From aa0e0de1d93bcc8ed4c6a8ce092fc45a4ce76996 Mon Sep 17 00:00:00 2001 From: mickski56 <35852605+mickski56@users.noreply.github.com> Date: Tue, 24 Jul 2018 22:48:50 +0100 Subject: [PATCH 0001/1292] address #6920 Proper analog trigger support --- input/drivers_joypad/udev_joypad.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 4475c62e5f..2841032dda 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -80,6 +80,8 @@ struct udev_joypad char *path; int32_t vid; int32_t pid; + /* Deal with analog triggers that report -32767 to 32767 */ + bool neg_trigger[NUM_AXES]; }; struct joypad_udev_entry @@ -217,6 +219,14 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char if (abs->maximum > abs->minimum) { pad->axes[axes] = udev_compute_axis(abs, abs->value); + /* Deal with analog triggers that report -32767 to 32767 + by testing if the axis initial value is negative, allowing for + for some slop (1300 =~ 4%)in an axis centred around 0. + The actual work is done in udev_joypad_axis. + All bets are off if you're sitting on it. Reinitailise it by unpluging + and plugging back in. */ + if (udev_compute_axis(abs, abs->value) < -1300) + pad->neg_trigger[i] = true; pad->axes_bind[i] = axes++; } } @@ -662,12 +672,20 @@ static int16_t udev_joypad_axis(unsigned port, uint32_t joyaxis) if (AXIS_NEG_GET(joyaxis) < NUM_AXES) { val = pad->axes[AXIS_NEG_GET(joyaxis)]; + /* Deal with analog triggers that report -32767 to 32767 */ + if (((AXIS_NEG_GET(joyaxis) == ABS_Z) || (AXIS_NEG_GET(joyaxis) == ABS_RZ)) + && (pad->neg_trigger[AXIS_NEG_GET(joyaxis)])) + val = (val + 0x7fff) / 2; if (val > 0) val = 0; } else if (AXIS_POS_GET(joyaxis) < NUM_AXES) { val = pad->axes[AXIS_POS_GET(joyaxis)]; + /* Deal with analog triggers that report -32767 to 32767 */ + if (((AXIS_POS_GET(joyaxis) == ABS_Z) || (AXIS_POS_GET(joyaxis) == ABS_RZ)) + && (pad->neg_trigger[AXIS_POS_GET(joyaxis)])) + val = (val + 0x7fff) / 2; if (val < 0) val = 0; } From e2fc3c11a6cc9a5b73baf65173d61581cf649b95 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Tue, 31 Jul 2018 22:21:36 +0100 Subject: [PATCH 0002/1292] Added rcheevos as a dependency --- deps/rcheevos/CHANGELOG.md | 77 + deps/rcheevos/LICENSE | 21 + deps/rcheevos/README.md | 509 + deps/rcheevos/include/rcheevos.h | 288 + deps/rcheevos/include/rjson.h | 122 + deps/rcheevos/include/rurl.h | 32 + deps/rcheevos/src/rcheevos/alloc.c | 17 + deps/rcheevos/src/rcheevos/condition.c | 125 + deps/rcheevos/src/rcheevos/condset.c | 174 + deps/rcheevos/src/rcheevos/expression.c | 41 + deps/rcheevos/src/rcheevos/format.c | 106 + deps/rcheevos/src/rcheevos/internal.h | 41 + deps/rcheevos/src/rcheevos/lboard.c | 233 + deps/rcheevos/src/rcheevos/operand.c | 450 + deps/rcheevos/src/rcheevos/term.c | 88 + deps/rcheevos/src/rcheevos/trigger.c | 100 + deps/rcheevos/src/rcheevos/value.c | 65 + deps/rcheevos/src/rjson/dejson.c | 750 ++ deps/rcheevos/src/rjson/dejson.h | 71 + deps/rcheevos/src/rjson/schema.c | 566 + deps/rcheevos/src/rjson/schema.dej | 75 + deps/rcheevos/src/rurl/url.c | 245 + deps/rcheevos/test/Makefile | 38 + deps/rcheevos/test/galaga_nes.json | 205 + deps/rcheevos/test/lua/Makefile | 114 + deps/rcheevos/test/lua/README | 6 + deps/rcheevos/test/lua/doc/contents.html | 619 + deps/rcheevos/test/lua/doc/index.css | 21 + deps/rcheevos/test/lua/doc/logo.gif | Bin 0 -> 9893 bytes deps/rcheevos/test/lua/doc/lua.1 | 112 + deps/rcheevos/test/lua/doc/lua.css | 164 + deps/rcheevos/test/lua/doc/luac.1 | 118 + deps/rcheevos/test/lua/doc/manual.css | 21 + deps/rcheevos/test/lua/doc/manual.html | 10985 ++++++++++++++++ .../test/lua/doc/osi-certified-72x60.png | Bin 0 -> 3774 bytes deps/rcheevos/test/lua/doc/readme.html | 365 + deps/rcheevos/test/lua/src/Makefile | 197 + deps/rcheevos/test/lua/src/lapi.c | 1298 ++ deps/rcheevos/test/lua/src/lapi.h | 24 + deps/rcheevos/test/lua/src/lauxlib.c | 1043 ++ deps/rcheevos/test/lua/src/lauxlib.h | 264 + deps/rcheevos/test/lua/src/lbaselib.c | 498 + deps/rcheevos/test/lua/src/lbitlib.c | 233 + deps/rcheevos/test/lua/src/lcode.c | 1203 ++ deps/rcheevos/test/lua/src/lcode.h | 88 + deps/rcheevos/test/lua/src/lcorolib.c | 168 + deps/rcheevos/test/lua/src/lctype.c | 55 + deps/rcheevos/test/lua/src/lctype.h | 95 + deps/rcheevos/test/lua/src/ldblib.c | 456 + deps/rcheevos/test/lua/src/ldebug.c | 698 + deps/rcheevos/test/lua/src/ldebug.h | 39 + deps/rcheevos/test/lua/src/ldo.c | 802 ++ deps/rcheevos/test/lua/src/ldo.h | 58 + deps/rcheevos/test/lua/src/ldump.c | 215 + deps/rcheevos/test/lua/src/lfunc.c | 151 + deps/rcheevos/test/lua/src/lfunc.h | 61 + deps/rcheevos/test/lua/src/lgc.c | 1178 ++ deps/rcheevos/test/lua/src/lgc.h | 147 + deps/rcheevos/test/lua/src/linit.c | 68 + deps/rcheevos/test/lua/src/liolib.c | 771 ++ deps/rcheevos/test/lua/src/llex.c | 565 + deps/rcheevos/test/lua/src/llex.h | 85 + deps/rcheevos/test/lua/src/llimits.h | 323 + deps/rcheevos/test/lua/src/lmathlib.c | 410 + deps/rcheevos/test/lua/src/lmem.c | 100 + deps/rcheevos/test/lua/src/lmem.h | 69 + deps/rcheevos/test/lua/src/loadlib.c | 790 ++ deps/rcheevos/test/lua/src/lobject.c | 521 + deps/rcheevos/test/lua/src/lobject.h | 549 + deps/rcheevos/test/lua/src/lopcodes.c | 124 + deps/rcheevos/test/lua/src/lopcodes.h | 297 + deps/rcheevos/test/lua/src/loslib.c | 407 + deps/rcheevos/test/lua/src/lparser.c | 1650 +++ deps/rcheevos/test/lua/src/lparser.h | 133 + deps/rcheevos/test/lua/src/lprefix.h | 45 + deps/rcheevos/test/lua/src/lstate.c | 347 + deps/rcheevos/test/lua/src/lstate.h | 235 + deps/rcheevos/test/lua/src/lstring.c | 248 + deps/rcheevos/test/lua/src/lstring.h | 49 + deps/rcheevos/test/lua/src/lstrlib.c | 1584 +++ deps/rcheevos/test/lua/src/ltable.c | 669 + deps/rcheevos/test/lua/src/ltable.h | 66 + deps/rcheevos/test/lua/src/ltablib.c | 450 + deps/rcheevos/test/lua/src/ltm.c | 165 + deps/rcheevos/test/lua/src/ltm.h | 76 + deps/rcheevos/test/lua/src/lua.c | 612 + deps/rcheevos/test/lua/src/lua.h | 486 + deps/rcheevos/test/lua/src/lua.hpp | 9 + deps/rcheevos/test/lua/src/luac.c | 449 + deps/rcheevos/test/lua/src/luaconf.h | 783 ++ deps/rcheevos/test/lua/src/lualib.h | 61 + deps/rcheevos/test/lua/src/lundump.c | 279 + deps/rcheevos/test/lua/src/lundump.h | 32 + deps/rcheevos/test/lua/src/lutf8lib.c | 256 + deps/rcheevos/test/lua/src/lvm.c | 1322 ++ deps/rcheevos/test/lua/src/lvm.h | 113 + deps/rcheevos/test/lua/src/lzio.c | 68 + deps/rcheevos/test/lua/src/lzio.h | 66 + deps/rcheevos/test/smw_snes.json | 606 + deps/rcheevos/test/test.c | 2183 +++ 100 files changed, 44056 insertions(+) create mode 100644 deps/rcheevos/CHANGELOG.md create mode 100644 deps/rcheevos/LICENSE create mode 100644 deps/rcheevos/README.md create mode 100644 deps/rcheevos/include/rcheevos.h create mode 100644 deps/rcheevos/include/rjson.h create mode 100644 deps/rcheevos/include/rurl.h create mode 100644 deps/rcheevos/src/rcheevos/alloc.c create mode 100644 deps/rcheevos/src/rcheevos/condition.c create mode 100644 deps/rcheevos/src/rcheevos/condset.c create mode 100644 deps/rcheevos/src/rcheevos/expression.c create mode 100644 deps/rcheevos/src/rcheevos/format.c create mode 100644 deps/rcheevos/src/rcheevos/internal.h create mode 100644 deps/rcheevos/src/rcheevos/lboard.c create mode 100644 deps/rcheevos/src/rcheevos/operand.c create mode 100644 deps/rcheevos/src/rcheevos/term.c create mode 100644 deps/rcheevos/src/rcheevos/trigger.c create mode 100644 deps/rcheevos/src/rcheevos/value.c create mode 100644 deps/rcheevos/src/rjson/dejson.c create mode 100644 deps/rcheevos/src/rjson/dejson.h create mode 100644 deps/rcheevos/src/rjson/schema.c create mode 100644 deps/rcheevos/src/rjson/schema.dej create mode 100644 deps/rcheevos/src/rurl/url.c create mode 100644 deps/rcheevos/test/Makefile create mode 100644 deps/rcheevos/test/galaga_nes.json create mode 100644 deps/rcheevos/test/lua/Makefile create mode 100644 deps/rcheevos/test/lua/README create mode 100644 deps/rcheevos/test/lua/doc/contents.html create mode 100644 deps/rcheevos/test/lua/doc/index.css create mode 100644 deps/rcheevos/test/lua/doc/logo.gif create mode 100644 deps/rcheevos/test/lua/doc/lua.1 create mode 100644 deps/rcheevos/test/lua/doc/lua.css create mode 100644 deps/rcheevos/test/lua/doc/luac.1 create mode 100644 deps/rcheevos/test/lua/doc/manual.css create mode 100644 deps/rcheevos/test/lua/doc/manual.html create mode 100644 deps/rcheevos/test/lua/doc/osi-certified-72x60.png create mode 100644 deps/rcheevos/test/lua/doc/readme.html create mode 100644 deps/rcheevos/test/lua/src/Makefile create mode 100644 deps/rcheevos/test/lua/src/lapi.c create mode 100644 deps/rcheevos/test/lua/src/lapi.h create mode 100644 deps/rcheevos/test/lua/src/lauxlib.c create mode 100644 deps/rcheevos/test/lua/src/lauxlib.h create mode 100644 deps/rcheevos/test/lua/src/lbaselib.c create mode 100644 deps/rcheevos/test/lua/src/lbitlib.c create mode 100644 deps/rcheevos/test/lua/src/lcode.c create mode 100644 deps/rcheevos/test/lua/src/lcode.h create mode 100644 deps/rcheevos/test/lua/src/lcorolib.c create mode 100644 deps/rcheevos/test/lua/src/lctype.c create mode 100644 deps/rcheevos/test/lua/src/lctype.h create mode 100644 deps/rcheevos/test/lua/src/ldblib.c create mode 100644 deps/rcheevos/test/lua/src/ldebug.c create mode 100644 deps/rcheevos/test/lua/src/ldebug.h create mode 100644 deps/rcheevos/test/lua/src/ldo.c create mode 100644 deps/rcheevos/test/lua/src/ldo.h create mode 100644 deps/rcheevos/test/lua/src/ldump.c create mode 100644 deps/rcheevos/test/lua/src/lfunc.c create mode 100644 deps/rcheevos/test/lua/src/lfunc.h create mode 100644 deps/rcheevos/test/lua/src/lgc.c create mode 100644 deps/rcheevos/test/lua/src/lgc.h create mode 100644 deps/rcheevos/test/lua/src/linit.c create mode 100644 deps/rcheevos/test/lua/src/liolib.c create mode 100644 deps/rcheevos/test/lua/src/llex.c create mode 100644 deps/rcheevos/test/lua/src/llex.h create mode 100644 deps/rcheevos/test/lua/src/llimits.h create mode 100644 deps/rcheevos/test/lua/src/lmathlib.c create mode 100644 deps/rcheevos/test/lua/src/lmem.c create mode 100644 deps/rcheevos/test/lua/src/lmem.h create mode 100644 deps/rcheevos/test/lua/src/loadlib.c create mode 100644 deps/rcheevos/test/lua/src/lobject.c create mode 100644 deps/rcheevos/test/lua/src/lobject.h create mode 100644 deps/rcheevos/test/lua/src/lopcodes.c create mode 100644 deps/rcheevos/test/lua/src/lopcodes.h create mode 100644 deps/rcheevos/test/lua/src/loslib.c create mode 100644 deps/rcheevos/test/lua/src/lparser.c create mode 100644 deps/rcheevos/test/lua/src/lparser.h create mode 100644 deps/rcheevos/test/lua/src/lprefix.h create mode 100644 deps/rcheevos/test/lua/src/lstate.c create mode 100644 deps/rcheevos/test/lua/src/lstate.h create mode 100644 deps/rcheevos/test/lua/src/lstring.c create mode 100644 deps/rcheevos/test/lua/src/lstring.h create mode 100644 deps/rcheevos/test/lua/src/lstrlib.c create mode 100644 deps/rcheevos/test/lua/src/ltable.c create mode 100644 deps/rcheevos/test/lua/src/ltable.h create mode 100644 deps/rcheevos/test/lua/src/ltablib.c create mode 100644 deps/rcheevos/test/lua/src/ltm.c create mode 100644 deps/rcheevos/test/lua/src/ltm.h create mode 100644 deps/rcheevos/test/lua/src/lua.c create mode 100644 deps/rcheevos/test/lua/src/lua.h create mode 100644 deps/rcheevos/test/lua/src/lua.hpp create mode 100644 deps/rcheevos/test/lua/src/luac.c create mode 100644 deps/rcheevos/test/lua/src/luaconf.h create mode 100644 deps/rcheevos/test/lua/src/lualib.h create mode 100644 deps/rcheevos/test/lua/src/lundump.c create mode 100644 deps/rcheevos/test/lua/src/lundump.h create mode 100644 deps/rcheevos/test/lua/src/lutf8lib.c create mode 100644 deps/rcheevos/test/lua/src/lvm.c create mode 100644 deps/rcheevos/test/lua/src/lvm.h create mode 100644 deps/rcheevos/test/lua/src/lzio.c create mode 100644 deps/rcheevos/test/lua/src/lzio.h create mode 100644 deps/rcheevos/test/smw_snes.json create mode 100644 deps/rcheevos/test/test.c diff --git a/deps/rcheevos/CHANGELOG.md b/deps/rcheevos/CHANGELOG.md new file mode 100644 index 0000000000..98e803bd21 --- /dev/null +++ b/deps/rcheevos/CHANGELOG.md @@ -0,0 +1,77 @@ +# v6.3.1 + +* Pass the peek function and the user data to the Lua functions used in operands. + +# v6.3.0 + +* Added **rurl**, an API to build URLs to access RetroAchievements web services. + +# v6.2.0 + +* Added **rjson**, an API to easily decode RetroAchievements JSON files into C structures. + +# v6.1.0 + +* Added support for 24-bit operands with the `'W'` prefix (`RC_OPERAND_24_BITS`) + +# v6.0.2 + +* Only define RC_ALIGNMENT if it has not been already defined + +# v6.0.1 + +* Use `sizeof(void*)` as a better default for `RC_ALIGNMENT` + +# v6.0.0 + +* Simplified API: separate functions to get the buffer size and to parse `memaddr` into the provided buffer +* Fixed crash trying to call `rc_update_condition_pause` during a dry-run +* The callers are now responsible to pass down a scratch buffer to avoid accesses to out-of-scope memory + +# v5.0.0 + +* Pre-compute if a condition has a pause condition in its group +* Added a pre-computed flag that tells if the condition set has at least one pause condition +* Removed the link to the previous condition in a condition set chain + +# v4.0.0 + +* Fixed `ret` not being properly initialized in `rc_parse_trigger` +* Build the unit tests with optimizations and `-Wall` to help catch more issues +* Added `extern "C"` around the inclusion of the Lua headers so that **rcheevos** can be compiled cleanly as C++ +* Exposed `rc_parse_value` and `rc_evaluate_value` to be used with rich presence +* Removed the `reset` and `dirty` flags from the external API + +# v3.2.0 + +* Added the ability to reset triggers and leaderboards +* Add a function to parse a format string and return the format enum, and some unit tests for it + +# v3.1.0 + +* Added `rc_format_value` to the API + +# v3.0.1 + +* Fixed wrong 32-bit value on 64-bit platforms + +# v3.0.0 + +* Removed function rc_evaluate_value from the API + +# v2.0.0 + +* Removed leaderboard callbacks in favor of a simpler scheme + +# v1.1.2 + +* Fixed NULL pointer deference when there's an error during the parse + +# v1.1.1 + +* Removed unwanted garbage +* Should be v1.0.1 :/ + +# v1.0.0 + +* First version diff --git a/deps/rcheevos/LICENSE b/deps/rcheevos/LICENSE new file mode 100644 index 0000000000..5f1faf3dc4 --- /dev/null +++ b/deps/rcheevos/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 RetroAchievements.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/deps/rcheevos/README.md b/deps/rcheevos/README.md new file mode 100644 index 0000000000..5bf1303e58 --- /dev/null +++ b/deps/rcheevos/README.md @@ -0,0 +1,509 @@ +# **rcheevos** + +**rcheevos** is a set of C code, or a library if you will, that tries to make it easier for emulators to process [RetroAchievements](https://retroachievements.org) data, providing support for achievements and leaderboards for their players. + +Keep in mind that **rcheevos** does *not* provide HTTP network connections or JSON parsing. Clients must get data from RetroAchievements, parse the JSON payloads and pass the results down to **rcheevos** for processing. (**TODO**: document the server API and JSON schema.) + +Not all structures defined by **rcheevos** can be created via the public API, but are exposed to allow interactions beyond just creation, destruction, and testing, such as the ones required by UI code that helps to create them. + +Finally, **rcheevos** does *not* allocate or manage memory by itself. All structures that can be returned by it have a function to determine the number of bytes needed to hold the structure, and another one that actually builds the structure using a caller-provided buffer to bake it. However, calls to **rcheevos** may allocate and/or free memory as part of the Lua runtime, which is a dependency. + +## Lua + +RetroAchievements has decided to support achievements written using the [Lua](https://www.lua.org) language. The current expression-based implementation was too limiting already for the Nintendo 64, and was preventing the support of other systems. + +> **rcheevos** does *not* create or maintain a Lua state, you have to create your own state and provide it to **rcheevos** to be used when Lua-coded achievements are found. + +Lua functions used in trigger operands receive two parameters: `peek`, which is used to read from the emulated system's memory, and `userdata`, which must be passed to `peek`. `peek`'s signature is the same as its C counterpart: + +```lua +function peek(address, num_bytes, userdata) +``` + +## API + +> An understanding about how achievements are developed may be useful, you can read more about it [here](http://docs.retroachievements.org/Developer-docs/). + +### User Configuration + +There's only one thing that can be configured by users of **rcheevos**: `RC_ALIGNMENT`. This macro holds the alignment of allocations made in the buffer provided to the parsing functions, and the default value is `sizeof(void*)`. + +If your platform will benefit from a different value, define a new value for it on your compiler flags before compiling the code. It has to be a power of 2, but no checking is done. + +### Return values + +The functions that compute the amount of memory that something will take return the number of bytes, or a negative value from the following enumeration: + +```c +enum { + RC_OK = 0, + RC_INVALID_LUA_OPERAND = -1, + RC_INVALID_MEMORY_OPERAND = -2, + RC_INVALID_CONST_OPERAND = -3, + RC_INVALID_FP_OPERAND = -4, + RC_INVALID_CONDITION_TYPE = -5, + RC_INVALID_OPERATOR = -6, + RC_INVALID_REQUIRED_HITS = -7, + RC_DUPLICATED_START = -8, + RC_DUPLICATED_CANCEL = -9, + RC_DUPLICATED_SUBMIT = -10, + RC_DUPLICATED_VALUE = -11, + RC_DUPLICATED_PROGRESS = -12, + RC_MISSING_START = -13, + RC_MISSING_CANCEL = -14, + RC_MISSING_SUBMIT = -15, + RC_MISSING_VALUE = -16, + RC_INVALID_LBOARD_FIELD = -17 +}; +``` + +### `rc_operand_t` + +An operand is the leaf node of RetroAchievements expressions, and can hold one of the following: + +* A constant integer or floating-point value +* A memory address of the system being emulated +* A reference to the Lua function that will be called to provide the value + +```c +typedef struct { + union { + /* A value read from memory. */ + struct { + /* The memory address or constant value of this variable. */ + unsigned value; + /* The previous memory contents if RC_OPERAND_DELTA. */ + unsigned previous; + + /* The size of the variable. */ + char size; + /* True if the value is in BCD. */ + char is_bcd; + /* The type of the variable. */ + }; + + /* A floating point value. */ + double fp_value; + + /* A reference to the Lua function that provides the value. */ + int function_ref; + }; + + char type; +} +rc_operand_t; +``` + +The `size` field, when applicable, holds one of these values: + +```c +enum { + RC_OPERAND_BIT_0, + RC_OPERAND_BIT_1, + RC_OPERAND_BIT_2, + RC_OPERAND_BIT_3, + RC_OPERAND_BIT_4, + RC_OPERAND_BIT_5, + RC_OPERAND_BIT_6, + RC_OPERAND_BIT_7, + RC_OPERAND_LOW, + RC_OPERAND_HIGH, + RC_OPERAND_8_BITS, + RC_OPERAND_16_BITS, + RC_OPERAND_24_BITS, + RC_OPERAND_32_BITS, +}; +``` + +The `type` field is always valid, and holds one of these values: + +```c +enum { + RC_OPERAND_ADDRESS, /* Compare to the value of a live address in RAM. */ + RC_OPERAND_DELTA, /* The value last known at this address. */ + RC_OPERAND_CONST, /* A 32-bit unsigned integer. */ + RC_OPERAND_FP, /* A floating point value. */ + RC_OPERAND_LUA /* A Lua function that provides the value. */ +}; +``` + +`RC_OPERAND_ADDRESS`, `RC_OPERAND_DELTA` and `RC_OPERAND_CONST` mean that the anonymous structure in the union is active. `RC_OPERAND_FP` means that `fp_value` is active. `RC_OPERAND_LUA` means `function_ref` is active. + + +### `rc_condition_t` + +A condition compares its two operands according to the defined operator. It also keeps track of other things to make it possible to code more advanced achievements. + +```c +typedef struct rc_condition_t rc_condition_t; + +struct rc_condition_t { + /* The next condition in the chain. */ + rc_condition_t* next; + + /* The condition's operands. */ + rc_operand_t operand1; + rc_operand_t operand2; + + /* Required hits to fire this condition. */ + unsigned required_hits; + /* Number of hits so far. */ + unsigned current_hits; + + /** + * Set if the condition needs to processed as part of the "check if paused" + * pass + */ + char pause; + + /* The type of the condition. */ + char type; + /* The comparison operator to use. */ + char oper; /* operator is a reserved word in C++. */ +}; +``` + +`type` can be one of these values: + +```c +enum { + RC_CONDITION_STANDARD, + RC_CONDITION_PAUSE_IF, + RC_CONDITION_RESET_IF, + RC_CONDITION_ADD_SOURCE, + RC_CONDITION_SUB_SOURCE, + RC_CONDITION_ADD_HITS +}; +``` + +`oper` is the comparison operator to be used when comparing the two operands: + +```c +enum { + RC_CONDITION_EQ, + RC_CONDITION_LT, + RC_CONDITION_LE, + RC_CONDITION_GT, + RC_CONDITION_GE, + RC_CONDITION_NE +}; +``` + +### `rc_condset_t` + +Condition sets are an ordered collection of conditions (`rc_condition_t`), which are usually and'ed together to help build complex expressions for achievements. + +```c +typedef struct rc_condset_t rc_condset_t; + +struct rc_condset_t { + /* The next condition set in the chain. */ + rc_condset_t* next; + + /* The list of conditions in this condition set. */ + rc_condition_t* conditions; + + /* True if any condition in the set is a pause condition. */ + char has_pause; +}; +``` + +### `rc_trigger_t` + +Triggers are the basic blocks of achievements and leaderboards. In fact, achievements are just triggers with some additional information like title, description, a badge, and some state, like whether it has already been awarded or not. All the logic to test if an achievement should be awarded is encapsulated in `rc_trigger_t`. + +```c +typedef struct { + /* The main condition set. */ + rc_condset_t* requirement; + + /* The list of sub condition sets in this test. */ + rc_condset_t* alternative; +} +rc_trigger_t; +``` + +The size in bytes of memory a trigger needs to be created is given by the `rc_trigger_size` function: + +```c +int rc_trigger_size(const char* memaddr); +``` + +The return value is the size needed for the trigger described by the `memaddr` parameter, or a negative value with an [error code](#return-values). + +Once the memory size is known, `rc_parse_trigger` can be called to actually construct a trigger in the caller-provided buffer: + +```c +rc_trigger_t* rc_parse_trigger(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx); +``` + +`buffer` is the caller-allocated buffer, which must have enough space for the trigger. `memaddr` describes the trigger, and must be the same one used to compute the trigger's size with `rc_trigger_size`. `L` must be a valid Lua state, and `funcs_ndx` must be an index to the current Lua stack which contains a table which is a map of names to functions. This map is used to look for operands which are Lua functions. + +Once the trigger is created, `rc_test_trigger` can be called to test whether the trigger fires or not. + +```c +int rc_test_trigger(rc_trigger_t* trigger, rc_peek_t peek, void* ud, lua_State* L); +``` + +`trigger` is the trigger to test. `peek` is a callback used to read bytes from the emulated memory. `ud` is an user-provided opaque value that is passed to `peek`. `L` is the Lua state in which context the Lua functions are looked for and called, if necessary. + +`rc_peek_t`'s signature is: + +```c +typedef unsigned (*rc_peek_t)(unsigned address, unsigned num_bytes, void* ud); +``` + +where `address` is the starting address to read from, `num_bytes` the number of bytes to read (1, 2, or 4, little-endian), and `ud` is the same value passed to `rc_test_trigger`. + +> Addresses passed to `peek` do *not* map 1:1 to the emulated memory. (**TODO**: document the mapping from `peek` addresses to emulated memory for each supported system.) + +Finally, `rc_reset_trigger` can be used to reset the internal state of a trigger. + +```c +void rc_reset_trigger(rc_trigger_t* self); +``` + +### `rc_term_t` + +A term is the leaf node of expressions used to compute values from operands. A term is evaluated by multiplying its two operands. `invert` is used to invert the bits of the second operand of the term, when the unary operator `~` is used. + +```c +typedef struct rc_term_t rc_term_t; + +struct rc_term_t { + /* The next term in this chain. */ + rc_term_t* next; + + /* The first operand. */ + rc_operand_t operand1; + /* The second operand. */ + rc_operand_t operand2; + + /* A value that is applied to the second variable to invert its bits. */ + unsigned invert; +}; +``` + +### `rc_expression_t` + +An expression is a collection of terms. All terms in the collection are added together to give the value of the expression. + +```c +typedef struct rc_expression_t rc_expression_t; + +struct rc_expression_t { + /* The next expression in this chain. */ + rc_expression_t* next; + + /* The list of terms in this expression. */ + rc_term_t* terms; +}; +``` + +### `rc_value_t` + +A value is a collection of expressions. It's used to give the value for a leaderboard, and it evaluates to value of the expression with the greatest value in the collection. + +```c +typedef struct { + /* The list of expression to evaluate. */ + rc_expression_t* expressions; +} +rc_value_t; +``` + +The size in bytes needed to create a value can be computed by `rc_value_size`: + +```c +int rc_value_size(const char* memaddr); +``` + +With the size at hand, the caller can allocate the necessary memory and pass it to `rc_parse_value` to create the value: + +```c +rc_value_t* rc_parse_value(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx); +``` + +`buffer`, `memaddr`, `L`, and `funcs_ndx` are the same as in [`rc_parse_trigger`](#rc_parse_trigger). + +To compute the value, use `rc_evaluate_value`: + +```c +unsigned rc_evaluate_value(rc_value_t* value, rc_peek_t peek, void* ud, lua_State* L); +``` + +`value` is the value to compute the value of, and `peek`, `ud`, and `L`, are as in [`rc_test_trigger`](#rc_test_trigger). + +### `rc_lboard_t` + +Leaderboards track a value over time, starting when a trigger is fired. The leaderboard can be canceled depending on the value of another trigger, and submitted to the RetroAchievements server depending on a third trigger. + +The value submitted comes from the `value` field. Values displayed to the player come from the `progress` field unless it's `NULL`, in which case it's the same as `value`. + +```c +typedef struct { + rc_trigger_t start; + rc_trigger_t submit; + rc_trigger_t cancel; + rc_value_t value; + rc_value_t* progress; + + char started; + char submitted; +} +rc_lboard_t; +``` + +Leaderboards are created and parsed just the same as triggers and values: + +```c +int rc_lboard_size(const char* memaddr); +rc_lboard_t* rc_parse_lboard(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx); +``` + +A leaderboard can be evaluated with the `rc_evaluate_lboard` function: + +```c +int rc_evaluate_lboard(rc_lboard_t* lboard, unsigned* value, rc_peek_t peek, void* peek_ud, lua_State* L); +``` + +The function returns an action that must be performed by the caller, and `value` contains the value to be used for that action when the function returns. The action can be one of: + +```c +enum { + RC_LBOARD_INACTIVE, + RC_LBOARD_ACTIVE, + RC_LBOARD_STARTED, + RC_LBOARD_CANCELED, + RC_LBOARD_TRIGGERED +}; +``` + +The caller must keep track of these values and do the necessary actions: + +* `RC_LBOARD_ACTIVE` and `RC_LBOARD_INACTIVE`: just signal that the leaderboard didn't change its state. +* `RC_LBOARD_STARTED`: indicates that the leaderboard has been started, so the caller can i.e. show a message for the player, and start showing its value in the UI. +* `RC_LBOARD_CANCELED`: the leaderboard has been canceled, and the caller can inform the user and stop showing its value. +* `RC_LBOARD_TRIGGERED`: the leaderboard has been finished, and the value must be submitted to the RetroAchievements server; the caller can also notify the player and stop showing the value in the UI. + +`rc_reset_lboard` resets the leaderboard: + +```c +void rc_reset_lboard(rc_lboard_t* lboard); +``` + +### Value Formatting + +**rcheevos** includes helper functions to parse formatting strings from RetroAchievements, and format values according to them. + +`rc_parse_format` returns the format for the given string: + +```c +int rc_parse_format(const char* format_str); +``` + +The returned value is one of: + +```c +enum { + RC_FORMAT_FRAMES, + RC_FORMAT_SECONDS, + RC_FORMAT_CENTISECS, + RC_FORMAT_SCORE, + RC_FORMAT_VALUE, + RC_FORMAT_OTHER, +}; +``` + +`RC_FORMAT_VALUE` is returned if `format_str` doesn't contain a valid format. + +`rc_format_value` can be used to format the given value into the provided buffer: + +```c +void rc_format_value(char* buffer, int size, unsigned value, int format); +``` + +`buffer` receives `value` formatted according to `format`. No more than `size` characters will be written to `buffer`. 32 characters are enough to hold any valid value with any format. + +# **rjson** + +**rjson** provides parsing of RetroAchievements JSON files, and provides the results in strongly typed C structures instead of returning a generic dictionary and forcing the caller to check for values and extracting them. + +Similarly to **rcheevos**, **rjson** does *not* allocate any memory. The caller must use the functions that compute the size needed to parse a given JSON, allocate the necessary memory, and call another function that does the parsing. + +## API + +### Return values + +The functions that compute the memory needed for a given JSON return a positive value, which is the number of bytes needed. Errors are negative values taken from the following enumeration: + +```c +enum { + RC_JSON_OK = 0, + RC_JSON_OBJECT_EXPECTED = -1, + RC_JSON_UNKOWN_RECORD = -2, + RC_JSON_EOF_EXPECTED = -3, + RC_JSON_MISSING_KEY = -4, + RC_JSON_UNTERMINATED_KEY = -5, + RC_JSON_MISSING_VALUE = -6, + RC_JSON_UNTERMINATED_OBJECT = -7, + RC_JSON_INVALID_VALUE = -8, + RC_JSON_UNTERMINATED_STRING = -9, + RC_JSON_UNTERMINATED_ARRAY = -10, + RC_JSON_INVALID_ESCAPE = -11 +}; +``` + +### Supported schemas + +**rjson** supports the following JSON schemas. Please see `rjson.h` for the definition of the C structures: + +* `rc_json_gameid_t`: The game identifier returned by the server, given its hash. +* `rc_json_login_t`: The login token for the user, given their user name and password. +* `rc_json_patch_t`: The information about a game, given its identifier. It includes arrays with the achievements and leaderboards for the game. +* `rc_json_unlocks_t`: The list of achievements already awarded for the player, given the game identifier. Used to avoid the emulator awarding achievements more than once. + +For each schema there are two functions, for example: + +```c +int rc_json_get_patch_size(const char* json); +const rc_json_patch_t* rc_json_parse_patch(void* buffer, const char* json); +``` + +`rc_json_get_patch_size` returns the number of bytes needed to parse the given JSON as a `rc_json_patch_t`. `rc_json_parse_patch` parses the given JSON into the given `buffer`, returning a pointer that is used to access the decoded information. + +# **rurl** + +**rurl** builds URLs to access many RetroAchievements web services. Its purpose it to just to free the developer from having to URL-encode parameters and build correct URL that are valid for the server. + +**rurl** does *not* make HTTP requests. + +## API + +### Return values + +All functions return `0` if successful, or `-1` in case of errors. Errors are usually because the provided buffer is too small to hold the URL. If your buffer is large and you're still receiving errors, please open an issue. + +### Functions + +All functions take a `buffer`, where the URL will be written into, and `size` with the size of the buffer. The other parameters are particular to the desired URL. + +```c +int rc_url_award_cheevo(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned cheevo_id, int hardcore); + +int rc_url_submit_lboard(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned lboard_id, unsigned value, unsigned char hash[16]); + +int rc_url_get_gameid(char* buffer, size_t size, unsigned char hash[16]); + +int rc_url_get_patch(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid); + +int rc_url_get_badge_image(char* buffer, size_t size, const char* badge_name); + +int rc_url_login_with_password(char* buffer, size_t size, const char* user_name, const char* password); + +int rc_url_login_with_token(char* buffer, size_t size, const char* user_name, const char* login_token); + +int rc_url_get_unlock_list(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid, int hardcore); + +int rc_url_post_playing(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid); +``` diff --git a/deps/rcheevos/include/rcheevos.h b/deps/rcheevos/include/rcheevos.h new file mode 100644 index 0000000000..f9cfde39d2 --- /dev/null +++ b/deps/rcheevos/include/rcheevos.h @@ -0,0 +1,288 @@ +#ifndef RCHEEVOS_H +#define RCHEEVOS_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lua_State lua_State; + +/*****************************************************************************\ +| User configuration | +\*****************************************************************************/ + +#ifndef RC_ALIGNMENT +#define RC_ALIGNMENT sizeof(void*) +#endif + +/*****************************************************************************\ +| Return values | +\*****************************************************************************/ + +enum { + RC_OK = 0, + RC_INVALID_LUA_OPERAND = -1, + RC_INVALID_MEMORY_OPERAND = -2, + RC_INVALID_CONST_OPERAND = -3, + RC_INVALID_FP_OPERAND = -4, + RC_INVALID_CONDITION_TYPE = -5, + RC_INVALID_OPERATOR = -6, + RC_INVALID_REQUIRED_HITS = -7, + RC_DUPLICATED_START = -8, + RC_DUPLICATED_CANCEL = -9, + RC_DUPLICATED_SUBMIT = -10, + RC_DUPLICATED_VALUE = -11, + RC_DUPLICATED_PROGRESS = -12, + RC_MISSING_START = -13, + RC_MISSING_CANCEL = -14, + RC_MISSING_SUBMIT = -15, + RC_MISSING_VALUE = -16, + RC_INVALID_LBOARD_FIELD = -17 +}; + +/*****************************************************************************\ +| Callbacks | +\*****************************************************************************/ + +/** + * Callback used to read num_bytes bytes from memory starting at address. If + * num_bytes is greater than 1, the value is read in little-endian from + * memory. + */ +typedef unsigned (*rc_peek_t)(unsigned address, unsigned num_bytes, void* ud); + +/*****************************************************************************\ +| Operands | +\*****************************************************************************/ + +/* Sizes. */ +enum { + RC_OPERAND_BIT_0, + RC_OPERAND_BIT_1, + RC_OPERAND_BIT_2, + RC_OPERAND_BIT_3, + RC_OPERAND_BIT_4, + RC_OPERAND_BIT_5, + RC_OPERAND_BIT_6, + RC_OPERAND_BIT_7, + RC_OPERAND_LOW, + RC_OPERAND_HIGH, + RC_OPERAND_8_BITS, + RC_OPERAND_16_BITS, + RC_OPERAND_24_BITS, + RC_OPERAND_32_BITS, +}; + +/* types */ +enum { + RC_OPERAND_ADDRESS, /* Compare to the value of a live address in RAM. */ + RC_OPERAND_DELTA, /* The value last known at this address. */ + RC_OPERAND_CONST, /* A 32-bit unsigned integer. */ + RC_OPERAND_FP, /* A floating point value. */ + RC_OPERAND_LUA /* A Lua function that provides the value. */ +}; + +typedef struct { + union { + /* A value read from memory. */ + struct { + /* The memory address or constant value of this variable. */ + unsigned value; + /* The previous memory contents if RC_OPERAND_DELTA. */ + unsigned previous; + + /* The size of the variable. */ + char size; + /* True if the value is in BCD. */ + char is_bcd; + /* The type of the variable. */ + }; + + /* A floating point value. */ + double fp_value; + + /* A reference to the Lua function that provides the value. */ + int function_ref; + }; + + char type; +} +rc_operand_t; + +/*****************************************************************************\ +| Conditions | +\*****************************************************************************/ + +/* types */ +enum { + RC_CONDITION_STANDARD, + RC_CONDITION_PAUSE_IF, + RC_CONDITION_RESET_IF, + RC_CONDITION_ADD_SOURCE, + RC_CONDITION_SUB_SOURCE, + RC_CONDITION_ADD_HITS +}; + +/* operators */ +enum { + RC_CONDITION_EQ, + RC_CONDITION_LT, + RC_CONDITION_LE, + RC_CONDITION_GT, + RC_CONDITION_GE, + RC_CONDITION_NE +}; + +typedef struct rc_condition_t rc_condition_t; + +struct rc_condition_t { + /* The next condition in the chain. */ + rc_condition_t* next; + + /* The condition's operands. */ + rc_operand_t operand1; + rc_operand_t operand2; + + /* Required hits to fire this condition. */ + unsigned required_hits; + /* Number of hits so far. */ + unsigned current_hits; + + /** + * Set if the condition needs to processed as part of the "check if paused" + * pass + */ + char pause; + + /* The type of the condition. */ + char type; + /* The comparison operator to use. */ + char oper; /* operator is a reserved word in C++. */ +}; + +/*****************************************************************************\ +| Condition sets | +\*****************************************************************************/ + +typedef struct rc_condset_t rc_condset_t; + +struct rc_condset_t { + /* The next condition set in the chain. */ + rc_condset_t* next; + + /* The list of conditions in this condition set. */ + rc_condition_t* conditions; + + /* True if any condition in the set is a pause condition. */ + char has_pause; +}; + +/*****************************************************************************\ +| Trigger | +\*****************************************************************************/ + +typedef struct { + /* The main condition set. */ + rc_condset_t* requirement; + + /* The list of sub condition sets in this test. */ + rc_condset_t* alternative; +} +rc_trigger_t; + +int rc_trigger_size(const char* memaddr); +rc_trigger_t* rc_parse_trigger(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx); +int rc_test_trigger(rc_trigger_t* trigger, rc_peek_t peek, void* ud, lua_State* L); +void rc_reset_trigger(rc_trigger_t* self); + +/*****************************************************************************\ +| Expressions and values | +\*****************************************************************************/ + +typedef struct rc_term_t rc_term_t; + +struct rc_term_t { + /* The next term in this chain. */ + rc_term_t* next; + + /* The first operand. */ + rc_operand_t operand1; + /* The second operand. */ + rc_operand_t operand2; + + /* A value that is applied to the second variable to invert its bits. */ + unsigned invert; +}; + +typedef struct rc_expression_t rc_expression_t; + +struct rc_expression_t { + /* The next expression in this chain. */ + rc_expression_t* next; + + /* The list of terms in this expression. */ + rc_term_t* terms; +}; + +typedef struct { + /* The list of expression to evaluate. */ + rc_expression_t* expressions; +} +rc_value_t; + +int rc_value_size(const char* memaddr); +rc_value_t* rc_parse_value(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx); +unsigned rc_evaluate_value(rc_value_t* value, rc_peek_t peek, void* ud, lua_State* L); + +/*****************************************************************************\ +| Leaderboards | +\*****************************************************************************/ + +/* Return values for rc_evaluate_lboard. */ +enum { + RC_LBOARD_INACTIVE, + RC_LBOARD_ACTIVE, + RC_LBOARD_STARTED, + RC_LBOARD_CANCELED, + RC_LBOARD_TRIGGERED +}; + +typedef struct { + rc_trigger_t start; + rc_trigger_t submit; + rc_trigger_t cancel; + rc_value_t value; + rc_value_t* progress; + + char started; + char submitted; +} +rc_lboard_t; + +int rc_lboard_size(const char* memaddr); +rc_lboard_t* rc_parse_lboard(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx); +int rc_evaluate_lboard(rc_lboard_t* lboard, unsigned* value, rc_peek_t peek, void* peek_ud, lua_State* L); +void rc_reset_lboard(rc_lboard_t* lboard); + +/*****************************************************************************\ +| Value formatting | +\*****************************************************************************/ + +/* Supported formats. */ +enum { + RC_FORMAT_FRAMES, + RC_FORMAT_SECONDS, + RC_FORMAT_CENTISECS, + RC_FORMAT_SCORE, + RC_FORMAT_VALUE, + RC_FORMAT_OTHER, +}; + +int rc_parse_format(const char* format_str); +void rc_format_value(char* buffer, int size, unsigned value, int format); + +#ifdef __cplusplus +} +#endif + +#endif /* RCHEEVOS_H */ diff --git a/deps/rcheevos/include/rjson.h b/deps/rcheevos/include/rjson.h new file mode 100644 index 0000000000..e8d5aa04ca --- /dev/null +++ b/deps/rcheevos/include/rjson.h @@ -0,0 +1,122 @@ +#ifndef RJSON_H +#define RJSON_H + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + RC_JSON_OK = 0, + RC_JSON_OBJECT_EXPECTED = -1, + RC_JSON_UNKOWN_RECORD = -2, + RC_JSON_EOF_EXPECTED = -3, + RC_JSON_MISSING_KEY = -4, + RC_JSON_UNTERMINATED_KEY = -5, + RC_JSON_MISSING_VALUE = -6, + RC_JSON_UNTERMINATED_OBJECT = -7, + RC_JSON_INVALID_VALUE = -8, + RC_JSON_UNTERMINATED_STRING = -9, + RC_JSON_UNTERMINATED_ARRAY = -10, + RC_JSON_INVALID_ESCAPE = -11 +}; + +typedef struct { + unsigned int gameid; + char success; +} +rc_json_gameid_t; + +int rc_json_get_gameid_size(const char* json); +const rc_json_gameid_t* rc_json_parse_gameid(void* buffer, const char* json); + +typedef struct { + const char* token; + const char* user; + unsigned int score; + unsigned int messages; + char success; +} +rc_json_login_t; + +int rc_json_get_login_size(const char* json); +const rc_json_login_t* rc_json_parse_login(void* buffer, const char* json); + +typedef struct { + unsigned long long created; + unsigned long long modified; + const char* author; + const char* badge; + const char* description; + const char* memaddr; + const char* title; + unsigned int flags; + unsigned int points; + unsigned int id; +} +rc_json_cheevo_t; + +int rc_json_get_cheevo_size(const char* json); +const rc_json_cheevo_t* rc_json_parse_cheevo(void* buffer, const char* json); + +typedef struct { + const char* description; + const char* title; + const char* format; + const char* mem; + unsigned int id; +} +rc_json_lboard_t; + +int rc_json_get_lboard_size(const char* json); +const rc_json_lboard_t* rc_json_parse_lboard(void* buffer, const char* json); + +typedef struct { + const rc_json_lboard_t* lboards; int lboards_count; + const char* genre; + const char* developer; + const char* publisher; + const char* released; + const char** presence; + const char* console; + const rc_json_cheevo_t* cheevos; int cheevos_count; + const char* image_boxart; + const char* image_title; + const char* image_icon; + const char* title; + const char* image_ingame; + unsigned int consoleid; + unsigned int id; + unsigned int flags; + unsigned int topicid; + char is_final; +} +rc_json_patchdata_t; + +int rc_json_get_patchdata_size(const char* json); +const rc_json_patchdata_t* rc_json_parse_patchdata(void* buffer, const char* json); + +typedef struct { + rc_json_patchdata_t patchdata; + char success; +} +rc_json_patch_t; + +int rc_json_get_patch_size(const char* json); +const rc_json_patch_t* rc_json_parse_patch(void* buffer, const char* json); + +typedef struct { + const unsigned int* ids; int ids_count; + unsigned int gameid; + char success; + char hardcore; +} +rc_json_unlocks_t; + +int rc_json_get_unlocks_size(const char* json); +const rc_json_unlocks_t* rc_json_parse_unlocks(void* buffer, const char* json); + +#ifdef __cplusplus +} +#endif + +#endif /* RJSON_H */ diff --git a/deps/rcheevos/include/rurl.h b/deps/rcheevos/include/rurl.h new file mode 100644 index 0000000000..8c81050cc5 --- /dev/null +++ b/deps/rcheevos/include/rurl.h @@ -0,0 +1,32 @@ +#ifndef RURL_H +#define RURL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int rc_url_award_cheevo(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned cheevo_id, int hardcore); + +int rc_url_submit_lboard(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned lboard_id, unsigned value, unsigned char hash[16]); + +int rc_url_get_gameid(char* buffer, size_t size, unsigned char hash[16]); + +int rc_url_get_patch(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid); + +int rc_url_get_badge_image(char* buffer, size_t size, const char* badge_name); + +int rc_url_login_with_password(char* buffer, size_t size, const char* user_name, const char* password); + +int rc_url_login_with_token(char* buffer, size_t size, const char* user_name, const char* login_token); + +int rc_url_get_unlock_list(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid, int hardcore); + +int rc_url_post_playing(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid); + +#ifdef __cplusplus +} +#endif + +#endif /* RURL_H */ diff --git a/deps/rcheevos/src/rcheevos/alloc.c b/deps/rcheevos/src/rcheevos/alloc.c new file mode 100644 index 0000000000..93700932ff --- /dev/null +++ b/deps/rcheevos/src/rcheevos/alloc.c @@ -0,0 +1,17 @@ +#include "internal.h" + +void* rc_alloc(void* pointer, int* offset, int size, rc_scratch_t* scratch) { + void* ptr; + + *offset = (*offset + RC_ALIGNMENT - 1) & -RC_ALIGNMENT; + + if (pointer != 0) { + ptr = (void*)((char*)pointer + *offset); + } + else { + ptr = scratch; + } + + *offset += size; + return ptr; +} diff --git a/deps/rcheevos/src/rcheevos/condition.c b/deps/rcheevos/src/rcheevos/condition.c new file mode 100644 index 0000000000..93130327a2 --- /dev/null +++ b/deps/rcheevos/src/rcheevos/condition.c @@ -0,0 +1,125 @@ +#include "internal.h" + +#include + +rc_condition_t* rc_parse_condition(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx) { + rc_condition_t* self; + const char* aux; + int ret2; + + aux = *memaddr; + self = (rc_condition_t*)rc_alloc(buffer, ret, sizeof(rc_condition_t), scratch); + self->current_hits = 0; + + if (*aux != 0 && aux[1] == ':') { + switch (*aux) { + case 'p': case 'P': self->type = RC_CONDITION_PAUSE_IF; break; + case 'r': case 'R': self->type = RC_CONDITION_RESET_IF; break; + case 'a': case 'A': self->type = RC_CONDITION_ADD_SOURCE; break; + case 'b': case 'B': self->type = RC_CONDITION_SUB_SOURCE; break; + case 'c': case 'C': self->type = RC_CONDITION_ADD_HITS; break; + default: *ret = RC_INVALID_CONDITION_TYPE; return 0; + } + + aux += 2; + } + else { + self->type = RC_CONDITION_STANDARD; + } + + ret2 = rc_parse_operand(&self->operand1, &aux, 1, L, funcs_ndx); + + if (ret2 < 0) { + *ret = ret2; + return 0; + } + + switch (*aux++) { + case '=': + self->oper = RC_CONDITION_EQ; + aux += *aux == '='; + break; + + case '!': + if (*aux++ != '=') { + /* fall through */ + default: + *ret = RC_INVALID_OPERATOR; + return 0; + } + + self->oper = RC_CONDITION_NE; + break; + + case '<': + self->oper = RC_CONDITION_LT; + + if (*aux == '=') { + self->oper = RC_CONDITION_LE; + aux++; + } + + break; + + case '>': + self->oper = RC_CONDITION_GT; + + if (*aux == '=') { + self->oper = RC_CONDITION_GE; + aux++; + } + + break; + } + + ret2 = rc_parse_operand(&self->operand2, &aux, 1, L, funcs_ndx); + + if (ret2 < 0) { + *ret = ret2; + return 0; + } + + if (*aux == '(') { + char* end; + self->required_hits = (unsigned)strtoul(++aux, &end, 10); + + if (end == aux || *end != ')') { + *ret = RC_INVALID_REQUIRED_HITS; + return 0; + } + + aux = end + 1; + } + else if (*aux == '.') { + char* end; + self->required_hits = (unsigned)strtoul(++aux, &end, 10); + + if (end == aux || *end != '.') { + *ret = RC_INVALID_REQUIRED_HITS; + return 0; + } + + aux = end + 1; + } + else { + self->required_hits = 0; + } + + *memaddr = aux; + return self; +} + +int rc_test_condition(rc_condition_t* self, unsigned add_buffer, rc_peek_t peek, void* ud, lua_State* L) { + unsigned value1 = rc_evaluate_operand(&self->operand1, peek, ud, L) + add_buffer; + unsigned value2 = rc_evaluate_operand(&self->operand2, peek, ud, L); + + switch (self->oper) { + case RC_CONDITION_EQ: return value1 == value2; + case RC_CONDITION_NE: return value1 != value2; + case RC_CONDITION_LT: return value1 < value2; + case RC_CONDITION_LE: return value1 <= value2; + case RC_CONDITION_GT: return value1 > value2; + case RC_CONDITION_GE: return value1 >= value2; + default: return 1; + } +} diff --git a/deps/rcheevos/src/rcheevos/condset.c b/deps/rcheevos/src/rcheevos/condset.c new file mode 100644 index 0000000000..b7e93c2608 --- /dev/null +++ b/deps/rcheevos/src/rcheevos/condset.c @@ -0,0 +1,174 @@ +#include "internal.h" + +static void rc_update_condition_pause(rc_condition_t* condition, int* in_pause) { + if (condition->next != 0) { + rc_update_condition_pause(condition->next, in_pause); + } + + switch (condition->type) { + case RC_CONDITION_PAUSE_IF: + *in_pause = condition->pause = 1; + break; + + case RC_CONDITION_ADD_SOURCE: + case RC_CONDITION_SUB_SOURCE: + case RC_CONDITION_ADD_HITS: + condition->pause = *in_pause; + break; + + default: + *in_pause = condition->pause = 0; + break; + } +} + +rc_condset_t* rc_parse_condset(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx) { + rc_condset_t* self; + rc_condition_t** next; + int in_pause; + + self = (rc_condset_t*)rc_alloc(buffer, ret, sizeof(rc_condset_t), scratch); + self->has_pause = 0; + next = &self->conditions; + + for (;;) { + *next = rc_parse_condition(ret, buffer, scratch, memaddr, L, funcs_ndx); + + if (*ret < 0) { + return 0; + } + + self->has_pause |= (*next)->type == RC_CONDITION_PAUSE_IF; + next = &(*next)->next; + + if (**memaddr != '_') { + break; + } + + (*memaddr)++; + } + + *next = 0; + + + if (buffer != 0) { + in_pause = 0; + rc_update_condition_pause(self->conditions, &in_pause); + } + + return self; +} + +static int rc_test_condset_internal(rc_condset_t* self, int processing_pause, int* reset, rc_peek_t peek, void* ud, lua_State* L) { + rc_condition_t* condition; + int set_valid, cond_valid; + unsigned add_buffer, add_hits; + + set_valid = 1; + add_buffer = add_hits = 0; + + for (condition = self->conditions; condition != 0; condition = condition->next) { + if (condition->pause != processing_pause) { + continue; + } + + switch (condition->type) { + case RC_CONDITION_ADD_SOURCE: + add_buffer += rc_evaluate_operand(&condition->operand1, peek, ud, L); + continue; + + case RC_CONDITION_SUB_SOURCE: + add_buffer -= rc_evaluate_operand(&condition->operand1, peek, ud, L); + continue; + + case RC_CONDITION_ADD_HITS: + if (rc_test_condition(condition, add_buffer, peek, ud, L)) { + if (condition->required_hits == 0 || condition->current_hits < condition->required_hits) { + condition->current_hits++; + } + } + + add_hits += condition->current_hits; + continue; + } + + /* always evaluate the condition to ensure delta values get tracked correctly */ + cond_valid = rc_test_condition(condition, add_buffer, peek, ud, L); + + /* if the condition has a target hit count that has already been met, it's automatically true, even if not currently true. */ + if (condition->required_hits != 0 && (condition->current_hits + add_hits) >= condition->required_hits) { + cond_valid = 1; + } + else if (cond_valid) { + condition->current_hits++; + + if (condition->required_hits == 0) { + /* not a hit-based requirement: ignore any additional logic! */ + } + else if ((condition->current_hits + add_hits) < condition->required_hits) { + /* HitCount target has not yet been met, condition is not yet valid */ + cond_valid = 0; + } + } + + add_buffer = add_hits = 0; + + switch (condition->type) { + case RC_CONDITION_PAUSE_IF: + /* as soon as we find a PauseIf that evaluates to true, stop processing the rest of the group */ + if (cond_valid) { + return 1; + } + + /* if we make it to the end of the function, make sure we indicate that nothing matched. if we do find + a later PauseIf match, it'll automatically return true via the previous condition. */ + set_valid = 0; + + if (condition->required_hits == 0) { + /* PauseIf didn't evaluate true, and doesn't have a HitCount, reset the HitCount to indicate the condition didn't match */ + condition->current_hits = 0; + } + else { + /* PauseIf has a HitCount that hasn't been met, ignore it for now. */ + } + + break; + + case RC_CONDITION_RESET_IF: + if (cond_valid) { + *reset = 1; /* let caller know to reset all hit counts */ + set_valid = 0; /* cannot be valid if we've hit a reset condition */ + } + + break; + + default: + set_valid &= cond_valid; + break; + } + } + + return set_valid; +} + +int rc_test_condset(rc_condset_t* self, int* reset, rc_peek_t peek, void* ud, lua_State* L) { + if (self->conditions == 0) { + /* important: empty group must evaluate true */ + return 1; + } + + if (self->has_pause && rc_test_condset_internal(self, 1, reset, peek, ud, L)) { + /* one or more Pause conditions exists, if any of them are true, stop processing this group */ + return 0; + } + + return rc_test_condset_internal(self, 0, reset, peek, ud, L); +} + +void rc_reset_condset(rc_condset_t* self) { + rc_condition_t* condition; + + for (condition = self->conditions; condition != 0; condition = condition->next) { + condition->current_hits = 0; + } +} diff --git a/deps/rcheevos/src/rcheevos/expression.c b/deps/rcheevos/src/rcheevos/expression.c new file mode 100644 index 0000000000..22c86fb9e4 --- /dev/null +++ b/deps/rcheevos/src/rcheevos/expression.c @@ -0,0 +1,41 @@ +#include "internal.h" + +rc_expression_t* rc_parse_expression(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx) { + rc_expression_t* self; + rc_term_t** next; + + self = (rc_expression_t*)rc_alloc(buffer, ret, sizeof(rc_expression_t), scratch); + next = &self->terms; + + for (;;) { + *next = rc_parse_term(ret, buffer, scratch, memaddr, L, funcs_ndx); + + if (*ret < 0) { + return 0; + } + + next = &(*next)->next; + + if (**memaddr != '_') { + break; + } + + (*memaddr)++; + } + + *next = 0; + return self; +} + +unsigned rc_evaluate_expression(rc_expression_t* self, rc_peek_t peek, void* ud, lua_State* L) { + rc_term_t* term; + unsigned value; + + value = 0; + + for (term = self->terms; term != 0; term = term->next) { + value += rc_evaluate_term(term, peek, ud, L); + } + + return value; +} diff --git a/deps/rcheevos/src/rcheevos/format.c b/deps/rcheevos/src/rcheevos/format.c new file mode 100644 index 0000000000..e9084064c2 --- /dev/null +++ b/deps/rcheevos/src/rcheevos/format.c @@ -0,0 +1,106 @@ +#include "internal.h" + +#include +#include + +int rc_parse_format(const char* format_str) { + switch (*format_str++) { + case 'F': + if (!strcmp(format_str, "RAMES")) { + return RC_FORMAT_FRAMES; + } + + break; + + case 'T': + if (!strcmp(format_str, "IME")) { + return RC_FORMAT_FRAMES; + } + else if (!strcmp(format_str, "IMESECS")) { + return RC_FORMAT_SECONDS; + } + + break; + + case 'S': + if (!strcmp(format_str, "ECS")) { + return RC_FORMAT_SECONDS; + } + if (!strcmp(format_str, "CORE")) { + return RC_FORMAT_SCORE; + } + + break; + + case 'M': + if (!strcmp(format_str, "ILLISECS")) { + return RC_FORMAT_CENTISECS; + } + + break; + + case 'P': + if (!strcmp(format_str, "OINTS")) { + return RC_FORMAT_SCORE; + } + + break; + + case 'V': + if (!strcmp(format_str, "ALUE")) { + return RC_FORMAT_VALUE; + } + + break; + + case 'O': + if (!strcmp(format_str, "THER")) { + return RC_FORMAT_OTHER; + } + + break; + } + + return RC_FORMAT_VALUE; +} + +void rc_format_value(char* buffer, int size, unsigned value, int format) { + unsigned a, b, c; + + switch (format) { + case RC_FORMAT_FRAMES: + a = value * 10 / 6; /* centisecs */ + b = a / 100; /* seconds */ + a -= b * 100; + c = b / 60; /* minutes */ + b -= c * 60; + snprintf(buffer, size, "%02u:%02u.%02u", c, b, a); + break; + + case RC_FORMAT_SECONDS: + a = value / 60; /* minutes */ + value -= a * 60; + snprintf(buffer, size, "%02u:%02u", a, value); + break; + + case RC_FORMAT_CENTISECS: + a = value / 100; /* seconds */ + value -= a * 100; + b = a / 60; /* minutes */ + a -= b * 60; + snprintf(buffer, size, "%02u:%02u.%02u", b, a, value); + break; + + case RC_FORMAT_SCORE: + snprintf(buffer, size, "%06u Points", value); + break; + + case RC_FORMAT_VALUE: + snprintf(buffer, size, "%01u", value); + break; + + case RC_FORMAT_OTHER: + default: + snprintf(buffer, size, "%06u", value); + } +} diff --git a/deps/rcheevos/src/rcheevos/internal.h b/deps/rcheevos/src/rcheevos/internal.h new file mode 100644 index 0000000000..edfd49697b --- /dev/null +++ b/deps/rcheevos/src/rcheevos/internal.h @@ -0,0 +1,41 @@ +#ifndef INTERNAL_H +#define INTERNAL_H + +#include "rcheevos.h" + +typedef union { + rc_operand_t operand; + rc_condition_t condition; + rc_condset_t condset; + rc_trigger_t trigger; + rc_term_t term; + rc_expression_t expression; + rc_lboard_t lboard; +} +rc_scratch_t; + +void* rc_alloc(void* pointer, int* offset, int size, rc_scratch_t* scratch); + +void rc_parse_trigger_internal(rc_trigger_t* self, int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx); + +rc_condset_t* rc_parse_condset(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx); +int rc_test_condset(rc_condset_t* self, int* reset, rc_peek_t peek, void* ud, lua_State* L); +void rc_reset_condset(rc_condset_t* self); + +rc_condition_t* rc_parse_condition(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx); +int rc_test_condition(rc_condition_t* self, unsigned add_buffer, rc_peek_t peek, void* ud, lua_State* L); + +int rc_parse_operand(rc_operand_t* self, const char** memaddr, int is_trigger, lua_State* L, int funcs_ndx); +unsigned rc_evaluate_operand(rc_operand_t* self, rc_peek_t peek, void* ud, lua_State* L); + +rc_term_t* rc_parse_term(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx); +unsigned rc_evaluate_term(rc_term_t* self, rc_peek_t peek, void* ud, lua_State* L); + +rc_expression_t* rc_parse_expression(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx); +unsigned rc_evaluate_expression(rc_expression_t* self, rc_peek_t peek, void* ud, lua_State* L); + +void rc_parse_value_internal(rc_value_t* self, int* ret, void* buffer, void* scratch, const char** memaddr, lua_State* L, int funcs_ndx); + +void rc_parse_lboard_internal(rc_lboard_t* self, int* ret, void* buffer, void* scratch, const char* memaddr, lua_State* L, int funcs_ndx); + +#endif /* INTERNAL_H */ diff --git a/deps/rcheevos/src/rcheevos/lboard.c b/deps/rcheevos/src/rcheevos/lboard.c new file mode 100644 index 0000000000..4e81c76c46 --- /dev/null +++ b/deps/rcheevos/src/rcheevos/lboard.c @@ -0,0 +1,233 @@ +#include "internal.h" + +enum { + RC_LBOARD_START = 1 << 0, + RC_LBOARD_CANCEL = 1 << 1, + RC_LBOARD_SUBMIT = 1 << 2, + RC_LBOARD_VALUE = 1 << 3, + RC_LBOARD_PROGRESS = 1 << 4, + RC_LBOARD_COMPLETE = RC_LBOARD_START | RC_LBOARD_CANCEL | RC_LBOARD_SUBMIT | RC_LBOARD_VALUE +}; + +void rc_parse_lboard_internal(rc_lboard_t* self, int* ret, void* buffer, void* scratch, const char* memaddr, lua_State* L, int funcs_ndx) { + int found; + + self->progress = 0; + found = 0; + + for (;;) + { + if ((memaddr[0] == 's' || memaddr[0] == 'S') && + (memaddr[1] == 't' || memaddr[1] == 'T') && + (memaddr[2] == 'a' || memaddr[2] == 'A') && memaddr[3] == ':') { + if ((found & RC_LBOARD_START) != 0) { + *ret = RC_DUPLICATED_START; + return; + } + + found |= RC_LBOARD_START; + memaddr += 4; + rc_parse_trigger_internal(&self->start, ret, buffer, scratch, &memaddr, L, funcs_ndx); + + if (*ret < 0) { + return; + } + } + else if ((memaddr[0] == 'c' || memaddr[0] == 'C') && + (memaddr[1] == 'a' || memaddr[1] == 'A') && + (memaddr[2] == 'n' || memaddr[2] == 'N') && memaddr[3] == ':') { + if ((found & RC_LBOARD_CANCEL) != 0) { + *ret = RC_DUPLICATED_CANCEL; + return; + } + + found |= RC_LBOARD_CANCEL; + memaddr += 4; + rc_parse_trigger_internal(&self->cancel, ret, buffer, scratch, &memaddr, L, funcs_ndx); + + if (*ret < 0) { + return; + } + } + else if ((memaddr[0] == 's' || memaddr[0] == 'S') && + (memaddr[1] == 'u' || memaddr[1] == 'U') && + (memaddr[2] == 'b' || memaddr[2] == 'B') && memaddr[3] == ':') { + if ((found & RC_LBOARD_SUBMIT) != 0) { + *ret = RC_DUPLICATED_SUBMIT; + return; + } + + found |= RC_LBOARD_SUBMIT; + memaddr += 4; + rc_parse_trigger_internal(&self->submit, ret, buffer, scratch, &memaddr, L, funcs_ndx); + + if (*ret < 0) { + return; + } + } + else if ((memaddr[0] == 'v' || memaddr[0] == 'V') && + (memaddr[1] == 'a' || memaddr[1] == 'A') && + (memaddr[2] == 'l' || memaddr[2] == 'L') && memaddr[3] == ':') { + if ((found & RC_LBOARD_VALUE) != 0) { + *ret = RC_DUPLICATED_VALUE; + return; + } + + found |= RC_LBOARD_VALUE; + memaddr += 4; + rc_parse_value_internal(&self->value, ret, buffer, scratch, &memaddr, L, funcs_ndx); + + if (*ret < 0) { + return; + } + } + else if ((memaddr[0] == 'p' || memaddr[0] == 'P') && + (memaddr[1] == 'r' || memaddr[1] == 'R') && + (memaddr[2] == 'o' || memaddr[2] == 'O') && memaddr[3] == ':') { + if ((found & RC_LBOARD_PROGRESS) != 0) { + *ret = RC_DUPLICATED_PROGRESS; + return; + } + + found |= RC_LBOARD_PROGRESS; + memaddr += 4; + + self->progress = (rc_value_t*)rc_alloc(buffer, ret, sizeof(rc_value_t), scratch); + rc_parse_value_internal(self->progress, ret, buffer, scratch, &memaddr, L, funcs_ndx); + + if (*ret < 0) { + return; + } + } + else { + *ret = RC_INVALID_LBOARD_FIELD; + return; + } + + if (memaddr[0] != ':' || memaddr[1] != ':') { + break; + } + + memaddr += 2; + } + + if ((found & RC_LBOARD_COMPLETE) != RC_LBOARD_COMPLETE) { + if ((found & RC_LBOARD_START) == 0) { + *ret = RC_MISSING_START; + } + else if ((found & RC_LBOARD_CANCEL) == 0) { + *ret = RC_MISSING_CANCEL; + } + else if ((found & RC_LBOARD_SUBMIT) == 0) { + *ret = RC_MISSING_SUBMIT; + } + else if ((found & RC_LBOARD_VALUE) == 0) { + *ret = RC_MISSING_VALUE; + } + + return; + } + + self->started = self->submitted = 0; +} + +int rc_lboard_size(const char* memaddr) { + int ret; + rc_lboard_t* self; + rc_scratch_t scratch; + + ret = 0; + self = (rc_lboard_t*)rc_alloc(0, &ret, sizeof(rc_lboard_t), &scratch); + rc_parse_lboard_internal(self, &ret, 0, &scratch, memaddr, 0, 0); + return ret; +} + +rc_lboard_t* rc_parse_lboard(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx) { + int ret; + rc_lboard_t* self; + rc_scratch_t scratch; + + ret = 0; + self = (rc_lboard_t*)rc_alloc(buffer, &ret, sizeof(rc_lboard_t), &scratch); + rc_parse_lboard_internal(self, &ret, buffer, 0, memaddr, L, funcs_ndx); + return ret >= 0 ? self : 0; +} + +int rc_evaluate_lboard(rc_lboard_t* self, unsigned* value, rc_peek_t peek, void* peek_ud, lua_State* L) { + int start_ok, cancel_ok, submit_ok; + int action = -1; + + /* ASSERT: these are always tested once every frame, to ensure delta variables work properly */ + start_ok = rc_test_trigger(&self->start, peek, peek_ud, L); + cancel_ok = rc_test_trigger(&self->cancel, peek, peek_ud, L); + submit_ok = rc_test_trigger(&self->submit, peek, peek_ud, L); + + if (self->submitted) { + /* if we've already submitted or canceled the leaderboard, don't reactivate it until it becomes inactive. */ + if (!start_ok) { + self->submitted = 0; + } + } + else if (!self->started) { + /* leaderboard is not active, if the start condition is true, activate it */ + if (start_ok && !cancel_ok) { + if (submit_ok) { + /* start and submit both true in the same frame, just submit without announcing the leaderboard is available */ + action = RC_LBOARD_TRIGGERED; + /* prevent multiple submissions/notifications */ + self->submitted = 1; + } + else if (self->start.requirement != 0 || self->start.alternative != 0) { + self->started = 1; + action = RC_LBOARD_STARTED; + } + } + } + else { + /* leaderboard is active */ + if (cancel_ok) { + /* cancel condition is true, deactivate the leaderboard */ + self->started = 0; + action = RC_LBOARD_CANCELED; + /* prevent multiple cancel notifications */ + self->submitted = 1; + } + else if (submit_ok) { + /* submit condition is true, submit the current value */ + self->started = 0; + action = RC_LBOARD_TRIGGERED; + self->submitted = 1; + } + } + + if (action == -1) { + action = self->started ? RC_LBOARD_ACTIVE : RC_LBOARD_INACTIVE; + } + + /* Calculate the value */ + switch (action) { + case RC_LBOARD_ACTIVE: /* fall through */ + case RC_LBOARD_STARTED: + *value = rc_evaluate_value(self->progress != 0 ? self->progress : &self->value, peek, peek_ud, L); + break; + + case RC_LBOARD_TRIGGERED: + *value = rc_evaluate_value(&self->value, peek, peek_ud, L); + break; + + case RC_LBOARD_INACTIVE: + case RC_LBOARD_CANCELED: + *value = 0; + break; + } + + return action; +} + +void rc_reset_lboard(rc_lboard_t* self) { + self->started = self->submitted = 0; + + rc_reset_trigger(&self->start); + rc_reset_trigger(&self->submit); + rc_reset_trigger(&self->cancel); +} diff --git a/deps/rcheevos/src/rcheevos/operand.c b/deps/rcheevos/src/rcheevos/operand.c new file mode 100644 index 0000000000..a34e7cb666 --- /dev/null +++ b/deps/rcheevos/src/rcheevos/operand.c @@ -0,0 +1,450 @@ +#include "internal.h" + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifdef __cplusplus +} +#endif + +static int rc_parse_operand_lua(rc_operand_t* self, const char** memaddr, lua_State* L, int funcs_ndx) { + const char* aux = *memaddr; + const char* id; + + if (*aux++ != '@') { + return RC_INVALID_LUA_OPERAND; + } + + if (!isalpha(*aux)) { + return RC_INVALID_LUA_OPERAND; + } + + id = aux; + + while (isalnum(*aux) || *aux == '_') { + aux++; + } + + if (L != 0) { + if (!lua_istable(L, funcs_ndx)) { + return RC_INVALID_LUA_OPERAND; + } + + lua_pushlstring(L, id, aux - id); + lua_gettable(L, funcs_ndx); + + if (!lua_isfunction(L, -1)) { + lua_pop(L, 1); + return RC_INVALID_LUA_OPERAND; + } + + self->function_ref = luaL_ref(L, LUA_REGISTRYINDEX); + } + + self->type = RC_OPERAND_LUA; + *memaddr = aux; + return RC_OK; +} + +static int rc_parse_operand_memory(rc_operand_t* self, const char** memaddr) { + const char* aux = *memaddr; + char* end; + unsigned long value; + + switch (*aux++) { + case 'd': case 'D': + self->type = RC_OPERAND_DELTA; + break; + + case 'b': case 'B': + self->type = RC_OPERAND_ADDRESS; + self->is_bcd = 1; + break; + + default: + self->type = RC_OPERAND_ADDRESS; + aux--; + break; + } + + if (*aux++ != '0') { + return RC_INVALID_MEMORY_OPERAND; + } + + if (*aux != 'x' && *aux != 'X') { + return RC_INVALID_MEMORY_OPERAND; + } + + aux++; + + switch (*aux++) { + case 'm': case 'M': self->size = RC_OPERAND_BIT_0; break; + case 'n': case 'N': self->size = RC_OPERAND_BIT_1; break; + case 'o': case 'O': self->size = RC_OPERAND_BIT_2; break; + case 'p': case 'P': self->size = RC_OPERAND_BIT_3; break; + case 'q': case 'Q': self->size = RC_OPERAND_BIT_4; break; + case 'r': case 'R': self->size = RC_OPERAND_BIT_5; break; + case 's': case 'S': self->size = RC_OPERAND_BIT_6; break; + case 't': case 'T': self->size = RC_OPERAND_BIT_7; break; + case 'l': case 'L': self->size = RC_OPERAND_LOW; break; + case 'u': case 'U': self->size = RC_OPERAND_HIGH; break; + case 'h': case 'H': self->size = RC_OPERAND_8_BITS; break; + case 'w': case 'W': self->size = RC_OPERAND_24_BITS; break; + case 'x': case 'X': self->size = RC_OPERAND_32_BITS; break; + + default: /* fall through */ + aux--; + case ' ': + self->size = RC_OPERAND_16_BITS; + break; + } + + value = (unsigned)strtoul(aux, &end, 16); + + if (end == aux) { + return RC_INVALID_MEMORY_OPERAND; + } + + if (value > 0xffffffffU) { + value = 0xffffffffU; + } + + self->value = (unsigned)value; + + *memaddr = end; + return RC_OK; +} + +static int rc_parse_operand_trigger(rc_operand_t* self, const char** memaddr, lua_State* L, int funcs_ndx) { + const char* aux = *memaddr; + char* end; + int ret; + unsigned long value; + + switch (*aux) { + case 'h': case 'H': + value = strtoul(++aux, &end, 16); + + if (end == aux) { + return RC_INVALID_CONST_OPERAND; + } + + if (value > 0xffffffffU) { + value = 0xffffffffU; + } + + self->type = RC_OPERAND_CONST; + self->value = (unsigned)value; + + aux = end; + break; + + case '0': + if (aux[1] == 'x' || aux[1] == 'X') { + /* fall through */ + default: + ret = rc_parse_operand_memory(self, &aux); + + if (ret < 0) { + return ret; + } + + break; + } + + /* fall through */ + case '+': case '-': + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + value = strtoul(aux, &end, 10); + + if (end == aux) { + return RC_INVALID_CONST_OPERAND; + } + + if (value > 0xffffffffU) { + value = 0xffffffffU; + } + + self->type = RC_OPERAND_CONST; + self->value = (unsigned)value; + + aux = end; + break; + + case '@': + ret = rc_parse_operand_lua(self, &aux, L, funcs_ndx); + + if (ret < 0) { + return ret; + } + + break; + } + + *memaddr = aux; + return RC_OK; +} + +static int rc_parse_operand_term(rc_operand_t* self, const char** memaddr, lua_State* L, int funcs_ndx) { + const char* aux = *memaddr; + char* end; + int ret; + unsigned long value; + + switch (*aux) { + case 'h': case 'H': + value = (unsigned)strtoul(++aux, &end, 16); + + if (end == aux) { + return RC_INVALID_CONST_OPERAND; + } + + if (value > 0xffffffffU) { + value = 0xffffffffU; + } + + self->type = RC_OPERAND_CONST; + self->value = (unsigned)value; + + aux = end; + break; + + case 'v': case 'V': + value = (unsigned)strtoul(++aux, &end, 10); + + if (end == aux) { + return RC_INVALID_CONST_OPERAND; + } + + if (value > 0xffffffffU) { + value = 0xffffffffU; + } + + self->type = RC_OPERAND_CONST; + self->value = (unsigned)value; + + aux = end; + break; + + case '0': + if (aux[1] == 'x' || aux[1] == 'X') { + /* fall through */ + default: + ret = rc_parse_operand_memory(self, &aux); + + if (ret < 0) { + return ret; + } + + break; + } + + /* fall through */ + case '+': case '-': + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + self->type = RC_OPERAND_FP; + self->fp_value = strtod(aux, &end); + + if (end == aux) { + return RC_INVALID_FP_OPERAND; + } + + aux = end; + break; + + case '@': + ret = rc_parse_operand_lua(self, &aux, L, funcs_ndx); + + if (ret < 0) { + return ret; + } + + break; + } + + *memaddr = aux; + return RC_OK; +} + +int rc_parse_operand(rc_operand_t* self, const char** memaddr, int is_trigger, lua_State* L, int funcs_ndx) { + self->size = RC_OPERAND_8_BITS; + self->is_bcd = 0; + self->previous = 0; + + if (is_trigger) { + return rc_parse_operand_trigger(self, memaddr, L, funcs_ndx); + } + else { + return rc_parse_operand_term(self, memaddr, L, funcs_ndx); + } +} + +typedef struct { + rc_peek_t peek; + void* ud; +} +rc_luapeek_t; + +static int rc_luapeek(lua_State* L) { + unsigned address = luaL_checkinteger(L, 1); + unsigned num_bytes = luaL_checkinteger(L, 2); + rc_luapeek_t* luapeek = (rc_luapeek_t*)lua_touserdata(L, 3); + + unsigned value = luapeek->peek(address, num_bytes, luapeek->ud); + + lua_pushinteger(L, value); + return 1; +} + +unsigned rc_evaluate_operand(rc_operand_t* self, rc_peek_t peek, void* ud, lua_State* L) { + rc_luapeek_t luapeek; + unsigned value = 0; + + switch (self->type) { + case RC_OPERAND_CONST: + value = self->value; + break; + + case RC_OPERAND_FP: + /* This is handled by rc_evaluate_expression. */ + return 0; + + case RC_OPERAND_LUA: + lua_rawgeti(L, LUA_REGISTRYINDEX, self->function_ref); + lua_pushcfunction(L, rc_luapeek); + + luapeek.peek = peek; + luapeek.ud = ud; + + lua_pushlightuserdata(L, &luapeek); + + if (lua_pcall(L, 2, 1, 0) == LUA_OK) { + if (lua_isboolean(L, -1)) { + value = lua_toboolean(L, -1); + } + else { + value = (unsigned)lua_tonumber(L, -1); + } + } + else { + value = 0; + } + + lua_pop(L, 1); + break; + + case RC_OPERAND_ADDRESS: + case RC_OPERAND_DELTA: + switch (self->size) { + case RC_OPERAND_BIT_0: + value = (peek(self->value, 1, ud) >> 0) & 1; + break; + + case RC_OPERAND_BIT_1: + value = (peek(self->value, 1, ud) >> 1) & 1; + break; + + case RC_OPERAND_BIT_2: + value = (peek(self->value, 1, ud) >> 2) & 1; + break; + + case RC_OPERAND_BIT_3: + value = (peek(self->value, 1, ud) >> 3) & 1; + break; + + case RC_OPERAND_BIT_4: + value = (peek(self->value, 1, ud) >> 4) & 1; + break; + + case RC_OPERAND_BIT_5: + value = (peek(self->value, 1, ud) >> 5 ) & 1; + break; + + case RC_OPERAND_BIT_6: + value = (peek(self->value, 1, ud) >> 6) & 1; + break; + + case RC_OPERAND_BIT_7: + value = (peek(self->value, 1, ud) >> 7) & 1; + break; + + case RC_OPERAND_LOW: + value = peek(self->value, 1, ud) & 0x0f; + break; + + case RC_OPERAND_HIGH: + value = (peek(self->value, 1, ud) >> 4) & 0x0f; + break; + + case RC_OPERAND_8_BITS: + value = peek(self->value, 1, ud); + + if (self->is_bcd) { + value = ((value >> 4) & 0x0f) * 10 + (value & 0x0f); + } + + break; + + case RC_OPERAND_16_BITS: + value = peek(self->value, 2, ud); + + if (self->is_bcd) { + value = ((value >> 12) & 0x0f) * 1000 + + ((value >> 8) & 0x0f) * 100 + + ((value >> 4) & 0x0f) * 10 + + ((value >> 0) & 0x0f) * 1; + } + + break; + + case RC_OPERAND_24_BITS: + value = peek(self->value, 4, ud); + + if (self->is_bcd) { + value = ((value >> 20) & 0x0f) * 100000 + + ((value >> 16) & 0x0f) * 10000 + + ((value >> 12) & 0x0f) * 1000 + + ((value >> 8) & 0x0f) * 100 + + ((value >> 4) & 0x0f) * 10 + + ((value >> 0) & 0x0f) * 1; + } + + break; + + case RC_OPERAND_32_BITS: + value = peek(self->value, 4, ud); + + if (self->is_bcd) { + value = ((value >> 28) & 0x0f) * 10000000 + + ((value >> 24) & 0x0f) * 1000000 + + ((value >> 20) & 0x0f) * 100000 + + ((value >> 16) & 0x0f) * 10000 + + ((value >> 12) & 0x0f) * 1000 + + ((value >> 8) & 0x0f) * 100 + + ((value >> 4) & 0x0f) * 10 + + ((value >> 0) & 0x0f) * 1; + } + + break; + } + + if (self->type == RC_OPERAND_DELTA) { + unsigned previous = self->previous; + self->previous = value; + value = previous; + } + + break; + } + + return value; +} diff --git a/deps/rcheevos/src/rcheevos/term.c b/deps/rcheevos/src/rcheevos/term.c new file mode 100644 index 0000000000..1ee21fe5ab --- /dev/null +++ b/deps/rcheevos/src/rcheevos/term.c @@ -0,0 +1,88 @@ +#include "internal.h" + +rc_term_t* rc_parse_term(int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx) { + rc_term_t* self; + const char* aux; + int ret2; + + aux = *memaddr; + self = (rc_term_t*)rc_alloc(buffer, ret, sizeof(rc_term_t), scratch); + self->invert = 0; + + ret2 = rc_parse_operand(&self->operand1, &aux, 0, L, funcs_ndx); + + if (ret2 < 0) { + *ret = ret2; + return 0; + } + + if (*aux == '*') { + aux++; + + if (*aux == '~') { + aux++; + self->invert = 1; + } + + ret2 = rc_parse_operand(&self->operand2, &aux, 0, L, funcs_ndx); + + if (ret2 < 0) { + *ret = ret2; + return 0; + } + + if (self->invert) { + switch (self->operand2.size) { + case RC_OPERAND_BIT_0: + case RC_OPERAND_BIT_1: + case RC_OPERAND_BIT_2: + case RC_OPERAND_BIT_3: + case RC_OPERAND_BIT_4: + case RC_OPERAND_BIT_5: + case RC_OPERAND_BIT_6: + case RC_OPERAND_BIT_7: + /* invert is already 1 */ + break; + + case RC_OPERAND_LOW: + case RC_OPERAND_HIGH: + self->invert = 0xf; + break; + + case RC_OPERAND_8_BITS: + self->invert = 0xffU; + break; + + case RC_OPERAND_16_BITS: + self->invert = 0xffffU; + break; + + case RC_OPERAND_24_BITS: + self->invert = 0xffffffU; + break; + + case RC_OPERAND_32_BITS: + self->invert = 0xffffffffU; + break; + } + } + } + else { + self->operand2.type = RC_OPERAND_FP; + self->operand2.size = RC_OPERAND_8_BITS; + self->operand2.fp_value = 1.0; + } + + *memaddr = aux; + return self; +} + +unsigned rc_evaluate_term(rc_term_t* self, rc_peek_t peek, void* ud, lua_State* L) { + unsigned value = rc_evaluate_operand(&self->operand1, peek, ud, L); + + if (self->operand2.type != RC_OPERAND_FP) { + return value * (rc_evaluate_operand(&self->operand2, peek, ud, L) ^ self->invert); + } + + return value * self->operand2.fp_value; +} diff --git a/deps/rcheevos/src/rcheevos/trigger.c b/deps/rcheevos/src/rcheevos/trigger.c new file mode 100644 index 0000000000..0e7b46d1c1 --- /dev/null +++ b/deps/rcheevos/src/rcheevos/trigger.c @@ -0,0 +1,100 @@ +#include "internal.h" + +#include + +void rc_parse_trigger_internal(rc_trigger_t* self, int* ret, void* buffer, rc_scratch_t* scratch, const char** memaddr, lua_State* L, int funcs_ndx) { + rc_condset_t** next; + const char* aux; + + aux = *memaddr; + next = &self->alternative; + + if (*aux == 's' || *aux == 'S') { + self->requirement = 0; + } + else { + self->requirement = rc_parse_condset(ret, buffer, scratch, &aux, L, funcs_ndx); + + if (*ret < 0) { + return; + } + } + + while (*aux == 's' || *aux == 'S') { + aux++; + *next = rc_parse_condset(ret, buffer, scratch, &aux, L, funcs_ndx); + + if (*ret < 0) { + return; + } + + next = &(*next)->next; + } + + *next = 0; + *memaddr = aux; +} + +int rc_trigger_size(const char* memaddr) { + int ret; + rc_trigger_t* self; + rc_scratch_t scratch; + + ret = 0; + self = (rc_trigger_t*)rc_alloc(0, &ret, sizeof(rc_trigger_t), &scratch); + rc_parse_trigger_internal(self, &ret, 0, &scratch, &memaddr, 0, 0); + return ret; +} + +rc_trigger_t* rc_parse_trigger(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx) { + int ret; + rc_trigger_t* self; + rc_scratch_t scratch; + + ret = 0; + self = (rc_trigger_t*)rc_alloc(buffer, &ret, sizeof(rc_trigger_t), &scratch); + rc_parse_trigger_internal(self, &ret, buffer, 0, &memaddr, L, funcs_ndx); + return ret >= 0 ? self : 0; +} + +int rc_test_trigger(rc_trigger_t* self, rc_peek_t peek, void* ud, lua_State* L) { + int ret, reset; + rc_condset_t* condset; + + reset = 0; + ret = self->requirement != 0 ? rc_test_condset(self->requirement, &reset, peek, ud, L) : 1; + condset = self->alternative; + + if (condset) { + int sub = 0; + + do { + sub |= rc_test_condset(condset, &reset, peek, ud, L); + condset = condset->next; + } + while (condset != 0); + + ret &= sub && !reset; + } + + if (reset) { + rc_reset_trigger(self); + } + + return ret; +} + +void rc_reset_trigger(rc_trigger_t* self) { + rc_condset_t* condset; + + if (self->requirement != 0) { + rc_reset_condset(self->requirement); + } + + condset = self->alternative; + + while (condset != 0) { + rc_reset_condset(condset); + condset = condset->next; + } +} diff --git a/deps/rcheevos/src/rcheevos/value.c b/deps/rcheevos/src/rcheevos/value.c new file mode 100644 index 0000000000..4ada51c73a --- /dev/null +++ b/deps/rcheevos/src/rcheevos/value.c @@ -0,0 +1,65 @@ +#include "internal.h" + +void rc_parse_value_internal(rc_value_t* self, int* ret, void* buffer, void* scratch, const char** memaddr, lua_State* L, int funcs_ndx) { + rc_expression_t** next; + + next = &self->expressions; + + for (;;) { + *next = rc_parse_expression(ret, buffer, scratch, memaddr, L, funcs_ndx); + + if (*ret < 0) { + return; + } + + next = &(*next)->next; + + if (**memaddr != '$') { + break; + } + + (*memaddr)++; + } + + *next = 0; +} + +int rc_value_size(const char* memaddr) { + int ret; + rc_value_t* self; + rc_scratch_t scratch; + + ret = 0; + self = (rc_value_t*)rc_alloc(0, &ret, sizeof(rc_value_t), &scratch); + rc_parse_value_internal(self, &ret, 0, &scratch, &memaddr, 0, 0); + return ret; +} + +rc_value_t* rc_parse_value(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx) { + int ret; + rc_value_t* self; + rc_scratch_t scratch; + + ret = 0; + self = (rc_value_t*)rc_alloc(buffer, &ret, sizeof(rc_value_t), &scratch); + rc_parse_value_internal(self, &ret, buffer, 0, &memaddr, L, funcs_ndx); + return ret >= 0 ? self : 0; +} + +unsigned rc_evaluate_value(rc_value_t* self, rc_peek_t peek, void* ud, lua_State* L) { + rc_expression_t* exp; + unsigned value, max; + + exp = self->expressions; + max = rc_evaluate_expression(exp, peek, ud, L); + + for (exp = exp->next; exp != 0; exp = exp->next) { + value = rc_evaluate_expression(exp, peek, ud, L); + + if (value > max) { + max = value; + } + } + + return max; +} diff --git a/deps/rcheevos/src/rjson/dejson.c b/deps/rcheevos/src/rjson/dejson.c new file mode 100644 index 0000000000..e1b628f264 --- /dev/null +++ b/deps/rcheevos/src/rjson/dejson.c @@ -0,0 +1,750 @@ +#include "rjson.h" +#include "dejson.h" + +#include +#include +#include +#include +#include +#include +#include + +typedef struct { + const uint8_t* json; + uintptr_t buffer; + int counting; + jmp_buf rollback; +} +rc_json_state_t; + +static void* rc_json_alloc(rc_json_state_t* state, size_t size, size_t alignment) { + state->buffer = (state->buffer + alignment - 1) & ~(alignment - 1); + void* ptr = (void*)state->buffer; + state->buffer += size; + return ptr; +} + +static void rc_json_skip_spaces(rc_json_state_t* state) { + if (isspace(*state->json)) { + do { + state->json++; + } + while (isspace(*state->json)); + } +} + +static size_t rc_json_skip_string(rc_json_state_t*); +static void rc_json_skip_value(rc_json_state_t*); + +static void rc_json_skip_object(rc_json_state_t* state) { + state->json++; + rc_json_skip_spaces(state); + + while (*state->json != '}') { + rc_json_skip_string(state); + rc_json_skip_spaces(state); + + if (*state->json != ':') { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + state->json++; + rc_json_skip_spaces(state); + rc_json_skip_value(state); + rc_json_skip_spaces(state); + + if (*state->json != ',') { + break; + } + + state->json++; + rc_json_skip_spaces(state); + } + + if (*state->json != '}') { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + state->json++; +} + +static size_t rc_json_skip_array(rc_json_state_t* state) { + size_t count = 0; + state->json++; + rc_json_skip_spaces(state); + + while (*state->json != ']') { + rc_json_skip_value(state); + rc_json_skip_spaces(state); + + count++; + + if (*state->json != ',') { + break; + } + + state->json++; + rc_json_skip_spaces(state); + } + + if (*state->json != ']') { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + state->json++; + return count; +} + +static void rc_json_skip_number(rc_json_state_t* state) { + errno = 0; + + char* end; + double result = strtod((const char*)state->json, &end); + + if ((result == 0.0 && end == (const char*)state->json) || errno == ERANGE) { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + state->json = (uint8_t*)end; +} + +static void rc_json_skip_boolean(rc_json_state_t* state) { + const uint8_t* json = state->json; + + if (json[0] == 't' && json[1] == 'r' && json[2] == 'u' && json[3] == 'e' && !isalpha(json[4])) { + state->json += 4; + } + else if (json[0] == 'f' && json[1] == 'a' && json[2] == 'l' && json[3] == 's' && json[4] == 'e' && !isalpha(json[5])) { + state->json += 5; + } + else { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } +} + +static size_t rc_json_skip_string(rc_json_state_t* state) { + const uint8_t* aux = state->json + 1; + size_t length = 0; + + if (*aux !='"') { + do { + length++; + + if (*aux++ == '\\') { + char digits[5]; + uint32_t utf32; + + switch (*aux++) { + case '"': + case '\\': + case '/': + case 'b': + case 'f': + case 'n': + case 'r': + case 't': + break; + + case 'u': + if (!isxdigit(aux[0] || !isxdigit(aux[1]) || !isxdigit(aux[2]) || !isxdigit(aux[3]))) { + longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); + } + + digits[0] = aux[0]; + digits[1] = aux[1]; + digits[2] = aux[2]; + digits[3] = aux[3]; + digits[4] = 0; + aux += 4; + + utf32 = strtoul(digits, NULL, 16); + + if (utf32 < 0x80U) { + length += 0; + } + else if (utf32 < 0x800U) { + length += 1; + } + else if (utf32 < 0x10000U) { + length += 2; + } + else if (utf32 < 0x200000U) { + length += 3; + } + else { + longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); + } + + break; + + default: + longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); + } + } + } + while (*aux != '"'); + } + + state->json = aux + 1; + return length + 1; +} + +static void rc_json_skip_null(rc_json_state_t* state) { + const uint8_t* json = state->json; + + if (json[0] == 'n' && json[1] == 'u' && json[2] == 'l' && json[3] == 'l' && !isalpha(json[4])) { + state->json += 4; + } + else { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } +} + +static void rc_json_skip_value(rc_json_state_t* state) { + switch (*state->json) { + case '{': + rc_json_skip_object(state); + break; + + case '[': + rc_json_skip_array(state); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + rc_json_skip_number(state); + break; + + case 't': + case 'f': + rc_json_skip_boolean(state); + break; + + case '"': + rc_json_skip_string(state); + break; + + case 'n': + rc_json_skip_null(state); + break; + + default: + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + rc_json_skip_spaces(state); +} + +static int64_t rc_json_get_int64(rc_json_state_t* state, int64_t min, int64_t max) { + errno = 0; + + char* end; + long long result = strtoll((const char*)state->json, &end, 10); + + if ((result == 0 && end == (const char*)state->json) || errno == ERANGE || result < min || result > max) { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + state->json = (uint8_t*)end; + return result; +} + +static uint64_t rc_json_get_uint64(rc_json_state_t* state, uint64_t max) { + errno = 0; + + char* end; + unsigned long long result = strtoull((char*)state->json, &end, 10); + + if ((result == 0 && end == (const char*)state->json) || errno == ERANGE || result > max) { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + state->json = (uint8_t*)end; + return result; +} + +static double rc_json_get_double(rc_json_state_t* state, double min, double max) { + errno = 0; + + char* end; + double result = strtod((const char*)state->json, &end); + + if ((result == 0.0 && end == (const char*)state->json) || errno == ERANGE || result < min || result > max) { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + state->json = (uint8_t*)end; + return result; +} + +static void rc_json_parse_char(rc_json_state_t* state, void* data) { + *(char*)data = rc_json_get_int64(state, CHAR_MIN, CHAR_MAX); +} + +static void rc_json_parse_uchar(rc_json_state_t* state, void* data) { + *(unsigned char*)data = rc_json_get_uint64(state, UCHAR_MAX); +} + +static void rc_json_parse_short(rc_json_state_t* state, void* data) { + *(short*)data = rc_json_get_int64(state, SHRT_MIN, SHRT_MAX); +} + +static void rc_json_parse_ushort(rc_json_state_t* state, void* data) { + *(unsigned short*)data = rc_json_get_uint64(state, USHRT_MAX); +} + +static void rc_json_parse_int(rc_json_state_t* state, void* data) { + *(int*)data = rc_json_get_int64(state, INT_MIN, INT_MAX); +} + +static void rc_json_parse_uint(rc_json_state_t* state, void* data) { + *(unsigned int*)data = rc_json_get_uint64(state, UINT_MAX); +} + +static void rc_json_parse_long(rc_json_state_t* state, void* data) { + *(long*)data = rc_json_get_int64(state, LONG_MIN, LONG_MAX); +} + +static void rc_json_parse_ulong(rc_json_state_t* state, void* data) { + *(unsigned long*)data = rc_json_get_uint64(state, ULONG_MAX); +} + +static void rc_json_parse_longlong(rc_json_state_t* state, void* data) { + *(unsigned long*)data = rc_json_get_int64(state, LLONG_MIN, LLONG_MAX); +} + +static void rc_json_parse_ulonglong(rc_json_state_t* state, void* data) { + *(unsigned long*)data = rc_json_get_uint64(state, ULLONG_MAX); +} + +static void rc_json_parse_int8(rc_json_state_t* state, void* data) { + *(int8_t*)data = rc_json_get_int64(state, INT8_MIN, INT8_MAX); +} + +static void rc_json_parse_int16(rc_json_state_t* state, void* data) { + *(int16_t*)data = rc_json_get_int64(state, INT16_MIN, INT16_MAX); +} + +static void rc_json_parse_int32(rc_json_state_t* state, void* data) { + *(int32_t*)data = rc_json_get_int64(state, INT32_MIN, INT32_MAX); +} + +static void rc_json_parse_int64(rc_json_state_t* state, void* data) { + *(int64_t*)data = rc_json_get_int64(state, INT64_MIN, INT64_MAX); +} + +static void rc_json_parse_uint8(rc_json_state_t* state, void* data) { + *(uint8_t*)data = rc_json_get_uint64(state, UINT8_MAX); +} + +static void rc_json_parse_uint16(rc_json_state_t* state, void* data) { + *(uint16_t*)data = rc_json_get_uint64(state, UINT16_MAX); +} + +static void rc_json_parse_uint32(rc_json_state_t* state, void* data) { + *(uint32_t*)data = rc_json_get_uint64(state, UINT32_MAX); +} + +static void rc_json_parse_uint64(rc_json_state_t* state, void* data) { + *(uint64_t*)data = rc_json_get_uint64(state, UINT64_MAX); +} + +static void rc_json_parse_float(rc_json_state_t* state, void* data) { + *(float*)data = rc_json_get_double(state, FLT_MIN, FLT_MAX); +} + +static void rc_json_parse_double(rc_json_state_t* state, void* data) { + *(double*)data = rc_json_get_double(state, DBL_MIN, DBL_MAX); +} + +static void rc_json_parse_boolean(rc_json_state_t* state, void* data) { + const uint8_t* json = state->json; + + if (json[0] == 't' && json[1] == 'r' && json[2] == 'u' && json[3] == 'e' && !isalpha(json[4])) { + *(char*)data = 1; + state->json += 4; + } + else if (json[0] == 'f' && json[1] == 'a' && json[2] == 'l' && json[3] == 's' && json[4] == 'e' && !isalpha(json[5])) { + *(char*)data = 0; + state->json += 5; + } + else { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } +} + +static void rc_json_parse_string(rc_json_state_t* state, void* data) { + const uint8_t* aux = state->json; + size_t length = rc_json_skip_string(state); + uint8_t* str = (uint8_t*)rc_json_alloc(state, length + 1, RC_JSON_ALIGNOF(char)); + + if (state->counting) { + return; + } + + if (*aux++ != '"') { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + *(char**)data = (char*)str; + + if (*aux !='"') { + do { + if (*aux == '\\') { + char digits[5]; + uint32_t utf32; + + aux++; + + switch (*aux++) { + case '"': *str++ = '"'; break; + case '\\': *str++ = '\\'; break; + case '/': *str++ = '/'; break; + case 'b': *str++ = '\b'; break; + case 'f': *str++ = '\f'; break; + case 'n': *str++ = '\n'; break; + case 'r': *str++ = '\r'; break; + case 't': *str++ = '\t'; break; + + case 'u': + digits[0] = aux[0]; + digits[1] = aux[1]; + digits[2] = aux[2]; + digits[3] = aux[3]; + digits[4] = 0; + aux += 4; + + utf32 = strtoul(digits, NULL, 16); + + if (utf32 < 0x80) { + *str++ = utf32; + } + else if (utf32 < 0x800) { + str[0] = 0xc0 | (utf32 >> 6); + str[1] = 0x80 | (utf32 & 0x3f); + str += 2; + } + else if (utf32 < 0x10000) { + str[0] = 0xe0 | (utf32 >> 12); + str[1] = 0x80 | ((utf32 >> 6) & 0x3f); + str[2] = 0x80 | (utf32 & 0x3f); + str += 3; + } + else { + str[0] = 0xf0 | (utf32 >> 18); + str[1] = 0x80 | ((utf32 >> 12) & 0x3f); + str[2] = 0x80 | ((utf32 >> 6) & 0x3f); + str[3] = 0x80 | (utf32 & 0x3f); + str += 4; + } + + break; + + default: + longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); + } + } + else { + *str++ = *aux++; + } + } + while (*aux != '"'); + } + + *str = 0; +} + +typedef void (*rc_json_parser_t)(rc_json_state_t*, void*); + +static const rc_json_parser_t rc_json_parsers[] = { + rc_json_parse_char, rc_json_parse_uchar, rc_json_parse_short, rc_json_parse_ushort, + rc_json_parse_int, rc_json_parse_uint, rc_json_parse_long, rc_json_parse_ulong, + rc_json_parse_longlong, rc_json_parse_ulonglong, + rc_json_parse_int8, rc_json_parse_int16, rc_json_parse_int32, rc_json_parse_int64, + rc_json_parse_uint8, rc_json_parse_uint16, rc_json_parse_uint32, rc_json_parse_uint64, + rc_json_parse_float, rc_json_parse_double, rc_json_parse_boolean, rc_json_parse_string +}; + +static void rc_json_parse_value(rc_json_state_t*, void*, const rc_json_field_meta_t*); +static void rc_json_parse_object(rc_json_state_t*, void*, const rc_json_struct_meta_t*); + +static void rc_json_parse_array(rc_json_state_t* state, void* value, size_t element_size, size_t element_alignment, const rc_json_field_meta_t* field) { + if (*state->json != '[') { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + const uint8_t* save = state->json; + size_t count = rc_json_skip_array(state); + state->json = save + 1; + + uint8_t* elements = (uint8_t*)rc_json_alloc(state, element_size * count, element_alignment); + + if (!state->counting) { + struct { + void* elements; + int count; + } + *array = value; + + array->elements = elements; + array->count = count; + } + + rc_json_skip_spaces(state); + + rc_json_field_meta_t field_scalar = *field; + field_scalar.flags &= ~RC_JSON_FLAG_ARRAY; + + while (*state->json != ']') { + rc_json_parse_value(state, (void*)elements, &field_scalar); + rc_json_skip_spaces(state); + + elements += element_size; + + if (*state->json != ',') { + break; + } + + state->json++; + rc_json_skip_spaces(state); + } + + if (*state->json != ']') { + longjmp(state->rollback, RC_JSON_UNTERMINATED_ARRAY); + } + + state->json++; +} + +const rc_json_struct_meta_t* rc_json_resolve_struct(uint32_t hash); + +static void rc_json_parse_value(rc_json_state_t* state, void* value, const rc_json_field_meta_t* field) { +#define RC_JSON_TYPE_INFO(t) sizeof(t), RC_JSON_ALIGNOF(t) + + static const size_t rc_json_type_info[] = { + RC_JSON_TYPE_INFO(char), RC_JSON_TYPE_INFO(unsigned char), RC_JSON_TYPE_INFO(short), RC_JSON_TYPE_INFO(unsigned short), + RC_JSON_TYPE_INFO(int), RC_JSON_TYPE_INFO(unsigned int), RC_JSON_TYPE_INFO(long), RC_JSON_TYPE_INFO(unsigned long), + RC_JSON_TYPE_INFO(long long), RC_JSON_TYPE_INFO(unsigned long long), + RC_JSON_TYPE_INFO(int8_t), RC_JSON_TYPE_INFO(int16_t), RC_JSON_TYPE_INFO(int32_t), RC_JSON_TYPE_INFO(int64_t), + RC_JSON_TYPE_INFO(uint8_t), RC_JSON_TYPE_INFO(uint16_t), RC_JSON_TYPE_INFO(uint32_t), RC_JSON_TYPE_INFO(uint64_t), + RC_JSON_TYPE_INFO(float), RC_JSON_TYPE_INFO(double), RC_JSON_TYPE_INFO(char), RC_JSON_TYPE_INFO(const char*) + }; + + const rc_json_struct_meta_t* meta = NULL; + + if ((field->flags & (RC_JSON_FLAG_ARRAY | RC_JSON_FLAG_POINTER)) == 0) { + if (field->type != RC_JSON_TYPE_RECORD) { + char dummy[64]; + + if (state->counting) { + value = (void*)dummy; + } + + rc_json_parsers[field->type](state, value); + } + else { + meta = rc_json_resolve_struct(field->type_hash); + + if (meta == NULL) { + longjmp(state->rollback, RC_JSON_UNKOWN_RECORD); + } + + rc_json_parse_object(state, value, meta); + } + + return; + } + + size_t size, alignment; + + if (field->type != RC_JSON_TYPE_RECORD) { + unsigned ndx = field->type * 2; + size = rc_json_type_info[ndx]; + alignment = rc_json_type_info[ndx + 1]; + } + else { /* field->type == RC_JSON_TYPE_RECORD */ + meta = rc_json_resolve_struct(field->type_hash); + + if (meta == NULL) { + longjmp(state->rollback, RC_JSON_UNKOWN_RECORD); + } + + size = meta->size; + alignment = meta->alignment; + } + + if ((field->flags & RC_JSON_FLAG_ARRAY) != 0) { + rc_json_parse_array(state, value, size, alignment, field); + return; + } + + const uint8_t* json = state->json; + + if (json[0] == 'n' && json[1] == 'u' && json[2] == 'l' && json[3] == 'l' && !isalpha(json[4])) { + if (!state->counting) { + *(void**)value = NULL; + } + + state->json += 4; + return; + } + + void* pointer = rc_json_alloc(state, size, alignment); + + if (!state->counting) { + *(void**)value = pointer; + } + + value = pointer; + + if (field->type != RC_JSON_TYPE_RECORD) { + rc_json_parsers[field->type](state, value); + } + else { + rc_json_parse_object(state, value, meta); + } +} + +static void rc_json_parse_object(rc_json_state_t* state, void* record, const rc_json_struct_meta_t* meta) { + if (*state->json != '{') { + longjmp(state->rollback, RC_JSON_INVALID_VALUE); + } + + if (!state->counting) { + memset((void*)record, 0, meta->size); + } + + state->json++; + rc_json_skip_spaces(state); + + while (*state->json != '}') { + if (*state->json != '"') { + longjmp(state->rollback, RC_JSON_MISSING_KEY); + } + + const char* key = (const char*)++state->json; + const char* quote = key; + + for (;;) { + quote = strchr(quote, '"'); + + if (!quote) { + longjmp(state->rollback, RC_JSON_UNTERMINATED_KEY); + } + + if (quote[-1] != '\\') { + break; + } + } + + state->json = (const uint8_t*)quote + 1; + uint32_t hash = rc_json_hash((const uint8_t*)key, quote - key); + + unsigned i; + const rc_json_field_meta_t* field; + + for (i = 0, field = meta->fields; i < meta->num_fields; i++, field++) { + if (field->name_hash == hash) { + break; + } + } + + rc_json_skip_spaces(state); + + if (*state->json != ':') { + longjmp(state->rollback, RC_JSON_MISSING_VALUE); + } + + state->json++; + rc_json_skip_spaces(state); + + if (i != meta->num_fields) { + rc_json_parse_value(state, (void*)((uint8_t*)record + field->offset), field); + } + else { + rc_json_skip_value(state); + } + + rc_json_skip_spaces(state); + + if (*state->json != ',') { + break; + } + + state->json++; + rc_json_skip_spaces(state); + } + + if (*state->json != '}') { + longjmp(state->rollback, RC_JSON_UNTERMINATED_OBJECT); + } + + state->json++; +} + +static int rc_json_execute(void* buffer, uint32_t hash, const uint8_t* json, int counting) { + const rc_json_struct_meta_t* meta = rc_json_resolve_struct(hash); + + if (!meta) { + return RC_JSON_UNKOWN_RECORD; + } + + rc_json_state_t state; + int res; + + if ((res = setjmp(state.rollback)) != 0) { + return res; + } + + state.json = json; + state.buffer = counting ? 0 : (uintptr_t)*(void**)buffer; + state.counting = counting; + + if (!counting) { + *(void**)buffer = rc_json_alloc(&state, meta->size, meta->alignment); + } + + rc_json_skip_spaces(&state); + rc_json_parse_object(&state, *(void**)buffer, meta); + rc_json_skip_spaces(&state); + + if (counting) { + *(size_t*)buffer = state.buffer; + } + + return *state.json == 0 ? RC_JSON_OK : RC_JSON_EOF_EXPECTED; +} + +void* rc_json_deserialize(void* buffer, uint32_t hash, const uint8_t* json) { + void** record = &buffer; + int res = rc_json_execute(record, hash, json, 0); + return res == RC_JSON_OK ? *record : NULL; +} + +int rc_json_get_size(size_t* size, uint32_t hash, const uint8_t* json) { + return rc_json_execute((void*)size, hash, json, 1); +} + +uint32_t rc_json_hash(const uint8_t* str, size_t length) { + typedef char unsigned_must_have_32_bits_minimum[sizeof(unsigned) >= 4 ? 1 : -1]; + + uint32_t hash = 5381; + + if (length != 0) { + do { + hash = hash * 33 + *str++; + } + while (--length != 0); + } + + return hash & 0xffffffffU; +} diff --git a/deps/rcheevos/src/rjson/dejson.h b/deps/rcheevos/src/rjson/dejson.h new file mode 100644 index 0000000000..406c29eac1 --- /dev/null +++ b/deps/rcheevos/src/rjson/dejson.h @@ -0,0 +1,71 @@ +#ifndef DEJSON_H +#define DEJSON_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define RC_JSON_OFFSETOF(s, f) ((size_t)(&((s*)0)->f)) +#define RC_JSON_ALIGNOF(t) RC_JSON_OFFSETOF(struct{char c; t d;}, d) + +enum { + RC_JSON_TYPE_CHAR, + RC_JSON_TYPE_UCHAR, + RC_JSON_TYPE_SHORT, + RC_JSON_TYPE_USHORT, + RC_JSON_TYPE_INT, + RC_JSON_TYPE_UINT, + RC_JSON_TYPE_LONG, + RC_JSON_TYPE_LONGLONG, + RC_JSON_TYPE_ULONG, + RC_JSON_TYPE_ULONGLONG, + RC_JSON_TYPE_INT8, + RC_JSON_TYPE_INT16, + RC_JSON_TYPE_INT32, + RC_JSON_TYPE_INT64, + RC_JSON_TYPE_UINT8, + RC_JSON_TYPE_UINT16, + RC_JSON_TYPE_UINT32, + RC_JSON_TYPE_UINT64, + RC_JSON_TYPE_FLOAT, + RC_JSON_TYPE_DOUBLE, + RC_JSON_TYPE_BOOL, + RC_JSON_TYPE_STRING, + RC_JSON_TYPE_RECORD +}; + +enum { + RC_JSON_FLAG_ARRAY = 1 << 0, + RC_JSON_FLAG_POINTER = 1 << 1 +}; + +typedef struct { + uint32_t name_hash; + uint32_t type_hash; + uint16_t offset; + uint8_t type; + uint8_t flags; +} +rc_json_field_meta_t; + +typedef struct { + const rc_json_field_meta_t* fields; + uint32_t name_hash; + uint32_t size; + uint16_t alignment; + uint16_t num_fields; +} +rc_json_struct_meta_t; + +void* rc_json_deserialize(void* buffer, uint32_t hash, const uint8_t* json); +int rc_json_get_size(size_t* size, uint32_t hash, const uint8_t* json); +uint32_t rc_json_hash(const uint8_t* str, size_t length); + +#ifdef __cplusplus +} +#endif + +#endif /* DEJSON_H */ diff --git a/deps/rcheevos/src/rjson/schema.c b/deps/rcheevos/src/rjson/schema.c new file mode 100644 index 0000000000..f063568f60 --- /dev/null +++ b/deps/rcheevos/src/rjson/schema.c @@ -0,0 +1,566 @@ +#include "rjson.h" +#include "dejson.h" + +static const rc_json_field_meta_t rc_json_field_meta_gameid[] = { + { + /* Metadata for field unsigned int gameid;. */ + /* name_hash */ 0xb4960eecU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_gameid_t, gameid), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field char success;. */ + /* name_hash */ 0x110461deU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_gameid_t, success), + /* type */ RC_JSON_TYPE_BOOL, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_gameid = { + /* fields */ rc_json_field_meta_gameid, + /* name_hash */ 0xb4960eecU, + /* size */ sizeof(rc_json_gameid_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_gameid_t), + /* num_fields */ 2 +}; + +int rc_json_get_gameid_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0xb4960eecU, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_gameid_t* rc_json_parse_gameid(void* buffer, const char* json) { + return (const rc_json_gameid_t*)rc_json_deserialize(buffer, 0xb4960eecU, (const uint8_t*)json); +} + +static const rc_json_field_meta_t rc_json_field_meta_login[] = { + { + /* Metadata for field const char* token;. */ + /* name_hash */ 0x0e2dbd26U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, token), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* user;. */ + /* name_hash */ 0x7c8da264U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, user), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int score;. */ + /* name_hash */ 0x0e1522c1U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, score), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int messages;. */ + /* name_hash */ 0xfed3807dU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, messages), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field char success;. */ + /* name_hash */ 0x110461deU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, success), + /* type */ RC_JSON_TYPE_BOOL, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_login = { + /* fields */ rc_json_field_meta_login, + /* name_hash */ 0x0d9ce89eU, + /* size */ sizeof(rc_json_login_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_login_t), + /* num_fields */ 5 +}; + +int rc_json_get_login_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0x0d9ce89eU, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_login_t* rc_json_parse_login(void* buffer, const char* json) { + return (const rc_json_login_t*)rc_json_deserialize(buffer, 0x0d9ce89eU, (const uint8_t*)json); +} + +static const rc_json_field_meta_t rc_json_field_meta_cheevo[] = { + { + /* Metadata for field unsigned long long created;. */ + /* name_hash */ 0x3a84721dU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, created), + /* type */ RC_JSON_TYPE_ULONGLONG, + /* flags */ 0 + }, + { + /* Metadata for field unsigned long long modified;. */ + /* name_hash */ 0xdcea4fe6U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, modified), + /* type */ RC_JSON_TYPE_ULONGLONG, + /* flags */ 0 + }, + { + /* Metadata for field const char* author;. */ + /* name_hash */ 0xa804edb8U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, author), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* badge;. */ + /* name_hash */ 0x887685d9U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, badge), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* description;. */ + /* name_hash */ 0xe61a1f69U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, description), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* memaddr;. */ + /* name_hash */ 0x1e76b53fU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, memaddr), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* title;. */ + /* name_hash */ 0x0e2a9a07U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, title), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int flags;. */ + /* name_hash */ 0x0d2e96b2U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, flags), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int points;. */ + /* name_hash */ 0xca8fce22U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, points), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int id;. */ + /* name_hash */ 0x005973f2U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, id), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_cheevo = { + /* fields */ rc_json_field_meta_cheevo, + /* name_hash */ 0x0af404aeU, + /* size */ sizeof(rc_json_cheevo_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_cheevo_t), + /* num_fields */ 10 +}; + +int rc_json_get_cheevo_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0x0af404aeU, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_cheevo_t* rc_json_parse_cheevo(void* buffer, const char* json) { + return (const rc_json_cheevo_t*)rc_json_deserialize(buffer, 0x0af404aeU, (const uint8_t*)json); +} + +static const rc_json_field_meta_t rc_json_field_meta_lboard[] = { + { + /* Metadata for field const char* description;. */ + /* name_hash */ 0xe61a1f69U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, description), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* title;. */ + /* name_hash */ 0x0e2a9a07U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, title), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* format;. */ + /* name_hash */ 0xb341208eU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, format), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* mem;. */ + /* name_hash */ 0x0b8807e4U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, mem), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int id;. */ + /* name_hash */ 0x005973f2U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, id), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_lboard = { + /* fields */ rc_json_field_meta_lboard, + /* name_hash */ 0xf7cacd7aU, + /* size */ sizeof(rc_json_lboard_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_lboard_t), + /* num_fields */ 5 +}; + +int rc_json_get_lboard_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0xf7cacd7aU, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_lboard_t* rc_json_parse_lboard(void* buffer, const char* json) { + return (const rc_json_lboard_t*)rc_json_deserialize(buffer, 0xf7cacd7aU, (const uint8_t*)json); +} + +static const rc_json_field_meta_t rc_json_field_meta_patchdata[] = { + { + /* Metadata for field const rc_json_lboard_t* lboards; int lboards_count;. */ + /* name_hash */ 0xf1247d2dU, + /* type_hash */ 0xf7cacd7aU, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, lboards), + /* type */ RC_JSON_TYPE_RECORD, + /* flags */ RC_JSON_FLAG_ARRAY + }, + { + /* Metadata for field const char* genre;. */ + /* name_hash */ 0x0d3d1136U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, genre), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* developer;. */ + /* name_hash */ 0x87f5b28bU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, developer), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* publisher;. */ + /* name_hash */ 0xce7b6ff3U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, publisher), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* released;. */ + /* name_hash */ 0x8acb686aU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, released), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char** presence;. */ + /* name_hash */ 0xf18dd230U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, presence), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ RC_JSON_FLAG_POINTER + }, + { + /* Metadata for field const char* console;. */ + /* name_hash */ 0x260aebd9U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, console), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const rc_json_cheevo_t* cheevos; int cheevos_count;. */ + /* name_hash */ 0x69749ae1U, + /* type_hash */ 0x0af404aeU, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, cheevos), + /* type */ RC_JSON_TYPE_RECORD, + /* flags */ RC_JSON_FLAG_ARRAY + }, + { + /* Metadata for field const char* image_boxart;. */ + /* name_hash */ 0xddc6bd18U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_boxart), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* image_title;. */ + /* name_hash */ 0x65121b6aU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_title), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* image_icon;. */ + /* name_hash */ 0xe4022c11U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_icon), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* title;. */ + /* name_hash */ 0x0e2a9a07U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, title), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field const char* image_ingame;. */ + /* name_hash */ 0xedfff5f9U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_ingame), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int consoleid;. */ + /* name_hash */ 0x071656e5U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, consoleid), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int id;. */ + /* name_hash */ 0x005973f2U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, id), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int flags;. */ + /* name_hash */ 0x0d2e96b2U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, flags), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field unsigned int topicid;. */ + /* name_hash */ 0x7d2b565aU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, topicid), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field char is_final;. */ + /* name_hash */ 0x088a58abU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, is_final), + /* type */ RC_JSON_TYPE_BOOL, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_patchdata = { + /* fields */ rc_json_field_meta_patchdata, + /* name_hash */ 0xadc4ac0fU, + /* size */ sizeof(rc_json_patchdata_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_patchdata_t), + /* num_fields */ 18 +}; + +int rc_json_get_patchdata_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0xadc4ac0fU, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_patchdata_t* rc_json_parse_patchdata(void* buffer, const char* json) { + return (const rc_json_patchdata_t*)rc_json_deserialize(buffer, 0xadc4ac0fU, (const uint8_t*)json); +} + +static const rc_json_field_meta_t rc_json_field_meta_patch[] = { + { + /* Metadata for field rc_json_patchdata_t patchdata;. */ + /* name_hash */ 0xadc4ac0fU, + /* type_hash */ 0xadc4ac0fU, + /* offset */ RC_JSON_OFFSETOF(rc_json_patch_t, patchdata), + /* type */ RC_JSON_TYPE_RECORD, + /* flags */ 0 + }, + { + /* Metadata for field char success;. */ + /* name_hash */ 0x110461deU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_patch_t, success), + /* type */ RC_JSON_TYPE_BOOL, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_patch = { + /* fields */ rc_json_field_meta_patch, + /* name_hash */ 0x0dddd3d5U, + /* size */ sizeof(rc_json_patch_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_patch_t), + /* num_fields */ 2 +}; + +int rc_json_get_patch_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0x0dddd3d5U, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_patch_t* rc_json_parse_patch(void* buffer, const char* json) { + return (const rc_json_patch_t*)rc_json_deserialize(buffer, 0x0dddd3d5U, (const uint8_t*)json); +} + +static const rc_json_field_meta_t rc_json_field_meta_unlocks[] = { + { + /* Metadata for field const unsigned int* ids; int ids_count;. */ + /* name_hash */ 0xc5e91303U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, ids), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ RC_JSON_FLAG_ARRAY + }, + { + /* Metadata for field unsigned int gameid;. */ + /* name_hash */ 0xb4960eecU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, gameid), + /* type */ RC_JSON_TYPE_UINT, + /* flags */ 0 + }, + { + /* Metadata for field char success;. */ + /* name_hash */ 0x110461deU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, success), + /* type */ RC_JSON_TYPE_BOOL, + /* flags */ 0 + }, + { + /* Metadata for field char hardcore;. */ + /* name_hash */ 0xc1b80672U, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, hardcore), + /* type */ RC_JSON_TYPE_BOOL, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_unlocks = { + /* fields */ rc_json_field_meta_unlocks, + /* name_hash */ 0x9b4e2684U, + /* size */ sizeof(rc_json_unlocks_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_unlocks_t), + /* num_fields */ 4 +}; + +int rc_json_get_unlocks_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0x9b4e2684U, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_unlocks_t* rc_json_parse_unlocks(void* buffer, const char* json) { + return (const rc_json_unlocks_t*)rc_json_deserialize(buffer, 0x9b4e2684U, (const uint8_t*)json); +} + +const rc_json_struct_meta_t* rc_json_resolve_struct(unsigned hash) { + + switch (hash) { + case 0xb4960eecU: return &rc_json_struct_meta_gameid; + case 0x0d9ce89eU: return &rc_json_struct_meta_login; + case 0x0af404aeU: return &rc_json_struct_meta_cheevo; + case 0xf7cacd7aU: return &rc_json_struct_meta_lboard; + case 0xadc4ac0fU: return &rc_json_struct_meta_patchdata; + case 0x0dddd3d5U: return &rc_json_struct_meta_patch; + case 0x9b4e2684U: return &rc_json_struct_meta_unlocks; + default: return NULL; + } +} diff --git a/deps/rcheevos/src/rjson/schema.dej b/deps/rcheevos/src/rjson/schema.dej new file mode 100644 index 0000000000..a902d5e835 --- /dev/null +++ b/deps/rcheevos/src/rjson/schema.dej @@ -0,0 +1,75 @@ +//---------------------------------------------------------------------------- + +struct gameid/GameID { + bool success/Success; + unsigned gameid/GameID; +}; + +//---------------------------------------------------------------------------- + +struct login/Login { + bool success/Success; + string user/User; + string token/Token; + unsigned score/Score; + unsigned messages/Messages; +}; + +//---------------------------------------------------------------------------- + +struct cheevo/Achievement { + unsigned id/ID; + string memaddr/MemAddr; + string title/Title; + string description/Description; + unsigned points/Points; + string author/Author; + string badge/BadgeName; + unsigned flags/Flags; + + unsigned long long modified/Modified; + unsigned long long created/Created; +}; + +struct lboard/Leaderboard { + unsigned id/ID; + string mem/Mem; + string format/Format; + string title/Title; + string description/Description; +}; + +struct patchdata/PatchData { + unsigned id/ID; + string title/Title; + unsigned consoleid/ConsoleID; + unsigned topicid/ForumTopicID; + unsigned flags/Flags; + string image_icon/ImageIcon; + string image_title/ImageTitle; + string image_ingame/ImageIngame; + string image_boxart/ImageBoxArt; + string publisher/Publisher; + string developer/Developer; + string genre/Genre; + string released/Released; + bool is_final/IsFinal; + string console/ConsoleName; + string* presence/RichPresencePatch; + cheevo cheevos/Achievements[]; + lboard lboards/Leaderboards[]; +}; + +struct patch/Patch { + bool success/Success; + patchdata patchdata/PatchData; +}; + +//---------------------------------------------------------------------------- + +struct unlocks/Unlocks { + bool success/Success; + unsigned ids/UserUnlocks[]; + unsigned gameid/GameID; + bool hardcore/HardcoreMode; +}; diff --git a/deps/rcheevos/src/rurl/url.c b/deps/rcheevos/src/rurl/url.c new file mode 100644 index 0000000000..bbfa4b703f --- /dev/null +++ b/deps/rcheevos/src/rurl/url.c @@ -0,0 +1,245 @@ +#include "rurl.h" + +#include + +static int rc_url_encode(char* encoded, size_t len, const char* str) { + for (;;) { + switch (*str) { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + case '-': case '_': case '.': case '~': + if (len >= 2) { + *encoded++ = *str++; + len--; + } + else { + return -1; + } + + break; + + default: + if (len >= 4) { + snprintf(encoded, len, "%%%02x", (unsigned char)*str); + encoded += 3; + str++; + len -= 3; + } + else { + return -1; + } + + break; + + case 0: + *encoded = 0; + return 0; + } + } +} + +int rc_url_award_cheevo(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned cheevo_id, int hardcore) { + char urle_user_name[64]; + char urle_login_token[64]; + int written; + + if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) { + return -1; + } + + if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) { + return -1; + } + + written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=awardachievement&u=%s&t=%s&a=%u&h=%d", + urle_user_name, + urle_login_token, + cheevo_id, + hardcore ? 1 : 0 + ); + + return -(written + 1 > size); +} + +int rc_url_submit_lboard(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned lboard_id, unsigned value, unsigned char hash[16]) { + char urle_user_name[64]; + char urle_login_token[64]; + int written; + + if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) { + return -1; + } + + if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) { + return -1; + } + + written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=submitlbentry&u=%s&t=%s&i=%u&s=%u&v=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + urle_user_name, + urle_login_token, + lboard_id, + value, + hash[ 0], hash[ 1], hash[ 2], hash[ 3], hash[ 4], hash[ 5], hash[ 6], hash[ 7], + hash[ 8], hash[ 9], hash[10], hash[11],hash[12], hash[13], hash[14], hash[15] + ); + + return -(written + 1 > size); +} + +int rc_url_get_gameid(char* buffer, size_t size, unsigned char hash[16]) { + int written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=gameid&m=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + hash[ 0], hash[ 1], hash[ 2], hash[ 3], hash[ 4], hash[ 5], hash[ 6], hash[ 7], + hash[ 8], hash[ 9], hash[10], hash[11],hash[12], hash[13], hash[14], hash[15] + ); + + return -(written + 1 > size); +} + +int rc_url_get_patch(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid) { + char urle_user_name[64]; + char urle_login_token[64]; + int written; + + if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) { + return -1; + } + + if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) { + return -1; + } + + written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=patch&u=%s&t=%s&g=%u", + urle_user_name, + urle_login_token, + gameid + ); + + return -(written + 1 > size); +} + +int rc_url_get_badge_image(char* buffer, size_t size, const char* badge_name) { + int written = snprintf( + buffer, + size, + "http://i.retroachievements.org/Badge/%s", + badge_name + ); + + return -(written + 1 > size); +} + +int rc_url_login_with_password(char* buffer, size_t size, const char* user_name, const char* password) { + char urle_user_name[64]; + char urle_password[64]; + int written; + + if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) { + return -1; + } + + if (rc_url_encode(urle_password, sizeof(urle_password), password) != 0) { + return -1; + } + + written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=login&u=%s&p=%s", + urle_user_name, + urle_password + ); + + return -(written + 1 > size); +} + +int rc_url_login_with_token(char* buffer, size_t size, const char* user_name, const char* login_token) { + char urle_user_name[64]; + char urle_login_token[64]; + int written; + + if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) { + return -1; + } + + if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) { + return -1; + } + + written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=login&u=%s&t=%s", + urle_user_name, + urle_login_token + ); + + return -(written + 1 > size); +} + +int rc_url_get_unlock_list(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid, int hardcore) { + char urle_user_name[64]; + char urle_login_token[64]; + int written; + + if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) { + return -1; + } + + if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) { + return -1; + } + + written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=unlocks&u=%s&t=%s&g=%u&h=%d", + urle_user_name, + urle_login_token, + gameid, + hardcore ? 1 : 0 + ); + + return -(written + 1 > size); +} + +int rc_url_post_playing(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid) { + char urle_user_name[64]; + char urle_login_token[64]; + int written; + + if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) { + return -1; + } + + if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) { + return -1; + } + + written = snprintf( + buffer, + size, + "http://retroachievements.org/dorequest.php?r=postactivity&u=%s&t=%s&a=3&m=%u", + urle_user_name, + urle_login_token, + gameid + ); + + return -(written + 1 > size); +} diff --git a/deps/rcheevos/test/Makefile b/deps/rcheevos/test/Makefile new file mode 100644 index 0000000000..32562be5e4 --- /dev/null +++ b/deps/rcheevos/test/Makefile @@ -0,0 +1,38 @@ +RC_SRC=../src/rcheevos +RC_JSON_SRC=../src/rjson +RC_URL_SRC=../src/rurl +LUA_SRC=lua/src + +OBJ=$(RC_SRC)/trigger.o $(RC_SRC)/condset.o $(RC_SRC)/condition.o $(RC_SRC)/operand.o \ + $(RC_SRC)/term.o $(RC_SRC)/expression.o $(RC_SRC)/value.o $(RC_SRC)/lboard.o \ + $(RC_SRC)/alloc.o $(RC_SRC)/format.o \ + $(RC_JSON_SRC)/dejson.o $(RC_JSON_SRC)/schema.o \ + $(RC_URL_SRC)/url.o \ + $(LUA_SRC)/lapi.o $(LUA_SRC)/lcode.o $(LUA_SRC)/lctype.o $(LUA_SRC)/ldebug.o \ + $(LUA_SRC)/ldo.o $(LUA_SRC)/ldump.o $(LUA_SRC)/lfunc.o $(LUA_SRC)/lgc.o $(LUA_SRC)/llex.o \ + $(LUA_SRC)/lmem.o $(LUA_SRC)/lobject.o $(LUA_SRC)/lopcodes.o $(LUA_SRC)/lparser.o \ + $(LUA_SRC)/lstate.o $(LUA_SRC)/lstring.o $(LUA_SRC)/ltable.o $(LUA_SRC)/ltm.o \ + $(LUA_SRC)/lundump.o $(LUA_SRC)/lvm.o $(LUA_SRC)/lzio.o $(LUA_SRC)/lauxlib.o \ + $(LUA_SRC)/lbaselib.o $(LUA_SRC)/lbitlib.o $(LUA_SRC)/lcorolib.o $(LUA_SRC)/ldblib.o \ + $(LUA_SRC)/liolib.o $(LUA_SRC)/lmathlib.o $(LUA_SRC)/loslib.o $(LUA_SRC)/lstrlib.o \ + $(LUA_SRC)/ltablib.o $(LUA_SRC)/lutf8lib.o $(LUA_SRC)/loadlib.o $(LUA_SRC)/linit.o \ + test.o + +all: test + +%.o: %.c + gcc -Wall -O0 -g -I../include -I$(RC_SRC) -I$(LUA_SRC) -c $< -o $@ + +test: $(OBJ) + gcc -o $@ $+ -lm + +test.o: smw_snes.h galaga_nes.h + +smw_snes.h: smw_snes.json + xxd -i $< | sed "s@unsigned@const@" > $@ + +galaga_nes.h: galaga_nes.json + xxd -i $< | sed "s@unsigned@const@" > $@ + +clean: + rm -f test $(OBJ) smw_snes.h galaga_nes.h diff --git a/deps/rcheevos/test/galaga_nes.json b/deps/rcheevos/test/galaga_nes.json new file mode 100644 index 0000000000..9039bec3b1 --- /dev/null +++ b/deps/rcheevos/test/galaga_nes.json @@ -0,0 +1,205 @@ +{ + "Success": true, + "PatchData": { + "ID": 1701, + "Title": "Galaga", + "ConsoleID": 7, + "ForumTopicID": 2528, + "Flags": 0, + "ImageIcon": "\/Images\/002324.png", + "ImageTitle": "\/Images\/002322.png", + "ImageIngame": "\/Images\/002323.png", + "ImageBoxArt": "\/Images\/012173.png", + "Publisher": "Bandai America (NA), Namco (JP)", + "Developer": "Namco", + "Genre": "Fixed Shooter", + "Released": "Nov 1988 (NA), Feb 1985 (JP)", + "IsFinal": false, + "ConsoleName": "NES", + "RichPresencePatch": null, + "Achievements": [{ + "ID": 10055, + "MemAddr": "0xH0482=5", + "Title": "That Was Easy", + "Description": "Get to level 5.", + "Points": 5, + "Author": "dude1286", + "Modified": 1404761487, + "Created": 1404761423, + "BadgeName": "09723", + "Flags": 3 + }, { + "ID": 10056, + "MemAddr": "0xH0481=1", + "Title": "Getting Slightly Difficult", + "Description": "Get to level 10.", + "Points": 20, + "Author": "dude1286", + "Modified": 1404761490, + "Created": 1404761427, + "BadgeName": "09724", + "Flags": 3 + }, { + "ID": 10057, + "MemAddr": "0xH0481=2", + "Title": "Hail of Bullets", + "Description": "Get to level 20.", + "Points": 25, + "Author": "dude1286", + "Modified": 1404761493, + "Created": 1404761430, + "BadgeName": "09725", + "Flags": 3 + }, { + "ID": 10058, + "MemAddr": "0xH0481=3", + "Title": "Bulletstorm", + "Description": "Get to level 30.", + "Points": 40, + "Author": "dude1286", + "Modified": 1404761498, + "Created": 1404761435, + "BadgeName": "09726", + "Flags": 3 + }, { + "ID": 10059, + "MemAddr": "0xH0480=0_0xH0481=0_0xH0482=3_R:0xH0482!=3.1._0xH00c4=40", + "Title": "Challenge 1 Master", + "Description": "Get a perfect on Stage 3.", + "Points": 15, + "Author": "dude1286", + "Modified": 1404796406, + "Created": 1404761443, + "BadgeName": "09715", + "Flags": 3 + }, { + "ID": 10060, + "MemAddr": "0xH0480=0_0xH0481=0_0xH0482=7_0xH00c4=40_R:0xH0482!=7.1.", + "Title": "Challenge 2 Master", + "Description": "Get a perfect on Stage 7.", + "Points": 20, + "Author": "dude1286", + "Modified": 1404796449, + "Created": 1404761447, + "BadgeName": "09716", + "Flags": 3 + }, { + "ID": 10061, + "MemAddr": "0xH0480=0_0xH0481=1_0xH0482=1_R:0xH0482!=1.1._0xH00c4=40", + "Title": "Challenge 3 Master", + "Description": "Get a perfect on Stage 11.", + "Points": 25, + "Author": "dude1286", + "Modified": 1404796468, + "Created": 1404761450, + "BadgeName": "09717", + "Flags": 3 + }, { + "ID": 10062, + "MemAddr": "0xH0480=0_0xH0481=1_0xH0482=5_R:0xH0482!=5.1._0xH00c4=40", + "Title": "Challenge 4 Master", + "Description": "Get a perfect on Stage 15.", + "Points": 30, + "Author": "dude1286", + "Modified": 1404796484, + "Created": 1404761454, + "BadgeName": "09718", + "Flags": 3 + }, { + "ID": 10063, + "MemAddr": "0xH0480=0_0xH0481=1_0xH0482=9_R:0xH0482!=9.1._0xH00c4=40", + "Title": "Challenge 5 Master", + "Description": "Get a perfect on Stage 19.", + "Points": 35, + "Author": "dude1286", + "Modified": 1404796507, + "Created": 1404761457, + "BadgeName": "09719", + "Flags": 3 + }, { + "ID": 10064, + "MemAddr": "0xH0480=0_0xH0481=2_0xH0482=3_R:0xH0482!=3.1._0xH00c4=40", + "Title": "Challenge 6 Master", + "Description": "Get a perfect on Stage 23.", + "Points": 40, + "Author": "dude1286", + "Modified": 1404796523, + "Created": 1404761461, + "BadgeName": "09720", + "Flags": 3 + }, { + "ID": 10065, + "MemAddr": "0xH0480=0_0xH0481=2_0xH0482=7_R:0xH0482!=7.1._0xH00c4=40", + "Title": "Challenge 7 Master", + "Description": "Get a perfect on Stage 27.", + "Points": 45, + "Author": "dude1286", + "Modified": 1404796555, + "Created": 1404761464, + "BadgeName": "09721", + "Flags": 3 + }, { + "ID": 10066, + "MemAddr": "0xH0480=0_0xH0481=3_0xH0482=1_R:0xH0482!=1.1._0xH00c4=40", + "Title": "Challenge 8 Master", + "Description": "Get a perfect on Stage 31.", + "Points": 50, + "Author": "dude1286", + "Modified": 1404796574, + "Created": 1404761468, + "BadgeName": "09722", + "Flags": 3 + }, { + "ID": 10067, + "MemAddr": "0xH0079=4_d0xH0079=3", + "Title": "Was That On Purpose?", + "Description": "Get one of your ships captured by the enemy.", + "Points": 5, + "Author": "dude1286", + "Modified": 1404761532, + "Created": 1404761472, + "BadgeName": "09714", + "Flags": 3 + }, { + "ID": 10068, + "MemAddr": "d0xH0079=6_0xH0079=1", + "Title": "Doubled Fire", + "Description": "Save a captured ship and have double the fire power.", + "Points": 10, + "Author": "dude1286", + "Modified": 1404761536, + "Created": 1404761476, + "BadgeName": "09713", + "Flags": 3 + }, { + "ID": 10069, + "MemAddr": "0xH00e2>=3_d0xH00e2<3", + "Title": "Default Score", + "Description": "Get higher than the default hi-score.", + "Points": 10, + "Author": "dude1286", + "Modified": 1404761540, + "Created": 1404761479, + "BadgeName": "09727", + "Flags": 3 + }, { + "ID": 10070, + "MemAddr": "0xH0482=2_d0xH0482=1_0xH04af=0xH04a7_0xH04ae=0xH04a6_0xH04ad=0xH04a5", + "Title": "Perfect Shot", + "Description": "Get to the second level without missing a shot.", + "Points": 25, + "Author": "dude1286", + "Modified": 1404761543, + "Created": 1404761482, + "BadgeName": "09712", + "Flags": 3 + }], + "Leaderboards": [{ + "ID": 310, + "Mem": "STA:0xh0482=1::CAN:0xh0470=0_0xh0471=0::SUB:0xh0485=0_d0xh007a=0_0xh007a=1::VAL:0xh00e5*10_0xh00e4*100_0xh00e3*1000_0xh00e2*10000_0xh00e1*100000_0xh00e0*1000000", + "Format": "SCORE", + "Title": "Hi-Score", + "Description": "Get the highest score possible." + }] + } +} \ No newline at end of file diff --git a/deps/rcheevos/test/lua/Makefile b/deps/rcheevos/test/lua/Makefile new file mode 100644 index 0000000000..119110d2f0 --- /dev/null +++ b/deps/rcheevos/test/lua/Makefile @@ -0,0 +1,114 @@ +# Makefile for installing Lua +# See doc/readme.html for installation and customization instructions. + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +# Where to install. The installation starts in the src and doc directories, +# so take care if INSTALL_TOP is not an absolute path. See the local target. +# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with +# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. +INSTALL_TOP= /usr/local +INSTALL_BIN= $(INSTALL_TOP)/bin +INSTALL_INC= $(INSTALL_TOP)/include +INSTALL_LIB= $(INSTALL_TOP)/lib +INSTALL_MAN= $(INSTALL_TOP)/man/man1 +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V + +# How to install. If your install program does not support "-p", then +# you may have to run ranlib on the installed liblua.a. +INSTALL= install -p +INSTALL_EXEC= $(INSTALL) -m 0755 +INSTALL_DATA= $(INSTALL) -m 0644 +# +# If you don't have "install" you can use "cp" instead. +# INSTALL= cp -p +# INSTALL_EXEC= $(INSTALL) +# INSTALL_DATA= $(INSTALL) + +# Other utilities. +MKDIR= mkdir -p +RM= rm -f + +# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + +# Convenience platforms targets. +PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris + +# What to install. +TO_BIN= lua luac +TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp +TO_LIB= liblua.a +TO_MAN= lua.1 luac.1 + +# Lua version and release. +V= 5.3 +R= $V.4 + +# Targets start here. +all: $(PLAT) + +$(PLATS) clean: + cd src && $(MAKE) $@ + +test: dummy + src/lua -v + +install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) + cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) + +uninstall: + cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) + cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC) + cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB) + cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN) + +local: + $(MAKE) install INSTALL_TOP=../install + +none: + @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" + @echo " $(PLATS)" + @echo "See doc/readme.html for complete instructions." + +# make may get confused with test/ and install/ +dummy: + +# echo config parameters +echo: + @cd src && $(MAKE) -s echo + @echo "PLAT= $(PLAT)" + @echo "V= $V" + @echo "R= $R" + @echo "TO_BIN= $(TO_BIN)" + @echo "TO_INC= $(TO_INC)" + @echo "TO_LIB= $(TO_LIB)" + @echo "TO_MAN= $(TO_MAN)" + @echo "INSTALL_TOP= $(INSTALL_TOP)" + @echo "INSTALL_BIN= $(INSTALL_BIN)" + @echo "INSTALL_INC= $(INSTALL_INC)" + @echo "INSTALL_LIB= $(INSTALL_LIB)" + @echo "INSTALL_MAN= $(INSTALL_MAN)" + @echo "INSTALL_LMOD= $(INSTALL_LMOD)" + @echo "INSTALL_CMOD= $(INSTALL_CMOD)" + @echo "INSTALL_EXEC= $(INSTALL_EXEC)" + @echo "INSTALL_DATA= $(INSTALL_DATA)" + +# echo pkg-config data +pc: + @echo "version=$R" + @echo "prefix=$(INSTALL_TOP)" + @echo "libdir=$(INSTALL_LIB)" + @echo "includedir=$(INSTALL_INC)" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho + +# (end of Makefile) diff --git a/deps/rcheevos/test/lua/README b/deps/rcheevos/test/lua/README new file mode 100644 index 0000000000..0b31908a06 --- /dev/null +++ b/deps/rcheevos/test/lua/README @@ -0,0 +1,6 @@ + +This is Lua 5.3.4, released on 12 Jan 2017. + +For installation instructions, license details, and +further information about Lua, see doc/readme.html. + diff --git a/deps/rcheevos/test/lua/doc/contents.html b/deps/rcheevos/test/lua/doc/contents.html new file mode 100644 index 0000000000..445556f964 --- /dev/null +++ b/deps/rcheevos/test/lua/doc/contents.html @@ -0,0 +1,619 @@ + + + +Lua 5.3 Reference Manual - contents + + + + + + + +

+Lua +Lua 5.3 Reference Manual +

+ +

+The reference manual is the official definition of the Lua language. +
+For a complete introduction to Lua programming, see the book +Programming in Lua. + +

+ +

+ +Copyright © 2015–2017 Lua.org, PUC-Rio. +Freely available under the terms of the +Lua license. + + +

Contents

+ + +

Index

+ + + + + + + + + + + + + + diff --git a/deps/rcheevos/test/lua/doc/index.css b/deps/rcheevos/test/lua/doc/index.css new file mode 100644 index 0000000000..c961835731 --- /dev/null +++ b/deps/rcheevos/test/lua/doc/index.css @@ -0,0 +1,21 @@ +ul { + list-style-type: none ; +} + +ul.contents { + padding: 0 ; +} + +table { + border: none ; + border-spacing: 0 ; + border-collapse: collapse ; +} + +td { + vertical-align: top ; + padding: 0 ; + text-align: left ; + line-height: 1.25 ; + width: 15% ; +} diff --git a/deps/rcheevos/test/lua/doc/logo.gif b/deps/rcheevos/test/lua/doc/logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..5c77eacc3b8f397fb2e87d2aaecd89128e53a117 GIT binary patch literal 9893 zcmZ`JAZZ!6FBhF{g-pRY z?mq`C!p1xV^4?ZTR7k~j;V9G1HDS87U+{!}P$o&rgc4zX0NDT~riS`~QEcMXc4?@W z^+STR)$~fm_`ABgqdI|BbFIpHF{r}hP+etgD8-NQs7W75NaJI?Ql(hqjVakK+HRty zUXfx9(Bq-+-?*K3uw9ID@9?*;-eo#?myt-t^)SGPba%#*OB5Fu=j7)HeEWuc=*-K) z!oqjj0S)u!&5gi;Bahobc>^^a9XUOHT z2|mFhODfM>_&5x-TrvTHjN4n=t}cJHz|Oj&#(Ac#A<;QYj?%w(I{6NHetKEy88L^C$rQ3l)#a6 zoT#z!d-$MNnQ|f0h4|+;?CDm7g1UnqCpv3AVbZ0g!y5D)ht6oJG9OD4(C|vg-ir+_ zH4QGgnPSh+=ffel34{g3QbJKkb?GxJXlu)W&M4!QB^7H4b450C&zK>m4Sy@4- z6QwcXU;C4g#1AgjGlY}HQLNi?RV^MlIy=8Y#lo5nG5DcI$LoBU)7F-?yK5#MO(ZKV z4S#la_H=)P#gQKG^HdgSn#J9BwwdVYIM>{c*8F@wEO$d}R+sxjn>$#7D0Sp=?`**6 zSgb455aPSEq?K#BY9czOB~w zbadnT{PaZ|6MyUb3JQ8>r#+FkD@XhNG?}o-!{}_4A*5_Nyi-4?sw$?YhV}1AdjC?B zgUxkSi}=^CG*t3gMjJh01>e6T@3$!ESeZ^i-|I!u zS;Y;*lPMP-5pj1|J68PThiJLljogBy_@_?@umOG-J7a9_muB|%_5%Y0xG`uvyho24 zIB%XLJt0uPbhhSAqhnKw*C!-wew~ll#zHvKqtx}hu;K?rot-)2DP`g3vIG)P#bW#V z#78r@yHnXrnbSui-|;3*m#OEgl|Ar3-?ZbLj*ECy&1Z-(e4BAv822YtIM?~_>A{XCM0gm<2F`yi=~k^Qpkaj;z9R!JMds*m*#io0jdc7= z_32qZaeQ{RyoLtu;NW0GM#|0W?QI53?3wlUfYmFzOS9J|wG7ON3R+r2E3FBfX*p?^~m1 z6V|U~sT|y#!d_|FC~juNn3R-(U?c)K1cYB-XL+RJsusn5sJ+RfCJjfoveJPB2E8VY ze>-6GiZ=08p%V7#QAzD2(fGeZ=h&GUh!qrTD!o3Hx0HW92SHt(m5Rzw1vQg>ESIRL zceqjS=8oh<74zz*;XjH7mM-Q|N>rkd^6&&UHrgsF*A*1*Ny>erU}PL7XDcg0?d{O* z1OHq$wC4kBW@%Z_)RY<-8R=VoJu1hW%$PbbR=GYYPsi<1pLKq2BJ*9&lH*Mr1@h?- zk$H2rr%((U;g63+%JFe|?|D5i*-R){z1;cs_IMilux#weYs=fwFeyZelpm6zO3TXT zYfVu=SRoN`fR)c~#H3%xLrrVG){XLs%W+C*j!X)3XXS=o9L4Y7Y4c4Nn3e6iqIP!B$P!~=+%bVCorwZbea_d%{9_@+x)gMD z!A=L1w$D$>lAk8s9b;tVXJZqwMyRqA-fVf9jLHaCqMT)d%(`(nU#mfn-S)W6#P; z=3~G1aSyeny@xz{sqe(QAtQ%m7HZiLcGoU!#=I^tB;>)$tUp@4#&}2onV7?oPE35i zlo$@3HMJv8Y>)4(2i;^?lJIo!@e!ZH+B3jmXa9^CL-NPx#NG&|6hO2b&vPRZ#5%&5>oeqS2brR1*C$NtWqMvwVDOx5Y@S#^ z&_6%4yRdnC(v!H)L}^Ka+LW}D-Cm1w)+quD5+xy*Ed+psxoShNndF8Bm$M#>koguj z6f7);EM(I_VR11rgmli6^)M>r$(5Du>ykxlf{`JnO5?K)MC~1O8|-vR+p3I8AN~*= zT@6_!CDC>&*w)uvnR50H4tI|iW17v5G!4tni~8OiB$0i{-skaNkDJ7=p?>-!QAtuK zGH&qwyZv(MezW5r9PF&?$r6pDH(b=RG{xXlS@d8_Q?g~x9Zwmx@oP1+_x>s#?yX&A zJ<$i~41SNKh86dSYQui}G5(udqd)BUytgYi|Dx4(X$bQst#fSOqxZjt63ThVELa(< z=wI@Opzy_vOv)kuWxt8eUN7D5>|Apl8>nubM5%c9f7!7;r$k%CGhCKXT2 z-k!qzYR%Czzyy-azx++9a_n;OQf4Lr3KX3NpT!_=3b$18MH`>vz-i^}tMTVUZ z>>6?`x}LOt@qT{D&)`uV`Y3Z+ZZooW)2=6EW~SdY0o?^b4jI6ZC)@y&ZP@Uz`5D7Z zl7dqFba9n&vrI2DRB5j@vG&K0)N-wxvoW8ny|(k~ASD{ZgPGTs%RJA)pGADun)w|a z9dCPO-ENNA_?|AQmW!TZVZ#avB>&ydPA~a9V`hh<#3X&+zS}w3vd~Kp=B*6_p}bcV zUE^_+>f5sHi>P1s`6V5{K_R*fd;9HOnbE7L83#ush~4-^y8hd8)pE5F z;(t~CR|ixR&)!V>9E-Q}W7qM?>PHTG9O>l`kbNR(){jzBZ*ds4KT^iK9nC2MFeUHP z9338RB2IKBlpAx=O+0EmU0UsJqgAF_Yqf}8Q@d%~4+9$z#-MfW^efyWWMSd6uGf_+ zqjn?n8k;pT-XZ&lpw~#O~n_8?Twhc9ed6YFyb#LI=KCJ zvxB&XLT&i`?-Sp}FiYifPlEId6de`PfSdd$>PIn)jd(&d4rO4 z)`gJ$(5q|9mZSEj+U-Jyj68(nd8|~`FqMr8&xOZFD(-ejPhfMcleKc;TX^`F^Q}P@ zH8mx*zim<8h~pUTMM@?2#=mgs!BWd|-=d!OJHi|z39ur+V?Et3D{3|8<={wSG3*04*38Uo_r^=G9s|a2cvz-V z?>h*Y_J3Cw*8EqJ+E0vUf*#IF9rqE@D5hP3xQMXi$A5?SFx~#$VJzA8YVz(7Q})(U6RbGxnUHX$I?6)oBrzO(9Gijguu~Q)mrI3TvYr5V zlecf*E;%n+iHt!C3&ov}`Pd8MvETwj-e6#3A9{!ob!->gJ&Dyi?9fPmit;{cNQQD} zRloJu`6cIqVp~w*ZEHNPfMO=t?uJUuz+PjK>|*NYH$DV0sZDM5xKUD4+E5i?XUAS~ z&ENey8k;>nVL)7Oe!#gxo%g+OLzzHbZ^Q#Hr?fQO-~Uyl_=%{Dwe=v}>VpS~e)Zfd zq6(`zp2q6M3EN{ptaCKVO!w*q^{zTx5U{s93}a&p(^r#9_g$4P^C zhOAD1#@AZmX9yCK(qOMLy4SZxI3t?z`q%(R0dXh+nA(Xct8Ixl9UWcRw{PM_lWt44 zii-UG-&9%8)deq&#<(253+VH6aJtz4m08Z|cR8Fh9?iD7Y$R^gm6wr0OlHzMRz(`> zc#of!mL@4Fxf?IyQ+0dVt(2A~UOH1LC^|9d2W<@XX~FiNC;9vL0sMRjA2{kA)_ivs zeWeS@SXj{VCnOyl*v3ad<_MUZ(*T3SXZzS^K0w(^57NRwPnw6=RAub}_Hv4CRcFz|73xTIY87ZN%Eu-R<#d?Y0Mk9Z}Bv zYr7mCuc_(%=s#ii#emwHHkH8m#t`<|2Vzt7Ll=jtqy z)$u#R!;`EfUY`u5UOo|I+42}XT)zUCA%0A-^7`I=ZfR-o#M>pI(&x#FQO~-wA&6X` z)yeVAwEKme93k?X@U%31d;)%TT8MV@)M27H{Ks-Nz!g>w@Q)m&r)ECy?&D|eyj2WD z5o~z@y`E18lT9aWgGMI%u|qa35ieo1_7QK4-^D*)V(2O9s-SjK2ozF~_xSI1JUn=b zy>CfBmtzObTZ)&fd8j^&zW*o2Cny~%la4)hePrQ&alp>0b+@msxA}OtZYdw5sBHN6 ztY2{B#7A&&qxUPlZbskj8B0%J@YVO!y3g-G)<+CB0VRNfvmr2^%A)G?(XzvKx_J8c@z3|&{Jf#Q6hf-12#XCn z7r*I(05aTlBn=FvRV={-z0+e8P%4{pPQ2F+ylIcnR!zi{>dI$k4-)qKT;6A1muF^S zK@RG@;X6RE3#zLPC5zl$yRohr!qFKRGMCf%c85Adviqy5tKWrm?BiqK zJlr6{$2}y}emwh4R~Zu<+v)!rAvhG56B@nNgK8~TG-+s&BVCBA0)MH6Qz1MY zE!g%GI++q<31}P~DeNho66M2rTY);Fw)_xu*nZscis(d#~c9jyj zlO_C&>f}=Bs;a6})6=1f$k$?UuQo zZj|=1ToL2BBQGZkFdJ#5n4sGI_w=9=6GwLu$gdFr zh@3YGgbkL}(_R~PjdJ9F=gAn_f;2xJN7|XcD)GfrMW1)WQ8+fEHZ(*N2vyEHta{ym zJ9?aozqKTFj7fv5GVqnYQ;U7M9$e-XJy*c9ovSeEAX* z_qjGGA8%scLJA^GI>}8 z0u=`bV!4{EnHef=;?l|Mk|G&AF^v?P#5t_BW^7QU-Bp)8{tk;~`REdzZuECUqksL% z({@#k_d|!*Zz7-EdY61|W+q6R@mAYKgEF4Y!6Z-K>LVxg*3OQyfuyN0BkoWHzR ze@`Hb)#sM}c1JEkE<$Ag03DiREQpYh&<73>=auitEdPKE5Zio;M8>8#N3>mg$0#?fpooPYP3zvz$nr7G*V7M zL14Z_bdBXaYg~N14k9WJj)Z~&Du{QYWN+27M0$-FY3mA?660V3@hEr#80d}w6uBc2 z&xqbW5PdYDPRl#h-K81fsXxHpZz5AyS!#Y)UzBun<3>V4@)GI(`I&(y^V|Nuxg|$> ze-xu$mXxC-bvJjTp)D$GT`3va6usUGXWYHK56@_&k5|l4vR1Rs&x#osT?6V=nbSGf zNgVWviClW^l>IX%D-Hsnz=(>8T~WS@?M&=}0=Gz!$qFHiCcqgvoX^J_MPyEqLP0_T zb4;*2p#vi+Gj-|xXMBA0c)93JEa7Bg!0Ez*S5~L7_vr6)zKF6xBOtNG78De$aK-4l zeXw5Q`YxaS?ekGnkbI$1mB|Q9bQHQsm_-1i4t)GUm|kp&@+NF2q~fM^;guaSW5drtx9X1l{5mNq(_-&+XiTn`hG7xNubGh-OWvXylx2D+uyhNHEuTL`TXFZQESqr z@1Eb*h7^$7wv@4yyalP)=k5 ztp@8qNET4Yfq*ppnVftWU#Mi{zggx?1(g1hR?AF7gL#a<0p2DqkruOp>mR#??h!I0 zR-@x!50K!O9L8=}OuaAjnD3C{Cg-mEz^5}70Z{c=dST~_(OVbQUEHQ(>p!wd^mKqDerqMHD0f3E%r6}(tKvECnk z>(}yvt*>g`NS`kR``z|Sx)B}Knx6mB7#X>$cNmgf9t?h|w!Pd{EG=yrimJ8SROySp zxuRb~X=L@Xny;x`ErtJobBCTDE_E2|(CyLn{pxKWFOZv&h2JqMsGF|GO01kDe+PLy zCZ(8^n>%hm63f2HmqH2?iyi3eCughAUJ3jj;WSJ(drz_eRlI$h2K7!_=*#0RE{Ao- z{*C5-|KIZRazbu<7{D8Zh5h?Y13)cK=N#LbkXY?s#|?c8LrbUScHD&FT@po=jF7=Q zJI5p{jk#{)GgMSu>}TW67Q*eI6dHvD9)d)Qv9+aheE8Q%){c!2T~2dz&_sUSJl^?GmyDOdBCvz1``m^V5AmdwV#F{P!Yxje4v0fRqp zR0c8$iZ^pI5Eo^>9~8zQBpiJV?j}{#S(bKkib!XHvlbwrhY>}irA;d-W^Q^~(ea4e zl0Mr=%l4D*`m}qM3wX^%3z*^8)%&}$Pbt3P> zOI`DB@Oua*(rNKvFMnQaQ+!Zge6uu-jy?DDE9}LNN5%DPX8foO0k5=z0*XJA%Lm9y ztbj*;>5IhMb>xX|4e|g(z<0lEnM5zuuOs!7$(B5nUNdeqKYH|f!C65=1I!#H6_sfR z=11rir@n9RK8cG5s}JUTpuT(eJ6@i#@aGiQ8q^L#V}Pi6={Kru?FEmZD@?f}3`I;l z;N&?eL*5j)-;QP$&9%6V!Icvenn?mi!1w&9^B-mEvpr8HKt003u*hp~LzSO_-gw)I z^7mfb?O_#4x-f(IQQz9d;Oi<$@=)a`&r@G0chPW81!^O{>$xM(O#*HriRwpQA=EX3 z)q(Zueoq!$w_u^GFC6J^H_I;EZhw9?J3(@DrR%MAF1?v>rYjb&#x|B z5wUP^;**nilr?XOC|@QARsjTzb= zPGt)L{w+KLLbZnHC*_LSkkb&sA8R{;dV%7T@fN$QuPe${#(dgB1s@H9#(J0-7`DM} zDJUqIO-BjG&iP#b#ERz|OqZ(89XU4yh4PD;6~_@jyE2xP#6BLHKCs}*EZwjFB`Yc6 z0b|q!M&DE5=u=!zZv>7aH731o3vN^&n@_hdwLfe?ON)8E<$S*%bh7($vo%BGkKhQL zqKmEgPhOFT`v?)e!oXPs(1~bKHy8;T@`2sy6zKR1nfzs$S`zr7AgVnd7He-uT};rh z*gcgFZigXx)L&RrLn9+EOZVsMY`H{Vbge06VuxE>%?2;e0%_=3A)8MB4?w@Z8_rB8 zWPUxSzs?4&-QpUHB5(^FJ`A7AS5mo6Q4Msp|kLZhOt3Y&C` zRp8q$3q{o`2t|wv(n@LB7#R4k-Uic=H^OCSRqXJtrjERL4#q>QE$|z-aHeBf+eZzn zebx;(4rkY}-rUeC>gvF8IvJmt>HD2Xm&$D5ze)ksDA%0K$X@GlgXerA&<#W>E<(ne zlk_pfilr|2pbP*qG}^t<4`$`b_;n7{O>q@5X=rIT0#F1DMDS_WA zWNXXpvh0++8j2!fi*)&6r%G^q{%gO!S#C~FFa{MZ4gHU9eX~BJ{SI>{5~-Ec>eoUu zndqE>Qz{H#Q$Y$hTi6TFm5sXO9vRXn4JRusEHtb8oR`lZ4c~Um3oDF*D)~KzLLEj< zM~46lYXldOAt9MlS=IP^Nl8Fbk{l1u(gSyJAaz)z3I-OI@Rz*c1WX1H^%PVVz|8~O zE^@R+ec87V^{X{*Z#Sdy04dRvD_;?gqaZ{^OCOonX{;6mwFubrnDFzm1Vz;0KkMq; z603#?5Z&5tl9I4TGkN>LmWx!d{JFWgiExTe-vE`N*l06rN#-yV{Z zmKLUr_Y!)v29ArE*lXIvaO0sQ7J!kX5AWK(%xOSp%2Bb-kMMdf%cP8$K%%Yg{&iI8 zLy9H`I|JUt4jRd1@?e$Ew3|<@L!{zB=>UmiV`Ib9W?UW@TQ$46xfxv3ZnX6Sw`T)& z4^$^fkmWiOrT+y}hvP=Q><17rFdzl&!Q-TLwkU?z=Zl6U#8$PM8sw&nF~Opm8uUcz z-aN4gpf)$ni(KFXa2}Cp8usb85tYDcFb-k3J!vSsEeNWgkcO046OYr z{Pf~Ng@%Tv^V4T5C@KmmDxv|ZYGi5}pO(g>pKv_VRTT@F1+IT{xw)>AlK+Gm1vfWP z`h6yCF!&dfr3;12j?%k&zf_MeEc`B3%zxZqV8_JG%74{BrW8l<;yDQkL3MU^ib_bt z$HaUzH>XWaO@%@${PAKDC@6e%a$={Uq4C1a*_lGBI1(#S$y1B5Vy~sbIHg zXlS_TBd{4CAO8qA92mL7LrYe+$|)KmDcpLkj;L`AxUa0Kwp@fju)Rw4ESvsaq4Nva z^FaB+AS7H$$Mjh53i3+nShux3oMWM-qqF151Vs4H#DtK&J!_eIpscPg0R-yyDh@@= zCfjvk8=@y5_kgd#`0twjR-;WEPGdhXX>VISeU@4^LTa0+cn3CNy>}GTa5OS-H0Ck1 zHwGsND>DlR0}Cqy^9L0cW*$~{9#(D!W>y|%X0efPKmV(Nm5tF?6Sx1};6n@t9B2TM M5|b0H5Z3qqKj-ldMF0Q* literal 0 HcmV?d00001 diff --git a/deps/rcheevos/test/lua/doc/lua.1 b/deps/rcheevos/test/lua/doc/lua.1 new file mode 100644 index 0000000000..d728d0b80c --- /dev/null +++ b/deps/rcheevos/test/lua/doc/lua.1 @@ -0,0 +1,112 @@ +.\" $Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp $ +.TH LUA 1 "$Date: 2016/10/17 15:43:50 $" +.SH NAME +lua \- Lua interpreter +.SH SYNOPSIS +.B lua +[ +.I options +] +[ +.I script +[ +.I args +] +] +.SH DESCRIPTION +.B lua +is the standalone Lua interpreter. +It loads and executes Lua programs, +either in textual source form or +in precompiled binary form. +(Precompiled binaries are output by +.BR luac , +the Lua compiler.) +.B lua +can be used as a batch interpreter and also interactively. +.LP +The given +.I options +are handled in order and then +the Lua program in file +.I script +is loaded and executed. +The given +.I args +are available to +.I script +as strings in a global table named +.BR arg . +If no options or arguments are given, +then +.B "\-v \-i" +is assumed when the standard input is a terminal; +otherwise, +.B "\-" +is assumed. +.LP +In interactive mode, +.B lua +prompts the user, +reads lines from the standard input, +and executes them as they are read. +If the line contains an expression or list of expressions, +then the line is evaluated and the results are printed. +If a line does not contain a complete statement, +then a secondary prompt is displayed and +lines are read until a complete statement is formed or +a syntax error is found. +.LP +At the very start, +before even handling the command line, +.B lua +checks the contents of the environment variables +.B LUA_INIT_5_3 +or +.BR LUA_INIT , +in that order. +If the contents is of the form +.RI '@ filename ', +then +.I filename +is executed. +Otherwise, the string is assumed to be a Lua statement and is executed. +.SH OPTIONS +.TP +.BI \-e " stat" +execute statement +.IR stat . +.TP +.B \-i +enter interactive mode after executing +.IR script . +.TP +.BI \-l " name" +execute the equivalent of +.IB name =require(' name ') +before executing +.IR script . +.TP +.B \-v +show version information. +.TP +.B \-E +ignore environment variables. +.TP +.B \-\- +stop handling options. +.TP +.B \- +stop handling options and execute the standard input as a file. +.SH "SEE ALSO" +.BR luac (1) +.br +The documentation at lua.org, +especially section 7 of the reference manual. +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH AUTHORS +R. Ierusalimschy, +L. H. de Figueiredo, +W. Celes +.\" EOF diff --git a/deps/rcheevos/test/lua/doc/lua.css b/deps/rcheevos/test/lua/doc/lua.css new file mode 100644 index 0000000000..5bedf7eb89 --- /dev/null +++ b/deps/rcheevos/test/lua/doc/lua.css @@ -0,0 +1,164 @@ +html { + background-color: #F8F8F8 ; +} + +body { + background-color: #FFFFFF ; + color: #000000 ; + font-family: Helvetica, Arial, sans-serif ; + text-align: justify ; + line-height: 1.25 ; + margin: 16px auto ; + padding: 32px ; + border: solid #a0a0a0 1px ; + border-radius: 20px ; + max-width: 70em ; + width: 90% ; +} + +h1, h2, h3, h4 { + color: #000080 ; + font-family: Verdana, Geneva, sans-serif ; + font-weight: normal ; + font-style: normal ; + text-align: left ; +} + +h1 { + font-size: 28pt ; +} + +h1 img { + vertical-align: text-bottom ; +} + +h2:before { + content: "\2756" ; + padding-right: 0.5em ; +} + +a { + text-decoration: none ; +} + +a:link { + color: #000080 ; +} + +a:link:hover, a:visited:hover { + background-color: #D0D0FF ; + color: #000080 ; + border-radius: 4px ; +} + +a:link:active, a:visited:active { + color: #FF0000 ; +} + +div.menubar { + padding-bottom: 0.5em ; +} + +p.menubar { + margin-left: 2.5em ; +} + +.menubar a:hover { + margin: -3px -3px -3px -3px ; + padding: 3px 3px 3px 3px ; + border-radius: 4px ; +} + +:target { + background-color: #F0F0F0 ; + margin: -8px ; + padding: 8px ; + border-radius: 8px ; + outline: none ; +} + +hr { + display: none ; +} + +table hr { + background-color: #a0a0a0 ; + color: #a0a0a0 ; + border: 0 ; + height: 1px ; + display: block ; +} + +.footer { + color: gray ; + font-size: x-small ; + text-transform: lowercase ; +} + +input[type=text] { + border: solid #a0a0a0 2px ; + border-radius: 2em ; + background-image: url('images/search.png') ; + background-repeat: no-repeat ; + background-position: 4px center ; + padding-left: 20px ; + height: 2em ; +} + +pre.session { + background-color: #F8F8F8 ; + padding: 1em ; + border-radius: 8px ; +} + +td.gutter { + width: 4% ; +} + +table.columns { + border: none ; + border-spacing: 0 ; + border-collapse: collapse ; +} + +table.columns td { + vertical-align: top ; + padding: 0 ; + padding-bottom: 1em ; + text-align: justify ; + line-height: 1.25 ; +} + +p.logos a:link:hover, p.logos a:visited:hover { + background-color: inherit ; +} + +table.book { + border: none ; + border-spacing: 0 ; + border-collapse: collapse ; +} + +table.book td { + padding: 0 ; + vertical-align: top ; +} + +table.book td.cover { + padding-right: 1em ; +} + +table.book img { + border: solid #000080 1px ; +} + +table.book span { + font-size: small ; + text-align: left ; + display: block ; + margin-top: 0.25em ; +} + +img { + background-color: white ; +} diff --git a/deps/rcheevos/test/lua/doc/luac.1 b/deps/rcheevos/test/lua/doc/luac.1 new file mode 100644 index 0000000000..33a4ed00ac --- /dev/null +++ b/deps/rcheevos/test/lua/doc/luac.1 @@ -0,0 +1,118 @@ +.\" $Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp $ +.TH LUAC 1 "$Date: 2011/11/16 13:53:40 $" +.SH NAME +luac \- Lua compiler +.SH SYNOPSIS +.B luac +[ +.I options +] [ +.I filenames +] +.SH DESCRIPTION +.B luac +is the Lua compiler. +It translates programs written in the Lua programming language +into binary files containing precompiled chunks +that can be later loaded and executed. +.LP +The main advantages of precompiling chunks are: +faster loading, +protecting source code from accidental user changes, +and +off-line syntax checking. +Precompiling does not imply faster execution +because in Lua chunks are always compiled into bytecodes before being executed. +.B luac +simply allows those bytecodes to be saved in a file for later execution. +Precompiled chunks are not necessarily smaller than the corresponding source. +The main goal in precompiling is faster loading. +.LP +In the command line, +you can mix +text files containing Lua source and +binary files containing precompiled chunks. +.B luac +produces a single output file containing the combined bytecodes +for all files given. +Executing the combined file is equivalent to executing the given files. +By default, +the output file is named +.BR luac.out , +but you can change this with the +.B \-o +option. +.LP +Precompiled chunks are +.I not +portable across different architectures. +Moreover, +the internal format of precompiled chunks +is likely to change when a new version of Lua is released. +Make sure you save the source files of all Lua programs that you precompile. +.LP +.SH OPTIONS +.TP +.B \-l +produce a listing of the compiled bytecode for Lua's virtual machine. +Listing bytecodes is useful to learn about Lua's virtual machine. +If no files are given, then +.B luac +loads +.B luac.out +and lists its contents. +Use +.B \-l \-l +for a full listing. +.TP +.BI \-o " file" +output to +.IR file , +instead of the default +.BR luac.out . +(You can use +.B "'\-'" +for standard output, +but not on platforms that open standard output in text mode.) +The output file may be one of the given files because +all files are loaded before the output file is written. +Be careful not to overwrite precious files. +.TP +.B \-p +load files but do not generate any output file. +Used mainly for syntax checking and for testing precompiled chunks: +corrupted files will probably generate errors when loaded. +If no files are given, then +.B luac +loads +.B luac.out +and tests its contents. +No messages are displayed if the file loads without errors. +.TP +.B \-s +strip debug information before writing the output file. +This saves some space in very large chunks, +but if errors occur when running a stripped chunk, +then the error messages may not contain the full information they usually do. +In particular, +line numbers and names of local variables are lost. +.TP +.B \-v +show version information. +.TP +.B \-\- +stop handling options. +.TP +.B \- +stop handling options and process standard input. +.SH "SEE ALSO" +.BR lua (1) +.br +The documentation at lua.org. +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH AUTHORS +R. Ierusalimschy, +L. H. de Figueiredo, +W. Celes +.\" EOF diff --git a/deps/rcheevos/test/lua/doc/manual.css b/deps/rcheevos/test/lua/doc/manual.css new file mode 100644 index 0000000000..aa0e677dd5 --- /dev/null +++ b/deps/rcheevos/test/lua/doc/manual.css @@ -0,0 +1,21 @@ +h3 code { + font-family: inherit ; + font-size: inherit ; +} + +pre, code { + font-size: 12pt ; +} + +span.apii { + color: gray ; + float: right ; + font-family: inherit ; + font-style: normal ; + font-size: small ; +} + +h2:before { + content: "" ; + padding-right: 0em ; +} diff --git a/deps/rcheevos/test/lua/doc/manual.html b/deps/rcheevos/test/lua/doc/manual.html new file mode 100644 index 0000000000..3126b5d6af --- /dev/null +++ b/deps/rcheevos/test/lua/doc/manual.html @@ -0,0 +1,10985 @@ + + + +Lua 5.3 Reference Manual + + + + + + + +

+Lua +Lua 5.3 Reference Manual +

+ +

+by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes + +

+ +Copyright © 2015–2017 Lua.org, PUC-Rio. +Freely available under the terms of the +Lua license. + + +

+ + +

+ + + + + + +

1 – Introduction

+ +

+Lua is a powerful, efficient, lightweight, embeddable scripting language. +It supports procedural programming, +object-oriented programming, functional programming, +data-driven programming, and data description. + + +

+Lua combines simple procedural syntax with powerful data description +constructs based on associative arrays and extensible semantics. +Lua is dynamically typed, +runs by interpreting bytecode with a register-based +virtual machine, +and has automatic memory management with +incremental garbage collection, +making it ideal for configuration, scripting, +and rapid prototyping. + + +

+Lua is implemented as a library, written in clean C, +the common subset of Standard C and C++. +The Lua distribution includes a host program called lua, +which uses the Lua library to offer a complete, +standalone Lua interpreter, +for interactive or batch use. +Lua is intended to be used both as a powerful, lightweight, +embeddable scripting language for any program that needs one, +and as a powerful but lightweight and efficient stand-alone language. + + +

+As an extension language, Lua has no notion of a "main" program: +it works embedded in a host client, +called the embedding program or simply the host. +(Frequently, this host is the stand-alone lua program.) +The host program can invoke functions to execute a piece of Lua code, +can write and read Lua variables, +and can register C functions to be called by Lua code. +Through the use of C functions, Lua can be augmented to cope with +a wide range of different domains, +thus creating customized programming languages sharing a syntactical framework. + + +

+Lua is free software, +and is provided as usual with no guarantees, +as stated in its license. +The implementation described in this manual is available +at Lua's official web site, www.lua.org. + + +

+Like any other reference manual, +this document is dry in places. +For a discussion of the decisions behind the design of Lua, +see the technical papers available at Lua's web site. +For a detailed introduction to programming in Lua, +see Roberto's book, Programming in Lua. + + + +

2 – Basic Concepts

+ +

+This section describes the basic concepts of the language. + + + +

2.1 – Values and Types

+ +

+Lua is a dynamically typed language. +This means that +variables do not have types; only values do. +There are no type definitions in the language. +All values carry their own type. + + +

+All values in Lua are first-class values. +This means that all values can be stored in variables, +passed as arguments to other functions, and returned as results. + + +

+There are eight basic types in Lua: +nil, boolean, number, +string, function, userdata, +thread, and table. +The type nil has one single value, nil, +whose main property is to be different from any other value; +it usually represents the absence of a useful value. +The type boolean has two values, false and true. +Both nil and false make a condition false; +any other value makes it true. +The type number represents both +integer numbers and real (floating-point) numbers. +The type string represents immutable sequences of bytes. + +Lua is 8-bit clean: +strings can contain any 8-bit value, +including embedded zeros ('\0'). +Lua is also encoding-agnostic; +it makes no assumptions about the contents of a string. + + +

+The type number uses two internal representations, +or two subtypes, +one called integer and the other called float. +Lua has explicit rules about when each representation is used, +but it also converts between them automatically as needed (see §3.4.3). +Therefore, +the programmer may choose to mostly ignore the difference +between integers and floats +or to assume complete control over the representation of each number. +Standard Lua uses 64-bit integers and double-precision (64-bit) floats, +but you can also compile Lua so that it +uses 32-bit integers and/or single-precision (32-bit) floats. +The option with 32 bits for both integers and floats +is particularly attractive +for small machines and embedded systems. +(See macro LUA_32BITS in file luaconf.h.) + + +

+Lua can call (and manipulate) functions written in Lua and +functions written in C (see §3.4.10). +Both are represented by the type function. + + +

+The type userdata is provided to allow arbitrary C data to +be stored in Lua variables. +A userdata value represents a block of raw memory. +There are two kinds of userdata: +full userdata, +which is an object with a block of memory managed by Lua, +and light userdata, +which is simply a C pointer value. +Userdata has no predefined operations in Lua, +except assignment and identity test. +By using metatables, +the programmer can define operations for full userdata values +(see §2.4). +Userdata values cannot be created or modified in Lua, +only through the C API. +This guarantees the integrity of data owned by the host program. + + +

+The type thread represents independent threads of execution +and it is used to implement coroutines (see §2.6). +Lua threads are not related to operating-system threads. +Lua supports coroutines on all systems, +even those that do not support threads natively. + + +

+The type table implements associative arrays, +that is, arrays that can be indexed not only with numbers, +but with any Lua value except nil and NaN. +(Not a Number is a special value used to represent +undefined or unrepresentable numerical results, such as 0/0.) +Tables can be heterogeneous; +that is, they can contain values of all types (except nil). +Any key with value nil is not considered part of the table. +Conversely, any key that is not part of a table has +an associated value nil. + + +

+Tables are the sole data-structuring mechanism in Lua; +they can be used to represent ordinary arrays, lists, +symbol tables, sets, records, graphs, trees, etc. +To represent records, Lua uses the field name as an index. +The language supports this representation by +providing a.name as syntactic sugar for a["name"]. +There are several convenient ways to create tables in Lua +(see §3.4.9). + + +

+Like indices, +the values of table fields can be of any type. +In particular, +because functions are first-class values, +table fields can contain functions. +Thus tables can also carry methods (see §3.4.11). + + +

+The indexing of tables follows +the definition of raw equality in the language. +The expressions a[i] and a[j] +denote the same table element +if and only if i and j are raw equal +(that is, equal without metamethods). +In particular, floats with integral values +are equal to their respective integers +(e.g., 1.0 == 1). +To avoid ambiguities, +any float with integral value used as a key +is converted to its respective integer. +For instance, if you write a[2.0] = true, +the actual key inserted into the table will be the +integer 2. +(On the other hand, +2 and "2" are different Lua values and therefore +denote different table entries.) + + +

+Tables, functions, threads, and (full) userdata values are objects: +variables do not actually contain these values, +only references to them. +Assignment, parameter passing, and function returns +always manipulate references to such values; +these operations do not imply any kind of copy. + + +

+The library function type returns a string describing the type +of a given value (see §6.1). + + + + + +

2.2 – Environments and the Global Environment

+ +

+As will be discussed in §3.2 and §3.3.3, +any reference to a free name +(that is, a name not bound to any declaration) var +is syntactically translated to _ENV.var. +Moreover, every chunk is compiled in the scope of +an external local variable named _ENV (see §3.3.2), +so _ENV itself is never a free name in a chunk. + + +

+Despite the existence of this external _ENV variable and +the translation of free names, +_ENV is a completely regular name. +In particular, +you can define new variables and parameters with that name. +Each reference to a free name uses the _ENV that is +visible at that point in the program, +following the usual visibility rules of Lua (see §3.5). + + +

+Any table used as the value of _ENV is called an environment. + + +

+Lua keeps a distinguished environment called the global environment. +This value is kept at a special index in the C registry (see §4.5). +In Lua, the global variable _G is initialized with this same value. +(_G is never used internally.) + + +

+When Lua loads a chunk, +the default value for its _ENV upvalue +is the global environment (see load). +Therefore, by default, +free names in Lua code refer to entries in the global environment +(and, therefore, they are also called global variables). +Moreover, all standard libraries are loaded in the global environment +and some functions there operate on that environment. +You can use load (or loadfile) +to load a chunk with a different environment. +(In C, you have to load the chunk and then change the value +of its first upvalue.) + + + + + +

2.3 – Error Handling

+ +

+Because Lua is an embedded extension language, +all Lua actions start from C code in the host program +calling a function from the Lua library. +(When you use Lua standalone, +the lua application is the host program.) +Whenever an error occurs during +the compilation or execution of a Lua chunk, +control returns to the host, +which can take appropriate measures +(such as printing an error message). + + +

+Lua code can explicitly generate an error by calling the +error function. +If you need to catch errors in Lua, +you can use pcall or xpcall +to call a given function in protected mode. + + +

+Whenever there is an error, +an error object (also called an error message) +is propagated with information about the error. +Lua itself only generates errors whose error object is a string, +but programs may generate errors with +any value as the error object. +It is up to the Lua program or its host to handle such error objects. + + +

+When you use xpcall or lua_pcall, +you may give a message handler +to be called in case of errors. +This function is called with the original error object +and returns a new error object. +It is called before the error unwinds the stack, +so that it can gather more information about the error, +for instance by inspecting the stack and creating a stack traceback. +This message handler is still protected by the protected call; +so, an error inside the message handler +will call the message handler again. +If this loop goes on for too long, +Lua breaks it and returns an appropriate message. +(The message handler is called only for regular runtime errors. +It is not called for memory-allocation errors +nor for errors while running finalizers.) + + + + + +

2.4 – Metatables and Metamethods

+ +

+Every value in Lua can have a metatable. +This metatable is an ordinary Lua table +that defines the behavior of the original value +under certain special operations. +You can change several aspects of the behavior +of operations over a value by setting specific fields in its metatable. +For instance, when a non-numeric value is the operand of an addition, +Lua checks for a function in the field "__add" of the value's metatable. +If it finds one, +Lua calls this function to perform the addition. + + +

+The key for each event in a metatable is a string +with the event name prefixed by two underscores; +the corresponding values are called metamethods. +In the previous example, the key is "__add" +and the metamethod is the function that performs the addition. + + +

+You can query the metatable of any value +using the getmetatable function. +Lua queries metamethods in metatables using a raw access (see rawget). +So, to retrieve the metamethod for event ev in object o, +Lua does the equivalent to the following code: + +

+     rawget(getmetatable(o) or {}, "__ev")
+
+ +

+You can replace the metatable of tables +using the setmetatable function. +You cannot change the metatable of other types from Lua code +(except by using the debug library (§6.10)); +you should use the C API for that. + + +

+Tables and full userdata have individual metatables +(although multiple tables and userdata can share their metatables). +Values of all other types share one single metatable per type; +that is, there is one single metatable for all numbers, +one for all strings, etc. +By default, a value has no metatable, +but the string library sets a metatable for the string type (see §6.4). + + +

+A metatable controls how an object behaves in +arithmetic operations, bitwise operations, +order comparisons, concatenation, length operation, calls, and indexing. +A metatable also can define a function to be called +when a userdata or a table is garbage collected (§2.5). + + +

+For the unary operators (negation, length, and bitwise NOT), +the metamethod is computed and called with a dummy second operand, +equal to the first one. +This extra operand is only to simplify Lua's internals +(by making these operators behave like a binary operation) +and may be removed in future versions. +(For most uses this extra operand is irrelevant.) + + +

+A detailed list of events controlled by metatables is given next. +Each operation is identified by its corresponding key. + + + +

    + +
  • __add: +the addition (+) operation. +If any operand for an addition is not a number +(nor a string coercible to a number), +Lua will try to call a metamethod. +First, Lua will check the first operand (even if it is valid). +If that operand does not define a metamethod for __add, +then Lua will check the second operand. +If Lua can find a metamethod, +it calls the metamethod with the two operands as arguments, +and the result of the call +(adjusted to one value) +is the result of the operation. +Otherwise, +it raises an error. +
  • + +
  • __sub: +the subtraction (-) operation. +Behavior similar to the addition operation. +
  • + +
  • __mul: +the multiplication (*) operation. +Behavior similar to the addition operation. +
  • + +
  • __div: +the division (/) operation. +Behavior similar to the addition operation. +
  • + +
  • __mod: +the modulo (%) operation. +Behavior similar to the addition operation. +
  • + +
  • __pow: +the exponentiation (^) operation. +Behavior similar to the addition operation. +
  • + +
  • __unm: +the negation (unary -) operation. +Behavior similar to the addition operation. +
  • + +
  • __idiv: +the floor division (//) operation. +Behavior similar to the addition operation. +
  • + +
  • __band: +the bitwise AND (&) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod +if any operand is neither an integer +nor a value coercible to an integer (see §3.4.3). +
  • + +
  • __bor: +the bitwise OR (|) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __bxor: +the bitwise exclusive OR (binary ~) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __bnot: +the bitwise NOT (unary ~) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __shl: +the bitwise left shift (<<) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __shr: +the bitwise right shift (>>) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __concat: +the concatenation (..) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod +if any operand is neither a string nor a number +(which is always coercible to a string). +
  • + +
  • __len: +the length (#) operation. +If the object is not a string, +Lua will try its metamethod. +If there is a metamethod, +Lua calls it with the object as argument, +and the result of the call +(always adjusted to one value) +is the result of the operation. +If there is no metamethod but the object is a table, +then Lua uses the table length operation (see §3.4.7). +Otherwise, Lua raises an error. +
  • + +
  • __eq: +the equal (==) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod only when the values +being compared are either both tables or both full userdata +and they are not primitively equal. +The result of the call is always converted to a boolean. +
  • + +
  • __lt: +the less than (<) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod only when the values +being compared are neither both numbers nor both strings. +The result of the call is always converted to a boolean. +
  • + +
  • __le: +the less equal (<=) operation. +Unlike other operations, +the less-equal operation can use two different events. +First, Lua looks for the __le metamethod in both operands, +like in the less than operation. +If it cannot find such a metamethod, +then it will try the __lt metamethod, +assuming that a <= b is equivalent to not (b < a). +As with the other comparison operators, +the result is always a boolean. +(This use of the __lt event can be removed in future versions; +it is also slower than a real __le metamethod.) +
  • + +
  • __index: +The indexing access table[key]. +This event happens when table is not a table or +when key is not present in table. +The metamethod is looked up in table. + + +

    +Despite the name, +the metamethod for this event can be either a function or a table. +If it is a function, +it is called with table and key as arguments, +and the result of the call +(adjusted to one value) +is the result of the operation. +If it is a table, +the final result is the result of indexing this table with key. +(This indexing is regular, not raw, +and therefore can trigger another metamethod.) +

  • + +
  • __newindex: +The indexing assignment table[key] = value. +Like the index event, +this event happens when table is not a table or +when key is not present in table. +The metamethod is looked up in table. + + +

    +Like with indexing, +the metamethod for this event can be either a function or a table. +If it is a function, +it is called with table, key, and value as arguments. +If it is a table, +Lua does an indexing assignment to this table with the same key and value. +(This assignment is regular, not raw, +and therefore can trigger another metamethod.) + + +

    +Whenever there is a __newindex metamethod, +Lua does not perform the primitive assignment. +(If necessary, +the metamethod itself can call rawset +to do the assignment.) +

  • + +
  • __call: +The call operation func(args). +This event happens when Lua tries to call a non-function value +(that is, func is not a function). +The metamethod is looked up in func. +If present, +the metamethod is called with func as its first argument, +followed by the arguments of the original call (args). +All results of the call +are the result of the operation. +(This is the only metamethod that allows multiple results.) +
  • + +
+ +

+It is a good practice to add all needed metamethods to a table +before setting it as a metatable of some object. +In particular, the __gc metamethod works only when this order +is followed (see §2.5.1). + + +

+Because metatables are regular tables, +they can contain arbitrary fields, +not only the event names defined above. +Some functions in the standard library +(e.g., tostring) +use other fields in metatables for their own purposes. + + + + + +

2.5 – Garbage Collection

+ +

+Lua performs automatic memory management. +This means that +you do not have to worry about allocating memory for new objects +or freeing it when the objects are no longer needed. +Lua manages memory automatically by running +a garbage collector to collect all dead objects +(that is, objects that are no longer accessible from Lua). +All memory used by Lua is subject to automatic management: +strings, tables, userdata, functions, threads, internal structures, etc. + + +

+Lua implements an incremental mark-and-sweep collector. +It uses two numbers to control its garbage-collection cycles: +the garbage-collector pause and +the garbage-collector step multiplier. +Both use percentage points as units +(e.g., a value of 100 means an internal value of 1). + + +

+The garbage-collector pause +controls how long the collector waits before starting a new cycle. +Larger values make the collector less aggressive. +Values smaller than 100 mean the collector will not wait to +start a new cycle. +A value of 200 means that the collector waits for the total memory in use +to double before starting a new cycle. + + +

+The garbage-collector step multiplier +controls the relative speed of the collector relative to +memory allocation. +Larger values make the collector more aggressive but also increase +the size of each incremental step. +You should not use values smaller than 100, +because they make the collector too slow and +can result in the collector never finishing a cycle. +The default is 200, +which means that the collector runs at "twice" +the speed of memory allocation. + + +

+If you set the step multiplier to a very large number +(larger than 10% of the maximum number of +bytes that the program may use), +the collector behaves like a stop-the-world collector. +If you then set the pause to 200, +the collector behaves as in old Lua versions, +doing a complete collection every time Lua doubles its +memory usage. + + +

+You can change these numbers by calling lua_gc in C +or collectgarbage in Lua. +You can also use these functions to control +the collector directly (e.g., stop and restart it). + + + +

2.5.1 – Garbage-Collection Metamethods

+ +

+You can set garbage-collector metamethods for tables +and, using the C API, +for full userdata (see §2.4). +These metamethods are also called finalizers. +Finalizers allow you to coordinate Lua's garbage collection +with external resource management +(such as closing files, network or database connections, +or freeing your own memory). + + +

+For an object (table or userdata) to be finalized when collected, +you must mark it for finalization. + +You mark an object for finalization when you set its metatable +and the metatable has a field indexed by the string "__gc". +Note that if you set a metatable without a __gc field +and later create that field in the metatable, +the object will not be marked for finalization. + + +

+When a marked object becomes garbage, +it is not collected immediately by the garbage collector. +Instead, Lua puts it in a list. +After the collection, +Lua goes through that list. +For each object in the list, +it checks the object's __gc metamethod: +If it is a function, +Lua calls it with the object as its single argument; +if the metamethod is not a function, +Lua simply ignores it. + + +

+At the end of each garbage-collection cycle, +the finalizers for objects are called in +the reverse order that the objects were marked for finalization, +among those collected in that cycle; +that is, the first finalizer to be called is the one associated +with the object marked last in the program. +The execution of each finalizer may occur at any point during +the execution of the regular code. + + +

+Because the object being collected must still be used by the finalizer, +that object (and other objects accessible only through it) +must be resurrected by Lua. +Usually, this resurrection is transient, +and the object memory is freed in the next garbage-collection cycle. +However, if the finalizer stores the object in some global place +(e.g., a global variable), +then the resurrection is permanent. +Moreover, if the finalizer marks a finalizing object for finalization again, +its finalizer will be called again in the next cycle where the +object is unreachable. +In any case, +the object memory is freed only in a GC cycle where +the object is unreachable and not marked for finalization. + + +

+When you close a state (see lua_close), +Lua calls the finalizers of all objects marked for finalization, +following the reverse order that they were marked. +If any finalizer marks objects for collection during that phase, +these marks have no effect. + + + + + +

2.5.2 – Weak Tables

+ +

+A weak table is a table whose elements are +weak references. +A weak reference is ignored by the garbage collector. +In other words, +if the only references to an object are weak references, +then the garbage collector will collect that object. + + +

+A weak table can have weak keys, weak values, or both. +A table with weak values allows the collection of its values, +but prevents the collection of its keys. +A table with both weak keys and weak values allows the collection of +both keys and values. +In any case, if either the key or the value is collected, +the whole pair is removed from the table. +The weakness of a table is controlled by the +__mode field of its metatable. +If the __mode field is a string containing the character 'k', +the keys in the table are weak. +If __mode contains 'v', +the values in the table are weak. + + +

+A table with weak keys and strong values +is also called an ephemeron table. +In an ephemeron table, +a value is considered reachable only if its key is reachable. +In particular, +if the only reference to a key comes through its value, +the pair is removed. + + +

+Any change in the weakness of a table may take effect only +at the next collect cycle. +In particular, if you change the weakness to a stronger mode, +Lua may still collect some items from that table +before the change takes effect. + + +

+Only objects that have an explicit construction +are removed from weak tables. +Values, such as numbers and light C functions, +are not subject to garbage collection, +and therefore are not removed from weak tables +(unless their associated values are collected). +Although strings are subject to garbage collection, +they do not have an explicit construction, +and therefore are not removed from weak tables. + + +

+Resurrected objects +(that is, objects being finalized +and objects accessible only through objects being finalized) +have a special behavior in weak tables. +They are removed from weak values before running their finalizers, +but are removed from weak keys only in the next collection +after running their finalizers, when such objects are actually freed. +This behavior allows the finalizer to access properties +associated with the object through weak tables. + + +

+If a weak table is among the resurrected objects in a collection cycle, +it may not be properly cleared until the next cycle. + + + + + + + +

2.6 – Coroutines

+ +

+Lua supports coroutines, +also called collaborative multithreading. +A coroutine in Lua represents an independent thread of execution. +Unlike threads in multithread systems, however, +a coroutine only suspends its execution by explicitly calling +a yield function. + + +

+You create a coroutine by calling coroutine.create. +Its sole argument is a function +that is the main function of the coroutine. +The create function only creates a new coroutine and +returns a handle to it (an object of type thread); +it does not start the coroutine. + + +

+You execute a coroutine by calling coroutine.resume. +When you first call coroutine.resume, +passing as its first argument +a thread returned by coroutine.create, +the coroutine starts its execution by +calling its main function. +Extra arguments passed to coroutine.resume are passed +as arguments to that function. +After the coroutine starts running, +it runs until it terminates or yields. + + +

+A coroutine can terminate its execution in two ways: +normally, when its main function returns +(explicitly or implicitly, after the last instruction); +and abnormally, if there is an unprotected error. +In case of normal termination, +coroutine.resume returns true, +plus any values returned by the coroutine main function. +In case of errors, coroutine.resume returns false +plus an error object. + + +

+A coroutine yields by calling coroutine.yield. +When a coroutine yields, +the corresponding coroutine.resume returns immediately, +even if the yield happens inside nested function calls +(that is, not in the main function, +but in a function directly or indirectly called by the main function). +In the case of a yield, coroutine.resume also returns true, +plus any values passed to coroutine.yield. +The next time you resume the same coroutine, +it continues its execution from the point where it yielded, +with the call to coroutine.yield returning any extra +arguments passed to coroutine.resume. + + +

+Like coroutine.create, +the coroutine.wrap function also creates a coroutine, +but instead of returning the coroutine itself, +it returns a function that, when called, resumes the coroutine. +Any arguments passed to this function +go as extra arguments to coroutine.resume. +coroutine.wrap returns all the values returned by coroutine.resume, +except the first one (the boolean error code). +Unlike coroutine.resume, +coroutine.wrap does not catch errors; +any error is propagated to the caller. + + +

+As an example of how coroutines work, +consider the following code: + +

+     function foo (a)
+       print("foo", a)
+       return coroutine.yield(2*a)
+     end
+     
+     co = coroutine.create(function (a,b)
+           print("co-body", a, b)
+           local r = foo(a+1)
+           print("co-body", r)
+           local r, s = coroutine.yield(a+b, a-b)
+           print("co-body", r, s)
+           return b, "end"
+     end)
+     
+     print("main", coroutine.resume(co, 1, 10))
+     print("main", coroutine.resume(co, "r"))
+     print("main", coroutine.resume(co, "x", "y"))
+     print("main", coroutine.resume(co, "x", "y"))
+

+When you run it, it produces the following output: + +

+     co-body 1       10
+     foo     2
+     main    true    4
+     co-body r
+     main    true    11      -9
+     co-body x       y
+     main    true    10      end
+     main    false   cannot resume dead coroutine
+
+ +

+You can also create and manipulate coroutines through the C API: +see functions lua_newthread, lua_resume, +and lua_yield. + + + + + +

3 – The Language

+ +

+This section describes the lexis, the syntax, and the semantics of Lua. +In other words, +this section describes +which tokens are valid, +how they can be combined, +and what their combinations mean. + + +

+Language constructs will be explained using the usual extended BNF notation, +in which +{a} means 0 or more a's, and +[a] means an optional a. +Non-terminals are shown like non-terminal, +keywords are shown like kword, +and other terminal symbols are shown like ‘=’. +The complete syntax of Lua can be found in §9 +at the end of this manual. + + + +

3.1 – Lexical Conventions

+ +

+Lua is a free-form language. +It ignores spaces (including new lines) and comments +between lexical elements (tokens), +except as delimiters between names and keywords. + + +

+Names +(also called identifiers) +in Lua can be any string of letters, +digits, and underscores, +not beginning with a digit and +not being a reserved word. +Identifiers are used to name variables, table fields, and labels. + + +

+The following keywords are reserved +and cannot be used as names: + + +

+     and       break     do        else      elseif    end
+     false     for       function  goto      if        in
+     local     nil       not       or        repeat    return
+     then      true      until     while
+
+ +

+Lua is a case-sensitive language: +and is a reserved word, but And and AND +are two different, valid names. +As a convention, +programs should avoid creating +names that start with an underscore followed by +one or more uppercase letters (such as _VERSION). + + +

+The following strings denote other tokens: + +

+     +     -     *     /     %     ^     #
+     &     ~     |     <<    >>    //
+     ==    ~=    <=    >=    <     >     =
+     (     )     {     }     [     ]     ::
+     ;     :     ,     .     ..    ...
+
+ +

+A short literal string +can be delimited by matching single or double quotes, +and can contain the following C-like escape sequences: +'\a' (bell), +'\b' (backspace), +'\f' (form feed), +'\n' (newline), +'\r' (carriage return), +'\t' (horizontal tab), +'\v' (vertical tab), +'\\' (backslash), +'\"' (quotation mark [double quote]), +and '\'' (apostrophe [single quote]). +A backslash followed by a line break +results in a newline in the string. +The escape sequence '\z' skips the following span +of white-space characters, +including line breaks; +it is particularly useful to break and indent a long literal string +into multiple lines without adding the newlines and spaces +into the string contents. +A short literal string cannot contain unescaped line breaks +nor escapes not forming a valid escape sequence. + + +

+We can specify any byte in a short literal string by its numeric value +(including embedded zeros). +This can be done +with the escape sequence \xXX, +where XX is a sequence of exactly two hexadecimal digits, +or with the escape sequence \ddd, +where ddd is a sequence of up to three decimal digits. +(Note that if a decimal escape sequence is to be followed by a digit, +it must be expressed using exactly three digits.) + + +

+The UTF-8 encoding of a Unicode character +can be inserted in a literal string with +the escape sequence \u{XXX} +(note the mandatory enclosing brackets), +where XXX is a sequence of one or more hexadecimal digits +representing the character code point. + + +

+Literal strings can also be defined using a long format +enclosed by long brackets. +We define an opening long bracket of level n as an opening +square bracket followed by n equal signs followed by another +opening square bracket. +So, an opening long bracket of level 0 is written as [[, +an opening long bracket of level 1 is written as [=[, +and so on. +A closing long bracket is defined similarly; +for instance, +a closing long bracket of level 4 is written as ]====]. +A long literal starts with an opening long bracket of any level and +ends at the first closing long bracket of the same level. +It can contain any text except a closing bracket of the same level. +Literals in this bracketed form can run for several lines, +do not interpret any escape sequences, +and ignore long brackets of any other level. +Any kind of end-of-line sequence +(carriage return, newline, carriage return followed by newline, +or newline followed by carriage return) +is converted to a simple newline. + + +

+For convenience, +when the opening long bracket is immediately followed by a newline, +the newline is not included in the string. +As an example, in a system using ASCII +(in which 'a' is coded as 97, +newline is coded as 10, and '1' is coded as 49), +the five literal strings below denote the same string: + +

+     a = 'alo\n123"'
+     a = "alo\n123\""
+     a = '\97lo\10\04923"'
+     a = [[alo
+     123"]]
+     a = [==[
+     alo
+     123"]==]
+
+ +

+Any byte in a literal string not +explicitly affected by the previous rules represents itself. +However, Lua opens files for parsing in text mode, +and the system file functions may have problems with +some control characters. +So, it is safer to represent +non-text data as a quoted literal with +explicit escape sequences for the non-text characters. + + +

+A numeric constant (or numeral) +can be written with an optional fractional part +and an optional decimal exponent, +marked by a letter 'e' or 'E'. +Lua also accepts hexadecimal constants, +which start with 0x or 0X. +Hexadecimal constants also accept an optional fractional part +plus an optional binary exponent, +marked by a letter 'p' or 'P'. +A numeric constant with a radix point or an exponent +denotes a float; +otherwise, +if its value fits in an integer, +it denotes an integer. +Examples of valid integer constants are + +

+     3   345   0xff   0xBEBADA
+

+Examples of valid float constants are + +

+     3.0     3.1416     314.16e-2     0.31416E1     34e1
+     0x0.1E  0xA23p-4   0X1.921FB54442D18P+1
+
+ +

+A comment starts with a double hyphen (--) +anywhere outside a string. +If the text immediately after -- is not an opening long bracket, +the comment is a short comment, +which runs until the end of the line. +Otherwise, it is a long comment, +which runs until the corresponding closing long bracket. +Long comments are frequently used to disable code temporarily. + + + + + +

3.2 – Variables

+ +

+Variables are places that store values. +There are three kinds of variables in Lua: +global variables, local variables, and table fields. + + +

+A single name can denote a global variable or a local variable +(or a function's formal parameter, +which is a particular kind of local variable): + +

+	var ::= Name
+

+Name denotes identifiers, as defined in §3.1. + + +

+Any variable name is assumed to be global unless explicitly declared +as a local (see §3.3.7). +Local variables are lexically scoped: +local variables can be freely accessed by functions +defined inside their scope (see §3.5). + + +

+Before the first assignment to a variable, its value is nil. + + +

+Square brackets are used to index a table: + +

+	var ::= prefixexp ‘[’ exp ‘]’
+

+The meaning of accesses to table fields can be changed via metatables. +An access to an indexed variable t[i] is equivalent to +a call gettable_event(t,i). +(See §2.4 for a complete description of the +gettable_event function. +This function is not defined or callable in Lua. +We use it here only for explanatory purposes.) + + +

+The syntax var.Name is just syntactic sugar for +var["Name"]: + +

+	var ::= prefixexp ‘.’ Name
+
+ +

+An access to a global variable x +is equivalent to _ENV.x. +Due to the way that chunks are compiled, +_ENV is never a global name (see §2.2). + + + + + +

3.3 – Statements

+ +

+Lua supports an almost conventional set of statements, +similar to those in Pascal or C. +This set includes +assignments, control structures, function calls, +and variable declarations. + + + +

3.3.1 – Blocks

+ +

+A block is a list of statements, +which are executed sequentially: + +

+	block ::= {stat}
+

+Lua has empty statements +that allow you to separate statements with semicolons, +start a block with a semicolon +or write two semicolons in sequence: + +

+	stat ::= ‘;’
+
+ +

+Function calls and assignments +can start with an open parenthesis. +This possibility leads to an ambiguity in Lua's grammar. +Consider the following fragment: + +

+     a = b + c
+     (print or io.write)('done')
+

+The grammar could see it in two ways: + +

+     a = b + c(print or io.write)('done')
+     
+     a = b + c; (print or io.write)('done')
+

+The current parser always sees such constructions +in the first way, +interpreting the open parenthesis +as the start of the arguments to a call. +To avoid this ambiguity, +it is a good practice to always precede with a semicolon +statements that start with a parenthesis: + +

+     ;(print or io.write)('done')
+
+ +

+A block can be explicitly delimited to produce a single statement: + +

+	stat ::= do block end
+

+Explicit blocks are useful +to control the scope of variable declarations. +Explicit blocks are also sometimes used to +add a return statement in the middle +of another block (see §3.3.4). + + + + + +

3.3.2 – Chunks

+ +

+The unit of compilation of Lua is called a chunk. +Syntactically, +a chunk is simply a block: + +

+	chunk ::= block
+
+ +

+Lua handles a chunk as the body of an anonymous function +with a variable number of arguments +(see §3.4.11). +As such, chunks can define local variables, +receive arguments, and return values. +Moreover, such anonymous function is compiled as in the +scope of an external local variable called _ENV (see §2.2). +The resulting function always has _ENV as its only upvalue, +even if it does not use that variable. + + +

+A chunk can be stored in a file or in a string inside the host program. +To execute a chunk, +Lua first loads it, +precompiling the chunk's code into instructions for a virtual machine, +and then Lua executes the compiled code +with an interpreter for the virtual machine. + + +

+Chunks can also be precompiled into binary form; +see program luac and function string.dump for details. +Programs in source and compiled forms are interchangeable; +Lua automatically detects the file type and acts accordingly (see load). + + + + + +

3.3.3 – Assignment

+ +

+Lua allows multiple assignments. +Therefore, the syntax for assignment +defines a list of variables on the left side +and a list of expressions on the right side. +The elements in both lists are separated by commas: + +

+	stat ::= varlist ‘=’ explist
+	varlist ::= var {‘,’ var}
+	explist ::= exp {‘,’ exp}
+

+Expressions are discussed in §3.4. + + +

+Before the assignment, +the list of values is adjusted to the length of +the list of variables. +If there are more values than needed, +the excess values are thrown away. +If there are fewer values than needed, +the list is extended with as many nil's as needed. +If the list of expressions ends with a function call, +then all values returned by that call enter the list of values, +before the adjustment +(except when the call is enclosed in parentheses; see §3.4). + + +

+The assignment statement first evaluates all its expressions +and only then the assignments are performed. +Thus the code + +

+     i = 3
+     i, a[i] = i+1, 20
+

+sets a[3] to 20, without affecting a[4] +because the i in a[i] is evaluated (to 3) +before it is assigned 4. +Similarly, the line + +

+     x, y = y, x
+

+exchanges the values of x and y, +and + +

+     x, y, z = y, z, x
+

+cyclically permutes the values of x, y, and z. + + +

+The meaning of assignments to global variables +and table fields can be changed via metatables. +An assignment to an indexed variable t[i] = val is equivalent to +settable_event(t,i,val). +(See §2.4 for a complete description of the +settable_event function. +This function is not defined or callable in Lua. +We use it here only for explanatory purposes.) + + +

+An assignment to a global name x = val +is equivalent to the assignment +_ENV.x = val (see §2.2). + + + + + +

3.3.4 – Control Structures

+The control structures +if, while, and repeat have the usual meaning and +familiar syntax: + + + + +

+	stat ::= while exp do block end
+	stat ::= repeat block until exp
+	stat ::= if exp then block {elseif exp then block} [else block] end
+

+Lua also has a for statement, in two flavors (see §3.3.5). + + +

+The condition expression of a +control structure can return any value. +Both false and nil are considered false. +All values different from nil and false are considered true +(in particular, the number 0 and the empty string are also true). + + +

+In the repeatuntil loop, +the inner block does not end at the until keyword, +but only after the condition. +So, the condition can refer to local variables +declared inside the loop block. + + +

+The goto statement transfers the program control to a label. +For syntactical reasons, +labels in Lua are considered statements too: + + + +

+	stat ::= goto Name
+	stat ::= label
+	label ::= ‘::’ Name ‘::’
+
+ +

+A label is visible in the entire block where it is defined, +except +inside nested blocks where a label with the same name is defined and +inside nested functions. +A goto may jump to any visible label as long as it does not +enter into the scope of a local variable. + + +

+Labels and empty statements are called void statements, +as they perform no actions. + + +

+The break statement terminates the execution of a +while, repeat, or for loop, +skipping to the next statement after the loop: + + +

+	stat ::= break
+

+A break ends the innermost enclosing loop. + + +

+The return statement is used to return values +from a function or a chunk +(which is an anonymous function). + +Functions can return more than one value, +so the syntax for the return statement is + +

+	stat ::= return [explist] [‘;’]
+
+ +

+The return statement can only be written +as the last statement of a block. +If it is really necessary to return in the middle of a block, +then an explicit inner block can be used, +as in the idiom do return end, +because now return is the last statement in its (inner) block. + + + + + +

3.3.5 – For Statement

+ +

+ +The for statement has two forms: +one numerical and one generic. + + +

+The numerical for loop repeats a block of code while a +control variable runs through an arithmetic progression. +It has the following syntax: + +

+	stat ::= for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end
+

+The block is repeated for name starting at the value of +the first exp, until it passes the second exp by steps of the +third exp. +More precisely, a for statement like + +

+     for v = e1, e2, e3 do block end
+

+is equivalent to the code: + +

+     do
+       local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
+       if not (var and limit and step) then error() end
+       var = var - step
+       while true do
+         var = var + step
+         if (step >= 0 and var > limit) or (step < 0 and var < limit) then
+           break
+         end
+         local v = var
+         block
+       end
+     end
+
+ +

+Note the following: + +

    + +
  • +All three control expressions are evaluated only once, +before the loop starts. +They must all result in numbers. +
  • + +
  • +var, limit, and step are invisible variables. +The names shown here are for explanatory purposes only. +
  • + +
  • +If the third expression (the step) is absent, +then a step of 1 is used. +
  • + +
  • +You can use break and goto to exit a for loop. +
  • + +
  • +The loop variable v is local to the loop body. +If you need its value after the loop, +assign it to another variable before exiting the loop. +
  • + +
+ +

+The generic for statement works over functions, +called iterators. +On each iteration, the iterator function is called to produce a new value, +stopping when this new value is nil. +The generic for loop has the following syntax: + +

+	stat ::= for namelist in explist do block end
+	namelist ::= Name {‘,’ Name}
+

+A for statement like + +

+     for var_1, ···, var_n in explist do block end
+

+is equivalent to the code: + +

+     do
+       local f, s, var = explist
+       while true do
+         local var_1, ···, var_n = f(s, var)
+         if var_1 == nil then break end
+         var = var_1
+         block
+       end
+     end
+

+Note the following: + +

    + +
  • +explist is evaluated only once. +Its results are an iterator function, +a state, +and an initial value for the first iterator variable. +
  • + +
  • +f, s, and var are invisible variables. +The names are here for explanatory purposes only. +
  • + +
  • +You can use break to exit a for loop. +
  • + +
  • +The loop variables var_i are local to the loop; +you cannot use their values after the for ends. +If you need these values, +then assign them to other variables before breaking or exiting the loop. +
  • + +
+ + + + +

3.3.6 – Function Calls as Statements

+To allow possible side-effects, +function calls can be executed as statements: + +

+	stat ::= functioncall
+

+In this case, all returned values are thrown away. +Function calls are explained in §3.4.10. + + + + + +

3.3.7 – Local Declarations

+Local variables can be declared anywhere inside a block. +The declaration can include an initial assignment: + +

+	stat ::= local namelist [‘=’ explist]
+

+If present, an initial assignment has the same semantics +of a multiple assignment (see §3.3.3). +Otherwise, all variables are initialized with nil. + + +

+A chunk is also a block (see §3.3.2), +and so local variables can be declared in a chunk outside any explicit block. + + +

+The visibility rules for local variables are explained in §3.5. + + + + + + + +

3.4 – Expressions

+ +

+The basic expressions in Lua are the following: + +

+	exp ::= prefixexp
+	exp ::= nil | false | true
+	exp ::= Numeral
+	exp ::= LiteralString
+	exp ::= functiondef
+	exp ::= tableconstructor
+	exp ::= ‘...’
+	exp ::= exp binop exp
+	exp ::= unop exp
+	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
+
+ +

+Numerals and literal strings are explained in §3.1; +variables are explained in §3.2; +function definitions are explained in §3.4.11; +function calls are explained in §3.4.10; +table constructors are explained in §3.4.9. +Vararg expressions, +denoted by three dots ('...'), can only be used when +directly inside a vararg function; +they are explained in §3.4.11. + + +

+Binary operators comprise arithmetic operators (see §3.4.1), +bitwise operators (see §3.4.2), +relational operators (see §3.4.4), logical operators (see §3.4.5), +and the concatenation operator (see §3.4.6). +Unary operators comprise the unary minus (see §3.4.1), +the unary bitwise NOT (see §3.4.2), +the unary logical not (see §3.4.5), +and the unary length operator (see §3.4.7). + + +

+Both function calls and vararg expressions can result in multiple values. +If a function call is used as a statement (see §3.3.6), +then its return list is adjusted to zero elements, +thus discarding all returned values. +If an expression is used as the last (or the only) element +of a list of expressions, +then no adjustment is made +(unless the expression is enclosed in parentheses). +In all other contexts, +Lua adjusts the result list to one element, +either discarding all values except the first one +or adding a single nil if there are no values. + + +

+Here are some examples: + +

+     f()                -- adjusted to 0 results
+     g(f(), x)          -- f() is adjusted to 1 result
+     g(x, f())          -- g gets x plus all results from f()
+     a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
+     a,b = ...          -- a gets the first vararg parameter, b gets
+                        -- the second (both a and b can get nil if there
+                        -- is no corresponding vararg parameter)
+     
+     a,b,c = x, f()     -- f() is adjusted to 2 results
+     a,b,c = f()        -- f() is adjusted to 3 results
+     return f()         -- returns all results from f()
+     return ...         -- returns all received vararg parameters
+     return x,y,f()     -- returns x, y, and all results from f()
+     {f()}              -- creates a list with all results from f()
+     {...}              -- creates a list with all vararg parameters
+     {f(), nil}         -- f() is adjusted to 1 result
+
+ +

+Any expression enclosed in parentheses always results in only one value. +Thus, +(f(x,y,z)) is always a single value, +even if f returns several values. +(The value of (f(x,y,z)) is the first value returned by f +or nil if f does not return any values.) + + + +

3.4.1 – Arithmetic Operators

+Lua supports the following arithmetic operators: + +

    +
  • +: addition
  • +
  • -: subtraction
  • +
  • *: multiplication
  • +
  • /: float division
  • +
  • //: floor division
  • +
  • %: modulo
  • +
  • ^: exponentiation
  • +
  • -: unary minus
  • +
+ +

+With the exception of exponentiation and float division, +the arithmetic operators work as follows: +If both operands are integers, +the operation is performed over integers and the result is an integer. +Otherwise, if both operands are numbers +or strings that can be converted to +numbers (see §3.4.3), +then they are converted to floats, +the operation is performed following the usual rules +for floating-point arithmetic +(usually the IEEE 754 standard), +and the result is a float. + + +

+Exponentiation and float division (/) +always convert their operands to floats +and the result is always a float. +Exponentiation uses the ISO C function pow, +so that it works for non-integer exponents too. + + +

+Floor division (//) is a division +that rounds the quotient towards minus infinity, +that is, the floor of the division of its operands. + + +

+Modulo is defined as the remainder of a division +that rounds the quotient towards minus infinity (floor division). + + +

+In case of overflows in integer arithmetic, +all operations wrap around, +according to the usual rules of two-complement arithmetic. +(In other words, +they return the unique representable integer +that is equal modulo 264 to the mathematical result.) + + + +

3.4.2 – Bitwise Operators

+Lua supports the following bitwise operators: + +

    +
  • &: bitwise AND
  • +
  • |: bitwise OR
  • +
  • ~: bitwise exclusive OR
  • +
  • >>: right shift
  • +
  • <<: left shift
  • +
  • ~: unary bitwise NOT
  • +
+ +

+All bitwise operations convert its operands to integers +(see §3.4.3), +operate on all bits of those integers, +and result in an integer. + + +

+Both right and left shifts fill the vacant bits with zeros. +Negative displacements shift to the other direction; +displacements with absolute values equal to or higher than +the number of bits in an integer +result in zero (as all bits are shifted out). + + + + + +

3.4.3 – Coercions and Conversions

+Lua provides some automatic conversions between some +types and representations at run time. +Bitwise operators always convert float operands to integers. +Exponentiation and float division +always convert integer operands to floats. +All other arithmetic operations applied to mixed numbers +(integers and floats) convert the integer operand to a float; +this is called the usual rule. +The C API also converts both integers to floats and +floats to integers, as needed. +Moreover, string concatenation accepts numbers as arguments, +besides strings. + + +

+Lua also converts strings to numbers, +whenever a number is expected. + + +

+In a conversion from integer to float, +if the integer value has an exact representation as a float, +that is the result. +Otherwise, +the conversion gets the nearest higher or +the nearest lower representable value. +This kind of conversion never fails. + + +

+The conversion from float to integer +checks whether the float has an exact representation as an integer +(that is, the float has an integral value and +it is in the range of integer representation). +If it does, that representation is the result. +Otherwise, the conversion fails. + + +

+The conversion from strings to numbers goes as follows: +First, the string is converted to an integer or a float, +following its syntax and the rules of the Lua lexer. +(The string may have also leading and trailing spaces and a sign.) +Then, the resulting number (float or integer) +is converted to the type (float or integer) required by the context +(e.g., the operation that forced the conversion). + + +

+All conversions from strings to numbers +accept both a dot and the current locale mark +as the radix character. +(The Lua lexer, however, accepts only a dot.) + + +

+The conversion from numbers to strings uses a +non-specified human-readable format. +For complete control over how numbers are converted to strings, +use the format function from the string library +(see string.format). + + + + + +

3.4.4 – Relational Operators

+Lua supports the following relational operators: + +

    +
  • ==: equality
  • +
  • ~=: inequality
  • +
  • <: less than
  • +
  • >: greater than
  • +
  • <=: less or equal
  • +
  • >=: greater or equal
  • +

+These operators always result in false or true. + + +

+Equality (==) first compares the type of its operands. +If the types are different, then the result is false. +Otherwise, the values of the operands are compared. +Strings are compared in the obvious way. +Numbers are equal if they denote the same mathematical value. + + +

+Tables, userdata, and threads +are compared by reference: +two objects are considered equal only if they are the same object. +Every time you create a new object +(a table, userdata, or thread), +this new object is different from any previously existing object. +Closures with the same reference are always equal. +Closures with any detectable difference +(different behavior, different definition) are always different. + + +

+You can change the way that Lua compares tables and userdata +by using the "eq" metamethod (see §2.4). + + +

+Equality comparisons do not convert strings to numbers +or vice versa. +Thus, "0"==0 evaluates to false, +and t[0] and t["0"] denote different +entries in a table. + + +

+The operator ~= is exactly the negation of equality (==). + + +

+The order operators work as follows. +If both arguments are numbers, +then they are compared according to their mathematical values +(regardless of their subtypes). +Otherwise, if both arguments are strings, +then their values are compared according to the current locale. +Otherwise, Lua tries to call the "lt" or the "le" +metamethod (see §2.4). +A comparison a > b is translated to b < a +and a >= b is translated to b <= a. + + +

+Following the IEEE 754 standard, +NaN is considered neither smaller than, +nor equal to, nor greater than any value (including itself). + + + + + +

3.4.5 – Logical Operators

+The logical operators in Lua are +and, or, and not. +Like the control structures (see §3.3.4), +all logical operators consider both false and nil as false +and anything else as true. + + +

+The negation operator not always returns false or true. +The conjunction operator and returns its first argument +if this value is false or nil; +otherwise, and returns its second argument. +The disjunction operator or returns its first argument +if this value is different from nil and false; +otherwise, or returns its second argument. +Both and and or use short-circuit evaluation; +that is, +the second operand is evaluated only if necessary. +Here are some examples: + +

+     10 or 20            --> 10
+     10 or error()       --> 10
+     nil or "a"          --> "a"
+     nil and 10          --> nil
+     false and error()   --> false
+     false and nil       --> false
+     false or nil        --> nil
+     10 and 20           --> 20
+

+(In this manual, +--> indicates the result of the preceding expression.) + + + + + +

3.4.6 – Concatenation

+The string concatenation operator in Lua is +denoted by two dots ('..'). +If both operands are strings or numbers, then they are converted to +strings according to the rules described in §3.4.3. +Otherwise, the __concat metamethod is called (see §2.4). + + + + + +

3.4.7 – The Length Operator

+ +

+The length operator is denoted by the unary prefix operator #. + + +

+The length of a string is its number of bytes +(that is, the usual meaning of string length when each +character is one byte). + + +

+The length operator applied on a table +returns a border in that table. +A border in a table t is any natural number +that satisfies the following condition: + +

+     (border == 0 or t[border] ~= nil) and t[border + 1] == nil
+

+In words, +a border is any (natural) index in a table +where a non-nil value is followed by a nil value +(or zero, when index 1 is nil). + + +

+A table with exactly one border is called a sequence. +For instance, the table {10, 20, 30, 40, 50} is a sequence, +as it has only one border (5). +The table {10, 20, 30, nil, 50} has two borders (3 and 5), +and therefore it is not a sequence. +The table {nil, 20, 30, nil, nil, 60, nil} +has three borders (0, 3, and 6), +so it is not a sequence, too. +The table {} is a sequence with border 0. +Note that non-natural keys do not interfere +with whether a table is a sequence. + + +

+When t is a sequence, +#t returns its only border, +which corresponds to the intuitive notion of the length of the sequence. +When t is not a sequence, +#t can return any of its borders. +(The exact one depends on details of +the internal representation of the table, +which in turn can depend on how the table was populated and +the memory addresses of its non-numeric keys.) + + +

+The computation of the length of a table +has a guaranteed worst time of O(log n), +where n is the largest natural key in the table. + + +

+A program can modify the behavior of the length operator for +any value but strings through the __len metamethod (see §2.4). + + + + + +

3.4.8 – Precedence

+Operator precedence in Lua follows the table below, +from lower to higher priority: + +

+     or
+     and
+     <     >     <=    >=    ~=    ==
+     |
+     ~
+     &
+     <<    >>
+     ..
+     +     -
+     *     /     //    %
+     unary operators (not   #     -     ~)
+     ^
+

+As usual, +you can use parentheses to change the precedences of an expression. +The concatenation ('..') and exponentiation ('^') +operators are right associative. +All other binary operators are left associative. + + + + + +

3.4.9 – Table Constructors

+Table constructors are expressions that create tables. +Every time a constructor is evaluated, a new table is created. +A constructor can be used to create an empty table +or to create a table and initialize some of its fields. +The general syntax for constructors is + +

+	tableconstructor ::= ‘{’ [fieldlist] ‘}’
+	fieldlist ::= field {fieldsep field} [fieldsep]
+	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
+	fieldsep ::= ‘,’ | ‘;’
+
+ +

+Each field of the form [exp1] = exp2 adds to the new table an entry +with key exp1 and value exp2. +A field of the form name = exp is equivalent to +["name"] = exp. +Finally, fields of the form exp are equivalent to +[i] = exp, where i are consecutive integers +starting with 1. +Fields in the other formats do not affect this counting. +For example, + +

+     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
+

+is equivalent to + +

+     do
+       local t = {}
+       t[f(1)] = g
+       t[1] = "x"         -- 1st exp
+       t[2] = "y"         -- 2nd exp
+       t.x = 1            -- t["x"] = 1
+       t[3] = f(x)        -- 3rd exp
+       t[30] = 23
+       t[4] = 45          -- 4th exp
+       a = t
+     end
+
+ +

+The order of the assignments in a constructor is undefined. +(This order would be relevant only when there are repeated keys.) + + +

+If the last field in the list has the form exp +and the expression is a function call or a vararg expression, +then all values returned by this expression enter the list consecutively +(see §3.4.10). + + +

+The field list can have an optional trailing separator, +as a convenience for machine-generated code. + + + + + +

3.4.10 – Function Calls

+A function call in Lua has the following syntax: + +

+	functioncall ::= prefixexp args
+

+In a function call, +first prefixexp and args are evaluated. +If the value of prefixexp has type function, +then this function is called +with the given arguments. +Otherwise, the prefixexp "call" metamethod is called, +having as first parameter the value of prefixexp, +followed by the original call arguments +(see §2.4). + + +

+The form + +

+	functioncall ::= prefixexp ‘:’ Name args
+

+can be used to call "methods". +A call v:name(args) +is syntactic sugar for v.name(v,args), +except that v is evaluated only once. + + +

+Arguments have the following syntax: + +

+	args ::= ‘(’ [explist] ‘)’
+	args ::= tableconstructor
+	args ::= LiteralString
+

+All argument expressions are evaluated before the call. +A call of the form f{fields} is +syntactic sugar for f({fields}); +that is, the argument list is a single new table. +A call of the form f'string' +(or f"string" or f[[string]]) +is syntactic sugar for f('string'); +that is, the argument list is a single literal string. + + +

+A call of the form return functioncall is called +a tail call. +Lua implements proper tail calls +(or proper tail recursion): +in a tail call, +the called function reuses the stack entry of the calling function. +Therefore, there is no limit on the number of nested tail calls that +a program can execute. +However, a tail call erases any debug information about the +calling function. +Note that a tail call only happens with a particular syntax, +where the return has one single function call as argument; +this syntax makes the calling function return exactly +the returns of the called function. +So, none of the following examples are tail calls: + +

+     return (f(x))        -- results adjusted to 1
+     return 2 * f(x)
+     return x, f(x)       -- additional results
+     f(x); return         -- results discarded
+     return x or f(x)     -- results adjusted to 1
+
+ + + + +

3.4.11 – Function Definitions

+ +

+The syntax for function definition is + +

+	functiondef ::= function funcbody
+	funcbody ::= ‘(’ [parlist] ‘)’ block end
+
+ +

+The following syntactic sugar simplifies function definitions: + +

+	stat ::= function funcname funcbody
+	stat ::= local function Name funcbody
+	funcname ::= Name {‘.’ Name} [‘:’ Name]
+

+The statement + +

+     function f () body end
+

+translates to + +

+     f = function () body end
+

+The statement + +

+     function t.a.b.c.f () body end
+

+translates to + +

+     t.a.b.c.f = function () body end
+

+The statement + +

+     local function f () body end
+

+translates to + +

+     local f; f = function () body end
+

+not to + +

+     local f = function () body end
+

+(This only makes a difference when the body of the function +contains references to f.) + + +

+A function definition is an executable expression, +whose value has type function. +When Lua precompiles a chunk, +all its function bodies are precompiled too. +Then, whenever Lua executes the function definition, +the function is instantiated (or closed). +This function instance (or closure) +is the final value of the expression. + + +

+Parameters act as local variables that are +initialized with the argument values: + +

+	parlist ::= namelist [‘,’ ‘...’] | ‘...’
+

+When a function is called, +the list of arguments is adjusted to +the length of the list of parameters, +unless the function is a vararg function, +which is indicated by three dots ('...') +at the end of its parameter list. +A vararg function does not adjust its argument list; +instead, it collects all extra arguments and supplies them +to the function through a vararg expression, +which is also written as three dots. +The value of this expression is a list of all actual extra arguments, +similar to a function with multiple results. +If a vararg expression is used inside another expression +or in the middle of a list of expressions, +then its return list is adjusted to one element. +If the expression is used as the last element of a list of expressions, +then no adjustment is made +(unless that last expression is enclosed in parentheses). + + +

+As an example, consider the following definitions: + +

+     function f(a, b) end
+     function g(a, b, ...) end
+     function r() return 1,2,3 end
+

+Then, we have the following mapping from arguments to parameters and +to the vararg expression: + +

+     CALL            PARAMETERS
+     
+     f(3)             a=3, b=nil
+     f(3, 4)          a=3, b=4
+     f(3, 4, 5)       a=3, b=4
+     f(r(), 10)       a=1, b=10
+     f(r())           a=1, b=2
+     
+     g(3)             a=3, b=nil, ... -->  (nothing)
+     g(3, 4)          a=3, b=4,   ... -->  (nothing)
+     g(3, 4, 5, 8)    a=3, b=4,   ... -->  5  8
+     g(5, r())        a=5, b=1,   ... -->  2  3
+
+ +

+Results are returned using the return statement (see §3.3.4). +If control reaches the end of a function +without encountering a return statement, +then the function returns with no results. + + +

+ +There is a system-dependent limit on the number of values +that a function may return. +This limit is guaranteed to be larger than 1000. + + +

+The colon syntax +is used for defining methods, +that is, functions that have an implicit extra parameter self. +Thus, the statement + +

+     function t.a.b.c:f (params) body end
+

+is syntactic sugar for + +

+     t.a.b.c.f = function (self, params) body end
+
+ + + + + + +

3.5 – Visibility Rules

+ +

+ +Lua is a lexically scoped language. +The scope of a local variable begins at the first statement after +its declaration and lasts until the last non-void statement +of the innermost block that includes the declaration. +Consider the following example: + +

+     x = 10                -- global variable
+     do                    -- new block
+       local x = x         -- new 'x', with value 10
+       print(x)            --> 10
+       x = x+1
+       do                  -- another block
+         local x = x+1     -- another 'x'
+         print(x)          --> 12
+       end
+       print(x)            --> 11
+     end
+     print(x)              --> 10  (the global one)
+
+ +

+Notice that, in a declaration like local x = x, +the new x being declared is not in scope yet, +and so the second x refers to the outside variable. + + +

+Because of the lexical scoping rules, +local variables can be freely accessed by functions +defined inside their scope. +A local variable used by an inner function is called +an upvalue, or external local variable, +inside the inner function. + + +

+Notice that each execution of a local statement +defines new local variables. +Consider the following example: + +

+     a = {}
+     local x = 20
+     for i=1,10 do
+       local y = 0
+       a[i] = function () y=y+1; return x+y end
+     end
+

+The loop creates ten closures +(that is, ten instances of the anonymous function). +Each of these closures uses a different y variable, +while all of them share the same x. + + + + + +

4 – The Application Program Interface

+ +

+ +This section describes the C API for Lua, that is, +the set of C functions available to the host program to communicate +with Lua. +All API functions and related types and constants +are declared in the header file lua.h. + + +

+Even when we use the term "function", +any facility in the API may be provided as a macro instead. +Except where stated otherwise, +all such macros use each of their arguments exactly once +(except for the first argument, which is always a Lua state), +and so do not generate any hidden side-effects. + + +

+As in most C libraries, +the Lua API functions do not check their arguments for validity or consistency. +However, you can change this behavior by compiling Lua +with the macro LUA_USE_APICHECK defined. + + +

+The Lua library is fully reentrant: +it has no global variables. +It keeps all information it needs in a dynamic structure, +called the Lua state. + + +

+Each Lua state has one or more threads, +which correspond to independent, cooperative lines of execution. +The type lua_State (despite its name) refers to a thread. +(Indirectly, through the thread, it also refers to the +Lua state associated to the thread.) + + +

+A pointer to a thread must be passed as the first argument to +every function in the library, except to lua_newstate, +which creates a Lua state from scratch and returns a pointer +to the main thread in the new state. + + + +

4.1 – The Stack

+ +

+Lua uses a virtual stack to pass values to and from C. +Each element in this stack represents a Lua value +(nil, number, string, etc.). +Functions in the API can access this stack through the +Lua state parameter that they receive. + + +

+Whenever Lua calls C, the called function gets a new stack, +which is independent of previous stacks and of stacks of +C functions that are still active. +This stack initially contains any arguments to the C function +and it is where the C function can store temporary +Lua values and must push its results +to be returned to the caller (see lua_CFunction). + + +

+For convenience, +most query operations in the API do not follow a strict stack discipline. +Instead, they can refer to any element in the stack +by using an index: +A positive index represents an absolute stack position +(starting at 1); +a negative index represents an offset relative to the top of the stack. +More specifically, if the stack has n elements, +then index 1 represents the first element +(that is, the element that was pushed onto the stack first) +and +index n represents the last element; +index -1 also represents the last element +(that is, the element at the top) +and index -n represents the first element. + + + + + +

4.2 – Stack Size

+ +

+When you interact with the Lua API, +you are responsible for ensuring consistency. +In particular, +you are responsible for controlling stack overflow. +You can use the function lua_checkstack +to ensure that the stack has enough space for pushing new elements. + + +

+Whenever Lua calls C, +it ensures that the stack has space for +at least LUA_MINSTACK extra slots. +LUA_MINSTACK is defined as 20, +so that usually you do not have to worry about stack space +unless your code has loops pushing elements onto the stack. + + +

+When you call a Lua function +without a fixed number of results (see lua_call), +Lua ensures that the stack has enough space for all results, +but it does not ensure any extra space. +So, before pushing anything in the stack after such a call +you should use lua_checkstack. + + + + + +

4.3 – Valid and Acceptable Indices

+ +

+Any function in the API that receives stack indices +works only with valid indices or acceptable indices. + + +

+A valid index is an index that refers to a +position that stores a modifiable Lua value. +It comprises stack indices between 1 and the stack top +(1 ≤ abs(index) ≤ top) + +plus pseudo-indices, +which represent some positions that are accessible to C code +but that are not in the stack. +Pseudo-indices are used to access the registry (see §4.5) +and the upvalues of a C function (see §4.4). + + +

+Functions that do not need a specific mutable position, +but only a value (e.g., query functions), +can be called with acceptable indices. +An acceptable index can be any valid index, +but it also can be any positive index after the stack top +within the space allocated for the stack, +that is, indices up to the stack size. +(Note that 0 is never an acceptable index.) +Except when noted otherwise, +functions in the API work with acceptable indices. + + +

+Acceptable indices serve to avoid extra tests +against the stack top when querying the stack. +For instance, a C function can query its third argument +without the need to first check whether there is a third argument, +that is, without the need to check whether 3 is a valid index. + + +

+For functions that can be called with acceptable indices, +any non-valid index is treated as if it +contains a value of a virtual type LUA_TNONE, +which behaves like a nil value. + + + + + +

4.4 – C Closures

+ +

+When a C function is created, +it is possible to associate some values with it, +thus creating a C closure +(see lua_pushcclosure); +these values are called upvalues and are +accessible to the function whenever it is called. + + +

+Whenever a C function is called, +its upvalues are located at specific pseudo-indices. +These pseudo-indices are produced by the macro +lua_upvalueindex. +The first upvalue associated with a function is at index +lua_upvalueindex(1), and so on. +Any access to lua_upvalueindex(n), +where n is greater than the number of upvalues of the +current function +(but not greater than 256, +which is one plus the maximum number of upvalues in a closure), +produces an acceptable but invalid index. + + + + + +

4.5 – Registry

+ +

+Lua provides a registry, +a predefined table that can be used by any C code to +store whatever Lua values it needs to store. +The registry table is always located at pseudo-index +LUA_REGISTRYINDEX. +Any C library can store data into this table, +but it must take care to choose keys +that are different from those used +by other libraries, to avoid collisions. +Typically, you should use as key a string containing your library name, +or a light userdata with the address of a C object in your code, +or any Lua object created by your code. +As with variable names, +string keys starting with an underscore followed by +uppercase letters are reserved for Lua. + + +

+The integer keys in the registry are used +by the reference mechanism (see luaL_ref) +and by some predefined values. +Therefore, integer keys must not be used for other purposes. + + +

+When you create a new Lua state, +its registry comes with some predefined values. +These predefined values are indexed with integer keys +defined as constants in lua.h. +The following constants are defined: + +

    +
  • LUA_RIDX_MAINTHREAD: At this index the registry has +the main thread of the state. +(The main thread is the one created together with the state.) +
  • + +
  • LUA_RIDX_GLOBALS: At this index the registry has +the global environment. +
  • +
+ + + + +

4.6 – Error Handling in C

+ +

+Internally, Lua uses the C longjmp facility to handle errors. +(Lua will use exceptions if you compile it as C++; +search for LUAI_THROW in the source code for details.) +When Lua faces any error +(such as a memory allocation error or a type error) +it raises an error; +that is, it does a long jump. +A protected environment uses setjmp +to set a recovery point; +any error jumps to the most recent active recovery point. + + +

+Inside a C function you can raise an error by calling lua_error. + + +

+Most functions in the API can raise an error, +for instance due to a memory allocation error. +The documentation for each function indicates whether +it can raise errors. + + +

+If an error happens outside any protected environment, +Lua calls a panic function (see lua_atpanic) +and then calls abort, +thus exiting the host application. +Your panic function can avoid this exit by +never returning +(e.g., doing a long jump to your own recovery point outside Lua). + + +

+The panic function, +as its name implies, +is a mechanism of last resort. +Programs should avoid it. +As a general rule, +when a C function is called by Lua with a Lua state, +it can do whatever it wants on that Lua state, +as it should be already protected. +However, +when C code operates on other Lua states +(e.g., a Lua parameter to the function, +a Lua state stored in the registry, or +the result of lua_newthread), +it should use them only in API calls that cannot raise errors. + + +

+The panic function runs as if it were a message handler (see §2.3); +in particular, the error object is at the top of the stack. +However, there is no guarantee about stack space. +To push anything on the stack, +the panic function must first check the available space (see §4.2). + + + + + +

4.7 – Handling Yields in C

+ +

+Internally, Lua uses the C longjmp facility to yield a coroutine. +Therefore, if a C function foo calls an API function +and this API function yields +(directly or indirectly by calling another function that yields), +Lua cannot return to foo any more, +because the longjmp removes its frame from the C stack. + + +

+To avoid this kind of problem, +Lua raises an error whenever it tries to yield across an API call, +except for three functions: +lua_yieldk, lua_callk, and lua_pcallk. +All those functions receive a continuation function +(as a parameter named k) to continue execution after a yield. + + +

+We need to set some terminology to explain continuations. +We have a C function called from Lua which we will call +the original function. +This original function then calls one of those three functions in the C API, +which we will call the callee function, +that then yields the current thread. +(This can happen when the callee function is lua_yieldk, +or when the callee function is either lua_callk or lua_pcallk +and the function called by them yields.) + + +

+Suppose the running thread yields while executing the callee function. +After the thread resumes, +it eventually will finish running the callee function. +However, +the callee function cannot return to the original function, +because its frame in the C stack was destroyed by the yield. +Instead, Lua calls a continuation function, +which was given as an argument to the callee function. +As the name implies, +the continuation function should continue the task +of the original function. + + +

+As an illustration, consider the following function: + +

+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       status = lua_pcall(L, n, m, h);  /* calls Lua */
+       ...     /* code 2 */
+     }
+

+Now we want to allow +the Lua code being run by lua_pcall to yield. +First, we can rewrite our function like here: + +

+     int k (lua_State *L, int status, lua_KContext ctx) {
+       ...  /* code 2 */
+     }
+     
+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       return k(L, lua_pcall(L, n, m, h), ctx);
+     }
+

+In the above code, +the new function k is a +continuation function (with type lua_KFunction), +which should do all the work that the original function +was doing after calling lua_pcall. +Now, we must inform Lua that it must call k if the Lua code +being executed by lua_pcall gets interrupted in some way +(errors or yielding), +so we rewrite the code as here, +replacing lua_pcall by lua_pcallk: + +

+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       return k(L, lua_pcallk(L, n, m, h, ctx2, k), ctx1);
+     }
+

+Note the external, explicit call to the continuation: +Lua will call the continuation only if needed, that is, +in case of errors or resuming after a yield. +If the called function returns normally without ever yielding, +lua_pcallk (and lua_callk) will also return normally. +(Of course, instead of calling the continuation in that case, +you can do the equivalent work directly inside the original function.) + + +

+Besides the Lua state, +the continuation function has two other parameters: +the final status of the call plus the context value (ctx) that +was passed originally to lua_pcallk. +(Lua does not use this context value; +it only passes this value from the original function to the +continuation function.) +For lua_pcallk, +the status is the same value that would be returned by lua_pcallk, +except that it is LUA_YIELD when being executed after a yield +(instead of LUA_OK). +For lua_yieldk and lua_callk, +the status is always LUA_YIELD when Lua calls the continuation. +(For these two functions, +Lua will not call the continuation in case of errors, +because they do not handle errors.) +Similarly, when using lua_callk, +you should call the continuation function +with LUA_OK as the status. +(For lua_yieldk, there is not much point in calling +directly the continuation function, +because lua_yieldk usually does not return.) + + +

+Lua treats the continuation function as if it were the original function. +The continuation function receives the same Lua stack +from the original function, +in the same state it would be if the callee function had returned. +(For instance, +after a lua_callk the function and its arguments are +removed from the stack and replaced by the results from the call.) +It also has the same upvalues. +Whatever it returns is handled by Lua as if it were the return +of the original function. + + + + + +

4.8 – Functions and Types

+ +

+Here we list all functions and types from the C API in +alphabetical order. +Each function has an indicator like this: +[-o, +p, x] + + +

+The first field, o, +is how many elements the function pops from the stack. +The second field, p, +is how many elements the function pushes onto the stack. +(Any function always pushes its results after popping its arguments.) +A field in the form x|y means the function can push (or pop) +x or y elements, +depending on the situation; +an interrogation mark '?' means that +we cannot know how many elements the function pops/pushes +by looking only at its arguments +(e.g., they may depend on what is on the stack). +The third field, x, +tells whether the function may raise errors: +'-' means the function never raises any error; +'m' means the function may raise out-of-memory errors +and errors running a __gc metamethod; +'e' means the function may raise any errors +(it can run arbitrary Lua code, +either directly or through metamethods); +'v' means the function may raise an error on purpose. + + + +


lua_absindex

+[-0, +0, –] +

int lua_absindex (lua_State *L, int idx);
+ +

+Converts the acceptable index idx +into an equivalent absolute index +(that is, one that does not depend on the stack top). + + + + + +


lua_Alloc

+
typedef void * (*lua_Alloc) (void *ud,
+                             void *ptr,
+                             size_t osize,
+                             size_t nsize);
+ +

+The type of the memory-allocation function used by Lua states. +The allocator function must provide a +functionality similar to realloc, +but not exactly the same. +Its arguments are +ud, an opaque pointer passed to lua_newstate; +ptr, a pointer to the block being allocated/reallocated/freed; +osize, the original size of the block or some code about what +is being allocated; +and nsize, the new size of the block. + + +

+When ptr is not NULL, +osize is the size of the block pointed by ptr, +that is, the size given when it was allocated or reallocated. + + +

+When ptr is NULL, +osize encodes the kind of object that Lua is allocating. +osize is any of +LUA_TSTRING, LUA_TTABLE, LUA_TFUNCTION, +LUA_TUSERDATA, or LUA_TTHREAD when (and only when) +Lua is creating a new object of that type. +When osize is some other value, +Lua is allocating memory for something else. + + +

+Lua assumes the following behavior from the allocator function: + + +

+When nsize is zero, +the allocator must behave like free +and return NULL. + + +

+When nsize is not zero, +the allocator must behave like realloc. +The allocator returns NULL +if and only if it cannot fulfill the request. +Lua assumes that the allocator never fails when +osize >= nsize. + + +

+Here is a simple implementation for the allocator function. +It is used in the auxiliary library by luaL_newstate. + +

+     static void *l_alloc (void *ud, void *ptr, size_t osize,
+                                                size_t nsize) {
+       (void)ud;  (void)osize;  /* not used */
+       if (nsize == 0) {
+         free(ptr);
+         return NULL;
+       }
+       else
+         return realloc(ptr, nsize);
+     }
+

+Note that Standard C ensures +that free(NULL) has no effect and that +realloc(NULL,size) is equivalent to malloc(size). +This code assumes that realloc does not fail when shrinking a block. +(Although Standard C does not ensure this behavior, +it seems to be a safe assumption.) + + + + + +


lua_arith

+[-(2|1), +1, e] +

void lua_arith (lua_State *L, int op);
+ +

+Performs an arithmetic or bitwise operation over the two values +(or one, in the case of negations) +at the top of the stack, +with the value at the top being the second operand, +pops these values, and pushes the result of the operation. +The function follows the semantics of the corresponding Lua operator +(that is, it may call metamethods). + + +

+The value of op must be one of the following constants: + +

+ + + + +

lua_atpanic

+[-0, +0, –] +

lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
+ +

+Sets a new panic function and returns the old one (see §4.6). + + + + + +


lua_call

+[-(nargs+1), +nresults, e] +

void lua_call (lua_State *L, int nargs, int nresults);
+ +

+Calls a function. + + +

+To call a function you must use the following protocol: +first, the function to be called is pushed onto the stack; +then, the arguments to the function are pushed +in direct order; +that is, the first argument is pushed first. +Finally you call lua_call; +nargs is the number of arguments that you pushed onto the stack. +All arguments and the function value are popped from the stack +when the function is called. +The function results are pushed onto the stack when the function returns. +The number of results is adjusted to nresults, +unless nresults is LUA_MULTRET. +In this case, all results from the function are pushed; +Lua takes care that the returned values fit into the stack space, +but it does not ensure any extra space in the stack. +The function results are pushed onto the stack in direct order +(the first result is pushed first), +so that after the call the last result is on the top of the stack. + + +

+Any error inside the called function is propagated upwards +(with a longjmp). + + +

+The following example shows how the host program can do the +equivalent to this Lua code: + +

+     a = f("how", t.x, 14)
+

+Here it is in C: + +

+     lua_getglobal(L, "f");                  /* function to be called */
+     lua_pushliteral(L, "how");                       /* 1st argument */
+     lua_getglobal(L, "t");                    /* table to be indexed */
+     lua_getfield(L, -1, "x");        /* push result of t.x (2nd arg) */
+     lua_remove(L, -2);                  /* remove 't' from the stack */
+     lua_pushinteger(L, 14);                          /* 3rd argument */
+     lua_call(L, 3, 1);     /* call 'f' with 3 arguments and 1 result */
+     lua_setglobal(L, "a");                         /* set global 'a' */
+

+Note that the code above is balanced: +at its end, the stack is back to its original configuration. +This is considered good programming practice. + + + + + +


lua_callk

+[-(nargs + 1), +nresults, e] +

void lua_callk (lua_State *L,
+                int nargs,
+                int nresults,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+This function behaves exactly like lua_call, +but allows the called function to yield (see §4.7). + + + + + +


lua_CFunction

+
typedef int (*lua_CFunction) (lua_State *L);
+ +

+Type for C functions. + + +

+In order to communicate properly with Lua, +a C function must use the following protocol, +which defines the way parameters and results are passed: +a C function receives its arguments from Lua in its stack +in direct order (the first argument is pushed first). +So, when the function starts, +lua_gettop(L) returns the number of arguments received by the function. +The first argument (if any) is at index 1 +and its last argument is at index lua_gettop(L). +To return values to Lua, a C function just pushes them onto the stack, +in direct order (the first result is pushed first), +and returns the number of results. +Any other value in the stack below the results will be properly +discarded by Lua. +Like a Lua function, a C function called by Lua can also return +many results. + + +

+As an example, the following function receives a variable number +of numeric arguments and returns their average and their sum: + +

+     static int foo (lua_State *L) {
+       int n = lua_gettop(L);    /* number of arguments */
+       lua_Number sum = 0.0;
+       int i;
+       for (i = 1; i <= n; i++) {
+         if (!lua_isnumber(L, i)) {
+           lua_pushliteral(L, "incorrect argument");
+           lua_error(L);
+         }
+         sum += lua_tonumber(L, i);
+       }
+       lua_pushnumber(L, sum/n);        /* first result */
+       lua_pushnumber(L, sum);         /* second result */
+       return 2;                   /* number of results */
+     }
+
+ + + + +

lua_checkstack

+[-0, +0, –] +

int lua_checkstack (lua_State *L, int n);
+ +

+Ensures that the stack has space for at least n extra slots +(that is, that you can safely push up to n values into it). +It returns false if it cannot fulfill the request, +either because it would cause the stack +to be larger than a fixed maximum size +(typically at least several thousand elements) or +because it cannot allocate memory for the extra space. +This function never shrinks the stack; +if the stack already has space for the extra slots, +it is left unchanged. + + + + + +


lua_close

+[-0, +0, –] +

void lua_close (lua_State *L);
+ +

+Destroys all objects in the given Lua state +(calling the corresponding garbage-collection metamethods, if any) +and frees all dynamic memory used by this state. +On several platforms, you may not need to call this function, +because all resources are naturally released when the host program ends. +On the other hand, long-running programs that create multiple states, +such as daemons or web servers, +will probably need to close states as soon as they are not needed. + + + + + +


lua_compare

+[-0, +0, e] +

int lua_compare (lua_State *L, int index1, int index2, int op);
+ +

+Compares two Lua values. +Returns 1 if the value at index index1 satisfies op +when compared with the value at index index2, +following the semantics of the corresponding Lua operator +(that is, it may call metamethods). +Otherwise returns 0. +Also returns 0 if any of the indices is not valid. + + +

+The value of op must be one of the following constants: + +

    + +
  • LUA_OPEQ: compares for equality (==)
  • +
  • LUA_OPLT: compares for less than (<)
  • +
  • LUA_OPLE: compares for less or equal (<=)
  • + +
+ + + + +

lua_concat

+[-n, +1, e] +

void lua_concat (lua_State *L, int n);
+ +

+Concatenates the n values at the top of the stack, +pops them, and leaves the result at the top. +If n is 1, the result is the single value on the stack +(that is, the function does nothing); +if n is 0, the result is the empty string. +Concatenation is performed following the usual semantics of Lua +(see §3.4.6). + + + + + +


lua_copy

+[-0, +0, –] +

void lua_copy (lua_State *L, int fromidx, int toidx);
+ +

+Copies the element at index fromidx +into the valid index toidx, +replacing the value at that position. +Values at other positions are not affected. + + + + + +


lua_createtable

+[-0, +1, m] +

void lua_createtable (lua_State *L, int narr, int nrec);
+ +

+Creates a new empty table and pushes it onto the stack. +Parameter narr is a hint for how many elements the table +will have as a sequence; +parameter nrec is a hint for how many other elements +the table will have. +Lua may use these hints to preallocate memory for the new table. +This preallocation is useful for performance when you know in advance +how many elements the table will have. +Otherwise you can use the function lua_newtable. + + + + + +


lua_dump

+[-0, +0, –] +

int lua_dump (lua_State *L,
+                        lua_Writer writer,
+                        void *data,
+                        int strip);
+ +

+Dumps a function as a binary chunk. +Receives a Lua function on the top of the stack +and produces a binary chunk that, +if loaded again, +results in a function equivalent to the one dumped. +As it produces parts of the chunk, +lua_dump calls function writer (see lua_Writer) +with the given data +to write them. + + +

+If strip is true, +the binary representation may not include all debug information +about the function, +to save space. + + +

+The value returned is the error code returned by the last +call to the writer; +0 means no errors. + + +

+This function does not pop the Lua function from the stack. + + + + + +


lua_error

+[-1, +0, v] +

int lua_error (lua_State *L);
+ +

+Generates a Lua error, +using the value at the top of the stack as the error object. +This function does a long jump, +and therefore never returns +(see luaL_error). + + + + + +


lua_gc

+[-0, +0, m] +

int lua_gc (lua_State *L, int what, int data);
+ +

+Controls the garbage collector. + + +

+This function performs several tasks, +according to the value of the parameter what: + +

    + +
  • LUA_GCSTOP: +stops the garbage collector. +
  • + +
  • LUA_GCRESTART: +restarts the garbage collector. +
  • + +
  • LUA_GCCOLLECT: +performs a full garbage-collection cycle. +
  • + +
  • LUA_GCCOUNT: +returns the current amount of memory (in Kbytes) in use by Lua. +
  • + +
  • LUA_GCCOUNTB: +returns the remainder of dividing the current amount of bytes of +memory in use by Lua by 1024. +
  • + +
  • LUA_GCSTEP: +performs an incremental step of garbage collection. +
  • + +
  • LUA_GCSETPAUSE: +sets data as the new value +for the pause of the collector (see §2.5) +and returns the previous value of the pause. +
  • + +
  • LUA_GCSETSTEPMUL: +sets data as the new value for the step multiplier of +the collector (see §2.5) +and returns the previous value of the step multiplier. +
  • + +
  • LUA_GCISRUNNING: +returns a boolean that tells whether the collector is running +(i.e., not stopped). +
  • + +
+ +

+For more details about these options, +see collectgarbage. + + + + + +


lua_getallocf

+[-0, +0, –] +

lua_Alloc lua_getallocf (lua_State *L, void **ud);
+ +

+Returns the memory-allocation function of a given state. +If ud is not NULL, Lua stores in *ud the +opaque pointer given when the memory-allocator function was set. + + + + + +


lua_getfield

+[-0, +1, e] +

int lua_getfield (lua_State *L, int index, const char *k);
+ +

+Pushes onto the stack the value t[k], +where t is the value at the given index. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_getextraspace

+[-0, +0, –] +

void *lua_getextraspace (lua_State *L);
+ +

+Returns a pointer to a raw memory area associated with the +given Lua state. +The application can use this area for any purpose; +Lua does not use it for anything. + + +

+Each new thread has this area initialized with a copy +of the area of the main thread. + + +

+By default, this area has the size of a pointer to void, +but you can recompile Lua with a different size for this area. +(See LUA_EXTRASPACE in luaconf.h.) + + + + + +


lua_getglobal

+[-0, +1, e] +

int lua_getglobal (lua_State *L, const char *name);
+ +

+Pushes onto the stack the value of the global name. +Returns the type of that value. + + + + + +


lua_geti

+[-0, +1, e] +

int lua_geti (lua_State *L, int index, lua_Integer i);
+ +

+Pushes onto the stack the value t[i], +where t is the value at the given index. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_getmetatable

+[-0, +(0|1), –] +

int lua_getmetatable (lua_State *L, int index);
+ +

+If the value at the given index has a metatable, +the function pushes that metatable onto the stack and returns 1. +Otherwise, +the function returns 0 and pushes nothing on the stack. + + + + + +


lua_gettable

+[-1, +1, e] +

int lua_gettable (lua_State *L, int index);
+ +

+Pushes onto the stack the value t[k], +where t is the value at the given index +and k is the value at the top of the stack. + + +

+This function pops the key from the stack, +pushing the resulting value in its place. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_gettop

+[-0, +0, –] +

int lua_gettop (lua_State *L);
+ +

+Returns the index of the top element in the stack. +Because indices start at 1, +this result is equal to the number of elements in the stack; +in particular, 0 means an empty stack. + + + + + +


lua_getuservalue

+[-0, +1, –] +

int lua_getuservalue (lua_State *L, int index);
+ +

+Pushes onto the stack the Lua value associated with the full userdata +at the given index. + + +

+Returns the type of the pushed value. + + + + + +


lua_insert

+[-1, +1, –] +

void lua_insert (lua_State *L, int index);
+ +

+Moves the top element into the given valid index, +shifting up the elements above this index to open space. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_Integer

+
typedef ... lua_Integer;
+ +

+The type of integers in Lua. + + +

+By default this type is long long, +(usually a 64-bit two-complement integer), +but that can be changed to long or int +(usually a 32-bit two-complement integer). +(See LUA_INT_TYPE in luaconf.h.) + + +

+Lua also defines the constants +LUA_MININTEGER and LUA_MAXINTEGER, +with the minimum and the maximum values that fit in this type. + + + + + +


lua_isboolean

+[-0, +0, –] +

int lua_isboolean (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a boolean, +and 0 otherwise. + + + + + +


lua_iscfunction

+[-0, +0, –] +

int lua_iscfunction (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a C function, +and 0 otherwise. + + + + + +


lua_isfunction

+[-0, +0, –] +

int lua_isfunction (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a function +(either C or Lua), and 0 otherwise. + + + + + +


lua_isinteger

+[-0, +0, –] +

int lua_isinteger (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is an integer +(that is, the value is a number and is represented as an integer), +and 0 otherwise. + + + + + +


lua_islightuserdata

+[-0, +0, –] +

int lua_islightuserdata (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a light userdata, +and 0 otherwise. + + + + + +


lua_isnil

+[-0, +0, –] +

int lua_isnil (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is nil, +and 0 otherwise. + + + + + +


lua_isnone

+[-0, +0, –] +

int lua_isnone (lua_State *L, int index);
+ +

+Returns 1 if the given index is not valid, +and 0 otherwise. + + + + + +


lua_isnoneornil

+[-0, +0, –] +

int lua_isnoneornil (lua_State *L, int index);
+ +

+Returns 1 if the given index is not valid +or if the value at this index is nil, +and 0 otherwise. + + + + + +


lua_isnumber

+[-0, +0, –] +

int lua_isnumber (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a number +or a string convertible to a number, +and 0 otherwise. + + + + + +


lua_isstring

+[-0, +0, –] +

int lua_isstring (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a string +or a number (which is always convertible to a string), +and 0 otherwise. + + + + + +


lua_istable

+[-0, +0, –] +

int lua_istable (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a table, +and 0 otherwise. + + + + + +


lua_isthread

+[-0, +0, –] +

int lua_isthread (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a thread, +and 0 otherwise. + + + + + +


lua_isuserdata

+[-0, +0, –] +

int lua_isuserdata (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a userdata +(either full or light), and 0 otherwise. + + + + + +


lua_isyieldable

+[-0, +0, –] +

int lua_isyieldable (lua_State *L);
+ +

+Returns 1 if the given coroutine can yield, +and 0 otherwise. + + + + + +


lua_KContext

+
typedef ... lua_KContext;
+ +

+The type for continuation-function contexts. +It must be a numeric type. +This type is defined as intptr_t +when intptr_t is available, +so that it can store pointers too. +Otherwise, it is defined as ptrdiff_t. + + + + + +


lua_KFunction

+
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
+ +

+Type for continuation functions (see §4.7). + + + + + +


lua_len

+[-0, +1, e] +

void lua_len (lua_State *L, int index);
+ +

+Returns the length of the value at the given index. +It is equivalent to the '#' operator in Lua (see §3.4.7) and +may trigger a metamethod for the "length" event (see §2.4). +The result is pushed on the stack. + + + + + +


lua_load

+[-0, +1, –] +

int lua_load (lua_State *L,
+              lua_Reader reader,
+              void *data,
+              const char *chunkname,
+              const char *mode);
+ +

+Loads a Lua chunk without running it. +If there are no errors, +lua_load pushes the compiled chunk as a Lua +function on top of the stack. +Otherwise, it pushes an error message. + + +

+The return values of lua_load are: + +

    + +
  • LUA_OK: no errors;
  • + +
  • LUA_ERRSYNTAX: +syntax error during precompilation;
  • + +
  • LUA_ERRMEM: +memory allocation (out-of-memory) error;
  • + +
  • LUA_ERRGCMM: +error while running a __gc metamethod. +(This error has no relation with the chunk being loaded. +It is generated by the garbage collector.) +
  • + +
+ +

+The lua_load function uses a user-supplied reader function +to read the chunk (see lua_Reader). +The data argument is an opaque value passed to the reader function. + + +

+The chunkname argument gives a name to the chunk, +which is used for error messages and in debug information (see §4.9). + + +

+lua_load automatically detects whether the chunk is text or binary +and loads it accordingly (see program luac). +The string mode works as in function load, +with the addition that +a NULL value is equivalent to the string "bt". + + +

+lua_load uses the stack internally, +so the reader function must always leave the stack +unmodified when returning. + + +

+If the resulting function has upvalues, +its first upvalue is set to the value of the global environment +stored at index LUA_RIDX_GLOBALS in the registry (see §4.5). +When loading main chunks, +this upvalue will be the _ENV variable (see §2.2). +Other upvalues are initialized with nil. + + + + + +


lua_newstate

+[-0, +0, –] +

lua_State *lua_newstate (lua_Alloc f, void *ud);
+ +

+Creates a new thread running in a new, independent state. +Returns NULL if it cannot create the thread or the state +(due to lack of memory). +The argument f is the allocator function; +Lua does all memory allocation for this state +through this function (see lua_Alloc). +The second argument, ud, is an opaque pointer that Lua +passes to the allocator in every call. + + + + + +


lua_newtable

+[-0, +1, m] +

void lua_newtable (lua_State *L);
+ +

+Creates a new empty table and pushes it onto the stack. +It is equivalent to lua_createtable(L, 0, 0). + + + + + +


lua_newthread

+[-0, +1, m] +

lua_State *lua_newthread (lua_State *L);
+ +

+Creates a new thread, pushes it on the stack, +and returns a pointer to a lua_State that represents this new thread. +The new thread returned by this function shares with the original thread +its global environment, +but has an independent execution stack. + + +

+There is no explicit function to close or to destroy a thread. +Threads are subject to garbage collection, +like any Lua object. + + + + + +


lua_newuserdata

+[-0, +1, m] +

void *lua_newuserdata (lua_State *L, size_t size);
+ +

+This function allocates a new block of memory with the given size, +pushes onto the stack a new full userdata with the block address, +and returns this address. +The host program can freely use this memory. + + + + + +


lua_next

+[-1, +(2|0), e] +

int lua_next (lua_State *L, int index);
+ +

+Pops a key from the stack, +and pushes a key–value pair from the table at the given index +(the "next" pair after the given key). +If there are no more elements in the table, +then lua_next returns 0 (and pushes nothing). + + +

+A typical traversal looks like this: + +

+     /* table is in the stack at index 't' */
+     lua_pushnil(L);  /* first key */
+     while (lua_next(L, t) != 0) {
+       /* uses 'key' (at index -2) and 'value' (at index -1) */
+       printf("%s - %s\n",
+              lua_typename(L, lua_type(L, -2)),
+              lua_typename(L, lua_type(L, -1)));
+       /* removes 'value'; keeps 'key' for next iteration */
+       lua_pop(L, 1);
+     }
+
+ +

+While traversing a table, +do not call lua_tolstring directly on a key, +unless you know that the key is actually a string. +Recall that lua_tolstring may change +the value at the given index; +this confuses the next call to lua_next. + + +

+See function next for the caveats of modifying +the table during its traversal. + + + + + +


lua_Number

+
typedef ... lua_Number;
+ +

+The type of floats in Lua. + + +

+By default this type is double, +but that can be changed to a single float or a long double. +(See LUA_FLOAT_TYPE in luaconf.h.) + + + + + +


lua_numbertointeger

+
int lua_numbertointeger (lua_Number n, lua_Integer *p);
+ +

+Converts a Lua float to a Lua integer. +This macro assumes that n has an integral value. +If that value is within the range of Lua integers, +it is converted to an integer and assigned to *p. +The macro results in a boolean indicating whether the +conversion was successful. +(Note that this range test can be tricky to do +correctly without this macro, +due to roundings.) + + +

+This macro may evaluate its arguments more than once. + + + + + +


lua_pcall

+[-(nargs + 1), +(nresults|1), –] +

int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);
+ +

+Calls a function in protected mode. + + +

+Both nargs and nresults have the same meaning as +in lua_call. +If there are no errors during the call, +lua_pcall behaves exactly like lua_call. +However, if there is any error, +lua_pcall catches it, +pushes a single value on the stack (the error object), +and returns an error code. +Like lua_call, +lua_pcall always removes the function +and its arguments from the stack. + + +

+If msgh is 0, +then the error object returned on the stack +is exactly the original error object. +Otherwise, msgh is the stack index of a +message handler. +(This index cannot be a pseudo-index.) +In case of runtime errors, +this function will be called with the error object +and its return value will be the object +returned on the stack by lua_pcall. + + +

+Typically, the message handler is used to add more debug +information to the error object, such as a stack traceback. +Such information cannot be gathered after the return of lua_pcall, +since by then the stack has unwound. + + +

+The lua_pcall function returns one of the following constants +(defined in lua.h): + +

    + +
  • LUA_OK (0): +success.
  • + +
  • LUA_ERRRUN: +a runtime error. +
  • + +
  • LUA_ERRMEM: +memory allocation error. +For such errors, Lua does not call the message handler. +
  • + +
  • LUA_ERRERR: +error while running the message handler. +
  • + +
  • LUA_ERRGCMM: +error while running a __gc metamethod. +For such errors, Lua does not call the message handler +(as this kind of error typically has no relation +with the function being called). +
  • + +
+ + + + +

lua_pcallk

+[-(nargs + 1), +(nresults|1), –] +

int lua_pcallk (lua_State *L,
+                int nargs,
+                int nresults,
+                int msgh,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+This function behaves exactly like lua_pcall, +but allows the called function to yield (see §4.7). + + + + + +


lua_pop

+[-n, +0, –] +

void lua_pop (lua_State *L, int n);
+ +

+Pops n elements from the stack. + + + + + +


lua_pushboolean

+[-0, +1, –] +

void lua_pushboolean (lua_State *L, int b);
+ +

+Pushes a boolean value with value b onto the stack. + + + + + +


lua_pushcclosure

+[-n, +1, m] +

void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
+ +

+Pushes a new C closure onto the stack. + + +

+When a C function is created, +it is possible to associate some values with it, +thus creating a C closure (see §4.4); +these values are then accessible to the function whenever it is called. +To associate values with a C function, +first these values must be pushed onto the stack +(when there are multiple values, the first value is pushed first). +Then lua_pushcclosure +is called to create and push the C function onto the stack, +with the argument n telling how many values will be +associated with the function. +lua_pushcclosure also pops these values from the stack. + + +

+The maximum value for n is 255. + + +

+When n is zero, +this function creates a light C function, +which is just a pointer to the C function. +In that case, it never raises a memory error. + + + + + +


lua_pushcfunction

+[-0, +1, –] +

void lua_pushcfunction (lua_State *L, lua_CFunction f);
+ +

+Pushes a C function onto the stack. +This function receives a pointer to a C function +and pushes onto the stack a Lua value of type function that, +when called, invokes the corresponding C function. + + +

+Any function to be callable by Lua must +follow the correct protocol to receive its parameters +and return its results (see lua_CFunction). + + + + + +


lua_pushfstring

+[-0, +1, e] +

const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
+ +

+Pushes onto the stack a formatted string +and returns a pointer to this string. +It is similar to the ISO C function sprintf, +but has some important differences: + +

    + +
  • +You do not have to allocate space for the result: +the result is a Lua string and Lua takes care of memory allocation +(and deallocation, through garbage collection). +
  • + +
  • +The conversion specifiers are quite restricted. +There are no flags, widths, or precisions. +The conversion specifiers can only be +'%%' (inserts the character '%'), +'%s' (inserts a zero-terminated string, with no size restrictions), +'%f' (inserts a lua_Number), +'%I' (inserts a lua_Integer), +'%p' (inserts a pointer as a hexadecimal numeral), +'%d' (inserts an int), +'%c' (inserts an int as a one-byte character), and +'%U' (inserts a long int as a UTF-8 byte sequence). +
  • + +
+ +

+Unlike other push functions, +this function checks for the stack space it needs, +including the slot for its result. + + + + + +


lua_pushglobaltable

+[-0, +1, –] +

void lua_pushglobaltable (lua_State *L);
+ +

+Pushes the global environment onto the stack. + + + + + +


lua_pushinteger

+[-0, +1, –] +

void lua_pushinteger (lua_State *L, lua_Integer n);
+ +

+Pushes an integer with value n onto the stack. + + + + + +


lua_pushlightuserdata

+[-0, +1, –] +

void lua_pushlightuserdata (lua_State *L, void *p);
+ +

+Pushes a light userdata onto the stack. + + +

+Userdata represent C values in Lua. +A light userdata represents a pointer, a void*. +It is a value (like a number): +you do not create it, it has no individual metatable, +and it is not collected (as it was never created). +A light userdata is equal to "any" +light userdata with the same C address. + + + + + +


lua_pushliteral

+[-0, +1, m] +

const char *lua_pushliteral (lua_State *L, const char *s);
+ +

+This macro is equivalent to lua_pushstring, +but should be used only when s is a literal string. + + + + + +


lua_pushlstring

+[-0, +1, m] +

const char *lua_pushlstring (lua_State *L, const char *s, size_t len);
+ +

+Pushes the string pointed to by s with size len +onto the stack. +Lua makes (or reuses) an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. +The string can contain any binary data, +including embedded zeros. + + +

+Returns a pointer to the internal copy of the string. + + + + + +


lua_pushnil

+[-0, +1, –] +

void lua_pushnil (lua_State *L);
+ +

+Pushes a nil value onto the stack. + + + + + +


lua_pushnumber

+[-0, +1, –] +

void lua_pushnumber (lua_State *L, lua_Number n);
+ +

+Pushes a float with value n onto the stack. + + + + + +


lua_pushstring

+[-0, +1, m] +

const char *lua_pushstring (lua_State *L, const char *s);
+ +

+Pushes the zero-terminated string pointed to by s +onto the stack. +Lua makes (or reuses) an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. + + +

+Returns a pointer to the internal copy of the string. + + +

+If s is NULL, pushes nil and returns NULL. + + + + + +


lua_pushthread

+[-0, +1, –] +

int lua_pushthread (lua_State *L);
+ +

+Pushes the thread represented by L onto the stack. +Returns 1 if this thread is the main thread of its state. + + + + + +


lua_pushvalue

+[-0, +1, –] +

void lua_pushvalue (lua_State *L, int index);
+ +

+Pushes a copy of the element at the given index +onto the stack. + + + + + +


lua_pushvfstring

+[-0, +1, m] +

const char *lua_pushvfstring (lua_State *L,
+                              const char *fmt,
+                              va_list argp);
+ +

+Equivalent to lua_pushfstring, except that it receives a va_list +instead of a variable number of arguments. + + + + + +


lua_rawequal

+[-0, +0, –] +

int lua_rawequal (lua_State *L, int index1, int index2);
+ +

+Returns 1 if the two values in indices index1 and +index2 are primitively equal +(that is, without calling the __eq metamethod). +Otherwise returns 0. +Also returns 0 if any of the indices are not valid. + + + + + +


lua_rawget

+[-1, +1, –] +

int lua_rawget (lua_State *L, int index);
+ +

+Similar to lua_gettable, but does a raw access +(i.e., without metamethods). + + + + + +


lua_rawgeti

+[-0, +1, –] +

int lua_rawgeti (lua_State *L, int index, lua_Integer n);
+ +

+Pushes onto the stack the value t[n], +where t is the table at the given index. +The access is raw, +that is, it does not invoke the __index metamethod. + + +

+Returns the type of the pushed value. + + + + + +


lua_rawgetp

+[-0, +1, –] +

int lua_rawgetp (lua_State *L, int index, const void *p);
+ +

+Pushes onto the stack the value t[k], +where t is the table at the given index and +k is the pointer p represented as a light userdata. +The access is raw; +that is, it does not invoke the __index metamethod. + + +

+Returns the type of the pushed value. + + + + + +


lua_rawlen

+[-0, +0, –] +

size_t lua_rawlen (lua_State *L, int index);
+ +

+Returns the raw "length" of the value at the given index: +for strings, this is the string length; +for tables, this is the result of the length operator ('#') +with no metamethods; +for userdata, this is the size of the block of memory allocated +for the userdata; +for other values, it is 0. + + + + + +


lua_rawset

+[-2, +0, m] +

void lua_rawset (lua_State *L, int index);
+ +

+Similar to lua_settable, but does a raw assignment +(i.e., without metamethods). + + + + + +


lua_rawseti

+[-1, +0, m] +

void lua_rawseti (lua_State *L, int index, lua_Integer i);
+ +

+Does the equivalent of t[i] = v, +where t is the table at the given index +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +The assignment is raw, +that is, it does not invoke the __newindex metamethod. + + + + + +


lua_rawsetp

+[-1, +0, m] +

void lua_rawsetp (lua_State *L, int index, const void *p);
+ +

+Does the equivalent of t[p] = v, +where t is the table at the given index, +p is encoded as a light userdata, +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +The assignment is raw, +that is, it does not invoke __newindex metamethod. + + + + + +


lua_Reader

+
typedef const char * (*lua_Reader) (lua_State *L,
+                                    void *data,
+                                    size_t *size);
+ +

+The reader function used by lua_load. +Every time it needs another piece of the chunk, +lua_load calls the reader, +passing along its data parameter. +The reader must return a pointer to a block of memory +with a new piece of the chunk +and set size to the block size. +The block must exist until the reader function is called again. +To signal the end of the chunk, +the reader must return NULL or set size to zero. +The reader function may return pieces of any size greater than zero. + + + + + +


lua_register

+[-0, +0, e] +

void lua_register (lua_State *L, const char *name, lua_CFunction f);
+ +

+Sets the C function f as the new value of global name. +It is defined as a macro: + +

+     #define lua_register(L,n,f) \
+            (lua_pushcfunction(L, f), lua_setglobal(L, n))
+
+ + + + +

lua_remove

+[-1, +0, –] +

void lua_remove (lua_State *L, int index);
+ +

+Removes the element at the given valid index, +shifting down the elements above this index to fill the gap. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_replace

+[-1, +0, –] +

void lua_replace (lua_State *L, int index);
+ +

+Moves the top element into the given valid index +without shifting any element +(therefore replacing the value at that given index), +and then pops the top element. + + + + + +


lua_resume

+[-?, +?, –] +

int lua_resume (lua_State *L, lua_State *from, int nargs);
+ +

+Starts and resumes a coroutine in the given thread L. + + +

+To start a coroutine, +you push onto the thread stack the main function plus any arguments; +then you call lua_resume, +with nargs being the number of arguments. +This call returns when the coroutine suspends or finishes its execution. +When it returns, the stack contains all values passed to lua_yield, +or all values returned by the body function. +lua_resume returns +LUA_YIELD if the coroutine yields, +LUA_OK if the coroutine finishes its execution +without errors, +or an error code in case of errors (see lua_pcall). + + +

+In case of errors, +the stack is not unwound, +so you can use the debug API over it. +The error object is on the top of the stack. + + +

+To resume a coroutine, +you remove any results from the last lua_yield, +put on its stack only the values to +be passed as results from yield, +and then call lua_resume. + + +

+The parameter from represents the coroutine that is resuming L. +If there is no such coroutine, +this parameter can be NULL. + + + + + +


lua_rotate

+[-0, +0, –] +

void lua_rotate (lua_State *L, int idx, int n);
+ +

+Rotates the stack elements between the valid index idx +and the top of the stack. +The elements are rotated n positions in the direction of the top, +for a positive n, +or -n positions in the direction of the bottom, +for a negative n. +The absolute value of n must not be greater than the size +of the slice being rotated. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_setallocf

+[-0, +0, –] +

void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
+ +

+Changes the allocator function of a given state to f +with user data ud. + + + + + +


lua_setfield

+[-1, +0, e] +

void lua_setfield (lua_State *L, int index, const char *k);
+ +

+Does the equivalent to t[k] = v, +where t is the value at the given index +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_setglobal

+[-1, +0, e] +

void lua_setglobal (lua_State *L, const char *name);
+ +

+Pops a value from the stack and +sets it as the new value of global name. + + + + + +


lua_seti

+[-1, +0, e] +

void lua_seti (lua_State *L, int index, lua_Integer n);
+ +

+Does the equivalent to t[n] = v, +where t is the value at the given index +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_setmetatable

+[-1, +0, –] +

void lua_setmetatable (lua_State *L, int index);
+ +

+Pops a table from the stack and +sets it as the new metatable for the value at the given index. + + + + + +


lua_settable

+[-2, +0, e] +

void lua_settable (lua_State *L, int index);
+ +

+Does the equivalent to t[k] = v, +where t is the value at the given index, +v is the value at the top of the stack, +and k is the value just below the top. + + +

+This function pops both the key and the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_settop

+[-?, +?, –] +

void lua_settop (lua_State *L, int index);
+ +

+Accepts any index, or 0, +and sets the stack top to this index. +If the new top is larger than the old one, +then the new elements are filled with nil. +If index is 0, then all stack elements are removed. + + + + + +


lua_setuservalue

+[-1, +0, –] +

void lua_setuservalue (lua_State *L, int index);
+ +

+Pops a value from the stack and sets it as +the new value associated to the full userdata at the given index. + + + + + +


lua_State

+
typedef struct lua_State lua_State;
+ +

+An opaque structure that points to a thread and indirectly +(through the thread) to the whole state of a Lua interpreter. +The Lua library is fully reentrant: +it has no global variables. +All information about a state is accessible through this structure. + + +

+A pointer to this structure must be passed as the first argument to +every function in the library, except to lua_newstate, +which creates a Lua state from scratch. + + + + + +


lua_status

+[-0, +0, –] +

int lua_status (lua_State *L);
+ +

+Returns the status of the thread L. + + +

+The status can be 0 (LUA_OK) for a normal thread, +an error code if the thread finished the execution +of a lua_resume with an error, +or LUA_YIELD if the thread is suspended. + + +

+You can only call functions in threads with status LUA_OK. +You can resume threads with status LUA_OK +(to start a new coroutine) or LUA_YIELD +(to resume a coroutine). + + + + + +


lua_stringtonumber

+[-0, +1, –] +

size_t lua_stringtonumber (lua_State *L, const char *s);
+ +

+Converts the zero-terminated string s to a number, +pushes that number into the stack, +and returns the total size of the string, +that is, its length plus one. +The conversion can result in an integer or a float, +according to the lexical conventions of Lua (see §3.1). +The string may have leading and trailing spaces and a sign. +If the string is not a valid numeral, +returns 0 and pushes nothing. +(Note that the result can be used as a boolean, +true if the conversion succeeds.) + + + + + +


lua_toboolean

+[-0, +0, –] +

int lua_toboolean (lua_State *L, int index);
+ +

+Converts the Lua value at the given index to a C boolean +value (0 or 1). +Like all tests in Lua, +lua_toboolean returns true for any Lua value +different from false and nil; +otherwise it returns false. +(If you want to accept only actual boolean values, +use lua_isboolean to test the value's type.) + + + + + +


lua_tocfunction

+[-0, +0, –] +

lua_CFunction lua_tocfunction (lua_State *L, int index);
+ +

+Converts a value at the given index to a C function. +That value must be a C function; +otherwise, returns NULL. + + + + + +


lua_tointeger

+[-0, +0, –] +

lua_Integer lua_tointeger (lua_State *L, int index);
+ +

+Equivalent to lua_tointegerx with isnum equal to NULL. + + + + + +


lua_tointegerx

+[-0, +0, –] +

lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);
+ +

+Converts the Lua value at the given index +to the signed integral type lua_Integer. +The Lua value must be an integer, +or a number or string convertible to an integer (see §3.4.3); +otherwise, lua_tointegerx returns 0. + + +

+If isnum is not NULL, +its referent is assigned a boolean value that +indicates whether the operation succeeded. + + + + + +


lua_tolstring

+[-0, +0, m] +

const char *lua_tolstring (lua_State *L, int index, size_t *len);
+ +

+Converts the Lua value at the given index to a C string. +If len is not NULL, +it sets *len with the string length. +The Lua value must be a string or a number; +otherwise, the function returns NULL. +If the value is a number, +then lua_tolstring also +changes the actual value in the stack to a string. +(This change confuses lua_next +when lua_tolstring is applied to keys during a table traversal.) + + +

+lua_tolstring returns a pointer +to a string inside the Lua state. +This string always has a zero ('\0') +after its last character (as in C), +but can contain other zeros in its body. + + +

+Because Lua has garbage collection, +there is no guarantee that the pointer returned by lua_tolstring +will be valid after the corresponding Lua value is removed from the stack. + + + + + +


lua_tonumber

+[-0, +0, –] +

lua_Number lua_tonumber (lua_State *L, int index);
+ +

+Equivalent to lua_tonumberx with isnum equal to NULL. + + + + + +


lua_tonumberx

+[-0, +0, –] +

lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);
+ +

+Converts the Lua value at the given index +to the C type lua_Number (see lua_Number). +The Lua value must be a number or a string convertible to a number +(see §3.4.3); +otherwise, lua_tonumberx returns 0. + + +

+If isnum is not NULL, +its referent is assigned a boolean value that +indicates whether the operation succeeded. + + + + + +


lua_topointer

+[-0, +0, –] +

const void *lua_topointer (lua_State *L, int index);
+ +

+Converts the value at the given index to a generic +C pointer (void*). +The value can be a userdata, a table, a thread, or a function; +otherwise, lua_topointer returns NULL. +Different objects will give different pointers. +There is no way to convert the pointer back to its original value. + + +

+Typically this function is used only for hashing and debug information. + + + + + +


lua_tostring

+[-0, +0, m] +

const char *lua_tostring (lua_State *L, int index);
+ +

+Equivalent to lua_tolstring with len equal to NULL. + + + + + +


lua_tothread

+[-0, +0, –] +

lua_State *lua_tothread (lua_State *L, int index);
+ +

+Converts the value at the given index to a Lua thread +(represented as lua_State*). +This value must be a thread; +otherwise, the function returns NULL. + + + + + +


lua_touserdata

+[-0, +0, –] +

void *lua_touserdata (lua_State *L, int index);
+ +

+If the value at the given index is a full userdata, +returns its block address. +If the value is a light userdata, +returns its pointer. +Otherwise, returns NULL. + + + + + +


lua_type

+[-0, +0, –] +

int lua_type (lua_State *L, int index);
+ +

+Returns the type of the value in the given valid index, +or LUA_TNONE for a non-valid (but acceptable) index. +The types returned by lua_type are coded by the following constants +defined in lua.h: +LUA_TNIL (0), +LUA_TNUMBER, +LUA_TBOOLEAN, +LUA_TSTRING, +LUA_TTABLE, +LUA_TFUNCTION, +LUA_TUSERDATA, +LUA_TTHREAD, +and +LUA_TLIGHTUSERDATA. + + + + + +


lua_typename

+[-0, +0, –] +

const char *lua_typename (lua_State *L, int tp);
+ +

+Returns the name of the type encoded by the value tp, +which must be one the values returned by lua_type. + + + + + +


lua_Unsigned

+
typedef ... lua_Unsigned;
+ +

+The unsigned version of lua_Integer. + + + + + +


lua_upvalueindex

+[-0, +0, –] +

int lua_upvalueindex (int i);
+ +

+Returns the pseudo-index that represents the i-th upvalue of +the running function (see §4.4). + + + + + +


lua_version

+[-0, +0, –] +

const lua_Number *lua_version (lua_State *L);
+ +

+Returns the address of the version number +(a C static variable) +stored in the Lua core. +When called with a valid lua_State, +returns the address of the version used to create that state. +When called with NULL, +returns the address of the version running the call. + + + + + +


lua_Writer

+
typedef int (*lua_Writer) (lua_State *L,
+                           const void* p,
+                           size_t sz,
+                           void* ud);
+ +

+The type of the writer function used by lua_dump. +Every time it produces another piece of chunk, +lua_dump calls the writer, +passing along the buffer to be written (p), +its size (sz), +and the data parameter supplied to lua_dump. + + +

+The writer returns an error code: +0 means no errors; +any other value means an error and stops lua_dump from +calling the writer again. + + + + + +


lua_xmove

+[-?, +?, –] +

void lua_xmove (lua_State *from, lua_State *to, int n);
+ +

+Exchange values between different threads of the same state. + + +

+This function pops n values from the stack from, +and pushes them onto the stack to. + + + + + +


lua_yield

+[-?, +?, e] +

int lua_yield (lua_State *L, int nresults);
+ +

+This function is equivalent to lua_yieldk, +but it has no continuation (see §4.7). +Therefore, when the thread resumes, +it continues the function that called +the function calling lua_yield. + + + + + +


lua_yieldk

+[-?, +?, e] +

int lua_yieldk (lua_State *L,
+                int nresults,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+Yields a coroutine (thread). + + +

+When a C function calls lua_yieldk, +the running coroutine suspends its execution, +and the call to lua_resume that started this coroutine returns. +The parameter nresults is the number of values from the stack +that will be passed as results to lua_resume. + + +

+When the coroutine is resumed again, +Lua calls the given continuation function k to continue +the execution of the C function that yielded (see §4.7). +This continuation function receives the same stack +from the previous function, +with the n results removed and +replaced by the arguments passed to lua_resume. +Moreover, +the continuation function receives the value ctx +that was passed to lua_yieldk. + + +

+Usually, this function does not return; +when the coroutine eventually resumes, +it continues executing the continuation function. +However, there is one special case, +which is when this function is called +from inside a line or a count hook (see §4.9). +In that case, lua_yieldk should be called with no continuation +(probably in the form of lua_yield) and no results, +and the hook should return immediately after the call. +Lua will yield and, +when the coroutine resumes again, +it will continue the normal execution +of the (Lua) function that triggered the hook. + + +

+This function can raise an error if it is called from a thread +with a pending C call with no continuation function, +or it is called from a thread that is not running inside a resume +(e.g., the main thread). + + + + + + + +

4.9 – The Debug Interface

+ +

+Lua has no built-in debugging facilities. +Instead, it offers a special interface +by means of functions and hooks. +This interface allows the construction of different +kinds of debuggers, profilers, and other tools +that need "inside information" from the interpreter. + + + +


lua_Debug

+
typedef struct lua_Debug {
+  int event;
+  const char *name;           /* (n) */
+  const char *namewhat;       /* (n) */
+  const char *what;           /* (S) */
+  const char *source;         /* (S) */
+  int currentline;            /* (l) */
+  int linedefined;            /* (S) */
+  int lastlinedefined;        /* (S) */
+  unsigned char nups;         /* (u) number of upvalues */
+  unsigned char nparams;      /* (u) number of parameters */
+  char isvararg;              /* (u) */
+  char istailcall;            /* (t) */
+  char short_src[LUA_IDSIZE]; /* (S) */
+  /* private part */
+  other fields
+} lua_Debug;
+ +

+A structure used to carry different pieces of +information about a function or an activation record. +lua_getstack fills only the private part +of this structure, for later use. +To fill the other fields of lua_Debug with useful information, +call lua_getinfo. + + +

+The fields of lua_Debug have the following meaning: + +

    + +
  • source: +the name of the chunk that created the function. +If source starts with a '@', +it means that the function was defined in a file where +the file name follows the '@'. +If source starts with a '=', +the remainder of its contents describe the source in a user-dependent manner. +Otherwise, +the function was defined in a string where +source is that string. +
  • + +
  • short_src: +a "printable" version of source, to be used in error messages. +
  • + +
  • linedefined: +the line number where the definition of the function starts. +
  • + +
  • lastlinedefined: +the line number where the definition of the function ends. +
  • + +
  • what: +the string "Lua" if the function is a Lua function, +"C" if it is a C function, +"main" if it is the main part of a chunk. +
  • + +
  • currentline: +the current line where the given function is executing. +When no line information is available, +currentline is set to -1. +
  • + +
  • name: +a reasonable name for the given function. +Because functions in Lua are first-class values, +they do not have a fixed name: +some functions can be the value of multiple global variables, +while others can be stored only in a table field. +The lua_getinfo function checks how the function was +called to find a suitable name. +If it cannot find a name, +then name is set to NULL. +
  • + +
  • namewhat: +explains the name field. +The value of namewhat can be +"global", "local", "method", +"field", "upvalue", or "" (the empty string), +according to how the function was called. +(Lua uses the empty string when no other option seems to apply.) +
  • + +
  • istailcall: +true if this function invocation was called by a tail call. +In this case, the caller of this level is not in the stack. +
  • + +
  • nups: +the number of upvalues of the function. +
  • + +
  • nparams: +the number of fixed parameters of the function +(always 0 for C functions). +
  • + +
  • isvararg: +true if the function is a vararg function +(always true for C functions). +
  • + +
+ + + + +

lua_gethook

+[-0, +0, –] +

lua_Hook lua_gethook (lua_State *L);
+ +

+Returns the current hook function. + + + + + +


lua_gethookcount

+[-0, +0, –] +

int lua_gethookcount (lua_State *L);
+ +

+Returns the current hook count. + + + + + +


lua_gethookmask

+[-0, +0, –] +

int lua_gethookmask (lua_State *L);
+ +

+Returns the current hook mask. + + + + + +


lua_getinfo

+[-(0|1), +(0|1|2), e] +

int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
+ +

+Gets information about a specific function or function invocation. + + +

+To get information about a function invocation, +the parameter ar must be a valid activation record that was +filled by a previous call to lua_getstack or +given as argument to a hook (see lua_Hook). + + +

+To get information about a function you push it onto the stack +and start the what string with the character '>'. +(In that case, +lua_getinfo pops the function from the top of the stack.) +For instance, to know in which line a function f was defined, +you can write the following code: + +

+     lua_Debug ar;
+     lua_getglobal(L, "f");  /* get global 'f' */
+     lua_getinfo(L, ">S", &ar);
+     printf("%d\n", ar.linedefined);
+
+ +

+Each character in the string what +selects some fields of the structure ar to be filled or +a value to be pushed on the stack: + +

    + +
  • 'n': fills in the field name and namewhat; +
  • + +
  • 'S': +fills in the fields source, short_src, +linedefined, lastlinedefined, and what; +
  • + +
  • 'l': fills in the field currentline; +
  • + +
  • 't': fills in the field istailcall; +
  • + +
  • 'u': fills in the fields +nups, nparams, and isvararg; +
  • + +
  • 'f': +pushes onto the stack the function that is +running at the given level; +
  • + +
  • 'L': +pushes onto the stack a table whose indices are the +numbers of the lines that are valid on the function. +(A valid line is a line with some associated code, +that is, a line where you can put a break point. +Non-valid lines include empty lines and comments.) + + +

    +If this option is given together with option 'f', +its table is pushed after the function. +

  • + +
+ +

+This function returns 0 on error +(for instance, an invalid option in what). + + + + + +


lua_getlocal

+[-0, +(0|1), –] +

const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+ +

+Gets information about a local variable of +a given activation record or a given function. + + +

+In the first case, +the parameter ar must be a valid activation record that was +filled by a previous call to lua_getstack or +given as argument to a hook (see lua_Hook). +The index n selects which local variable to inspect; +see debug.getlocal for details about variable indices +and names. + + +

+lua_getlocal pushes the variable's value onto the stack +and returns its name. + + +

+In the second case, ar must be NULL and the function +to be inspected must be at the top of the stack. +In this case, only parameters of Lua functions are visible +(as there is no information about what variables are active) +and no values are pushed onto the stack. + + +

+Returns NULL (and pushes nothing) +when the index is greater than +the number of active local variables. + + + + + +


lua_getstack

+[-0, +0, –] +

int lua_getstack (lua_State *L, int level, lua_Debug *ar);
+ +

+Gets information about the interpreter runtime stack. + + +

+This function fills parts of a lua_Debug structure with +an identification of the activation record +of the function executing at a given level. +Level 0 is the current running function, +whereas level n+1 is the function that has called level n +(except for tail calls, which do not count on the stack). +When there are no errors, lua_getstack returns 1; +when called with a level greater than the stack depth, +it returns 0. + + + + + +


lua_getupvalue

+[-0, +(0|1), –] +

const char *lua_getupvalue (lua_State *L, int funcindex, int n);
+ +

+Gets information about the n-th upvalue +of the closure at index funcindex. +It pushes the upvalue's value onto the stack +and returns its name. +Returns NULL (and pushes nothing) +when the index n is greater than the number of upvalues. + + +

+For C functions, this function uses the empty string "" +as a name for all upvalues. +(For Lua functions, +upvalues are the external local variables that the function uses, +and that are consequently included in its closure.) + + +

+Upvalues have no particular order, +as they are active through the whole function. +They are numbered in an arbitrary order. + + + + + +


lua_Hook

+
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+ +

+Type for debugging hook functions. + + +

+Whenever a hook is called, its ar argument has its field +event set to the specific event that triggered the hook. +Lua identifies these events with the following constants: +LUA_HOOKCALL, LUA_HOOKRET, +LUA_HOOKTAILCALL, LUA_HOOKLINE, +and LUA_HOOKCOUNT. +Moreover, for line events, the field currentline is also set. +To get the value of any other field in ar, +the hook must call lua_getinfo. + + +

+For call events, event can be LUA_HOOKCALL, +the normal value, or LUA_HOOKTAILCALL, for a tail call; +in this case, there will be no corresponding return event. + + +

+While Lua is running a hook, it disables other calls to hooks. +Therefore, if a hook calls back Lua to execute a function or a chunk, +this execution occurs without any calls to hooks. + + +

+Hook functions cannot have continuations, +that is, they cannot call lua_yieldk, +lua_pcallk, or lua_callk with a non-null k. + + +

+Hook functions can yield under the following conditions: +Only count and line events can yield; +to yield, a hook function must finish its execution +calling lua_yield with nresults equal to zero +(that is, with no values). + + + + + +


lua_sethook

+[-0, +0, –] +

void lua_sethook (lua_State *L, lua_Hook f, int mask, int count);
+ +

+Sets the debugging hook function. + + +

+Argument f is the hook function. +mask specifies on which events the hook will be called: +it is formed by a bitwise OR of the constants +LUA_MASKCALL, +LUA_MASKRET, +LUA_MASKLINE, +and LUA_MASKCOUNT. +The count argument is only meaningful when the mask +includes LUA_MASKCOUNT. +For each event, the hook is called as explained below: + +

    + +
  • The call hook: is called when the interpreter calls a function. +The hook is called just after Lua enters the new function, +before the function gets its arguments. +
  • + +
  • The return hook: is called when the interpreter returns from a function. +The hook is called just before Lua leaves the function. +There is no standard way to access the values +to be returned by the function. +
  • + +
  • The line hook: is called when the interpreter is about to +start the execution of a new line of code, +or when it jumps back in the code (even to the same line). +(This event only happens while Lua is executing a Lua function.) +
  • + +
  • The count hook: is called after the interpreter executes every +count instructions. +(This event only happens while Lua is executing a Lua function.) +
  • + +
+ +

+A hook is disabled by setting mask to zero. + + + + + +


lua_setlocal

+[-(0|1), +0, –] +

const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+ +

+Sets the value of a local variable of a given activation record. +It assigns the value at the top of the stack +to the variable and returns its name. +It also pops the value from the stack. + + +

+Returns NULL (and pops nothing) +when the index is greater than +the number of active local variables. + + +

+Parameters ar and n are as in function lua_getlocal. + + + + + +


lua_setupvalue

+[-(0|1), +0, –] +

const char *lua_setupvalue (lua_State *L, int funcindex, int n);
+ +

+Sets the value of a closure's upvalue. +It assigns the value at the top of the stack +to the upvalue and returns its name. +It also pops the value from the stack. + + +

+Returns NULL (and pops nothing) +when the index n is greater than the number of upvalues. + + +

+Parameters funcindex and n are as in function lua_getupvalue. + + + + + +


lua_upvalueid

+[-0, +0, –] +

void *lua_upvalueid (lua_State *L, int funcindex, int n);
+ +

+Returns a unique identifier for the upvalue numbered n +from the closure at index funcindex. + + +

+These unique identifiers allow a program to check whether different +closures share upvalues. +Lua closures that share an upvalue +(that is, that access a same external local variable) +will return identical ids for those upvalue indices. + + +

+Parameters funcindex and n are as in function lua_getupvalue, +but n cannot be greater than the number of upvalues. + + + + + +


lua_upvaluejoin

+[-0, +0, –] +

void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
+                                    int funcindex2, int n2);
+ +

+Make the n1-th upvalue of the Lua closure at index funcindex1 +refer to the n2-th upvalue of the Lua closure at index funcindex2. + + + + + + + +

5 – The Auxiliary Library

+ +

+ +The auxiliary library provides several convenient functions +to interface C with Lua. +While the basic API provides the primitive functions for all +interactions between C and Lua, +the auxiliary library provides higher-level functions for some +common tasks. + + +

+All functions and types from the auxiliary library +are defined in header file lauxlib.h and +have a prefix luaL_. + + +

+All functions in the auxiliary library are built on +top of the basic API, +and so they provide nothing that cannot be done with that API. +Nevertheless, the use of the auxiliary library ensures +more consistency to your code. + + +

+Several functions in the auxiliary library use internally some +extra stack slots. +When a function in the auxiliary library uses less than five slots, +it does not check the stack size; +it simply assumes that there are enough slots. + + +

+Several functions in the auxiliary library are used to +check C function arguments. +Because the error message is formatted for arguments +(e.g., "bad argument #1"), +you should not use these functions for other stack values. + + +

+Functions called luaL_check* +always raise an error if the check is not satisfied. + + + +

5.1 – Functions and Types

+ +

+Here we list all functions and types from the auxiliary library +in alphabetical order. + + + +


luaL_addchar

+[-?, +?, m] +

void luaL_addchar (luaL_Buffer *B, char c);
+ +

+Adds the byte c to the buffer B +(see luaL_Buffer). + + + + + +


luaL_addlstring

+[-?, +?, m] +

void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
+ +

+Adds the string pointed to by s with length l to +the buffer B +(see luaL_Buffer). +The string can contain embedded zeros. + + + + + +


luaL_addsize

+[-?, +?, –] +

void luaL_addsize (luaL_Buffer *B, size_t n);
+ +

+Adds to the buffer B (see luaL_Buffer) +a string of length n previously copied to the +buffer area (see luaL_prepbuffer). + + + + + +


luaL_addstring

+[-?, +?, m] +

void luaL_addstring (luaL_Buffer *B, const char *s);
+ +

+Adds the zero-terminated string pointed to by s +to the buffer B +(see luaL_Buffer). + + + + + +


luaL_addvalue

+[-1, +?, m] +

void luaL_addvalue (luaL_Buffer *B);
+ +

+Adds the value at the top of the stack +to the buffer B +(see luaL_Buffer). +Pops the value. + + +

+This is the only function on string buffers that can (and must) +be called with an extra element on the stack, +which is the value to be added to the buffer. + + + + + +


luaL_argcheck

+[-0, +0, v] +

void luaL_argcheck (lua_State *L,
+                    int cond,
+                    int arg,
+                    const char *extramsg);
+ +

+Checks whether cond is true. +If it is not, raises an error with a standard message (see luaL_argerror). + + + + + +


luaL_argerror

+[-0, +0, v] +

int luaL_argerror (lua_State *L, int arg, const char *extramsg);
+ +

+Raises an error reporting a problem with argument arg +of the C function that called it, +using a standard message +that includes extramsg as a comment: + +

+     bad argument #arg to 'funcname' (extramsg)
+

+This function never returns. + + + + + +


luaL_Buffer

+
typedef struct luaL_Buffer luaL_Buffer;
+ +

+Type for a string buffer. + + +

+A string buffer allows C code to build Lua strings piecemeal. +Its pattern of use is as follows: + +

    + +
  • First declare a variable b of type luaL_Buffer.
  • + +
  • Then initialize it with a call luaL_buffinit(L, &b).
  • + +
  • +Then add string pieces to the buffer calling any of +the luaL_add* functions. +
  • + +
  • +Finish by calling luaL_pushresult(&b). +This call leaves the final string on the top of the stack. +
  • + +
+ +

+If you know beforehand the total size of the resulting string, +you can use the buffer like this: + +

    + +
  • First declare a variable b of type luaL_Buffer.
  • + +
  • Then initialize it and preallocate a space of +size sz with a call luaL_buffinitsize(L, &b, sz).
  • + +
  • Then copy the string into that space.
  • + +
  • +Finish by calling luaL_pushresultsize(&b, sz), +where sz is the total size of the resulting string +copied into that space. +
  • + +
+ +

+During its normal operation, +a string buffer uses a variable number of stack slots. +So, while using a buffer, you cannot assume that you know where +the top of the stack is. +You can use the stack between successive calls to buffer operations +as long as that use is balanced; +that is, +when you call a buffer operation, +the stack is at the same level +it was immediately after the previous buffer operation. +(The only exception to this rule is luaL_addvalue.) +After calling luaL_pushresult the stack is back to its +level when the buffer was initialized, +plus the final string on its top. + + + + + +


luaL_buffinit

+[-0, +0, –] +

void luaL_buffinit (lua_State *L, luaL_Buffer *B);
+ +

+Initializes a buffer B. +This function does not allocate any space; +the buffer must be declared as a variable +(see luaL_Buffer). + + + + + +


luaL_buffinitsize

+[-?, +?, m] +

char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);
+ +

+Equivalent to the sequence +luaL_buffinit, luaL_prepbuffsize. + + + + + +


luaL_callmeta

+[-0, +(0|1), e] +

int luaL_callmeta (lua_State *L, int obj, const char *e);
+ +

+Calls a metamethod. + + +

+If the object at index obj has a metatable and this +metatable has a field e, +this function calls this field passing the object as its only argument. +In this case this function returns true and pushes onto the +stack the value returned by the call. +If there is no metatable or no metamethod, +this function returns false (without pushing any value on the stack). + + + + + +


luaL_checkany

+[-0, +0, v] +

void luaL_checkany (lua_State *L, int arg);
+ +

+Checks whether the function has an argument +of any type (including nil) at position arg. + + + + + +


luaL_checkinteger

+[-0, +0, v] +

lua_Integer luaL_checkinteger (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is an integer +(or can be converted to an integer) +and returns this integer cast to a lua_Integer. + + + + + +


luaL_checklstring

+[-0, +0, v] +

const char *luaL_checklstring (lua_State *L, int arg, size_t *l);
+ +

+Checks whether the function argument arg is a string +and returns this string; +if l is not NULL fills *l +with the string's length. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_checknumber

+[-0, +0, v] +

lua_Number luaL_checknumber (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is a number +and returns this number. + + + + + +


luaL_checkoption

+[-0, +0, v] +

int luaL_checkoption (lua_State *L,
+                      int arg,
+                      const char *def,
+                      const char *const lst[]);
+ +

+Checks whether the function argument arg is a string and +searches for this string in the array lst +(which must be NULL-terminated). +Returns the index in the array where the string was found. +Raises an error if the argument is not a string or +if the string cannot be found. + + +

+If def is not NULL, +the function uses def as a default value when +there is no argument arg or when this argument is nil. + + +

+This is a useful function for mapping strings to C enums. +(The usual convention in Lua libraries is +to use strings instead of numbers to select options.) + + + + + +


luaL_checkstack

+[-0, +0, v] +

void luaL_checkstack (lua_State *L, int sz, const char *msg);
+ +

+Grows the stack size to top + sz elements, +raising an error if the stack cannot grow to that size. +msg is an additional text to go into the error message +(or NULL for no additional text). + + + + + +


luaL_checkstring

+[-0, +0, v] +

const char *luaL_checkstring (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is a string +and returns this string. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_checktype

+[-0, +0, v] +

void luaL_checktype (lua_State *L, int arg, int t);
+ +

+Checks whether the function argument arg has type t. +See lua_type for the encoding of types for t. + + + + + +


luaL_checkudata

+[-0, +0, v] +

void *luaL_checkudata (lua_State *L, int arg, const char *tname);
+ +

+Checks whether the function argument arg is a userdata +of the type tname (see luaL_newmetatable) and +returns the userdata address (see lua_touserdata). + + + + + +


luaL_checkversion

+[-0, +0, v] +

void luaL_checkversion (lua_State *L);
+ +

+Checks whether the core running the call, +the core that created the Lua state, +and the code making the call are all using the same version of Lua. +Also checks whether the core running the call +and the core that created the Lua state +are using the same address space. + + + + + +


luaL_dofile

+[-0, +?, e] +

int luaL_dofile (lua_State *L, const char *filename);
+ +

+Loads and runs the given file. +It is defined as the following macro: + +

+     (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
+

+It returns false if there are no errors +or true in case of errors. + + + + + +


luaL_dostring

+[-0, +?, –] +

int luaL_dostring (lua_State *L, const char *str);
+ +

+Loads and runs the given string. +It is defined as the following macro: + +

+     (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
+

+It returns false if there are no errors +or true in case of errors. + + + + + +


luaL_error

+[-0, +0, v] +

int luaL_error (lua_State *L, const char *fmt, ...);
+ +

+Raises an error. +The error message format is given by fmt +plus any extra arguments, +following the same rules of lua_pushfstring. +It also adds at the beginning of the message the file name and +the line number where the error occurred, +if this information is available. + + +

+This function never returns, +but it is an idiom to use it in C functions +as return luaL_error(args). + + + + + +


luaL_execresult

+[-0, +3, m] +

int luaL_execresult (lua_State *L, int stat);
+ +

+This function produces the return values for +process-related functions in the standard library +(os.execute and io.close). + + + + + +


luaL_fileresult

+[-0, +(1|3), m] +

int luaL_fileresult (lua_State *L, int stat, const char *fname);
+ +

+This function produces the return values for +file-related functions in the standard library +(io.open, os.rename, file:seek, etc.). + + + + + +


luaL_getmetafield

+[-0, +(0|1), m] +

int luaL_getmetafield (lua_State *L, int obj, const char *e);
+ +

+Pushes onto the stack the field e from the metatable +of the object at index obj and returns the type of pushed value. +If the object does not have a metatable, +or if the metatable does not have this field, +pushes nothing and returns LUA_TNIL. + + + + + +


luaL_getmetatable

+[-0, +1, m] +

int luaL_getmetatable (lua_State *L, const char *tname);
+ +

+Pushes onto the stack the metatable associated with name tname +in the registry (see luaL_newmetatable) +(nil if there is no metatable associated with that name). +Returns the type of the pushed value. + + + + + +


luaL_getsubtable

+[-0, +1, e] +

int luaL_getsubtable (lua_State *L, int idx, const char *fname);
+ +

+Ensures that the value t[fname], +where t is the value at index idx, +is a table, +and pushes that table onto the stack. +Returns true if it finds a previous table there +and false if it creates a new table. + + + + + +


luaL_gsub

+[-0, +1, m] +

const char *luaL_gsub (lua_State *L,
+                       const char *s,
+                       const char *p,
+                       const char *r);
+ +

+Creates a copy of string s by replacing +any occurrence of the string p +with the string r. +Pushes the resulting string on the stack and returns it. + + + + + +


luaL_len

+[-0, +0, e] +

lua_Integer luaL_len (lua_State *L, int index);
+ +

+Returns the "length" of the value at the given index +as a number; +it is equivalent to the '#' operator in Lua (see §3.4.7). +Raises an error if the result of the operation is not an integer. +(This case only can happen through metamethods.) + + + + + +


luaL_loadbuffer

+[-0, +1, –] +

int luaL_loadbuffer (lua_State *L,
+                     const char *buff,
+                     size_t sz,
+                     const char *name);
+ +

+Equivalent to luaL_loadbufferx with mode equal to NULL. + + + + + +


luaL_loadbufferx

+[-0, +1, –] +

int luaL_loadbufferx (lua_State *L,
+                      const char *buff,
+                      size_t sz,
+                      const char *name,
+                      const char *mode);
+ +

+Loads a buffer as a Lua chunk. +This function uses lua_load to load the chunk in the +buffer pointed to by buff with size sz. + + +

+This function returns the same results as lua_load. +name is the chunk name, +used for debug information and error messages. +The string mode works as in function lua_load. + + + + + +


luaL_loadfile

+[-0, +1, m] +

int luaL_loadfile (lua_State *L, const char *filename);
+ +

+Equivalent to luaL_loadfilex with mode equal to NULL. + + + + + +


luaL_loadfilex

+[-0, +1, m] +

int luaL_loadfilex (lua_State *L, const char *filename,
+                                            const char *mode);
+ +

+Loads a file as a Lua chunk. +This function uses lua_load to load the chunk in the file +named filename. +If filename is NULL, +then it loads from the standard input. +The first line in the file is ignored if it starts with a #. + + +

+The string mode works as in function lua_load. + + +

+This function returns the same results as lua_load, +but it has an extra error code LUA_ERRFILE +for file-related errors +(e.g., it cannot open or read the file). + + +

+As lua_load, this function only loads the chunk; +it does not run it. + + + + + +


luaL_loadstring

+[-0, +1, –] +

int luaL_loadstring (lua_State *L, const char *s);
+ +

+Loads a string as a Lua chunk. +This function uses lua_load to load the chunk in +the zero-terminated string s. + + +

+This function returns the same results as lua_load. + + +

+Also as lua_load, this function only loads the chunk; +it does not run it. + + + + + +


luaL_newlib

+[-0, +1, m] +

void luaL_newlib (lua_State *L, const luaL_Reg l[]);
+ +

+Creates a new table and registers there +the functions in list l. + + +

+It is implemented as the following macro: + +

+     (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
+

+The array l must be the actual array, +not a pointer to it. + + + + + +


luaL_newlibtable

+[-0, +1, m] +

void luaL_newlibtable (lua_State *L, const luaL_Reg l[]);
+ +

+Creates a new table with a size optimized +to store all entries in the array l +(but does not actually store them). +It is intended to be used in conjunction with luaL_setfuncs +(see luaL_newlib). + + +

+It is implemented as a macro. +The array l must be the actual array, +not a pointer to it. + + + + + +


luaL_newmetatable

+[-0, +1, m] +

int luaL_newmetatable (lua_State *L, const char *tname);
+ +

+If the registry already has the key tname, +returns 0. +Otherwise, +creates a new table to be used as a metatable for userdata, +adds to this new table the pair __name = tname, +adds to the registry the pair [tname] = new table, +and returns 1. +(The entry __name is used by some error-reporting functions.) + + +

+In both cases pushes onto the stack the final value associated +with tname in the registry. + + + + + +


luaL_newstate

+[-0, +0, –] +

lua_State *luaL_newstate (void);
+ +

+Creates a new Lua state. +It calls lua_newstate with an +allocator based on the standard C realloc function +and then sets a panic function (see §4.6) that prints +an error message to the standard error output in case of fatal +errors. + + +

+Returns the new state, +or NULL if there is a memory allocation error. + + + + + +


luaL_openlibs

+[-0, +0, e] +

void luaL_openlibs (lua_State *L);
+ +

+Opens all standard Lua libraries into the given state. + + + + + +


luaL_opt

+[-0, +0, e] +

T luaL_opt (L, func, arg, dflt);
+ +

+This macro is defined as follows: + +

+     (lua_isnoneornil(L,(arg)) ? (dflt) : func(L,(arg)))
+

+In words, if the argument arg is nil or absent, +the macro results in the default dflt. +Otherwise, it results in the result of calling func +with the state L and the argument index arg as +parameters. +Note that it evaluates the expression dflt only if needed. + + + + + +


luaL_optinteger

+[-0, +0, v] +

lua_Integer luaL_optinteger (lua_State *L,
+                             int arg,
+                             lua_Integer d);
+ +

+If the function argument arg is an integer +(or convertible to an integer), +returns this integer. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_optlstring

+[-0, +0, v] +

const char *luaL_optlstring (lua_State *L,
+                             int arg,
+                             const char *d,
+                             size_t *l);
+ +

+If the function argument arg is a string, +returns this string. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + +

+If l is not NULL, +fills the position *l with the result's length. +If the result is NULL +(only possible when returning d and d == NULL), +its length is considered zero. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_optnumber

+[-0, +0, v] +

lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number d);
+ +

+If the function argument arg is a number, +returns this number. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_optstring

+[-0, +0, v] +

const char *luaL_optstring (lua_State *L,
+                            int arg,
+                            const char *d);
+ +

+If the function argument arg is a string, +returns this string. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_prepbuffer

+[-?, +?, m] +

char *luaL_prepbuffer (luaL_Buffer *B);
+ +

+Equivalent to luaL_prepbuffsize +with the predefined size LUAL_BUFFERSIZE. + + + + + +


luaL_prepbuffsize

+[-?, +?, m] +

char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);
+ +

+Returns an address to a space of size sz +where you can copy a string to be added to buffer B +(see luaL_Buffer). +After copying the string into this space you must call +luaL_addsize with the size of the string to actually add +it to the buffer. + + + + + +


luaL_pushresult

+[-?, +1, m] +

void luaL_pushresult (luaL_Buffer *B);
+ +

+Finishes the use of buffer B leaving the final string on +the top of the stack. + + + + + +


luaL_pushresultsize

+[-?, +1, m] +

void luaL_pushresultsize (luaL_Buffer *B, size_t sz);
+ +

+Equivalent to the sequence luaL_addsize, luaL_pushresult. + + + + + +


luaL_ref

+[-1, +0, m] +

int luaL_ref (lua_State *L, int t);
+ +

+Creates and returns a reference, +in the table at index t, +for the object at the top of the stack (and pops the object). + + +

+A reference is a unique integer key. +As long as you do not manually add integer keys into table t, +luaL_ref ensures the uniqueness of the key it returns. +You can retrieve an object referred by reference r +by calling lua_rawgeti(L, t, r). +Function luaL_unref frees a reference and its associated object. + + +

+If the object at the top of the stack is nil, +luaL_ref returns the constant LUA_REFNIL. +The constant LUA_NOREF is guaranteed to be different +from any reference returned by luaL_ref. + + + + + +


luaL_Reg

+
typedef struct luaL_Reg {
+  const char *name;
+  lua_CFunction func;
+} luaL_Reg;
+ +

+Type for arrays of functions to be registered by +luaL_setfuncs. +name is the function name and func is a pointer to +the function. +Any array of luaL_Reg must end with a sentinel entry +in which both name and func are NULL. + + + + + +


luaL_requiref

+[-0, +1, e] +

void luaL_requiref (lua_State *L, const char *modname,
+                    lua_CFunction openf, int glb);
+ +

+If modname is not already present in package.loaded, +calls function openf with string modname as an argument +and sets the call result in package.loaded[modname], +as if that function has been called through require. + + +

+If glb is true, +also stores the module into global modname. + + +

+Leaves a copy of the module on the stack. + + + + + +


luaL_setfuncs

+[-nup, +0, m] +

void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
+ +

+Registers all functions in the array l +(see luaL_Reg) into the table on the top of the stack +(below optional upvalues, see next). + + +

+When nup is not zero, +all functions are created sharing nup upvalues, +which must be previously pushed on the stack +on top of the library table. +These values are popped from the stack after the registration. + + + + + +


luaL_setmetatable

+[-0, +0, –] +

void luaL_setmetatable (lua_State *L, const char *tname);
+ +

+Sets the metatable of the object at the top of the stack +as the metatable associated with name tname +in the registry (see luaL_newmetatable). + + + + + +


luaL_Stream

+
typedef struct luaL_Stream {
+  FILE *f;
+  lua_CFunction closef;
+} luaL_Stream;
+ +

+The standard representation for file handles, +which is used by the standard I/O library. + + +

+A file handle is implemented as a full userdata, +with a metatable called LUA_FILEHANDLE +(where LUA_FILEHANDLE is a macro with the actual metatable's name). +The metatable is created by the I/O library +(see luaL_newmetatable). + + +

+This userdata must start with the structure luaL_Stream; +it can contain other data after this initial structure. +Field f points to the corresponding C stream +(or it can be NULL to indicate an incompletely created handle). +Field closef points to a Lua function +that will be called to close the stream +when the handle is closed or collected; +this function receives the file handle as its sole argument and +must return either true (in case of success) +or nil plus an error message (in case of error). +Once Lua calls this field, +it changes the field value to NULL +to signal that the handle is closed. + + + + + +


luaL_testudata

+[-0, +0, m] +

void *luaL_testudata (lua_State *L, int arg, const char *tname);
+ +

+This function works like luaL_checkudata, +except that, when the test fails, +it returns NULL instead of raising an error. + + + + + +


luaL_tolstring

+[-0, +1, e] +

const char *luaL_tolstring (lua_State *L, int idx, size_t *len);
+ +

+Converts any Lua value at the given index to a C string +in a reasonable format. +The resulting string is pushed onto the stack and also +returned by the function. +If len is not NULL, +the function also sets *len with the string length. + + +

+If the value has a metatable with a __tostring field, +then luaL_tolstring calls the corresponding metamethod +with the value as argument, +and uses the result of the call as its result. + + + + + +


luaL_traceback

+[-0, +1, m] +

void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
+                     int level);
+ +

+Creates and pushes a traceback of the stack L1. +If msg is not NULL it is appended +at the beginning of the traceback. +The level parameter tells at which level +to start the traceback. + + + + + +


luaL_typename

+[-0, +0, –] +

const char *luaL_typename (lua_State *L, int index);
+ +

+Returns the name of the type of the value at the given index. + + + + + +


luaL_unref

+[-0, +0, –] +

void luaL_unref (lua_State *L, int t, int ref);
+ +

+Releases reference ref from the table at index t +(see luaL_ref). +The entry is removed from the table, +so that the referred object can be collected. +The reference ref is also freed to be used again. + + +

+If ref is LUA_NOREF or LUA_REFNIL, +luaL_unref does nothing. + + + + + +


luaL_where

+[-0, +1, m] +

void luaL_where (lua_State *L, int lvl);
+ +

+Pushes onto the stack a string identifying the current position +of the control at level lvl in the call stack. +Typically this string has the following format: + +

+     chunkname:currentline:
+

+Level 0 is the running function, +level 1 is the function that called the running function, +etc. + + +

+This function is used to build a prefix for error messages. + + + + + + + +

6 – Standard Libraries

+ +

+The standard Lua libraries provide useful functions +that are implemented directly through the C API. +Some of these functions provide essential services to the language +(e.g., type and getmetatable); +others provide access to "outside" services (e.g., I/O); +and others could be implemented in Lua itself, +but are quite useful or have critical performance requirements that +deserve an implementation in C (e.g., table.sort). + + +

+All libraries are implemented through the official C API +and are provided as separate C modules. +Currently, Lua has the following standard libraries: + +

    + +
  • basic library (§6.1);
  • + +
  • coroutine library (§6.2);
  • + +
  • package library (§6.3);
  • + +
  • string manipulation (§6.4);
  • + +
  • basic UTF-8 support (§6.5);
  • + +
  • table manipulation (§6.6);
  • + +
  • mathematical functions (§6.7) (sin, log, etc.);
  • + +
  • input and output (§6.8);
  • + +
  • operating system facilities (§6.9);
  • + +
  • debug facilities (§6.10).
  • + +

+Except for the basic and the package libraries, +each library provides all its functions as fields of a global table +or as methods of its objects. + + +

+To have access to these libraries, +the C host program should call the luaL_openlibs function, +which opens all standard libraries. +Alternatively, +the host program can open them individually by using +luaL_requiref to call +luaopen_base (for the basic library), +luaopen_package (for the package library), +luaopen_coroutine (for the coroutine library), +luaopen_string (for the string library), +luaopen_utf8 (for the UTF8 library), +luaopen_table (for the table library), +luaopen_math (for the mathematical library), +luaopen_io (for the I/O library), +luaopen_os (for the operating system library), +and luaopen_debug (for the debug library). +These functions are declared in lualib.h. + + + +

6.1 – Basic Functions

+ +

+The basic library provides core functions to Lua. +If you do not include this library in your application, +you should check carefully whether you need to provide +implementations for some of its facilities. + + +

+


assert (v [, message])

+ + +

+Calls error if +the value of its argument v is false (i.e., nil or false); +otherwise, returns all its arguments. +In case of error, +message is the error object; +when absent, it defaults to "assertion failed!" + + + + +

+


collectgarbage ([opt [, arg]])

+ + +

+This function is a generic interface to the garbage collector. +It performs different functions according to its first argument, opt: + +

    + +
  • "collect": +performs a full garbage-collection cycle. +This is the default option. +
  • + +
  • "stop": +stops automatic execution of the garbage collector. +The collector will run only when explicitly invoked, +until a call to restart it. +
  • + +
  • "restart": +restarts automatic execution of the garbage collector. +
  • + +
  • "count": +returns the total memory in use by Lua in Kbytes. +The value has a fractional part, +so that it multiplied by 1024 +gives the exact number of bytes in use by Lua +(except for overflows). +
  • + +
  • "step": +performs a garbage-collection step. +The step "size" is controlled by arg. +With a zero value, +the collector will perform one basic (indivisible) step. +For non-zero values, +the collector will perform as if that amount of memory +(in KBytes) had been allocated by Lua. +Returns true if the step finished a collection cycle. +
  • + +
  • "setpause": +sets arg as the new value for the pause of +the collector (see §2.5). +Returns the previous value for pause. +
  • + +
  • "setstepmul": +sets arg as the new value for the step multiplier of +the collector (see §2.5). +Returns the previous value for step. +
  • + +
  • "isrunning": +returns a boolean that tells whether the collector is running +(i.e., not stopped). +
  • + +
+ + + +

+


dofile ([filename])

+Opens the named file and executes its contents as a Lua chunk. +When called without arguments, +dofile executes the contents of the standard input (stdin). +Returns all values returned by the chunk. +In case of errors, dofile propagates the error +to its caller (that is, dofile does not run in protected mode). + + + + +

+


error (message [, level])

+Terminates the last protected function called +and returns message as the error object. +Function error never returns. + + +

+Usually, error adds some information about the error position +at the beginning of the message, if the message is a string. +The level argument specifies how to get the error position. +With level 1 (the default), the error position is where the +error function was called. +Level 2 points the error to where the function +that called error was called; and so on. +Passing a level 0 avoids the addition of error position information +to the message. + + + + +

+


_G

+A global variable (not a function) that +holds the global environment (see §2.2). +Lua itself does not use this variable; +changing its value does not affect any environment, +nor vice versa. + + + + +

+


getmetatable (object)

+ + +

+If object does not have a metatable, returns nil. +Otherwise, +if the object's metatable has a __metatable field, +returns the associated value. +Otherwise, returns the metatable of the given object. + + + + +

+


ipairs (t)

+ + +

+Returns three values (an iterator function, the table t, and 0) +so that the construction + +

+     for i,v in ipairs(t) do body end
+

+will iterate over the key–value pairs +(1,t[1]), (2,t[2]), ..., +up to the first nil value. + + + + +

+


load (chunk [, chunkname [, mode [, env]]])

+ + +

+Loads a chunk. + + +

+If chunk is a string, the chunk is this string. +If chunk is a function, +load calls it repeatedly to get the chunk pieces. +Each call to chunk must return a string that concatenates +with previous results. +A return of an empty string, nil, or no value signals the end of the chunk. + + +

+If there are no syntactic errors, +returns the compiled chunk as a function; +otherwise, returns nil plus the error message. + + +

+If the resulting function has upvalues, +the first upvalue is set to the value of env, +if that parameter is given, +or to the value of the global environment. +Other upvalues are initialized with nil. +(When you load a main chunk, +the resulting function will always have exactly one upvalue, +the _ENV variable (see §2.2). +However, +when you load a binary chunk created from a function (see string.dump), +the resulting function can have an arbitrary number of upvalues.) +All upvalues are fresh, that is, +they are not shared with any other function. + + +

+chunkname is used as the name of the chunk for error messages +and debug information (see §4.9). +When absent, +it defaults to chunk, if chunk is a string, +or to "=(load)" otherwise. + + +

+The string mode controls whether the chunk can be text or binary +(that is, a precompiled chunk). +It may be the string "b" (only binary chunks), +"t" (only text chunks), +or "bt" (both binary and text). +The default is "bt". + + +

+Lua does not check the consistency of binary chunks. +Maliciously crafted binary chunks can crash +the interpreter. + + + + +

+


loadfile ([filename [, mode [, env]]])

+ + +

+Similar to load, +but gets the chunk from file filename +or from the standard input, +if no file name is given. + + + + +

+


next (table [, index])

+ + +

+Allows a program to traverse all fields of a table. +Its first argument is a table and its second argument +is an index in this table. +next returns the next index of the table +and its associated value. +When called with nil as its second argument, +next returns an initial index +and its associated value. +When called with the last index, +or with nil in an empty table, +next returns nil. +If the second argument is absent, then it is interpreted as nil. +In particular, +you can use next(t) to check whether a table is empty. + + +

+The order in which the indices are enumerated is not specified, +even for numeric indices. +(To traverse a table in numerical order, +use a numerical for.) + + +

+The behavior of next is undefined if, +during the traversal, +you assign any value to a non-existent field in the table. +You may however modify existing fields. +In particular, you may clear existing fields. + + + + +

+


pairs (t)

+ + +

+If t has a metamethod __pairs, +calls it with t as argument and returns the first three +results from the call. + + +

+Otherwise, +returns three values: the next function, the table t, and nil, +so that the construction + +

+     for k,v in pairs(t) do body end
+

+will iterate over all key–value pairs of table t. + + +

+See function next for the caveats of modifying +the table during its traversal. + + + + +

+


pcall (f [, arg1, ···])

+ + +

+Calls function f with +the given arguments in protected mode. +This means that any error inside f is not propagated; +instead, pcall catches the error +and returns a status code. +Its first result is the status code (a boolean), +which is true if the call succeeds without errors. +In such case, pcall also returns all results from the call, +after this first result. +In case of any error, pcall returns false plus the error message. + + + + +

+


print (···)

+Receives any number of arguments +and prints their values to stdout, +using the tostring function to convert each argument to a string. +print is not intended for formatted output, +but only as a quick way to show a value, +for instance for debugging. +For complete control over the output, +use string.format and io.write. + + + + +

+


rawequal (v1, v2)

+Checks whether v1 is equal to v2, +without invoking the __eq metamethod. +Returns a boolean. + + + + +

+


rawget (table, index)

+Gets the real value of table[index], +without invoking the __index metamethod. +table must be a table; +index may be any value. + + + + +

+


rawlen (v)

+Returns the length of the object v, +which must be a table or a string, +without invoking the __len metamethod. +Returns an integer. + + + + +

+


rawset (table, index, value)

+Sets the real value of table[index] to value, +without invoking the __newindex metamethod. +table must be a table, +index any value different from nil and NaN, +and value any Lua value. + + +

+This function returns table. + + + + +

+


select (index, ···)

+ + +

+If index is a number, +returns all arguments after argument number index; +a negative number indexes from the end (-1 is the last argument). +Otherwise, index must be the string "#", +and select returns the total number of extra arguments it received. + + + + +

+


setmetatable (table, metatable)

+ + +

+Sets the metatable for the given table. +(To change the metatable of other types from Lua code, +you must use the debug library (§6.10).) +If metatable is nil, +removes the metatable of the given table. +If the original metatable has a __metatable field, +raises an error. + + +

+This function returns table. + + + + +

+


tonumber (e [, base])

+ + +

+When called with no base, +tonumber tries to convert its argument to a number. +If the argument is already a number or +a string convertible to a number, +then tonumber returns this number; +otherwise, it returns nil. + + +

+The conversion of strings can result in integers or floats, +according to the lexical conventions of Lua (see §3.1). +(The string may have leading and trailing spaces and a sign.) + + +

+When called with base, +then e must be a string to be interpreted as +an integer numeral in that base. +The base may be any integer between 2 and 36, inclusive. +In bases above 10, the letter 'A' (in either upper or lower case) +represents 10, 'B' represents 11, and so forth, +with 'Z' representing 35. +If the string e is not a valid numeral in the given base, +the function returns nil. + + + + +

+


tostring (v)

+Receives a value of any type and +converts it to a string in a human-readable format. +(For complete control of how numbers are converted, +use string.format.) + + +

+If the metatable of v has a __tostring field, +then tostring calls the corresponding value +with v as argument, +and uses the result of the call as its result. + + + + +

+


type (v)

+Returns the type of its only argument, coded as a string. +The possible results of this function are +"nil" (a string, not the value nil), +"number", +"string", +"boolean", +"table", +"function", +"thread", +and "userdata". + + + + +

+


_VERSION

+ + +

+A global variable (not a function) that +holds a string containing the running Lua version. +The current value of this variable is "Lua 5.3". + + + + +

+


xpcall (f, msgh [, arg1, ···])

+ + +

+This function is similar to pcall, +except that it sets a new message handler msgh. + + + + + + + +

6.2 – Coroutine Manipulation

+ +

+This library comprises the operations to manipulate coroutines, +which come inside the table coroutine. +See §2.6 for a general description of coroutines. + + +

+


coroutine.create (f)

+ + +

+Creates a new coroutine, with body f. +f must be a function. +Returns this new coroutine, +an object with type "thread". + + + + +

+


coroutine.isyieldable ()

+ + +

+Returns true when the running coroutine can yield. + + +

+A running coroutine is yieldable if it is not the main thread and +it is not inside a non-yieldable C function. + + + + +

+


coroutine.resume (co [, val1, ···])

+ + +

+Starts or continues the execution of coroutine co. +The first time you resume a coroutine, +it starts running its body. +The values val1, ... are passed +as the arguments to the body function. +If the coroutine has yielded, +resume restarts it; +the values val1, ... are passed +as the results from the yield. + + +

+If the coroutine runs without any errors, +resume returns true plus any values passed to yield +(when the coroutine yields) or any values returned by the body function +(when the coroutine terminates). +If there is any error, +resume returns false plus the error message. + + + + +

+


coroutine.running ()

+ + +

+Returns the running coroutine plus a boolean, +true when the running coroutine is the main one. + + + + +

+


coroutine.status (co)

+ + +

+Returns the status of coroutine co, as a string: +"running", +if the coroutine is running (that is, it called status); +"suspended", if the coroutine is suspended in a call to yield, +or if it has not started running yet; +"normal" if the coroutine is active but not running +(that is, it has resumed another coroutine); +and "dead" if the coroutine has finished its body function, +or if it has stopped with an error. + + + + +

+


coroutine.wrap (f)

+ + +

+Creates a new coroutine, with body f. +f must be a function. +Returns a function that resumes the coroutine each time it is called. +Any arguments passed to the function behave as the +extra arguments to resume. +Returns the same values returned by resume, +except the first boolean. +In case of error, propagates the error. + + + + +

+


coroutine.yield (···)

+ + +

+Suspends the execution of the calling coroutine. +Any arguments to yield are passed as extra results to resume. + + + + + + + +

6.3 – Modules

+ +

+The package library provides basic +facilities for loading modules in Lua. +It exports one function directly in the global environment: +require. +Everything else is exported in a table package. + + +

+


require (modname)

+ + +

+Loads the given module. +The function starts by looking into the package.loaded table +to determine whether modname is already loaded. +If it is, then require returns the value stored +at package.loaded[modname]. +Otherwise, it tries to find a loader for the module. + + +

+To find a loader, +require is guided by the package.searchers sequence. +By changing this sequence, +we can change how require looks for a module. +The following explanation is based on the default configuration +for package.searchers. + + +

+First require queries package.preload[modname]. +If it has a value, +this value (which must be a function) is the loader. +Otherwise require searches for a Lua loader using the +path stored in package.path. +If that also fails, it searches for a C loader using the +path stored in package.cpath. +If that also fails, +it tries an all-in-one loader (see package.searchers). + + +

+Once a loader is found, +require calls the loader with two arguments: +modname and an extra value dependent on how it got the loader. +(If the loader came from a file, +this extra value is the file name.) +If the loader returns any non-nil value, +require assigns the returned value to package.loaded[modname]. +If the loader does not return a non-nil value and +has not assigned any value to package.loaded[modname], +then require assigns true to this entry. +In any case, require returns the +final value of package.loaded[modname]. + + +

+If there is any error loading or running the module, +or if it cannot find any loader for the module, +then require raises an error. + + + + +

+


package.config

+ + +

+A string describing some compile-time configurations for packages. +This string is a sequence of lines: + +

    + +
  • The first line is the directory separator string. +Default is '\' for Windows and '/' for all other systems.
  • + +
  • The second line is the character that separates templates in a path. +Default is ';'.
  • + +
  • The third line is the string that marks the +substitution points in a template. +Default is '?'.
  • + +
  • The fourth line is a string that, in a path in Windows, +is replaced by the executable's directory. +Default is '!'.
  • + +
  • The fifth line is a mark to ignore all text after it +when building the luaopen_ function name. +Default is '-'.
  • + +
+ + + +

+


package.cpath

+ + +

+The path used by require to search for a C loader. + + +

+Lua initializes the C path package.cpath in the same way +it initializes the Lua path package.path, +using the environment variable LUA_CPATH_5_3, +or the environment variable LUA_CPATH, +or a default path defined in luaconf.h. + + + + +

+


package.loaded

+ + +

+A table used by require to control which +modules are already loaded. +When you require a module modname and +package.loaded[modname] is not false, +require simply returns the value stored there. + + +

+This variable is only a reference to the real table; +assignments to this variable do not change the +table used by require. + + + + +

+


package.loadlib (libname, funcname)

+ + +

+Dynamically links the host program with the C library libname. + + +

+If funcname is "*", +then it only links with the library, +making the symbols exported by the library +available to other dynamically linked libraries. +Otherwise, +it looks for a function funcname inside the library +and returns this function as a C function. +So, funcname must follow the lua_CFunction prototype +(see lua_CFunction). + + +

+This is a low-level function. +It completely bypasses the package and module system. +Unlike require, +it does not perform any path searching and +does not automatically adds extensions. +libname must be the complete file name of the C library, +including if necessary a path and an extension. +funcname must be the exact name exported by the C library +(which may depend on the C compiler and linker used). + + +

+This function is not supported by Standard C. +As such, it is only available on some platforms +(Windows, Linux, Mac OS X, Solaris, BSD, +plus other Unix systems that support the dlfcn standard). + + + + +

+


package.path

+ + +

+The path used by require to search for a Lua loader. + + +

+At start-up, Lua initializes this variable with +the value of the environment variable LUA_PATH_5_3 or +the environment variable LUA_PATH or +with a default path defined in luaconf.h, +if those environment variables are not defined. +Any ";;" in the value of the environment variable +is replaced by the default path. + + + + +

+


package.preload

+ + +

+A table to store loaders for specific modules +(see require). + + +

+This variable is only a reference to the real table; +assignments to this variable do not change the +table used by require. + + + + +

+


package.searchers

+ + +

+A table used by require to control how to load modules. + + +

+Each entry in this table is a searcher function. +When looking for a module, +require calls each of these searchers in ascending order, +with the module name (the argument given to require) as its +sole parameter. +The function can return another function (the module loader) +plus an extra value that will be passed to that loader, +or a string explaining why it did not find that module +(or nil if it has nothing to say). + + +

+Lua initializes this table with four searcher functions. + + +

+The first searcher simply looks for a loader in the +package.preload table. + + +

+The second searcher looks for a loader as a Lua library, +using the path stored at package.path. +The search is done as described in function package.searchpath. + + +

+The third searcher looks for a loader as a C library, +using the path given by the variable package.cpath. +Again, +the search is done as described in function package.searchpath. +For instance, +if the C path is the string + +

+     "./?.so;./?.dll;/usr/local/?/init.so"
+

+the searcher for module foo +will try to open the files ./foo.so, ./foo.dll, +and /usr/local/foo/init.so, in that order. +Once it finds a C library, +this searcher first uses a dynamic link facility to link the +application with the library. +Then it tries to find a C function inside the library to +be used as the loader. +The name of this C function is the string "luaopen_" +concatenated with a copy of the module name where each dot +is replaced by an underscore. +Moreover, if the module name has a hyphen, +its suffix after (and including) the first hyphen is removed. +For instance, if the module name is a.b.c-v2.1, +the function name will be luaopen_a_b_c. + + +

+The fourth searcher tries an all-in-one loader. +It searches the C path for a library for +the root name of the given module. +For instance, when requiring a.b.c, +it will search for a C library for a. +If found, it looks into it for an open function for +the submodule; +in our example, that would be luaopen_a_b_c. +With this facility, a package can pack several C submodules +into one single library, +with each submodule keeping its original open function. + + +

+All searchers except the first one (preload) return as the extra value +the file name where the module was found, +as returned by package.searchpath. +The first searcher returns no extra value. + + + + +

+


package.searchpath (name, path [, sep [, rep]])

+ + +

+Searches for the given name in the given path. + + +

+A path is a string containing a sequence of +templates separated by semicolons. +For each template, +the function replaces each interrogation mark (if any) +in the template with a copy of name +wherein all occurrences of sep +(a dot, by default) +were replaced by rep +(the system's directory separator, by default), +and then tries to open the resulting file name. + + +

+For instance, if the path is the string + +

+     "./?.lua;./?.lc;/usr/local/?/init.lua"
+

+the search for the name foo.a +will try to open the files +./foo/a.lua, ./foo/a.lc, and +/usr/local/foo/a/init.lua, in that order. + + +

+Returns the resulting name of the first file that it can +open in read mode (after closing the file), +or nil plus an error message if none succeeds. +(This error message lists all file names it tried to open.) + + + + + + + +

6.4 – String Manipulation

+ +

+This library provides generic functions for string manipulation, +such as finding and extracting substrings, and pattern matching. +When indexing a string in Lua, the first character is at position 1 +(not at 0, as in C). +Indices are allowed to be negative and are interpreted as indexing backwards, +from the end of the string. +Thus, the last character is at position -1, and so on. + + +

+The string library provides all its functions inside the table +string. +It also sets a metatable for strings +where the __index field points to the string table. +Therefore, you can use the string functions in object-oriented style. +For instance, string.byte(s,i) +can be written as s:byte(i). + + +

+The string library assumes one-byte character encodings. + + +

+


string.byte (s [, i [, j]])

+Returns the internal numeric codes of the characters s[i], +s[i+1], ..., s[j]. +The default value for i is 1; +the default value for j is i. +These indices are corrected +following the same rules of function string.sub. + + +

+Numeric codes are not necessarily portable across platforms. + + + + +

+


string.char (···)

+Receives zero or more integers. +Returns a string with length equal to the number of arguments, +in which each character has the internal numeric code equal +to its corresponding argument. + + +

+Numeric codes are not necessarily portable across platforms. + + + + +

+


string.dump (function [, strip])

+ + +

+Returns a string containing a binary representation +(a binary chunk) +of the given function, +so that a later load on this string returns +a copy of the function (but with new upvalues). +If strip is a true value, +the binary representation may not include all debug information +about the function, +to save space. + + +

+Functions with upvalues have only their number of upvalues saved. +When (re)loaded, +those upvalues receive fresh instances containing nil. +(You can use the debug library to serialize +and reload the upvalues of a function +in a way adequate to your needs.) + + + + +

+


string.find (s, pattern [, init [, plain]])

+ + +

+Looks for the first match of +pattern (see §6.4.1) in the string s. +If it finds a match, then find returns the indices of s +where this occurrence starts and ends; +otherwise, it returns nil. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative. +A value of true as a fourth, optional argument plain +turns off the pattern matching facilities, +so the function does a plain "find substring" operation, +with no characters in pattern being considered magic. +Note that if plain is given, then init must be given as well. + + +

+If the pattern has captures, +then in a successful match +the captured values are also returned, +after the two indices. + + + + +

+


string.format (formatstring, ···)

+ + +

+Returns a formatted version of its variable number of arguments +following the description given in its first argument (which must be a string). +The format string follows the same rules as the ISO C function sprintf. +The only differences are that the options/modifiers +*, h, L, l, n, +and p are not supported +and that there is an extra option, q. + + +

+The q option formats a string between double quotes, +using escape sequences when necessary to ensure that +it can safely be read back by the Lua interpreter. +For instance, the call + +

+     string.format('%q', 'a string with "quotes" and \n new line')
+

+may produce the string: + +

+     "a string with \"quotes\" and \
+      new line"
+
+ +

+Options +A, a, E, e, f, +G, and g all expect a number as argument. +Options c, d, +i, o, u, X, and x +expect an integer. +When Lua is compiled with a C89 compiler, +options A and a (hexadecimal floats) +do not support any modifier (flags, width, length). + + +

+Option s expects a string; +if its argument is not a string, +it is converted to one following the same rules of tostring. +If the option has any modifier (flags, width, length), +the string argument should not contain embedded zeros. + + + + +

+


string.gmatch (s, pattern)

+Returns an iterator function that, +each time it is called, +returns the next captures from pattern (see §6.4.1) +over the string s. +If pattern specifies no captures, +then the whole match is produced in each call. + + +

+As an example, the following loop +will iterate over all the words from string s, +printing one per line: + +

+     s = "hello world from Lua"
+     for w in string.gmatch(s, "%a+") do
+       print(w)
+     end
+

+The next example collects all pairs key=value from the +given string into a table: + +

+     t = {}
+     s = "from=world, to=Lua"
+     for k, v in string.gmatch(s, "(%w+)=(%w+)") do
+       t[k] = v
+     end
+
+ +

+For this function, a caret '^' at the start of a pattern does not +work as an anchor, as this would prevent the iteration. + + + + +

+


string.gsub (s, pattern, repl [, n])

+Returns a copy of s +in which all (or the first n, if given) +occurrences of the pattern (see §6.4.1) have been +replaced by a replacement string specified by repl, +which can be a string, a table, or a function. +gsub also returns, as its second value, +the total number of matches that occurred. +The name gsub comes from Global SUBstitution. + + +

+If repl is a string, then its value is used for replacement. +The character % works as an escape character: +any sequence in repl of the form %d, +with d between 1 and 9, +stands for the value of the d-th captured substring. +The sequence %0 stands for the whole match. +The sequence %% stands for a single %. + + +

+If repl is a table, then the table is queried for every match, +using the first capture as the key. + + +

+If repl is a function, then this function is called every time a +match occurs, with all captured substrings passed as arguments, +in order. + + +

+In any case, +if the pattern specifies no captures, +then it behaves as if the whole pattern was inside a capture. + + +

+If the value returned by the table query or by the function call +is a string or a number, +then it is used as the replacement string; +otherwise, if it is false or nil, +then there is no replacement +(that is, the original match is kept in the string). + + +

+Here are some examples: + +

+     x = string.gsub("hello world", "(%w+)", "%1 %1")
+     --> x="hello hello world world"
+     
+     x = string.gsub("hello world", "%w+", "%0 %0", 1)
+     --> x="hello hello world"
+     
+     x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
+     --> x="world hello Lua from"
+     
+     x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
+     --> x="home = /home/roberto, user = roberto"
+     
+     x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
+           return load(s)()
+         end)
+     --> x="4+5 = 9"
+     
+     local t = {name="lua", version="5.3"}
+     x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
+     --> x="lua-5.3.tar.gz"
+
+ + + +

+


string.len (s)

+Receives a string and returns its length. +The empty string "" has length 0. +Embedded zeros are counted, +so "a\000bc\000" has length 5. + + + + +

+


string.lower (s)

+Receives a string and returns a copy of this string with all +uppercase letters changed to lowercase. +All other characters are left unchanged. +The definition of what an uppercase letter is depends on the current locale. + + + + +

+


string.match (s, pattern [, init])

+Looks for the first match of +pattern (see §6.4.1) in the string s. +If it finds one, then match returns +the captures from the pattern; +otherwise it returns nil. +If pattern specifies no captures, +then the whole match is returned. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative. + + + + +

+


string.pack (fmt, v1, v2, ···)

+ + +

+Returns a binary string containing the values v1, v2, etc. +packed (that is, serialized in binary form) +according to the format string fmt (see §6.4.2). + + + + +

+


string.packsize (fmt)

+ + +

+Returns the size of a string resulting from string.pack +with the given format. +The format string cannot have the variable-length options +'s' or 'z' (see §6.4.2). + + + + +

+


string.rep (s, n [, sep])

+Returns a string that is the concatenation of n copies of +the string s separated by the string sep. +The default value for sep is the empty string +(that is, no separator). +Returns the empty string if n is not positive. + + +

+(Note that it is very easy to exhaust the memory of your machine +with a single call to this function.) + + + + +

+


string.reverse (s)

+Returns a string that is the string s reversed. + + + + +

+


string.sub (s, i [, j])

+Returns the substring of s that +starts at i and continues until j; +i and j can be negative. +If j is absent, then it is assumed to be equal to -1 +(which is the same as the string length). +In particular, +the call string.sub(s,1,j) returns a prefix of s +with length j, +and string.sub(s, -i) (for a positive i) +returns a suffix of s +with length i. + + +

+If, after the translation of negative indices, +i is less than 1, +it is corrected to 1. +If j is greater than the string length, +it is corrected to that length. +If, after these corrections, +i is greater than j, +the function returns the empty string. + + + + +

+


string.unpack (fmt, s [, pos])

+ + +

+Returns the values packed in string s (see string.pack) +according to the format string fmt (see §6.4.2). +An optional pos marks where +to start reading in s (default is 1). +After the read values, +this function also returns the index of the first unread byte in s. + + + + +

+


string.upper (s)

+Receives a string and returns a copy of this string with all +lowercase letters changed to uppercase. +All other characters are left unchanged. +The definition of what a lowercase letter is depends on the current locale. + + + + + +

6.4.1 – Patterns

+ +

+Patterns in Lua are described by regular strings, +which are interpreted as patterns by the pattern-matching functions +string.find, +string.gmatch, +string.gsub, +and string.match. +This section describes the syntax and the meaning +(that is, what they match) of these strings. + + + +

Character Class:

+A character class is used to represent a set of characters. +The following combinations are allowed in describing a character class: + +

    + +
  • x: +(where x is not one of the magic characters +^$()%.[]*+-?) +represents the character x itself. +
  • + +
  • .: (a dot) represents all characters.
  • + +
  • %a: represents all letters.
  • + +
  • %c: represents all control characters.
  • + +
  • %d: represents all digits.
  • + +
  • %g: represents all printable characters except space.
  • + +
  • %l: represents all lowercase letters.
  • + +
  • %p: represents all punctuation characters.
  • + +
  • %s: represents all space characters.
  • + +
  • %u: represents all uppercase letters.
  • + +
  • %w: represents all alphanumeric characters.
  • + +
  • %x: represents all hexadecimal digits.
  • + +
  • %x: (where x is any non-alphanumeric character) +represents the character x. +This is the standard way to escape the magic characters. +Any non-alphanumeric character +(including all punctuation characters, even the non-magical) +can be preceded by a '%' +when used to represent itself in a pattern. +
  • + +
  • [set]: +represents the class which is the union of all +characters in set. +A range of characters can be specified by +separating the end characters of the range, +in ascending order, with a '-'. +All classes %x described above can also be used as +components in set. +All other characters in set represent themselves. +For example, [%w_] (or [_%w]) +represents all alphanumeric characters plus the underscore, +[0-7] represents the octal digits, +and [0-7%l%-] represents the octal digits plus +the lowercase letters plus the '-' character. + + +

    +You can put a closing square bracket in a set +by positioning it as the first character in the set. +You can put an hyphen in a set +by positioning it as the first or the last character in the set. +(You can also use an escape for both cases.) + + +

    +The interaction between ranges and classes is not defined. +Therefore, patterns like [%a-z] or [a-%%] +have no meaning. +

  • + +
  • [^set]: +represents the complement of set, +where set is interpreted as above. +
  • + +

+For all classes represented by single letters (%a, %c, etc.), +the corresponding uppercase letter represents the complement of the class. +For instance, %S represents all non-space characters. + + +

+The definitions of letter, space, and other character groups +depend on the current locale. +In particular, the class [a-z] may not be equivalent to %l. + + + + + +

Pattern Item:

+A pattern item can be + +

    + +
  • +a single character class, +which matches any single character in the class; +
  • + +
  • +a single character class followed by '*', +which matches zero or more repetitions of characters in the class. +These repetition items will always match the longest possible sequence; +
  • + +
  • +a single character class followed by '+', +which matches one or more repetitions of characters in the class. +These repetition items will always match the longest possible sequence; +
  • + +
  • +a single character class followed by '-', +which also matches zero or more repetitions of characters in the class. +Unlike '*', +these repetition items will always match the shortest possible sequence; +
  • + +
  • +a single character class followed by '?', +which matches zero or one occurrence of a character in the class. +It always matches one occurrence if possible; +
  • + +
  • +%n, for n between 1 and 9; +such item matches a substring equal to the n-th captured string +(see below); +
  • + +
  • +%bxy, where x and y are two distinct characters; +such item matches strings that start with x, end with y, +and where the x and y are balanced. +This means that, if one reads the string from left to right, +counting +1 for an x and -1 for a y, +the ending y is the first y where the count reaches 0. +For instance, the item %b() matches expressions with +balanced parentheses. +
  • + +
  • +%f[set], a frontier pattern; +such item matches an empty string at any position such that +the next character belongs to set +and the previous character does not belong to set. +The set set is interpreted as previously described. +The beginning and the end of the subject are handled as if +they were the character '\0'. +
  • + +
+ + + + +

Pattern:

+A pattern is a sequence of pattern items. +A caret '^' at the beginning of a pattern anchors the match at the +beginning of the subject string. +A '$' at the end of a pattern anchors the match at the +end of the subject string. +At other positions, +'^' and '$' have no special meaning and represent themselves. + + + + + +

Captures:

+A pattern can contain sub-patterns enclosed in parentheses; +they describe captures. +When a match succeeds, the substrings of the subject string +that match captures are stored (captured) for future use. +Captures are numbered according to their left parentheses. +For instance, in the pattern "(a*(.)%w(%s*))", +the part of the string matching "a*(.)%w(%s*)" is +stored as the first capture (and therefore has number 1); +the character matching "." is captured with number 2, +and the part matching "%s*" has number 3. + + +

+As a special case, the empty capture () captures +the current string position (a number). +For instance, if we apply the pattern "()aa()" on the +string "flaaap", there will be two captures: 3 and 5. + + + + + + + +

6.4.2 – Format Strings for Pack and Unpack

+ +

+The first argument to string.pack, +string.packsize, and string.unpack +is a format string, +which describes the layout of the structure being created or read. + + +

+A format string is a sequence of conversion options. +The conversion options are as follows: + +

    +
  • <: sets little endian
  • +
  • >: sets big endian
  • +
  • =: sets native endian
  • +
  • ![n]: sets maximum alignment to n +(default is native alignment)
  • +
  • b: a signed byte (char)
  • +
  • B: an unsigned byte (char)
  • +
  • h: a signed short (native size)
  • +
  • H: an unsigned short (native size)
  • +
  • l: a signed long (native size)
  • +
  • L: an unsigned long (native size)
  • +
  • j: a lua_Integer
  • +
  • J: a lua_Unsigned
  • +
  • T: a size_t (native size)
  • +
  • i[n]: a signed int with n bytes +(default is native size)
  • +
  • I[n]: an unsigned int with n bytes +(default is native size)
  • +
  • f: a float (native size)
  • +
  • d: a double (native size)
  • +
  • n: a lua_Number
  • +
  • cn: a fixed-sized string with n bytes
  • +
  • z: a zero-terminated string
  • +
  • s[n]: a string preceded by its length +coded as an unsigned integer with n bytes +(default is a size_t)
  • +
  • x: one byte of padding
  • +
  • Xop: an empty item that aligns +according to option op +(which is otherwise ignored)
  • +
  • ' ': (empty space) ignored
  • +

+(A "[n]" means an optional integral numeral.) +Except for padding, spaces, and configurations +(options "xX <=>!"), +each option corresponds to an argument (in string.pack) +or a result (in string.unpack). + + +

+For options "!n", "sn", "in", and "In", +n can be any integer between 1 and 16. +All integral options check overflows; +string.pack checks whether the given value fits in the given size; +string.unpack checks whether the read value fits in a Lua integer. + + +

+Any format string starts as if prefixed by "!1=", +that is, +with maximum alignment of 1 (no alignment) +and native endianness. + + +

+Alignment works as follows: +For each option, +the format gets extra padding until the data starts +at an offset that is a multiple of the minimum between the +option size and the maximum alignment; +this minimum must be a power of 2. +Options "c" and "z" are not aligned; +option "s" follows the alignment of its starting integer. + + +

+All padding is filled with zeros by string.pack +(and ignored by string.unpack). + + + + + + + +

6.5 – UTF-8 Support

+ +

+This library provides basic support for UTF-8 encoding. +It provides all its functions inside the table utf8. +This library does not provide any support for Unicode other +than the handling of the encoding. +Any operation that needs the meaning of a character, +such as character classification, is outside its scope. + + +

+Unless stated otherwise, +all functions that expect a byte position as a parameter +assume that the given position is either the start of a byte sequence +or one plus the length of the subject string. +As in the string library, +negative indices count from the end of the string. + + +

+


utf8.char (···)

+Receives zero or more integers, +converts each one to its corresponding UTF-8 byte sequence +and returns a string with the concatenation of all these sequences. + + + + +

+


utf8.charpattern

+The pattern (a string, not a function) "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" +(see §6.4.1), +which matches exactly one UTF-8 byte sequence, +assuming that the subject is a valid UTF-8 string. + + + + +

+


utf8.codes (s)

+ + +

+Returns values so that the construction + +

+     for p, c in utf8.codes(s) do body end
+

+will iterate over all characters in string s, +with p being the position (in bytes) and c the code point +of each character. +It raises an error if it meets any invalid byte sequence. + + + + +

+


utf8.codepoint (s [, i [, j]])

+Returns the codepoints (as integers) from all characters in s +that start between byte position i and j (both included). +The default for i is 1 and for j is i. +It raises an error if it meets any invalid byte sequence. + + + + +

+


utf8.len (s [, i [, j]])

+Returns the number of UTF-8 characters in string s +that start between positions i and j (both inclusive). +The default for i is 1 and for j is -1. +If it finds any invalid byte sequence, +returns a false value plus the position of the first invalid byte. + + + + +

+


utf8.offset (s, n [, i])

+Returns the position (in bytes) where the encoding of the +n-th character of s +(counting from position i) starts. +A negative n gets characters before position i. +The default for i is 1 when n is non-negative +and #s + 1 otherwise, +so that utf8.offset(s, -n) gets the offset of the +n-th character from the end of the string. +If the specified character is neither in the subject +nor right after its end, +the function returns nil. + + +

+As a special case, +when n is 0 the function returns the start of the encoding +of the character that contains the i-th byte of s. + + +

+This function assumes that s is a valid UTF-8 string. + + + + + + + +

6.6 – Table Manipulation

+ +

+This library provides generic functions for table manipulation. +It provides all its functions inside the table table. + + +

+Remember that, whenever an operation needs the length of a table, +all caveats about the length operator apply (see §3.4.7). +All functions ignore non-numeric keys +in the tables given as arguments. + + +

+


table.concat (list [, sep [, i [, j]]])

+ + +

+Given a list where all elements are strings or numbers, +returns the string list[i]..sep..list[i+1] ··· sep..list[j]. +The default value for sep is the empty string, +the default for i is 1, +and the default for j is #list. +If i is greater than j, returns the empty string. + + + + +

+


table.insert (list, [pos,] value)

+ + +

+Inserts element value at position pos in list, +shifting up the elements +list[pos], list[pos+1], ···, list[#list]. +The default value for pos is #list+1, +so that a call table.insert(t,x) inserts x at the end +of list t. + + + + +

+


table.move (a1, f, e, t [,a2])

+ + +

+Moves elements from table a1 to table a2, +performing the equivalent to the following +multiple assignment: +a2[t],··· = a1[f],···,a1[e]. +The default for a2 is a1. +The destination range can overlap with the source range. +The number of elements to be moved must fit in a Lua integer. + + +

+Returns the destination table a2. + + + + +

+


table.pack (···)

+ + +

+Returns a new table with all parameters stored into keys 1, 2, etc. +and with a field "n" with the total number of parameters. +Note that the resulting table may not be a sequence. + + + + +

+


table.remove (list [, pos])

+ + +

+Removes from list the element at position pos, +returning the value of the removed element. +When pos is an integer between 1 and #list, +it shifts down the elements +list[pos+1], list[pos+2], ···, list[#list] +and erases element list[#list]; +The index pos can also be 0 when #list is 0, +or #list + 1; +in those cases, the function erases the element list[pos]. + + +

+The default value for pos is #list, +so that a call table.remove(l) removes the last element +of list l. + + + + +

+


table.sort (list [, comp])

+ + +

+Sorts list elements in a given order, in-place, +from list[1] to list[#list]. +If comp is given, +then it must be a function that receives two list elements +and returns true when the first element must come +before the second in the final order +(so that, after the sort, +i < j implies not comp(list[j],list[i])). +If comp is not given, +then the standard Lua operator < is used instead. + + +

+Note that the comp function must define +a strict partial order over the elements in the list; +that is, it must be asymmetric and transitive. +Otherwise, no valid sort may be possible. + + +

+The sort algorithm is not stable: +elements considered equal by the given order +may have their relative positions changed by the sort. + + + + +

+


table.unpack (list [, i [, j]])

+ + +

+Returns the elements from the given list. +This function is equivalent to + +

+     return list[i], list[i+1], ···, list[j]
+

+By default, i is 1 and j is #list. + + + + + + + +

6.7 – Mathematical Functions

+ +

+This library provides basic mathematical functions. +It provides all its functions and constants inside the table math. +Functions with the annotation "integer/float" give +integer results for integer arguments +and float results for float (or mixed) arguments. +Rounding functions +(math.ceil, math.floor, and math.modf) +return an integer when the result fits in the range of an integer, +or a float otherwise. + + +

+


math.abs (x)

+ + +

+Returns the absolute value of x. (integer/float) + + + + +

+


math.acos (x)

+ + +

+Returns the arc cosine of x (in radians). + + + + +

+


math.asin (x)

+ + +

+Returns the arc sine of x (in radians). + + + + +

+


math.atan (y [, x])

+ + +

+ +Returns the arc tangent of y/x (in radians), +but uses the signs of both parameters to find the +quadrant of the result. +(It also handles correctly the case of x being zero.) + + +

+The default value for x is 1, +so that the call math.atan(y) +returns the arc tangent of y. + + + + +

+


math.ceil (x)

+ + +

+Returns the smallest integral value larger than or equal to x. + + + + +

+


math.cos (x)

+ + +

+Returns the cosine of x (assumed to be in radians). + + + + +

+


math.deg (x)

+ + +

+Converts the angle x from radians to degrees. + + + + +

+


math.exp (x)

+ + +

+Returns the value ex +(where e is the base of natural logarithms). + + + + +

+


math.floor (x)

+ + +

+Returns the largest integral value smaller than or equal to x. + + + + +

+


math.fmod (x, y)

+ + +

+Returns the remainder of the division of x by y +that rounds the quotient towards zero. (integer/float) + + + + +

+


math.huge

+ + +

+The float value HUGE_VAL, +a value larger than any other numeric value. + + + + +

+


math.log (x [, base])

+ + +

+Returns the logarithm of x in the given base. +The default for base is e +(so that the function returns the natural logarithm of x). + + + + +

+


math.max (x, ···)

+ + +

+Returns the argument with the maximum value, +according to the Lua operator <. (integer/float) + + + + +

+


math.maxinteger

+An integer with the maximum value for an integer. + + + + +

+


math.min (x, ···)

+ + +

+Returns the argument with the minimum value, +according to the Lua operator <. (integer/float) + + + + +

+


math.mininteger

+An integer with the minimum value for an integer. + + + + +

+


math.modf (x)

+ + +

+Returns the integral part of x and the fractional part of x. +Its second result is always a float. + + + + +

+


math.pi

+ + +

+The value of π. + + + + +

+


math.rad (x)

+ + +

+Converts the angle x from degrees to radians. + + + + +

+


math.random ([m [, n]])

+ + +

+When called without arguments, +returns a pseudo-random float with uniform distribution +in the range [0,1). +When called with two integers m and n, +math.random returns a pseudo-random integer +with uniform distribution in the range [m, n]. +(The value n-m cannot be negative and must fit in a Lua integer.) +The call math.random(n) is equivalent to math.random(1,n). + + +

+This function is an interface to the underling +pseudo-random generator function provided by C. + + + + +

+


math.randomseed (x)

+ + +

+Sets x as the "seed" +for the pseudo-random generator: +equal seeds produce equal sequences of numbers. + + + + +

+


math.sin (x)

+ + +

+Returns the sine of x (assumed to be in radians). + + + + +

+


math.sqrt (x)

+ + +

+Returns the square root of x. +(You can also use the expression x^0.5 to compute this value.) + + + + +

+


math.tan (x)

+ + +

+Returns the tangent of x (assumed to be in radians). + + + + +

+


math.tointeger (x)

+ + +

+If the value x is convertible to an integer, +returns that integer. +Otherwise, returns nil. + + + + +

+


math.type (x)

+ + +

+Returns "integer" if x is an integer, +"float" if it is a float, +or nil if x is not a number. + + + + +

+


math.ult (m, n)

+ + +

+Returns a boolean, +true if and only if integer m is below integer n when +they are compared as unsigned integers. + + + + + + + +

6.8 – Input and Output Facilities

+ +

+The I/O library provides two different styles for file manipulation. +The first one uses implicit file handles; +that is, there are operations to set a default input file and a +default output file, +and all input/output operations are over these default files. +The second style uses explicit file handles. + + +

+When using implicit file handles, +all operations are supplied by table io. +When using explicit file handles, +the operation io.open returns a file handle +and then all operations are supplied as methods of the file handle. + + +

+The table io also provides +three predefined file handles with their usual meanings from C: +io.stdin, io.stdout, and io.stderr. +The I/O library never closes these files. + + +

+Unless otherwise stated, +all I/O functions return nil on failure +(plus an error message as a second result and +a system-dependent error code as a third result) +and some value different from nil on success. +On non-POSIX systems, +the computation of the error message and error code +in case of errors +may be not thread safe, +because they rely on the global C variable errno. + + +

+


io.close ([file])

+ + +

+Equivalent to file:close(). +Without a file, closes the default output file. + + + + +

+


io.flush ()

+ + +

+Equivalent to io.output():flush(). + + + + +

+


io.input ([file])

+ + +

+When called with a file name, it opens the named file (in text mode), +and sets its handle as the default input file. +When called with a file handle, +it simply sets this file handle as the default input file. +When called without parameters, +it returns the current default input file. + + +

+In case of errors this function raises the error, +instead of returning an error code. + + + + +

+


io.lines ([filename, ···])

+ + +

+Opens the given file name in read mode +and returns an iterator function that +works like file:lines(···) over the opened file. +When the iterator function detects the end of file, +it returns no values (to finish the loop) and automatically closes the file. + + +

+The call io.lines() (with no file name) is equivalent +to io.input():lines("*l"); +that is, it iterates over the lines of the default input file. +In this case it does not close the file when the loop ends. + + +

+In case of errors this function raises the error, +instead of returning an error code. + + + + +

+


io.open (filename [, mode])

+ + +

+This function opens a file, +in the mode specified in the string mode. +In case of success, +it returns a new file handle. + + +

+The mode string can be any of the following: + +

    +
  • "r": read mode (the default);
  • +
  • "w": write mode;
  • +
  • "a": append mode;
  • +
  • "r+": update mode, all previous data is preserved;
  • +
  • "w+": update mode, all previous data is erased;
  • +
  • "a+": append update mode, previous data is preserved, + writing is only allowed at the end of file.
  • +

+The mode string can also have a 'b' at the end, +which is needed in some systems to open the file in binary mode. + + + + +

+


io.output ([file])

+ + +

+Similar to io.input, but operates over the default output file. + + + + +

+


io.popen (prog [, mode])

+ + +

+This function is system dependent and is not available +on all platforms. + + +

+Starts program prog in a separated process and returns +a file handle that you can use to read data from this program +(if mode is "r", the default) +or to write data to this program +(if mode is "w"). + + + + +

+


io.read (···)

+ + +

+Equivalent to io.input():read(···). + + + + +

+


io.tmpfile ()

+ + +

+In case of success, +returns a handle for a temporary file. +This file is opened in update mode +and it is automatically removed when the program ends. + + + + +

+


io.type (obj)

+ + +

+Checks whether obj is a valid file handle. +Returns the string "file" if obj is an open file handle, +"closed file" if obj is a closed file handle, +or nil if obj is not a file handle. + + + + +

+


io.write (···)

+ + +

+Equivalent to io.output():write(···). + + + + +

+


file:close ()

+ + +

+Closes file. +Note that files are automatically closed when +their handles are garbage collected, +but that takes an unpredictable amount of time to happen. + + +

+When closing a file handle created with io.popen, +file:close returns the same values +returned by os.execute. + + + + +

+


file:flush ()

+ + +

+Saves any written data to file. + + + + +

+


file:lines (···)

+ + +

+Returns an iterator function that, +each time it is called, +reads the file according to the given formats. +When no format is given, +uses "l" as a default. +As an example, the construction + +

+     for c in file:lines(1) do body end
+

+will iterate over all characters of the file, +starting at the current position. +Unlike io.lines, this function does not close the file +when the loop ends. + + +

+In case of errors this function raises the error, +instead of returning an error code. + + + + +

+


file:read (···)

+ + +

+Reads the file file, +according to the given formats, which specify what to read. +For each format, +the function returns a string or a number with the characters read, +or nil if it cannot read data with the specified format. +(In this latter case, +the function does not read subsequent formats.) +When called without formats, +it uses a default format that reads the next line +(see below). + + +

+The available formats are + +

    + +
  • "n": +reads a numeral and returns it as a float or an integer, +following the lexical conventions of Lua. +(The numeral may have leading spaces and a sign.) +This format always reads the longest input sequence that +is a valid prefix for a numeral; +if that prefix does not form a valid numeral +(e.g., an empty string, "0x", or "3.4e-"), +it is discarded and the function returns nil. +
  • + +
  • "a": +reads the whole file, starting at the current position. +On end of file, it returns the empty string. +
  • + +
  • "l": +reads the next line skipping the end of line, +returning nil on end of file. +This is the default format. +
  • + +
  • "L": +reads the next line keeping the end-of-line character (if present), +returning nil on end of file. +
  • + +
  • number: +reads a string with up to this number of bytes, +returning nil on end of file. +If number is zero, +it reads nothing and returns an empty string, +or nil on end of file. +
  • + +

+The formats "l" and "L" should be used only for text files. + + + + +

+


file:seek ([whence [, offset]])

+ + +

+Sets and gets the file position, +measured from the beginning of the file, +to the position given by offset plus a base +specified by the string whence, as follows: + +

    +
  • "set": base is position 0 (beginning of the file);
  • +
  • "cur": base is current position;
  • +
  • "end": base is end of file;
  • +

+In case of success, seek returns the final file position, +measured in bytes from the beginning of the file. +If seek fails, it returns nil, +plus a string describing the error. + + +

+The default value for whence is "cur", +and for offset is 0. +Therefore, the call file:seek() returns the current +file position, without changing it; +the call file:seek("set") sets the position to the +beginning of the file (and returns 0); +and the call file:seek("end") sets the position to the +end of the file, and returns its size. + + + + +

+


file:setvbuf (mode [, size])

+ + +

+Sets the buffering mode for an output file. +There are three available modes: + +

    + +
  • "no": +no buffering; the result of any output operation appears immediately. +
  • + +
  • "full": +full buffering; output operation is performed only +when the buffer is full or when +you explicitly flush the file (see io.flush). +
  • + +
  • "line": +line buffering; output is buffered until a newline is output +or there is any input from some special files +(such as a terminal device). +
  • + +

+For the last two cases, size +specifies the size of the buffer, in bytes. +The default is an appropriate size. + + + + +

+


file:write (···)

+ + +

+Writes the value of each of its arguments to file. +The arguments must be strings or numbers. + + +

+In case of success, this function returns file. +Otherwise it returns nil plus a string describing the error. + + + + + + + +

6.9 – Operating System Facilities

+ +

+This library is implemented through table os. + + +

+


os.clock ()

+ + +

+Returns an approximation of the amount in seconds of CPU time +used by the program. + + + + +

+


os.date ([format [, time]])

+ + +

+Returns a string or a table containing date and time, +formatted according to the given string format. + + +

+If the time argument is present, +this is the time to be formatted +(see the os.time function for a description of this value). +Otherwise, date formats the current time. + + +

+If format starts with '!', +then the date is formatted in Coordinated Universal Time. +After this optional character, +if format is the string "*t", +then date returns a table with the following fields: +year, month (1–12), day (1–31), +hour (0–23), min (0–59), sec (0–61), +wday (weekday, 1–7, Sunday is 1), +yday (day of the year, 1–366), +and isdst (daylight saving flag, a boolean). +This last field may be absent +if the information is not available. + + +

+If format is not "*t", +then date returns the date as a string, +formatted according to the same rules as the ISO C function strftime. + + +

+When called without arguments, +date returns a reasonable date and time representation that depends on +the host system and on the current locale. +(More specifically, os.date() is equivalent to os.date("%c").) + + +

+On non-POSIX systems, +this function may be not thread safe +because of its reliance on C function gmtime and C function localtime. + + + + +

+


os.difftime (t2, t1)

+ + +

+Returns the difference, in seconds, +from time t1 to time t2 +(where the times are values returned by os.time). +In POSIX, Windows, and some other systems, +this value is exactly t2-t1. + + + + +

+


os.execute ([command])

+ + +

+This function is equivalent to the ISO C function system. +It passes command to be executed by an operating system shell. +Its first result is true +if the command terminated successfully, +or nil otherwise. +After this first result +the function returns a string plus a number, +as follows: + +

    + +
  • "exit": +the command terminated normally; +the following number is the exit status of the command. +
  • + +
  • "signal": +the command was terminated by a signal; +the following number is the signal that terminated the command. +
  • + +
+ +

+When called without a command, +os.execute returns a boolean that is true if a shell is available. + + + + +

+


os.exit ([code [, close]])

+ + +

+Calls the ISO C function exit to terminate the host program. +If code is true, +the returned status is EXIT_SUCCESS; +if code is false, +the returned status is EXIT_FAILURE; +if code is a number, +the returned status is this number. +The default value for code is true. + + +

+If the optional second argument close is true, +closes the Lua state before exiting. + + + + +

+


os.getenv (varname)

+ + +

+Returns the value of the process environment variable varname, +or nil if the variable is not defined. + + + + +

+


os.remove (filename)

+ + +

+Deletes the file (or empty directory, on POSIX systems) +with the given name. +If this function fails, it returns nil, +plus a string describing the error and the error code. +Otherwise, it returns true. + + + + +

+


os.rename (oldname, newname)

+ + +

+Renames the file or directory named oldname to newname. +If this function fails, it returns nil, +plus a string describing the error and the error code. +Otherwise, it returns true. + + + + +

+


os.setlocale (locale [, category])

+ + +

+Sets the current locale of the program. +locale is a system-dependent string specifying a locale; +category is an optional string describing which category to change: +"all", "collate", "ctype", +"monetary", "numeric", or "time"; +the default category is "all". +The function returns the name of the new locale, +or nil if the request cannot be honored. + + +

+If locale is the empty string, +the current locale is set to an implementation-defined native locale. +If locale is the string "C", +the current locale is set to the standard C locale. + + +

+When called with nil as the first argument, +this function only returns the name of the current locale +for the given category. + + +

+This function may be not thread safe +because of its reliance on C function setlocale. + + + + +

+


os.time ([table])

+ + +

+Returns the current time when called without arguments, +or a time representing the local date and time specified by the given table. +This table must have fields year, month, and day, +and may have fields +hour (default is 12), +min (default is 0), +sec (default is 0), +and isdst (default is nil). +Other fields are ignored. +For a description of these fields, see the os.date function. + + +

+The values in these fields do not need to be inside their valid ranges. +For instance, if sec is -10, +it means -10 seconds from the time specified by the other fields; +if hour is 1000, +it means +1000 hours from the time specified by the other fields. + + +

+The returned value is a number, whose meaning depends on your system. +In POSIX, Windows, and some other systems, +this number counts the number +of seconds since some given start time (the "epoch"). +In other systems, the meaning is not specified, +and the number returned by time can be used only as an argument to +os.date and os.difftime. + + + + +

+


os.tmpname ()

+ + +

+Returns a string with a file name that can +be used for a temporary file. +The file must be explicitly opened before its use +and explicitly removed when no longer needed. + + +

+On POSIX systems, +this function also creates a file with that name, +to avoid security risks. +(Someone else might create the file with wrong permissions +in the time between getting the name and creating the file.) +You still have to open the file to use it +and to remove it (even if you do not use it). + + +

+When possible, +you may prefer to use io.tmpfile, +which automatically removes the file when the program ends. + + + + + + + +

6.10 – The Debug Library

+ +

+This library provides +the functionality of the debug interface (§4.9) to Lua programs. +You should exert care when using this library. +Several of its functions +violate basic assumptions about Lua code +(e.g., that variables local to a function +cannot be accessed from outside; +that userdata metatables cannot be changed by Lua code; +that Lua programs do not crash) +and therefore can compromise otherwise secure code. +Moreover, some functions in this library may be slow. + + +

+All functions in this library are provided +inside the debug table. +All functions that operate over a thread +have an optional first argument which is the +thread to operate over. +The default is always the current thread. + + +

+


debug.debug ()

+ + +

+Enters an interactive mode with the user, +running each string that the user enters. +Using simple commands and other debug facilities, +the user can inspect global and local variables, +change their values, evaluate expressions, and so on. +A line containing only the word cont finishes this function, +so that the caller continues its execution. + + +

+Note that commands for debug.debug are not lexically nested +within any function and so have no direct access to local variables. + + + + +

+


debug.gethook ([thread])

+ + +

+Returns the current hook settings of the thread, as three values: +the current hook function, the current hook mask, +and the current hook count +(as set by the debug.sethook function). + + + + +

+


debug.getinfo ([thread,] f [, what])

+ + +

+Returns a table with information about a function. +You can give the function directly +or you can give a number as the value of f, +which means the function running at level f of the call stack +of the given thread: +level 0 is the current function (getinfo itself); +level 1 is the function that called getinfo +(except for tail calls, which do not count on the stack); +and so on. +If f is a number larger than the number of active functions, +then getinfo returns nil. + + +

+The returned table can contain all the fields returned by lua_getinfo, +with the string what describing which fields to fill in. +The default for what is to get all information available, +except the table of valid lines. +If present, +the option 'f' +adds a field named func with the function itself. +If present, +the option 'L' +adds a field named activelines with the table of +valid lines. + + +

+For instance, the expression debug.getinfo(1,"n").name returns +a name for the current function, +if a reasonable name can be found, +and the expression debug.getinfo(print) +returns a table with all available information +about the print function. + + + + +

+


debug.getlocal ([thread,] f, local)

+ + +

+This function returns the name and the value of the local variable +with index local of the function at level f of the stack. +This function accesses not only explicit local variables, +but also parameters, temporaries, etc. + + +

+The first parameter or local variable has index 1, and so on, +following the order that they are declared in the code, +counting only the variables that are active +in the current scope of the function. +Negative indices refer to vararg parameters; +-1 is the first vararg parameter. +The function returns nil if there is no variable with the given index, +and raises an error when called with a level out of range. +(You can call debug.getinfo to check whether the level is valid.) + + +

+Variable names starting with '(' (open parenthesis) +represent variables with no known names +(internal variables such as loop control variables, +and variables from chunks saved without debug information). + + +

+The parameter f may also be a function. +In that case, getlocal returns only the name of function parameters. + + + + +

+


debug.getmetatable (value)

+ + +

+Returns the metatable of the given value +or nil if it does not have a metatable. + + + + +

+


debug.getregistry ()

+ + +

+Returns the registry table (see §4.5). + + + + +

+


debug.getupvalue (f, up)

+ + +

+This function returns the name and the value of the upvalue +with index up of the function f. +The function returns nil if there is no upvalue with the given index. + + +

+Variable names starting with '(' (open parenthesis) +represent variables with no known names +(variables from chunks saved without debug information). + + + + +

+


debug.getuservalue (u)

+ + +

+Returns the Lua value associated to u. +If u is not a full userdata, +returns nil. + + + + +

+


debug.sethook ([thread,] hook, mask [, count])

+ + +

+Sets the given function as a hook. +The string mask and the number count describe +when the hook will be called. +The string mask may have any combination of the following characters, +with the given meaning: + +

    +
  • 'c': the hook is called every time Lua calls a function;
  • +
  • 'r': the hook is called every time Lua returns from a function;
  • +
  • 'l': the hook is called every time Lua enters a new line of code.
  • +

+Moreover, +with a count different from zero, +the hook is called also after every count instructions. + + +

+When called without arguments, +debug.sethook turns off the hook. + + +

+When the hook is called, its first parameter is a string +describing the event that has triggered its call: +"call" (or "tail call"), +"return", +"line", and "count". +For line events, +the hook also gets the new line number as its second parameter. +Inside a hook, +you can call getinfo with level 2 to get more information about +the running function +(level 0 is the getinfo function, +and level 1 is the hook function). + + + + +

+


debug.setlocal ([thread,] level, local, value)

+ + +

+This function assigns the value value to the local variable +with index local of the function at level level of the stack. +The function returns nil if there is no local +variable with the given index, +and raises an error when called with a level out of range. +(You can call getinfo to check whether the level is valid.) +Otherwise, it returns the name of the local variable. + + +

+See debug.getlocal for more information about +variable indices and names. + + + + +

+


debug.setmetatable (value, table)

+ + +

+Sets the metatable for the given value to the given table +(which can be nil). +Returns value. + + + + +

+


debug.setupvalue (f, up, value)

+ + +

+This function assigns the value value to the upvalue +with index up of the function f. +The function returns nil if there is no upvalue +with the given index. +Otherwise, it returns the name of the upvalue. + + + + +

+


debug.setuservalue (udata, value)

+ + +

+Sets the given value as +the Lua value associated to the given udata. +udata must be a full userdata. + + +

+Returns udata. + + + + +

+


debug.traceback ([thread,] [message [, level]])

+ + +

+If message is present but is neither a string nor nil, +this function returns message without further processing. +Otherwise, +it returns a string with a traceback of the call stack. +The optional message string is appended +at the beginning of the traceback. +An optional level number tells at which level +to start the traceback +(default is 1, the function calling traceback). + + + + +

+


debug.upvalueid (f, n)

+ + +

+Returns a unique identifier (as a light userdata) +for the upvalue numbered n +from the given function. + + +

+These unique identifiers allow a program to check whether different +closures share upvalues. +Lua closures that share an upvalue +(that is, that access a same external local variable) +will return identical ids for those upvalue indices. + + + + +

+


debug.upvaluejoin (f1, n1, f2, n2)

+ + +

+Make the n1-th upvalue of the Lua closure f1 +refer to the n2-th upvalue of the Lua closure f2. + + + + + + + +

7 – Lua Standalone

+ +

+Although Lua has been designed as an extension language, +to be embedded in a host C program, +it is also frequently used as a standalone language. +An interpreter for Lua as a standalone language, +called simply lua, +is provided with the standard distribution. +The standalone interpreter includes +all standard libraries, including the debug library. +Its usage is: + +

+     lua [options] [script [args]]
+

+The options are: + +

    +
  • -e stat: executes string stat;
  • +
  • -l mod: "requires" mod;
  • +
  • -i: enters interactive mode after running script;
  • +
  • -v: prints version information;
  • +
  • -E: ignores environment variables;
  • +
  • --: stops handling options;
  • +
  • -: executes stdin as a file and stops handling options.
  • +

+After handling its options, lua runs the given script. +When called without arguments, +lua behaves as lua -v -i +when the standard input (stdin) is a terminal, +and as lua - otherwise. + + +

+When called without option -E, +the interpreter checks for an environment variable LUA_INIT_5_3 +(or LUA_INIT if the versioned name is not defined) +before running any argument. +If the variable content has the format @filename, +then lua executes the file. +Otherwise, lua executes the string itself. + + +

+When called with option -E, +besides ignoring LUA_INIT, +Lua also ignores +the values of LUA_PATH and LUA_CPATH, +setting the values of +package.path and package.cpath +with the default paths defined in luaconf.h. + + +

+All options are handled in order, except -i and -E. +For instance, an invocation like + +

+     $ lua -e'a=1' -e 'print(a)' script.lua
+

+will first set a to 1, then print the value of a, +and finally run the file script.lua with no arguments. +(Here $ is the shell prompt. Your prompt may be different.) + + +

+Before running any code, +lua collects all command-line arguments +in a global table called arg. +The script name goes to index 0, +the first argument after the script name goes to index 1, +and so on. +Any arguments before the script name +(that is, the interpreter name plus its options) +go to negative indices. +For instance, in the call + +

+     $ lua -la b.lua t1 t2
+

+the table is like this: + +

+     arg = { [-2] = "lua", [-1] = "-la",
+             [0] = "b.lua",
+             [1] = "t1", [2] = "t2" }
+

+If there is no script in the call, +the interpreter name goes to index 0, +followed by the other arguments. +For instance, the call + +

+     $ lua -e "print(arg[1])"
+

+will print "-e". +If there is a script, +the script is called with parameters +arg[1], ···, arg[#arg]. +(Like all chunks in Lua, +the script is compiled as a vararg function.) + + +

+In interactive mode, +Lua repeatedly prompts and waits for a line. +After reading a line, +Lua first try to interpret the line as an expression. +If it succeeds, it prints its value. +Otherwise, it interprets the line as a statement. +If you write an incomplete statement, +the interpreter waits for its completion +by issuing a different prompt. + + +

+If the global variable _PROMPT contains a string, +then its value is used as the prompt. +Similarly, if the global variable _PROMPT2 contains a string, +its value is used as the secondary prompt +(issued during incomplete statements). + + +

+In case of unprotected errors in the script, +the interpreter reports the error to the standard error stream. +If the error object is not a string but +has a metamethod __tostring, +the interpreter calls this metamethod to produce the final message. +Otherwise, the interpreter converts the error object to a string +and adds a stack traceback to it. + + +

+When finishing normally, +the interpreter closes its main Lua state +(see lua_close). +The script can avoid this step by +calling os.exit to terminate. + + +

+To allow the use of Lua as a +script interpreter in Unix systems, +the standalone interpreter skips +the first line of a chunk if it starts with #. +Therefore, Lua scripts can be made into executable programs +by using chmod +x and the #! form, +as in + +

+     #!/usr/local/bin/lua
+

+(Of course, +the location of the Lua interpreter may be different in your machine. +If lua is in your PATH, +then + +

+     #!/usr/bin/env lua
+

+is a more portable solution.) + + + +

8 – Incompatibilities with the Previous Version

+ +

+Here we list the incompatibilities that you may find when moving a program +from Lua 5.2 to Lua 5.3. +You can avoid some incompatibilities by compiling Lua with +appropriate options (see file luaconf.h). +However, +all these compatibility options will be removed in the future. + + +

+Lua versions can always change the C API in ways that +do not imply source-code changes in a program, +such as the numeric values for constants +or the implementation of functions as macros. +Therefore, +you should not assume that binaries are compatible between +different Lua versions. +Always recompile clients of the Lua API when +using a new version. + + +

+Similarly, Lua versions can always change the internal representation +of precompiled chunks; +precompiled chunks are not compatible between different Lua versions. + + +

+The standard paths in the official distribution may +change between versions. + + + +

8.1 – Changes in the Language

+
    + +
  • +The main difference between Lua 5.2 and Lua 5.3 is the +introduction of an integer subtype for numbers. +Although this change should not affect "normal" computations, +some computations +(mainly those that involve some kind of overflow) +can give different results. + + +

    +You can fix these differences by forcing a number to be a float +(in Lua 5.2 all numbers were float), +in particular writing constants with an ending .0 +or using x = x + 0.0 to convert a variable. +(This recommendation is only for a quick fix +for an occasional incompatibility; +it is not a general guideline for good programming. +For good programming, +use floats where you need floats +and integers where you need integers.) +

  • + +
  • +The conversion of a float to a string now adds a .0 suffix +to the result if it looks like an integer. +(For instance, the float 2.0 will be printed as 2.0, +not as 2.) +You should always use an explicit format +when you need a specific format for numbers. + + +

    +(Formally this is not an incompatibility, +because Lua does not specify how numbers are formatted as strings, +but some programs assumed a specific format.) +

  • + +
  • +The generational mode for the garbage collector was removed. +(It was an experimental feature in Lua 5.2.) +
  • + +
+ + + + +

8.2 – Changes in the Libraries

+
    + +
  • +The bit32 library has been deprecated. +It is easy to require a compatible external library or, +better yet, to replace its functions with appropriate bitwise operations. +(Keep in mind that bit32 operates on 32-bit integers, +while the bitwise operators in Lua 5.3 operate on Lua integers, +which by default have 64 bits.) +
  • + +
  • +The Table library now respects metamethods +for setting and getting elements. +
  • + +
  • +The ipairs iterator now respects metamethods and +its __ipairs metamethod has been deprecated. +
  • + +
  • +Option names in io.read do not have a starting '*' anymore. +For compatibility, Lua will continue to accept (and ignore) this character. +
  • + +
  • +The following functions were deprecated in the mathematical library: +atan2, cosh, sinh, tanh, pow, +frexp, and ldexp. +You can replace math.pow(x,y) with x^y; +you can replace math.atan2 with math.atan, +which now accepts one or two parameters; +you can replace math.ldexp(x,exp) with x * 2.0^exp. +For the other operations, +you can either use an external library or +implement them in Lua. +
  • + +
  • +The searcher for C loaders used by require +changed the way it handles versioned names. +Now, the version should come after the module name +(as is usual in most other tools). +For compatibility, that searcher still tries the old format +if it cannot find an open function according to the new style. +(Lua 5.2 already worked that way, +but it did not document the change.) +
  • + +
  • +The call collectgarbage("count") now returns only one result. +(You can compute that second result from the fractional part +of the first result.) +
  • + +
+ + + + +

8.3 – Changes in the API

+ + +
    + +
  • +Continuation functions now receive as parameters what they needed +to get through lua_getctx, +so lua_getctx has been removed. +Adapt your code accordingly. +
  • + +
  • +Function lua_dump has an extra parameter, strip. +Use 0 as the value of this parameter to get the old behavior. +
  • + +
  • +Functions to inject/project unsigned integers +(lua_pushunsigned, lua_tounsigned, lua_tounsignedx, +luaL_checkunsigned, luaL_optunsigned) +were deprecated. +Use their signed equivalents with a type cast. +
  • + +
  • +Macros to project non-default integer types +(luaL_checkint, luaL_optint, luaL_checklong, luaL_optlong) +were deprecated. +Use their equivalent over lua_Integer with a type cast +(or, when possible, use lua_Integer in your code). +
  • + +
+ + + + +

9 – The Complete Syntax of Lua

+ +

+Here is the complete syntax of Lua in extended BNF. +As usual in extended BNF, +{A} means 0 or more As, +and [A] means an optional A. +(For operator precedences, see §3.4.8; +for a description of the terminals +Name, Numeral, +and LiteralString, see §3.1.) + + + + +

+
+	chunk ::= block
+
+	block ::= {stat} [retstat]
+
+	stat ::=  ‘;’ | 
+		 varlist ‘=’ explist | 
+		 functioncall | 
+		 label | 
+		 break | 
+		 goto Name | 
+		 do block end | 
+		 while exp do block end | 
+		 repeat block until exp | 
+		 if exp then block {elseif exp then block} [else block] end | 
+		 for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 
+		 for namelist in explist do block end | 
+		 function funcname funcbody | 
+		 local function Name funcbody | 
+		 local namelist [‘=’ explist] 
+
+	retstat ::= return [explist] [‘;’]
+
+	label ::= ‘::’ Name ‘::’
+
+	funcname ::= Name {‘.’ Name} [‘:’ Name]
+
+	varlist ::= var {‘,’ var}
+
+	var ::=  Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name 
+
+	namelist ::= Name {‘,’ Name}
+
+	explist ::= exp {‘,’ exp}
+
+	exp ::=  nil | false | true | Numeral | LiteralString | ‘...’ | functiondef | 
+		 prefixexp | tableconstructor | exp binop exp | unop exp 
+
+	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
+
+	functioncall ::=  prefixexp args | prefixexp ‘:’ Name args 
+
+	args ::=  ‘(’ [explist] ‘)’ | tableconstructor | LiteralString 
+
+	functiondef ::= function funcbody
+
+	funcbody ::= ‘(’ [parlist] ‘)’ block end
+
+	parlist ::= namelist [‘,’ ‘...’] | ‘...’
+
+	tableconstructor ::= ‘{’ [fieldlist] ‘}’
+
+	fieldlist ::= field {fieldsep field} [fieldsep]
+
+	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
+
+	fieldsep ::= ‘,’ | ‘;’
+
+	binop ::=  ‘+’ | ‘-’ | ‘*’ | ‘/’ | ‘//’ | ‘^’ | ‘%’ | 
+		 ‘&’ | ‘~’ | ‘|’ | ‘>>’ | ‘<<’ | ‘..’ | 
+		 ‘<’ | ‘<=’ | ‘>’ | ‘>=’ | ‘==’ | ‘~=’ | 
+		 and | or
+
+	unop ::= ‘-’ | not | ‘#’ | ‘~’
+
+
+ +

+ + + + + + + +

+ + + + diff --git a/deps/rcheevos/test/lua/doc/osi-certified-72x60.png b/deps/rcheevos/test/lua/doc/osi-certified-72x60.png new file mode 100644 index 0000000000000000000000000000000000000000..07df5f6ee7a7a8b2108025dcd815f73f145a83af GIT binary patch literal 3774 zcmV;v4ngsWP)$kl5 zqcT7g&?zu8?ezWYz4zUB-|zR9d+&Qy2xAN{qY(ew0A7^*gV^7jytKqPFV3{hZfovn zs%x!l>(m&Gdb8C+5XeR7>h0kj=o=X3A39;2KLYfEMt>p1YMW~dt`rpAC{lN~P>5pq zH1L4nAdCT17}*hN=LnEsvMl=5Ij^QArAa&_V~zoht-Ei~)E~(Ivhe0#jik{t$isEK znCH$TxCB8EKmcF>3@pRaHpbR%Gqm*dsZA4H{j(NjZFp^iNFW+RBx6R*X19J*`0XG5 z^Y>cR=^Hi9#ovYGlbFSr#Q*^PgCGC^gb*SC5TcBfzQLe-r2m!Quik&_g9XzTj0qSR zD`FkG_RYWDa^+#UUxL&t+!K+&(ion@Fd`5l5p7{Qsva9vegC|4^NzJUMvn)^gqWsF zvu^j=%FfCVg^cgbXDRl1DE$lsfe;BjjmFmRHER~E-MeWoNsyyNHCpG%Y}igd_(Md;&9La8_B075NDRX9gTD zIHY`}9E~aGi9Kk1@P~rmPna=*=gz~UTdTpsQmjX)J23%v9NliQS)8`xJh6Qz_nE~e z&tP|!dcJdo;JMNa3>afSx$lko8>fp-I}OiCVz(dOF1u6e8$IrsSP?=5mp~lkaFqm? zAUMxRq%ecIu3WE)Uf=%p8g z+RSY?G=VO%wAfdICj?Uzb+5jr{8m|)i#{M}JjaDIoXf#1=DYLwX;1EW&sijPvm6EkBGuOx6r~lKv`g`yH?)|&PRUr$5Ibw2HBM7C74XvE@gaPjN+@;j$J)AgYhnT-U5m+wj|Wz8K630AfO8PUoGD^^Mcq zY9C<~%wUm^u%ox5P21)KNN0$(v^OI$A~?iwsS_fRu1+`EH|CRdpA4zsk8Z#|?x@^vVEAL+2JxH%&^{JUU%B=?EU7`Ar*Q|JvqPofcBt765(*f5JI$>=3{<%K)4ei zogo$)5XP}_X$y^pIYyWTt}EAnhTq}u4sAdBvC(WC{I#x4^>$vCvQ0UDs^18sAQG9o zEaP0qjrSSv1W0FyO%9&y$@em~n@8}}EXBG6x%ew49J_q%l@As_XnNpi|MTTPr~ca_ zW%uon6dBKL*pvzYFvf<~p6K8hK9BDNNN0$7xp^hWC3n^7FoQ?P(=m(6!Pj&S2f1fqH=`(w)KcPl5aEi2}~4hF*f*g}vaS-=c7v>N8c z{yNM*%+azq=@prWtgpi~^3?^AsJqS(>=pb=6PrGH#=O{Hcho$_F#MtsK$$3e2fZvg zy}!-V%`+uFMOW87LIgu3vKuMgqwY0}*Sd;aokQp(F#-{}Ss(Iy1iekY1ZQX?1WEL? z7=zq`lH-#Hw=bHRio3yPun%`c5rI1Hb|wTSWTs|12Mg#QkkwTmy zAYul0H*_b(BnkP#!R_&p@d54uz0JKthGv3C^fdKS%~alookE`QX@%#MQN2=SFWrOha7Ij7ImStNaWsy~? zsylUeT02_-z-G4s0L!v=+Wx|cxr$tmY&$a1by8z#6HBp!*9{@mU9XQ0h@L%V_R}4g z&s#2{MCOj4`5ux-SUautC5@{U895o-biKMWWoQ09{|jx8wz}@_(ep%Yk4{90C#s6-sa}fU5{}m>#>VtE_b#5bn8O+3k{&6GoEkB;yGie;A_5Uy zqPN*tU()pE+_&~``5XX({el-xT_}%`%fsc>_0@m5{+FhXru>rpyLESe31R>cK^FFrCm+#WL$-D{Z3*9>Lg{wi}xEYn_`@Hy`-d z1N}kIY%@Eu&Bpe|Rr6N;%Yk>6&RI$lgpIO26BYT%C!dU-o4bqqQpGY?p6lPru6Hzc z@WuSDI^BYaDH*>R)~)$V1J0Edn4r(9vo>E<2XjOJr2*G124;t^U+p{iUnZN5oapCpCk(F}}<#3ZZli!Nk z^UWT;Q9qm-i`i$kJS}5P%puBJ<&krTO;*#$Y7d$o96EbQ{aF1XFpTj}wf}eI|IOba z%w}_CWu?JjkV>U-ad9L$@Mu$CU;pUQBZgt5QmI@n=W@9K(A(SF-rnxzy|_!5ekKqCQTad`sa|&&Q6jfy}iAEst?|mH*emIjg9SB zRVWlHl?r3bvh2qnf6V6(+>4TulB%kzFveeh{k1?K*t&J=m>dk9P8SjqQdn4sF;*&- z(b3VFnVH$y*$Rb%rs zefJ#z#KpyZ_0?C$jvY%)O?7a?7#}%u1OT>d*)keF*REZ=c=4j6tkr5MilS*cB_$;< zFArmEv)Oby-7}4>TD9uE_ulKT4s6Bp@^Y0*rBEo&o;?cy8#Zi^%jH+DTv4f1SFc_L zfc5LwXJ=;vKt@K!?%liR&!6Almmq$2R@G|tg$oyGnpP+jQBhF<(9qCOR8%AuiBtJCSc zyu1LQw6wIQre^Zw$^E0N)#}R1%J}$rkw`Qc#z0A{)dIkjDN`I(PfyS2=x9f~R4N64 zPe1*1=gytQ#l=RWao4V0bLY-=?Bpl*dQDA@LZMJ9l{Gar$;rvzfB$`Tb#+==T0=ua zSy@?1N{UXWyL9Q&#*G`Zv$GE#JXljxBauj2T3VD!rO9N<%F3#*uP-Sn(P%W=w{Jgx z{(NC!VNOmC0OaN6ZQHg@tJQw^;fGtdZUulVSFX&NGv~~iGoO9-nNq0~2n78w23E{L zmth7T3|W>10ISuSm6cUgRCMXmr5!tV0D!x@`?6)rcI?<8lgZ#IIehqVOiYYpi@x#3 z8xau^+1c4ER;th&( zVHk--A`l3|!os9dsYatANm8TH96x@%qM{-&FmUtc&2qVX-MV%A_U(J~%{TY#*<&ym zX3Ur|c$No?u%e>k#EBDaZEY7XUVLH`0zh|n zw_~XRz;RH!y1MS)zn_X$Km70mNs@ZKo~G$z$BuD09F}FpVzEY}F&d2ug#rLPJUpgPpKh}a^y$-i zJl@%}XHT6vRaaNHckf=MQYn>6Fk&*D<+ja0B z5C{a#&CQN-V`HPyXe3EeAP~gH#>U3RayT5ZSd1}tbaaSNDAZ^)j%n&QHMoE=7KubA zlWEeVNpiV7Dk=&gzM|0Dz(>0HA5Q-_F}_znz(xxqbU~E|+`a#EH|V zPjA|^DJLg~rs?+f_6rv-T)upnAP7fChoq;cFJHcV=gyt)zWXjs(+gZ<%kMDTlOd1+TFW%&z(D`)oKF*0@Bmd zLqkIy?RvewprGK+ojWv5%Ve?@D^>&r1p$CcrMhuv}x1&joiO~|IC>)G) + + +Lua 5.3 readme + + + + + + + +

+Lua +Welcome to Lua 5.3 +

+ + + +

About Lua

+

+Lua is a powerful, fast, lightweight, embeddable scripting language +developed by a +team +at +PUC-Rio, +the Pontifical Catholic University of Rio de Janeiro in Brazil. +Lua is +free software +used in many products and projects around the world. + +

+Lua's +official web site +provides complete information +about Lua, +including +an +executive summary +and +updated +documentation, +especially the +reference manual, +which may differ slightly from the +local copy +distributed in this package. + +

Installing Lua

+

+Lua is distributed in +source +form. +You need to build it before using it. +Building Lua should be straightforward +because +Lua is implemented in pure ANSI C and compiles unmodified in all known +platforms that have an ANSI C compiler. +Lua also compiles unmodified as C++. +The instructions given below for building Lua are for Unix-like platforms. +See also +instructions for other systems +and +customization options. + +

+If you don't have the time or the inclination to compile Lua yourself, +get a binary from +LuaBinaries. +Try also +LuaDist, +a multi-platform distribution of Lua that includes batteries. + +

Building Lua

+

+In most Unix-like platforms, simply do "make" with a suitable target. +Here are the details. + +

    +
  1. +Open a terminal window and move to +the top-level directory, which is named lua-5.3.x. +The Makefile there controls both the build process and the installation process. +

    +

  2. + Do "make" and see if your platform is listed. + The platforms currently supported are: +

    +

    + aix bsd c89 freebsd generic linux macosx mingw posix solaris +

    +

    + If your platform is listed, just do "make xxx", where xxx + is your platform name. +

    + If your platform is not listed, try the closest one or posix, generic, + c89, in this order. +

    +

  3. +The compilation takes only a few moments +and produces three files in the src directory: +lua (the interpreter), +luac (the compiler), +and liblua.a (the library). +

    +

  4. + To check that Lua has been built correctly, do "make test" + after building Lua. This will run the interpreter and print its version. +
+

+If you're running Linux and get compilation errors, +make sure you have installed the readline development package +(which is probably named libreadline-dev or readline-devel). +If you get link errors after that, +then try "make linux MYLIBS=-ltermcap". + +

Installing Lua

+

+ Once you have built Lua, you may want to install it in an official + place in your system. In this case, do "make install". The official + place and the way to install files are defined in the Makefile. You'll + probably need the right permissions to install files. + +

+ To build and install Lua in one step, do "make xxx install", + where xxx is your platform name. + +

+ To install Lua locally, do "make local". + This will create a directory install with subdirectories + bin, include, lib, man, share, + and install Lua as listed below. + + To install Lua locally, but in some other directory, do + "make install INSTALL_TOP=xxx", where xxx is your chosen directory. + The installation starts in the src and doc directories, + so take care if INSTALL_TOP is not an absolute path. + +

+
+ bin: +
+ lua luac +
+ include: +
+ lua.h luaconf.h lualib.h lauxlib.h lua.hpp +
+ lib: +
+ liblua.a +
+ man/man1: +
+ lua.1 luac.1 +
+ +

+ These are the only directories you need for development. + If you only want to run Lua programs, + you only need the files in bin and man. + The files in include and lib are needed for + embedding Lua in C or C++ programs. + +

Customization

+

+ Three kinds of things can be customized by editing a file: +

    +
  • Where and how to install Lua — edit Makefile. +
  • How to build Lua — edit src/Makefile. +
  • Lua features — edit src/luaconf.h. +
+ +

+ You don't actually need to edit the Makefiles because you may set the + relevant variables in the command line when invoking make. + Nevertheless, it's probably best to edit and save the Makefiles to + record the changes you've made. + +

+ On the other hand, if you need to customize some Lua features, you'll need + to edit src/luaconf.h before building and installing Lua. + The edited file will be the one installed, and + it will be used by any Lua clients that you build, to ensure consistency. + Further customization is available to experts by editing the Lua sources. + +

Building Lua on other systems

+

+ If you're not using the usual Unix tools, then the instructions for + building Lua depend on the compiler you use. You'll need to create + projects (or whatever your compiler uses) for building the library, + the interpreter, and the compiler, as follows: + +

+
+library: +
+lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c +lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c +ltm.c lundump.c lvm.c lzio.c +lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c +lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c +
+interpreter: +
+ library, lua.c +
+compiler: +
+ library, luac.c +
+ +

+ To use Lua as a library in your own programs you'll need to know how to + create and use libraries with your compiler. Moreover, to dynamically load + C libraries for Lua you'll need to know how to create dynamic libraries + and you'll need to make sure that the Lua API functions are accessible to + those dynamic libraries — but don't link the Lua library + into each dynamic library. For Unix, we recommend that the Lua library + be linked statically into the host program and its symbols exported for + dynamic linking; src/Makefile does this for the Lua interpreter. + For Windows, we recommend that the Lua library be a DLL. + In all cases, the compiler luac should be linked statically. + +

+ As mentioned above, you may edit src/luaconf.h to customize + some features before building Lua. + +

Changes since Lua 5.2

+

+Here are the main changes introduced in Lua 5.3. +The +reference manual +lists the +incompatibilities that had to be introduced. + +

Main changes

+
    +
  • integers (64-bit by default) +
  • official support for 32-bit numbers +
  • bitwise operators +
  • basic utf-8 support +
  • functions for packing and unpacking values + +
+ +Here are the other changes introduced in Lua 5.3: +

Language

+
    +
  • userdata can have any Lua value as uservalue +
  • floor division +
  • more flexible rules for some metamethods +
+ +

Libraries

+
    +
  • ipairs and the table library respect metamethods +
  • strip option in string.dump +
  • table library respects metamethods +
  • new function table.move +
  • new function string.pack +
  • new function string.unpack +
  • new function string.packsize +
+ +

C API

+
    +
  • simpler API for continuation functions in C +
  • lua_gettable and similar functions return type of resulted value +
  • strip option in lua_dump +
  • new function: lua_geti +
  • new function: lua_seti +
  • new function: lua_isyieldable +
  • new function: lua_numbertointeger +
  • new function: lua_rotate +
  • new function: lua_stringtonumber +
+ +

Lua standalone interpreter

+
    +
  • can be used as calculator; no need to prefix with '=' +
  • arg table available to all code +
+ +

License

+

+ +[osi certified] + +Lua is free software distributed under the terms of the +MIT license +reproduced below; +it may be used for any purpose, including commercial purposes, +at absolutely no cost without having to ask us. + +The only requirement is that if you do use Lua, +then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. + +For details, see +this. + +

+Copyright © 1994–2017 Lua.org, PUC-Rio. + +

+Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +

+The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +

+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +

+

+ +

+ + + + diff --git a/deps/rcheevos/test/lua/src/Makefile b/deps/rcheevos/test/lua/src/Makefile new file mode 100644 index 0000000000..d71c75c873 --- /dev/null +++ b/deps/rcheevos/test/lua/src/Makefile @@ -0,0 +1,197 @@ +# Makefile for building Lua +# See ../doc/readme.html for installation and customization instructions. + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +CC= gcc -std=gnu99 +CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) +LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) +LIBS= -lm $(SYSLIBS) $(MYLIBS) + +AR= ar rcu +RANLIB= ranlib +RM= rm -f + +SYSCFLAGS= +SYSLDFLAGS= +SYSLIBS= + +MYCFLAGS= +MYLDFLAGS= +MYLIBS= +MYOBJS= + +# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + +PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris + +LUA_A= liblua.a +CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ + lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ + ltm.o lundump.o lvm.o lzio.o +LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \ + lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o +BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) + +LUA_T= lua +LUA_O= lua.o + +LUAC_T= luac +LUAC_O= luac.o + +ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_A= $(LUA_A) + +# Targets start here. +default: $(PLAT) + +all: $(ALL_T) + +o: $(ALL_O) + +a: $(ALL_A) + +$(LUA_A): $(BASE_O) + $(AR) $@ $(BASE_O) + $(RANLIB) $@ + +$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + +clean: + $(RM) $(ALL_T) $(ALL_O) + +depend: + @$(CC) $(CFLAGS) -MM l*.c + +echo: + @echo "PLAT= $(PLAT)" + @echo "CC= $(CC)" + @echo "CFLAGS= $(CFLAGS)" + @echo "LDFLAGS= $(SYSLDFLAGS)" + @echo "LIBS= $(LIBS)" + @echo "AR= $(AR)" + @echo "RANLIB= $(RANLIB)" + @echo "RM= $(RM)" + +# Convenience targets for popular platforms +ALL= all + +none: + @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" + @echo " $(PLATS)" + +aix: + $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" + +bsd: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" + +c89: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" + @echo '' + @echo '*** C89 does not guarantee 64-bit integers for Lua.' + @echo '' + + +freebsd: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" + +generic: $(ALL) + +linux: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" + +macosx: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc + +mingw: + $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ + "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe + $(MAKE) "LUAC_T=luac.exe" luac.exe + +posix: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" + +solaris: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) default o a clean depend echo none + +# DO NOT DELETE + +lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \ + ltable.h lundump.h lvm.h +lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h +lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ + llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ + ldo.h lgc.h lstring.h ltable.h lvm.h +lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h +ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \ + ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h +ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \ + lparser.h lstring.h ltable.h lundump.h lvm.h +ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ + ltm.h lzio.h lmem.h lundump.h +lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \ + lgc.h lstate.h ltm.h lzio.h lmem.h +lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h +linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h +liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \ + lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \ + lstring.h ltable.h +lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h +loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \ + ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \ + lvm.h +lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h +loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ + llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ + ldo.h lfunc.h lstring.h lgc.h ltable.h +lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \ + lstring.h ltable.h +lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ + lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h +lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h +ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h ltable.h lvm.h +lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h lobject.h llimits.h \ + lstate.h ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h +lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ + lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ + lundump.h +lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ + ltable.h lvm.h +lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ + lobject.h ltm.h lzio.h + +# (end of Makefile) diff --git a/deps/rcheevos/test/lua/src/lapi.c b/deps/rcheevos/test/lua/src/lapi.c new file mode 100644 index 0000000000..0097d070b2 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lapi.c @@ -0,0 +1,1298 @@ +/* +** $Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + +#define lapi_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$LuaVersion: " LUA_COPYRIGHT " $" + "$LuaAuthors: " LUA_AUTHORS " $"; + + +/* value at a non-valid index */ +#define NONVALIDVALUE cast(TValue *, luaO_nilobject) + +/* corresponding test */ +#define isvalid(o) ((o) != luaO_nilobject) + +/* test for pseudo index */ +#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX) + +/* test for upvalue */ +#define isupvalue(i) ((i) < LUA_REGISTRYINDEX) + +/* test for valid but not pseudo index */ +#define isstackindex(i, o) (isvalid(o) && !ispseudo(i)) + +#define api_checkvalidindex(l,o) api_check(l, isvalid(o), "invalid index") + +#define api_checkstackindex(l, i, o) \ + api_check(l, isstackindex(i, o), "index not in the stack") + + +static TValue *index2addr (lua_State *L, int idx) { + CallInfo *ci = L->ci; + if (idx > 0) { + TValue *o = ci->func + idx; + api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index"); + if (o >= L->top) return NONVALIDVALUE; + else return o; + } + else if (!ispseudo(idx)) { /* negative index */ + api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); + return L->top + idx; + } + else if (idx == LUA_REGISTRYINDEX) + return &G(L)->l_registry; + else { /* upvalues */ + idx = LUA_REGISTRYINDEX - idx; + api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); + if (ttislcf(ci->func)) /* light C function? */ + return NONVALIDVALUE; /* it has no upvalues */ + else { + CClosure *func = clCvalue(ci->func); + return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE; + } + } +} + + +/* +** to be called by 'lua_checkstack' in protected mode, to grow stack +** capturing memory errors +*/ +static void growstack (lua_State *L, void *ud) { + int size = *(int *)ud; + luaD_growstack(L, size); +} + + +LUA_API int lua_checkstack (lua_State *L, int n) { + int res; + CallInfo *ci = L->ci; + lua_lock(L); + api_check(L, n >= 0, "negative 'n'"); + if (L->stack_last - L->top > n) /* stack large enough? */ + res = 1; /* yes; check is OK */ + else { /* no; need to grow stack */ + int inuse = cast_int(L->top - L->stack) + EXTRC_STACK; + if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */ + res = 0; /* no */ + else /* try to grow stack */ + res = (luaD_rawrunprotected(L, &growstack, &n) == LUA_OK); + } + if (res && ci->top < L->top + n) + ci->top = L->top + n; /* adjust frame top */ + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to), "moving among independent states"); + api_check(from, to->ci->top - to->top >= n, "stack overflow"); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top, from->top + i); + to->top++; /* stack already checked by previous 'api_check' */ + } + lua_unlock(to); +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API const lua_Number *lua_version (lua_State *L) { + static const lua_Number version = LUA_VERSION_NUM; + if (L == NULL) return &version; + else return G(L)->version; +} + + + +/* +** basic stack manipulation +*/ + + +/* +** convert an acceptable stack index into an absolute index +*/ +LUA_API int lua_absindex (lua_State *L, int idx) { + return (idx > 0 || ispseudo(idx)) + ? idx + : cast_int(L->top - L->ci->func) + idx; +} + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - (L->ci->func + 1)); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + StkId func = L->ci->func; + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); + while (L->top < (func + 1) + idx) + setnilvalue(L->top++); + L->top = (func + 1) + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); + L->top += idx+1; /* 'subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +/* +** Reverse the stack segment from 'from' to 'to' +** (auxiliary to 'lua_rotate') +*/ +static void reverse (lua_State *L, StkId from, StkId to) { + for (; from < to; from++, to--) { + TValue temp; + setobj(L, &temp, from); + setobjs2s(L, from, to); + setobj2s(L, to, &temp); + } +} + + +/* +** Let x = AB, where A is a prefix of length 'n'. Then, +** rotate x n == BA. But BA == (A^r . B^r)^r. +*/ +LUA_API void lua_rotate (lua_State *L, int idx, int n) { + StkId p, t, m; + lua_lock(L); + t = L->top - 1; /* end of stack segment being rotated */ + p = index2addr(L, idx); /* start of segment */ + api_checkstackindex(L, idx, p); + api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); + m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ + reverse(L, p, m); /* reverse the prefix with length 'n' */ + reverse(L, m + 1, t); /* reverse the suffix */ + reverse(L, p, t); /* reverse the entire segment */ + lua_unlock(L); +} + + +LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { + TValue *fr, *to; + lua_lock(L); + fr = index2addr(L, fromidx); + to = index2addr(L, toidx); + api_checkvalidindex(L, to); + setobj(L, to, fr); + if (isupvalue(toidx)) /* function upvalue? */ + luaC_barrier(L, clCvalue(L->ci->func), fr); + /* LUA_REGISTRYINDEX does not need gc barrier + (collector revisits it before finishing collection) */ + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2addr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return (isvalid(o) ? ttnov(o) : LUA_TNONE); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + api_check(L, LUA_TNONE <= t && t < LUA_NUMTAGS, "invalid tag"); + return ttypename(t); +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return (ttislcf(o) || (ttisCclosure(o))); +} + + +LUA_API int lua_isinteger (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return ttisinteger(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + lua_Number n; + const TValue *o = index2addr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + const TValue *o = index2addr(L, idx); + return (ttisstring(o) || cvt2str(o)); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2addr(L, idx); + return (ttisfulluserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2addr(L, index1); + StkId o2 = index2addr(L, index2); + return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0; +} + + +LUA_API void lua_arith (lua_State *L, int op) { + lua_lock(L); + if (op != LUA_OPUNM && op != LUA_OPBNOT) + api_checknelems(L, 2); /* all other operations expect two operands */ + else { /* for unary operations, add fake 2nd operand */ + api_checknelems(L, 1); + setobjs2s(L, L->top, L->top - 1); + api_incr_top(L); + } + /* first operand at top - 2, second at top - 1; result go to top - 2 */ + luaO_arith(L, op, L->top - 2, L->top - 1, L->top - 2); + L->top--; /* remove second operand */ + lua_unlock(L); +} + + +LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { + StkId o1, o2; + int i = 0; + lua_lock(L); /* may call tag method */ + o1 = index2addr(L, index1); + o2 = index2addr(L, index2); + if (isvalid(o1) && isvalid(o2)) { + switch (op) { + case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; + case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; + case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; + default: api_check(L, 0, "invalid option"); + } + } + lua_unlock(L); + return i; +} + + +LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { + size_t sz = luaO_str2num(s, L->top); + if (sz != 0) + api_incr_top(L); + return sz; +} + + +LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum) { + lua_Number n; + const TValue *o = index2addr(L, idx); + int isnum = tonumber(o, &n); + if (!isnum) + n = 0; /* call to 'tonumber' may change 'n' even if it fails */ + if (pisnum) *pisnum = isnum; + return n; +} + + +LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum) { + lua_Integer res; + const TValue *o = index2addr(L, idx); + int isnum = tointeger(o, &res); + if (!isnum) + res = 0; /* call to 'tointeger' may change 'n' even if it fails */ + if (pisnum) *pisnum = isnum; + return res; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2addr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2addr(L, idx); + if (!ttisstring(o)) { + if (!cvt2str(o)) { /* not convertible? */ + if (len != NULL) *len = 0; + return NULL; + } + lua_lock(L); /* 'luaO_tostring' may create a new string */ + luaO_tostring(L, o); + luaC_checkGC(L); + o = index2addr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) + *len = vslen(o); + return svalue(o); +} + + +LUA_API size_t lua_rawlen (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + switch (ttype(o)) { + case LUA_TSHRSTR: return tsvalue(o)->shrlen; + case LUA_TLNGSTR: return tsvalue(o)->u.lnglen; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + if (ttislcf(o)) return fvalue(o); + else if (ttisCclosure(o)) + return clCvalue(o)->f; + else return NULL; /* not a C function */ +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + switch (ttnov(o)) { + case LUA_TUSERDATA: return getudatamem(uvalue(o)); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TLCL: return clLvalue(o); + case LUA_TCCL: return clCvalue(o); + case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: return getudatamem(uvalue(o)); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setfltvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setivalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +/* +** Pushes on the stack a string with given length. Avoid using 's' when +** 'len' == 0 (as 's' can be NULL in that case), due to later use of +** 'memcmp' and 'memcpy'. +*/ +LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { + TString *ts; + lua_lock(L); + ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); + setsvalue2s(L, L->top, ts); + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return getstr(ts); +} + + +LUA_API const char *lua_pushstring (lua_State *L, const char *s) { + lua_lock(L); + if (s == NULL) + setnilvalue(L->top); + else { + TString *ts; + ts = luaS_new(L, s); + setsvalue2s(L, L->top, ts); + s = getstr(ts); /* internal copy's address */ + } + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return s; +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + ret = luaO_pushvfstring(L, fmt, argp); + luaC_checkGC(L); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + luaC_checkGC(L); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + lua_lock(L); + if (n == 0) { + setfvalue(L->top, fn); + } + else { + CClosure *cl; + api_checknelems(L, n); + api_check(L, n <= MAXUPVAL, "upvalue index too large"); + cl = luaF_newCclosure(L, n); + cl->f = fn; + L->top -= n; + while (n--) { + setobj2n(L, &cl->upvalue[n], L->top + n); + /* does not need barrier because closure is white */ + } + setclCvalue(L, L->top, cl); + } + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +static int auxgetstr (lua_State *L, const TValue *t, const char *k) { + const TValue *slot; + TString *str = luaS_new(L, k); + if (luaV_fastget(L, t, str, slot, luaH_getstr)) { + setobj2s(L, L->top, slot); + api_incr_top(L); + } + else { + setsvalue2s(L, L->top, str); + api_incr_top(L); + luaV_finishget(L, t, L->top - 1, L->top - 1, slot); + } + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_getglobal (lua_State *L, const char *name) { + Table *reg = hvalue(&G(L)->l_registry); + lua_lock(L); + return auxgetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); +} + + +LUA_API int lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_getfield (lua_State *L, int idx, const char *k) { + lua_lock(L); + return auxgetstr(L, index2addr(L, idx), k); +} + + +LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { + StkId t; + const TValue *slot; + lua_lock(L); + t = index2addr(L, idx); + if (luaV_fastget(L, t, n, slot, luaH_getint)) { + setobj2s(L, L->top, slot); + api_incr_top(L); + } + else { + setivalue(L->top, n); + api_incr_top(L); + luaV_finishget(L, t, L->top - 1, L->top - 1, slot); + } + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + setobj2s(L, L->top, luaH_getint(hvalue(t), n)); + api_incr_top(L); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { + StkId t; + TValue k; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + setpvalue(&k, cast(void *, p)); + setobj2s(L, L->top, luaH_get(hvalue(t), &k)); + api_incr_top(L); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + Table *t; + lua_lock(L); + t = luaH_new(L); + sethvalue(L, L->top, t); + api_incr_top(L); + if (narray > 0 || nrec > 0) + luaH_resize(L, t, narray, nrec); + luaC_checkGC(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt; + int res = 0; + lua_lock(L); + obj = index2addr(L, objindex); + switch (ttnov(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttnov(obj)]; + break; + } + if (mt != NULL) { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API int lua_getuservalue (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2addr(L, idx); + api_check(L, ttisfulluserdata(o), "full userdata expected"); + getuservalue(L, uvalue(o), L->top); + api_incr_top(L); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +/* +** set functions (stack -> Lua) +*/ + +/* +** t[k] = value at the top of the stack (where 'k' is a string) +*/ +static void auxsetstr (lua_State *L, const TValue *t, const char *k) { + const TValue *slot; + TString *str = luaS_new(L, k); + api_checknelems(L, 1); + if (luaV_fastset(L, t, str, slot, luaH_getstr, L->top - 1)) + L->top--; /* pop value */ + else { + setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */ + api_incr_top(L); + luaV_finishset(L, t, L->top - 1, L->top - 2, slot); + L->top -= 2; /* pop value and key */ + } + lua_unlock(L); /* lock done by caller */ +} + + +LUA_API void lua_setglobal (lua_State *L, const char *name) { + Table *reg = hvalue(&G(L)->l_registry); + lua_lock(L); /* unlock done in 'auxsetstr' */ + auxsetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); +} + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2addr(L, idx); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + lua_lock(L); /* unlock done in 'auxsetstr' */ + auxsetstr(L, index2addr(L, idx), k); +} + + +LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { + StkId t; + const TValue *slot; + lua_lock(L); + api_checknelems(L, 1); + t = index2addr(L, idx); + if (luaV_fastset(L, t, n, slot, luaH_getint, L->top - 1)) + L->top--; /* pop value */ + else { + setivalue(L->top, n); + api_incr_top(L); + luaV_finishset(L, t, L->top - 1, L->top - 2, slot); + L->top -= 2; /* pop value and key */ + } + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId o; + TValue *slot; + lua_lock(L); + api_checknelems(L, 2); + o = index2addr(L, idx); + api_check(L, ttistable(o), "table expected"); + slot = luaH_set(L, hvalue(o), L->top - 2); + setobj2t(L, slot, L->top - 1); + invalidateTMcache(hvalue(o)); + luaC_barrierback(L, hvalue(o), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2addr(L, idx); + api_check(L, ttistable(o), "table expected"); + luaH_setint(L, hvalue(o), n, L->top - 1); + luaC_barrierback(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { + StkId o; + TValue k, *slot; + lua_lock(L); + api_checknelems(L, 1); + o = index2addr(L, idx); + api_check(L, ttistable(o), "table expected"); + setpvalue(&k, cast(void *, p)); + slot = luaH_set(L, hvalue(o), &k); + setobj2t(L, slot, L->top - 1); + luaC_barrierback(L, hvalue(o), L->top - 1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2addr(L, objindex); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1), "table expected"); + mt = hvalue(L->top - 1); + } + switch (ttnov(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) { + luaC_objbarrier(L, gcvalue(obj), mt); + luaC_checkfinalizer(L, gcvalue(obj), mt); + } + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) { + luaC_objbarrier(L, uvalue(obj), mt); + luaC_checkfinalizer(L, gcvalue(obj), mt); + } + break; + } + default: { + G(L)->mt[ttnov(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API void lua_setuservalue (lua_State *L, int idx) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2addr(L, idx); + api_check(L, ttisfulluserdata(o), "full userdata expected"); + setuservalue(L, uvalue(o), L->top - 1); + luaC_barrier(L, gcvalue(o), L->top - 1); + L->top--; + lua_unlock(L); +} + + +/* +** 'load' and 'call' functions (run Lua code) +*/ + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ + "results from function overflow current stack size") + + +LUA_API void lua_callk (lua_State *L, int nargs, int nresults, + lua_KContext ctx, lua_KFunction k) { + StkId func; + lua_lock(L); + api_check(L, k == NULL || !isLua(L->ci), + "cannot use continuations inside hooks"); + api_checknelems(L, nargs+1); + api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ + L->ci->u.c.k = k; /* save continuation */ + L->ci->u.c.ctx = ctx; /* save context */ + luaD_call(L, func, nresults); /* do the call */ + } + else /* no continuation or no yieldable */ + luaD_callnoyield(L, func, nresults); /* just do the call */ + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to 'f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_callnoyield(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, + lua_KContext ctx, lua_KFunction k) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_check(L, k == NULL || !isLua(L->ci), + "cannot use continuations inside hooks"); + api_checknelems(L, nargs+1); + api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2addr(L, errfunc); + api_checkstackindex(L, errfunc, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */ + c.nresults = nresults; /* do a 'conventional' protected call */ + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + } + else { /* prepare continuation (call is already protected by 'resume') */ + CallInfo *ci = L->ci; + ci->u.c.k = k; /* save continuation */ + ci->u.c.ctx = ctx; /* save context */ + /* save information for error recovery */ + ci->extra = savestack(L, c.func); + ci->u.c.old_errfunc = L->errfunc; + L->errfunc = func; + setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */ + ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ + luaD_call(L, c.func, nresults); /* do the call */ + ci->callstatus &= ~CIST_YPCALL; + L->errfunc = ci->u.c.old_errfunc; + status = LUA_OK; /* if it is here, there were no errors */ + } + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname, const char *mode) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname, mode); + if (status == LUA_OK) { /* no errors? */ + LClosure *f = clLvalue(L->top - 1); /* get newly created function */ + if (f->nupvalues >= 1) { /* does it have an upvalue? */ + /* get global table from registry */ + Table *reg = hvalue(&G(L)->l_registry); + const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS); + /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ + setobj(L, f->upvals[0]->v, gt); + luaC_upvalbarrier(L, f->upvals[0]); + } + } + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, getproto(o), writer, data, strip); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->gcrunning = 0; + break; + } + case LUA_GCRESTART: { + luaE_setdebt(g, 0); + g->gcrunning = 1; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L, 0); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(gettotalbytes(g) >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(gettotalbytes(g) & 0x3ff); + break; + } + case LUA_GCSTEP: { + l_mem debt = 1; /* =1 to signal that it did an actual step */ + lu_byte oldrunning = g->gcrunning; + g->gcrunning = 1; /* allow GC to run */ + if (data == 0) { + luaE_setdebt(g, -GCSTEPSIZE); /* to do a "small" step */ + luaC_step(L); + } + else { /* add 'data' to total debt */ + debt = cast(l_mem, data) * 1024 + g->GCdebt; + luaE_setdebt(g, debt); + luaC_checkGC(L); + } + g->gcrunning = oldrunning; /* restore previous state */ + if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ + res = 1; /* signal it */ + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + if (data < 40) data = 40; /* avoid ridiculous low values (and 0) */ + g->gcstepmul = data; + break; + } + case LUA_GCISRUNNING: { + res = g->gcrunning; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + /* code unreachable; will unlock when control actually leaves the kernel */ + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaV_concat(L, n); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + luaC_checkGC(L); + lua_unlock(L); +} + + +LUA_API void lua_len (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + luaV_objlen(L, L->top, t); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + u = luaS_newudata(L, size); + setuvalue(L, L->top, u); + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return getudatamem(u); +} + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val, + CClosure **owner, UpVal **uv) { + switch (ttype(fi)) { + case LUA_TCCL: { /* C closure */ + CClosure *f = clCvalue(fi); + if (!(1 <= n && n <= f->nupvalues)) return NULL; + *val = &f->upvalue[n-1]; + if (owner) *owner = f; + return ""; + } + case LUA_TLCL: { /* Lua closure */ + LClosure *f = clLvalue(fi); + TString *name; + Proto *p = f->p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->upvals[n-1]->v; + if (uv) *uv = f->upvals[n - 1]; + name = p->upvalues[n-1].name; + return (name == NULL) ? "(*no name)" : getstr(name); + } + default: return NULL; /* not a closure */ + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val = NULL; /* to avoid warnings */ + lua_lock(L); + name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL, NULL); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val = NULL; /* to avoid warnings */ + CClosure *owner = NULL; + UpVal *uv = NULL; + StkId fi; + lua_lock(L); + fi = index2addr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val, &owner, &uv); + if (name) { + L->top--; + setobj(L, val, L->top); + if (owner) { luaC_barrier(L, owner, L->top); } + else if (uv) { luaC_upvalbarrier(L, uv); } + } + lua_unlock(L); + return name; +} + + +static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { + LClosure *f; + StkId fi = index2addr(L, fidx); + api_check(L, ttisLclosure(fi), "Lua function expected"); + f = clLvalue(fi); + api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); + if (pf) *pf = f; + return &f->upvals[n - 1]; /* get its upvalue pointer */ +} + + +LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { + StkId fi = index2addr(L, fidx); + switch (ttype(fi)) { + case LUA_TLCL: { /* lua closure */ + return *getupvalref(L, fidx, n, NULL); + } + case LUA_TCCL: { /* C closure */ + CClosure *f = clCvalue(fi); + api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); + return &f->upvalue[n - 1]; + } + default: { + api_check(L, 0, "closure expected"); + return NULL; + } + } +} + + +LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, + int fidx2, int n2) { + LClosure *f1; + UpVal **up1 = getupvalref(L, fidx1, n1, &f1); + UpVal **up2 = getupvalref(L, fidx2, n2, NULL); + luaC_upvdeccount(L, *up1); + *up1 = *up2; + (*up1)->refcount++; + if (upisopen(*up1)) (*up1)->u.open.touched = 1; + luaC_upvalbarrier(L, *up1); +} + + diff --git a/deps/rcheevos/test/lua/src/lapi.h b/deps/rcheevos/test/lua/src/lapi.h new file mode 100644 index 0000000000..6d36dee3fb --- /dev/null +++ b/deps/rcheevos/test/lua/src/lapi.h @@ -0,0 +1,24 @@ +/* +** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "llimits.h" +#include "lstate.h" + +#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ + "stack overflow");} + +#define adjustresults(L,nres) \ + { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } + +#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ + "not enough elements in the stack") + + +#endif diff --git a/deps/rcheevos/test/lua/src/lauxlib.c b/deps/rcheevos/test/lua/src/lauxlib.c new file mode 100644 index 0000000000..f7a383663e --- /dev/null +++ b/deps/rcheevos/test/lua/src/lauxlib.c @@ -0,0 +1,1043 @@ +/* +** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include + + +/* +** This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#include "lua.h" + +#include "lauxlib.h" + + +/* +** {====================================================== +** Traceback +** ======================================================= +*/ + + +#define LEVELS1 10 /* size of the first part of the stack */ +#define LEVELS2 11 /* size of the second part of the stack */ + + + +/* +** search for 'objidx' in table at index -1. +** return 1 + string at top if find a good name. +*/ +static int findfield (lua_State *L, int objidx, int level) { + if (level == 0 || !lua_istable(L, -1)) + return 0; /* not found */ + lua_pushnil(L); /* start 'next' loop */ + while (lua_next(L, -2)) { /* for each pair in table */ + if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ + if (lua_rawequal(L, objidx, -1)) { /* found object? */ + lua_pop(L, 1); /* remove value (but keep name) */ + return 1; + } + else if (findfield(L, objidx, level - 1)) { /* try recursively */ + lua_remove(L, -2); /* remove table (but keep name) */ + lua_pushliteral(L, "."); + lua_insert(L, -2); /* place '.' between the two names */ + lua_concat(L, 3); + return 1; + } + } + lua_pop(L, 1); /* remove value */ + } + return 0; /* not found */ +} + + +/* +** Search for a name for a function in all loaded modules +*/ +static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { + int top = lua_gettop(L); + lua_getinfo(L, "f", ar); /* push function */ + lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + if (findfield(L, top + 1, 2)) { + const char *name = lua_tostring(L, -1); + if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ + lua_pushstring(L, name + 3); /* push name without prefix */ + lua_remove(L, -2); /* remove original name */ + } + lua_copy(L, -1, top + 1); /* move name to proper place */ + lua_pop(L, 2); /* remove pushed values */ + return 1; + } + else { + lua_settop(L, top); /* remove function and global table */ + return 0; + } +} + + +static void pushfuncname (lua_State *L, lua_Debug *ar) { + if (pushglobalfuncname(L, ar)) { /* try first a global name */ + lua_pushfstring(L, "function '%s'", lua_tostring(L, -1)); + lua_remove(L, -2); /* remove name */ + } + else if (*ar->namewhat != '\0') /* is there a name from code? */ + lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */ + else if (*ar->what == 'm') /* main? */ + lua_pushliteral(L, "main chunk"); + else if (*ar->what != 'C') /* for Lua functions, use */ + lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); + else /* nothing left... */ + lua_pushliteral(L, "?"); +} + + +static int lastlevel (lua_State *L) { + lua_Debug ar; + int li = 1, le = 1; + /* find an upper bound */ + while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } + /* do a binary search */ + while (li < le) { + int m = (li + le)/2; + if (lua_getstack(L, m, &ar)) li = m + 1; + else le = m; + } + return le - 1; +} + + +LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, + const char *msg, int level) { + lua_Debug ar; + int top = lua_gettop(L); + int last = lastlevel(L1); + int n1 = (last - level > LEVELS1 + LEVELS2) ? LEVELS1 : -1; + if (msg) + lua_pushfstring(L, "%s\n", msg); + luaL_checkstack(L, 10, NULL); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (n1-- == 0) { /* too many levels? */ + lua_pushliteral(L, "\n\t..."); /* add a '...' */ + level = last - LEVELS2 + 1; /* and skip to last ones */ + } + else { + lua_getinfo(L1, "Slnt", &ar); + lua_pushfstring(L, "\n\t%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + lua_pushliteral(L, " in "); + pushfuncname(L, &ar); + if (ar.istailcall) + lua_pushliteral(L, "\n\t(...tail calls...)"); + lua_concat(L, lua_gettop(L) - top); + } + } + lua_concat(L, lua_gettop(L) - top); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + +LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + arg--; /* do not count 'self' */ + if (arg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling '%s' on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; + return luaL_error(L, "bad argument #%d to '%s' (%s)", + arg, ar.name, extramsg); +} + + +static int typeerror (lua_State *L, int arg, const char *tname) { + const char *msg; + const char *typearg; /* name for the type of the actual argument */ + if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING) + typearg = lua_tostring(L, -1); /* use the given type name */ + else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) + typearg = "light userdata"; /* special name for messages */ + else + typearg = luaL_typename(L, arg); /* standard name */ + msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); + return luaL_argerror(L, arg, msg); +} + + +static void tag_error (lua_State *L, int arg, int tag) { + typeerror(L, arg, lua_typename(L, tag)); +} + + +/* +** The use of 'lua_pushfstring' ensures this function does not +** need reserved stack space when called. +*/ +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushfstring(L, ""); /* else, no information available... */ +} + + +/* +** Again, the use of 'lua_pushvfstring' ensures this function does +** not need reserved stack space when called. (At worst, it generates +** an error with "stack overflow" instead of the given message.) +*/ +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + + +LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { + int en = errno; /* calls to Lua API may change this value */ + if (stat) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (fname) + lua_pushfstring(L, "%s: %s", fname, strerror(en)); + else + lua_pushstring(L, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +#if !defined(l_inspectstat) /* { */ + +#if defined(LUA_USE_POSIX) + +#include + +/* +** use appropriate macros to interpret 'pclose' return status +*/ +#define l_inspectstat(stat,what) \ + if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \ + else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; } + +#else + +#define l_inspectstat(stat,what) /* no op */ + +#endif + +#endif /* } */ + + +LUALIB_API int luaL_execresult (lua_State *L, int stat) { + const char *what = "exit"; /* type of termination */ + if (stat == -1) /* error? */ + return luaL_fileresult(L, 0, NULL); + else { + l_inspectstat(stat, what); /* interpret result */ + if (*what == 'e' && stat == 0) /* successful termination? */ + lua_pushboolean(L, 1); + else + lua_pushnil(L); + lua_pushstring(L, what); + lua_pushinteger(L, stat); + return 3; /* return true/nil,what,code */ + } +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Userdata's metatable manipulation +** ======================================================= +*/ + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + if (luaL_getmetatable(L, tname) != LUA_TNIL) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_createtable(L, 0, 2); /* create metatable */ + lua_pushstring(L, tname); + lua_setfield(L, -2, "__name"); /* metatable.__name = tname */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { + luaL_getmetatable(L, tname); + lua_setmetatable(L, -2); +} + + +LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + luaL_getmetatable(L, tname); /* get correct metatable */ + if (!lua_rawequal(L, -1, -2)) /* not the same? */ + p = NULL; /* value is a userdata with wrong metatable */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + return NULL; /* value is not a userdata with a metatable */ +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = luaL_testudata(L, ud, tname); + if (p == NULL) typeerror(L, ud, tname); + return p; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Argument check functions +** ======================================================= +*/ + +LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, arg, def) : + luaL_checkstring(L, arg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, arg, + lua_pushfstring(L, "invalid option '%s'", name)); +} + + +/* +** Ensures the stack has at least 'space' extra slots, raising an error +** if it cannot fulfill the request. (The error handling needs a few +** extra slots to format the error message. In case of an error without +** this extra space, Lua will generate the same 'stack overflow' error, +** but without 'msg'.) +*/ +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { + if (!lua_checkstack(L, space)) { + if (msg) + luaL_error(L, "stack overflow (%s)", msg); + else + luaL_error(L, "stack overflow"); + } +} + + +LUALIB_API void luaL_checktype (lua_State *L, int arg, int t) { + if (lua_type(L, arg) != t) + tag_error(L, arg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int arg) { + if (lua_type(L, arg) == LUA_TNONE) + luaL_argerror(L, arg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int arg, size_t *len) { + const char *s = lua_tolstring(L, arg, len); + if (!s) tag_error(L, arg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int arg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, arg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, arg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg) { + int isnum; + lua_Number d = lua_tonumberx(L, arg, &isnum); + if (!isnum) + tag_error(L, arg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, arg, def); +} + + +static void interror (lua_State *L, int arg) { + if (lua_isnumber(L, arg)) + luaL_argerror(L, arg, "number has no integer representation"); + else + tag_error(L, arg, LUA_TNUMBER); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg) { + int isnum; + lua_Integer d = lua_tointegerx(L, arg, &isnum); + if (!isnum) { + interror(L, arg); + } + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, arg, def); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + +/* userdata to box arbitrary data */ +typedef struct UBox { + void *box; + size_t bsize; +} UBox; + + +static void *resizebox (lua_State *L, int idx, size_t newsize) { + void *ud; + lua_Alloc allocf = lua_getallocf(L, &ud); + UBox *box = (UBox *)lua_touserdata(L, idx); + void *temp = allocf(ud, box->box, box->bsize, newsize); + if (temp == NULL && newsize > 0) { /* allocation error? */ + resizebox(L, idx, 0); /* free buffer */ + luaL_error(L, "not enough memory for buffer allocation"); + } + box->box = temp; + box->bsize = newsize; + return temp; +} + + +static int boxgc (lua_State *L) { + resizebox(L, 1, 0); + return 0; +} + + +static void *newbox (lua_State *L, size_t newsize) { + UBox *box = (UBox *)lua_newuserdata(L, sizeof(UBox)); + box->box = NULL; + box->bsize = 0; + if (luaL_newmetatable(L, "LUABOX")) { /* creating metatable? */ + lua_pushcfunction(L, boxgc); + lua_setfield(L, -2, "__gc"); /* metatable.__gc = boxgc */ + } + lua_setmetatable(L, -2); + return resizebox(L, -1, newsize); +} + + +/* +** check whether buffer is using a userdata on the stack as a temporary +** buffer +*/ +#define buffonstack(B) ((B)->b != (B)->initb) + + +/* +** returns a pointer to a free area with at least 'sz' bytes +*/ +LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) { + lua_State *L = B->L; + if (B->size - B->n < sz) { /* not enough space? */ + char *newbuff; + size_t newsize = B->size * 2; /* double buffer size */ + if (newsize - B->n < sz) /* not big enough? */ + newsize = B->n + sz; + if (newsize < B->n || newsize - B->n < sz) + luaL_error(L, "buffer too large"); + /* create larger buffer */ + if (buffonstack(B)) + newbuff = (char *)resizebox(L, -1, newsize); + else { /* no buffer yet */ + newbuff = (char *)newbox(L, newsize); + memcpy(newbuff, B->b, B->n * sizeof(char)); /* copy original content */ + } + B->b = newbuff; + B->size = newsize; + } + return &B->b[B->n]; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + if (l > 0) { /* avoid 'memcpy' when 's' can be NULL */ + char *b = luaL_prepbuffsize(B, l); + memcpy(b, s, l * sizeof(char)); + luaL_addsize(B, l); + } +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + lua_State *L = B->L; + lua_pushlstring(L, B->b, B->n); + if (buffonstack(B)) { + resizebox(L, -2, 0); /* delete old buffer */ + lua_remove(L, -2); /* remove its header from the stack */ + } +} + + +LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) { + luaL_addsize(B, sz); + luaL_pushresult(B); +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t l; + const char *s = lua_tolstring(L, -1, &l); + if (buffonstack(B)) + lua_insert(L, -2); /* put value below buffer */ + luaL_addlstring(B, s, l); + lua_remove(L, (buffonstack(B)) ? -2 : -1); /* remove value */ +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->b = B->initb; + B->n = 0; + B->size = LUAL_BUFFERSIZE; +} + + +LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) { + luaL_buffinit(L, B); + return luaL_prepbuffsize(B, sz); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Reference system +** ======================================================= +*/ + +/* index of free-list header */ +#define freelist 0 + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* 'nil' has a unique fixed reference */ + } + t = lua_absindex(L, t); + lua_rawgeti(L, t, freelist); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */ + } + else /* no free elements */ + ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = lua_absindex(L, t); + lua_rawgeti(L, t, freelist); + lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, freelist); /* t[freelist] = ref */ + } +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int n; /* number of pre-read characters */ + FILE *f; /* file being read */ + char buff[BUFSIZ]; /* area for reading file */ +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; /* not used */ + if (lf->n > 0) { /* are there pre-read characters to be read? */ + *size = lf->n; /* return them (chars already in buffer) */ + lf->n = 0; /* no more pre-read characters */ + } + else { /* read a block from file */ + /* 'fread' can return > 0 *and* set the EOF flag. If next call to + 'getF' called 'fread', it might still wait for user input. + The next check avoids this problem. */ + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ + } + return lf->buff; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +static int skipBOM (LoadF *lf) { + const char *p = "\xEF\xBB\xBF"; /* UTF-8 BOM mark */ + int c; + lf->n = 0; + do { + c = getc(lf->f); + if (c == EOF || c != *(const unsigned char *)p++) return c; + lf->buff[lf->n++] = c; /* to be read by the parser */ + } while (*p != '\0'); + lf->n = 0; /* prefix matched; discard it */ + return getc(lf->f); /* return next character */ +} + + +/* +** reads the first character of file 'f' and skips an optional BOM mark +** in its beginning plus its first line if it starts with '#'. Returns +** true if it skipped the first line. In any case, '*cp' has the +** first "valid" character of the file (after the optional BOM and +** a first-line comment). +*/ +static int skipcomment (LoadF *lf, int *cp) { + int c = *cp = skipBOM(lf); + if (c == '#') { /* first line is a comment (Unix exec. file)? */ + do { /* skip first line */ + c = getc(lf->f); + } while (c != EOF && c != '\n'); + *cp = getc(lf->f); /* skip end-of-line, if present */ + return 1; /* there was a comment */ + } + else return 0; /* no comment */ +} + + +LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, + const char *mode) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + if (skipcomment(&lf, &c)) /* read initial portion */ + lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */ + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + skipcomment(&lf, &c); /* re-read initial portion */ + } + if (c != EOF) + lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ + status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; /* not used */ + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, + const char *name, const char *mode) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name, mode); +} + + +LUALIB_API int luaL_loadstring (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + +/* }====================================================== */ + + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return LUA_TNIL; + else { + int tt; + lua_pushstring(L, event); + tt = lua_rawget(L, -2); + if (tt == LUA_TNIL) /* is metafield nil? */ + lua_pop(L, 2); /* remove metatable and metafield */ + else + lua_remove(L, -2); /* remove only metatable */ + return tt; /* return metafield type */ + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = lua_absindex(L, obj); + if (luaL_getmetafield(L, obj, event) == LUA_TNIL) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { + lua_Integer l; + int isnum; + lua_len(L, idx); + l = lua_tointegerx(L, -1, &isnum); + if (!isnum) + luaL_error(L, "object length is not an integer"); + lua_pop(L, 1); /* remove object */ + return l; +} + + +LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { + if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */ + if (!lua_isstring(L, -1)) + luaL_error(L, "'__tostring' must return a string"); + } + else { + switch (lua_type(L, idx)) { + case LUA_TNUMBER: { + if (lua_isinteger(L, idx)) + lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx)); + else + lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx)); + break; + } + case LUA_TSTRING: + lua_pushvalue(L, idx); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: { + int tt = luaL_getmetafield(L, idx, "__name"); /* try name */ + const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) : + luaL_typename(L, idx); + lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx)); + if (tt != LUA_TNIL) + lua_remove(L, -2); /* remove '__name' */ + break; + } + } + } + return lua_tolstring(L, -1, len); +} + + +/* +** {====================================================== +** Compatibility with 5.1 module functions +** ======================================================= +*/ +#if defined(LUA_COMPAT_MODULE) + +static const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + if (idx) lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + if (lua_rawget(L, -2) == LUA_TNIL) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + +/* +** Count number of elements in a luaL_Reg list. +*/ +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l && l->name; l++) size++; + return size; +} + + +/* +** Find or create a module table with a given name. The function +** first looks at the LOADED table and, if that fails, try a +** global variable with that name. In any case, leaves on the stack +** the module table. +*/ +LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, + int sizehint) { + luaL_findtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE, 1); + if (lua_getfield(L, -1, modname) != LUA_TTABLE) { /* no LOADED[modname]? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + lua_pushglobaltable(L); + if (luaL_findtable(L, 0, modname, sizehint) != NULL) + luaL_error(L, "name conflict for module '%s'", modname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, modname); /* LOADED[modname] = new table */ + } + lua_remove(L, -2); /* remove LOADED table */ +} + + +LUALIB_API void luaL_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + luaL_checkversion(L); + if (libname) { + luaL_pushmodule(L, libname, libsize(l)); /* get/create library table */ + lua_insert(L, -(nup + 1)); /* move library table to below upvalues */ + } + if (l) + luaL_setfuncs(L, l, nup); + else + lua_pop(L, nup); /* remove upvalues */ +} + +#endif +/* }====================================================== */ + +/* +** set functions from list 'l' into table at top - 'nup'; each +** function gets the 'nup' elements at the top as upvalues. +** Returns with only the table at the stack. +*/ +LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { + luaL_checkstack(L, nup, "too many upvalues"); + for (; l->name != NULL; l++) { /* fill the table with given functions */ + int i; + for (i = 0; i < nup; i++) /* copy upvalues to the top */ + lua_pushvalue(L, -nup); + lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ + lua_setfield(L, -(nup + 2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + +/* +** ensure that stack[idx][fname] has a table and push that table +** into the stack +*/ +LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { + if (lua_getfield(L, idx, fname) == LUA_TTABLE) + return 1; /* table already there */ + else { + lua_pop(L, 1); /* remove previous result */ + idx = lua_absindex(L, idx); + lua_newtable(L); + lua_pushvalue(L, -1); /* copy to be left at top */ + lua_setfield(L, idx, fname); /* assign new table to field */ + return 0; /* false, because did not find table there */ + } +} + + +/* +** Stripped-down 'require': After checking "loaded" table, calls 'openf' +** to open a module, registers the result in 'package.loaded' table and, +** if 'glb' is true, also registers the result in the global table. +** Leaves resulting module on the top. +*/ +LUALIB_API void luaL_requiref (lua_State *L, const char *modname, + lua_CFunction openf, int glb) { + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + lua_getfield(L, -1, modname); /* LOADED[modname] */ + if (!lua_toboolean(L, -1)) { /* package not already loaded? */ + lua_pop(L, 1); /* remove field */ + lua_pushcfunction(L, openf); + lua_pushstring(L, modname); /* argument to open function */ + lua_call(L, 1, 1); /* call 'openf' to open module */ + lua_pushvalue(L, -1); /* make copy of module (call result) */ + lua_setfield(L, -3, modname); /* LOADED[modname] = module */ + } + lua_remove(L, -2); /* remove LOADED table */ + if (glb) { + lua_pushvalue(L, -1); /* copy of module */ + lua_setglobal(L, modname); /* _G[modname] = module */ + } +} + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after 'p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; (void)osize; /* not used */ + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; /* return to Lua to abort */ +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + + +LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { + const lua_Number *v = lua_version(L); + if (sz != LUAL_NUMSIZES) /* check numeric types */ + luaL_error(L, "core and library have incompatible numeric types"); + if (v != lua_version(NULL)) + luaL_error(L, "multiple Lua VMs detected"); + else if (*v != ver) + luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", + (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v); +} + diff --git a/deps/rcheevos/test/lua/src/lauxlib.h b/deps/rcheevos/test/lua/src/lauxlib.h new file mode 100644 index 0000000000..9a2e66aa06 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lauxlib.h @@ -0,0 +1,264 @@ +/* +** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + + +/* extra error code for 'luaL_loadfilex' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +/* key, in the registry, for table of loaded modules */ +#define LUA_LOADED_TABLE "_LOADED" + + +/* key, in the registry, for table of preloaded loaders */ +#define LUA_PRELOAD_TABLE "_PRELOAD" + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + +#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number)) + +LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz); +#define luaL_checkversion(L) \ + luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES) + +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); +LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int arg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); +LUALIB_API int (luaL_execresult) (lua_State *L, int stat); + +/* predefined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, + const char *mode); + +#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) + +LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, + const char *name, const char *mode); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + +LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); + +LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); + +LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, + const char *msg, int level); + +LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, + lua_CFunction openf, int glb); + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + + +#define luaL_newlibtable(L,l) \ + lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) + +#define luaL_newlib(L,l) \ + (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) + +#define luaL_argcheck(L, cond,arg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (arg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + +typedef struct luaL_Buffer { + char *b; /* buffer address */ + size_t size; /* buffer size */ + size_t n; /* number of characters in buffer */ + lua_State *L; + char initb[LUAL_BUFFERSIZE]; /* initial buffer */ +} luaL_Buffer; + + +#define luaL_addchar(B,c) \ + ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ + ((B)->b[(B)->n++] = (c))) + +#define luaL_addsize(B,s) ((B)->n += (s)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); +LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); + +#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) + +/* }====================================================== */ + + + +/* +** {====================================================== +** File handles for IO library +** ======================================================= +*/ + +/* +** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and +** initial structure 'luaL_Stream' (it may contain other fields +** after that initial structure). +*/ + +#define LUA_FILEHANDLE "FILE*" + + +typedef struct luaL_Stream { + FILE *f; /* stream (NULL for incompletely created streams) */ + lua_CFunction closef; /* to close stream (NULL for closed streams) */ +} luaL_Stream; + +/* }====================================================== */ + + + +/* compatibility with old module system */ +#if defined(LUA_COMPAT_MODULE) + +LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, + int sizehint); +LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); + +#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) + +#endif + + +/* +** {================================================================== +** "Abstraction Layer" for basic report of messages and errors +** =================================================================== +*/ + +/* print a string */ +#if !defined(lua_writestring) +#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) +#endif + +/* print a newline and flush the output */ +#if !defined(lua_writeline) +#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) +#endif + +/* print an error message */ +#if !defined(lua_writestringerror) +#define lua_writestringerror(s,p) \ + (fprintf(stderr, (s), (p)), fflush(stderr)) +#endif + +/* }================================================================== */ + + +/* +** {============================================================ +** Compatibility with deprecated conversions +** ============================================================= +*/ +#if defined(LUA_COMPAT_APIINTCASTS) + +#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) +#define luaL_optunsigned(L,a,d) \ + ((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d))) + +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) + +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#endif +/* }============================================================ */ + + + +#endif + + diff --git a/deps/rcheevos/test/lua/src/lbaselib.c b/deps/rcheevos/test/lua/src/lbaselib.c new file mode 100644 index 0000000000..08523e6e75 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lbaselib.c @@ -0,0 +1,498 @@ +/* +** $Id: lbaselib.c,v 1.314 2016/09/05 19:06:34 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + +#define lbaselib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + size_t l; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tolstring(L, -1, &l); /* get result */ + if (s == NULL) + return luaL_error(L, "'tostring' must return a string to 'print'"); + if (i>1) lua_writestring("\t", 1); + lua_writestring(s, l); + lua_pop(L, 1); /* pop result */ + } + lua_writeline(); + return 0; +} + + +#define SPACECHARS " \f\n\r\t\v" + +static const char *b_str2int (const char *s, int base, lua_Integer *pn) { + lua_Unsigned n = 0; + int neg = 0; + s += strspn(s, SPACECHARS); /* skip initial spaces */ + if (*s == '-') { s++; neg = 1; } /* handle signal */ + else if (*s == '+') s++; + if (!isalnum((unsigned char)*s)) /* no digit? */ + return NULL; + do { + int digit = (isdigit((unsigned char)*s)) ? *s - '0' + : (toupper((unsigned char)*s) - 'A') + 10; + if (digit >= base) return NULL; /* invalid numeral */ + n = n * base + digit; + s++; + } while (isalnum((unsigned char)*s)); + s += strspn(s, SPACECHARS); /* skip trailing spaces */ + *pn = (lua_Integer)((neg) ? (0u - n) : n); + return s; +} + + +static int luaB_tonumber (lua_State *L) { + if (lua_isnoneornil(L, 2)) { /* standard conversion? */ + luaL_checkany(L, 1); + if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ + lua_settop(L, 1); /* yes; return it */ + return 1; + } + else { + size_t l; + const char *s = lua_tolstring(L, 1, &l); + if (s != NULL && lua_stringtonumber(L, s) == l + 1) + return 1; /* successful conversion to number */ + /* else not a number */ + } + } + else { + size_t l; + const char *s; + lua_Integer n = 0; /* to avoid warnings */ + lua_Integer base = luaL_checkinteger(L, 2); + luaL_checktype(L, 1, LUA_TSTRING); /* no numbers as strings */ + s = lua_tolstring(L, 1, &l); + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + if (b_str2int(s, (int)base, &n) == s + l) { + lua_pushinteger(L, n); + return 1; + } /* else not a number */ + } /* else not a number */ + lua_pushnil(L); /* not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = (int)luaL_optinteger(L, 2, 1); + lua_settop(L, 1); + if (lua_type(L, 1) == LUA_TSTRING && level > 0) { + luaL_where(L, level); /* add extra information */ + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL) + return luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawlen (lua_State *L) { + int t = lua_type(L, 1); + luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1, + "table or string expected"); + lua_pushinteger(L, lua_rawlen(L, 1)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", + "isrunning", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, + LUA_GCISRUNNING}; + int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; + int ex = (int)luaL_optinteger(L, 2, 0); + int res = lua_gc(L, o, ex); + switch (o) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, (lua_Number)res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: case LUA_GCISRUNNING: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushinteger(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + int t = lua_type(L, 1); + luaL_argcheck(L, t != LUA_TNONE, 1, "value expected"); + lua_pushstring(L, lua_typename(L, t)); + return 1; +} + + +static int pairsmeta (lua_State *L, const char *method, int iszero, + lua_CFunction iter) { + luaL_checkany(L, 1); + if (luaL_getmetafield(L, 1, method) == LUA_TNIL) { /* no metamethod? */ + lua_pushcfunction(L, iter); /* will return generator, */ + lua_pushvalue(L, 1); /* state, */ + if (iszero) lua_pushinteger(L, 0); /* and initial value */ + else lua_pushnil(L); + } + else { + lua_pushvalue(L, 1); /* argument 'self' to metamethod */ + lua_call(L, 1, 3); /* get 3 values from metamethod */ + } + return 3; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + return pairsmeta(L, "__pairs", 0, luaB_next); +} + + +/* +** Traversal function for 'ipairs' +*/ +static int ipairsaux (lua_State *L) { + lua_Integer i = luaL_checkinteger(L, 2) + 1; + lua_pushinteger(L, i); + return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; +} + + +/* +** 'ipairs' function. Returns 'ipairsaux', given "table", 0. +** (The given "table" may not be a table.) +*/ +static int luaB_ipairs (lua_State *L) { +#if defined(LUA_COMPAT_IPAIRS) + return pairsmeta(L, "__ipairs", 1, ipairsaux); +#else + luaL_checkany(L, 1); + lua_pushcfunction(L, ipairsaux); /* iteration function */ + lua_pushvalue(L, 1); /* state */ + lua_pushinteger(L, 0); /* initial value */ + return 3; +#endif +} + + +static int load_aux (lua_State *L, int status, int envidx) { + if (status == LUA_OK) { + if (envidx != 0) { /* 'env' parameter? */ + lua_pushvalue(L, envidx); /* environment for loaded function */ + if (!lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */ + lua_pop(L, 1); /* remove 'env' if not used by previous call */ + } + return 1; + } + else { /* error (message is on top of the stack) */ + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + const char *mode = luaL_optstring(L, 2, NULL); + int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ + int status = luaL_loadfilex(L, fname, mode); + return load_aux(L, status, env); +} + + +/* +** {====================================================== +** Generic Read function +** ======================================================= +*/ + + +/* +** reserved slot, above all arguments, to hold a copy of the returned +** string to avoid it being collected while parsed. 'load' has four +** optional arguments (chunk, source name, mode, and environment). +*/ +#define RESERVEDSLOT 5 + + +/* +** Reader for generic 'load' function: 'lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)(ud); /* not used */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* pop result */ + *size = 0; + return NULL; + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "reader function must return a string"); + lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ + return lua_tolstring(L, RESERVEDSLOT, size); +} + + +static int luaB_load (lua_State *L) { + int status; + size_t l; + const char *s = lua_tolstring(L, 1, &l); + const char *mode = luaL_optstring(L, 3, "bt"); + int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ + if (s != NULL) { /* loading a string? */ + const char *chunkname = luaL_optstring(L, 2, s); + status = luaL_loadbufferx(L, s, l, chunkname, mode); + } + else { /* loading from a reader function */ + const char *chunkname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, RESERVEDSLOT); /* create reserved slot */ + status = lua_load(L, generic_reader, NULL, chunkname, mode); + } + return load_aux(L, status, env); +} + +/* }====================================================== */ + + +static int dofilecont (lua_State *L, int d1, lua_KContext d2) { + (void)d1; (void)d2; /* only to match 'lua_Kfunction' prototype */ + return lua_gettop(L) - 1; +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + lua_settop(L, 1); + if (luaL_loadfile(L, fname) != LUA_OK) + return lua_error(L); + lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); + return dofilecont(L, 0, 0); +} + + +static int luaB_assert (lua_State *L) { + if (lua_toboolean(L, 1)) /* condition is true? */ + return lua_gettop(L); /* return all arguments */ + else { /* error */ + luaL_checkany(L, 1); /* there must be a condition */ + lua_remove(L, 1); /* remove it */ + lua_pushliteral(L, "assertion failed!"); /* default message */ + lua_settop(L, 1); /* leave only message (default if no other one) */ + return luaB_error(L); /* call 'error' */ + } +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + lua_Integer i = luaL_checkinteger(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - (int)i; + } +} + + +/* +** Continuation function for 'pcall' and 'xpcall'. Both functions +** already pushed a 'true' before doing the call, so in case of success +** 'finishpcall' only has to return everything in the stack minus +** 'extra' values (where 'extra' is exactly the number of items to be +** ignored). +*/ +static int finishpcall (lua_State *L, int status, lua_KContext extra) { + if (status != LUA_OK && status != LUA_YIELD) { /* error? */ + lua_pushboolean(L, 0); /* first result (false) */ + lua_pushvalue(L, -2); /* error message */ + return 2; /* return false, msg */ + } + else + return lua_gettop(L) - (int)extra; /* return all results */ +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + lua_pushboolean(L, 1); /* first result if no errors */ + lua_insert(L, 1); /* put it in place */ + status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, finishpcall); + return finishpcall(L, status, 0); +} + + +/* +** Do a protected call with error handling. After 'lua_rotate', the +** stack will have ; so, the function passes +** 2 to 'finishpcall' to skip the 2 first values when returning results. +*/ +static int luaB_xpcall (lua_State *L) { + int status; + int n = lua_gettop(L); + luaL_checktype(L, 2, LUA_TFUNCTION); /* check error function */ + lua_pushboolean(L, 1); /* first result */ + lua_pushvalue(L, 1); /* function */ + lua_rotate(L, 3, 2); /* move them below function's arguments */ + status = lua_pcallk(L, n - 2, LUA_MULTRET, 2, 2, finishpcall); + return finishpcall(L, status, 2); +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + luaL_tolstring(L, 1, NULL); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"getmetatable", luaB_getmetatable}, + {"ipairs", luaB_ipairs}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, +#if defined(LUA_COMPAT_LOADSTRING) + {"loadstring", luaB_load}, +#endif + {"next", luaB_next}, + {"pairs", luaB_pairs}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawlen", luaB_rawlen}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"xpcall", luaB_xpcall}, + /* placeholders */ + {"_G", NULL}, + {"_VERSION", NULL}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_base (lua_State *L) { + /* open lib into global table */ + lua_pushglobaltable(L); + luaL_setfuncs(L, base_funcs, 0); + /* set global _G */ + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_G"); + /* set global _VERSION */ + lua_pushliteral(L, LUA_VERSION); + lua_setfield(L, -2, "_VERSION"); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/lbitlib.c b/deps/rcheevos/test/lua/src/lbitlib.c new file mode 100644 index 0000000000..1cb1d5b932 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lbitlib.c @@ -0,0 +1,233 @@ +/* +** $Id: lbitlib.c,v 1.30 2015/11/11 19:08:09 roberto Exp $ +** Standard library for bitwise operations +** See Copyright Notice in lua.h +*/ + +#define lbitlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#if defined(LUA_COMPAT_BITLIB) /* { */ + + +#define pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) +#define checkunsigned(L,i) ((lua_Unsigned)luaL_checkinteger(L,i)) + + +/* number of bits to consider in a number */ +#if !defined(LUA_NBITS) +#define LUA_NBITS 32 +#endif + + +/* +** a lua_Unsigned with its first LUA_NBITS bits equal to 1. (Shift must +** be made in two parts to avoid problems when LUA_NBITS is equal to the +** number of bits in a lua_Unsigned.) +*/ +#define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1)) + + +/* macro to trim extra bits */ +#define trim(x) ((x) & ALLONES) + + +/* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */ +#define mask(n) (~((ALLONES << 1) << ((n) - 1))) + + + +static lua_Unsigned andaux (lua_State *L) { + int i, n = lua_gettop(L); + lua_Unsigned r = ~(lua_Unsigned)0; + for (i = 1; i <= n; i++) + r &= checkunsigned(L, i); + return trim(r); +} + + +static int b_and (lua_State *L) { + lua_Unsigned r = andaux(L); + pushunsigned(L, r); + return 1; +} + + +static int b_test (lua_State *L) { + lua_Unsigned r = andaux(L); + lua_pushboolean(L, r != 0); + return 1; +} + + +static int b_or (lua_State *L) { + int i, n = lua_gettop(L); + lua_Unsigned r = 0; + for (i = 1; i <= n; i++) + r |= checkunsigned(L, i); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_xor (lua_State *L) { + int i, n = lua_gettop(L); + lua_Unsigned r = 0; + for (i = 1; i <= n; i++) + r ^= checkunsigned(L, i); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_not (lua_State *L) { + lua_Unsigned r = ~checkunsigned(L, 1); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) { + if (i < 0) { /* shift right? */ + i = -i; + r = trim(r); + if (i >= LUA_NBITS) r = 0; + else r >>= i; + } + else { /* shift left */ + if (i >= LUA_NBITS) r = 0; + else r <<= i; + r = trim(r); + } + pushunsigned(L, r); + return 1; +} + + +static int b_lshift (lua_State *L) { + return b_shift(L, checkunsigned(L, 1), luaL_checkinteger(L, 2)); +} + + +static int b_rshift (lua_State *L) { + return b_shift(L, checkunsigned(L, 1), -luaL_checkinteger(L, 2)); +} + + +static int b_arshift (lua_State *L) { + lua_Unsigned r = checkunsigned(L, 1); + lua_Integer i = luaL_checkinteger(L, 2); + if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1)))) + return b_shift(L, r, -i); + else { /* arithmetic shift for 'negative' number */ + if (i >= LUA_NBITS) r = ALLONES; + else + r = trim((r >> i) | ~(trim(~(lua_Unsigned)0) >> i)); /* add signal bit */ + pushunsigned(L, r); + return 1; + } +} + + +static int b_rot (lua_State *L, lua_Integer d) { + lua_Unsigned r = checkunsigned(L, 1); + int i = d & (LUA_NBITS - 1); /* i = d % NBITS */ + r = trim(r); + if (i != 0) /* avoid undefined shift of LUA_NBITS when i == 0 */ + r = (r << i) | (r >> (LUA_NBITS - i)); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_lrot (lua_State *L) { + return b_rot(L, luaL_checkinteger(L, 2)); +} + + +static int b_rrot (lua_State *L) { + return b_rot(L, -luaL_checkinteger(L, 2)); +} + + +/* +** get field and width arguments for field-manipulation functions, +** checking whether they are valid. +** ('luaL_error' called without 'return' to avoid later warnings about +** 'width' being used uninitialized.) +*/ +static int fieldargs (lua_State *L, int farg, int *width) { + lua_Integer f = luaL_checkinteger(L, farg); + lua_Integer w = luaL_optinteger(L, farg + 1, 1); + luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); + luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); + if (f + w > LUA_NBITS) + luaL_error(L, "trying to access non-existent bits"); + *width = (int)w; + return (int)f; +} + + +static int b_extract (lua_State *L) { + int w; + lua_Unsigned r = trim(checkunsigned(L, 1)); + int f = fieldargs(L, 2, &w); + r = (r >> f) & mask(w); + pushunsigned(L, r); + return 1; +} + + +static int b_replace (lua_State *L) { + int w; + lua_Unsigned r = trim(checkunsigned(L, 1)); + lua_Unsigned v = trim(checkunsigned(L, 2)); + int f = fieldargs(L, 3, &w); + lua_Unsigned m = mask(w); + r = (r & ~(m << f)) | ((v & m) << f); + pushunsigned(L, r); + return 1; +} + + +static const luaL_Reg bitlib[] = { + {"arshift", b_arshift}, + {"band", b_and}, + {"bnot", b_not}, + {"bor", b_or}, + {"bxor", b_xor}, + {"btest", b_test}, + {"extract", b_extract}, + {"lrotate", b_lrot}, + {"lshift", b_lshift}, + {"replace", b_replace}, + {"rrotate", b_rrot}, + {"rshift", b_rshift}, + {NULL, NULL} +}; + + + +LUAMOD_API int luaopen_bit32 (lua_State *L) { + luaL_newlib(L, bitlib); + return 1; +} + + +#else /* }{ */ + + +LUAMOD_API int luaopen_bit32 (lua_State *L) { + return luaL_error(L, "library 'bit32' has been deprecated"); +} + +#endif /* } */ diff --git a/deps/rcheevos/test/lua/src/lcode.c b/deps/rcheevos/test/lua/src/lcode.c new file mode 100644 index 0000000000..0bb414262e --- /dev/null +++ b/deps/rcheevos/test/lua/src/lcode.c @@ -0,0 +1,1203 @@ +/* +** $Id: lcode.c,v 2.112 2016/12/22 13:08:50 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#define lcode_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstring.h" +#include "ltable.h" +#include "lvm.h" + + +/* Maximum number of registers in a Lua function (must fit in 8 bits) */ +#define MAXREGS 255 + + +#define hasjumps(e) ((e)->t != (e)->f) + + +/* +** If expression is a numeric constant, fills 'v' with its value +** and returns 1. Otherwise, returns 0. +*/ +static int tonumeral(const expdesc *e, TValue *v) { + if (hasjumps(e)) + return 0; /* not a numeral */ + switch (e->k) { + case VKINT: + if (v) setivalue(v, e->u.ival); + return 1; + case VKFLT: + if (v) setfltvalue(v, e->u.nval); + return 1; + default: return 0; + } +} + + +/* +** Create a OP_LOADNIL instruction, but try to optimize: if the previous +** instruction is also OP_LOADNIL and ranges are compatible, adjust +** range of previous instruction instead of emitting a new one. (For +** instance, 'local a; local b' will generate a single opcode.) +*/ +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + int l = from + n - 1; /* last register to set nil */ + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { /* previous is LOADNIL? */ + int pfrom = GETARG_A(*previous); /* get previous range */ + int pl = pfrom + GETARG_B(*previous); + if ((pfrom <= from && from <= pl + 1) || + (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */ + if (pfrom < from) from = pfrom; /* from = min(from, pfrom) */ + if (pl > l) l = pl; /* l = max(l, pl) */ + SETARG_A(*previous, from); + SETARG_B(*previous, l - from); + return; + } + } /* else go through */ + } + luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */ +} + + +/* +** Gets the destination address of a jump instruction. Used to traverse +** a list of jumps. +*/ +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +/* +** Fix jump instruction at position 'pc' to jump to 'dest'. +** (Jump addresses are relative in Lua) +*/ +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest - (pc + 1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** Concatenate jump-list 'l2' into jump-list 'l1' +*/ +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; /* nothing to concatenate? */ + else if (*l1 == NO_JUMP) /* no original list? */ + *l1 = l2; /* 'l1' points to 'l2' */ + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); /* last element links to 'l2' */ + } +} + + +/* +** Create a jump instruction and return its position, so its destination +** can be fixed later (with 'fixjump'). If there are jumps to +** this position (kept in 'jpc'), link them all together so that +** 'patchlistaux' will fix all them directly to the final destination. +*/ +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; /* no more jumps to here */ + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +/* +** Code a 'return' instruction +*/ +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +/* +** Code a "conditional jump", that is, a test or comparison opcode +** followed by a jump. Return jump position. +*/ +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +/* +** returns current 'pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +/* +** Returns the position of the instruction "controlling" a given +** jump (that is, its condition), or the jump itself if it is +** unconditional. +*/ +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** Patch destination register for a TESTSET instruction. +** If instruction in position 'node' is not a TESTSET, return 0 ("fails"). +** Otherwise, if 'reg' is not 'NO_REG', set it as the destination +** register. Otherwise, change instruction to a simple 'TEST' (produces +** no register value) +*/ +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else { + /* no register to put value or register already has the value; + change instruction to simple test */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + } + return 1; +} + + +/* +** Traverse a list of tests ensuring no one produces a value +*/ +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +/* +** Traverse a list of tests, patching their destination address and +** registers: tests producing values jump to 'vtarget' (and put their +** values in 'reg'), other tests jump to 'dtarget'. +*/ +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +/* +** Ensure all pending jumps to current position are fixed (jumping +** to current position with no values) and reset list of pending +** jumps +*/ +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +/* +** Add elements in 'list' to list of pending jumps to "here" +** (current position) +*/ +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); /* mark "here" as a jump target */ + luaK_concat(fs, &fs->jpc, list); +} + + +/* +** Path all jumps in 'list' to jump to 'target'. +** (The assert means that we cannot fix a jump to a forward address +** because we only know addresses once code is generated.) +*/ +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) /* 'target' is current position? */ + luaK_patchtohere(fs, list); /* add list to pending jumps */ + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +/* +** Path all jumps in 'list' to close upvalues up to given 'level' +** (The assertion checks that jumps either were closing nothing +** or were closing higher levels, from inner blocks.) +*/ +void luaK_patchclose (FuncState *fs, int list, int level) { + level++; /* argument is +1 to reserve 0 as non-op */ + for (; list != NO_JUMP; list = getjump(fs, list)) { + lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP && + (GETARG_A(fs->f->code[list]) == 0 || + GETARG_A(fs->f->code[list]) >= level)); + SETARG_A(fs->f->code[list], level); + } +} + + +/* +** Emit instruction 'i', checking for array sizes and saving also its +** line information. Return 'i' position. +*/ +static int luaK_code (FuncState *fs, Instruction i) { + Proto *f = fs->f; + dischargejpc(fs); /* 'pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "opcodes"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "opcodes"); + f->lineinfo[fs->pc] = fs->ls->lastline; + return fs->pc++; +} + + +/* +** Format and emit an 'iABC' instruction. (Assertions check consistency +** of parameters versus opcode.) +*/ +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C); + return luaK_code(fs, CREATE_ABC(o, a, b, c)); +} + + +/* +** Format and emit an 'iABx' instruction. +*/ +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx); + return luaK_code(fs, CREATE_ABx(o, a, bc)); +} + + +/* +** Emit an "extra argument" instruction (format 'iAx') +*/ +static int codeextraarg (FuncState *fs, int a) { + lua_assert(a <= MAXARG_Ax); + return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a)); +} + + +/* +** Emit a "load constant" instruction, using either 'OP_LOADK' +** (if constant index 'k' fits in 18 bits) or an 'OP_LOADKX' +** instruction with "extra argument". +*/ +int luaK_codek (FuncState *fs, int reg, int k) { + if (k <= MAXARG_Bx) + return luaK_codeABx(fs, OP_LOADK, reg, k); + else { + int p = luaK_codeABx(fs, OP_LOADKX, reg, 0); + codeextraarg(fs, k); + return p; + } +} + + +/* +** Check register-stack level, keeping track of its maximum size +** in field 'maxstacksize' +*/ +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXREGS) + luaX_syntaxerror(fs->ls, + "function or expression needs too many registers"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +/* +** Reserve 'n' registers in register stack +*/ +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +/* +** Free register 'reg', if it is neither a constant index nor +** a local variable. +) +*/ +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +/* +** Free register used by expression 'e' (if any) +*/ +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.info); +} + + +/* +** Free registers used by expressions 'e1' and 'e2' (if any) in proper +** order. +*/ +static void freeexps (FuncState *fs, expdesc *e1, expdesc *e2) { + int r1 = (e1->k == VNONRELOC) ? e1->u.info : -1; + int r2 = (e2->k == VNONRELOC) ? e2->u.info : -1; + if (r1 > r2) { + freereg(fs, r1); + freereg(fs, r2); + } + else { + freereg(fs, r2); + freereg(fs, r1); + } +} + + +/* +** Add constant 'v' to prototype's list of constants (field 'k'). +** Use scanner's table to cache position of constants in constant list +** and try to reuse constants. Because some values should not be used +** as keys (nil cannot be a key, integer keys can collapse with float +** keys), the caller must provide a useful 'key' for indexing the cache. +*/ +static int addk (FuncState *fs, TValue *key, TValue *v) { + lua_State *L = fs->ls->L; + Proto *f = fs->f; + TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */ + int k, oldsize; + if (ttisinteger(idx)) { /* is there an index there? */ + k = cast_int(ivalue(idx)); + /* correct value? (warning: must distinguish floats from integers!) */ + if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && + luaV_rawequalobj(&f->k[k], v)) + return k; /* reuse index */ + } + /* constant not found; create a new entry */ + oldsize = f->sizek; + k = fs->nk; + /* numerical value does not need GC barrier; + table has no metatable, so it does not need to invalidate cache */ + setivalue(idx, k); + luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[k], v); + fs->nk++; + luaC_barrier(L, f, v); + return k; +} + + +/* +** Add a string to list of constants and return its index. +*/ +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->ls->L, &o, s); + return addk(fs, &o, &o); /* use string itself as key */ +} + + +/* +** Add an integer to list of constants and return its index. +** Integers use userdata as keys to avoid collision with floats with +** same value; conversion to 'void*' is used only for hashing, so there +** are no "precision" problems. +*/ +int luaK_intK (FuncState *fs, lua_Integer n) { + TValue k, o; + setpvalue(&k, cast(void*, cast(size_t, n))); + setivalue(&o, n); + return addk(fs, &k, &o); +} + +/* +** Add a float to list of constants and return its index. +*/ +static int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setfltvalue(&o, r); + return addk(fs, &o, &o); /* use number itself as key */ +} + + +/* +** Add a boolean to list of constants and return its index. +*/ +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); /* use boolean itself as key */ +} + + +/* +** Add nil to list of constants and return its index. +*/ +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->ls->L, &k, fs->ls->h); + return addk(fs, &k, &v); +} + + +/* +** Fix an expression to return the number of results 'nresults'. +** Either 'e' is a multi-ret expression (function call or vararg) +** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). +*/ +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getinstruction(fs, e), nresults + 1); + } + else if (e->k == VVARARG) { + Instruction *pc = &getinstruction(fs, e); + SETARG_B(*pc, nresults + 1); + SETARG_A(*pc, fs->freereg); + luaK_reserveregs(fs, 1); + } + else lua_assert(nresults == LUA_MULTRET); +} + + +/* +** Fix an expression to return one result. +** If expression is not a multi-ret expression (function call or +** vararg), it already returns one result, so nothing needs to be done. +** Function calls become VNONRELOC expressions (as its result comes +** fixed in the base register of the call), while vararg expressions +** become VRELOCABLE (as OP_VARARG puts its results where it wants). +** (Calls are created returning one result, so that does not need +** to be fixed.) +*/ +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + /* already returns 1 value */ + lua_assert(GETARG_C(getinstruction(fs, e)) == 2); + e->k = VNONRELOC; /* result has fixed position */ + e->u.info = GETARG_A(getinstruction(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getinstruction(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +/* +** Ensure that expression 'e' is not a variable. +*/ +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { /* already in a register */ + e->k = VNONRELOC; /* becomes a non-relocatable value */ + break; + } + case VUPVAL: { /* move value to some (pending) register */ + e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + OpCode op; + freereg(fs, e->u.ind.idx); + if (e->u.ind.vt == VLOCAL) { /* is 't' in a register? */ + freereg(fs, e->u.ind.t); + op = OP_GETTABLE; + } + else { + lua_assert(e->u.ind.vt == VUPVAL); + op = OP_GETTABUP; /* 't' is in an upvalue */ + } + e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx); + e->k = VRELOCABLE; + break; + } + case VVARARG: case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +/* +** Ensures expression value is in register 'reg' (and therefore +** 'e' will become a non-relocatable expression). +*/ +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codek(fs, reg, e->u.info); + break; + } + case VKFLT: { + luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VKINT: { + luaK_codek(fs, reg, luaK_intK(fs, e->u.ival)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getinstruction(fs, e); + SETARG_A(*pc, reg); /* instruction will put result in 'reg' */ + break; + } + case VNONRELOC: { + if (reg != e->u.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0); + break; + } + default: { + lua_assert(e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.info = reg; + e->k = VNONRELOC; +} + + +/* +** Ensures expression value is in any register. +*/ +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { /* no fixed register yet? */ + luaK_reserveregs(fs, 1); /* get a register */ + discharge2reg(fs, e, fs->freereg-1); /* put value there */ + } +} + + +static int code_loadbool (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +/* +** check whether list has any jump that do not produce a value +** or produce an inverted value +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +/* +** Ensures final expression result (including results from its jump +** lists) is in register 'reg'. +** If expression has jumps, need to patch these jumps either to +** its final position or to "load" instructions (for those tests +** that do not produce values). +*/ +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) /* expression itself is a test? */ + luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_loadbool(fs, reg, 0, 1); + p_t = code_loadbool(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.info = reg; + e->k = VNONRELOC; +} + + +/* +** Ensures final expression result (including results from its jump +** lists) is in next available register. +*/ +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +/* +** Ensures final expression result (including results from its jump +** lists) is in some (any) register and return that register. +*/ +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { /* expression already has a register? */ + if (!hasjumps(e)) /* no jumps? */ + return e->u.info; /* result is already in a register */ + if (e->u.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.info); /* put final result in it */ + return e->u.info; + } + } + luaK_exp2nextreg(fs, e); /* otherwise, use next available register */ + return e->u.info; +} + + +/* +** Ensures final expression result is either in a register or in an +** upvalue. +*/ +void luaK_exp2anyregup (FuncState *fs, expdesc *e) { + if (e->k != VUPVAL || hasjumps(e)) + luaK_exp2anyreg(fs, e); +} + + +/* +** Ensures final expression result is either in a register or it is +** a constant. +*/ +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +/* +** Ensures final expression result is in a valid R/K index +** (that is, it is either in a register or in 'k' with an index +** in the range of R/K indices). +** Returns R/K index. +*/ +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { /* move constants to 'k' */ + case VTRUE: e->u.info = boolK(fs, 1); goto vk; + case VFALSE: e->u.info = boolK(fs, 0); goto vk; + case VNIL: e->u.info = nilK(fs); goto vk; + case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk; + case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk; + case VK: + vk: + e->k = VK; + if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */ + return RKASK(e->u.info); + else break; + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +/* +** Generate code to store result of expression 'ex' into variable 'var'. +*/ +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.info); /* compute 'ex' into proper place */ + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); + break; + } + case VINDEXED: { + OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP; + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e); + break; + } + default: lua_assert(0); /* invalid var kind to store */ + } + freeexp(fs, ex); +} + + +/* +** Emit SELF instruction (convert expression 'e' into 'e:key(e,'). +*/ +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int ereg; + luaK_exp2anyreg(fs, e); + ereg = e->u.info; /* register where 'e' was placed */ + freeexp(fs, e); + e->u.info = fs->freereg; /* base register for op_self */ + e->k = VNONRELOC; /* self expression has a fixed register */ + luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ + luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key)); + freeexp(fs, key); +} + + +/* +** Negate condition 'e' (where 'e' is a comparison). +*/ +static void negatecondition (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +/* +** Emit instruction to jump if 'e' is 'cond' (that is, if 'cond' +** is true, code will jump if 'e' is true.) Return jump position. +** Optimize when 'e' is 'not' something, inverting the condition +** and removing the 'not'. +*/ +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getinstruction(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond); +} + + +/* +** Emit code to go through if 'e' is true, jump otherwise. +*/ +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of new jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VJMP: { /* condition? */ + negatecondition(fs, e); /* jump when it is false */ + pc = e->u.info; /* save jump position */ + break; + } + case VK: case VKFLT: case VKINT: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + default: { + pc = jumponcond(fs, e, 0); /* jump when false */ + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ + luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ + e->t = NO_JUMP; +} + + +/* +** Emit code to go through if 'e' is false, jump otherwise. +*/ +void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of new jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VJMP: { + pc = e->u.info; /* already jump if true */ + break; + } + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + default: { + pc = jumponcond(fs, e, 1); /* jump if true */ + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */ + luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */ + e->f = NO_JUMP; +} + + +/* +** Code 'not e', doing constant folding. +*/ +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; /* true == not nil == not false */ + break; + } + case VK: case VKFLT: case VKINT: case VTRUE: { + e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */ + break; + } + case VJMP: { + negatecondition(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0); + e->k = VRELOCABLE; + break; + } + default: lua_assert(0); /* cannot happen */ + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); /* values are useless when negated */ + removevalues(fs, e->t); +} + + +/* +** Create expression 't[k]'. 't' must have its final result already in a +** register or upvalue. +*/ +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + lua_assert(!hasjumps(t) && (vkisinreg(t->k) || t->k == VUPVAL)); + t->u.ind.t = t->u.info; /* register or upvalue index */ + t->u.ind.idx = luaK_exp2RK(fs, k); /* R/K index for key */ + t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL : VLOCAL; + t->k = VINDEXED; +} + + +/* +** Return false if folding can raise an error. +** Bitwise operations need operands convertible to integers; division +** operations cannot have 0 as divisor. +*/ +static int validop (int op, TValue *v1, TValue *v2) { + switch (op) { + case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: + case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: { /* conversion errors */ + lua_Integer i; + return (tointeger(v1, &i) && tointeger(v2, &i)); + } + case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */ + return (nvalue(v2) != 0); + default: return 1; /* everything else is valid */ + } +} + + +/* +** Try to "constant-fold" an operation; return 1 iff successful. +** (In this case, 'e1' has the final result.) +*/ +static int constfolding (FuncState *fs, int op, expdesc *e1, + const expdesc *e2) { + TValue v1, v2, res; + if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2)) + return 0; /* non-numeric operands or not safe to fold */ + luaO_arith(fs->ls->L, op, &v1, &v2, &res); /* does operation */ + if (ttisinteger(&res)) { + e1->k = VKINT; + e1->u.ival = ivalue(&res); + } + else { /* folds neither NaN nor 0.0 (to avoid problems with -0.0) */ + lua_Number n = fltvalue(&res); + if (luai_numisnan(n) || n == 0) + return 0; + e1->k = VKFLT; + e1->u.nval = n; + } + return 1; +} + + +/* +** Emit code for unary expressions that "produce values" +** (everything but 'not'). +** Expression to produce final result will be encoded in 'e'. +*/ +static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) { + int r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */ + freeexp(fs, e); + e->u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */ + e->k = VRELOCABLE; /* all those operations are relocatable */ + luaK_fixline(fs, line); +} + + +/* +** Emit code for binary expressions that "produce values" +** (everything but logical operators 'and'/'or' and comparison +** operators). +** Expression to produce final result will be encoded in 'e1'. +** Because 'luaK_exp2RK' can free registers, its calls must be +** in "stack order" (that is, first on 'e2', which may have more +** recent registers to be released). +*/ +static void codebinexpval (FuncState *fs, OpCode op, + expdesc *e1, expdesc *e2, int line) { + int rk2 = luaK_exp2RK(fs, e2); /* both operands are "RK" */ + int rk1 = luaK_exp2RK(fs, e1); + freeexps(fs, e1, e2); + e1->u.info = luaK_codeABC(fs, op, 0, rk1, rk2); /* generate opcode */ + e1->k = VRELOCABLE; /* all those operations are relocatable */ + luaK_fixline(fs, line); +} + + +/* +** Emit code for comparisons. +** 'e1' was already put in R/K form by 'luaK_infix'. +*/ +static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { + int rk1 = (e1->k == VK) ? RKASK(e1->u.info) + : check_exp(e1->k == VNONRELOC, e1->u.info); + int rk2 = luaK_exp2RK(fs, e2); + freeexps(fs, e1, e2); + switch (opr) { + case OPR_NE: { /* '(a ~= b)' ==> 'not (a == b)' */ + e1->u.info = condjump(fs, OP_EQ, 0, rk1, rk2); + break; + } + case OPR_GT: case OPR_GE: { + /* '(a > b)' ==> '(b < a)'; '(a >= b)' ==> '(b <= a)' */ + OpCode op = cast(OpCode, (opr - OPR_NE) + OP_EQ); + e1->u.info = condjump(fs, op, 1, rk2, rk1); /* invert operands */ + break; + } + default: { /* '==', '<', '<=' use their own opcodes */ + OpCode op = cast(OpCode, (opr - OPR_EQ) + OP_EQ); + e1->u.info = condjump(fs, op, 1, rk1, rk2); + break; + } + } + e1->k = VJMP; +} + + +/* +** Aplly prefix operation 'op' to expression 'e'. +*/ +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { + static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; + switch (op) { + case OPR_MINUS: case OPR_BNOT: /* use 'ef' as fake 2nd operand */ + if (constfolding(fs, op + LUA_OPUNM, e, &ef)) + break; + /* FALLTHROUGH */ + case OPR_LEN: + codeunexpval(fs, cast(OpCode, op + OP_UNM), e, line); + break; + case OPR_NOT: codenot(fs, e); break; + default: lua_assert(0); + } +} + + +/* +** Process 1st operand 'v' of binary operation 'op' before reading +** 2nd operand. +*/ +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the 'stack' */ + break; + } + case OPR_ADD: case OPR_SUB: + case OPR_MUL: case OPR_DIV: case OPR_IDIV: + case OPR_MOD: case OPR_POW: + case OPR_BAND: case OPR_BOR: case OPR_BXOR: + case OPR_SHL: case OPR_SHR: { + if (!tonumeral(v, NULL)) + luaK_exp2RK(fs, v); + /* else keep numeral, which may be folded with 2nd operand */ + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +/* +** Finalize code for binary operation, after reading 2nd operand. +** For '(a .. b .. c)' (which is '(a .. (b .. c))', because +** concatenation is right associative), merge second CONCAT into first +** one. +*/ +void luaK_posfix (FuncState *fs, BinOpr op, + expdesc *e1, expdesc *e2, int line) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list closed by 'luK_infix' */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list closed by 'luK_infix' */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && + GET_OPCODE(getinstruction(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.info == GETARG_B(getinstruction(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getinstruction(fs, e2), e1->u.info); + e1->k = VRELOCABLE; e1->u.info = e2->u.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codebinexpval(fs, OP_CONCAT, e1, e2, line); + } + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_IDIV: case OPR_MOD: case OPR_POW: + case OPR_BAND: case OPR_BOR: case OPR_BXOR: + case OPR_SHL: case OPR_SHR: { + if (!constfolding(fs, op + LUA_OPADD, e1, e2)) + codebinexpval(fs, cast(OpCode, op + OP_ADD), e1, e2, line); + break; + } + case OPR_EQ: case OPR_LT: case OPR_LE: + case OPR_NE: case OPR_GT: case OPR_GE: { + codecomp(fs, op, e1, e2); + break; + } + default: lua_assert(0); + } +} + + +/* +** Change line information associated with current position. +*/ +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +/* +** Emit a SETLIST instruction. +** 'base' is register that keeps table; +** 'nelems' is #table plus those to be stored now; +** 'tostore' is number of values (in registers 'base + 1',...) to add to +** table (or LUA_MULTRET to add up to stack top). +*/ +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else if (c <= MAXARG_Ax) { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + codeextraarg(fs, c); + } + else + luaX_syntaxerror(fs->ls, "constructor too long"); + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/deps/rcheevos/test/lua/src/lcode.h b/deps/rcheevos/test/lua/src/lcode.h new file mode 100644 index 0000000000..cd306d573a --- /dev/null +++ b/deps/rcheevos/test/lua/src/lcode.h @@ -0,0 +1,88 @@ +/* +** $Id: lcode.h,v 1.64 2016/01/05 16:22:37 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums (ORDER OP) +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW, + OPR_DIV, + OPR_IDIV, + OPR_BAND, OPR_BOR, OPR_BXOR, + OPR_SHL, OPR_SHR, + OPR_CONCAT, + OPR_EQ, OPR_LT, OPR_LE, + OPR_NE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +/* get (pointer to) instruction of given 'expdesc' */ +#define getinstruction(fs,e) ((fs)->f->code[(e)->u.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_intK (FuncState *fs, lua_Integer n); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, + expdesc *v2, int line); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/deps/rcheevos/test/lua/src/lcorolib.c b/deps/rcheevos/test/lua/src/lcorolib.c new file mode 100644 index 0000000000..2303429e7b --- /dev/null +++ b/deps/rcheevos/test/lua/src/lcorolib.c @@ -0,0 +1,168 @@ +/* +** $Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp $ +** Coroutine Library +** See Copyright Notice in lua.h +*/ + +#define lcorolib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static lua_State *getco (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "thread expected"); + return co; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status; + if (!lua_checkstack(co, narg)) { + lua_pushliteral(L, "too many arguments to resume"); + return -1; /* error flag */ + } + if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) { + lua_pushliteral(L, "cannot resume dead coroutine"); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + status = lua_resume(co, L, narg); + if (status == LUA_OK || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) { + lua_pop(co, nres); /* remove results anyway */ + lua_pushliteral(L, "too many results to resume"); + return -1; /* error flag */ + } + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = getco(L); + int r; + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + 'resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_type(L, -1) == LUA_TSTRING) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + return lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL; + luaL_checktype(L, 1, LUA_TFUNCTION); + NL = lua_newthread(L); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = getco(L); + if (L == co) lua_pushliteral(L, "running"); + else { + switch (lua_status(co)) { + case LUA_YIELD: + lua_pushliteral(L, "suspended"); + break; + case LUA_OK: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + lua_pushliteral(L, "normal"); /* it is running */ + else if (lua_gettop(co) == 0) + lua_pushliteral(L, "dead"); + else + lua_pushliteral(L, "suspended"); /* initial state */ + break; + } + default: /* some error occurred */ + lua_pushliteral(L, "dead"); + break; + } + } + return 1; +} + + +static int luaB_yieldable (lua_State *L) { + lua_pushboolean(L, lua_isyieldable(L)); + return 1; +} + + +static int luaB_corunning (lua_State *L) { + int ismain = lua_pushthread(L); + lua_pushboolean(L, ismain); + return 2; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {"isyieldable", luaB_yieldable}, + {NULL, NULL} +}; + + + +LUAMOD_API int luaopen_coroutine (lua_State *L) { + luaL_newlib(L, co_funcs); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/lctype.c b/deps/rcheevos/test/lua/src/lctype.c new file mode 100644 index 0000000000..ae9367e691 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lctype.c @@ -0,0 +1,55 @@ +/* +** $Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp $ +** 'ctype' functions for Lua +** See Copyright Notice in lua.h +*/ + +#define lctype_c +#define LUA_CORE + +#include "lprefix.h" + + +#include "lctype.h" + +#if !LUA_USE_CTYPE /* { */ + +#include + +LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { + 0x00, /* EOZ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ + 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ + 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ + 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, + 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ + 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +#endif /* } */ diff --git a/deps/rcheevos/test/lua/src/lctype.h b/deps/rcheevos/test/lua/src/lctype.h new file mode 100644 index 0000000000..99c7d12237 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lctype.h @@ -0,0 +1,95 @@ +/* +** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $ +** 'ctype' functions for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lctype_h +#define lctype_h + +#include "lua.h" + + +/* +** WARNING: the functions defined here do not necessarily correspond +** to the similar functions in the standard C ctype.h. They are +** optimized for the specific needs of Lua +*/ + +#if !defined(LUA_USE_CTYPE) + +#if 'A' == 65 && '0' == 48 +/* ASCII case: can use its own tables; faster and fixed */ +#define LUA_USE_CTYPE 0 +#else +/* must use standard C ctype */ +#define LUA_USE_CTYPE 1 +#endif + +#endif + + +#if !LUA_USE_CTYPE /* { */ + +#include + +#include "llimits.h" + + +#define ALPHABIT 0 +#define DIGITBIT 1 +#define PRINTBIT 2 +#define SPACEBIT 3 +#define XDIGITBIT 4 + + +#define MASK(B) (1 << (B)) + + +/* +** add 1 to char to allow index -1 (EOZ) +*/ +#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) + +/* +** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' +*/ +#define lislalpha(c) testprop(c, MASK(ALPHABIT)) +#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) +#define lisdigit(c) testprop(c, MASK(DIGITBIT)) +#define lisspace(c) testprop(c, MASK(SPACEBIT)) +#define lisprint(c) testprop(c, MASK(PRINTBIT)) +#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) + +/* +** this 'ltolower' only works for alphabetic characters +*/ +#define ltolower(c) ((c) | ('A' ^ 'a')) + + +/* two more entries for 0 and -1 (EOZ) */ +LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; + + +#else /* }{ */ + +/* +** use standard C ctypes +*/ + +#include + + +#define lislalpha(c) (isalpha(c) || (c) == '_') +#define lislalnum(c) (isalnum(c) || (c) == '_') +#define lisdigit(c) (isdigit(c)) +#define lisspace(c) (isspace(c)) +#define lisprint(c) (isprint(c)) +#define lisxdigit(c) (isxdigit(c)) + +#define ltolower(c) (tolower(c)) + +#endif /* } */ + +#endif + diff --git a/deps/rcheevos/test/lua/src/ldblib.c b/deps/rcheevos/test/lua/src/ldblib.c new file mode 100644 index 0000000000..786f6cd95d --- /dev/null +++ b/deps/rcheevos/test/lua/src/ldblib.c @@ -0,0 +1,456 @@ +/* +** $Id: ldblib.c,v 1.151 2015/11/23 11:29:43 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + +#define ldblib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** The hook table at registry[&HOOKKEY] maps threads to their current +** hook function. (We only need the unique address of 'HOOKKEY'.) +*/ +static const int HOOKKEY = 0; + + +/* +** If L1 != L, L1 can be in any state, and therefore there are no +** guarantees about its stack space; any push in L1 must be +** checked. +*/ +static void checkstack (lua_State *L, lua_State *L1, int n) { + if (L != L1 && !lua_checkstack(L1, n)) + luaL_error(L, "stack overflow"); +} + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; /* return 1st argument */ +} + + +static int db_getuservalue (lua_State *L) { + if (lua_type(L, 1) != LUA_TUSERDATA) + lua_pushnil(L); + else + lua_getuservalue(L, 1); + return 1; +} + + +static int db_setuservalue (lua_State *L) { + luaL_checktype(L, 1, LUA_TUSERDATA); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_setuservalue(L, 1); + return 1; +} + + +/* +** Auxiliary function used by several library functions: check for +** an optional thread as function's first argument and set 'arg' with +** 1 if this argument is present (so that functions can skip it to +** access their other arguments) +*/ +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; /* function will operate over current thread */ + } +} + + +/* +** Variations of 'lua_settable', used by 'db_getinfo' to put results +** from 'lua_getinfo' into result table. Key is always a string; +** value can be a string, an int, or a boolean. +*/ +static void settabss (lua_State *L, const char *k, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, k); +} + +static void settabsi (lua_State *L, const char *k, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, k); +} + +static void settabsb (lua_State *L, const char *k, int v) { + lua_pushboolean(L, v); + lua_setfield(L, -2, k); +} + + +/* +** In function 'db_getinfo', the call to 'lua_getinfo' may push +** results on the stack; later it creates the result table to put +** these objects. Function 'treatstackoption' puts the result from +** 'lua_getinfo' on top of the result table so that it can call +** 'lua_setfield'. +*/ +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) + lua_rotate(L, -2, 1); /* exchange object and table */ + else + lua_xmove(L1, L, 1); /* move object to the "main" stack */ + lua_setfield(L, -2, fname); /* put object into table */ +} + + +/* +** Calls 'lua_getinfo' and collects all results in a new table. +** L1 needs stack space for an optional input (function) plus +** two optional outputs (function and line table) from function +** 'lua_getinfo'. +*/ +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnStu"); + checkstack(L, L1, 3); + if (lua_isfunction(L, arg + 1)) { /* info about a function? */ + options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ + lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ + lua_xmove(L, L1, 1); + } + else { /* stack level */ + if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_newtable(L); /* table to collect results */ + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) { + settabsi(L, "nups", ar.nups); + settabsi(L, "nparams", ar.nparams); + settabsb(L, "isvararg", ar.isvararg); + } + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 't')) + settabsb(L, "istailcall", ar.istailcall); + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ + if (lua_isfunction(L, arg + 1)) { /* function argument? */ + lua_pushvalue(L, arg + 1); /* push function */ + lua_pushstring(L, lua_getlocal(L, NULL, nvar)); /* push local name */ + return 1; /* return only name (there is no value) */ + } + else { /* stack-level argument */ + int level = (int)luaL_checkinteger(L, arg + 1); + if (!lua_getstack(L1, level, &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + checkstack(L, L1, 1); + name = lua_getlocal(L1, &ar, nvar); + if (name) { + lua_xmove(L1, L, 1); /* move local value */ + lua_pushstring(L, name); /* push name */ + lua_rotate(L, -2, 1); /* re-order */ + return 2; + } + else { + lua_pushnil(L); /* no name (nor value) */ + return 1; + } + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + const char *name; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + int level = (int)luaL_checkinteger(L, arg + 1); + int nvar = (int)luaL_checkinteger(L, arg + 2); + if (!lua_getstack(L1, level, &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + checkstack(L, L1, 1); + lua_xmove(L, L1, 1); + name = lua_setlocal(L1, &ar, nvar); + if (name == NULL) + lua_pop(L1, 1); /* pop value (if not popped by 'lua_setlocal') */ + lua_pushstring(L, name); + return 1; +} + + +/* +** get (if 'get' is true) or set an upvalue from a closure +*/ +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = (int)luaL_checkinteger(L, 2); /* upvalue index */ + luaL_checktype(L, 1, LUA_TFUNCTION); /* closure */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); /* no-op if get is false */ + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + +/* +** Check whether a given upvalue from a given closure exists and +** returns its index +*/ +static int checkupval (lua_State *L, int argf, int argnup) { + int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */ + luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */ + luaL_argcheck(L, (lua_getupvalue(L, argf, nup) != NULL), argnup, + "invalid upvalue index"); + return nup; +} + + +static int db_upvalueid (lua_State *L) { + int n = checkupval(L, 1, 2); + lua_pushlightuserdata(L, lua_upvalueid(L, 1, n)); + return 1; +} + + +static int db_upvaluejoin (lua_State *L) { + int n1 = checkupval(L, 1, 2); + int n2 = checkupval(L, 3, 4); + luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected"); + luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected"); + lua_upvaluejoin(L, 1, n1, 3, n2); + return 0; +} + + +/* +** Call hook function registered at hook table for the current +** thread (if there is one) +*/ +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail call"}; + lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); + lua_pushthread(L); + if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */ + lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */ + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); /* push current line */ + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); /* call hook function */ + } +} + + +/* +** Convert a string mask (for 'sethook') into a bit mask +*/ +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +/* +** Convert a bit mask (for 'gethook') into a string mask +*/ +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { /* no hook? */ + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = (int)luaL_optinteger(L, arg + 3, 0); + func = hookf; mask = makemask(smask, count); + } + if (lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY) == LUA_TNIL) { + lua_createtable(L, 0, 2); /* create a hook table */ + lua_pushvalue(L, -1); + lua_rawsetp(L, LUA_REGISTRYINDEX, &HOOKKEY); /* set it in position */ + lua_pushstring(L, "k"); + lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */ + lua_pushvalue(L, -1); + lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */ + } + checkstack(L, L1, 1); + lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */ + lua_pushvalue(L, arg + 1); /* value (hook function) */ + lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */ + lua_sethook(L1, func, mask, count); + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook == NULL) /* no hook? */ + lua_pushnil(L); + else if (hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { /* hook table must exist */ + lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); + checkstack(L, L1, 1); + lua_pushthread(L1); lua_xmove(L1, L, 1); + lua_rawget(L, -2); /* 1st result = hooktable[L1] */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */ + lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */ + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + lua_writestringerror("%s", "lua_debug> "); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) + lua_writestringerror("%s\n", lua_tostring(L, -1)); + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +static int db_traceback (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + const char *msg = lua_tostring(L, arg + 1); + if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */ + lua_pushvalue(L, arg + 1); /* return it untouched */ + else { + int level = (int)luaL_optinteger(L, arg + 2, (L == L1) ? 1 : 0); + luaL_traceback(L, L1, msg, level); + } + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getuservalue", db_getuservalue}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"upvaluejoin", db_upvaluejoin}, + {"upvalueid", db_upvalueid}, + {"setuservalue", db_setuservalue}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_traceback}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_debug (lua_State *L) { + luaL_newlib(L, dblib); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/ldebug.c b/deps/rcheevos/test/lua/src/ldebug.c new file mode 100644 index 0000000000..4a98cd4116 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ldebug.c @@ -0,0 +1,698 @@ +/* +** $Id: ldebug.c,v 2.121 2016/10/19 12:32:10 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + +#define ldebug_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +#define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) + + +/* Active Lua function (given call info) */ +#define ci_func(ci) (clLvalue((ci)->func)) + + +static const char *funcnamefromcode (lua_State *L, CallInfo *ci, + const char **name); + + +static int currentpc (CallInfo *ci) { + lua_assert(isLua(ci)); + return pcRel(ci->u.l.savedpc, ci_func(ci)->p); +} + + +static int currentline (CallInfo *ci) { + return getfuncline(ci_func(ci)->p, currentpc(ci)); +} + + +/* +** If function yielded, its 'func' can be in the 'extra' field. The +** next function restores 'func' to its correct value for debugging +** purposes. (It exchanges 'func' and 'extra'; so, when called again, +** after debugging, it also "re-restores" ** 'func' to its altered value. +*/ +static void swapextra (lua_State *L) { + if (L->status == LUA_YIELD) { + CallInfo *ci = L->ci; /* get function that yielded */ + StkId temp = ci->func; /* exchange its 'func' and 'extra' values */ + ci->func = restorestack(L, ci->extra); + ci->extra = savestack(L, temp); + } +} + + +/* +** This function can be called asynchronously (e.g. during a signal). +** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by +** 'resethookcount') are for debug only, and it is no problem if they +** get arbitrary values (causes at most one wrong hook call). 'hookmask' +** is an atomic value. We assume that pointers are atomic too (e.g., gcc +** ensures that for all platforms where it runs). Moreover, 'hook' is +** always checked before being called (see 'luaD_hook'). +*/ +LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + if (isLua(L->ci)) + L->oldpc = L->ci->u.l.savedpc; + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + if (level < 0) return 0; /* invalid (negative) level */ + lua_lock(L); + for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) + level--; + if (level == 0 && ci != &L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = ci; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static const char *upvalname (Proto *p, int uv) { + TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name); + if (s == NULL) return "?"; + else return getstr(s); +} + + +static const char *findvararg (CallInfo *ci, int n, StkId *pos) { + int nparams = clLvalue(ci->func)->p->numparams; + if (n >= cast_int(ci->u.l.base - ci->func) - nparams) + return NULL; /* no such vararg */ + else { + *pos = ci->func + nparams + n; + return "(*vararg)"; /* generic name for any vararg */ + } +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n, + StkId *pos) { + const char *name = NULL; + StkId base; + if (isLua(ci)) { + if (n < 0) /* access to vararg values? */ + return findvararg(ci, -n, pos); + else { + base = ci->u.l.base; + name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); + } + } + else + base = ci->func + 1; + if (name == NULL) { /* no 'standard' name? */ + StkId limit = (ci == L->ci) ? L->top : ci->next->func; + if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + name = "(*temporary)"; /* generic name for any valid slot */ + else + return NULL; /* no name */ + } + *pos = base + (n - 1); + return name; +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + const char *name; + lua_lock(L); + swapextra(L); + if (ar == NULL) { /* information about non-active function? */ + if (!isLfunction(L->top - 1)) /* not a Lua function? */ + name = NULL; + else /* consider live variables at function start (parameters) */ + name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); + } + else { /* active function; get information through 'ar' */ + StkId pos = NULL; /* to avoid warnings */ + name = findlocal(L, ar->i_ci, n, &pos); + if (name) { + setobj2s(L, L->top, pos); + api_incr_top(L); + } + } + swapextra(L); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + StkId pos = NULL; /* to avoid warnings */ + const char *name; + lua_lock(L); + swapextra(L); + name = findlocal(L, ar->i_ci, n, &pos); + if (name) { + setobjs2s(L, pos, L->top - 1); + L->top--; /* pop value */ + } + swapextra(L); + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (noLuaClosure(cl)) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + Proto *p = cl->l.p; + ar->source = p->source ? getstr(p->source) : "=?"; + ar->linedefined = p->linedefined; + ar->lastlinedefined = p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (noLuaClosure(f)) { + setnilvalue(L->top); + api_incr_top(L); + } + else { + int i; + TValue v; + int *lineinfo = f->l.p->lineinfo; + Table *t = luaH_new(L); /* new table to store active lines */ + sethvalue(L, L->top, t); /* push it on stack */ + api_incr_top(L); + setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ + for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */ + luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ + } +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + if (ci == NULL) /* no 'ci'? */ + return NULL; /* no info */ + else if (ci->callstatus & CIST_FIN) { /* is this a finalizer? */ + *name = "__gc"; + return "metamethod"; /* report it as such */ + } + /* calling function is a known Lua function? */ + else if (!(ci->callstatus & CIST_TAIL) && isLua(ci->previous)) + return funcnamefromcode(L, ci->previous, name); + else return NULL; /* no way to find a name */ +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1; + break; + } + case 'u': { + ar->nups = (f == NULL) ? 0 : f->c.nupvalues; + if (noLuaClosure(f)) { + ar->isvararg = 1; + ar->nparams = 0; + } + else { + ar->isvararg = f->l.p->is_vararg; + ar->nparams = f->l.p->numparams; + } + break; + } + case 't': { + ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; + break; + } + case 'n': { + ar->namewhat = getfuncname(L, ci, &ar->name); + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *cl; + CallInfo *ci; + StkId func; + lua_lock(L); + swapextra(L); + if (*what == '>') { + ci = NULL; + func = L->top - 1; + api_check(L, ttisfunction(func), "function expected"); + what++; /* skip the '>' */ + L->top--; /* pop function */ + } + else { + ci = ar->i_ci; + func = ci->func; + lua_assert(ttisfunction(ci->func)); + } + cl = ttisclosure(func) ? clvalue(func) : NULL; + status = auxgetinfo(L, what, ar, cl, ci); + if (strchr(what, 'f')) { + setobjs2s(L, L->top, func); + api_incr_top(L); + } + swapextra(L); /* correct before option 'L', which can raise a mem. error */ + if (strchr(what, 'L')) + collectvalidlines(L, cl); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution +** ======================================================= +*/ + +static const char *getobjname (Proto *p, int lastpc, int reg, + const char **name); + + +/* +** find a "name" for the RK value 'c' +*/ +static void kname (Proto *p, int pc, int c, const char **name) { + if (ISK(c)) { /* is 'c' a constant? */ + TValue *kvalue = &p->k[INDEXK(c)]; + if (ttisstring(kvalue)) { /* literal constant? */ + *name = svalue(kvalue); /* it is its own name */ + return; + } + /* else no reasonable name found */ + } + else { /* 'c' is a register */ + const char *what = getobjname(p, pc, c, name); /* search for 'c' */ + if (what && *what == 'c') { /* found a constant name? */ + return; /* 'name' already filled */ + } + /* else no reasonable name found */ + } + *name = "?"; /* no reasonable name found */ +} + + +static int filterpc (int pc, int jmptarget) { + if (pc < jmptarget) /* is code conditional (inside a jump)? */ + return -1; /* cannot know who sets that register */ + else return pc; /* current position sets that register */ +} + + +/* +** try to find last instruction before 'lastpc' that modified register 'reg' +*/ +static int findsetreg (Proto *p, int lastpc, int reg) { + int pc; + int setreg = -1; /* keep last instruction that changed 'reg' */ + int jmptarget = 0; /* any code before this address is conditional */ + for (pc = 0; pc < lastpc; pc++) { + Instruction i = p->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + switch (op) { + case OP_LOADNIL: { + int b = GETARG_B(i); + if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ + setreg = filterpc(pc, jmptarget); + break; + } + case OP_TFORCALL: { + if (reg >= a + 2) /* affect all regs above its base */ + setreg = filterpc(pc, jmptarget); + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (reg >= a) /* affect all registers above base */ + setreg = filterpc(pc, jmptarget); + break; + } + case OP_JMP: { + int b = GETARG_sBx(i); + int dest = pc + 1 + b; + /* jump is forward and do not skip 'lastpc'? */ + if (pc < dest && dest <= lastpc) { + if (dest > jmptarget) + jmptarget = dest; /* update 'jmptarget' */ + } + break; + } + default: + if (testAMode(op) && reg == a) /* any instruction that set A */ + setreg = filterpc(pc, jmptarget); + break; + } + } + return setreg; +} + + +static const char *getobjname (Proto *p, int lastpc, int reg, + const char **name) { + int pc; + *name = luaF_getlocalname(p, reg + 1, lastpc); + if (*name) /* is a local? */ + return "local"; + /* else try symbolic execution */ + pc = findsetreg(p, lastpc, reg); + if (pc != -1) { /* could find instruction? */ + Instruction i = p->code[pc]; + OpCode op = GET_OPCODE(i); + switch (op) { + case OP_MOVE: { + int b = GETARG_B(i); /* move from 'b' to 'a' */ + if (b < GETARG_A(i)) + return getobjname(p, pc, b, name); /* get name for 'b' */ + break; + } + case OP_GETTABUP: + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + int t = GETARG_B(i); /* table index */ + const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ + ? luaF_getlocalname(p, t + 1, pc) + : upvalname(p, t); + kname(p, pc, k, name); + return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; + } + case OP_GETUPVAL: { + *name = upvalname(p, GETARG_B(i)); + return "upvalue"; + } + case OP_LOADK: + case OP_LOADKX: { + int b = (op == OP_LOADK) ? GETARG_Bx(i) + : GETARG_Ax(p->code[pc + 1]); + if (ttisstring(&p->k[b])) { + *name = svalue(&p->k[b]); + return "constant"; + } + break; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + kname(p, pc, k, name); + return "method"; + } + default: break; /* go through to return NULL */ + } + } + return NULL; /* could not find reasonable name */ +} + + +/* +** Try to find a name for a function based on the code that called it. +** (Only works when function was called by a Lua function.) +** Returns what the name is (e.g., "for iterator", "method", +** "metamethod") and sets '*name' to point to the name. +*/ +static const char *funcnamefromcode (lua_State *L, CallInfo *ci, + const char **name) { + TMS tm = (TMS)0; /* (initial value avoids warnings) */ + Proto *p = ci_func(ci)->p; /* calling function */ + int pc = currentpc(ci); /* calling instruction index */ + Instruction i = p->code[pc]; /* calling instruction */ + if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ + *name = "?"; + return "hook"; + } + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + return getobjname(p, pc, GETARG_A(i), name); /* get function name */ + case OP_TFORCALL: { /* for iterator */ + *name = "for iterator"; + return "for iterator"; + } + /* other instructions can do calls through metamethods */ + case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: + tm = TM_INDEX; + break; + case OP_SETTABUP: case OP_SETTABLE: + tm = TM_NEWINDEX; + break; + case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: + case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: + case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { + int offset = cast_int(GET_OPCODE(i)) - cast_int(OP_ADD); /* ORDER OP */ + tm = cast(TMS, offset + cast_int(TM_ADD)); /* ORDER TM */ + break; + } + case OP_UNM: tm = TM_UNM; break; + case OP_BNOT: tm = TM_BNOT; break; + case OP_LEN: tm = TM_LEN; break; + case OP_CONCAT: tm = TM_CONCAT; break; + case OP_EQ: tm = TM_EQ; break; + case OP_LT: tm = TM_LT; break; + case OP_LE: tm = TM_LE; break; + default: + return NULL; /* cannot find a reasonable name */ + } + *name = getstr(G(L)->tmname[tm]); + return "metamethod"; +} + +/* }====================================================== */ + + + +/* +** The subtraction of two potentially unrelated pointers is +** not ISO C, but it should not crash a program; the subsequent +** checks are ISO C and ensure a correct result. +*/ +static int isinstack (CallInfo *ci, const TValue *o) { + ptrdiff_t i = o - ci->u.l.base; + return (0 <= i && i < (ci->top - ci->u.l.base) && ci->u.l.base + i == o); +} + + +/* +** Checks whether value 'o' came from an upvalue. (That can only happen +** with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on +** upvalues.) +*/ +static const char *getupvalname (CallInfo *ci, const TValue *o, + const char **name) { + LClosure *c = ci_func(ci); + int i; + for (i = 0; i < c->nupvalues; i++) { + if (c->upvals[i]->v == o) { + *name = upvalname(c->p, i); + return "upvalue"; + } + } + return NULL; +} + + +static const char *varinfo (lua_State *L, const TValue *o) { + const char *name = NULL; /* to avoid warnings */ + CallInfo *ci = L->ci; + const char *kind = NULL; + if (isLua(ci)) { + kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ + if (!kind && isinstack(ci, o)) /* no? try a register */ + kind = getobjname(ci_func(ci)->p, currentpc(ci), + cast_int(o - ci->u.l.base), &name); + } + return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; +} + + +l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *t = luaT_objtypename(L, o); + luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o)); +} + + +l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { + if (ttisstring(p1) || cvt2str(p1)) p1 = p2; + luaG_typeerror(L, p1, "concatenate"); +} + + +l_noret luaG_opinterror (lua_State *L, const TValue *p1, + const TValue *p2, const char *msg) { + lua_Number temp; + if (!tonumber(p1, &temp)) /* first operand is wrong? */ + p2 = p1; /* now second is wrong */ + luaG_typeerror(L, p2, msg); +} + + +/* +** Error when both values are convertible to numbers, but not to integers +*/ +l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2) { + lua_Integer temp; + if (!tointeger(p1, &temp)) + p2 = p1; + luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2)); +} + + +l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_objtypename(L, p1); + const char *t2 = luaT_objtypename(L, p2); + if (strcmp(t1, t2) == 0) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); +} + + +/* add src:line information to 'msg' */ +const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, + int line) { + char buff[LUA_IDSIZE]; + if (src) + luaO_chunkid(buff, getstr(src), LUA_IDSIZE); + else { /* no source available; use "?" instead */ + buff[0] = '?'; buff[1] = '\0'; + } + return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); +} + + +l_noret luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + L->top++; /* assume EXTRC_STACK */ + luaD_callnoyield(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { + CallInfo *ci = L->ci; + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); /* format message */ + va_end(argp); + if (isLua(ci)) /* if Lua function, add source:line information */ + luaG_addinfo(L, msg, ci_func(ci)->p->source, currentline(ci)); + luaG_errormsg(L); +} + + +void luaG_traceexec (lua_State *L) { + CallInfo *ci = L->ci; + lu_byte mask = L->hookmask; + int counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT)); + if (counthook) + resethookcount(L); /* reset count */ + else if (!(mask & LUA_MASKLINE)) + return; /* no line hook and count != 0; nothing to be done */ + if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */ + ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */ + return; /* do not call hook again (VM yielded, so it did not move) */ + } + if (counthook) + luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(ci)->p; + int npc = pcRel(ci->u.l.savedpc, p); + int newline = getfuncline(p, npc); + if (npc == 0 || /* call linehook when enter a new function, */ + ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ + newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ + luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ + } + L->oldpc = ci->u.l.savedpc; + if (L->status == LUA_YIELD) { /* did hook yield? */ + if (counthook) + L->hookcount = 1; /* undo decrement to zero */ + ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ + ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ + ci->func = L->top - 1; /* protect stack below results */ + luaD_throw(L, LUA_YIELD); + } +} + diff --git a/deps/rcheevos/test/lua/src/ldebug.h b/deps/rcheevos/test/lua/src/ldebug.h new file mode 100644 index 0000000000..0e31546b1b --- /dev/null +++ b/deps/rcheevos/test/lua/src/ldebug.h @@ -0,0 +1,39 @@ +/* +** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, + const TValue *p2, + const char *msg); +LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, + TString *src, int line); +LUAI_FUNC l_noret luaG_errormsg (lua_State *L); +LUAI_FUNC void luaG_traceexec (lua_State *L); + + +#endif diff --git a/deps/rcheevos/test/lua/src/ldo.c b/deps/rcheevos/test/lua/src/ldo.c new file mode 100644 index 0000000000..0a0132ce90 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ldo.c @@ -0,0 +1,802 @@ +/* +** $Id: ldo.c,v 2.157 2016/12/13 15:52:21 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#define ldo_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + +#define errorstatus(s) ((s) > LUA_YIELD) + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + +/* +** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By +** default, Lua handles errors with exceptions when compiling as +** C++ code, with _longjmp/_setjmp when asked to use them, and with +** longjmp/setjmp otherwise. +*/ +#if !defined(LUAI_THROW) /* { */ + +#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */ + +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) \ + try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_POSIX) /* }{ */ + +/* in POSIX, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else /* }{ */ + +/* ISO C handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif /* } */ + +#endif /* } */ + + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { /* memory error? */ + setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + default: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +l_noret luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { /* thread has an error handler? */ + L->errorJmp->status = errcode; /* set status */ + LUAI_THROW(L, L->errorJmp); /* jump to it */ + } + else { /* thread has no error handler */ + global_State *g = G(L); + L->status = cast_byte(errcode); /* mark it as dead */ + if (g->mainthread->errorJmp) { /* main thread has a handler? */ + setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ + luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ + } + else { /* no handler at all; abort */ + if (g->panic) { /* panic function? */ + seterrorobj(L, errcode, L->top); /* assume EXTRC_STACK */ + if (L->ci->top < L->top) + L->ci->top = L->top; /* pushing msg. can break this invariant */ + lua_unlock(L); + g->panic(L); /* call panic function (last chance to jump out) */ + } + abort(); + } + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + unsigned short oldnCcalls = L->nCcalls; + struct lua_longjmp lj; + lj.status = LUA_OK; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + L->nCcalls = oldnCcalls; + return lj.status; +} + +/* }====================================================== */ + + +/* +** {================================================================== +** Stack reallocation +** =================================================================== +*/ +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + UpVal *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->u.open.next) + up->v = (up->v - oldstack) + L->stack; + for (ci = L->ci; ci != NULL; ci = ci->previous) { + ci->top = (ci->top - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + if (isLua(ci)) + ci->u.l.base = (ci->u.l.base - oldstack) + L->stack; + } +} + + +/* some space for error handling */ +#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int lim = L->stacksize; + lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRC_STACK); + luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue); + for (; lim < newsize; lim++) + setnilvalue(L->stack + lim); /* erase new segment */ + L->stacksize = newsize; + L->stack_last = L->stack + newsize - EXTRC_STACK; + correctstack(L, oldstack); +} + + +void luaD_growstack (lua_State *L, int n) { + int size = L->stacksize; + if (size > LUAI_MAXSTACK) /* error after extra size? */ + luaD_throw(L, LUA_ERRERR); + else { + int needed = cast_int(L->top - L->stack) + n + EXTRC_STACK; + int newsize = 2 * size; + if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; + if (newsize < needed) newsize = needed; + if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ + luaD_reallocstack(L, ERRORSTACKSIZE); + luaG_runerror(L, "stack overflow"); + } + else + luaD_reallocstack(L, newsize); + } +} + + +static int stackinuse (lua_State *L) { + CallInfo *ci; + StkId lim = L->top; + for (ci = L->ci; ci != NULL; ci = ci->previous) { + if (lim < ci->top) lim = ci->top; + } + lua_assert(lim <= L->stack_last); + return cast_int(lim - L->stack) + 1; /* part of stack in use */ +} + + +void luaD_shrinkstack (lua_State *L) { + int inuse = stackinuse(L); + int goodsize = inuse + (inuse / 8) + 2*EXTRC_STACK; + if (goodsize > LUAI_MAXSTACK) + goodsize = LUAI_MAXSTACK; /* respect stack limit */ + if (L->stacksize > LUAI_MAXSTACK) /* had been handling stack overflow? */ + luaE_freeCI(L); /* free all CIs (list grew because of an error) */ + else + luaE_shrinkCI(L); /* shrink list */ + /* if thread is currently not handling a stack overflow and its + good size is smaller than current size, shrink its stack */ + if (inuse <= (LUAI_MAXSTACK - EXTRC_STACK) && + goodsize < L->stacksize) + luaD_reallocstack(L, goodsize); + else /* don't change stack */ + condmovestack(L,{},{}); /* (change only for debugging) */ +} + + +void luaD_inctop (lua_State *L) { + luaD_checkstack(L, 1); + L->top++; +} + +/* }================================================================== */ + + +/* +** Call a hook for the given event. Make sure there is a hook to be +** called. (Both 'L->hook' and 'L->hookmask', which triggers this +** function, can be changed asynchronously by signals.) +*/ +void luaD_hook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { /* make sure there is a hook */ + CallInfo *ci = L->ci; + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + ar.i_ci = ci; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + ci->callstatus |= CIST_HOOKED; + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + ci->callstatus &= ~CIST_HOOKED; + } +} + + +static void callhook (lua_State *L, CallInfo *ci) { + int hook = LUA_HOOKCALL; + ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ + if (isLua(ci->previous) && + GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) { + ci->callstatus |= CIST_TAIL; + hook = LUA_HOOKTAILCALL; + } + luaD_hook(L, hook, -1); + ci->u.l.savedpc--; /* correct 'pc' */ +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + StkId base, fixed; + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i = 0; i < nfixargs && i < actual; i++) { + setobjs2s(L, L->top++, fixed + i); + setnilvalue(fixed + i); /* erase original copy (for GC) */ + } + for (; i < nfixargs; i++) + setnilvalue(L->top++); /* complete missing arguments */ + return base; +} + + +/* +** Check whether __call metafield of 'func' is a function. If so, put +** it in stack below original 'func' so that 'luaD_precall' can call +** it. Raise an error if __call metafield is not a function. +*/ +static void tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at 'func' */ + for (p = L->top; p > func; p--) + setobjs2s(L, p, p-1); + L->top++; /* slot ensured by caller */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ +} + + +/* +** Given 'nres' results at 'firstResult', move 'wanted' of them to 'res'. +** Handle most typical cases (zero results for commands, one result for +** expressions, multiple results for tail calls/single parameters) +** separated. +*/ +static int moveresults (lua_State *L, const TValue *firstResult, StkId res, + int nres, int wanted) { + switch (wanted) { /* handle typical cases separately */ + case 0: break; /* nothing to move */ + case 1: { /* one result needed */ + if (nres == 0) /* no results? */ + firstResult = luaO_nilobject; /* adjust with nil */ + setobjs2s(L, res, firstResult); /* move it to proper place */ + break; + } + case LUA_MULTRET: { + int i; + for (i = 0; i < nres; i++) /* move all results to correct place */ + setobjs2s(L, res + i, firstResult + i); + L->top = res + nres; + return 0; /* wanted == LUA_MULTRET */ + } + default: { + int i; + if (wanted <= nres) { /* enough results? */ + for (i = 0; i < wanted; i++) /* move wanted results to correct place */ + setobjs2s(L, res + i, firstResult + i); + } + else { /* not enough results; use all of them plus nils */ + for (i = 0; i < nres; i++) /* move all results to correct place */ + setobjs2s(L, res + i, firstResult + i); + for (; i < wanted; i++) /* complete wanted number of results */ + setnilvalue(res + i); + } + break; + } + } + L->top = res + wanted; /* top points after the last result */ + return 1; +} + + +/* +** Finishes a function call: calls hook if necessary, removes CallInfo, +** moves current number of results to proper place; returns 0 iff call +** wanted multiple (variable number of) results. +*/ +int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) { + StkId res; + int wanted = ci->nresults; + if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { + if (L->hookmask & LUA_MASKRET) { + ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ + luaD_hook(L, LUA_HOOKRET, -1); + firstResult = restorestack(L, fr); + } + L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ + } + res = ci->func; /* res == final position of 1st result */ + L->ci = ci->previous; /* back to caller */ + /* move results to proper place */ + return moveresults(L, firstResult, res, nres, wanted); +} + + + +#define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L))) + + +/* macro to check stack size, preserving 'p' */ +#define checkstackp(L,n,p) \ + luaD_checkstackaux(L, n, \ + ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ + luaC_checkGC(L), /* stack grow uses memory */ \ + p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ + + +/* +** Prepares a function call: checks the stack, creates a new CallInfo +** entry, fills in the relevant information, calls hook if needed. +** If function is a C function, does the call, too. (Otherwise, leave +** the execution ('luaV_execute') to the caller, to allow stackless +** calls.) Returns true iff function has been executed (C function). +*/ +int luaD_precall (lua_State *L, StkId func, int nresults) { + lua_CFunction f; + CallInfo *ci; + switch (ttype(func)) { + case LUA_TCCL: /* C closure */ + f = clCvalue(func)->f; + goto Cfunc; + case LUA_TLCF: /* light C function */ + f = fvalue(func); + Cfunc: { + int n; /* number of returns */ + checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ + ci = next_ci(L); /* now 'enter' new function */ + ci->nresults = nresults; + ci->func = func; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->callstatus = 0; + if (L->hookmask & LUA_MASKCALL) + luaD_hook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*f)(L); /* do the actual call */ + lua_lock(L); + api_checknelems(L, n); + luaD_poscall(L, ci, L->top - n, n); + return 1; + } + case LUA_TLCL: { /* Lua function: prepare its call */ + StkId base; + Proto *p = clLvalue(func)->p; + int n = cast_int(L->top - func) - 1; /* number of real arguments */ + int fsize = p->maxstacksize; /* frame size */ + checkstackp(L, fsize, func); + if (p->is_vararg) + base = adjust_varargs(L, p, n); + else { /* non vararg function */ + for (; n < p->numparams; n++) + setnilvalue(L->top++); /* complete missing arguments */ + base = func + 1; + } + ci = next_ci(L); /* now 'enter' new function */ + ci->nresults = nresults; + ci->func = func; + ci->u.l.base = base; + L->top = ci->top = base + fsize; + lua_assert(ci->top <= L->stack_last); + ci->u.l.savedpc = p->code; /* starting point */ + ci->callstatus = CIST_LUA; + if (L->hookmask & LUA_MASKCALL) + callhook(L, ci); + return 0; + } + default: { /* not a function */ + checkstackp(L, 1, func); /* ensure space for metamethod */ + tryfuncTM(L, func); /* try to get '__call' metamethod */ + return luaD_precall(L, func, nresults); /* now it must be a function */ + } + } +} + + +/* +** Check appropriate error for stack overflow ("regular" overflow or +** overflow while handling stack overflow). If 'nCalls' is larger than +** LUAI_MAXCCALLS (which means it is handling a "regular" overflow) but +** smaller than 9/8 of LUAI_MAXCCALLS, does not report an error (to +** allow overflow handling to work) +*/ +static void stackerror (lua_State *L) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) + stackerror(L); + if (!luaD_precall(L, func, nResults)) /* is a Lua function? */ + luaV_execute(L); /* call it */ + L->nCcalls--; +} + + +/* +** Similar to 'luaD_call', but does not allow yields during the call +*/ +void luaD_callnoyield (lua_State *L, StkId func, int nResults) { + L->nny++; + luaD_call(L, func, nResults); + L->nny--; +} + + +/* +** Completes the execution of an interrupted C function, calling its +** continuation function. +*/ +static void finishCcall (lua_State *L, int status) { + CallInfo *ci = L->ci; + int n; + /* must have a continuation and must be able to call it */ + lua_assert(ci->u.c.k != NULL && L->nny == 0); + /* error status can only happen in a protected call */ + lua_assert((ci->callstatus & CIST_YPCALL) || status == LUA_YIELD); + if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */ + ci->callstatus &= ~CIST_YPCALL; /* continuation is also inside it */ + L->errfunc = ci->u.c.old_errfunc; /* with the same error function */ + } + /* finish 'lua_callk'/'lua_pcall'; CIST_YPCALL and 'errfunc' already + handled */ + adjustresults(L, ci->nresults); + lua_unlock(L); + n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation function */ + lua_lock(L); + api_checknelems(L, n); + luaD_poscall(L, ci, L->top - n, n); /* finish 'luaD_precall' */ +} + + +/* +** Executes "full continuation" (everything in the stack) of a +** previously interrupted coroutine until the stack is empty (or another +** interruption long-jumps out of the loop). If the coroutine is +** recovering from an error, 'ud' points to the error status, which must +** be passed to the first continuation function (otherwise the default +** status is LUA_YIELD). +*/ +static void unroll (lua_State *L, void *ud) { + if (ud != NULL) /* error status? */ + finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */ + while (L->ci != &L->base_ci) { /* something in the stack */ + if (!isLua(L->ci)) /* C function? */ + finishCcall(L, LUA_YIELD); /* complete its execution */ + else { /* Lua function */ + luaV_finishOp(L); /* finish interrupted instruction */ + luaV_execute(L); /* execute down to higher C 'boundary' */ + } + } +} + + +/* +** Try to find a suspended protected call (a "recover point") for the +** given thread. +*/ +static CallInfo *findpcall (lua_State *L) { + CallInfo *ci; + for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ + if (ci->callstatus & CIST_YPCALL) + return ci; + } + return NULL; /* no pending pcall */ +} + + +/* +** Recovers from an error in a coroutine. Finds a recover point (if +** there is one) and completes the execution of the interrupted +** 'luaD_pcall'. If there is no recover point, returns zero. +*/ +static int recover (lua_State *L, int status) { + StkId oldtop; + CallInfo *ci = findpcall(L); + if (ci == NULL) return 0; /* no recovery point */ + /* "finish" luaD_pcall */ + oldtop = restorestack(L, ci->extra); + luaF_close(L, oldtop); + seterrorobj(L, status, oldtop); + L->ci = ci; + L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */ + L->nny = 0; /* should be zero to be yieldable */ + luaD_shrinkstack(L); + L->errfunc = ci->u.c.old_errfunc; + return 1; /* continue running the coroutine */ +} + + +/* +** Signal an error in the call to 'lua_resume', not in the execution +** of the coroutine itself. (Such errors should not be handled by any +** coroutine error handler and should not kill the coroutine.) +*/ +static int resume_error (lua_State *L, const char *msg, int narg) { + L->top -= narg; /* remove args from the stack */ + setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ + api_incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +/* +** Do the work for 'lua_resume' in protected mode. Most of the work +** depends on the status of the coroutine: initial state, suspended +** inside a hook, or regularly suspended (optionally with a continuation +** function), plus erroneous cases: non-suspended coroutine or dead +** coroutine. +*/ +static void resume (lua_State *L, void *ud) { + int n = *(cast(int*, ud)); /* number of arguments */ + StkId firstArg = L->top - n; /* first argument */ + CallInfo *ci = L->ci; + if (L->status == LUA_OK) { /* starting a coroutine? */ + if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) /* Lua function? */ + luaV_execute(L); /* call it */ + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = LUA_OK; /* mark that it is running (again) */ + ci->func = restorestack(L, ci->extra); + if (isLua(ci)) /* yielded inside a hook? */ + luaV_execute(L); /* just continue running Lua code */ + else { /* 'common' yield */ + if (ci->u.c.k != NULL) { /* does it have a continuation function? */ + lua_unlock(L); + n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */ + lua_lock(L); + api_checknelems(L, n); + firstArg = L->top - n; /* yield results come from continuation */ + } + luaD_poscall(L, ci, firstArg, n); /* finish 'luaD_precall' */ + } + unroll(L, NULL); /* run continuation */ + } +} + + +LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { + int status; + unsigned short oldnny = L->nny; /* save "number of non-yieldable" calls */ + lua_lock(L); + if (L->status == LUA_OK) { /* may be starting a coroutine */ + if (L->ci != &L->base_ci) /* not in base level? */ + return resume_error(L, "cannot resume non-suspended coroutine", nargs); + } + else if (L->status != LUA_YIELD) + return resume_error(L, "cannot resume dead coroutine", nargs); + L->nCcalls = (from) ? from->nCcalls + 1 : 1; + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow", nargs); + luai_userstateresume(L, nargs); + L->nny = 0; /* allow yields */ + api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); + status = luaD_rawrunprotected(L, resume, &nargs); + if (status == -1) /* error calling 'lua_resume'? */ + status = LUA_ERRRUN; + else { /* continue running after recoverable errors */ + while (errorstatus(status) && recover(L, status)) { + /* unroll continuation */ + status = luaD_rawrunprotected(L, unroll, &status); + } + if (errorstatus(status)) { /* unrecoverable error? */ + L->status = cast_byte(status); /* mark thread as 'dead' */ + seterrorobj(L, status, L->top); /* push error message */ + L->ci->top = L->top; + } + else lua_assert(status == L->status); /* normal end or yield */ + } + L->nny = oldnny; /* restore 'nny' */ + L->nCcalls--; + lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); + lua_unlock(L); + return status; +} + + +LUA_API int lua_isyieldable (lua_State *L) { + return (L->nny == 0); +} + + +LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, + lua_KFunction k) { + CallInfo *ci = L->ci; + luai_userstateyield(L, nresults); + lua_lock(L); + api_checknelems(L, nresults); + if (L->nny > 0) { + if (L != G(L)->mainthread) + luaG_runerror(L, "attempt to yield across a C-call boundary"); + else + luaG_runerror(L, "attempt to yield from outside a coroutine"); + } + L->status = LUA_YIELD; + ci->extra = savestack(L, ci->func); /* save current 'func' */ + if (isLua(ci)) { /* inside a hook? */ + api_check(L, k == NULL, "hooks cannot continue after yielding"); + } + else { + if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ + ci->u.c.ctx = ctx; /* save context */ + ci->func = L->top - nresults - 1; /* protect stack below results */ + luaD_throw(L, LUA_YIELD); + } + lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ + lua_unlock(L); + return 0; /* return to 'luaD_hook' */ +} + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + CallInfo *old_ci = L->ci; + lu_byte old_allowhooks = L->allowhook; + unsigned short old_nny = L->nny; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != LUA_OK) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close possible pending closures */ + seterrorobj(L, status, oldtop); + L->ci = old_ci; + L->allowhook = old_allowhooks; + L->nny = old_nny; + luaD_shrinkstack(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to 'f_parser' */ + ZIO *z; + Mbuffer buff; /* dynamic structure used by the scanner */ + Dyndata dyd; /* dynamic structures used by the parser */ + const char *mode; + const char *name; +}; + + +static void checkmode (lua_State *L, const char *mode, const char *x) { + if (mode && strchr(mode, x[0]) == NULL) { + luaO_pushfstring(L, + "attempt to load a %s chunk (mode is '%s')", x, mode); + luaD_throw(L, LUA_ERRSYNTAX); + } +} + + +static void f_parser (lua_State *L, void *ud) { + LClosure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = zgetc(p->z); /* read first character */ + if (c == LUA_SIGNATURE[0]) { + checkmode(L, p->mode, "binary"); + cl = luaU_undump(L, p->z, p->name); + } + else { + checkmode(L, p->mode, "text"); + cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); + } + lua_assert(cl->nupvalues == cl->p->sizeupvalues); + luaF_initupvals(L, cl); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, + const char *mode) { + struct SParser p; + int status; + L->nny++; /* cannot yield during parsing */ + p.z = z; p.name = name; p.mode = mode; + p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0; + p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; + p.dyd.label.arr = NULL; p.dyd.label.size = 0; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); + luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); + luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size); + L->nny--; + return status; +} + + diff --git a/deps/rcheevos/test/lua/src/ldo.h b/deps/rcheevos/test/lua/src/ldo.h new file mode 100644 index 0000000000..4f5d51c3c7 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ldo.h @@ -0,0 +1,58 @@ +/* +** $Id: ldo.h,v 2.29 2015/12/21 13:02:14 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +/* +** Macro to check stack size and grow stack if needed. Parameters +** 'pre'/'pos' allow the macro to preserve a pointer into the +** stack across reallocations, doing the work only when needed. +** 'condmovestack' is used in heavy tests to force a stack reallocation +** at every check. +*/ +#define luaD_checkstackaux(L,n,pre,pos) \ + if (L->stack_last - L->top <= (n)) \ + { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); } + +/* In general, 'pre'/'pos' are empty (nothing to save) */ +#define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) + + + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + + +/* type of protected functions, to be ran by 'runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, + const char *mode); +LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, + int nres); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); +LUAI_FUNC void luaD_shrinkstack (lua_State *L); +LUAI_FUNC void luaD_inctop (lua_State *L); + +LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +#endif + diff --git a/deps/rcheevos/test/lua/src/ldump.c b/deps/rcheevos/test/lua/src/ldump.c new file mode 100644 index 0000000000..016e300822 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ldump.c @@ -0,0 +1,215 @@ +/* +** $Id: ldump.c,v 2.37 2015/10/08 15:53:49 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#define ldump_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + + +typedef struct { + lua_State *L; + lua_Writer writer; + void *data; + int strip; + int status; +} DumpState; + + +/* +** All high-level dumps go through DumpVector; you can change it to +** change the endianness of the result +*/ +#define DumpVector(v,n,D) DumpBlock(v,(n)*sizeof((v)[0]),D) + +#define DumpLiteral(s,D) DumpBlock(s, sizeof(s) - sizeof(char), D) + + +static void DumpBlock (const void *b, size_t size, DumpState *D) { + if (D->status == 0 && size > 0) { + lua_unlock(D->L); + D->status = (*D->writer)(D->L, b, size, D->data); + lua_lock(D->L); + } +} + + +#define DumpVar(x,D) DumpVector(&x,1,D) + + +static void DumpByte (int y, DumpState *D) { + lu_byte x = (lu_byte)y; + DumpVar(x, D); +} + + +static void DumpInt (int x, DumpState *D) { + DumpVar(x, D); +} + + +static void DumpNumber (lua_Number x, DumpState *D) { + DumpVar(x, D); +} + + +static void DumpInteger (lua_Integer x, DumpState *D) { + DumpVar(x, D); +} + + +static void DumpString (const TString *s, DumpState *D) { + if (s == NULL) + DumpByte(0, D); + else { + size_t size = tsslen(s) + 1; /* include trailing '\0' */ + const char *str = getstr(s); + if (size < 0xFF) + DumpByte(cast_int(size), D); + else { + DumpByte(0xFF, D); + DumpVar(size, D); + } + DumpVector(str, size - 1, D); /* no need to save '\0' */ + } +} + + +static void DumpCode (const Proto *f, DumpState *D) { + DumpInt(f->sizecode, D); + DumpVector(f->code, f->sizecode, D); +} + + +static void DumpFunction(const Proto *f, TString *psource, DumpState *D); + +static void DumpConstants (const Proto *f, DumpState *D) { + int i; + int n = f->sizek; + DumpInt(n, D); + for (i = 0; i < n; i++) { + const TValue *o = &f->k[i]; + DumpByte(ttype(o), D); + switch (ttype(o)) { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpByte(bvalue(o), D); + break; + case LUA_TNUMFLT: + DumpNumber(fltvalue(o), D); + break; + case LUA_TNUMINT: + DumpInteger(ivalue(o), D); + break; + case LUA_TSHRSTR: + case LUA_TLNGSTR: + DumpString(tsvalue(o), D); + break; + default: + lua_assert(0); + } + } +} + + +static void DumpProtos (const Proto *f, DumpState *D) { + int i; + int n = f->sizep; + DumpInt(n, D); + for (i = 0; i < n; i++) + DumpFunction(f->p[i], f->source, D); +} + + +static void DumpUpvalues (const Proto *f, DumpState *D) { + int i, n = f->sizeupvalues; + DumpInt(n, D); + for (i = 0; i < n; i++) { + DumpByte(f->upvalues[i].instack, D); + DumpByte(f->upvalues[i].idx, D); + } +} + + +static void DumpDebug (const Proto *f, DumpState *D) { + int i, n; + n = (D->strip) ? 0 : f->sizelineinfo; + DumpInt(n, D); + DumpVector(f->lineinfo, n, D); + n = (D->strip) ? 0 : f->sizelocvars; + DumpInt(n, D); + for (i = 0; i < n; i++) { + DumpString(f->locvars[i].varname, D); + DumpInt(f->locvars[i].startpc, D); + DumpInt(f->locvars[i].endpc, D); + } + n = (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n, D); + for (i = 0; i < n; i++) + DumpString(f->upvalues[i].name, D); +} + + +static void DumpFunction (const Proto *f, TString *psource, DumpState *D) { + if (D->strip || f->source == psource) + DumpString(NULL, D); /* no debug info or same source as its parent */ + else + DumpString(f->source, D); + DumpInt(f->linedefined, D); + DumpInt(f->lastlinedefined, D); + DumpByte(f->numparams, D); + DumpByte(f->is_vararg, D); + DumpByte(f->maxstacksize, D); + DumpCode(f, D); + DumpConstants(f, D); + DumpUpvalues(f, D); + DumpProtos(f, D); + DumpDebug(f, D); +} + + +static void DumpHeader (DumpState *D) { + DumpLiteral(LUA_SIGNATURE, D); + DumpByte(LUAC_VERSION, D); + DumpByte(LUAC_FORMAT, D); + DumpLiteral(LUAC_DATA, D); + DumpByte(sizeof(int), D); + DumpByte(sizeof(size_t), D); + DumpByte(sizeof(Instruction), D); + DumpByte(sizeof(lua_Integer), D); + DumpByte(sizeof(lua_Number), D); + DumpInteger(LUAC_INT, D); + DumpNumber(LUAC_NUM, D); +} + + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, + int strip) { + DumpState D; + D.L = L; + D.writer = w; + D.data = data; + D.strip = strip; + D.status = 0; + DumpHeader(&D); + DumpByte(f->sizeupvalues, &D); + DumpFunction(f, NULL, &D); + return D.status; +} + diff --git a/deps/rcheevos/test/lua/src/lfunc.c b/deps/rcheevos/test/lua/src/lfunc.c new file mode 100644 index 0000000000..67967dab3f --- /dev/null +++ b/deps/rcheevos/test/lua/src/lfunc.c @@ -0,0 +1,151 @@ +/* +** $Id: lfunc.c,v 2.45 2014/11/02 19:19:04 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#define lfunc_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +CClosure *luaF_newCclosure (lua_State *L, int n) { + GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n)); + CClosure *c = gco2ccl(o); + c->nupvalues = cast_byte(n); + return c; +} + + +LClosure *luaF_newLclosure (lua_State *L, int n) { + GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n)); + LClosure *c = gco2lcl(o); + c->p = NULL; + c->nupvalues = cast_byte(n); + while (n--) c->upvals[n] = NULL; + return c; +} + +/* +** fill a closure with new closed upvalues +*/ +void luaF_initupvals (lua_State *L, LClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) { + UpVal *uv = luaM_new(L, UpVal); + uv->refcount = 1; + uv->v = &uv->u.value; /* make it closed */ + setnilvalue(uv->v); + cl->upvals[i] = uv; + } +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + UpVal **pp = &L->openupval; + UpVal *p; + UpVal *uv; + lua_assert(isintwups(L) || L->openupval == NULL); + while (*pp != NULL && (p = *pp)->v >= level) { + lua_assert(upisopen(p)); + if (p->v == level) /* found a corresponding upvalue? */ + return p; /* return it */ + pp = &p->u.open.next; + } + /* not found: create a new upvalue */ + uv = luaM_new(L, UpVal); + uv->refcount = 0; + uv->u.open.next = *pp; /* link it to list of open upvalues */ + uv->u.open.touched = 1; + *pp = uv; + uv->v = level; /* current value lives in the stack */ + if (!isintwups(L)) { /* thread not in list of threads with upvalues? */ + L->twups = G(L)->twups; /* link it to the list */ + G(L)->twups = L; + } + return uv; +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + while (L->openupval != NULL && (uv = L->openupval)->v >= level) { + lua_assert(upisopen(uv)); + L->openupval = uv->u.open.next; /* remove from 'open' list */ + if (uv->refcount == 0) /* no references? */ + luaM_free(L, uv); /* free upvalue */ + else { + setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ + uv->v = &uv->u.value; /* now current value lives here */ + luaC_upvalbarrier(L, uv); + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + GCObject *o = luaC_newobj(L, LUA_TPROTO, sizeof(Proto)); + Proto *f = gco2p(o); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->cache = NULL; + f->sizecode = 0; + f->lineinfo = NULL; + f->sizelineinfo = 0; + f->upvalues = NULL; + f->sizeupvalues = 0; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->locvars = NULL; + f->sizelocvars = 0; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode); + luaM_freearray(L, f->p, f->sizep); + luaM_freearray(L, f->k, f->sizek); + luaM_freearray(L, f->lineinfo, f->sizelineinfo); + luaM_freearray(L, f->locvars, f->sizelocvars); + luaM_freearray(L, f->upvalues, f->sizeupvalues); + luaM_free(L, f); +} + + +/* +** Look for n-th local variable at line 'line' in function 'func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/deps/rcheevos/test/lua/src/lfunc.h b/deps/rcheevos/test/lua/src/lfunc.h new file mode 100644 index 0000000000..2eeb0d5a48 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lfunc.h @@ -0,0 +1,61 @@ +/* +** $Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +/* test whether thread is in 'twups' list */ +#define isintwups(L) (L->twups != L) + + +/* +** maximum number of upvalues in a closure (both C and Lua). (Value +** must fit in a VM register.) +*/ +#define MAXUPVAL 255 + + +/* +** Upvalues for Lua closures +*/ +struct UpVal { + TValue *v; /* points to stack or to its own value */ + lu_mem refcount; /* reference counter */ + union { + struct { /* (when open) */ + UpVal *next; /* linked list */ + int touched; /* mark to avoid cycles with dead threads */ + } open; + TValue value; /* the value (when closed) */ + } u; +}; + +#define upisopen(up) ((up)->v != &(up)->u.value) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); +LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); +LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/deps/rcheevos/test/lua/src/lgc.c b/deps/rcheevos/test/lua/src/lgc.c new file mode 100644 index 0000000000..ba2c19e14e --- /dev/null +++ b/deps/rcheevos/test/lua/src/lgc.c @@ -0,0 +1,1178 @@ +/* +** $Id: lgc.c,v 2.215 2016/12/22 13:08:50 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#define lgc_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +/* +** internal state for collector while inside the atomic phase. The +** collector should never be in this state while running regular code. +*/ +#define GCSinsideatomic (GCSpause + 1) + +/* +** cost of sweeping one element (the size of a small object divided +** by some adjust for the sweep speed) +*/ +#define GCSWEEPCOST ((sizeof(TString) + 4) / 4) + +/* maximum number of elements to sweep in each single step */ +#define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) + +/* cost of calling one finalizer */ +#define GCFINALIZECOST GCSWEEPCOST + + +/* +** macro to adjust 'stepmul': 'stepmul' is actually used like +** 'stepmul / STEPMULADJ' (value chosen by tests) +*/ +#define STEPMULADJ 200 + + +/* +** macro to adjust 'pause': 'pause' is actually used like +** 'pause / PAUSEADJ' (value chosen by tests) +*/ +#define PAUSEADJ 100 + + +/* +** 'makewhite' erases all color bits then sets only the current white +** bit +*/ +#define maskcolors (~(bitmask(BLACKBIT) | WHITEBITS)) +#define makewhite(g,x) \ + (x->marked = cast_byte((x->marked & maskcolors) | luaC_white(g))) + +#define white2gray(x) resetbits(x->marked, WHITEBITS) +#define black2gray(x) resetbit(x->marked, BLACKBIT) + + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define checkdeadkey(n) lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n))) + + +#define checkconsistency(obj) \ + lua_longassert(!iscollectable(obj) || righttt(obj)) + + +#define markvalue(g,o) { checkconsistency(o); \ + if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(t)) reallymarkobject(g, obj2gco(t)); } + +/* +** mark an object that can be NULL (either because it is really optional, +** or it was stripped as debug info, or inside an uncompleted structure) +*/ +#define markobjectN(g,t) { if (t) markobject(g,t); } + +static void reallymarkobject (global_State *g, GCObject *o); + + +/* +** {====================================================== +** Generic functions +** ======================================================= +*/ + + +/* +** one after last element in a hash array +*/ +#define gnodelast(h) gnode(h, cast(size_t, sizenode(h))) + + +/* +** link collectable object 'o' into list pointed by 'p' +*/ +#define linkgclist(o,p) ((o)->gclist = (p), (p) = obj2gco(o)) + + +/* +** If key is not marked, mark its entry as dead. This allows key to be +** collected, but keeps its entry in the table. A dead node is needed +** when Lua looks up for a key (it may be part of a chain) and when +** traversing a weak table (key might be removed from the table during +** traversal). Other places never manipulate dead keys, because its +** associated nil value is enough to signal that the entry is logically +** empty. +*/ +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (valiswhite(gkey(n))) + setdeadvalue(wgkey(n)); /* unused and unmarked key; remove it */ +} + + +/* +** tells whether a key or value can be cleared from a weak +** table. Non-collectable objects are never removed from weak +** tables. Strings behave as 'values', so are never removed too. for +** other objects: if really collected, cannot keep them; for objects +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (global_State *g, const TValue *o) { + if (!iscollectable(o)) return 0; + else if (ttisstring(o)) { + markobject(g, tsvalue(o)); /* strings are 'values', so are never weak */ + return 0; + } + else return iswhite(gcvalue(o)); +} + + +/* +** barrier that moves collector forward, that is, mark the white object +** being pointed by a black object. (If in sweep phase, clear the black +** object to white [sweep it] to avoid other barrier calls for this +** same object.) +*/ +void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + if (keepinvariant(g)) /* must keep invariant? */ + reallymarkobject(g, v); /* restore invariant */ + else { /* sweep phase */ + lua_assert(issweepphase(g)); + makewhite(g, o); /* mark main obj. as white to avoid other barriers */ + } +} + + +/* +** barrier that moves collector backward, that is, mark the black object +** pointing to a white object as gray again. +*/ +void luaC_barrierback_ (lua_State *L, Table *t) { + global_State *g = G(L); + lua_assert(isblack(t) && !isdead(g, t)); + black2gray(t); /* make table gray (again) */ + linkgclist(t, g->grayagain); +} + + +/* +** barrier for assignments to closed upvalues. Because upvalues are +** shared among closures, it is impossible to know the color of all +** closures pointing to it. So, we assume that the object being assigned +** must be marked. +*/ +void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = gcvalue(uv->v); + lua_assert(!upisopen(uv)); /* ensured by macro luaC_upvalbarrier */ + if (keepinvariant(g)) + markobject(g, o); +} + + +void luaC_fix (lua_State *L, GCObject *o) { + global_State *g = G(L); + lua_assert(g->allgc == o); /* object must be 1st in 'allgc' list! */ + white2gray(o); /* they will be gray forever */ + g->allgc = o->next; /* remove object from 'allgc' list */ + o->next = g->fixedgc; /* link it to 'fixedgc' list */ + g->fixedgc = o; +} + + +/* +** create a new collectable object (with given type and size) and link +** it to 'allgc' list. +*/ +GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { + global_State *g = G(L); + GCObject *o = cast(GCObject *, luaM_newobject(L, novariant(tt), sz)); + o->marked = luaC_white(g); + o->tt = tt; + o->next = g->allgc; + g->allgc = o; + return o; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** Mark functions +** ======================================================= +*/ + + +/* +** mark an object. Userdata, strings, and closed upvalues are visited +** and turned black here. Other objects are marked gray and added +** to appropriate list to be visited (and turned black) later. (Open +** upvalues are already linked in 'headuv' list.) +*/ +static void reallymarkobject (global_State *g, GCObject *o) { + reentry: + white2gray(o); + switch (o->tt) { + case LUA_TSHRSTR: { + gray2black(o); + g->GCmemtrav += sizelstring(gco2ts(o)->shrlen); + break; + } + case LUA_TLNGSTR: { + gray2black(o); + g->GCmemtrav += sizelstring(gco2ts(o)->u.lnglen); + break; + } + case LUA_TUSERDATA: { + TValue uvalue; + markobjectN(g, gco2u(o)->metatable); /* mark its metatable */ + gray2black(o); + g->GCmemtrav += sizeudata(gco2u(o)); + getuservalue(g->mainthread, gco2u(o), &uvalue); + if (valiswhite(&uvalue)) { /* markvalue(g, &uvalue); */ + o = gcvalue(&uvalue); + goto reentry; + } + break; + } + case LUA_TLCL: { + linkgclist(gco2lcl(o), g->gray); + break; + } + case LUA_TCCL: { + linkgclist(gco2ccl(o), g->gray); + break; + } + case LUA_TTABLE: { + linkgclist(gco2t(o), g->gray); + break; + } + case LUA_TTHREAD: { + linkgclist(gco2th(o), g->gray); + break; + } + case LUA_TPROTO: { + linkgclist(gco2p(o), g->gray); + break; + } + default: lua_assert(0); break; + } +} + + +/* +** mark metamethods for basic types +*/ +static void markmt (global_State *g) { + int i; + for (i=0; i < LUA_NUMTAGS; i++) + markobjectN(g, g->mt[i]); +} + + +/* +** mark all objects in list of being-finalized +*/ +static void markbeingfnz (global_State *g) { + GCObject *o; + for (o = g->tobefnz; o != NULL; o = o->next) + markobject(g, o); +} + + +/* +** Mark all values stored in marked open upvalues from non-marked threads. +** (Values from marked threads were already marked when traversing the +** thread.) Remove from the list threads that no longer have upvalues and +** not-marked threads. +*/ +static void remarkupvals (global_State *g) { + lua_State *thread; + lua_State **p = &g->twups; + while ((thread = *p) != NULL) { + lua_assert(!isblack(thread)); /* threads are never black */ + if (isgray(thread) && thread->openupval != NULL) + p = &thread->twups; /* keep marked thread with upvalues in the list */ + else { /* thread is not marked or without upvalues */ + UpVal *uv; + *p = thread->twups; /* remove thread from the list */ + thread->twups = thread; /* mark that it is out of list */ + for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { + if (uv->u.open.touched) { + markvalue(g, uv->v); /* remark upvalue's value */ + uv->u.open.touched = 0; + } + } + } + } +} + + +/* +** mark root set and reset all gray lists, to start a new collection +*/ +static void restartcollection (global_State *g) { + g->gray = g->grayagain = NULL; + g->weak = g->allweak = g->ephemeron = NULL; + markobject(g, g->mainthread); + markvalue(g, &g->l_registry); + markmt(g); + markbeingfnz(g); /* mark any finalizing object left from previous cycle */ +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Traverse functions +** ======================================================= +*/ + +/* +** Traverse a table with weak values and link it to proper list. During +** propagate phase, keep it in 'grayagain' list, to be revisited in the +** atomic phase. In the atomic phase, if table has any white value, +** put it in 'weak' list, to be cleared. +*/ +static void traverseweakvalue (global_State *g, Table *h) { + Node *n, *limit = gnodelast(h); + /* if there is array part, assume it may have white values (it is not + worth traversing it now just to check) */ + int hasclears = (h->sizearray > 0); + for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ + checkdeadkey(n); + if (ttisnil(gval(n))) /* entry is empty? */ + removeentry(n); /* remove it */ + else { + lua_assert(!ttisnil(gkey(n))); + markvalue(g, gkey(n)); /* mark key */ + if (!hasclears && iscleared(g, gval(n))) /* is there a white value? */ + hasclears = 1; /* table will have to be cleared */ + } + } + if (g->gcstate == GCSpropagate) + linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ + else if (hasclears) + linkgclist(h, g->weak); /* has to be cleared later */ +} + + +/* +** Traverse an ephemeron table and link it to proper list. Returns true +** iff any object was marked during this traversal (which implies that +** convergence has to continue). During propagation phase, keep table +** in 'grayagain' list, to be visited again in the atomic phase. In +** the atomic phase, if table has any white->white entry, it has to +** be revisited during ephemeron convergence (as that key may turn +** black). Otherwise, if it has any white key, table has to be cleared +** (in the atomic phase). +*/ +static int traverseephemeron (global_State *g, Table *h) { + int marked = 0; /* true if an object is marked in this traversal */ + int hasclears = 0; /* true if table has white keys */ + int hasww = 0; /* true if table has entry "white-key -> white-value" */ + Node *n, *limit = gnodelast(h); + unsigned int i; + /* traverse array part */ + for (i = 0; i < h->sizearray; i++) { + if (valiswhite(&h->array[i])) { + marked = 1; + reallymarkobject(g, gcvalue(&h->array[i])); + } + } + /* traverse hash part */ + for (n = gnode(h, 0); n < limit; n++) { + checkdeadkey(n); + if (ttisnil(gval(n))) /* entry is empty? */ + removeentry(n); /* remove it */ + else if (iscleared(g, gkey(n))) { /* key is not marked (yet)? */ + hasclears = 1; /* table must be cleared */ + if (valiswhite(gval(n))) /* value not marked yet? */ + hasww = 1; /* white-white entry */ + } + else if (valiswhite(gval(n))) { /* value not marked yet? */ + marked = 1; + reallymarkobject(g, gcvalue(gval(n))); /* mark it now */ + } + } + /* link table into proper list */ + if (g->gcstate == GCSpropagate) + linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ + else if (hasww) /* table has white->white entries? */ + linkgclist(h, g->ephemeron); /* have to propagate again */ + else if (hasclears) /* table has white keys? */ + linkgclist(h, g->allweak); /* may have to clean white keys */ + return marked; +} + + +static void traversestrongtable (global_State *g, Table *h) { + Node *n, *limit = gnodelast(h); + unsigned int i; + for (i = 0; i < h->sizearray; i++) /* traverse array part */ + markvalue(g, &h->array[i]); + for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ + checkdeadkey(n); + if (ttisnil(gval(n))) /* entry is empty? */ + removeentry(n); /* remove it */ + else { + lua_assert(!ttisnil(gkey(n))); + markvalue(g, gkey(n)); /* mark key */ + markvalue(g, gval(n)); /* mark value */ + } + } +} + + +static lu_mem traversetable (global_State *g, Table *h) { + const char *weakkey, *weakvalue; + const TValue *mode = gfasttm(g, h->metatable, TM_MODE); + markobjectN(g, h->metatable); + if (mode && ttisstring(mode) && /* is there a weak mode? */ + ((weakkey = strchr(svalue(mode), 'k')), + (weakvalue = strchr(svalue(mode), 'v')), + (weakkey || weakvalue))) { /* is really weak? */ + black2gray(h); /* keep table gray */ + if (!weakkey) /* strong keys? */ + traverseweakvalue(g, h); + else if (!weakvalue) /* strong values? */ + traverseephemeron(g, h); + else /* all weak */ + linkgclist(h, g->allweak); /* nothing to traverse now */ + } + else /* not weak */ + traversestrongtable(g, h); + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * cast(size_t, allocsizenode(h)); +} + + +/* +** Traverse a prototype. (While a prototype is being build, its +** arrays can be larger than needed; the extra slots are filled with +** NULL, so the use of 'markobjectN') +*/ +static int traverseproto (global_State *g, Proto *f) { + int i; + if (f->cache && iswhite(f->cache)) + f->cache = NULL; /* allow cache to be collected */ + markobjectN(g, f->source); + for (i = 0; i < f->sizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ + markobjectN(g, f->upvalues[i].name); + for (i = 0; i < f->sizep; i++) /* mark nested protos */ + markobjectN(g, f->p[i]); + for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ + markobjectN(g, f->locvars[i].varname); + return sizeof(Proto) + sizeof(Instruction) * f->sizecode + + sizeof(Proto *) * f->sizep + + sizeof(TValue) * f->sizek + + sizeof(int) * f->sizelineinfo + + sizeof(LocVar) * f->sizelocvars + + sizeof(Upvaldesc) * f->sizeupvalues; +} + + +static lu_mem traverseCclosure (global_State *g, CClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->upvalue[i]); + return sizeCclosure(cl->nupvalues); +} + +/* +** open upvalues point to values in a thread, so those values should +** be marked when the thread is traversed except in the atomic phase +** (because then the value cannot be changed by the thread and the +** thread may not be traversed again) +*/ +static lu_mem traverseLclosure (global_State *g, LClosure *cl) { + int i; + markobjectN(g, cl->p); /* mark its prototype */ + for (i = 0; i < cl->nupvalues; i++) { /* mark its upvalues */ + UpVal *uv = cl->upvals[i]; + if (uv != NULL) { + if (upisopen(uv) && g->gcstate != GCSinsideatomic) + uv->u.open.touched = 1; /* can be marked in 'remarkupvals' */ + else + markvalue(g, uv->v); + } + } + return sizeLclosure(cl->nupvalues); +} + + +static lu_mem traversethread (global_State *g, lua_State *th) { + StkId o = th->stack; + if (o == NULL) + return 1; /* stack not completely built yet */ + lua_assert(g->gcstate == GCSinsideatomic || + th->openupval == NULL || isintwups(th)); + for (; o < th->top; o++) /* mark live elements in the stack */ + markvalue(g, o); + if (g->gcstate == GCSinsideatomic) { /* final traversal? */ + StkId lim = th->stack + th->stacksize; /* real end of stack */ + for (; o < lim; o++) /* clear not-marked stack slice */ + setnilvalue(o); + /* 'remarkupvals' may have removed thread from 'twups' list */ + if (!isintwups(th) && th->openupval != NULL) { + th->twups = g->twups; /* link it back to the list */ + g->twups = th; + } + } + else if (g->gckind != KGC_EMERGENCY) + luaD_shrinkstack(th); /* do not change stack in emergency cycle */ + return (sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->nci); +} + + +/* +** traverse one gray object, turning it to black (except for threads, +** which are always gray). +*/ +static void propagatemark (global_State *g) { + lu_mem size; + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->tt) { + case LUA_TTABLE: { + Table *h = gco2t(o); + g->gray = h->gclist; /* remove from 'gray' list */ + size = traversetable(g, h); + break; + } + case LUA_TLCL: { + LClosure *cl = gco2lcl(o); + g->gray = cl->gclist; /* remove from 'gray' list */ + size = traverseLclosure(g, cl); + break; + } + case LUA_TCCL: { + CClosure *cl = gco2ccl(o); + g->gray = cl->gclist; /* remove from 'gray' list */ + size = traverseCclosure(g, cl); + break; + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; /* remove from 'gray' list */ + linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ + black2gray(o); + size = traversethread(g, th); + break; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; /* remove from 'gray' list */ + size = traverseproto(g, p); + break; + } + default: lua_assert(0); return; + } + g->GCmemtrav += size; +} + + +static void propagateall (global_State *g) { + while (g->gray) propagatemark(g); +} + + +static void convergeephemerons (global_State *g) { + int changed; + do { + GCObject *w; + GCObject *next = g->ephemeron; /* get ephemeron list */ + g->ephemeron = NULL; /* tables may return to this list when traversed */ + changed = 0; + while ((w = next) != NULL) { + next = gco2t(w)->gclist; + if (traverseephemeron(g, gco2t(w))) { /* traverse marked some value? */ + propagateall(g); /* propagate changes */ + changed = 1; /* will have to revisit all ephemeron tables */ + } + } + } while (changed); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Sweep Functions +** ======================================================= +*/ + + +/* +** clear entries with unmarked keys from all weaktables in list 'l' up +** to element 'f' +*/ +static void clearkeys (global_State *g, GCObject *l, GCObject *f) { + for (; l != f; l = gco2t(l)->gclist) { + Table *h = gco2t(l); + Node *n, *limit = gnodelast(h); + for (n = gnode(h, 0); n < limit; n++) { + if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* and remove entry from table */ + } + } + } +} + + +/* +** clear entries with unmarked values from all weaktables in list 'l' up +** to element 'f' +*/ +static void clearvalues (global_State *g, GCObject *l, GCObject *f) { + for (; l != f; l = gco2t(l)->gclist) { + Table *h = gco2t(l); + Node *n, *limit = gnodelast(h); + unsigned int i; + for (i = 0; i < h->sizearray; i++) { + TValue *o = &h->array[i]; + if (iscleared(g, o)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + for (n = gnode(h, 0); n < limit; n++) { + if (!ttisnil(gval(n)) && iscleared(g, gval(n))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* and remove entry from table */ + } + } + } +} + + +void luaC_upvdeccount (lua_State *L, UpVal *uv) { + lua_assert(uv->refcount > 0); + uv->refcount--; + if (uv->refcount == 0 && !upisopen(uv)) + luaM_free(L, uv); +} + + +static void freeLclosure (lua_State *L, LClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) { + UpVal *uv = cl->upvals[i]; + if (uv) + luaC_upvdeccount(L, uv); + } + luaM_freemem(L, cl, sizeLclosure(cl->nupvalues)); +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TLCL: { + freeLclosure(L, gco2lcl(o)); + break; + } + case LUA_TCCL: { + luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues)); + break; + } + case LUA_TTABLE: luaH_free(L, gco2t(o)); break; + case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break; + case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; + case LUA_TSHRSTR: + luaS_remove(L, gco2ts(o)); /* remove it from hash table */ + luaM_freemem(L, o, sizelstring(gco2ts(o)->shrlen)); + break; + case LUA_TLNGSTR: { + luaM_freemem(L, o, sizelstring(gco2ts(o)->u.lnglen)); + break; + } + default: lua_assert(0); + } +} + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count); + + +/* +** sweep at most 'count' elements from a list of GCObjects erasing dead +** objects, where a dead object is one marked with the old (non current) +** white; change all non-dead objects back to white, preparing for next +** collection cycle. Return where to continue the traversal or NULL if +** list is finished. +*/ +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + global_State *g = G(L); + int ow = otherwhite(g); + int white = luaC_white(g); /* current white */ + while (*p != NULL && count-- > 0) { + GCObject *curr = *p; + int marked = curr->marked; + if (isdeadm(ow, marked)) { /* is 'curr' dead? */ + *p = curr->next; /* remove 'curr' from list */ + freeobj(L, curr); /* erase 'curr' */ + } + else { /* change mark to 'white' */ + curr->marked = cast_byte((marked & maskcolors) | white); + p = &curr->next; /* go to next element */ + } + } + return (*p == NULL) ? NULL : p; +} + + +/* +** sweep a list until a live object (or end of list) +*/ +static GCObject **sweeptolive (lua_State *L, GCObject **p) { + GCObject **old = p; + do { + p = sweeplist(L, p, 1); + } while (p == old); + return p; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Finalization +** ======================================================= +*/ + +/* +** If possible, shrink string table +*/ +static void checkSizes (lua_State *L, global_State *g) { + if (g->gckind != KGC_EMERGENCY) { + l_mem olddebt = g->GCdebt; + if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ + luaS_resize(L, g->strt.size / 2); /* shrink it a little */ + g->GCestimate += g->GCdebt - olddebt; /* update estimate */ + } +} + + +static GCObject *udata2finalize (global_State *g) { + GCObject *o = g->tobefnz; /* get first element */ + lua_assert(tofinalize(o)); + g->tobefnz = o->next; /* remove it from 'tobefnz' list */ + o->next = g->allgc; /* return it to 'allgc' list */ + g->allgc = o; + resetbit(o->marked, FINALIZEDBIT); /* object is "normal" again */ + if (issweepphase(g)) + makewhite(g, o); /* "sweep" object */ + return o; +} + + +static void dothecall (lua_State *L, void *ud) { + UNUSED(ud); + luaD_callnoyield(L, L->top - 2, 0); +} + + +static void GCTM (lua_State *L, int propagateerrors) { + global_State *g = G(L); + const TValue *tm; + TValue v; + setgcovalue(L, &v, udata2finalize(g)); + tm = luaT_gettmbyobj(L, &v, TM_GC); + if (tm != NULL && ttisfunction(tm)) { /* is there a finalizer? */ + int status; + lu_byte oldah = L->allowhook; + int running = g->gcrunning; + L->allowhook = 0; /* stop debug hooks during GC metamethod */ + g->gcrunning = 0; /* avoid GC steps */ + setobj2s(L, L->top, tm); /* push finalizer... */ + setobj2s(L, L->top + 1, &v); /* ... and its argument */ + L->top += 2; /* and (next line) call the finalizer */ + L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ + status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); + L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ + L->allowhook = oldah; /* restore hooks */ + g->gcrunning = running; /* restore state */ + if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ + if (status == LUA_ERRRUN) { /* is there an error object? */ + const char *msg = (ttisstring(L->top - 1)) + ? svalue(L->top - 1) + : "no message"; + luaO_pushfstring(L, "error in __gc metamethod (%s)", msg); + status = LUA_ERRGCMM; /* error in __gc metamethod */ + } + luaD_throw(L, status); /* re-throw error */ + } + } +} + + +/* +** call a few (up to 'g->gcfinnum') finalizers +*/ +static int runafewfinalizers (lua_State *L) { + global_State *g = G(L); + unsigned int i; + lua_assert(!g->tobefnz || g->gcfinnum > 0); + for (i = 0; g->tobefnz && i < g->gcfinnum; i++) + GCTM(L, 1); /* call one finalizer */ + g->gcfinnum = (!g->tobefnz) ? 0 /* nothing more to finalize? */ + : g->gcfinnum * 2; /* else call a few more next time */ + return i; +} + + +/* +** call all pending finalizers +*/ +static void callallpendingfinalizers (lua_State *L) { + global_State *g = G(L); + while (g->tobefnz) + GCTM(L, 0); +} + + +/* +** find last 'next' field in list 'p' list (to add elements in its end) +*/ +static GCObject **findlast (GCObject **p) { + while (*p != NULL) + p = &(*p)->next; + return p; +} + + +/* +** move all unreachable objects (or 'all' objects) that need +** finalization from list 'finobj' to list 'tobefnz' (to be finalized) +*/ +static void separatetobefnz (global_State *g, int all) { + GCObject *curr; + GCObject **p = &g->finobj; + GCObject **lastnext = findlast(&g->tobefnz); + while ((curr = *p) != NULL) { /* traverse all finalizable objects */ + lua_assert(tofinalize(curr)); + if (!(iswhite(curr) || all)) /* not being collected? */ + p = &curr->next; /* don't bother with it */ + else { + *p = curr->next; /* remove 'curr' from 'finobj' list */ + curr->next = *lastnext; /* link at the end of 'tobefnz' list */ + *lastnext = curr; + lastnext = &curr->next; + } + } +} + + +/* +** if object 'o' has a finalizer, remove it from 'allgc' list (must +** search the list to find it) and link it in 'finobj' list. +*/ +void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { + global_State *g = G(L); + if (tofinalize(o) || /* obj. is already marked... */ + gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */ + return; /* nothing to be done */ + else { /* move 'o' to 'finobj' list */ + GCObject **p; + if (issweepphase(g)) { + makewhite(g, o); /* "sweep" object 'o' */ + if (g->sweepgc == &o->next) /* should not remove 'sweepgc' object */ + g->sweepgc = sweeptolive(L, g->sweepgc); /* change 'sweepgc' */ + } + /* search for pointer pointing to 'o' */ + for (p = &g->allgc; *p != o; p = &(*p)->next) { /* empty */ } + *p = o->next; /* remove 'o' from 'allgc' list */ + o->next = g->finobj; /* link it in 'finobj' list */ + g->finobj = o; + l_setbit(o->marked, FINALIZEDBIT); /* mark it as such */ + } +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** GC control +** ======================================================= +*/ + + +/* +** Set a reasonable "time" to wait before starting a new GC cycle; cycle +** will start when memory use hits threshold. (Division by 'estimate' +** should be OK: it cannot be zero (because Lua cannot even start with +** less than PAUSEADJ bytes). +*/ +static void setpause (global_State *g) { + l_mem threshold, debt; + l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */ + lua_assert(estimate > 0); + threshold = (g->gcpause < MAX_LMEM / estimate) /* overflow? */ + ? estimate * g->gcpause /* no overflow */ + : MAX_LMEM; /* overflow; truncate to maximum */ + debt = gettotalbytes(g) - threshold; + luaE_setdebt(g, debt); +} + + +/* +** Enter first sweep phase. +** The call to 'sweeplist' tries to make pointer point to an object +** inside the list (instead of to the header), so that the real sweep do +** not need to skip objects created between "now" and the start of the +** real sweep. +*/ +static void entersweep (lua_State *L) { + global_State *g = G(L); + g->gcstate = GCSswpallgc; + lua_assert(g->sweepgc == NULL); + g->sweepgc = sweeplist(L, &g->allgc, 1); +} + + +void luaC_freeallobjects (lua_State *L) { + global_State *g = G(L); + separatetobefnz(g, 1); /* separate all objects with finalizers */ + lua_assert(g->finobj == NULL); + callallpendingfinalizers(L); + lua_assert(g->tobefnz == NULL); + g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */ + g->gckind = KGC_NORMAL; + sweepwholelist(L, &g->finobj); + sweepwholelist(L, &g->allgc); + sweepwholelist(L, &g->fixedgc); /* collect fixed objects */ + lua_assert(g->strt.nuse == 0); +} + + +static l_mem atomic (lua_State *L) { + global_State *g = G(L); + l_mem work; + GCObject *origweak, *origall; + GCObject *grayagain = g->grayagain; /* save original list */ + lua_assert(g->ephemeron == NULL && g->weak == NULL); + lua_assert(!iswhite(g->mainthread)); + g->gcstate = GCSinsideatomic; + g->GCmemtrav = 0; /* start counting work */ + markobject(g, L); /* mark running thread */ + /* registry and global metatables may be changed by API */ + markvalue(g, &g->l_registry); + markmt(g); /* mark global metatables */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + propagateall(g); /* propagate changes */ + work = g->GCmemtrav; /* stop counting (do not recount 'grayagain') */ + g->gray = grayagain; + propagateall(g); /* traverse 'grayagain' list */ + g->GCmemtrav = 0; /* restart counting */ + convergeephemerons(g); + /* at this point, all strongly accessible objects are marked. */ + /* Clear values from weak tables, before checking finalizers */ + clearvalues(g, g->weak, NULL); + clearvalues(g, g->allweak, NULL); + origweak = g->weak; origall = g->allweak; + work += g->GCmemtrav; /* stop counting (objects being finalized) */ + separatetobefnz(g, 0); /* separate objects to be finalized */ + g->gcfinnum = 1; /* there may be objects to be finalized */ + markbeingfnz(g); /* mark objects that will be finalized */ + propagateall(g); /* remark, to propagate 'resurrection' */ + g->GCmemtrav = 0; /* restart counting */ + convergeephemerons(g); + /* at this point, all resurrected objects are marked. */ + /* remove dead objects from weak tables */ + clearkeys(g, g->ephemeron, NULL); /* clear keys from all ephemeron tables */ + clearkeys(g, g->allweak, NULL); /* clear keys from all 'allweak' tables */ + /* clear values from resurrected weak tables */ + clearvalues(g, g->weak, origweak); + clearvalues(g, g->allweak, origall); + luaS_clearcache(g); + g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ + work += g->GCmemtrav; /* complete counting */ + return work; /* estimate of memory marked by 'atomic' */ +} + + +static lu_mem sweepstep (lua_State *L, global_State *g, + int nextstate, GCObject **nextlist) { + if (g->sweepgc) { + l_mem olddebt = g->GCdebt; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + g->GCestimate += g->GCdebt - olddebt; /* update estimate */ + if (g->sweepgc) /* is there still something to sweep? */ + return (GCSWEEPMAX * GCSWEEPCOST); + } + /* else enter next state */ + g->gcstate = nextstate; + g->sweepgc = nextlist; + return 0; +} + + +static lu_mem singlestep (lua_State *L) { + global_State *g = G(L); + switch (g->gcstate) { + case GCSpause: { + g->GCmemtrav = g->strt.size * sizeof(GCObject*); + restartcollection(g); + g->gcstate = GCSpropagate; + return g->GCmemtrav; + } + case GCSpropagate: { + g->GCmemtrav = 0; + lua_assert(g->gray); + propagatemark(g); + if (g->gray == NULL) /* no more gray objects? */ + g->gcstate = GCSatomic; /* finish propagate phase */ + return g->GCmemtrav; /* memory traversed in this step */ + } + case GCSatomic: { + lu_mem work; + propagateall(g); /* make sure gray list is empty */ + work = atomic(L); /* work is what was traversed by 'atomic' */ + entersweep(L); + g->GCestimate = gettotalbytes(g); /* first estimate */; + return work; + } + case GCSswpallgc: { /* sweep "regular" objects */ + return sweepstep(L, g, GCSswpfinobj, &g->finobj); + } + case GCSswpfinobj: { /* sweep objects with finalizers */ + return sweepstep(L, g, GCSswptobefnz, &g->tobefnz); + } + case GCSswptobefnz: { /* sweep objects to be finalized */ + return sweepstep(L, g, GCSswpend, NULL); + } + case GCSswpend: { /* finish sweeps */ + makewhite(g, g->mainthread); /* sweep main thread */ + checkSizes(L, g); + g->gcstate = GCScallfin; + return 0; + } + case GCScallfin: { /* call remaining finalizers */ + if (g->tobefnz && g->gckind != KGC_EMERGENCY) { + int n = runafewfinalizers(L); + return (n * GCFINALIZECOST); + } + else { /* emergency mode or no more finalizers */ + g->gcstate = GCSpause; /* finish collection */ + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +/* +** advances the garbage collector until it reaches a state allowed +** by 'statemask' +*/ +void luaC_runtilstate (lua_State *L, int statesmask) { + global_State *g = G(L); + while (!testbit(statesmask, g->gcstate)) + singlestep(L); +} + + +/* +** get GC debt and convert it from Kb to 'work units' (avoid zero debt +** and overflows) +*/ +static l_mem getdebt (global_State *g) { + l_mem debt = g->GCdebt; + int stepmul = g->gcstepmul; + if (debt <= 0) return 0; /* minimal debt */ + else { + debt = (debt / STEPMULADJ) + 1; + debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM; + return debt; + } +} + +/* +** performs a basic GC step when collector is running +*/ +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem debt = getdebt(g); /* GC deficit (be paid now) */ + if (!g->gcrunning) { /* not running? */ + luaE_setdebt(g, -GCSTEPSIZE * 10); /* avoid being called too often */ + return; + } + do { /* repeat until pause or enough "credit" (negative debt) */ + lu_mem work = singlestep(L); /* perform one single step */ + debt -= work; + } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause); + if (g->gcstate == GCSpause) + setpause(g); /* pause until next cycle */ + else { + debt = (debt / g->gcstepmul) * STEPMULADJ; /* convert 'work units' to Kb */ + luaE_setdebt(g, debt); + runafewfinalizers(L); + } +} + + +/* +** Performs a full GC cycle; if 'isemergency', set a flag to avoid +** some operations which could change the interpreter state in some +** unexpected ways (running finalizers and shrinking some structures). +** Before running the collection, check 'keepinvariant'; if it is true, +** there may be some objects marked as black, so the collector has +** to sweep all objects to turn them back to white (as white has not +** changed, nothing will be collected). +*/ +void luaC_fullgc (lua_State *L, int isemergency) { + global_State *g = G(L); + lua_assert(g->gckind == KGC_NORMAL); + if (isemergency) g->gckind = KGC_EMERGENCY; /* set flag */ + if (keepinvariant(g)) { /* black objects? */ + entersweep(L); /* sweep everything to turn them back to white */ + } + /* finish any pending sweep phase to start a new cycle */ + luaC_runtilstate(L, bitmask(GCSpause)); + luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */ + luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */ + /* estimate must be correct after a full GC cycle */ + lua_assert(g->GCestimate == gettotalbytes(g)); + luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ + g->gckind = KGC_NORMAL; + setpause(g); +} + +/* }====================================================== */ + + diff --git a/deps/rcheevos/test/lua/src/lgc.h b/deps/rcheevos/test/lua/src/lgc.h new file mode 100644 index 0000000000..aed3e18a5f --- /dev/null +++ b/deps/rcheevos/test/lua/src/lgc.h @@ -0,0 +1,147 @@ +/* +** $Id: lgc.h,v 2.91 2015/12/21 13:02:14 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" +#include "lstate.h" + +/* +** Collectable objects may have one of three colors: white, which +** means the object is not marked; gray, which means the +** object is marked, but its references may be not marked; and +** black, which means that the object and all its references are marked. +** The main invariant of the garbage collector, while marking objects, +** is that a black object can never point to a white one. Moreover, +** any gray object must be in a "gray list" (gray, grayagain, weak, +** allweak, ephemeron) so that it can be visited again before finishing +** the collection cycle. These lists have no meaning when the invariant +** is not being enforced (e.g., sweep phase). +*/ + + + +/* how much to allocate before next GC step */ +#if !defined(GCSTEPSIZE) +/* ~100 small strings */ +#define GCSTEPSIZE (cast_int(100 * sizeof(TString))) +#endif + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpropagate 0 +#define GCSatomic 1 +#define GCSswpallgc 2 +#define GCSswpfinobj 3 +#define GCSswptobefnz 4 +#define GCSswpend 5 +#define GCScallfin 6 +#define GCSpause 7 + + +#define issweepphase(g) \ + (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) + + +/* +** macro to tell when main invariant (white objects cannot point to black +** ones) must be kept. During a collection, the sweep +** phase may break the invariant, as objects turned white may point to +** still-black objects. The invariant is restored when sweep ends and +** all objects are white again. +*/ + +#define keepinvariant(g) ((g)->gcstate <= GCSatomic) + + +/* +** some useful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) + + +/* Layout for bit use in 'marked' field: */ +#define WHITE0BIT 0 /* object is white (type 0) */ +#define WHITE1BIT 1 /* object is white (type 1) */ +#define BLACKBIT 2 /* object is black */ +#define FINALIZEDBIT 3 /* object has been marked for finalization */ +/* bit 7 is currently used by tests (luaL_checkmemory) */ + +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) testbits((x)->marked, WHITEBITS) +#define isblack(x) testbit((x)->marked, BLACKBIT) +#define isgray(x) /* neither white nor black */ \ + (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT))) + +#define tofinalize(x) testbit((x)->marked, FINALIZEDBIT) + +#define otherwhite(g) ((g)->currentwhite ^ WHITEBITS) +#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) +#define isdead(g,v) isdeadm(otherwhite(g), (v)->marked) + +#define changewhite(x) ((x)->marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->marked, BLACKBIT) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +/* +** Does one step of collection when debt becomes positive. 'pre'/'pos' +** allows some adjustments to be done only when needed. macro +** 'condchangemem' is used only for heavy tests (forcing a full +** GC cycle on every opportunity) +*/ +#define luaC_condGC(L,pre,pos) \ + { if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; \ + condchangemem(L,pre,pos); } + +/* more often than not, 'pre'/'pos' are empty */ +#define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0) + + +#define luaC_barrier(L,p,v) ( \ + (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ + luaC_barrier_(L,obj2gco(p),gcvalue(v)) : cast_void(0)) + +#define luaC_barrierback(L,p,v) ( \ + (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ + luaC_barrierback_(L,p) : cast_void(0)) + +#define luaC_objbarrier(L,p,o) ( \ + (isblack(p) && iswhite(o)) ? \ + luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) + +#define luaC_upvalbarrier(L,uv) ( \ + (iscollectable((uv)->v) && !upisopen(uv)) ? \ + luaC_upvalbarrier_(L,uv) : cast_void(0)) + +LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); +LUAI_FUNC void luaC_freeallobjects (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); +LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); +LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); +LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o); +LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); +LUAI_FUNC void luaC_upvdeccount (lua_State *L, UpVal *uv); + + +#endif diff --git a/deps/rcheevos/test/lua/src/linit.c b/deps/rcheevos/test/lua/src/linit.c new file mode 100644 index 0000000000..afcaf98b24 --- /dev/null +++ b/deps/rcheevos/test/lua/src/linit.c @@ -0,0 +1,68 @@ +/* +** $Id: linit.c,v 1.39 2016/12/04 20:17:24 roberto Exp $ +** Initialization of libraries for lua.c and other clients +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +/* +** If you embed Lua in your program and need to open the standard +** libraries, call luaL_openlibs in your program. If you need a +** different set of libraries, copy this file to your project and edit +** it to suit your needs. +** +** You can also *preload* libraries, so that a later 'require' can +** open the library, which is already linked to the application. +** For that, do the following code: +** +** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); +** lua_pushcfunction(L, luaopen_modname); +** lua_setfield(L, -2, modname); +** lua_pop(L, 1); // remove PRELOAD table +*/ + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +/* +** these libs are loaded by lua.c and are readily available to any Lua +** program +*/ +static const luaL_Reg loadedlibs[] = { + {"_G", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_COLIBNAME, luaopen_coroutine}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_UTF8LIBNAME, luaopen_utf8}, + {LUA_DBLIBNAME, luaopen_debug}, +#if defined(LUA_COMPAT_BITLIB) + {LUA_BITLIBNAME, luaopen_bit32}, +#endif + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib; + /* "require" functions from 'loadedlibs' and set results to global table */ + for (lib = loadedlibs; lib->func; lib++) { + luaL_requiref(L, lib->name, lib->func, 1); + lua_pop(L, 1); /* remove lib */ + } +} + diff --git a/deps/rcheevos/test/lua/src/liolib.c b/deps/rcheevos/test/lua/src/liolib.c new file mode 100644 index 0000000000..156840358d --- /dev/null +++ b/deps/rcheevos/test/lua/src/liolib.c @@ -0,0 +1,771 @@ +/* +** $Id: liolib.c,v 2.151 2016/12/20 18:37:00 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + +#define liolib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** Change this macro to accept other modes for 'fopen' besides +** the standard ones. +*/ +#if !defined(l_checkmode) + +/* accepted extensions to 'mode' in 'fopen' */ +#if !defined(L_MODEEXT) +#define L_MODEEXT "b" +#endif + +/* Check whether 'mode' matches '[rwa]%+?[L_MODEEXT]*' */ +static int l_checkmode (const char *mode) { + return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && + (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */ + (strspn(mode, L_MODEEXT) == strlen(mode))); /* check extensions */ +} + +#endif + +/* +** {====================================================== +** l_popen spawns a new process connected to the current +** one through the file streams. +** ======================================================= +*/ + +#if !defined(l_popen) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#define l_popen(L,c,m) (fflush(NULL), popen(c,m)) +#define l_pclose(L,file) (pclose(file)) + +#elif defined(LUA_USE_WINDOWS) /* }{ */ + +#define l_popen(L,c,m) (_popen(c,m)) +#define l_pclose(L,file) (_pclose(file)) + +#else /* }{ */ + +/* ISO C definitions */ +#define l_popen(L,c,m) \ + ((void)((void)c, m), \ + luaL_error(L, "'popen' not supported"), \ + (FILE*)0) +#define l_pclose(L,file) ((void)L, (void)file, -1) + +#endif /* } */ + +#endif /* } */ + +/* }====================================================== */ + + +#if !defined(l_getc) /* { */ + +#if defined(LUA_USE_POSIX) +#define l_getc(f) getc_unlocked(f) +#define l_lockfile(f) flockfile(f) +#define l_unlockfile(f) funlockfile(f) +#else +#define l_getc(f) getc(f) +#define l_lockfile(f) ((void)0) +#define l_unlockfile(f) ((void)0) +#endif + +#endif /* } */ + + +/* +** {====================================================== +** l_fseek: configuration for longer offsets +** ======================================================= +*/ + +#if !defined(l_fseek) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#include + +#define l_fseek(f,o,w) fseeko(f,o,w) +#define l_ftell(f) ftello(f) +#define l_seeknum off_t + +#elif defined(LUA_USE_WINDOWS) && !defined(_CRTIMP_TYPEINFO) \ + && defined(_MSC_VER) && (_MSC_VER >= 1400) /* }{ */ + +/* Windows (but not DDK) and Visual C++ 2005 or higher */ +#define l_fseek(f,o,w) _fseeki64(f,o,w) +#define l_ftell(f) _ftelli64(f) +#define l_seeknum __int64 + +#else /* }{ */ + +/* ISO C definitions */ +#define l_fseek(f,o,w) fseek(f,o,w) +#define l_ftell(f) ftell(f) +#define l_seeknum long + +#endif /* } */ + +#endif /* } */ + +/* }====================================================== */ + + +#define IO_PREFIX "_IO_" +#define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) +#define IO_INPUT (IO_PREFIX "input") +#define IO_OUTPUT (IO_PREFIX "output") + + +typedef luaL_Stream LStream; + + +#define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + +#define isclosed(p) ((p)->closef == NULL) + + +static int io_type (lua_State *L) { + LStream *p; + luaL_checkany(L, 1); + p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE); + if (p == NULL) + lua_pushnil(L); /* not a file */ + else if (isclosed(p)) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static int f_tostring (lua_State *L) { + LStream *p = tolstream(L); + if (isclosed(p)) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", p->f); + return 1; +} + + +static FILE *tofile (lua_State *L) { + LStream *p = tolstream(L); + if (isclosed(p)) + luaL_error(L, "attempt to use a closed file"); + lua_assert(p->f); + return p->f; +} + + +/* +** When creating file handles, always creates a 'closed' file handle +** before opening the actual file; so, if there is a memory error, the +** handle is in a consistent state. +*/ +static LStream *newprefile (lua_State *L) { + LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream)); + p->closef = NULL; /* mark file handle as 'closed' */ + luaL_setmetatable(L, LUA_FILEHANDLE); + return p; +} + + +/* +** Calls the 'close' function from a file handle. The 'volatile' avoids +** a bug in some versions of the Clang compiler (e.g., clang 3.0 for +** 32 bits). +*/ +static int aux_close (lua_State *L) { + LStream *p = tolstream(L); + volatile lua_CFunction cf = p->closef; + p->closef = NULL; /* mark stream as closed */ + return (*cf)(L); /* close it */ +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) /* no argument? */ + lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ + tofile(L); /* make sure argument is an open stream */ + return aux_close(L); +} + + +static int f_gc (lua_State *L) { + LStream *p = tolstream(L); + if (!isclosed(p) && p->f != NULL) + aux_close(L); /* ignore closed and incompletely open files */ + return 0; +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + LStream *p = tolstream(L); + int res = fclose(p->f); + return luaL_fileresult(L, (res == 0), NULL); +} + + +static LStream *newfile (lua_State *L) { + LStream *p = newprefile(L); + p->f = NULL; + p->closef = &io_fclose; + return p; +} + + +static void opencheck (lua_State *L, const char *fname, const char *mode) { + LStream *p = newfile(L); + p->f = fopen(fname, mode); + if (p->f == NULL) + luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno)); +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + LStream *p = newfile(L); + const char *md = mode; /* to traverse/check mode */ + luaL_argcheck(L, l_checkmode(md), 2, "invalid mode"); + p->f = fopen(filename, mode); + return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + LStream *p = tolstream(L); + return luaL_execresult(L, l_pclose(L, p->f)); +} + + +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + LStream *p = newprefile(L); + p->f = l_popen(L, filename, mode); + p->closef = &io_pclose; + return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + LStream *p = newfile(L); + p->f = tmpfile(); + return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, const char *findex) { + LStream *p; + lua_getfield(L, LUA_REGISTRYINDEX, findex); + p = (LStream *)lua_touserdata(L, -1); + if (isclosed(p)) + luaL_error(L, "standard %s file is closed", findex + IOPREF_LEN); + return p->f; +} + + +static int g_iofile (lua_State *L, const char *f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) + opencheck(L, filename, mode); + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_setfield(L, LUA_REGISTRYINDEX, f); + } + /* return current value */ + lua_getfield(L, LUA_REGISTRYINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +/* +** maximum number of arguments to 'f:lines'/'io.lines' (it + 3 must fit +** in the limit for upvalues of a closure) +*/ +#define MAXARGLINE 250 + +static void aux_lines (lua_State *L, int toclose) { + int n = lua_gettop(L) - 1; /* number of arguments to read */ + luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments"); + lua_pushinteger(L, n); /* number of arguments to read */ + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ + lua_pushcclosure(L, io_readline, 3 + n); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + int toclose; + if (lua_isnone(L, 1)) lua_pushnil(L); /* at least one argument */ + if (lua_isnil(L, 1)) { /* no file name? */ + lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT); /* get default input */ + lua_replace(L, 1); /* put it at index 1 */ + tofile(L); /* check that it's a valid file handle */ + toclose = 0; /* do not close it after iteration */ + } + else { /* open a new file */ + const char *filename = luaL_checkstring(L, 1); + opencheck(L, filename, "r"); + lua_replace(L, 1); /* put file at index 1 */ + toclose = 1; /* close it after iteration */ + } + aux_lines(L, toclose); + return 1; +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +/* maximum length of a numeral */ +#if !defined (L_MAXLENNUM) +#define L_MAXLENNUM 200 +#endif + + +/* auxiliary structure used by 'read_number' */ +typedef struct { + FILE *f; /* file being read */ + int c; /* current character (look ahead) */ + int n; /* number of elements in buffer 'buff' */ + char buff[L_MAXLENNUM + 1]; /* +1 for ending '\0' */ +} RN; + + +/* +** Add current char to buffer (if not out of space) and read next one +*/ +static int nextc (RN *rn) { + if (rn->n >= L_MAXLENNUM) { /* buffer overflow? */ + rn->buff[0] = '\0'; /* invalidate result */ + return 0; /* fail */ + } + else { + rn->buff[rn->n++] = rn->c; /* save current char */ + rn->c = l_getc(rn->f); /* read next one */ + return 1; + } +} + + +/* +** Accept current char if it is in 'set' (of size 2) +*/ +static int test2 (RN *rn, const char *set) { + if (rn->c == set[0] || rn->c == set[1]) + return nextc(rn); + else return 0; +} + + +/* +** Read a sequence of (hex)digits +*/ +static int readdigits (RN *rn, int hex) { + int count = 0; + while ((hex ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) + count++; + return count; +} + + +/* +** Read a number: first reads a valid prefix of a numeral into a buffer. +** Then it calls 'lua_stringtonumber' to check whether the format is +** correct and to convert it to a Lua number +*/ +static int read_number (lua_State *L, FILE *f) { + RN rn; + int count = 0; + int hex = 0; + char decp[2]; + rn.f = f; rn.n = 0; + decp[0] = lua_getlocaledecpoint(); /* get decimal point from locale */ + decp[1] = '.'; /* always accept a dot */ + l_lockfile(rn.f); + do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ + test2(&rn, "-+"); /* optional signal */ + if (test2(&rn, "00")) { + if (test2(&rn, "xX")) hex = 1; /* numeral is hexadecimal */ + else count = 1; /* count initial '0' as a valid digit */ + } + count += readdigits(&rn, hex); /* integral part */ + if (test2(&rn, decp)) /* decimal point? */ + count += readdigits(&rn, hex); /* fractional part */ + if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) { /* exponent mark? */ + test2(&rn, "-+"); /* exponent signal */ + readdigits(&rn, 0); /* exponent digits */ + } + ungetc(rn.c, rn.f); /* unread look-ahead char */ + l_unlockfile(rn.f); + rn.buff[rn.n] = '\0'; /* finish string */ + if (lua_stringtonumber(L, rn.buff)) /* is this a valid number? */ + return 1; /* ok */ + else { /* invalid format */ + lua_pushnil(L); /* "result" to be removed */ + return 0; /* read fails */ + } +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); /* no-op when c == EOF */ + lua_pushliteral(L, ""); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f, int chop) { + luaL_Buffer b; + int c = '\0'; + luaL_buffinit(L, &b); + while (c != EOF && c != '\n') { /* repeat until end of line */ + char *buff = luaL_prepbuffer(&b); /* preallocate buffer */ + int i = 0; + l_lockfile(f); /* no memory errors can happen inside the lock */ + while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n') + buff[i++] = c; + l_unlockfile(f); + luaL_addsize(&b, i); + } + if (!chop && c == '\n') /* want a newline and have one? */ + luaL_addchar(&b, c); /* add ending newline to result */ + luaL_pushresult(&b); /* close buffer */ + /* return ok if read something (either a newline or something else) */ + return (c == '\n' || lua_rawlen(L, -1) > 0); +} + + +static void read_all (lua_State *L, FILE *f) { + size_t nr; + luaL_Buffer b; + luaL_buffinit(L, &b); + do { /* read file in chunks of LUAL_BUFFERSIZE bytes */ + char *p = luaL_prepbuffer(&b); + nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f); + luaL_addsize(&b, nr); + } while (nr == LUAL_BUFFERSIZE); + luaL_pushresult(&b); /* close buffer */ +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t nr; /* number of chars actually read */ + char *p; + luaL_Buffer b; + luaL_buffinit(L, &b); + p = luaL_prepbuffsize(&b, n); /* prepare buffer to read whole block */ + nr = fread(p, sizeof(char), n, f); /* try to read 'n' chars */ + luaL_addsize(&b, nr); + luaL_pushresult(&b); /* close buffer */ + return (nr > 0); /* true iff read something */ +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f, 1); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)luaL_checkinteger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = luaL_checkstring(L, n); + if (*p == '*') p++; /* skip optional '*' (for compatibility) */ + switch (*p) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f, 1); + break; + case 'L': /* line with end-of-line */ + success = read_line(L, f, 0); + break; + case 'a': /* file */ + read_all(L, f); /* read entire file */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return luaL_fileresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1)); + int i; + int n = (int)lua_tointeger(L, lua_upvalueindex(2)); + if (isclosed(p)) /* file is already closed? */ + return luaL_error(L, "file is already closed"); + lua_settop(L , 1); + luaL_checkstack(L, n, "too many arguments"); + for (i = 1; i <= n; i++) /* push arguments to 'g_read' */ + lua_pushvalue(L, lua_upvalueindex(3 + i)); + n = g_read(L, p->f, 2); /* 'n' is number of results */ + lua_assert(n > 0); /* should return at least a nil */ + if (lua_toboolean(L, -n)) /* read at least one value? */ + return n; /* return them */ + else { /* first result is nil: EOF or error */ + if (n > 1) { /* is there error information? */ + /* 2nd result is error message */ + return luaL_error(L, "%s", lua_tostring(L, -n + 1)); + } + if (lua_toboolean(L, lua_upvalueindex(3))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - arg; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + int len = lua_isinteger(L, arg) + ? fprintf(f, LUA_INTEGER_FMT, + (LUAI_UACINT)lua_tointeger(L, arg)) + : fprintf(f, LUA_NUMBER_FMT, + (LUAI_UACNUMBER)lua_tonumber(L, arg)); + status = status && (len > 0); + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + if (status) return 1; /* file handle already on stack top */ + else return luaL_fileresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + FILE *f = tofile(L); + lua_pushvalue(L, 1); /* push file at the stack top (to be returned) */ + return g_write(L, f, 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + lua_Integer p3 = luaL_optinteger(L, 3, 0); + l_seeknum offset = (l_seeknum)p3; + luaL_argcheck(L, (lua_Integer)offset == p3, 3, + "not an integer in proper range"); + op = l_fseek(f, offset, mode[op]); + if (op) + return luaL_fileresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, (lua_Integer)l_ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], (size_t)sz); + return luaL_fileresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL); +} + + +/* +** functions for 'io' library +*/ +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +/* +** methods for file handles +*/ +static const luaL_Reg flib[] = { + {"close", io_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", f_gc}, + {"__tostring", f_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */ + lua_pop(L, 1); /* pop new metatable */ +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + LStream *p = tolstream(L); + p->closef = &io_noclose; /* keep file opened */ + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +static void createstdfile (lua_State *L, FILE *f, const char *k, + const char *fname) { + LStream *p = newprefile(L); + p->f = f; + p->closef = &io_noclose; + if (k != NULL) { + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, k); /* add file to registry */ + } + lua_setfield(L, -2, fname); /* add file to module */ +} + + +LUAMOD_API int luaopen_io (lua_State *L) { + luaL_newlib(L, iolib); /* new module */ + createmeta(L); + /* create (and set) default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, NULL, "stderr"); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/llex.c b/deps/rcheevos/test/lua/src/llex.c new file mode 100644 index 0000000000..70328273f7 --- /dev/null +++ b/deps/rcheevos/test/lua/src/llex.c @@ -0,0 +1,565 @@ +/* +** $Id: llex.c,v 2.96 2016/05/02 14:02:12 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#define llex_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lctype.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +static const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "goto", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "//", "..", "...", "==", ">=", "<=", "~=", + "<<", ">>", "::", "", + "", "", "", "" +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static l_noret lexerror (LexState *ls, const char *msg, int token); + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) { + size_t newsize; + if (luaZ_sizebuffer(b) >= MAX_SIZE/2) + lexerror(ls, "lexical element too long", 0); + newsize = luaZ_sizebuffer(b) * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[luaZ_bufflen(b)++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + TString *e = luaS_newliteral(L, LUA_ENV); /* create env name */ + luaC_fix(L, obj2gco(e)); /* never collect this name */ + for (i=0; iextra = cast_byte(i+1); /* reserved word */ + } +} + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { /* single-byte symbols? */ + lua_assert(token == cast_uchar(token)); + return luaO_pushfstring(ls->L, "'%c'", token); + } + else { + const char *s = luaX_tokens[token - FIRST_RESERVED]; + if (token < TK_EOS) /* fixed format (symbols and reserved words)? */ + return luaO_pushfstring(ls->L, "'%s'", s); + else /* names, strings, and numerals */ + return s; + } +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: case TK_STRING: + case TK_FLT: case TK_INT: + save(ls, '\0'); + return luaO_pushfstring(ls->L, "'%s'", luaZ_buffer(ls->buff)); + default: + return luaX_token2str(ls, token); + } +} + + +static l_noret lexerror (LexState *ls, const char *msg, int token) { + msg = luaG_addinfo(ls->L, msg, ls->source, ls->linenumber); + if (token) + luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +l_noret luaX_syntaxerror (LexState *ls, const char *msg) { + lexerror(ls, msg, ls->t.token); +} + + +/* +** creates a new string and anchors it in scanner's table so that +** it will not be collected until the end of the compilation +** (by that time it should be anchored somewhere) +*/ +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TValue *o; /* entry for 'str' */ + TString *ts = luaS_newlstr(L, str, l); /* create new string */ + setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ + o = luaH_set(L, ls->h, L->top - 1); + if (ttisnil(o)) { /* not in use yet? */ + /* boolean value does not need GC barrier; + table has no metatable, so it does not need to invalidate cache */ + setbvalue(o, 1); /* t[string] = true */ + luaC_checkGC(L); + } + else { /* string already present */ + ts = tsvalue(keyfromval(o)); /* re-use value previously stored */ + } + L->top--; /* remove string from stack */ + return ts; +} + + +/* +** increment line number and skips newline sequence (any of +** \n, \r, \n\r, or \r\n) +*/ +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip '\n' or '\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip '\n\r' or '\r\n' */ + if (++ls->linenumber >= MAX_INT) + lexerror(ls, "chunk has too many lines", 0); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, + int firstchar) { + ls->t.token = 0; + ls->L = L; + ls->current = firstchar; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */ + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + +static int check_next1 (LexState *ls, int c) { + if (ls->current == c) { + next(ls); + return 1; + } + else return 0; +} + + +/* +** Check whether current char is in set 'set' (with two chars) and +** saves it +*/ +static int check_next2 (LexState *ls, const char *set) { + lua_assert(set[2] == '\0'); + if (ls->current == set[0] || ls->current == set[1]) { + save_and_next(ls); + return 1; + } + else return 0; +} + + +/* LUA_NUMBER */ +/* +** this function is quite liberal in what it accepts, as 'luaO_str2num' +** will reject ill-formed numerals. +*/ +static int read_numeral (LexState *ls, SemInfo *seminfo) { + TValue obj; + const char *expo = "Ee"; + int first = ls->current; + lua_assert(lisdigit(ls->current)); + save_and_next(ls); + if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ + expo = "Pp"; + for (;;) { + if (check_next2(ls, expo)) /* exponent part? */ + check_next2(ls, "-+"); /* optional exponent sign */ + if (lisxdigit(ls->current)) + save_and_next(ls); + else if (ls->current == '.') + save_and_next(ls); + else break; + } + save(ls, '\0'); + if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ + lexerror(ls, "malformed number", TK_FLT); + if (ttisinteger(&obj)) { + seminfo->i = ivalue(&obj); + return TK_INT; + } + else { + lua_assert(ttisfloat(&obj)); + seminfo->r = fltvalue(&obj); + return TK_FLT; + } +} + + +/* +** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return +** its number of '='s; otherwise, return a negative number (-1 iff there +** are no '='s after initial bracket) +*/ +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int line = ls->linenumber; /* initial line (for error message) */ + save_and_next(ls); /* skip 2nd '[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: { /* error */ + const char *what = (seminfo ? "string" : "comment"); + const char *msg = luaO_pushfstring(ls->L, + "unfinished long %s (starting at line %d)", what, line); + lexerror(ls, msg, TK_EOS); + break; /* to avoid warnings */ + } + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd ']' */ + goto endloop; + } + break; + } + case '\n': case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void esccheck (LexState *ls, int c, const char *msg) { + if (!c) { + if (ls->current != EOZ) + save_and_next(ls); /* add current to buffer for error message */ + lexerror(ls, msg, TK_STRING); + } +} + + +static int gethexa (LexState *ls) { + save_and_next(ls); + esccheck (ls, lisxdigit(ls->current), "hexadecimal digit expected"); + return luaO_hexavalue(ls->current); +} + + +static int readhexaesc (LexState *ls) { + int r = gethexa(ls); + r = (r << 4) + gethexa(ls); + luaZ_buffremove(ls->buff, 2); /* remove saved chars from buffer */ + return r; +} + + +static unsigned long readutf8esc (LexState *ls) { + unsigned long r; + int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ + save_and_next(ls); /* skip 'u' */ + esccheck(ls, ls->current == '{', "missing '{'"); + r = gethexa(ls); /* must have at least one digit */ + while ((save_and_next(ls), lisxdigit(ls->current))) { + i++; + r = (r << 4) + luaO_hexavalue(ls->current); + esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); + } + esccheck(ls, ls->current == '}', "missing '}'"); + next(ls); /* skip '}' */ + luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ + return r; +} + + +static void utf8esc (LexState *ls) { + char buff[UTF8BUFFSZ]; + int n = luaO_utf8esc(buff, readutf8esc(ls)); + for (; n > 0; n--) /* add 'buff' to string */ + save(ls, buff[UTF8BUFFSZ - n]); +} + + +static int readdecesc (LexState *ls) { + int i; + int r = 0; /* result accumulator */ + for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */ + r = 10*r + ls->current - '0'; + save_and_next(ls); + } + esccheck(ls, r <= UCHAR_MAX, "decimal escape too large"); + luaZ_buffremove(ls->buff, i); /* remove read digits from buffer */ + return r; +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); /* keep delimiter (for error messages) */ + while (ls->current != del) { + switch (ls->current) { + case EOZ: + lexerror(ls, "unfinished string", TK_EOS); + break; /* to avoid warnings */ + case '\n': + case '\r': + lexerror(ls, "unfinished string", TK_STRING); + break; /* to avoid warnings */ + case '\\': { /* escape sequences */ + int c; /* final character to be saved */ + save_and_next(ls); /* keep '\\' for error messages */ + switch (ls->current) { + case 'a': c = '\a'; goto read_save; + case 'b': c = '\b'; goto read_save; + case 'f': c = '\f'; goto read_save; + case 'n': c = '\n'; goto read_save; + case 'r': c = '\r'; goto read_save; + case 't': c = '\t'; goto read_save; + case 'v': c = '\v'; goto read_save; + case 'x': c = readhexaesc(ls); goto read_save; + case 'u': utf8esc(ls); goto no_save; + case '\n': case '\r': + inclinenumber(ls); c = '\n'; goto only_save; + case '\\': case '\"': case '\'': + c = ls->current; goto read_save; + case EOZ: goto no_save; /* will raise an error next loop */ + case 'z': { /* zap following span of spaces */ + luaZ_buffremove(ls->buff, 1); /* remove '\\' */ + next(ls); /* skip the 'z' */ + while (lisspace(ls->current)) { + if (currIsNewline(ls)) inclinenumber(ls); + else next(ls); + } + goto no_save; + } + default: { + esccheck(ls, lisdigit(ls->current), "invalid escape sequence"); + c = readdecesc(ls); /* digital escape '\ddd' */ + goto only_save; + } + } + read_save: + next(ls); + /* go through */ + only_save: + luaZ_buffremove(ls->buff, 1); /* remove '\\' */ + save(ls, c); + /* go through */ + no_save: break; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': case '\r': { /* line breaks */ + inclinenumber(ls); + break; + } + case ' ': case '\f': case '\t': case '\v': { /* spaces */ + next(ls); + break; + } + case '-': { /* '-' or '--' (comment) */ + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { /* long comment? */ + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* skip long comment */ + luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ + break; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); /* skip until end of line (or end of file) */ + break; + } + case '[': { /* long string or simply '[' */ + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep != -1) /* '[=...' missing second bracket */ + lexerror(ls, "invalid long string delimiter", TK_STRING); + return '['; + } + case '=': { + next(ls); + if (check_next1(ls, '=')) return TK_EQ; + else return '='; + } + case '<': { + next(ls); + if (check_next1(ls, '=')) return TK_LE; + else if (check_next1(ls, '<')) return TK_SHL; + else return '<'; + } + case '>': { + next(ls); + if (check_next1(ls, '=')) return TK_GE; + else if (check_next1(ls, '>')) return TK_SHR; + else return '>'; + } + case '/': { + next(ls); + if (check_next1(ls, '/')) return TK_IDIV; + else return '/'; + } + case '~': { + next(ls); + if (check_next1(ls, '=')) return TK_NE; + else return '~'; + } + case ':': { + next(ls); + if (check_next1(ls, ':')) return TK_DBCOLON; + else return ':'; + } + case '"': case '\'': { /* short literal strings */ + read_string(ls, ls->current, seminfo); + return TK_STRING; + } + case '.': { /* '.', '..', '...', or number */ + save_and_next(ls); + if (check_next1(ls, '.')) { + if (check_next1(ls, '.')) + return TK_DOTS; /* '...' */ + else return TK_CONCAT; /* '..' */ + } + else if (!lisdigit(ls->current)) return '.'; + else return read_numeral(ls, seminfo); + } + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': { + return read_numeral(ls, seminfo); + } + case EOZ: { + return TK_EOS; + } + default: { + if (lislalpha(ls->current)) { /* identifier or reserved word? */ + TString *ts; + do { + save_and_next(ls); + } while (lislalnum(ls->current)); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + seminfo->ts = ts; + if (isreserved(ts)) /* reserved word? */ + return ts->extra - 1 + FIRST_RESERVED; + else { + return TK_NAME; + } + } + else { /* single-char tokens (+ - / ...) */ + int c = ls->current; + next(ls); + return c; + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +int luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); + return ls->lookahead.token; +} + diff --git a/deps/rcheevos/test/lua/src/llex.h b/deps/rcheevos/test/lua/src/llex.h new file mode 100644 index 0000000000..2363d87e40 --- /dev/null +++ b/deps/rcheevos/test/lua/src/llex.h @@ -0,0 +1,85 @@ +/* +** $Id: llex.h,v 1.79 2016/05/02 14:02:12 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + + +#if !defined(LUA_ENV) +#define LUA_ENV "_ENV" +#endif + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, + TK_SHL, TK_SHR, + TK_DBCOLON, TK_EOS, + TK_FLT, TK_INT, TK_NAME, TK_STRING +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +typedef union { + lua_Number r; + lua_Integer i; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +/* state of the lexer plus state of the parser when shared by all + functions */ +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token 'consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* current function (parser) */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + Table *h; /* to avoid collection/reuse strings */ + struct Dyndata *dyd; /* dynamic structures used by the parser */ + TString *source; /* current source name */ + TString *envn; /* environment variable name */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source, int firstchar); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC int luaX_lookahead (LexState *ls); +LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/deps/rcheevos/test/lua/src/llimits.h b/deps/rcheevos/test/lua/src/llimits.h new file mode 100644 index 0000000000..f21377fef9 --- /dev/null +++ b/deps/rcheevos/test/lua/src/llimits.h @@ -0,0 +1,323 @@ +/* +** $Id: llimits.h,v 1.141 2015/11/19 19:16:22 roberto Exp $ +** Limits, basic types, and some other 'installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + +/* +** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count +** the total memory used by Lua (in bytes). Usually, 'size_t' and +** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. +*/ +#if defined(LUAI_MEM) /* { external definitions? */ +typedef LUAI_UMEM lu_mem; +typedef LUAI_MEM l_mem; +#elif LUAI_BITSINT >= 32 /* }{ */ +typedef size_t lu_mem; +typedef ptrdiff_t l_mem; +#else /* 16-bit ints */ /* }{ */ +typedef unsigned long lu_mem; +typedef long l_mem; +#endif /* } */ + + +/* chars used as small naturals (so that 'char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +/* maximum value for size_t */ +#define MAX_SIZET ((size_t)(~(size_t)0)) + +/* maximum size visible for Lua (must be representable in a lua_Integer */ +#define MAX_SIZE (sizeof(size_t) < sizeof(lua_Integer) ? MAX_SIZET \ + : (size_t)(LUA_MAXINTEGER)) + + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) + +#define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1)) + + +#define MAX_INT INT_MAX /* maximum value of an int */ + + +/* +** conversion of pointer to unsigned integer: +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX)) + + + +/* type to ensure maximum alignment */ +#if defined(LUAI_USER_ALIGNMENT_T) +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; +#else +typedef union { + lua_Number n; + double u; + void *s; + lua_Integer i; + long l; +} L_Umaxalign; +#endif + + + +/* types of 'usual argument conversions' for lua_Number and lua_Integer */ +typedef LUAI_UACNUMBER l_uacNumber; +typedef LUAI_UACINT l_uacInt; + + +/* internal assertions for in-house debugging */ +#if defined(lua_assert) +#define check_exp(c,e) (lua_assert(c), (e)) +/* to avoid problems with conditions too long */ +#define lua_longassert(c) ((c) ? (void)0 : lua_assert(0)) +#else +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define lua_longassert(c) ((void)0) +#endif + +/* +** assertion for checking API calls +*/ +#if !defined(luai_apicheck) +#define luai_apicheck(l,e) lua_assert(e) +#endif + +#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) + + +/* macro to avoid warnings about unused variables */ +#if !defined(UNUSED) +#define UNUSED(x) ((void)(x)) +#endif + + +/* type casts (a macro highlights casts in the code) */ +#define cast(t, exp) ((t)(exp)) + +#define cast_void(i) cast(void, (i)) +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) +#define cast_uchar(i) cast(unsigned char, (i)) + + +/* cast a signed lua_Integer to lua_Unsigned */ +#if !defined(l_castS2U) +#define l_castS2U(i) ((lua_Unsigned)(i)) +#endif + +/* +** cast a lua_Unsigned to a signed lua_Integer; this cast is +** not strict ISO C, but two-complement architectures should +** work fine. +*/ +#if !defined(l_castU2S) +#define l_castU2S(i) ((lua_Integer)(i)) +#endif + + +/* +** non-return type +*/ +#if defined(__GNUC__) +#define l_noret void __attribute__((noreturn)) +#elif defined(_MSC_VER) && _MSC_VER >= 1200 +#define l_noret void __declspec(noreturn) +#else +#define l_noret void +#endif + + + +/* +** maximum depth for nested C calls and syntactical nested non-terminals +** in a program. (Value must fit in an unsigned short int.) +*/ +#if !defined(LUAI_MAXCCALLS) +#define LUAI_MAXCCALLS 200 +#endif + + + +/* +** type for virtual-machine instructions; +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +#if LUAI_BITSINT >= 32 +typedef unsigned int Instruction; +#else +typedef unsigned long Instruction; +#endif + + + +/* +** Maximum length for short strings, that is, strings that are +** internalized. (Cannot be smaller than reserved words or tags for +** metamethods, as these strings must be internalized; +** #("function") = 8, #("__newindex") = 10.) +*/ +#if !defined(LUAI_MAXSHORTLEN) +#define LUAI_MAXSHORTLEN 40 +#endif + + +/* +** Initial size for the string table (must be power of 2). +** The Lua core alone registers ~50 strings (reserved words + +** metaevent keys + a few others). Libraries would typically add +** a few dozens more. +*/ +#if !defined(MINSTRTABSIZE) +#define MINSTRTABSIZE 128 +#endif + + +/* +** Size of cache for strings in the API. 'N' is the number of +** sets (better be a prime) and "M" is the size of each set (M == 1 +** makes a direct cache.) +*/ +#if !defined(STRCACHE_N) +#define STRCACHE_N 53 +#define STRCACHE_M 2 +#endif + + +/* minimum size for string buffer */ +#if !defined(LUA_MINBUFFER) +#define LUA_MINBUFFER 32 +#endif + + +/* +** macros that are executed whenever program enters the Lua core +** ('lua_lock') and leaves the core ('lua_unlock') +*/ +#if !defined(lua_lock) +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +/* +** macro executed during Lua functions at points where the +** function can yield. +*/ +#if !defined(luai_threadyield) +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** these macros allow user-specific actions on threads when you defined +** LUAI_EXTRASPACE and need to do something extra when a thread is +** created/deleted/resumed/yielded. +*/ +#if !defined(luai_userstateopen) +#define luai_userstateopen(L) ((void)L) +#endif + +#if !defined(luai_userstateclose) +#define luai_userstateclose(L) ((void)L) +#endif + +#if !defined(luai_userstatethread) +#define luai_userstatethread(L,L1) ((void)L) +#endif + +#if !defined(luai_userstatefree) +#define luai_userstatefree(L,L1) ((void)L) +#endif + +#if !defined(luai_userstateresume) +#define luai_userstateresume(L,n) ((void)L) +#endif + +#if !defined(luai_userstateyield) +#define luai_userstateyield(L,n) ((void)L) +#endif + + + +/* +** The luai_num* macros define the primitive operations over numbers. +*/ + +/* floor division (defined as 'floor(a/b)') */ +#if !defined(luai_numidiv) +#define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) +#endif + +/* float division */ +#if !defined(luai_numdiv) +#define luai_numdiv(L,a,b) ((a)/(b)) +#endif + +/* +** modulo: defined as 'a - floor(a/b)*b'; this definition gives NaN when +** 'b' is huge, but the result should be 'a'. 'fmod' gives the result of +** 'a - trunc(a/b)*b', and therefore must be corrected when 'trunc(a/b) +** ~= floor(a/b)'. That happens when the division has a non-integer +** negative result, which is equivalent to the test below. +*/ +#if !defined(luai_nummod) +#define luai_nummod(L,a,b,m) \ + { (m) = l_mathop(fmod)(a,b); if ((m)*(b) < 0) (m) += (b); } +#endif + +/* exponentiation */ +#if !defined(luai_numpow) +#define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b)) +#endif + +/* the others are quite standard operations */ +#if !defined(luai_numadd) +#define luai_numadd(L,a,b) ((a)+(b)) +#define luai_numsub(L,a,b) ((a)-(b)) +#define luai_nummul(L,a,b) ((a)*(b)) +#define luai_numunm(L,a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + + + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#if !defined(HARDSTACKTESTS) +#define condmovestack(L,pre,pos) ((void)0) +#else +/* realloc stack keeping its size */ +#define condmovestack(L,pre,pos) \ + { int sz_ = (L)->stacksize; pre; luaD_reallocstack((L), sz_); pos; } +#endif + +#if !defined(HARDMEMTESTS) +#define condchangemem(L,pre,pos) ((void)0) +#else +#define condchangemem(L,pre,pos) \ + { if (G(L)->gcrunning) { pre; luaC_fullgc(L, 0); pos; } } +#endif + +#endif diff --git a/deps/rcheevos/test/lua/src/lmathlib.c b/deps/rcheevos/test/lua/src/lmathlib.c new file mode 100644 index 0000000000..b7f8baee07 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lmathlib.c @@ -0,0 +1,410 @@ +/* +** $Id: lmathlib.c,v 1.119 2016/12/22 13:08:50 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + +#define lmathlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (l_mathop(3.141592653589793238462643383279502884)) + + +#if !defined(l_rand) /* { */ +#if defined(LUA_USE_POSIX) +#define l_rand() random() +#define l_srand(x) srandom(x) +#define L_RANDMAX 2147483647 /* (2^31 - 1), following POSIX */ +#else +#define l_rand() rand() +#define l_srand(x) srand(x) +#define L_RANDMAX RAND_MAX +#endif +#endif /* } */ + + +static int math_abs (lua_State *L) { + if (lua_isinteger(L, 1)) { + lua_Integer n = lua_tointeger(L, 1); + if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n); + lua_pushinteger(L, n); + } + else + lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_Number y = luaL_checknumber(L, 1); + lua_Number x = luaL_optnumber(L, 2, 1); + lua_pushnumber(L, l_mathop(atan2)(y, x)); + return 1; +} + + +static int math_toint (lua_State *L) { + int valid; + lua_Integer n = lua_tointegerx(L, 1, &valid); + if (valid) + lua_pushinteger(L, n); + else { + luaL_checkany(L, 1); + lua_pushnil(L); /* value is not convertible to integer */ + } + return 1; +} + + +static void pushnumint (lua_State *L, lua_Number d) { + lua_Integer n; + if (lua_numbertointeger(d, &n)) /* does 'd' fit in an integer? */ + lua_pushinteger(L, n); /* result is integer */ + else + lua_pushnumber(L, d); /* result is float */ +} + + +static int math_floor (lua_State *L) { + if (lua_isinteger(L, 1)) + lua_settop(L, 1); /* integer is its own floor */ + else { + lua_Number d = l_mathop(floor)(luaL_checknumber(L, 1)); + pushnumint(L, d); + } + return 1; +} + + +static int math_ceil (lua_State *L) { + if (lua_isinteger(L, 1)) + lua_settop(L, 1); /* integer is its own ceil */ + else { + lua_Number d = l_mathop(ceil)(luaL_checknumber(L, 1)); + pushnumint(L, d); + } + return 1; +} + + +static int math_fmod (lua_State *L) { + if (lua_isinteger(L, 1) && lua_isinteger(L, 2)) { + lua_Integer d = lua_tointeger(L, 2); + if ((lua_Unsigned)d + 1u <= 1u) { /* special cases: -1 or 0 */ + luaL_argcheck(L, d != 0, 2, "zero"); + lua_pushinteger(L, 0); /* avoid overflow with 0x80000... / -1 */ + } + else + lua_pushinteger(L, lua_tointeger(L, 1) % d); + } + else + lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1), + luaL_checknumber(L, 2))); + return 1; +} + + +/* +** next function does not use 'modf', avoiding problems with 'double*' +** (which is not compatible with 'float*') when lua_Number is not +** 'double'. +*/ +static int math_modf (lua_State *L) { + if (lua_isinteger(L ,1)) { + lua_settop(L, 1); /* number is its own integer part */ + lua_pushnumber(L, 0); /* no fractional part */ + } + else { + lua_Number n = luaL_checknumber(L, 1); + /* integer part (rounds toward zero) */ + lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); + pushnumint(L, ip); + /* fractional part (test needed for inf/-inf) */ + lua_pushnumber(L, (n == ip) ? l_mathop(0.0) : (n - ip)); + } + return 2; +} + + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1))); + return 1; +} + + +static int math_ult (lua_State *L) { + lua_Integer a = luaL_checkinteger(L, 1); + lua_Integer b = luaL_checkinteger(L, 2); + lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b); + return 1; +} + +static int math_log (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + lua_Number res; + if (lua_isnoneornil(L, 2)) + res = l_mathop(log)(x); + else { + lua_Number base = luaL_checknumber(L, 2); +#if !defined(LUA_USE_C89) + if (base == l_mathop(2.0)) + res = l_mathop(log2)(x); else +#endif + if (base == l_mathop(10.0)) + res = l_mathop(log10)(x); + else + res = l_mathop(log)(x)/l_mathop(log)(base); + } + lua_pushnumber(L, res); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1) * (l_mathop(180.0) / PI)); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1) * (PI / l_mathop(180.0))); + return 1; +} + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int imin = 1; /* index of current minimum value */ + int i; + luaL_argcheck(L, n >= 1, 1, "value expected"); + for (i = 2; i <= n; i++) { + if (lua_compare(L, i, imin, LUA_OPLT)) + imin = i; + } + lua_pushvalue(L, imin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int imax = 1; /* index of current maximum value */ + int i; + luaL_argcheck(L, n >= 1, 1, "value expected"); + for (i = 2; i <= n; i++) { + if (lua_compare(L, imax, i, LUA_OPLT)) + imax = i; + } + lua_pushvalue(L, imax); + return 1; +} + +/* +** This function uses 'double' (instead of 'lua_Number') to ensure that +** all bits from 'l_rand' can be represented, and that 'RANDMAX + 1.0' +** will keep full precision (ensuring that 'r' is always less than 1.0.) +*/ +static int math_random (lua_State *L) { + lua_Integer low, up; + double r = (double)l_rand() * (1.0 / ((double)L_RANDMAX + 1.0)); + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, (lua_Number)r); /* Number between 0 and 1 */ + return 1; + } + case 1: { /* only upper limit */ + low = 1; + up = luaL_checkinteger(L, 1); + break; + } + case 2: { /* lower and upper limits */ + low = luaL_checkinteger(L, 1); + up = luaL_checkinteger(L, 2); + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + /* random integer in the interval [low, up] */ + luaL_argcheck(L, low <= up, 1, "interval is empty"); + luaL_argcheck(L, low >= 0 || up <= LUA_MAXINTEGER + low, 1, + "interval too large"); + r *= (double)(up - low) + 1.0; + lua_pushinteger(L, (lua_Integer)r + low); + return 1; +} + + +static int math_randomseed (lua_State *L) { + l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); + (void)l_rand(); /* discard first value to avoid undesirable correlations */ + return 0; +} + + +static int math_type (lua_State *L) { + if (lua_type(L, 1) == LUA_TNUMBER) { + if (lua_isinteger(L, 1)) + lua_pushliteral(L, "integer"); + else + lua_pushliteral(L, "float"); + } + else { + luaL_checkany(L, 1); + lua_pushnil(L); + } + return 1; +} + + +/* +** {================================================================== +** Deprecated functions (for compatibility only) +** =================================================================== +*/ +#if defined(LUA_COMPAT_MATHLIB) + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + lua_Number y = luaL_checknumber(L, 2); + lua_pushnumber(L, l_mathop(pow)(x, y)); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + int ep = (int)luaL_checkinteger(L, 2); + lua_pushnumber(L, l_mathop(ldexp)(x, ep)); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1))); + return 1; +} + +#endif +/* }================================================================== */ + + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"tointeger", math_toint}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"ult", math_ult}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tan", math_tan}, + {"type", math_type}, +#if defined(LUA_COMPAT_MATHLIB) + {"atan2", math_atan}, + {"cosh", math_cosh}, + {"sinh", math_sinh}, + {"tanh", math_tanh}, + {"pow", math_pow}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, +#endif + /* placeholders */ + {"pi", NULL}, + {"huge", NULL}, + {"maxinteger", NULL}, + {"mininteger", NULL}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUAMOD_API int luaopen_math (lua_State *L) { + luaL_newlib(L, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, (lua_Number)HUGE_VAL); + lua_setfield(L, -2, "huge"); + lua_pushinteger(L, LUA_MAXINTEGER); + lua_setfield(L, -2, "maxinteger"); + lua_pushinteger(L, LUA_MININTEGER); + lua_setfield(L, -2, "mininteger"); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/lmem.c b/deps/rcheevos/test/lua/src/lmem.c new file mode 100644 index 0000000000..0a0476cc77 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lmem.c @@ -0,0 +1,100 @@ +/* +** $Id: lmem.c,v 1.91 2015/03/06 19:45:54 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#define lmem_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** ('osize' is the old size, 'nsize' is the new size) +** +** * frealloc(ud, NULL, x, s) creates a new block of size 's' (no +** matter 'x'). +** +** * frealloc(ud, p, x, 0) frees the block 'p' +** (in this specific case, frealloc must return NULL); +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ISO C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *what) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, "too many %s (limit is %d)", what, limit); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +l_noret luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + void *newblock; + global_State *g = G(L); + size_t realosize = (block) ? osize : 0; + lua_assert((realosize == 0) == (block == NULL)); +#if defined(HARDMEMTESTS) + if (nsize > realosize && g->gcrunning) + luaC_fullgc(L, 1); /* force a GC whenever possible */ +#endif + newblock = (*g->frealloc)(g->ud, block, osize, nsize); + if (newblock == NULL && nsize > 0) { + lua_assert(nsize > realosize); /* cannot fail when shrinking a block */ + if (g->version) { /* is state fully built? */ + luaC_fullgc(L, 1); /* try to free some memory... */ + newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ + } + if (newblock == NULL) + luaD_throw(L, LUA_ERRMEM); + } + lua_assert((nsize == 0) == (newblock == NULL)); + g->GCdebt = (g->GCdebt + nsize) - realosize; + return newblock; +} + diff --git a/deps/rcheevos/test/lua/src/lmem.h b/deps/rcheevos/test/lua/src/lmem.h new file mode 100644 index 0000000000..30f484895e --- /dev/null +++ b/deps/rcheevos/test/lua/src/lmem.h @@ -0,0 +1,69 @@ +/* +** $Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + + +/* +** This macro reallocs a vector 'b' from 'on' to 'n' elements, where +** each element has size 'e'. In case of arithmetic overflow of the +** product 'n'*'e', it raises an error (calling 'luaM_toobig'). Because +** 'e' is always constant, it avoids the runtime division MAX_SIZET/(e). +** +** (The macro is somewhat complex to avoid warnings: The 'sizeof' +** comparison avoids a runtime comparison when overflow cannot occur. +** The compiler should be able to optimize the real test by itself, but +** when it does it, it may give a warning about "comparison is always +** false due to limited range of data type"; the +1 tricks the compiler, +** avoiding this warning but also this optimization.) +*/ +#define luaM_reallocv(L,b,on,n,e) \ + (((sizeof(n) >= sizeof(size_t) && cast(size_t, (n)) + 1 > MAX_SIZET/(e)) \ + ? luaM_toobig(L) : cast_void(0)) , \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e))) + +/* +** Arrays of chars do not need any test +*/ +#define luaM_reallocvchar(L,b,on,n) \ + cast(char *, luaM_realloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) + +#define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + +LUAI_FUNC l_noret luaM_toobig (lua_State *L); + +/* not to be called directly */ +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *what); + +#endif + diff --git a/deps/rcheevos/test/lua/src/loadlib.c b/deps/rcheevos/test/lua/src/loadlib.c new file mode 100644 index 0000000000..4791e748b1 --- /dev/null +++ b/deps/rcheevos/test/lua/src/loadlib.c @@ -0,0 +1,790 @@ +/* +** $Id: loadlib.c,v 1.130 2017/01/12 17:14:26 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Windows, and a stub for other +** systems. +*/ + +#define loadlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** LUA_IGMARK is a mark to ignore all before it when building the +** luaopen_ function name. +*/ +#if !defined (LUA_IGMARK) +#define LUA_IGMARK "-" +#endif + + +/* +** LUA_CSUBSEP is the character that replaces dots in submodule names +** when searching for a C loader. +** LUA_LSUBSEP is the character that replaces dots in submodule names +** when searching for a Lua loader. +*/ +#if !defined(LUA_CSUBSEP) +#define LUA_CSUBSEP LUA_DIRSEP +#endif + +#if !defined(LUA_LSUBSEP) +#define LUA_LSUBSEP LUA_DIRSEP +#endif + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +/* +** unique key for table in the registry that keeps handles +** for all loaded C libraries +*/ +static const int CLIBS = 0; + +#define LIB_FAIL "open" + + +#define setprogdir(L) ((void)0) + + +/* +** system-dependent functions +*/ + +/* +** unload library 'lib' +*/ +static void lsys_unloadlib (void *lib); + +/* +** load C library in file 'path'. If 'seeglb', load with all names in +** the library global. +** Returns the library; in case of error, returns NULL plus an +** error string in the stack. +*/ +static void *lsys_load (lua_State *L, const char *path, int seeglb); + +/* +** Try to find a function named 'sym' in library 'lib'. +** Returns the function; in case of error, returns NULL plus an +** error string in the stack. +*/ +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym); + + + + +#if defined(LUA_USE_DLOPEN) /* { */ +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include + +/* +** Macro to convert pointer-to-void* to pointer-to-function. This cast +** is undefined according to ISO C, but POSIX assumes that it works. +** (The '__extension__' in gnu compilers is only to avoid warnings.) +*/ +#if defined(__GNUC__) +#define cast_func(p) (__extension__ (lua_CFunction)(p)) +#else +#define cast_func(p) ((lua_CFunction)(p)) +#endif + + +static void lsys_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *lsys_load (lua_State *L, const char *path, int seeglb) { + void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL)); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = cast_func(dlsym(lib, sym)); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) /* }{ */ +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include + + +/* +** optional flags for LoadLibraryEx +*/ +#if !defined(LUA_LLE_FLAGS) +#define LUA_LLE_FLAGS 0 +#endif + + +#undef setprogdir + + +/* +** Replace in the path (on the top of the stack) any occurrence +** of LUA_EXEC_DIR with the executable's path. +*/ +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); /* get exec. name */ + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; /* cut name on the last '\\' to get the path */ + luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void lsys_unloadlib (void *lib) { + FreeLibrary((HMODULE)lib); +} + + +static void *lsys_load (lua_State *L, const char *path, int seeglb) { + HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS); + (void)(seeglb); /* not used: symbols are 'global' by default */ + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + +#else /* }{ */ +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void lsys_unloadlib (void *lib) { + (void)(lib); /* not used */ +} + + +static void *lsys_load (lua_State *L, const char *path, int seeglb) { + (void)(path); (void)(seeglb); /* not used */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { + (void)(lib); (void)(sym); /* not used */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif /* } */ + + +/* +** {================================================================== +** Set Paths +** =================================================================== +*/ + +/* +** LUA_PATH_VAR and LUA_CPATH_VAR are the names of the environment +** variables that Lua check to set its paths. +*/ +#if !defined(LUA_PATH_VAR) +#define LUA_PATH_VAR "LUA_PATH" +#endif + +#if !defined(LUA_CPATH_VAR) +#define LUA_CPATH_VAR "LUA_CPATH" +#endif + + +#define AUXMARK "\1" /* auxiliary mark */ + + +/* +** return registry.LUA_NOENV as a boolean +*/ +static int noenv (lua_State *L) { + int b; + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); + b = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + return b; +} + + +/* +** Set a path +*/ +static void setpath (lua_State *L, const char *fieldname, + const char *envname, + const char *dft) { + const char *nver = lua_pushfstring(L, "%s%s", envname, LUA_VERSUFFIX); + const char *path = getenv(nver); /* use versioned name */ + if (path == NULL) /* no environment variable? */ + path = getenv(envname); /* try unversioned name */ + if (path == NULL || noenv(L)) /* no environment variable? */ + lua_pushstring(L, dft); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP, + LUA_PATH_SEP AUXMARK LUA_PATH_SEP); + luaL_gsub(L, path, AUXMARK, dft); + lua_remove(L, -2); /* remove result from 1st 'gsub' */ + } + setprogdir(L); + lua_setfield(L, -3, fieldname); /* package[fieldname] = path value */ + lua_pop(L, 1); /* pop versioned variable name */ +} + +/* }================================================================== */ + + +/* +** return registry.CLIBS[path] +*/ +static void *checkclib (lua_State *L, const char *path) { + void *plib; + lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); + lua_getfield(L, -1, path); + plib = lua_touserdata(L, -1); /* plib = CLIBS[path] */ + lua_pop(L, 2); /* pop CLIBS table and 'plib' */ + return plib; +} + + +/* +** registry.CLIBS[path] = plib -- for queries +** registry.CLIBS[#CLIBS + 1] = plib -- also keep a list of all libraries +*/ +static void addtoclib (lua_State *L, const char *path, void *plib) { + lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); + lua_pushlightuserdata(L, plib); + lua_pushvalue(L, -1); + lua_setfield(L, -3, path); /* CLIBS[path] = plib */ + lua_rawseti(L, -2, luaL_len(L, -2) + 1); /* CLIBS[#CLIBS + 1] = plib */ + lua_pop(L, 1); /* pop CLIBS table */ +} + + +/* +** __gc tag method for CLIBS table: calls 'lsys_unloadlib' for all lib +** handles in list CLIBS +*/ +static int gctm (lua_State *L) { + lua_Integer n = luaL_len(L, 1); + for (; n >= 1; n--) { /* for each handle, in reverse order */ + lua_rawgeti(L, 1, n); /* get handle CLIBS[n] */ + lsys_unloadlib(lua_touserdata(L, -1)); + lua_pop(L, 1); /* pop handle */ + } + return 0; +} + + + +/* error codes for 'lookforfunc' */ +#define ERRLIB 1 +#define ERRFUNC 2 + +/* +** Look for a C function named 'sym' in a dynamically loaded library +** 'path'. +** First, check whether the library is already loaded; if not, try +** to load it. +** Then, if 'sym' is '*', return true (as library has been loaded). +** Otherwise, look for symbol 'sym' in the library and push a +** C function with that symbol. +** Return 0 and 'true' or a function in the stack; in case of +** errors, return an error code and an error message in the stack. +*/ +static int lookforfunc (lua_State *L, const char *path, const char *sym) { + void *reg = checkclib(L, path); /* check loaded C libraries */ + if (reg == NULL) { /* must load library? */ + reg = lsys_load(L, path, *sym == '*'); /* global symbols if 'sym'=='*' */ + if (reg == NULL) return ERRLIB; /* unable to load library */ + addtoclib(L, path, reg); + } + if (*sym == '*') { /* loading only library (no function)? */ + lua_pushboolean(L, 1); /* return 'true' */ + return 0; /* no errors */ + } + else { + lua_CFunction f = lsys_sym(L, reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); /* else create new function */ + return 0; /* no errors */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = lookforfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATH_SEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATH_SEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *searchpath (lua_State *L, const char *name, + const char *path, + const char *sep, + const char *dirsep) { + luaL_Buffer msg; /* to build error message */ + luaL_buffinit(L, &msg); + if (*sep != '\0') /* non-empty separator? */ + name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename = luaL_gsub(L, lua_tostring(L, -1), + LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file '%s'", filename); + lua_remove(L, -2); /* remove file name */ + luaL_addvalue(&msg); /* concatenate error msg. entry */ + } + luaL_pushresult(&msg); /* create error message */ + return NULL; /* not found */ +} + + +static int ll_searchpath (lua_State *L) { + const char *f = searchpath(L, luaL_checkstring(L, 1), + luaL_checkstring(L, 2), + luaL_optstring(L, 3, "."), + luaL_optstring(L, 4, LUA_DIRSEP)); + if (f != NULL) return 1; + else { /* error message is on top of the stack */ + lua_pushnil(L); + lua_insert(L, -2); + return 2; /* return nil + error message */ + } +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname, + const char *dirsep) { + const char *path; + lua_getfield(L, lua_upvalueindex(1), pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, "'package.%s' must be a string", pname); + return searchpath(L, name, path, ".", dirsep); +} + + +static int checkload (lua_State *L, int stat, const char *filename) { + if (stat) { /* module loaded successfully? */ + lua_pushstring(L, filename); /* will be 2nd argument to module */ + return 2; /* return open function and file name */ + } + else + return luaL_error(L, "error loading module '%s' from file '%s':\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int searcher_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path", LUA_LSUBSEP); + if (filename == NULL) return 1; /* module not found in this path */ + return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename); +} + + +/* +** Try to find a load function for module 'modname' at file 'filename'. +** First, change '.' to '_' in 'modname'; then, if 'modname' has +** the form X-Y (that is, it has an "ignore mark"), build a function +** name "luaopen_X" and look for it. (For compatibility, if that +** fails, it also tries "luaopen_Y".) If there is no ignore mark, +** look for a function named "luaopen_modname". +*/ +static int loadfunc (lua_State *L, const char *filename, const char *modname) { + const char *openfunc; + const char *mark; + modname = luaL_gsub(L, modname, ".", LUA_OFSEP); + mark = strchr(modname, *LUA_IGMARK); + if (mark) { + int stat; + openfunc = lua_pushlstring(L, modname, mark - modname); + openfunc = lua_pushfstring(L, LUA_POF"%s", openfunc); + stat = lookforfunc(L, filename, openfunc); + if (stat != ERRFUNC) return stat; + modname = mark + 1; /* else go ahead and try old-style name */ + } + openfunc = lua_pushfstring(L, LUA_POF"%s", modname); + return lookforfunc(L, filename, openfunc); +} + + +static int searcher_C (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath", LUA_CSUBSEP); + if (filename == NULL) return 1; /* module not found in this path */ + return checkload(L, (loadfunc(L, filename, name) == 0), filename); +} + + +static int searcher_Croot (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP); + if (filename == NULL) return 1; /* root not found */ + if ((stat = loadfunc(L, filename, name)) != 0) { + if (stat != ERRFUNC) + return checkload(L, 0, filename); /* real error */ + else { /* open function not found */ + lua_pushfstring(L, "\n\tno module '%s' in file '%s'", name, filename); + return 1; + } + } + lua_pushstring(L, filename); /* will be 2nd argument to module */ + return 2; +} + + +static int searcher_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); + if (lua_getfield(L, -1, name) == LUA_TNIL) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static void findloader (lua_State *L, const char *name) { + int i; + luaL_Buffer msg; /* to build error message */ + luaL_buffinit(L, &msg); + /* push 'package.searchers' to index 3 in the stack */ + if (lua_getfield(L, lua_upvalueindex(1), "searchers") != LUA_TTABLE) + luaL_error(L, "'package.searchers' must be a table"); + /* iterate over available searchers to find a loader */ + for (i = 1; ; i++) { + if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ + lua_pop(L, 1); /* remove nil */ + luaL_pushresult(&msg); /* create error message */ + luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); + } + lua_pushstring(L, name); + lua_call(L, 1, 2); /* call it */ + if (lua_isfunction(L, -2)) /* did it find a loader? */ + return; /* module loader found */ + else if (lua_isstring(L, -2)) { /* searcher returned error message? */ + lua_pop(L, 1); /* remove extra return */ + luaL_addvalue(&msg); /* concatenate error message */ + } + else + lua_pop(L, 2); /* remove both returns */ + } +} + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_settop(L, 1); /* LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + lua_getfield(L, 2, name); /* LOADED[name] */ + if (lua_toboolean(L, -1)) /* is it there? */ + return 1; /* package is already loaded */ + /* else must load package */ + lua_pop(L, 1); /* remove 'getfield' result */ + findloader(L, name); + lua_pushstring(L, name); /* pass name as argument to module loader */ + lua_insert(L, -2); /* name is 1st argument (before search data) */ + lua_call(L, 2, 1); /* run loader to load module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* LOADED[name] = returned value */ + if (lua_getfield(L, 2, name) == LUA_TNIL) { /* module set no value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ +#if defined(LUA_COMPAT_MODULE) + +/* +** changes the environment variable of calling function +*/ +static void set_env (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, "'module' not called from a Lua function"); + lua_pushvalue(L, -2); /* copy new environment table to top */ + lua_setupvalue(L, -2, 1); + lua_pop(L, 1); /* remove function */ +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + if (lua_isfunction(L, i)) { /* avoid 'calling' extra info. */ + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int lastarg = lua_gettop(L); /* last parameter */ + luaL_pushmodule(L, modname, 1); /* get/create module table */ + /* check whether table already has a _NAME field */ + if (lua_getfield(L, -1, "_NAME") != LUA_TNIL) + lua_pop(L, 1); /* table is an initialized module */ + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + set_env(L); + dooptions(L, lastarg); + return 1; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushglobaltable(L); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + +#endif +/* }====================================================== */ + + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"searchpath", ll_searchpath}, +#if defined(LUA_COMPAT_MODULE) + {"seeall", ll_seeall}, +#endif + /* placeholders */ + {"preload", NULL}, + {"cpath", NULL}, + {"path", NULL}, + {"searchers", NULL}, + {"loaded", NULL}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { +#if defined(LUA_COMPAT_MODULE) + {"module", ll_module}, +#endif + {"require", ll_require}, + {NULL, NULL} +}; + + +static void createsearcherstable (lua_State *L) { + static const lua_CFunction searchers[] = + {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL}; + int i; + /* create 'searchers' table */ + lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0); + /* fill it with predefined searchers */ + for (i=0; searchers[i] != NULL; i++) { + lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */ + lua_pushcclosure(L, searchers[i], 1); + lua_rawseti(L, -2, i+1); + } +#if defined(LUA_COMPAT_LOADERS) + lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ + lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */ +#endif + lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ +} + + +/* +** create table CLIBS to keep track of loaded C libraries, +** setting a finalizer to close all libraries when closing state. +*/ +static void createclibstable (lua_State *L) { + lua_newtable(L); /* create CLIBS table */ + lua_createtable(L, 0, 1); /* create metatable for CLIBS */ + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */ + lua_setmetatable(L, -2); + lua_rawsetp(L, LUA_REGISTRYINDEX, &CLIBS); /* set CLIBS table in registry */ +} + + +LUAMOD_API int luaopen_package (lua_State *L) { + createclibstable(L); + luaL_newlib(L, pk_funcs); /* create 'package' table */ + createsearcherstable(L); + /* set paths */ + setpath(L, "path", LUA_PATH_VAR, LUA_PATH_DEFAULT); + setpath(L, "cpath", LUA_CPATH_VAR, LUA_CPATH_DEFAULT); + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n" + LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); + lua_setfield(L, -2, "config"); + /* set field 'loaded' */ + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + lua_setfield(L, -2, "loaded"); + /* set field 'preload' */ + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); + lua_setfield(L, -2, "preload"); + lua_pushglobaltable(L); + lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ + luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */ + lua_pop(L, 1); /* pop global table */ + return 1; /* return 'package' table */ +} + diff --git a/deps/rcheevos/test/lua/src/lobject.c b/deps/rcheevos/test/lua/src/lobject.c new file mode 100644 index 0000000000..2da76899a2 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lobject.c @@ -0,0 +1,521 @@ +/* +** $Id: lobject.c,v 2.113 2016/12/22 13:08:50 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#define lobject_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lctype.h" +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +LUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* exponent */ + if (x < 8) return x; + while (x >= (8 << 4)) { /* coarse steps */ + x = (x + 0xf) >> 4; /* x = ceil(x / 16) */ + e += 4; + } + while (x >= (8 << 1)) { /* fine steps */ + x = (x + 1) >> 1; /* x = ceil(x / 2) */ + e++; + } + return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1); +} + + +/* +** Computes ceil(log2(x)) +*/ +int luaO_ceillog2 (unsigned int x) { + static const lu_byte log_2[256] = { /* log_2[i] = ceil(log2(i - 1)) */ + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = 0; + x--; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; +} + + +static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, + lua_Integer v2) { + switch (op) { + case LUA_OPADD: return intop(+, v1, v2); + case LUA_OPSUB:return intop(-, v1, v2); + case LUA_OPMUL:return intop(*, v1, v2); + case LUA_OPMOD: return luaV_mod(L, v1, v2); + case LUA_OPIDIV: return luaV_div(L, v1, v2); + case LUA_OPBAND: return intop(&, v1, v2); + case LUA_OPBOR: return intop(|, v1, v2); + case LUA_OPBXOR: return intop(^, v1, v2); + case LUA_OPSHL: return luaV_shiftl(v1, v2); + case LUA_OPSHR: return luaV_shiftl(v1, -v2); + case LUA_OPUNM: return intop(-, 0, v1); + case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); + default: lua_assert(0); return 0; + } +} + + +static lua_Number numarith (lua_State *L, int op, lua_Number v1, + lua_Number v2) { + switch (op) { + case LUA_OPADD: return luai_numadd(L, v1, v2); + case LUA_OPSUB: return luai_numsub(L, v1, v2); + case LUA_OPMUL: return luai_nummul(L, v1, v2); + case LUA_OPDIV: return luai_numdiv(L, v1, v2); + case LUA_OPPOW: return luai_numpow(L, v1, v2); + case LUA_OPIDIV: return luai_numidiv(L, v1, v2); + case LUA_OPUNM: return luai_numunm(L, v1); + case LUA_OPMOD: { + lua_Number m; + luai_nummod(L, v1, v2, m); + return m; + } + default: lua_assert(0); return 0; + } +} + + +void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, + TValue *res) { + switch (op) { + case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: + case LUA_OPSHL: case LUA_OPSHR: + case LUA_OPBNOT: { /* operate only on integers */ + lua_Integer i1; lua_Integer i2; + if (tointeger(p1, &i1) && tointeger(p2, &i2)) { + setivalue(res, intarith(L, op, i1, i2)); + return; + } + else break; /* go to the end */ + } + case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */ + lua_Number n1; lua_Number n2; + if (tonumber(p1, &n1) && tonumber(p2, &n2)) { + setfltvalue(res, numarith(L, op, n1, n2)); + return; + } + else break; /* go to the end */ + } + default: { /* other operations */ + lua_Number n1; lua_Number n2; + if (ttisinteger(p1) && ttisinteger(p2)) { + setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2))); + return; + } + else if (tonumber(p1, &n1) && tonumber(p2, &n2)) { + setfltvalue(res, numarith(L, op, n1, n2)); + return; + } + else break; /* go to the end */ + } + } + /* could not perform raw operation; try metamethod */ + lua_assert(L != NULL); /* should not fail when folding (compile time) */ + luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD)); +} + + +int luaO_hexavalue (int c) { + if (lisdigit(c)) return c - '0'; + else return (ltolower(c) - 'a') + 10; +} + + +static int isneg (const char **s) { + if (**s == '-') { (*s)++; return 1; } + else if (**s == '+') (*s)++; + return 0; +} + + + +/* +** {================================================================== +** Lua's implementation for 'lua_strx2number' +** =================================================================== +*/ + +#if !defined(lua_strx2number) + +/* maximum number of significant digits to read (to avoid overflows + even with single floats) */ +#define MAXSIGDIG 30 + +/* +** convert an hexadecimal numeric string to a number, following +** C99 specification for 'strtod' +*/ +static lua_Number lua_strx2number (const char *s, char **endptr) { + int dot = lua_getlocaledecpoint(); + lua_Number r = 0.0; /* result (accumulator) */ + int sigdig = 0; /* number of significant digits */ + int nosigdig = 0; /* number of non-significant digits */ + int e = 0; /* exponent correction */ + int neg; /* 1 if number is negative */ + int hasdot = 0; /* true after seen a dot */ + *endptr = cast(char *, s); /* nothing is valid yet */ + while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ + neg = isneg(&s); /* check signal */ + if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ + return 0.0; /* invalid format (no '0x') */ + for (s += 2; ; s++) { /* skip '0x' and read numeral */ + if (*s == dot) { + if (hasdot) break; /* second dot? stop loop */ + else hasdot = 1; + } + else if (lisxdigit(cast_uchar(*s))) { + if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ + nosigdig++; + else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ + r = (r * cast_num(16.0)) + luaO_hexavalue(*s); + else e++; /* too many digits; ignore, but still count for exponent */ + if (hasdot) e--; /* decimal digit? correct exponent */ + } + else break; /* neither a dot nor a digit */ + } + if (nosigdig + sigdig == 0) /* no digits? */ + return 0.0; /* invalid format */ + *endptr = cast(char *, s); /* valid up to here */ + e *= 4; /* each digit multiplies/divides value by 2^4 */ + if (*s == 'p' || *s == 'P') { /* exponent part? */ + int exp1 = 0; /* exponent value */ + int neg1; /* exponent signal */ + s++; /* skip 'p' */ + neg1 = isneg(&s); /* signal */ + if (!lisdigit(cast_uchar(*s))) + return 0.0; /* invalid; must have at least one digit */ + while (lisdigit(cast_uchar(*s))) /* read exponent */ + exp1 = exp1 * 10 + *(s++) - '0'; + if (neg1) exp1 = -exp1; + e += exp1; + *endptr = cast(char *, s); /* valid up to here */ + } + if (neg) r = -r; + return l_mathop(ldexp)(r, e); +} + +#endif +/* }====================================================== */ + + +/* maximum length of a numeral */ +#if !defined (L_MAXLENNUM) +#define L_MAXLENNUM 200 +#endif + +static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { + char *endptr; + *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ + : lua_str2number(s, &endptr); + if (endptr == s) return NULL; /* nothing recognized? */ + while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ + return (*endptr == '\0') ? endptr : NULL; /* OK if no trailing characters */ +} + + +/* +** Convert string 's' to a Lua number (put in 'result'). Return NULL +** on fail or the address of the ending '\0' on success. +** 'pmode' points to (and 'mode' contains) special things in the string: +** - 'x'/'X' means an hexadecimal numeral +** - 'n'/'N' means 'inf' or 'nan' (which should be rejected) +** - '.' just optimizes the search for the common case (nothing special) +** This function accepts both the current locale or a dot as the radix +** mark. If the convertion fails, it may mean number has a dot but +** locale accepts something else. In that case, the code copies 's' +** to a buffer (because 's' is read-only), changes the dot to the +** current locale radix mark, and tries to convert again. +*/ +static const char *l_str2d (const char *s, lua_Number *result) { + const char *endptr; + const char *pmode = strpbrk(s, ".xXnN"); + int mode = pmode ? ltolower(cast_uchar(*pmode)) : 0; + if (mode == 'n') /* reject 'inf' and 'nan' */ + return NULL; + endptr = l_str2dloc(s, result, mode); /* try to convert */ + if (endptr == NULL) { /* failed? may be a different locale */ + char buff[L_MAXLENNUM + 1]; + const char *pdot = strchr(s, '.'); + if (strlen(s) > L_MAXLENNUM || pdot == NULL) + return NULL; /* string too long or no dot; fail */ + strcpy(buff, s); /* copy string to buffer */ + buff[pdot - s] = lua_getlocaledecpoint(); /* correct decimal point */ + endptr = l_str2dloc(buff, result, mode); /* try again */ + if (endptr != NULL) + endptr = s + (endptr - buff); /* make relative to 's' */ + } + return endptr; +} + + +#define MAXBY10 cast(lua_Unsigned, LUA_MAXINTEGER / 10) +#define MAXLASTD cast_int(LUA_MAXINTEGER % 10) + +static const char *l_str2int (const char *s, lua_Integer *result) { + lua_Unsigned a = 0; + int empty = 1; + int neg; + while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ + neg = isneg(&s); + if (s[0] == '0' && + (s[1] == 'x' || s[1] == 'X')) { /* hex? */ + s += 2; /* skip '0x' */ + for (; lisxdigit(cast_uchar(*s)); s++) { + a = a * 16 + luaO_hexavalue(*s); + empty = 0; + } + } + else { /* decimal */ + for (; lisdigit(cast_uchar(*s)); s++) { + int d = *s - '0'; + if (a >= MAXBY10 && (a > MAXBY10 || d > MAXLASTD + neg)) /* overflow? */ + return NULL; /* do not accept it (as integer) */ + a = a * 10 + d; + empty = 0; + } + } + while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ + if (empty || *s != '\0') return NULL; /* something wrong in the numeral */ + else { + *result = l_castU2S((neg) ? 0u - a : a); + return s; + } +} + + +size_t luaO_str2num (const char *s, TValue *o) { + lua_Integer i; lua_Number n; + const char *e; + if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */ + setivalue(o, i); + } + else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */ + setfltvalue(o, n); + } + else + return 0; /* conversion failed */ + return (e - s) + 1; /* success; return string size */ +} + + +int luaO_utf8esc (char *buff, unsigned long x) { + int n = 1; /* number of bytes put in buffer (backwards) */ + lua_assert(x <= 0x10FFFF); + if (x < 0x80) /* ascii? */ + buff[UTF8BUFFSZ - 1] = cast(char, x); + else { /* need continuation bytes */ + unsigned int mfb = 0x3f; /* maximum that fits in first byte */ + do { /* add continuation bytes */ + buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f)); + x >>= 6; /* remove added bits */ + mfb >>= 1; /* now there is one less bit available in first byte */ + } while (x > mfb); /* still needs continuation byte? */ + buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */ + } + return n; +} + + +/* maximum length of the conversion of a number to a string */ +#define MAXNUMBER2STR 50 + + +/* +** Convert a number object to a string +*/ +void luaO_tostring (lua_State *L, StkId obj) { + char buff[MAXNUMBER2STR]; + size_t len; + lua_assert(ttisnumber(obj)); + if (ttisinteger(obj)) + len = lua_integer2str(buff, sizeof(buff), ivalue(obj)); + else { + len = lua_number2str(buff, sizeof(buff), fltvalue(obj)); +#if !defined(LUA_COMPAT_FLOATSTRING) + if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ + buff[len++] = lua_getlocaledecpoint(); + buff[len++] = '0'; /* adds '.0' to result */ + } +#endif + } + setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); +} + + +static void pushstr (lua_State *L, const char *str, size_t l) { + setsvalue2s(L, L->top, luaS_newlstr(L, str, l)); + luaD_inctop(L); +} + + +/* +** this function handles only '%d', '%c', '%f', '%p', and '%s' + conventional formats, plus Lua-specific '%I' and '%U' +*/ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 0; + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + pushstr(L, fmt, e - fmt); + switch (*(e+1)) { + case 's': { /* zero-terminated string */ + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s, strlen(s)); + break; + } + case 'c': { /* an 'int' as a character */ + char buff = cast(char, va_arg(argp, int)); + if (lisprint(cast_uchar(buff))) + pushstr(L, &buff, 1); + else /* non-printable character; print its code */ + luaO_pushfstring(L, "<\\%d>", cast_uchar(buff)); + break; + } + case 'd': { /* an 'int' */ + setivalue(L->top, va_arg(argp, int)); + goto top2str; + } + case 'I': { /* a 'lua_Integer' */ + setivalue(L->top, cast(lua_Integer, va_arg(argp, l_uacInt))); + goto top2str; + } + case 'f': { /* a 'lua_Number' */ + setfltvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + top2str: /* convert the top element to a string */ + luaD_inctop(L); + luaO_tostring(L, L->top - 1); + break; + } + case 'p': { /* a pointer */ + char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */ + int l = l_sprintf(buff, sizeof(buff), "%p", va_arg(argp, void *)); + pushstr(L, buff, l); + break; + } + case 'U': { /* an 'int' as a UTF-8 sequence */ + char buff[UTF8BUFFSZ]; + int l = luaO_utf8esc(buff, cast(long, va_arg(argp, long))); + pushstr(L, buff + UTF8BUFFSZ - l, l); + break; + } + case '%': { + pushstr(L, "%", 1); + break; + } + default: { + luaG_runerror(L, "invalid option '%%%c' to 'lua_pushfstring'", + *(e + 1)); + } + } + n += 2; + fmt = e+2; + } + luaD_checkstack(L, 1); + pushstr(L, fmt, strlen(fmt)); + if (n > 0) luaV_concat(L, n + 1); + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +/* number of chars of a literal string without the ending \0 */ +#define LL(x) (sizeof(x)/sizeof(char) - 1) + +#define RETS "..." +#define PRE "[string \"" +#define POS "\"]" + +#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) ) + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + size_t l = strlen(source); + if (*source == '=') { /* 'literal' source */ + if (l <= bufflen) /* small enough? */ + memcpy(out, source + 1, l * sizeof(char)); + else { /* truncate it */ + addstr(out, source + 1, bufflen - 1); + *out = '\0'; + } + } + else if (*source == '@') { /* file name */ + if (l <= bufflen) /* small enough? */ + memcpy(out, source + 1, l * sizeof(char)); + else { /* add '...' before rest of name */ + addstr(out, RETS, LL(RETS)); + bufflen -= LL(RETS); + memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char)); + } + } + else { /* string; format as [string "source"] */ + const char *nl = strchr(source, '\n'); /* find first new line (if any) */ + addstr(out, PRE, LL(PRE)); /* add prefix */ + bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */ + if (l < bufflen && nl == NULL) { /* small one-line source? */ + addstr(out, source, l); /* keep it */ + } + else { + if (nl != NULL) l = nl - source; /* stop at first newline */ + if (l > bufflen) l = bufflen; + addstr(out, source, l); + addstr(out, RETS, LL(RETS)); + } + memcpy(out, POS, (LL(POS) + 1) * sizeof(char)); + } +} + diff --git a/deps/rcheevos/test/lua/src/lobject.h b/deps/rcheevos/test/lua/src/lobject.h new file mode 100644 index 0000000000..3c04228949 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lobject.h @@ -0,0 +1,549 @@ +/* +** $Id: lobject.h,v 2.117 2016/08/01 19:51:24 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO LUA_NUMTAGS /* function prototypes */ +#define LUA_TDEADKEY (LUA_NUMTAGS+1) /* removed keys in tables */ + +/* +** number of all possible tags (including LUA_TNONE but excluding DEADKEY) +*/ +#define LUA_TOTALTAGS (LUA_TPROTO + 2) + + +/* +** tags for Tagged Values have the following use of bits: +** bits 0-3: actual tag (a LUA_T* value) +** bits 4-5: variant bits +** bit 6: whether value is collectable +*/ + + +/* +** LUA_TFUNCTION variants: +** 0 - Lua function +** 1 - light C function +** 2 - regular C function (closure) +*/ + +/* Variant tags for functions */ +#define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ +#define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ +#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ + + +/* Variant tags for strings */ +#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */ +#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */ + + +/* Variant tags for numbers */ +#define LUA_TNUMFLT (LUA_TNUMBER | (0 << 4)) /* float numbers */ +#define LUA_TNUMINT (LUA_TNUMBER | (1 << 4)) /* integer numbers */ + + +/* Bit mark for collectable types */ +#define BIT_ISCOLLECTABLE (1 << 6) + +/* mark a tag as collectable */ +#define ctb(t) ((t) | BIT_ISCOLLECTABLE) + + +/* +** Common type for all collectable objects +*/ +typedef struct GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common type has only the common header +*/ +struct GCObject { + CommonHeader; +}; + + + + +/* +** Tagged Values. This is the basic representation of values in Lua, +** an actual value plus a tag with its type. +*/ + +/* +** Union of all Lua values +*/ +typedef union Value { + GCObject *gc; /* collectable objects */ + void *p; /* light userdata */ + int b; /* booleans */ + lua_CFunction f; /* light C functions */ + lua_Integer i; /* integer numbers */ + lua_Number n; /* float numbers */ +} Value; + + +#define TValuefields Value value_; int tt_ + + +typedef struct lua_TValue { + TValuefields; +} TValue; + + + +/* macro defining a nil value */ +#define NILCONSTANT {NULL}, LUA_TNIL + + +#define val_(o) ((o)->value_) + + +/* raw type tag of a TValue */ +#define rttype(o) ((o)->tt_) + +/* tag with no variants (bits 0-3) */ +#define novariant(x) ((x) & 0x0F) + +/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ +#define ttype(o) (rttype(o) & 0x3F) + +/* type tag of a TValue with no variants (bits 0-3) */ +#define ttnov(o) (novariant(rttype(o))) + + +/* Macros to test type */ +#define checktag(o,t) (rttype(o) == (t)) +#define checktype(o,t) (ttnov(o) == (t)) +#define ttisnumber(o) checktype((o), LUA_TNUMBER) +#define ttisfloat(o) checktag((o), LUA_TNUMFLT) +#define ttisinteger(o) checktag((o), LUA_TNUMINT) +#define ttisnil(o) checktag((o), LUA_TNIL) +#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) +#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) +#define ttisstring(o) checktype((o), LUA_TSTRING) +#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) +#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) +#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) +#define ttisfunction(o) checktype(o, LUA_TFUNCTION) +#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) +#define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) +#define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) +#define ttislcf(o) checktag((o), LUA_TLCF) +#define ttisfulluserdata(o) checktag((o), ctb(LUA_TUSERDATA)) +#define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) +#define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) + + +/* Macros to access values */ +#define ivalue(o) check_exp(ttisinteger(o), val_(o).i) +#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) +#define nvalue(o) check_exp(ttisnumber(o), \ + (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o))) +#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) +#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) +#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) +#define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc)) +#define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc)) +#define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc)) +#define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc)) +#define fvalue(o) check_exp(ttislcf(o), val_(o).f) +#define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc)) +#define bvalue(o) check_exp(ttisboolean(o), val_(o).b) +#define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc)) +/* a dead value may get the 'gc' field, but cannot access its contents */ +#define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + + +#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) + + +/* Macros for internal tests */ +#define righttt(obj) (ttype(obj) == gcvalue(obj)->tt) + +#define checkliveness(L,obj) \ + lua_longassert(!iscollectable(obj) || \ + (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))) + + +/* Macros to set values */ +#define settt_(o,t) ((o)->tt_=(t)) + +#define setfltvalue(obj,x) \ + { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } + +#define chgfltvalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } + +#define setivalue(obj,x) \ + { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } + +#define chgivalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } + +#define setnilvalue(obj) settt_(obj, LUA_TNIL) + +#define setfvalue(obj,x) \ + { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } + +#define setpvalue(obj,x) \ + { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } + +#define setbvalue(obj,x) \ + { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } + +#define setgcovalue(L,obj,x) \ + { TValue *io = (obj); GCObject *i_g=(x); \ + val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); } + +#define setsvalue(L,obj,x) \ + { TValue *io = (obj); TString *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \ + checkliveness(L,io); } + +#define setuvalue(L,obj,x) \ + { TValue *io = (obj); Udata *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \ + checkliveness(L,io); } + +#define setthvalue(L,obj,x) \ + { TValue *io = (obj); lua_State *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \ + checkliveness(L,io); } + +#define setclLvalue(L,obj,x) \ + { TValue *io = (obj); LClosure *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \ + checkliveness(L,io); } + +#define setclCvalue(L,obj,x) \ + { TValue *io = (obj); CClosure *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \ + checkliveness(L,io); } + +#define sethvalue(L,obj,x) \ + { TValue *io = (obj); Table *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \ + checkliveness(L,io); } + +#define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) + + + +#define setobj(L,obj1,obj2) \ + { TValue *io1=(obj1); *io1 = *(obj2); \ + (void)L; checkliveness(L,io1); } + + +/* +** different types of assignments, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +/* to table (define it as an expression to be used in macros) */ +#define setobj2t(L,o1,o2) ((void)L, *(o1)=*(o2), checkliveness(L,(o1))) + + + + +/* +** {====================================================== +** types and prototypes +** ======================================================= +*/ + + +typedef TValue *StkId; /* index to stack elements */ + + + + +/* +** Header for string value; string bytes follow the end of this structure +** (aligned according to 'UTString'; see next). +*/ +typedef struct TString { + CommonHeader; + lu_byte extra; /* reserved words for short strings; "has hash" for longs */ + lu_byte shrlen; /* length for short strings */ + unsigned int hash; + union { + size_t lnglen; /* length for long strings */ + struct TString *hnext; /* linked list for hash table */ + } u; +} TString; + + +/* +** Ensures that address after this type is always fully aligned. +*/ +typedef union UTString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + TString tsv; +} UTString; + + +/* +** Get the actual string (array of bytes) from a 'TString'. +** (Access to 'extra' ensures that value is really a 'TString'.) +*/ +#define getstr(ts) \ + check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) + + +/* get the actual string (array of bytes) from a Lua value */ +#define svalue(o) getstr(tsvalue(o)) + +/* get string length from 'TString *s' */ +#define tsslen(s) ((s)->tt == LUA_TSHRSTR ? (s)->shrlen : (s)->u.lnglen) + +/* get string length from 'TValue *o' */ +#define vslen(o) tsslen(tsvalue(o)) + + +/* +** Header for userdata; memory area follows the end of this structure +** (aligned according to 'UUdata'; see next). +*/ +typedef struct Udata { + CommonHeader; + lu_byte ttuv_; /* user value's tag */ + struct Table *metatable; + size_t len; /* number of bytes */ + union Value user_; /* user value */ +} Udata; + + +/* +** Ensures that address after this type is always fully aligned. +*/ +typedef union UUdata { + L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */ + Udata uv; +} UUdata; + + +/* +** Get the address of memory block inside 'Udata'. +** (Access to 'ttuv_' ensures that value is really a 'Udata'.) +*/ +#define getudatamem(u) \ + check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata))) + +#define setuservalue(L,u,o) \ + { const TValue *io=(o); Udata *iu = (u); \ + iu->user_ = io->value_; iu->ttuv_ = rttype(io); \ + checkliveness(L,io); } + + +#define getuservalue(L,u,o) \ + { TValue *io=(o); const Udata *iu = (u); \ + io->value_ = iu->user_; settt_(io, iu->ttuv_); \ + checkliveness(L,io); } + + +/* +** Description of an upvalue for function prototypes +*/ +typedef struct Upvaldesc { + TString *name; /* upvalue name (for debug information) */ + lu_byte instack; /* whether it is in stack (register) */ + lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ +} Upvaldesc; + + +/* +** Description of a local variable for function prototypes +** (used for debug information) +*/ +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + lu_byte numparams; /* number of fixed parameters */ + lu_byte is_vararg; + lu_byte maxstacksize; /* number of registers needed by this function */ + int sizeupvalues; /* size of 'upvalues' */ + int sizek; /* size of 'k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of 'p' */ + int sizelocvars; + int linedefined; /* debug information */ + int lastlinedefined; /* debug information */ + TValue *k; /* constants used by the function */ + Instruction *code; /* opcodes */ + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines (debug information) */ + LocVar *locvars; /* information about local variables (debug information) */ + Upvaldesc *upvalues; /* upvalue information */ + struct LClosure *cache; /* last-created closure with this prototype */ + TString *source; /* used for debug information */ + GCObject *gclist; +} Proto; + + + +/* +** Lua Upvalues +*/ +typedef struct UpVal UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte nupvalues; GCObject *gclist + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; /* list of upvalues */ +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; /* list of upvalues */ +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define isLfunction(o) ttisLclosure(o) + +#define getproto(o) (clLvalue(o)->p) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + int next; /* for chaining (offset for next node) */ + } nk; + TValue tvk; +} TKey; + + +/* copy a value into a key without messing up field 'next' */ +#define setnodekey(L,key,obj) \ + { TKey *k_=(key); const TValue *io_=(obj); \ + k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ + (void)L; checkliveness(L,io_); } + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

lsizenode)) + + +/* +** (address of) a fixed nil value +*/ +#define luaO_nilobject (&luaO_nilobject_) + + +LUAI_DDEC const TValue luaO_nilobject_; + +/* size of buffer for 'luaO_utf8esc' function */ +#define UTF8BUFFSZ 8 + +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); +LUAI_FUNC int luaO_ceillog2 (unsigned int x); +LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, + const TValue *p2, TValue *res); +LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); +LUAI_FUNC int luaO_hexavalue (int c); +LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/deps/rcheevos/test/lua/src/lopcodes.c b/deps/rcheevos/test/lua/src/lopcodes.c new file mode 100644 index 0000000000..a1cbef8573 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lopcodes.c @@ -0,0 +1,124 @@ +/* +** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#define lopcodes_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lopcodes.h" + + +/* ORDER OP */ + +LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADKX", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETTABUP", + "GETTABLE", + "SETTABUP", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "MOD", + "POW", + "DIV", + "IDIV", + "BAND", + "BOR", + "BXOR", + "SHL", + "SHR", + "UNM", + "BNOT", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORCALL", + "TFORLOOP", + "SETLIST", + "CLOSURE", + "VARARG", + "EXTRAARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_IDIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHR */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ + ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ +}; + diff --git a/deps/rcheevos/test/lua/src/lopcodes.h b/deps/rcheevos/test/lua/src/lopcodes.h new file mode 100644 index 0000000000..bbc4b61968 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lopcodes.h @@ -0,0 +1,297 @@ +/* +** $Id: lopcodes.h,v 1.149 2016/07/19 17:12:21 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + 'A' : 8 bits + 'B' : 9 bits + 'C' : 9 bits + 'Ax' : 26 bits ('A', 'B', and 'C' together) + 'Bx' : 18 bits ('B' and 'C' together) + 'sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 +#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C +#define POS_Ax POS_A + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<>1) /* 'sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + +#if SIZE_Ax < LUAI_BITSINT-1 +#define MAXARG_Ax ((1<>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>pos) & MASK1(size,0))) +#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ + ((cast(Instruction, v)<> RK(C) */ +OP_UNM,/* A B R(A) := -R(B) */ +OP_BNOT,/* A B R(A) := ~R(B) */ +OP_NOT,/* A B R(A) := not R(B) */ +OP_LEN,/* A B R(A) := length of R(B) */ + +OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ + +OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */ +OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ +OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ +OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ + +OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) > 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/deps/rcheevos/test/lua/src/loslib.c b/deps/rcheevos/test/lua/src/loslib.c new file mode 100644 index 0000000000..5a94eb9068 --- /dev/null +++ b/deps/rcheevos/test/lua/src/loslib.c @@ -0,0 +1,407 @@ +/* +** $Id: loslib.c,v 1.65 2016/07/18 17:58:58 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + +#define loslib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** {================================================================== +** List of valid conversion specifiers for the 'strftime' function; +** options are grouped by length; group of length 2 start with '||'. +** =================================================================== +*/ +#if !defined(LUA_STRFTIMEOPTIONS) /* { */ + +/* options for ANSI C 89 (only 1-char options) */ +#define L_STRFTIMEC89 "aAbBcdHIjmMpSUwWxXyYZ%" + +/* options for ISO C 99 and POSIX */ +#define L_STRFTIMEC99 "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ + "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */ + +/* options for Windows */ +#define L_STRFTIMEWIN "aAbBcdHIjmMpSUwWxXyYzZ%" \ + "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */ + +#if defined(LUA_USE_WINDOWS) +#define LUA_STRFTIMEOPTIONS L_STRFTIMEWIN +#elif defined(LUA_USE_C89) +#define LUA_STRFTIMEOPTIONS L_STRFTIMEC89 +#else /* C99 specification */ +#define LUA_STRFTIMEOPTIONS L_STRFTIMEC99 +#endif + +#endif /* } */ +/* }================================================================== */ + + +/* +** {================================================================== +** Configuration for time-related stuff +** =================================================================== +*/ + +#if !defined(l_time_t) /* { */ +/* +** type to represent time_t in Lua +*/ +#define l_timet lua_Integer +#define l_pushtime(L,t) lua_pushinteger(L,(lua_Integer)(t)) + +static time_t l_checktime (lua_State *L, int arg) { + lua_Integer t = luaL_checkinteger(L, arg); + luaL_argcheck(L, (time_t)t == t, arg, "time out-of-bounds"); + return (time_t)t; +} + +#endif /* } */ + + +#if !defined(l_gmtime) /* { */ +/* +** By default, Lua uses gmtime/localtime, except when POSIX is available, +** where it uses gmtime_r/localtime_r +*/ + +#if defined(LUA_USE_POSIX) /* { */ + +#define l_gmtime(t,r) gmtime_r(t,r) +#define l_localtime(t,r) localtime_r(t,r) + +#else /* }{ */ + +/* ISO C definitions */ +#define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) +#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) + +#endif /* } */ + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Configuration for 'tmpnam': +** By default, Lua uses tmpnam except when POSIX is available, where +** it uses mkstemp. +** =================================================================== +*/ +#if !defined(lua_tmpnam) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#include + +#define LUA_TMPNAMBUFSIZE 32 + +#if !defined(LUA_TMPNAMTEMPLATE) +#define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX" +#endif + +#define lua_tmpnam(b,e) { \ + strcpy(b, LUA_TMPNAMTEMPLATE); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else /* }{ */ + +/* ISO C definitions */ +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } + +#endif /* } */ + +#endif /* } */ +/* }================================================================== */ + + + + +static int os_execute (lua_State *L) { + const char *cmd = luaL_optstring(L, 1, NULL); + int stat = system(cmd); + if (cmd != NULL) + return luaL_execresult(L, stat); + else { + lua_pushboolean(L, stat); /* true if there is a shell */ + return 1; + } +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return luaL_fileresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return luaL_fileresult(L, rename(fromname, toname) == 0, NULL); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + + +/* +** Set all fields from structure 'tm' in the table on top of the stack +*/ +static void setallfields (lua_State *L, struct tm *stm) { + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon + 1); + setfield(L, "year", stm->tm_year + 1900); + setfield(L, "wday", stm->tm_wday + 1); + setfield(L, "yday", stm->tm_yday + 1); + setboolfield(L, "isdst", stm->tm_isdst); +} + + +static int getboolfield (lua_State *L, const char *key) { + int res; + res = (lua_getfield(L, -1, key) == LUA_TNIL) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +/* maximum value for date fields (to avoid arithmetic overflows with 'int') */ +#if !defined(L_MAXDATEFIELD) +#define L_MAXDATEFIELD (INT_MAX / 2) +#endif + +static int getfield (lua_State *L, const char *key, int d, int delta) { + int isnum; + int t = lua_getfield(L, -1, key); /* get field and its type */ + lua_Integer res = lua_tointegerx(L, -1, &isnum); + if (!isnum) { /* field is not an integer? */ + if (t != LUA_TNIL) /* some other value? */ + return luaL_error(L, "field '%s' is not an integer", key); + else if (d < 0) /* absent field; no default? */ + return luaL_error(L, "field '%s' missing in date table", key); + res = d; + } + else { + if (!(-L_MAXDATEFIELD <= res && res <= L_MAXDATEFIELD)) + return luaL_error(L, "field '%s' is out-of-bound", key); + res -= delta; + } + lua_pop(L, 1); + return (int)res; +} + + +static const char *checkoption (lua_State *L, const char *conv, + ptrdiff_t convlen, char *buff) { + const char *option = LUA_STRFTIMEOPTIONS; + int oplen = 1; /* length of options being checked */ + for (; *option != '\0' && oplen <= convlen; option += oplen) { + if (*option == '|') /* next block? */ + oplen++; /* will check options with next length (+1) */ + else if (memcmp(conv, option, oplen) == 0) { /* match? */ + memcpy(buff, conv, oplen); /* copy valid option to buffer */ + buff[oplen] = '\0'; + return conv + oplen; /* return next item */ + } + } + luaL_argerror(L, 1, + lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv)); + return conv; /* to avoid warnings */ +} + + +/* maximum size for an individual 'strftime' item */ +#define SIZETIMEFMT 250 + + +static int os_date (lua_State *L) { + size_t slen; + const char *s = luaL_optlstring(L, 1, "%c", &slen); + time_t t = luaL_opt(L, l_checktime, 2, time(NULL)); + const char *se = s + slen; /* 's' end */ + struct tm tmr, *stm; + if (*s == '!') { /* UTC? */ + stm = l_gmtime(&t, &tmr); + s++; /* skip '!' */ + } + else + stm = l_localtime(&t, &tmr); + if (stm == NULL) /* invalid date? */ + luaL_error(L, "time result cannot be represented in this installation"); + if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setallfields(L, stm); + } + else { + char cc[4]; /* buffer for individual conversion specifiers */ + luaL_Buffer b; + cc[0] = '%'; + luaL_buffinit(L, &b); + while (s < se) { + if (*s != '%') /* not a conversion specifier? */ + luaL_addchar(&b, *s++); + else { + size_t reslen; + char *buff = luaL_prepbuffsize(&b, SIZETIMEFMT); + s++; /* skip '%' */ + s = checkoption(L, s, se - s, cc + 1); /* copy specifier to 'cc' */ + reslen = strftime(buff, SIZETIMEFMT, cc, stm); + luaL_addsize(&b, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0, 0); + ts.tm_min = getfield(L, "min", 0, 0); + ts.tm_hour = getfield(L, "hour", 12, 0); + ts.tm_mday = getfield(L, "day", -1, 0); + ts.tm_mon = getfield(L, "month", -1, 1); + ts.tm_year = getfield(L, "year", -1, 1900); + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + setallfields(L, &ts); /* update fields with normalized values */ + } + if (t != (time_t)(l_timet)t || t == (time_t)(-1)) + luaL_error(L, "time result cannot be represented in this installation"); + l_pushtime(L, t); + return 1; +} + + +static int os_difftime (lua_State *L) { + time_t t1 = l_checktime(L, 1); + time_t t2 = l_checktime(L, 2); + lua_pushnumber(L, (lua_Number)difftime(t1, t2)); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + int status; + if (lua_isboolean(L, 1)) + status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE); + else + status = (int)luaL_optinteger(L, 1, EXIT_SUCCESS); + if (lua_toboolean(L, 2)) + lua_close(L); + if (L) exit(status); /* 'if' to avoid warnings for unreachable 'return' */ + return 0; +} + + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUAMOD_API int luaopen_os (lua_State *L) { + luaL_newlib(L, syslib); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/lparser.c b/deps/rcheevos/test/lua/src/lparser.c new file mode 100644 index 0000000000..cd4512d4d4 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lparser.c @@ -0,0 +1,1650 @@ +/* +** $Id: lparser.c,v 2.155 2016/08/01 19:51:24 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#define lparser_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +/* maximum number of local variables per function (must be smaller + than 250, due to the bytecode format) */ +#define MAXVARS 200 + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + + +/* because all strings are unified by the scanner, the parser + can use pointer equality for string equality */ +#define eqstr(a,b) ((a) == (b)) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int firstlabel; /* index of first label in this block */ + int firstgoto; /* index of first pending goto in this block */ + lu_byte nactvar; /* # active locals outside the block */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isloop; /* true if 'block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void statement (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +/* semantic error */ +static l_noret semerror (LexState *ls, const char *msg) { + ls->t.token = 0; /* remove "near " from final message */ + luaX_syntaxerror(ls, msg); +} + + +static l_noret error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); +} + + +static l_noret errorlimit (FuncState *fs, int limit, const char *what) { + lua_State *L = fs->ls->L; + const char *msg; + int line = fs->f->linedefined; + const char *where = (line == 0) + ? "main function" + : luaO_pushfstring(L, "function at line %d", line); + msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s", + what, limit, where); + luaX_syntaxerror(fs->ls, msg); +} + + +static void checklimit (FuncState *fs, int v, int l, const char *what) { + if (v > l) errorlimit(fs, l, what); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + "%s expected (to close %s at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname (LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "local variables"); + while (oldsize < f->sizelocvars) + f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +static void new_localvar (LexState *ls, TString *name) { + FuncState *fs = ls->fs; + Dyndata *dyd = ls->dyd; + int reg = registerlocalvar(ls, name); + checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, + MAXVARS, "local variables"); + luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1, + dyd->actvar.size, Vardesc, MAX_INT, "local variables"); + dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg); +} + + +static void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) { + new_localvar(ls, luaX_newstring(ls, name, sz)); +} + +#define new_localvarliteral(ls,v) \ + new_localvarliteral_(ls, "" v, (sizeof(v)/sizeof(char))-1) + + +static LocVar *getlocvar (FuncState *fs, int i) { + int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx; + lua_assert(idx < fs->nlocvars); + return &fs->f->locvars[idx]; +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc; + } +} + + +static void removevars (FuncState *fs, int tolevel) { + fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel); + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar)->endpc = fs->pc; +} + + +static int searchupvalue (FuncState *fs, TString *name) { + int i; + Upvaldesc *up = fs->f->upvalues; + for (i = 0; i < fs->nups; i++) { + if (eqstr(up[i].name, name)) return i; + } + return -1; /* not found */ +} + + +static int newupvalue (FuncState *fs, TString *name, expdesc *v) { + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); + luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, + Upvaldesc, MAXUPVAL, "upvalues"); + while (oldsize < f->sizeupvalues) + f->upvalues[oldsize++].name = NULL; + f->upvalues[fs->nups].instack = (v->k == VLOCAL); + f->upvalues[fs->nups].idx = cast_byte(v->u.info); + f->upvalues[fs->nups].name = name; + luaC_objbarrier(fs->ls->L, f, name); + return fs->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) { + if (eqstr(n, getlocvar(fs, i)->varname)) + return i; + } + return -1; /* not found */ +} + + +/* + Mark block where variable at given level was defined + (to emit close instructions later). +*/ +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl->nactvar > level) + bl = bl->previous; + bl->upval = 1; +} + + +/* + Find variable with given name 'n'. If it is an upvalue, add this + upvalue into all intermediate functions. +*/ +static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) /* no more levels? */ + init_exp(var, VVOID, 0); /* default is global */ + else { + int v = searchvar(fs, n); /* look up locals at current level */ + if (v >= 0) { /* found? */ + init_exp(var, VLOCAL, v); /* variable is local */ + if (!base) + markupval(fs, v); /* local will be used as an upval */ + } + else { /* not found as local at current level; try upvalues */ + int idx = searchupvalue(fs, n); /* try existing upvalues */ + if (idx < 0) { /* not found? */ + singlevaraux(fs->prev, n, var, 0); /* try upper levels */ + if (var->k == VVOID) /* not found? */ + return; /* it is a global */ + /* else was LOCAL or UPVAL */ + idx = newupvalue(fs, n, var); /* will be a new upvalue */ + } + init_exp(var, VUPVAL, idx); /* new or old upvalue */ + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + singlevaraux(fs, varname, var, 1); + if (var->k == VVOID) { /* global name? */ + expdesc key; + singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ + lua_assert(var->k != VVOID); /* this one must exist */ + codestring(ls, &key, varname); /* key is variable name */ + luaK_indexed(fs, var, &key); /* env[varname] */ + } +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ +} + + +static void enterlevel (LexState *ls) { + lua_State *L = ls->L; + ++L->nCcalls; + checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels"); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void closegoto (LexState *ls, int g, Labeldesc *label) { + int i; + FuncState *fs = ls->fs; + Labellist *gl = &ls->dyd->gt; + Labeldesc *gt = &gl->arr[g]; + lua_assert(eqstr(gt->name, label->name)); + if (gt->nactvar < label->nactvar) { + TString *vname = getlocvar(fs, gt->nactvar)->varname; + const char *msg = luaO_pushfstring(ls->L, + " at line %d jumps into the scope of local '%s'", + getstr(gt->name), gt->line, getstr(vname)); + semerror(ls, msg); + } + luaK_patchlist(fs, gt->pc, label->pc); + /* remove goto from pending list */ + for (i = g; i < gl->n - 1; i++) + gl->arr[i] = gl->arr[i + 1]; + gl->n--; +} + + +/* +** try to close a goto with existing labels; this solves backward jumps +*/ +static int findlabel (LexState *ls, int g) { + int i; + BlockCnt *bl = ls->fs->bl; + Dyndata *dyd = ls->dyd; + Labeldesc *gt = &dyd->gt.arr[g]; + /* check labels in current block for a match */ + for (i = bl->firstlabel; i < dyd->label.n; i++) { + Labeldesc *lb = &dyd->label.arr[i]; + if (eqstr(lb->name, gt->name)) { /* correct label? */ + if (gt->nactvar > lb->nactvar && + (bl->upval || dyd->label.n > bl->firstlabel)) + luaK_patchclose(ls->fs, gt->pc, lb->nactvar); + closegoto(ls, g, lb); /* close it */ + return 1; + } + } + return 0; /* label not found; cannot close goto */ +} + + +static int newlabelentry (LexState *ls, Labellist *l, TString *name, + int line, int pc) { + int n = l->n; + luaM_growvector(ls->L, l->arr, n, l->size, + Labeldesc, SHRT_MAX, "labels/gotos"); + l->arr[n].name = name; + l->arr[n].line = line; + l->arr[n].nactvar = ls->fs->nactvar; + l->arr[n].pc = pc; + l->n = n + 1; + return n; +} + + +/* +** check whether new label 'lb' matches any pending gotos in current +** block; solves forward jumps +*/ +static void findgotos (LexState *ls, Labeldesc *lb) { + Labellist *gl = &ls->dyd->gt; + int i = ls->fs->bl->firstgoto; + while (i < gl->n) { + if (eqstr(gl->arr[i].name, lb->name)) + closegoto(ls, i, lb); + else + i++; + } +} + + +/* +** export pending gotos to outer level, to check them against +** outer labels; if the block being exited has upvalues, and +** the goto exits the scope of any variable (which can be the +** upvalue), close those variables being exited. +*/ +static void movegotosout (FuncState *fs, BlockCnt *bl) { + int i = bl->firstgoto; + Labellist *gl = &fs->ls->dyd->gt; + /* correct pending gotos to current block and try to close it + with visible labels */ + while (i < gl->n) { + Labeldesc *gt = &gl->arr[i]; + if (gt->nactvar > bl->nactvar) { + if (bl->upval) + luaK_patchclose(fs, gt->pc, bl->nactvar); + gt->nactvar = bl->nactvar; + } + if (!findlabel(fs->ls, i)) + i++; /* move to next one */ + } +} + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { + bl->isloop = isloop; + bl->nactvar = fs->nactvar; + bl->firstlabel = fs->ls->dyd->label.n; + bl->firstgoto = fs->ls->dyd->gt.n; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +/* +** create a label named 'break' to resolve break statements +*/ +static void breaklabel (LexState *ls) { + TString *n = luaS_new(ls->L, "break"); + int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc); + findgotos(ls, &ls->dyd->label.arr[l]); +} + +/* +** generates an error for an undefined 'goto'; choose appropriate +** message when label name is a reserved word (which can only be 'break') +*/ +static l_noret undefgoto (LexState *ls, Labeldesc *gt) { + const char *msg = isreserved(gt->name) + ? "<%s> at line %d not inside a loop" + : "no visible label '%s' for at line %d"; + msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); + semerror(ls, msg); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + LexState *ls = fs->ls; + if (bl->previous && bl->upval) { + /* create a 'jump to here' to close upvalues */ + int j = luaK_jump(fs); + luaK_patchclose(fs, j, bl->nactvar); + luaK_patchtohere(fs, j); + } + if (bl->isloop) + breaklabel(ls); /* close pending breaks */ + fs->bl = bl->previous; + removevars(fs, bl->nactvar); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + ls->dyd->label.n = bl->firstlabel; /* remove local labels */ + if (bl->previous) /* inner block? */ + movegotosout(fs, bl); /* update pending gotos to outer block */ + else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */ + undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */ +} + + +/* +** adds a new prototype into list of prototypes +*/ +static Proto *addprototype (LexState *ls) { + Proto *clp; + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; /* prototype of current function */ + if (fs->np >= f->sizep) { + int oldsize = f->sizep; + luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); + while (oldsize < f->sizep) + f->p[oldsize++] = NULL; + } + f->p[fs->np++] = clp = luaF_newproto(L); + luaC_objbarrier(L, f, clp); + return clp; +} + + +/* +** codes instruction to create new closure in parent function. +** The OP_CLOSURE instruction must use the last available register, +** so that, if it invokes the GC, the GC knows which registers +** are in use at that time. +*/ +static void codeclosure (LexState *ls, expdesc *v) { + FuncState *fs = ls->fs->prev; + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); + luaK_exp2nextreg(fs, v); /* fix it at the last register */ +} + + +static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { + Proto *f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = 0; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nups = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->firstlocal = ls->dyd->actvar.n; + fs->bl = NULL; + f = fs->f; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + enterblock(fs, bl, 0); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + luaK_ret(fs, 0, 0); /* final return */ + leaveblock(fs); + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc); + f->sizeupvalues = fs->nups; + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + luaC_checkGC(L); +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +/* +** check whether current token is in the follow set of a block. +** 'until' closes syntactical blocks, but do not close scope, +** so it is handled in separate. +*/ +static int block_follow (LexState *ls, int withuntil) { + switch (ls->t.token) { + case TK_ELSE: case TK_ELSEIF: + case TK_END: case TK_EOS: + return 1; + case TK_UNTIL: return withuntil; + default: return 0; + } +} + + +static void statlist (LexState *ls) { + /* statlist -> { stat [';'] } */ + while (!block_follow(ls, 1)) { + if (ls->t.token == TK_RETURN) { + statement(ls); + return; /* 'return' must be last statement */ + } + statement(ls); + } +} + + +static void fieldsel (LexState *ls, expdesc *v) { + /* fieldsel -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyregup(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of 'record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | '['exp1']') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + /* listfield -> exp */ + expr(ls, &cc->v); + checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void field (LexState *ls, struct ConsControl *cc) { + /* field -> listfield | recfield */ + switch(ls->t.token) { + case TK_NAME: { /* may be 'listfield' or 'recfield' */ + if (luaX_lookahead(ls) != '=') /* expression? */ + listfield(ls, cc); + else + recfield(ls, cc); + break; + } + case '[': { + recfield(ls, cc); + break; + } + default: { + listfield(ls, cc); + break; + } + } +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> '{' [ field { sep field } [sep] ] '}' + sep -> ',' | ';' */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + field(ls, &cc); + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { ',' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is 'parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls)); + nparams++; + break; + } + case TK_DOTS: { /* param -> '...' */ + luaX_next(ls); + f->is_vararg = 1; /* declared vararg */ + break; + } + default: luaX_syntaxerror(ls, " or '...' expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int ismethod, int line) { + /* body -> '(' parlist ')' block END */ + FuncState new_fs; + BlockCnt bl; + new_fs.f = addprototype(ls); + new_fs.f->linedefined = line; + open_func(ls, &new_fs, &bl); + checknext(ls, '('); + if (ismethod) { + new_localvarliteral(ls, "self"); /* create 'self' parameter */ + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + statlist(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + codeclosure(ls, e); + close_func(ls); +} + + +static int explist (LexState *ls, expdesc *v) { + /* explist -> expr { ',' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f, int line) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + switch (ls->t.token) { + case '(': { /* funcargs -> '(' [ explist ] ')' */ + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use 'seminfo' before 'next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + } + } +} + + +static void suffixedexp (LexState *ls, expdesc *v) { + /* suffixedexp -> + primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + primaryexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* fieldsel */ + fieldsel(ls, v); + break; + } + case '[': { /* '[' exp1 ']' */ + expdesc key; + luaK_exp2anyregup(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* ':' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v, line); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v, line); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | + constructor | FUNCTION body | suffixedexp */ + switch (ls->t.token) { + case TK_FLT: { + init_exp(v, VKFLT, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_INT: { + init_exp(v, VKINT, 0); + v->u.ival = ls->t.seminfo.i; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use '...' outside a vararg function"); + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + suffixedexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '~': return OPR_BNOT; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case '/': return OPR_DIV; + case TK_IDIV: return OPR_IDIV; + case '&': return OPR_BAND; + case '|': return OPR_BOR; + case '~': return OPR_BXOR; + case TK_SHL: return OPR_SHL; + case TK_SHR: return OPR_SHR; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {10, 10}, {10, 10}, /* '+' '-' */ + {11, 11}, {11, 11}, /* '*' '%' */ + {14, 13}, /* '^' (right associative) */ + {11, 11}, {11, 11}, /* '/' '//' */ + {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */ + {7, 7}, {7, 7}, /* '<<' '>>' */ + {9, 8}, /* '..' (right associative) */ + {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ + {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ + {2, 2}, {1, 1} /* and, or */ +}; + +#define UNARY_PRIORITY 12 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where 'binop' is any binary operator with a priority higher than 'limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + int line = ls->linenumber; + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v, line); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than 'limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + int line = ls->linenumber; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2, line); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static void block (LexState *ls) { + /* block -> statlist */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + statlist(ls); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to an upvalue/local variable, the +** upvalue/local variable is begin used in a previous assignment to a +** table. If so, save original upvalue/local value in a safe place and +** use this safe copy in the previous assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { /* check all previous assignments */ + if (lh->v.k == VINDEXED) { /* assigning to a table? */ + /* table is the upvalue/local being assigned now? */ + if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) { + conflict = 1; + lh->v.u.ind.vt = VLOCAL; + lh->v.u.ind.t = extra; /* previous assignment will use safe copy */ + } + /* index is the local being assigned? (index cannot be upvalue) */ + if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { + conflict = 1; + lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + /* copy upvalue/local value to a temporary (in position 'extra') */ + OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, op, extra, v->u.info, 0); + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, vkisvar(lh->v.k), "syntax error"); + if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + suffixedexp(ls, &nv.v); + if (nv.v.k != VINDEXED) + check_conflict(ls, lh, &nv.v); + checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS, + "C levels"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> '=' explist */ + int nexps; + checknext(ls, '='); + nexps = explist(ls, &e); + if (nexps != nvars) + adjust_assign(ls, nvars, nexps, &e); + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void gotostat (LexState *ls, int pc) { + int line = ls->linenumber; + TString *label; + int g; + if (testnext(ls, TK_GOTO)) + label = str_checkname(ls); + else { + luaX_next(ls); /* skip break */ + label = luaS_new(ls->L, "break"); + } + g = newlabelentry(ls, &ls->dyd->gt, label, line, pc); + findlabel(ls, g); /* close it if label already defined */ +} + + +/* check for repeated labels on the same block */ +static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) { + int i; + for (i = fs->bl->firstlabel; i < ll->n; i++) { + if (eqstr(label, ll->arr[i].name)) { + const char *msg = luaO_pushfstring(fs->ls->L, + "label '%s' already defined on line %d", + getstr(label), ll->arr[i].line); + semerror(fs->ls, msg); + } + } +} + + +/* skip no-op statements */ +static void skipnoopstat (LexState *ls) { + while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) + statement(ls); +} + + +static void labelstat (LexState *ls, TString *label, int line) { + /* label -> '::' NAME '::' */ + FuncState *fs = ls->fs; + Labellist *ll = &ls->dyd->label; + int l; /* index of new label being created */ + checkrepeated(fs, ll, label); /* check for repeated labels */ + checknext(ls, TK_DBCOLON); /* skip double colon */ + /* create new entry for this label */ + l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); + skipnoopstat(ls); /* skip other no-op statements */ + if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ + /* assume that locals are already out of scope */ + ll->arr[l].nactvar = fs->bl->nactvar; + } + findgotos(ls, &ll->arr[l]); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_jumpto(fs, whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + statlist(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (bl2.upval) /* upvalues? */ + luaK_patchclose(fs, condexit, bl2.nactvar); + leaveblock(fs); /* finish scope */ + luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int reg; + expr(ls, &e); + luaK_exp2nextreg(ls->fs, &e); + lua_assert(e.k == VNONRELOC); + reg = e.u.info; + return reg; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + if (isnum) /* numeric for? */ + endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP); + else { /* generic for */ + luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars); + luaK_fixline(fs, line); + endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP); + } + luaK_patchlist(fs, endfor, prep + 1); + luaK_fixline(fs, line); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)"); + new_localvarliteral(ls, "(for limit)"); + new_localvarliteral(ls, "(for step)"); + new_localvar(ls, varname); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codek(fs, fs->freereg, luaK_intK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 4; /* gen, state, control, plus at least one declared var */ + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)"); + new_localvarliteral(ls, "(for state)"); + new_localvarliteral(ls, "(for control)"); + /* create declared variables */ + new_localvar(ls, indexname); + while (testnext(ls, ',')) { + new_localvar(ls, str_checkname(ls)); + nvars++; + } + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip 'for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, "'=' or 'in' expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope ('break' jumps to this point) */ +} + + +static void test_then_block (LexState *ls, int *escapelist) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + BlockCnt bl; + FuncState *fs = ls->fs; + expdesc v; + int jf; /* instruction to skip 'then' code (if condition is false) */ + luaX_next(ls); /* skip IF or ELSEIF */ + expr(ls, &v); /* read condition */ + checknext(ls, TK_THEN); + if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) { + luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */ + enterblock(fs, &bl, 0); /* must enter block before 'goto' */ + gotostat(ls, v.t); /* handle goto/break */ + skipnoopstat(ls); /* skip other no-op statements */ + if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ + leaveblock(fs); + return; /* and that is it */ + } + else /* must skip over 'then' part if condition is false */ + jf = luaK_jump(fs); + } + else { /* regular case (not goto/break) */ + luaK_goiftrue(ls->fs, &v); /* skip over block if condition is false */ + enterblock(fs, &bl, 0); + jf = v.f; + } + statlist(ls); /* 'then' part */ + leaveblock(fs); + if (ls->t.token == TK_ELSE || + ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ + luaK_concat(fs, escapelist, luaK_jump(fs)); /* must jump over it */ + luaK_patchtohere(fs, jf); +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int escapelist = NO_JUMP; /* exit list for finished parts */ + test_then_block(ls, &escapelist); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) + test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ + if (testnext(ls, TK_ELSE)) + block(ls); /* 'else' part */ + check_match(ls, TK_END, TK_IF, line); + luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ +} + + +static void localfunc (LexState *ls) { + expdesc b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls)); /* new local variable */ + adjustlocalvars(ls, 1); /* enter its scope */ + body(ls, &b, 0, ls->linenumber); /* function created in next register */ + /* debug information will only see the variable after this point! */ + getlocvar(fs, b.u.info)->startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {',' NAME} ['=' explist] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls)); + nvars++; + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {fieldsel} [':' NAME] */ + int ismethod = 0; + singlevar(ls, v); + while (ls->t.token == '.') + fieldsel(ls, v); + if (ls->t.token == ':') { + ismethod = 1; + fieldsel(ls, v); + } + return ismethod; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int ismethod; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + ismethod = funcname(ls, &v); + body(ls, &b, ismethod, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + suffixedexp(ls, &v.v); + if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */ + v.prev = NULL; + assignment(ls, &v, 1); + } + else { /* stat -> func */ + check_condition(ls, v.v.k == VCALL, "syntax error"); + SETARG_C(getinstruction(fs, &v.v), 1); /* call statement uses no results */ + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN [explist] [';'] */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + if (block_follow(ls, 1) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getinstruction(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getinstruction(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the stack */ + first = fs->nactvar; /* return all active values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); + testnext(ls, ';'); /* skip optional semicolon */ +} + + +static void statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + enterlevel(ls); + switch (ls->t.token) { + case ';': { /* stat -> ';' (empty statement) */ + luaX_next(ls); /* skip ';' */ + break; + } + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + break; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + break; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + break; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + break; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + break; + } + case TK_FUNCTION: { /* stat -> funcstat */ + funcstat(ls, line); + break; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + break; + } + case TK_DBCOLON: { /* stat -> label */ + luaX_next(ls); /* skip double colon */ + labelstat(ls, str_checkname(ls), line); + break; + } + case TK_RETURN: { /* stat -> retstat */ + luaX_next(ls); /* skip RETURN */ + retstat(ls); + break; + } + case TK_BREAK: /* stat -> breakstat */ + case TK_GOTO: { /* stat -> 'goto' NAME */ + gotostat(ls, luaK_jump(ls->fs)); + break; + } + default: { /* stat -> func | assignment */ + exprstat(ls); + break; + } + } + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + leavelevel(ls); +} + +/* }====================================================================== */ + + +/* +** compiles the main function, which is a regular vararg function with an +** upvalue named LUA_ENV +*/ +static void mainfunc (LexState *ls, FuncState *fs) { + BlockCnt bl; + expdesc v; + open_func(ls, fs, &bl); + fs->f->is_vararg = 1; /* main function is always declared vararg */ + init_exp(&v, VLOCAL, 0); /* create and... */ + newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ + luaX_next(ls); /* read first token */ + statlist(ls); /* parse main body */ + check(ls, TK_EOS); + close_func(ls); +} + + +LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + Dyndata *dyd, const char *name, int firstchar) { + LexState lexstate; + FuncState funcstate; + LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ + setclLvalue(L, L->top, cl); /* anchor it (to avoid being collected) */ + luaD_inctop(L); + lexstate.h = luaH_new(L); /* create table for scanner */ + sethvalue(L, L->top, lexstate.h); /* anchor it */ + luaD_inctop(L); + funcstate.f = cl->p = luaF_newproto(L); + funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ + lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ + lexstate.buff = buff; + lexstate.dyd = dyd; + dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; + luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar); + mainfunc(&lexstate, &funcstate); + lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); + /* all scopes should be correctly finished */ + lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); + L->top--; /* remove scanner's table */ + return cl; /* closure is on the stack, too */ +} + diff --git a/deps/rcheevos/test/lua/src/lparser.h b/deps/rcheevos/test/lua/src/lparser.h new file mode 100644 index 0000000000..02e9b03aeb --- /dev/null +++ b/deps/rcheevos/test/lua/src/lparser.h @@ -0,0 +1,133 @@ +/* +** $Id: lparser.h,v 1.76 2015/12/30 18:16:13 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression and variable descriptor. +** Code generation for variables and expressions can be delayed to allow +** optimizations; An 'expdesc' structure describes a potentially-delayed +** variable/expression. It has a description of its "main" value plus a +** list of conditional jumps that can also produce its value (generated +** by short-circuit operators 'and'/'or'). +*/ + +/* kinds of variables/expressions */ +typedef enum { + VVOID, /* when 'expdesc' describes the last expression a list, + this kind means an empty list (so, no expression) */ + VNIL, /* constant nil */ + VTRUE, /* constant true */ + VFALSE, /* constant false */ + VK, /* constant in 'k'; info = index of constant in 'k' */ + VKFLT, /* floating constant; nval = numerical float value */ + VKINT, /* integer constant; nval = numerical integer value */ + VNONRELOC, /* expression has its value in a fixed register; + info = result register */ + VLOCAL, /* local variable; info = local register */ + VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ + VINDEXED, /* indexed variable; + ind.vt = whether 't' is register or upvalue; + ind.t = table register or upvalue; + ind.idx = key's R/K index */ + VJMP, /* expression is a test/comparison; + info = pc of corresponding jump instruction */ + VRELOCABLE, /* expression can put result in any register; + info = instruction pc */ + VCALL, /* expression is a function call; info = instruction pc */ + VVARARG /* vararg expression; info = instruction pc */ +} expkind; + + +#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) +#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) + +typedef struct expdesc { + expkind k; + union { + lua_Integer ival; /* for VKINT */ + lua_Number nval; /* for VKFLT */ + int info; /* for generic use */ + struct { /* for indexed variables (VINDEXED) */ + short idx; /* index (R/K) */ + lu_byte t; /* table (register or upvalue) */ + lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ + } ind; + } u; + int t; /* patch list of 'exit when true' */ + int f; /* patch list of 'exit when false' */ +} expdesc; + + +/* description of active local variable */ +typedef struct Vardesc { + short idx; /* variable index in stack */ +} Vardesc; + + +/* description of pending goto statements and label statements */ +typedef struct Labeldesc { + TString *name; /* label identifier */ + int pc; /* position in code */ + int line; /* line where it appeared */ + lu_byte nactvar; /* local level where it appears in current block */ +} Labeldesc; + + +/* list of labels or gotos */ +typedef struct Labellist { + Labeldesc *arr; /* array */ + int n; /* number of entries in use */ + int size; /* array size */ +} Labellist; + + +/* dynamic structures used by the parser */ +typedef struct Dyndata { + struct { /* list of active local variables */ + Vardesc *arr; + int n; + int size; + } actvar; + Labellist gt; /* list of pending gotos */ + Labellist label; /* list of active labels */ +} Dyndata; + + +/* control of blocks */ +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to 'ncode') */ + int lasttarget; /* 'label' of last 'jump label' */ + int jpc; /* list of pending jumps to 'pc' */ + int nk; /* number of elements in 'k' */ + int np; /* number of elements in 'p' */ + int firstlocal; /* index of first local var (in Dyndata array) */ + short nlocvars; /* number of elements in 'f->locvars' */ + lu_byte nactvar; /* number of active local variables */ + lu_byte nups; /* number of upvalues */ + lu_byte freereg; /* first free register */ +} FuncState; + + +LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + Dyndata *dyd, const char *name, int firstchar); + + +#endif diff --git a/deps/rcheevos/test/lua/src/lprefix.h b/deps/rcheevos/test/lua/src/lprefix.h new file mode 100644 index 0000000000..02daa837f5 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lprefix.h @@ -0,0 +1,45 @@ +/* +** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ +** Definitions for Lua code that must come before any other header file +** See Copyright Notice in lua.h +*/ + +#ifndef lprefix_h +#define lprefix_h + + +/* +** Allows POSIX/XSI stuff +*/ +#if !defined(LUA_USE_C89) /* { */ + +#if !defined(_XOPEN_SOURCE) +#define _XOPEN_SOURCE 600 +#elif _XOPEN_SOURCE == 0 +#undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ +#endif + +/* +** Allows manipulation of large files in gcc and some other compilers +*/ +#if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) +#define _LARGEFILE_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#endif + +#endif /* } */ + + +/* +** Windows stuff +*/ +#if defined(_WIN32) /* { */ + +#if !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ +#endif + +#endif /* } */ + +#endif + diff --git a/deps/rcheevos/test/lua/src/lstate.c b/deps/rcheevos/test/lua/src/lstate.c new file mode 100644 index 0000000000..9e4c8f0616 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lstate.c @@ -0,0 +1,347 @@ +/* +** $Id: lstate.c,v 2.133 2015/11/13 12:16:51 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#define lstate_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#if !defined(LUAI_GCPAUSE) +#define LUAI_GCPAUSE 200 /* 200% */ +#endif + +#if !defined(LUAI_GCMUL) +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ +#endif + + +/* +** a macro to help the creation of a unique random seed when a state is +** created; the seed is used to randomize hashes. +*/ +#if !defined(luai_makeseed) +#include +#define luai_makeseed() cast(unsigned int, time(NULL)) +#endif + + + +/* +** thread state + extra space +*/ +typedef struct LX { + lu_byte extrc_[LUA_EXTRASPACE]; + lua_State l; +} LX; + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + LX l; + global_State g; +} LG; + + + +#define fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) + + +/* +** Compute an initial seed as random as possible. Rely on Address Space +** Layout Randomization (if present) to increase randomness.. +*/ +#define addbuff(b,p,e) \ + { size_t t = cast(size_t, e); \ + memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } + +static unsigned int makeseed (lua_State *L) { + char buff[4 * sizeof(size_t)]; + unsigned int h = luai_makeseed(); + int p = 0; + addbuff(buff, p, L); /* heap variable */ + addbuff(buff, p, &h); /* local variable */ + addbuff(buff, p, luaO_nilobject); /* global variable */ + addbuff(buff, p, &lua_newstate); /* public function */ + lua_assert(p == sizeof(buff)); + return luaS_hash(buff, p, h); +} + + +/* +** set GCdebt to a new value keeping the value (totalbytes + GCdebt) +** invariant (and avoiding underflows in 'totalbytes') +*/ +void luaE_setdebt (global_State *g, l_mem debt) { + l_mem tb = gettotalbytes(g); + lua_assert(tb > 0); + if (debt < tb - MAX_LMEM) + debt = tb - MAX_LMEM; /* will make 'totalbytes == MAX_LMEM' */ + g->totalbytes = tb - debt; + g->GCdebt = debt; +} + + +CallInfo *luaE_extendCI (lua_State *L) { + CallInfo *ci = luaM_new(L, CallInfo); + lua_assert(L->ci->next == NULL); + L->ci->next = ci; + ci->previous = L->ci; + ci->next = NULL; + L->nci++; + return ci; +} + + +/* +** free all CallInfo structures not in use by a thread +*/ +void luaE_freeCI (lua_State *L) { + CallInfo *ci = L->ci; + CallInfo *next = ci->next; + ci->next = NULL; + while ((ci = next) != NULL) { + next = ci->next; + luaM_free(L, ci); + L->nci--; + } +} + + +/* +** free half of the CallInfo structures not in use by a thread +*/ +void luaE_shrinkCI (lua_State *L) { + CallInfo *ci = L->ci; + CallInfo *next2; /* next's next */ + /* while there are two nexts */ + while (ci->next != NULL && (next2 = ci->next->next) != NULL) { + luaM_free(L, ci->next); /* free next */ + L->nci--; + ci->next = next2; /* remove 'next' from the list */ + next2->previous = ci; + ci = next2; /* keep next's next */ + } +} + + +static void stack_init (lua_State *L1, lua_State *L) { + int i; CallInfo *ci; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue); + L1->stacksize = BASIC_STACK_SIZE; + for (i = 0; i < BASIC_STACK_SIZE; i++) + setnilvalue(L1->stack + i); /* erase new stack */ + L1->top = L1->stack; + L1->stack_last = L1->stack + L1->stacksize - EXTRC_STACK; + /* initialize first ci */ + ci = &L1->base_ci; + ci->next = ci->previous = NULL; + ci->callstatus = 0; + ci->func = L1->top; + setnilvalue(L1->top++); /* 'function' entry for this 'ci' */ + ci->top = L1->top + LUA_MINSTACK; + L1->ci = ci; +} + + +static void freestack (lua_State *L) { + if (L->stack == NULL) + return; /* stack not completely built yet */ + L->ci = &L->base_ci; /* free the entire 'ci' list */ + luaE_freeCI(L); + lua_assert(L->nci == 0); + luaM_freearray(L, L->stack, L->stacksize); /* free stack array */ +} + + +/* +** Create registry table and its predefined values +*/ +static void init_registry (lua_State *L, global_State *g) { + TValue temp; + /* create registry */ + Table *registry = luaH_new(L); + sethvalue(L, &g->l_registry, registry); + luaH_resize(L, registry, LUA_RIDX_LAST, 0); + /* registry[LUA_RIDX_MAINTHREAD] = L */ + setthvalue(L, &temp, L); /* temp = L */ + luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); + /* registry[LUA_RIDX_GLOBALS] = table of globals */ + sethvalue(L, &temp, luaH_new(L)); /* temp = new table (global table) */ + luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp); +} + + +/* +** open parts of the state that may cause memory-allocation errors. +** ('g->version' != NULL flags that the state was completely build) +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + init_registry(L, g); + luaS_init(L); + luaT_init(L); + luaX_init(L); + g->gcrunning = 1; /* allow gc */ + g->version = lua_version(NULL); + luai_userstateopen(L); +} + + +/* +** preinitialize a thread with consistent values without allocating +** any memory (to avoid errors) +*/ +static void preinit_thread (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->ci = NULL; + L->nci = 0; + L->stacksize = 0; + L->twups = L; /* thread has no upvalues */ + L->errorJmp = NULL; + L->nCcalls = 0; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->nny = 1; + L->status = LUA_OK; + L->errfunc = 0; +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeallobjects(L); /* collect all objects */ + if (g->version) /* closing a fully built state? */ + luai_userstateclose(L); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); + freestack(L); + lua_assert(gettotalbytes(g) == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + global_State *g = G(L); + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + /* create new thread */ + L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; + L1->marked = luaC_white(g); + L1->tt = LUA_TTHREAD; + /* link it on list 'allgc' */ + L1->next = g->allgc; + g->allgc = obj2gco(L1); + /* anchor it on L stack */ + setthvalue(L, L->top, L1); + api_incr_top(L); + preinit_thread(L1, g); + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + /* initialize L1 extra space */ + memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread), + LUA_EXTRASPACE); + luai_userstatethread(L, L1); + stack_init(L1, L); /* init stack */ + lua_unlock(L); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + LX *l = fromstate(L1); + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L, L1); + freestack(L1); + luaM_free(L, l); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG))); + if (l == NULL) return NULL; + L = &l->l.l; + g = &l->g; + L->next = NULL; + L->tt = LUA_TTHREAD; + g->currentwhite = bitmask(WHITE0BIT); + L->marked = luaC_white(g); + preinit_thread(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->seed = makeseed(L); + g->gcrunning = 0; /* no GC while building state */ + g->GCestimate = 0; + g->strt.size = g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(&g->l_registry); + g->panic = NULL; + g->version = NULL; + g->gcstate = GCSpause; + g->gckind = KGC_NORMAL; + g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; + g->sweepgc = NULL; + g->gray = g->grayagain = NULL; + g->weak = g->ephemeron = g->allweak = NULL; + g->twups = NULL; + g->totalbytes = sizeof(LG); + g->GCdebt = 0; + g->gcfinnum = 0; + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + return L; +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + close_state(L); +} + + diff --git a/deps/rcheevos/test/lua/src/lstate.h b/deps/rcheevos/test/lua/src/lstate.h new file mode 100644 index 0000000000..ed621c4dfa --- /dev/null +++ b/deps/rcheevos/test/lua/src/lstate.h @@ -0,0 +1,235 @@ +/* +** $Id: lstate.h,v 2.133 2016/12/22 13:08:50 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + +/* + +** Some notes about garbage-collected objects: All objects in Lua must +** be kept somehow accessible until being freed, so all objects always +** belong to one (and only one) of these lists, using field 'next' of +** the 'CommonHeader' for the link: +** +** 'allgc': all objects not marked for finalization; +** 'finobj': all objects marked for finalization; +** 'tobefnz': all objects ready to be finalized; +** 'fixedgc': all objects that are not to be collected (currently +** only small strings, such as reserved words). + +*/ + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* +** Atomic type (relative to signals) to better ensure that 'lua_sethook' +** is thread safe +*/ +#if !defined(l_signalT) +#include +#define l_signalT sig_atomic_t +#endif + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRC_STACK 5 + + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + +/* kinds of Garbage Collection */ +#define KGC_NORMAL 0 +#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ + + +typedef struct stringtable { + TString **hash; + int nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** Information about a call. +** When a thread yields, 'func' is adjusted to pretend that the +** top function has only the yielded values in its stack; in that +** case, the actual 'func' value is saved in field 'extra'. +** When a function calls another with a continuation, 'extra' keeps +** the function index so that, in case of errors, the continuation +** function can be called with the correct top. +*/ +typedef struct CallInfo { + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + struct CallInfo *previous, *next; /* dynamic call link */ + union { + struct { /* only for Lua functions */ + StkId base; /* base for this function */ + const Instruction *savedpc; + } l; + struct { /* only for C functions */ + lua_KFunction k; /* continuation in case of yields */ + ptrdiff_t old_errfunc; + lua_KContext ctx; /* context info. in case of yields */ + } c; + } u; + ptrdiff_t extra; + short nresults; /* expected number of results from this function */ + unsigned short callstatus; +} CallInfo; + + +/* +** Bits in CallInfo status +*/ +#define CIST_OAH (1<<0) /* original value of 'allowhook' */ +#define CIST_LUA (1<<1) /* call is running a Lua function */ +#define CIST_HOOKED (1<<2) /* call is running a debug hook */ +#define CIST_FRESH (1<<3) /* call is running on a fresh invocation + of luaV_execute */ +#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ +#define CIST_TAIL (1<<5) /* call was tail called */ +#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ +#define CIST_LEQ (1<<7) /* using __lt for __le */ +#define CIST_FIN (1<<8) /* call is running a finalizer */ + +#define isLua(ci) ((ci)->callstatus & CIST_LUA) + +/* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ +#define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) +#define getoah(st) ((st) & CIST_OAH) + + +/* +** 'global state', shared by all threads of this state +*/ +typedef struct global_State { + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to 'frealloc' */ + l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ + l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ + lu_mem GCmemtrav; /* memory traversed by the GC */ + lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ + stringtable strt; /* hash table for strings */ + TValue l_registry; + unsigned int seed; /* randomized seed for hashes */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + lu_byte gckind; /* kind of GC running */ + lu_byte gcrunning; /* true if GC is running */ + GCObject *allgc; /* list of all collectable objects */ + GCObject **sweepgc; /* current position of sweep in list */ + GCObject *finobj; /* list of collectable objects with finalizers */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of tables with weak values */ + GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ + GCObject *allweak; /* list of all-weak tables */ + GCObject *tobefnz; /* list of userdata to be GC */ + GCObject *fixedgc; /* list of objects not to be collected */ + struct lua_State *twups; /* list of threads with open upvalues */ + unsigned int gcfinnum; /* number of finalizers to call in each GC step */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC 'granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + struct lua_State *mainthread; + const lua_Number *version; /* pointer to version number */ + TString *memerrmsg; /* memory-error message */ + TString *tmname[TM_N]; /* array with tag-method names */ + struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ + TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ +} global_State; + + +/* +** 'per thread' state +*/ +struct lua_State { + CommonHeader; + unsigned short nci; /* number of items in 'ci' list */ + lu_byte status; + StkId top; /* first free slot in the stack */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *oldpc; /* last pc traced */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + UpVal *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_State *twups; /* list of threads with open upvalues */ + struct lua_longjmp *errorJmp; /* current error recover point */ + CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ + volatile lua_Hook hook; + ptrdiff_t errfunc; /* current error handling function (stack index) */ + int stacksize; + int basehookcount; + int hookcount; + unsigned short nny; /* number of non-yieldable calls in stack */ + unsigned short nCcalls; /* number of nested C calls */ + l_signalT hookmask; + lu_byte allowhook; +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects (only for conversions) +*/ +union GCUnion { + GCObject gc; /* common header */ + struct TString ts; + struct Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct lua_State th; /* thread */ +}; + + +#define cast_u(o) cast(union GCUnion *, (o)) + +/* macros to convert a GCObject into a specific value */ +#define gco2ts(o) \ + check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) +#define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) +#define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) +#define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) +#define gco2cl(o) \ + check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) +#define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) +#define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) +#define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) + + +/* macro to convert a Lua object into a GCObject */ +#define obj2gco(v) \ + check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc))) + + +/* actual number of total bytes allocated */ +#define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt) + +LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); +LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); +LUAI_FUNC void luaE_freeCI (lua_State *L); +LUAI_FUNC void luaE_shrinkCI (lua_State *L); + + +#endif + diff --git a/deps/rcheevos/test/lua/src/lstring.c b/deps/rcheevos/test/lua/src/lstring.c new file mode 100644 index 0000000000..9351766fd6 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lstring.c @@ -0,0 +1,248 @@ +/* +** $Id: lstring.c,v 2.56 2015/11/23 11:32:51 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#define lstring_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + +#define MEMERRMSG "not enough memory" + + +/* +** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to +** compute its hash +*/ +#if !defined(LUAI_HASHLIMIT) +#define LUAI_HASHLIMIT 5 +#endif + + +/* +** equality for long strings +*/ +int luaS_eqlngstr (TString *a, TString *b) { + size_t len = a->u.lnglen; + lua_assert(a->tt == LUA_TLNGSTR && b->tt == LUA_TLNGSTR); + return (a == b) || /* same instance or... */ + ((len == b->u.lnglen) && /* equal length and ... */ + (memcmp(getstr(a), getstr(b), len) == 0)); /* equal contents */ +} + + +unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { + unsigned int h = seed ^ cast(unsigned int, l); + size_t step = (l >> LUAI_HASHLIMIT) + 1; + for (; l >= step; l -= step) + h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); + return h; +} + + +unsigned int luaS_hashlongstr (TString *ts) { + lua_assert(ts->tt == LUA_TLNGSTR); + if (ts->extra == 0) { /* no hash? */ + ts->hash = luaS_hash(getstr(ts), ts->u.lnglen, ts->hash); + ts->extra = 1; /* now it has its hash */ + } + return ts->hash; +} + + +/* +** resizes the string table +*/ +void luaS_resize (lua_State *L, int newsize) { + int i; + stringtable *tb = &G(L)->strt; + if (newsize > tb->size) { /* grow table if needed */ + luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); + for (i = tb->size; i < newsize; i++) + tb->hash[i] = NULL; + } + for (i = 0; i < tb->size; i++) { /* rehash */ + TString *p = tb->hash[i]; + tb->hash[i] = NULL; + while (p) { /* for each node in the list */ + TString *hnext = p->u.hnext; /* save next */ + unsigned int h = lmod(p->hash, newsize); /* new position */ + p->u.hnext = tb->hash[h]; /* chain it */ + tb->hash[h] = p; + p = hnext; + } + } + if (newsize < tb->size) { /* shrink table if needed */ + /* vanishing slice should be empty */ + lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL); + luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); + } + tb->size = newsize; +} + + +/* +** Clear API string cache. (Entries cannot be empty, so fill them with +** a non-collectable string.) +*/ +void luaS_clearcache (global_State *g) { + int i, j; + for (i = 0; i < STRCACHE_N; i++) + for (j = 0; j < STRCACHE_M; j++) { + if (iswhite(g->strcache[i][j])) /* will entry be collected? */ + g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */ + } +} + + +/* +** Initialize the string table and the string cache +*/ +void luaS_init (lua_State *L) { + global_State *g = G(L); + int i, j; + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + /* pre-create memory-error message */ + g->memerrmsg = luaS_newliteral(L, MEMERRMSG); + luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */ + for (i = 0; i < STRCACHE_N; i++) /* fill cache with valid strings */ + for (j = 0; j < STRCACHE_M; j++) + g->strcache[i][j] = g->memerrmsg; +} + + + +/* +** creates a new string object +*/ +static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) { + TString *ts; + GCObject *o; + size_t totalsize; /* total size of TString object */ + totalsize = sizelstring(l); + o = luaC_newobj(L, tag, totalsize); + ts = gco2ts(o); + ts->hash = h; + ts->extra = 0; + getstr(ts)[l] = '\0'; /* ending 0 */ + return ts; +} + + +TString *luaS_createlngstrobj (lua_State *L, size_t l) { + TString *ts = createstrobj(L, l, LUA_TLNGSTR, G(L)->seed); + ts->u.lnglen = l; + return ts; +} + + +void luaS_remove (lua_State *L, TString *ts) { + stringtable *tb = &G(L)->strt; + TString **p = &tb->hash[lmod(ts->hash, tb->size)]; + while (*p != ts) /* find previous element */ + p = &(*p)->u.hnext; + *p = (*p)->u.hnext; /* remove element from its list */ + tb->nuse--; +} + + +/* +** checks whether short string exists and reuses it or creates a new one +*/ +static TString *internshrstr (lua_State *L, const char *str, size_t l) { + TString *ts; + global_State *g = G(L); + unsigned int h = luaS_hash(str, l, g->seed); + TString **list = &g->strt.hash[lmod(h, g->strt.size)]; + lua_assert(str != NULL); /* otherwise 'memcmp'/'memcpy' are undefined */ + for (ts = *list; ts != NULL; ts = ts->u.hnext) { + if (l == ts->shrlen && + (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { + /* found! */ + if (isdead(g, ts)) /* dead (but not collected yet)? */ + changewhite(ts); /* resurrect it */ + return ts; + } + } + if (g->strt.nuse >= g->strt.size && g->strt.size <= MAX_INT/2) { + luaS_resize(L, g->strt.size * 2); + list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ + } + ts = createstrobj(L, l, LUA_TSHRSTR, h); + memcpy(getstr(ts), str, l * sizeof(char)); + ts->shrlen = cast_byte(l); + ts->u.hnext = *list; + *list = ts; + g->strt.nuse++; + return ts; +} + + +/* +** new string (with explicit length) +*/ +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + if (l <= LUAI_MAXSHORTLEN) /* short string? */ + return internshrstr(L, str, l); + else { + TString *ts; + if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = luaS_createlngstrobj(L, l); + memcpy(getstr(ts), str, l * sizeof(char)); + return ts; + } +} + + +/* +** Create or reuse a zero-terminated string, first checking in the +** cache (using the string address as a key). The cache can contain +** only zero-terminated strings, so it is safe to use 'strcmp' to +** check hits. +*/ +TString *luaS_new (lua_State *L, const char *str) { + unsigned int i = point2uint(str) % STRCACHE_N; /* hash */ + int j; + TString **p = G(L)->strcache[i]; + for (j = 0; j < STRCACHE_M; j++) { + if (strcmp(str, getstr(p[j])) == 0) /* hit? */ + return p[j]; /* that is it */ + } + /* normal route */ + for (j = STRCACHE_M - 1; j > 0; j--) + p[j] = p[j - 1]; /* move out last element */ + /* new element is first in the list */ + p[0] = luaS_newlstr(L, str, strlen(str)); + return p[0]; +} + + +Udata *luaS_newudata (lua_State *L, size_t s) { + Udata *u; + GCObject *o; + if (s > MAX_SIZE - sizeof(Udata)) + luaM_toobig(L); + o = luaC_newobj(L, LUA_TUSERDATA, sizeludata(s)); + u = gco2u(o); + u->len = s; + u->metatable = NULL; + setuservalue(L, u, luaO_nilobject); + return u; +} + diff --git a/deps/rcheevos/test/lua/src/lstring.h b/deps/rcheevos/test/lua/src/lstring.h new file mode 100644 index 0000000000..27efd20772 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lstring.h @@ -0,0 +1,49 @@ +/* +** $Id: lstring.h,v 1.61 2015/11/03 15:36:01 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) + +#define sizeludata(l) (sizeof(union UUdata) + (l)) +#define sizeudata(u) sizeludata((u)->len) + +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + + +/* +** test whether a string is a reserved word +*/ +#define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) + + +/* +** equality for short strings, which are always internalized +*/ +#define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) + + +LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); +LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); +LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC void luaS_clearcache (global_State *g); +LUAI_FUNC void luaS_init (lua_State *L); +LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); +LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); +LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); + + +#endif diff --git a/deps/rcheevos/test/lua/src/lstrlib.c b/deps/rcheevos/test/lua/src/lstrlib.c new file mode 100644 index 0000000000..c7aa755fab --- /dev/null +++ b/deps/rcheevos/test/lua/src/lstrlib.c @@ -0,0 +1,1584 @@ +/* +** $Id: lstrlib.c,v 1.254 2016/12/22 13:08:50 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + +#define lstrlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** maximum number of captures that a pattern can do during +** pattern-matching. This limit is arbitrary, but must fit in +** an unsigned char. +*/ +#if !defined(LUA_MAXCAPTURES) +#define LUA_MAXCAPTURES 32 +#endif + + +/* macro to 'unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + +/* +** Some sizes are better limited to fit in 'int', but must also fit in +** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) +*/ +#define MAX_SIZET ((size_t)(~(size_t)0)) + +#define MAXSIZE \ + (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) + + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, (lua_Integer)l); + return 1; +} + + +/* translate a relative string position: negative means back from end */ +static lua_Integer posrelat (lua_Integer pos, size_t len) { + if (pos >= 0) return pos; + else if (0u - (size_t)pos > len) return 0; + else return (lua_Integer)len + pos + 1; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + lua_Integer start = posrelat(luaL_checkinteger(L, 2), l); + lua_Integer end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (lua_Integer)l) end = l; + if (start <= end) + lua_pushlstring(L, s + start - 1, (size_t)(end - start) + 1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l, i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + char *p = luaL_buffinitsize(L, &b, l); + for (i = 0; i < l; i++) + p[i] = s[l - i - 1]; + luaL_pushresultsize(&b, l); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + char *p = luaL_buffinitsize(L, &b, l); + for (i=0; i MAXSIZE / n) /* may overflow? */ + return luaL_error(L, "resulting string too large"); + else { + size_t totallen = (size_t)n * l + (size_t)(n - 1) * lsep; + luaL_Buffer b; + char *p = luaL_buffinitsize(L, &b, totallen); + while (n-- > 1) { /* first n-1 copies (followed by separator) */ + memcpy(p, s, l * sizeof(char)); p += l; + if (lsep > 0) { /* empty 'memcpy' is not that cheap */ + memcpy(p, sep, lsep * sizeof(char)); + p += lsep; + } + } + memcpy(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ + luaL_pushresultsize(&b, totallen); + } + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + lua_Integer posi = posrelat(luaL_optinteger(L, 2, 1), l); + lua_Integer pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi < 1) posi = 1; + if (pose > (lua_Integer)l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + if (pose - posi >= INT_MAX) /* arithmetic overflow? */ + return luaL_error(L, "string slice too long"); + n = (int)(pose - posi) + 1; + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index %%%d", l + 1); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (p == ms->p_end) + luaL_error(ms->L, "malformed pattern (ends with '%%')"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a ']' */ + if (p == ms->p_end) + luaL_error(ms->L, "malformed pattern (missing ']')"); + if (*(p++) == L_ESC && p < ms->p_end) + p++; /* skip escapes (e.g. '%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'g' : res = isgraph(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; /* deprecated option */ + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the '^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (MatchState *ms, const char *s, const char *p, + const char *ep) { + if (s >= ms->src_end) + return 0; + else { + int c = uchar(*s); + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } + } +} + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (p >= ms->p_end - 1) + luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while (singlematch(ms, s + i, p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (singlematch(ms, s, p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + if (ms->matchdepth-- == 0) + luaL_error(ms->L, "pattern too complex"); + init: /* using goto's to optimize tail recursion */ + if (p != ms->p_end) { /* end of pattern? */ + switch (*p) { + case '(': { /* start capture */ + if (*(p + 1) == ')') /* position capture? */ + s = start_capture(ms, s, p + 2, CAP_POSITION); + else + s = start_capture(ms, s, p + 1, CAP_UNFINISHED); + break; + } + case ')': { /* end capture */ + s = end_capture(ms, s, p + 1); + break; + } + case '$': { + if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */ + goto dflt; /* no; go to default */ + s = (s == ms->src_end) ? s : NULL; /* check end of string */ + break; + } + case L_ESC: { /* escaped sequences not in the format class[*+?-]? */ + switch (*(p + 1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p + 2); + if (s != NULL) { + p += 4; goto init; /* return match(ms, s, p + 4); */ + } /* else fail (s == NULL) */ + break; + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing '[' after '%%f' in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s - 1); + if (!matchbracketclass(uchar(previous), p, ep - 1) && + matchbracketclass(uchar(*s), p, ep - 1)) { + p = ep; goto init; /* return match(ms, s, ep); */ + } + s = NULL; /* match failed */ + break; + } + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p + 1))); + if (s != NULL) { + p += 2; goto init; /* return match(ms, s, p + 2) */ + } + break; + } + default: goto dflt; + } + break; + } + default: dflt: { /* pattern class plus optional suffix */ + const char *ep = classend(ms, p); /* points to optional suffix */ + /* does not match at least once? */ + if (!singlematch(ms, s, p, ep)) { + if (*ep == '*' || *ep == '?' || *ep == '-') { /* accept empty? */ + p = ep + 1; goto init; /* return match(ms, s, ep + 1); */ + } + else /* '+' or no suffix */ + s = NULL; /* fail */ + } + else { /* matched once */ + switch (*ep) { /* handle optional suffix */ + case '?': { /* optional */ + const char *res; + if ((res = match(ms, s + 1, ep + 1)) != NULL) + s = res; + else { + p = ep + 1; goto init; /* else return match(ms, s, ep + 1); */ + } + break; + } + case '+': /* 1 or more repetitions */ + s++; /* 1 match already done */ + /* FALLTHROUGH */ + case '*': /* 0 or more repetitions */ + s = max_expand(ms, s, p, ep); + break; + case '-': /* 0 or more repetitions (minimum) */ + s = min_expand(ms, s, p, ep); + break; + default: /* no suffix */ + s++; p = ep; goto init; /* return match(ms, s + 1, ep); */ + } + } + break; + } + } + } + ms->matchdepth++; + return s; +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative 'l1' */ + else { + const char *init; /* to search for a '*s2' inside 's1' */ + l2--; /* 1st char will be checked by 'memchr' */ + l1 = l1-l2; /* 's2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct 'l1' and 's1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index %%%d", i + 1); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +/* check whether pattern has no special characters */ +static int nospecials (const char *p, size_t l) { + size_t upto = 0; + do { + if (strpbrk(p + upto, SPECIALS)) + return 0; /* pattern has a special character */ + upto += strlen(p + upto) + 1; /* may have more after \0 */ + } while (upto <= l); + return 1; /* no special chars found */ +} + + +static void prepstate (MatchState *ms, lua_State *L, + const char *s, size_t ls, const char *p, size_t lp) { + ms->L = L; + ms->matchdepth = MAXCCALLS; + ms->src_init = s; + ms->src_end = s + ls; + ms->p_end = p + lp; +} + + +static void reprepstate (MatchState *ms) { + ms->level = 0; + lua_assert(ms->matchdepth == MAXCCALLS); +} + + +static int str_find_aux (lua_State *L, int find) { + size_t ls, lp; + const char *s = luaL_checklstring(L, 1, &ls); + const char *p = luaL_checklstring(L, 2, &lp); + lua_Integer init = posrelat(luaL_optinteger(L, 3, 1), ls); + if (init < 1) init = 1; + else if (init > (lua_Integer)ls + 1) { /* start after string's end? */ + lua_pushnil(L); /* cannot find anything */ + return 1; + } + /* explicit request or no special characters? */ + if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) { + /* do a plain search */ + const char *s2 = lmemfind(s + init - 1, ls - (size_t)init + 1, p, lp); + if (s2) { + lua_pushinteger(L, (s2 - s) + 1); + lua_pushinteger(L, (s2 - s) + lp); + return 2; + } + } + else { + MatchState ms; + const char *s1 = s + init - 1; + int anchor = (*p == '^'); + if (anchor) { + p++; lp--; /* skip anchor character */ + } + prepstate(&ms, L, s, ls, p, lp); + do { + const char *res; + reprepstate(&ms); + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, (s1 - s) + 1); /* start */ + lua_pushinteger(L, res - s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +/* state for 'gmatch' */ +typedef struct GMatchState { + const char *src; /* current position */ + const char *p; /* pattern */ + const char *lastmatch; /* end of last match */ + MatchState ms; /* match state */ +} GMatchState; + + +static int gmatch_aux (lua_State *L) { + GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); + const char *src; + gm->ms.L = L; + for (src = gm->src; src <= gm->ms.src_end; src++) { + const char *e; + reprepstate(&gm->ms); + if ((e = match(&gm->ms, src, gm->p)) != NULL && e != gm->lastmatch) { + gm->src = gm->lastmatch = e; + return push_captures(&gm->ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + size_t ls, lp; + const char *s = luaL_checklstring(L, 1, &ls); + const char *p = luaL_checklstring(L, 2, &lp); + GMatchState *gm; + lua_settop(L, 2); /* keep them on closure to avoid being collected */ + gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState)); + prepstate(&gm->ms, L, s, ls, p, lp); + gm->src = s; gm->p = p; gm->lastmatch = NULL; + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + lua_State *L = ms->L; + const char *news = lua_tolstring(L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) { + if (news[i] != L_ESC) + luaL_error(L, "invalid use of '%c' in replacement string", L_ESC); + luaL_addchar(b, news[i]); + } + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_tolstring(L, -1, NULL); /* if number, convert it to string */ + lua_remove(L, -2); /* remove original value */ + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e, int tr) { + lua_State *L = ms->L; + switch (tr) { + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + default: { /* LUA_TNUMBER or LUA_TSTRING */ + add_s(ms, b, s, e); + return; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl, lp; + const char *src = luaL_checklstring(L, 1, &srcl); /* subject */ + const char *p = luaL_checklstring(L, 2, &lp); /* pattern */ + const char *lastmatch = NULL; /* end of last match */ + int tr = lua_type(L, 3); /* replacement type */ + lua_Integer max_s = luaL_optinteger(L, 4, srcl + 1); /* max replacements */ + int anchor = (*p == '^'); + lua_Integer n = 0; /* replacement count */ + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + if (anchor) { + p++; lp--; /* skip anchor character */ + } + prepstate(&ms, L, src, srcl, p, lp); + while (n < max_s) { + const char *e; + reprepstate(&ms); /* (re)prepare state for new match */ + if ((e = match(&ms, src, p)) != NULL && e != lastmatch) { /* match? */ + n++; + add_value(&ms, &b, src, e, tr); /* add replacement to buffer */ + src = lastmatch = e; + } + else if (src < ms.src_end) /* otherwise, skip one character */ + luaL_addchar(&b, *src++); + else break; /* end of subject */ + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** STRING FORMAT +** ======================================================= +*/ + +#if !defined(lua_number2strx) /* { */ + +/* +** Hexadecimal floating-point formatter +*/ + +#include + +#define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) + + +/* +** Number of bits that goes into the first digit. It can be any value +** between 1 and 4; the following definition tries to align the number +** to nibble boundaries by making what is left after that first digit a +** multiple of 4. +*/ +#define L_NBFD ((l_mathlim(MANT_DIG) - 1)%4 + 1) + + +/* +** Add integer part of 'x' to buffer and return new 'x' +*/ +static lua_Number adddigit (char *buff, int n, lua_Number x) { + lua_Number dd = l_mathop(floor)(x); /* get integer part from 'x' */ + int d = (int)dd; + buff[n] = (d < 10 ? d + '0' : d - 10 + 'a'); /* add to buffer */ + return x - dd; /* return what is left */ +} + + +static int num2straux (char *buff, int sz, lua_Number x) { + /* if 'inf' or 'NaN', format it like '%g' */ + if (x != x || x == (lua_Number)HUGE_VAL || x == -(lua_Number)HUGE_VAL) + return l_sprintf(buff, sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)x); + else if (x == 0) { /* can be -0... */ + /* create "0" or "-0" followed by exponent */ + return l_sprintf(buff, sz, LUA_NUMBER_FMT "x0p+0", (LUAI_UACNUMBER)x); + } + else { + int e; + lua_Number m = l_mathop(frexp)(x, &e); /* 'x' fraction and exponent */ + int n = 0; /* character count */ + if (m < 0) { /* is number negative? */ + buff[n++] = '-'; /* add signal */ + m = -m; /* make it positive */ + } + buff[n++] = '0'; buff[n++] = 'x'; /* add "0x" */ + m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ + e -= L_NBFD; /* this digit goes before the radix point */ + if (m > 0) { /* more digits? */ + buff[n++] = lua_getlocaledecpoint(); /* add radix point */ + do { /* add as many digits as needed */ + m = adddigit(buff, n++, m * 16); + } while (m > 0); + } + n += l_sprintf(buff + n, sz - n, "p%+d", e); /* add exponent */ + lua_assert(n < sz); + return n; + } +} + + +static int lua_number2strx (lua_State *L, char *buff, int sz, + const char *fmt, lua_Number x) { + int n = num2straux(buff, sz, x); + if (fmt[SIZELENMOD] == 'A') { + int i; + for (i = 0; i < n; i++) + buff[i] = toupper(uchar(buff[i])); + } + else if (fmt[SIZELENMOD] != 'a') + luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); + return n; +} + +#endif /* } */ + + +/* +** Maximum size of each formatted item. This maximum size is produced +** by format('%.99f', -maxfloat), and is equal to 99 + 3 ('-', '.', +** and '\0') + number of decimal digits to represent maxfloat (which +** is maximum exponent + 1). (99+3+1 then rounded to 120 for "extra +** expenses", such as locale-dependent stuff) +*/ +#define MAX_ITEM (120 + l_mathlim(MAX_10_EXP)) + + +/* valid flags in a format specification */ +#define FLAGS "-+ #0" + +/* +** maximum size of each format specification (such as "%-099.99d") +*/ +#define MAX_FORMAT 32 + + +static void addquoted (luaL_Buffer *b, const char *s, size_t len) { + luaL_addchar(b, '"'); + while (len--) { + if (*s == '"' || *s == '\\' || *s == '\n') { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + } + else if (iscntrl(uchar(*s))) { + char buff[10]; + if (!isdigit(uchar(*(s+1)))) + l_sprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s)); + else + l_sprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s)); + luaL_addstring(b, buff); + } + else + luaL_addchar(b, *s); + s++; + } + luaL_addchar(b, '"'); +} + + +/* +** Ensures the 'buff' string uses a dot as the radix character. +*/ +static void checkdp (char *buff, int nb) { + if (memchr(buff, '.', nb) == NULL) { /* no dot? */ + char point = lua_getlocaledecpoint(); /* try locale point */ + char *ppoint = (char *)memchr(buff, point, nb); + if (ppoint) *ppoint = '.'; /* change it to a dot */ + } +} + + +static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { + switch (lua_type(L, arg)) { + case LUA_TSTRING: { + size_t len; + const char *s = lua_tolstring(L, arg, &len); + addquoted(b, s, len); + break; + } + case LUA_TNUMBER: { + char *buff = luaL_prepbuffsize(b, MAX_ITEM); + int nb; + if (!lua_isinteger(L, arg)) { /* float? */ + lua_Number n = lua_tonumber(L, arg); /* write as hexa ('%a') */ + nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n); + checkdp(buff, nb); /* ensure it uses a dot */ + } + else { /* integers */ + lua_Integer n = lua_tointeger(L, arg); + const char *format = (n == LUA_MININTEGER) /* corner case? */ + ? "0x%" LUA_INTEGER_FRMLEN "x" /* use hexa */ + : LUA_INTEGER_FMT; /* else use default format */ + nb = l_sprintf(buff, MAX_ITEM, format, (LUAI_UACINT)n); + } + luaL_addsize(b, nb); + break; + } + case LUA_TNIL: case LUA_TBOOLEAN: { + luaL_tolstring(L, arg, NULL); + luaL_addvalue(b); + break; + } + default: { + luaL_argerror(L, arg, "value has no literal form"); + } + } +} + + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + memcpy(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char)); + form += (p - strfrmt) + 1; + *form = '\0'; + return p; +} + + +/* +** add length modifier into formats +*/ +static void addlenmod (char *form, const char *lenmod) { + size_t l = strlen(form); + size_t lm = strlen(lenmod); + char spec = form[l - 1]; + strcpy(form + l - 1, lenmod); + form[l + lm - 1] = spec; + form[l + lm] = '\0'; +} + + +static int str_format (lua_State *L) { + int top = lua_gettop(L); + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format ('%...') */ + char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ + int nb = 0; /* number of bytes in added item */ + if (++arg > top) + luaL_argerror(L, arg, "no value"); + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + nb = l_sprintf(buff, MAX_ITEM, form, (int)luaL_checkinteger(L, arg)); + break; + } + case 'd': case 'i': + case 'o': case 'u': case 'x': case 'X': { + lua_Integer n = luaL_checkinteger(L, arg); + addlenmod(form, LUA_INTEGER_FRMLEN); + nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACINT)n); + break; + } + case 'a': case 'A': + addlenmod(form, LUA_NUMBER_FRMLEN); + nb = lua_number2strx(L, buff, MAX_ITEM, form, + luaL_checknumber(L, arg)); + break; + case 'e': case 'E': case 'f': + case 'g': case 'G': { + lua_Number n = luaL_checknumber(L, arg); + addlenmod(form, LUA_NUMBER_FRMLEN); + nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACNUMBER)n); + break; + } + case 'q': { + addliteral(L, &b, arg); + break; + } + case 's': { + size_t l; + const char *s = luaL_tolstring(L, arg, &l); + if (form[2] == '\0') /* no modifiers? */ + luaL_addvalue(&b); /* keep entire string */ + else { + luaL_argcheck(L, l == strlen(s), arg, "string contains zeros"); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted */ + luaL_addvalue(&b); /* keep entire string */ + } + else { /* format the string into 'buff' */ + nb = l_sprintf(buff, MAX_ITEM, form, s); + lua_pop(L, 1); /* remove result from 'luaL_tolstring' */ + } + } + break; + } + default: { /* also treat cases 'pnLlh' */ + return luaL_error(L, "invalid option '%%%c' to 'format'", + *(strfrmt - 1)); + } + } + lua_assert(nb < MAX_ITEM); + luaL_addsize(&b, nb); + } + } + luaL_pushresult(&b); + return 1; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** PACK/UNPACK +** ======================================================= +*/ + + +/* value used for padding */ +#if !defined(LUAL_PACKPADBYTE) +#define LUAL_PACKPADBYTE 0x00 +#endif + +/* maximum size for the binary representation of an integer */ +#define MAXINTSIZE 16 + +/* number of bits in a character */ +#define NB CHAR_BIT + +/* mask for one character (NB 1's) */ +#define MC ((1 << NB) - 1) + +/* size of a lua_Integer */ +#define SZINT ((int)sizeof(lua_Integer)) + + +/* dummy union to get native endianness */ +static const union { + int dummy; + char little; /* true iff machine is little endian */ +} nativeendian = {1}; + + +/* dummy structure to get native alignment requirements */ +struct cD { + char c; + union { double d; void *p; lua_Integer i; lua_Number n; } u; +}; + +#define MAXALIGN (offsetof(struct cD, u)) + + +/* +** Union for serializing floats +*/ +typedef union Ftypes { + float f; + double d; + lua_Number n; + char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ +} Ftypes; + + +/* +** information to pack/unpack stuff +*/ +typedef struct Header { + lua_State *L; + int islittle; + int maxalign; +} Header; + + +/* +** options for pack/unpack +*/ +typedef enum KOption { + Kint, /* signed integers */ + Kuint, /* unsigned integers */ + Kfloat, /* floating-point numbers */ + Kchar, /* fixed-length strings */ + Kstring, /* strings with prefixed length */ + Kzstr, /* zero-terminated strings */ + Kpadding, /* padding */ + Kpaddalign, /* padding for alignment */ + Knop /* no-op (configuration or spaces) */ +} KOption; + + +/* +** Read an integer numeral from string 'fmt' or return 'df' if +** there is no numeral +*/ +static int digit (int c) { return '0' <= c && c <= '9'; } + +static int getnum (const char **fmt, int df) { + if (!digit(**fmt)) /* no number? */ + return df; /* return default value */ + else { + int a = 0; + do { + a = a*10 + (*((*fmt)++) - '0'); + } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); + return a; + } +} + + +/* +** Read an integer numeral and raises an error if it is larger +** than the maximum size for integers. +*/ +static int getnumlimit (Header *h, const char **fmt, int df) { + int sz = getnum(fmt, df); + if (sz > MAXINTSIZE || sz <= 0) + luaL_error(h->L, "integral size (%d) out of limits [1,%d]", + sz, MAXINTSIZE); + return sz; +} + + +/* +** Initialize Header +*/ +static void initheader (lua_State *L, Header *h) { + h->L = L; + h->islittle = nativeendian.little; + h->maxalign = 1; +} + + +/* +** Read and classify next option. 'size' is filled with option's size. +*/ +static KOption getoption (Header *h, const char **fmt, int *size) { + int opt = *((*fmt)++); + *size = 0; /* default */ + switch (opt) { + case 'b': *size = sizeof(char); return Kint; + case 'B': *size = sizeof(char); return Kuint; + case 'h': *size = sizeof(short); return Kint; + case 'H': *size = sizeof(short); return Kuint; + case 'l': *size = sizeof(long); return Kint; + case 'L': *size = sizeof(long); return Kuint; + case 'j': *size = sizeof(lua_Integer); return Kint; + case 'J': *size = sizeof(lua_Integer); return Kuint; + case 'T': *size = sizeof(size_t); return Kuint; + case 'f': *size = sizeof(float); return Kfloat; + case 'd': *size = sizeof(double); return Kfloat; + case 'n': *size = sizeof(lua_Number); return Kfloat; + case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; + case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; + case 's': *size = getnumlimit(h, fmt, sizeof(size_t)); return Kstring; + case 'c': + *size = getnum(fmt, -1); + if (*size == -1) + luaL_error(h->L, "missing size for format option 'c'"); + return Kchar; + case 'z': return Kzstr; + case 'x': *size = 1; return Kpadding; + case 'X': return Kpaddalign; + case ' ': break; + case '<': h->islittle = 1; break; + case '>': h->islittle = 0; break; + case '=': h->islittle = nativeendian.little; break; + case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; + default: luaL_error(h->L, "invalid format option '%c'", opt); + } + return Knop; +} + + +/* +** Read, classify, and fill other details about the next option. +** 'psize' is filled with option's size, 'notoalign' with its +** alignment requirements. +** Local variable 'size' gets the size to be aligned. (Kpadal option +** always gets its full alignment, other options are limited by +** the maximum alignment ('maxalign'). Kchar option needs no alignment +** despite its size. +*/ +static KOption getdetails (Header *h, size_t totalsize, + const char **fmt, int *psize, int *ntoalign) { + KOption opt = getoption(h, fmt, psize); + int align = *psize; /* usually, alignment follows size */ + if (opt == Kpaddalign) { /* 'X' gets alignment from following option */ + if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) + luaL_argerror(h->L, 1, "invalid next option for option 'X'"); + } + if (align <= 1 || opt == Kchar) /* need no alignment? */ + *ntoalign = 0; + else { + if (align > h->maxalign) /* enforce maximum alignment */ + align = h->maxalign; + if ((align & (align - 1)) != 0) /* is 'align' not a power of 2? */ + luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); + *ntoalign = (align - (int)(totalsize & (align - 1))) & (align - 1); + } + return opt; +} + + +/* +** Pack integer 'n' with 'size' bytes and 'islittle' endianness. +** The final 'if' handles the case when 'size' is larger than +** the size of a Lua integer, correcting the extra sign-extension +** bytes if necessary (by default they would be zeros). +*/ +static void packint (luaL_Buffer *b, lua_Unsigned n, + int islittle, int size, int neg) { + char *buff = luaL_prepbuffsize(b, size); + int i; + buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ + for (i = 1; i < size; i++) { + n >>= NB; + buff[islittle ? i : size - 1 - i] = (char)(n & MC); + } + if (neg && size > SZINT) { /* negative number need sign extension? */ + for (i = SZINT; i < size; i++) /* correct extra bytes */ + buff[islittle ? i : size - 1 - i] = (char)MC; + } + luaL_addsize(b, size); /* add result to buffer */ +} + + +/* +** Copy 'size' bytes from 'src' to 'dest', correcting endianness if +** given 'islittle' is different from native endianness. +*/ +static void copywithendian (volatile char *dest, volatile const char *src, + int size, int islittle) { + if (islittle == nativeendian.little) { + while (size-- != 0) + *(dest++) = *(src++); + } + else { + dest += size - 1; + while (size-- != 0) + *(dest--) = *(src++); + } +} + + +static int str_pack (lua_State *L) { + luaL_Buffer b; + Header h; + const char *fmt = luaL_checkstring(L, 1); /* format string */ + int arg = 1; /* current argument to pack */ + size_t totalsize = 0; /* accumulate total size of result */ + initheader(L, &h); + lua_pushnil(L); /* mark to separate arguments from string buffer */ + luaL_buffinit(L, &b); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); + totalsize += ntoalign + size; + while (ntoalign-- > 0) + luaL_addchar(&b, LUAL_PACKPADBYTE); /* fill alignment */ + arg++; + switch (opt) { + case Kint: { /* signed integers */ + lua_Integer n = luaL_checkinteger(L, arg); + if (size < SZINT) { /* need overflow check? */ + lua_Integer lim = (lua_Integer)1 << ((size * NB) - 1); + luaL_argcheck(L, -lim <= n && n < lim, arg, "integer overflow"); + } + packint(&b, (lua_Unsigned)n, h.islittle, size, (n < 0)); + break; + } + case Kuint: { /* unsigned integers */ + lua_Integer n = luaL_checkinteger(L, arg); + if (size < SZINT) /* need overflow check? */ + luaL_argcheck(L, (lua_Unsigned)n < ((lua_Unsigned)1 << (size * NB)), + arg, "unsigned overflow"); + packint(&b, (lua_Unsigned)n, h.islittle, size, 0); + break; + } + case Kfloat: { /* floating-point options */ + volatile Ftypes u; + char *buff = luaL_prepbuffsize(&b, size); + lua_Number n = luaL_checknumber(L, arg); /* get argument */ + if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ + else if (size == sizeof(u.d)) u.d = (double)n; + else u.n = n; + /* move 'u' to final result, correcting endianness if needed */ + copywithendian(buff, u.buff, size, h.islittle); + luaL_addsize(&b, size); + break; + } + case Kchar: { /* fixed-size string */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, len <= (size_t)size, arg, + "string longer than given size"); + luaL_addlstring(&b, s, len); /* add string */ + while (len++ < (size_t)size) /* pad extra space */ + luaL_addchar(&b, LUAL_PACKPADBYTE); + break; + } + case Kstring: { /* strings with length count */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, size >= (int)sizeof(size_t) || + len < ((size_t)1 << (size * NB)), + arg, "string length does not fit in given size"); + packint(&b, (lua_Unsigned)len, h.islittle, size, 0); /* pack length */ + luaL_addlstring(&b, s, len); + totalsize += len; + break; + } + case Kzstr: { /* zero-terminated string */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); + luaL_addlstring(&b, s, len); + luaL_addchar(&b, '\0'); /* add zero at the end */ + totalsize += len + 1; + break; + } + case Kpadding: luaL_addchar(&b, LUAL_PACKPADBYTE); /* FALLTHROUGH */ + case Kpaddalign: case Knop: + arg--; /* undo increment */ + break; + } + } + luaL_pushresult(&b); + return 1; +} + + +static int str_packsize (lua_State *L) { + Header h; + const char *fmt = luaL_checkstring(L, 1); /* format string */ + size_t totalsize = 0; /* accumulate total size of result */ + initheader(L, &h); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); + size += ntoalign; /* total space used by option */ + luaL_argcheck(L, totalsize <= MAXSIZE - size, 1, + "format result too large"); + totalsize += size; + switch (opt) { + case Kstring: /* strings with length count */ + case Kzstr: /* zero-terminated string */ + luaL_argerror(L, 1, "variable-length format"); + /* call never return, but to avoid warnings: *//* FALLTHROUGH */ + default: break; + } + } + lua_pushinteger(L, (lua_Integer)totalsize); + return 1; +} + + +/* +** Unpack an integer with 'size' bytes and 'islittle' endianness. +** If size is smaller than the size of a Lua integer and integer +** is signed, must do sign extension (propagating the sign to the +** higher bits); if size is larger than the size of a Lua integer, +** it must check the unread bytes to see whether they do not cause an +** overflow. +*/ +static lua_Integer unpackint (lua_State *L, const char *str, + int islittle, int size, int issigned) { + lua_Unsigned res = 0; + int i; + int limit = (size <= SZINT) ? size : SZINT; + for (i = limit - 1; i >= 0; i--) { + res <<= NB; + res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i]; + } + if (size < SZINT) { /* real size smaller than lua_Integer? */ + if (issigned) { /* needs sign extension? */ + lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1); + res = ((res ^ mask) - mask); /* do sign extension */ + } + } + else if (size > SZINT) { /* must check unread bytes */ + int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC; + for (i = limit; i < size; i++) { + if ((unsigned char)str[islittle ? i : size - 1 - i] != mask) + luaL_error(L, "%d-byte integer does not fit into Lua Integer", size); + } + } + return (lua_Integer)res; +} + + +static int str_unpack (lua_State *L) { + Header h; + const char *fmt = luaL_checkstring(L, 1); + size_t ld; + const char *data = luaL_checklstring(L, 2, &ld); + size_t pos = (size_t)posrelat(luaL_optinteger(L, 3, 1), ld) - 1; + int n = 0; /* number of results */ + luaL_argcheck(L, pos <= ld, 3, "initial position out of string"); + initheader(L, &h); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, pos, &fmt, &size, &ntoalign); + if ((size_t)ntoalign + size > ~pos || pos + ntoalign + size > ld) + luaL_argerror(L, 2, "data string too short"); + pos += ntoalign; /* skip alignment */ + /* stack space for item + next position */ + luaL_checkstack(L, 2, "too many results"); + n++; + switch (opt) { + case Kint: + case Kuint: { + lua_Integer res = unpackint(L, data + pos, h.islittle, size, + (opt == Kint)); + lua_pushinteger(L, res); + break; + } + case Kfloat: { + volatile Ftypes u; + lua_Number num; + copywithendian(u.buff, data + pos, size, h.islittle); + if (size == sizeof(u.f)) num = (lua_Number)u.f; + else if (size == sizeof(u.d)) num = (lua_Number)u.d; + else num = u.n; + lua_pushnumber(L, num); + break; + } + case Kchar: { + lua_pushlstring(L, data + pos, size); + break; + } + case Kstring: { + size_t len = (size_t)unpackint(L, data + pos, h.islittle, size, 0); + luaL_argcheck(L, pos + len + size <= ld, 2, "data string too short"); + lua_pushlstring(L, data + pos + size, len); + pos += len; /* skip string */ + break; + } + case Kzstr: { + size_t len = (int)strlen(data + pos); + lua_pushlstring(L, data + pos, len); + pos += len + 1; /* skip string plus final '\0' */ + break; + } + case Kpaddalign: case Kpadding: case Knop: + n--; /* undo increment */ + break; + } + pos += size; + } + lua_pushinteger(L, pos + 1); /* next position */ + return n + 1; +} + +/* }====================================================== */ + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {"pack", str_pack}, + {"packsize", str_packsize}, + {"unpack", str_unpack}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* table to be metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); /* copy table */ + lua_setmetatable(L, -2); /* set table as metatable for strings */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* get string library */ + lua_setfield(L, -2, "__index"); /* metatable.__index = string */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUAMOD_API int luaopen_string (lua_State *L) { + luaL_newlib(L, strlib); + createmetatable(L); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/ltable.c b/deps/rcheevos/test/lua/src/ltable.c new file mode 100644 index 0000000000..d080189f28 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ltable.c @@ -0,0 +1,669 @@ +/* +** $Id: ltable.c,v 2.118 2016/11/07 12:38:35 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#define ltable_c +#define LUA_CORE + +#include "lprefix.h" + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest 'n' such that +** more than half the slots between 1 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the 'original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lvm.h" + + +/* +** Maximum size of array part (MAXASIZE) is 2^MAXABITS. MAXABITS is +** the largest integer such that MAXASIZE fits in an unsigned int. +*/ +#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1) +#define MAXASIZE (1u << MAXABITS) + +/* +** Maximum size of hash part is 2^MAXHBITS. MAXHBITS is the largest +** integer such that 2^MAXHBITS fits in a signed int. (Note that the +** maximum number of elements in a table, 2^MAXABITS + 2^MAXHBITS, still +** fits comfortably in an unsigned int.) +*/ +#define MAXHBITS (MAXABITS - 1) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->hash) +#define hashboolean(t,p) hashpow2(t, p) +#define hashint(t,i) hashpow2(t, i) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, point2uint(p)) + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {NILCONSTANT}, /* value */ + {{NILCONSTANT, 0}} /* key */ +}; + + +/* +** Hash for floating-point numbers. +** The main computation should be just +** n = frexp(n, &i); return (n * INT_MAX) + i +** but there are some numerical subtleties. +** In a two-complement representation, INT_MAX does not has an exact +** representation as a float, but INT_MIN does; because the absolute +** value of 'frexp' is smaller than 1 (unless 'n' is inf/NaN), the +** absolute value of the product 'frexp * -INT_MIN' is smaller or equal +** to INT_MAX. Next, the use of 'unsigned int' avoids overflows when +** adding 'i'; the use of '~u' (instead of '-u') avoids problems with +** INT_MIN. +*/ +#if !defined(l_hashfloat) +static int l_hashfloat (lua_Number n) { + int i; + lua_Integer ni; + n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN); + if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */ + lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL)); + return 0; + } + else { /* normal case */ + unsigned int u = cast(unsigned int, i) + cast(unsigned int, ni); + return cast_int(u <= cast(unsigned int, INT_MAX) ? u : ~u); + } +} +#endif + + +/* +** returns the 'main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMINT: + return hashint(t, ivalue(key)); + case LUA_TNUMFLT: + return hashmod(t, l_hashfloat(fltvalue(key))); + case LUA_TSHRSTR: + return hashstr(t, tsvalue(key)); + case LUA_TLNGSTR: + return hashpow2(t, luaS_hashlongstr(tsvalue(key))); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + case LUA_TLCF: + return hashpointer(t, fvalue(key)); + default: + lua_assert(!ttisdeadkey(key)); + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for 'key' if 'key' is an appropriate key to live in +** the array part of the table, 0 otherwise. +*/ +static unsigned int arrayindex (const TValue *key) { + if (ttisinteger(key)) { + lua_Integer k = ivalue(key); + if (0 < k && (lua_Unsigned)k <= MAXASIZE) + return cast(unsigned int, k); /* 'key' is an appropriate array index */ + } + return 0; /* 'key' did not match some condition */ +} + + +/* +** returns the index of a 'key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signaled by 0. +*/ +static unsigned int findindex (lua_State *L, Table *t, StkId key) { + unsigned int i; + if (ttisnil(key)) return 0; /* first iteration */ + i = arrayindex(key); + if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */ + return i; /* yes; that's the index */ + else { + int nx; + Node *n = mainposition(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in 'next' */ + if (luaV_rawequalobj(gkey(n), key) || + (ttisdeadkey(gkey(n)) && iscollectable(key) && + deadvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return (i + 1) + t->sizearray; + } + nx = gnext(n); + if (nx == 0) + luaG_runerror(L, "invalid key to 'next'"); /* key not found */ + else n += nx; + } + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + unsigned int i = findindex(L, t, key); /* find original element */ + for (; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setivalue(key, i + 1); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, gkey(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + +/* +** Compute the optimal size for the array part of table 't'. 'nums' is a +** "count array" where 'nums[i]' is the number of integers in the table +** between 2^(i - 1) + 1 and 2^i. 'pna' enters with the total number of +** integer keys in the table and leaves with the number of keys that +** will go to the array part; return the optimal size. +*/ +static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { + int i; + unsigned int twotoi; /* 2^i (candidate for optimal size) */ + unsigned int a = 0; /* number of elements smaller than 2^i */ + unsigned int na = 0; /* number of elements to go to array part */ + unsigned int optimal = 0; /* optimal size for array part */ + /* loop while keys can fill more than half of total size */ + for (i = 0, twotoi = 1; *pna > twotoi / 2; i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + optimal = twotoi; /* optimal size (till now) */ + na = a; /* all elements up to 'optimal' will go to array part */ + } + } + } + lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal); + *pna = na; + return optimal; +} + + +static int countint (const TValue *key, unsigned int *nums) { + unsigned int k = arrayindex(key); + if (k != 0) { /* is 'key' an appropriate array index? */ + nums[luaO_ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +/* +** Count keys in array part of table 't': Fill 'nums[i]' with +** number of keys that will go into corresponding slice and return +** total number of non-nil keys. +*/ +static unsigned int numusearray (const Table *t, unsigned int *nums) { + int lg; + unsigned int ttlg; /* 2^lg */ + unsigned int ause = 0; /* summation of 'nums' */ + unsigned int i = 1; /* count to traverse all array keys */ + /* traverse each slice */ + for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { + unsigned int lc = 0; /* counter */ + unsigned int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg - 1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* elements added to 'nums' (can go to array part) */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(gkey(n), nums); + totaluse++; + } + } + *pna += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, unsigned int size) { + unsigned int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; iarray[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, unsigned int size) { + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common 'dummynode' */ + t->lsizenode = 0; + t->lastfree = NULL; /* signal that it is using dummy node */ + } + else { + int i; + int lsize = luaO_ceillog2(size); + if (lsize > MAXHBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i = 0; i < (int)size; i++) { + Node *n = gnode(t, i); + gnext(n) = 0; + setnilvalue(wgkey(n)); + setnilvalue(gval(n)); + } + t->lsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ + } +} + + +void luaH_resize (lua_State *L, Table *t, unsigned int nasize, + unsigned int nhsize) { + unsigned int i; + int j; + unsigned int oldasize = t->sizearray; + int oldhsize = allocsizenode(t); + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + setnodevector(L, t, nhsize); + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; iarray[i])) + luaH_setint(L, t, i + 1, &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (j = oldhsize - 1; j >= 0; j--) { + Node *old = nold + j; + if (!ttisnil(gval(old))) { + /* doesn't need barrier/invalidate cache, as entry was + already present in the table */ + setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); + } + } + if (oldhsize > 0) /* not the dummy node? */ + luaM_freearray(L, nold, cast(size_t, oldhsize)); /* free old hash */ +} + + +void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) { + int nsize = allocsizenode(t); + luaH_resize(L, t, nasize, nsize); +} + +/* +** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i +*/ +static void rehash (lua_State *L, Table *t, const TValue *ek) { + unsigned int asize; /* optimal size for array part */ + unsigned int na; /* number of keys in the array part */ + unsigned int nums[MAXABITS + 1]; + int i; + int totaluse; + for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ + na = numusearray(t, nums); /* count keys in array part */ + totaluse = na; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &na); /* count keys in hash part */ + /* count extra key */ + na += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + asize = computesizes(nums, &na); + /* resize the table to new computed sizes */ + luaH_resize(L, t, asize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L) { + GCObject *o = luaC_newobj(L, LUA_TTABLE, sizeof(Table)); + Table *t = gco2t(o); + t->metatable = NULL; + t->flags = cast_byte(~0); + t->array = NULL; + t->sizearray = 0; + setnodevector(L, t, 0); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (!isdummy(t)) + luaM_freearray(L, t->node, cast(size_t, sizenode(t))); + luaM_freearray(L, t->array, t->sizearray); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + if (!isdummy(t)) { + while (t->lastfree > t->node) { + t->lastfree--; + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp; + TValue aux; + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisfloat(key)) { + lua_Integer k; + if (luaV_tointeger(key, &k, 0)) { /* does index fit in an integer? */ + setivalue(&aux, k); + key = &aux; /* insert it as an integer */ + } + else if (luai_numisnan(fltvalue(key))) + luaG_runerror(L, "table index is NaN"); + } + mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || isdummy(t)) { /* main position is taken? */ + Node *othern; + Node *f = getfreepos(t); /* get a free place */ + if (f == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + /* whatever called 'newkey' takes care of TM cache */ + return luaH_set(L, t, key); /* insert key into grown table */ + } + lua_assert(!isdummy(t)); + othern = mainposition(t, gkey(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (othern + gnext(othern) != mp) /* find previous */ + othern += gnext(othern); + gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ + *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + if (gnext(mp) != 0) { + gnext(f) += cast_int(mp - f); /* correct 'next' */ + gnext(mp) = 0; /* now 'mp' is free */ + } + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + if (gnext(mp) != 0) + gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ + else lua_assert(gnext(f) == 0); + gnext(mp) = cast_int(f - mp); + mp = f; + } + } + setnodekey(L, &mp->i_key, key); + luaC_barrierback(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getint (Table *t, lua_Integer key) { + /* (1 <= key && key <= t->sizearray) */ + if (l_castS2U(key) - 1 < t->sizearray) + return &t->array[key - 1]; + else { + Node *n = hashint(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) break; + n += nx; + } + } + return luaO_nilobject; + } +} + + +/* +** search function for short strings +*/ +const TValue *luaH_getshortstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + lua_assert(key->tt == LUA_TSHRSTR); + for (;;) { /* check whether 'key' is somewhere in the chain */ + const TValue *k = gkey(n); + if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) + return luaO_nilobject; /* not found */ + n += nx; + } + } +} + + +/* +** "Generic" get version. (Not that generic: not valid for integers, +** which may be in array part, nor for floats with integral values.) +*/ +static const TValue *getgeneric (Table *t, const TValue *key) { + Node *n = mainposition(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + if (luaV_rawequalobj(gkey(n), key)) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) + return luaO_nilobject; /* not found */ + n += nx; + } + } +} + + +const TValue *luaH_getstr (Table *t, TString *key) { + if (key->tt == LUA_TSHRSTR) + return luaH_getshortstr(t, key); + else { /* for long strings, use generic case */ + TValue ko; + setsvalue(cast(lua_State *, NULL), &ko, key); + return getgeneric(t, &ko); + } +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TSHRSTR: return luaH_getshortstr(t, tsvalue(key)); + case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); + case LUA_TNIL: return luaO_nilobject; + case LUA_TNUMFLT: { + lua_Integer k; + if (luaV_tointeger(key, &k, 0)) /* index is int? */ + return luaH_getint(t, k); /* use specialized version */ + /* else... */ + } /* FALLTHROUGH */ + default: + return getgeneric(t, key); + } +} + + +/* +** beware: when using this function you probably need to check a GC +** barrier and invalidate the TM cache. +*/ +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else return luaH_newkey(L, t, key); +} + + +void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { + const TValue *p = luaH_getint(t, key); + TValue *cell; + if (p != luaO_nilobject) + cell = cast(TValue *, p); + else { + TValue k; + setivalue(&k, key); + cell = luaH_newkey(L, t, &k); + } + setobj2t(L, cell, value); +} + + +static int unbound_search (Table *t, unsigned int j) { + unsigned int i = j; /* i is zero or a present index */ + j++; + /* find 'i' and 'j' such that i is present and j is not */ + while (!ttisnil(luaH_getint(t, j))) { + i = j; + if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getint(t, i))) i++; + return i - 1; + } + j *= 2; + } + /* now do a binary search between them */ + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(luaH_getint(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table 't'. A 'boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +int luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (isdummy(t)) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (const Table *t) { return isdummy(t); } + +#endif diff --git a/deps/rcheevos/test/lua/src/ltable.h b/deps/rcheevos/test/lua/src/ltable.h new file mode 100644 index 0000000000..6da9024fe1 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ltable.h @@ -0,0 +1,66 @@ +/* +** $Id: ltable.h,v 2.23 2016/12/22 13:08:50 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + + +/* 'const' to avoid wrong writings that can mess up field 'next' */ +#define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) + +/* +** writable version of 'gkey'; allows updates to individual fields, +** but not to the whole (which has incompatible type) +*/ +#define wgkey(n) (&(n)->i_key.nk) + +#define invalidateTMcache(t) ((t)->flags = 0) + + +/* true when 't' is using 'dummynode' as its hash part */ +#define isdummy(t) ((t)->lastfree == NULL) + + +/* allocated size for hash nodes */ +#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) + + +/* returns the key, given the value of a table entry */ +#define keyfromval(v) \ + (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) + + +LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); +LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, + TValue *value); +LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L); +LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, + unsigned int nhsize); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (const Table *t); +#endif + + +#endif diff --git a/deps/rcheevos/test/lua/src/ltablib.c b/deps/rcheevos/test/lua/src/ltablib.c new file mode 100644 index 0000000000..98b2f87137 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ltablib.c @@ -0,0 +1,450 @@ +/* +** $Id: ltablib.c,v 1.93 2016/02/25 19:41:54 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + +#define ltablib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** Operations that an object must define to mimic a table +** (some functions only need some of them) +*/ +#define TAB_R 1 /* read */ +#define TAB_W 2 /* write */ +#define TAB_L 4 /* length */ +#define TAB_RW (TAB_R | TAB_W) /* read/write */ + + +#define aux_getn(L,n,w) (checktab(L, n, (w) | TAB_L), luaL_len(L, n)) + + +static int checkfield (lua_State *L, const char *key, int n) { + lua_pushstring(L, key); + return (lua_rawget(L, -n) != LUA_TNIL); +} + + +/* +** Check that 'arg' either is a table or can behave like one (that is, +** has a metatable with the required metamethods) +*/ +static void checktab (lua_State *L, int arg, int what) { + if (lua_type(L, arg) != LUA_TTABLE) { /* is it not a table? */ + int n = 1; /* number of elements to pop */ + if (lua_getmetatable(L, arg) && /* must have metatable */ + (!(what & TAB_R) || checkfield(L, "__index", ++n)) && + (!(what & TAB_W) || checkfield(L, "__newindex", ++n)) && + (!(what & TAB_L) || checkfield(L, "__len", ++n))) { + lua_pop(L, n); /* pop metatable and tested metamethods */ + } + else + luaL_checktype(L, arg, LUA_TTABLE); /* force an error */ + } +} + + +#if defined(LUA_COMPAT_MAXN) +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} +#endif + + +static int tinsert (lua_State *L) { + lua_Integer e = aux_getn(L, 1, TAB_RW) + 1; /* first empty element */ + lua_Integer pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + lua_Integer i; + pos = luaL_checkinteger(L, 2); /* 2nd argument is the position */ + luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds"); + for (i = e; i > pos; i--) { /* move up elements */ + lua_geti(L, 1, i - 1); + lua_seti(L, 1, i); /* t[i] = t[i - 1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to 'insert'"); + } + } + lua_seti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + lua_Integer size = aux_getn(L, 1, TAB_RW); + lua_Integer pos = luaL_optinteger(L, 2, size); + if (pos != size) /* validate 'pos' if given */ + luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); + lua_geti(L, 1, pos); /* result = t[pos] */ + for ( ; pos < size; pos++) { + lua_geti(L, 1, pos + 1); + lua_seti(L, 1, pos); /* t[pos] = t[pos + 1] */ + } + lua_pushnil(L); + lua_seti(L, 1, pos); /* t[pos] = nil */ + return 1; +} + + +/* +** Copy elements (1[f], ..., 1[e]) into (tt[t], tt[t+1], ...). Whenever +** possible, copy in increasing order, which is better for rehashing. +** "possible" means destination after original range, or smaller +** than origin, or copying to another table. +*/ +static int tmove (lua_State *L) { + lua_Integer f = luaL_checkinteger(L, 2); + lua_Integer e = luaL_checkinteger(L, 3); + lua_Integer t = luaL_checkinteger(L, 4); + int tt = !lua_isnoneornil(L, 5) ? 5 : 1; /* destination table */ + checktab(L, 1, TAB_R); + checktab(L, tt, TAB_W); + if (e >= f) { /* otherwise, nothing to move */ + lua_Integer n, i; + luaL_argcheck(L, f > 0 || e < LUA_MAXINTEGER + f, 3, + "too many elements to move"); + n = e - f + 1; /* number of elements to move */ + luaL_argcheck(L, t <= LUA_MAXINTEGER - n + 1, 4, + "destination wrap around"); + if (t > e || t <= f || (tt != 1 && !lua_compare(L, 1, tt, LUA_OPEQ))) { + for (i = 0; i < n; i++) { + lua_geti(L, 1, f + i); + lua_seti(L, tt, t + i); + } + } + else { + for (i = n - 1; i >= 0; i--) { + lua_geti(L, 1, f + i); + lua_seti(L, tt, t + i); + } + } + } + lua_pushvalue(L, tt); /* return destination table */ + return 1; +} + + +static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) { + lua_geti(L, 1, i); + if (!lua_isstring(L, -1)) + luaL_error(L, "invalid value (%s) at index %d in table for 'concat'", + luaL_typename(L, -1), i); + luaL_addvalue(b); +} + + +static int tconcat (lua_State *L) { + luaL_Buffer b; + lua_Integer last = aux_getn(L, 1, TAB_R); + size_t lsep; + const char *sep = luaL_optlstring(L, 2, "", &lsep); + lua_Integer i = luaL_optinteger(L, 3, 1); + last = luaL_optinteger(L, 4, last); + luaL_buffinit(L, &b); + for (; i < last; i++) { + addfield(L, &b, i); + luaL_addlstring(&b, sep, lsep); + } + if (i == last) /* add last value (if interval was not empty) */ + addfield(L, &b, i); + luaL_pushresult(&b); + return 1; +} + + +/* +** {====================================================== +** Pack/unpack +** ======================================================= +*/ + +static int pack (lua_State *L) { + int i; + int n = lua_gettop(L); /* number of elements to pack */ + lua_createtable(L, n, 1); /* create result table */ + lua_insert(L, 1); /* put it at index 1 */ + for (i = n; i >= 1; i--) /* assign elements */ + lua_seti(L, 1, i); + lua_pushinteger(L, n); + lua_setfield(L, 1, "n"); /* t.n = number of elements */ + return 1; /* return table */ +} + + +static int unpack (lua_State *L) { + lua_Unsigned n; + lua_Integer i = luaL_optinteger(L, 2, 1); + lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); + if (i > e) return 0; /* empty range */ + n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ + if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n))) + return luaL_error(L, "too many results to unpack"); + for (; i < e; i++) { /* push arg[i..e - 1] (to avoid overflows) */ + lua_geti(L, 1, i); + } + lua_geti(L, 1, e); /* push last element */ + return (int)n; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** Quicksort +** (based on 'Algorithms in MODULA-3', Robert Sedgewick; +** Addison-Wesley, 1993.) +** ======================================================= +*/ + + +/* type for array indices */ +typedef unsigned int IdxT; + + +/* +** Produce a "random" 'unsigned int' to randomize pivot choice. This +** macro is used only when 'sort' detects a big imbalance in the result +** of a partition. (If you don't want/need this "randomness", ~0 is a +** good choice.) +*/ +#if !defined(l_randomizePivot) /* { */ + +#include + +/* size of 'e' measured in number of 'unsigned int's */ +#define sof(e) (sizeof(e) / sizeof(unsigned int)) + +/* +** Use 'time' and 'clock' as sources of "randomness". Because we don't +** know the types 'clock_t' and 'time_t', we cannot cast them to +** anything without risking overflows. A safe way to use their values +** is to copy them to an array of a known type and use the array values. +*/ +static unsigned int l_randomizePivot (void) { + clock_t c = clock(); + time_t t = time(NULL); + unsigned int buff[sof(c) + sof(t)]; + unsigned int i, rnd = 0; + memcpy(buff, &c, sof(c) * sizeof(unsigned int)); + memcpy(buff + sof(c), &t, sof(t) * sizeof(unsigned int)); + for (i = 0; i < sof(buff); i++) + rnd += buff[i]; + return rnd; +} + +#endif /* } */ + + +/* arrays larger than 'RANLIMIT' may use randomized pivots */ +#define RANLIMIT 100u + + +static void set2 (lua_State *L, IdxT i, IdxT j) { + lua_seti(L, 1, i); + lua_seti(L, 1, j); +} + + +/* +** Return true iff value at stack index 'a' is less than the value at +** index 'b' (according to the order of the sort). +*/ +static int sort_comp (lua_State *L, int a, int b) { + if (lua_isnil(L, 2)) /* no function? */ + return lua_compare(L, a, b, LUA_OPLT); /* a < b */ + else { /* function */ + int res; + lua_pushvalue(L, 2); /* push function */ + lua_pushvalue(L, a-1); /* -1 to compensate function */ + lua_pushvalue(L, b-2); /* -2 to compensate function and 'a' */ + lua_call(L, 2, 1); /* call function */ + res = lua_toboolean(L, -1); /* get result */ + lua_pop(L, 1); /* pop result */ + return res; + } +} + + +/* +** Does the partition: Pivot P is at the top of the stack. +** precondition: a[lo] <= P == a[up-1] <= a[up], +** so it only needs to do the partition from lo + 1 to up - 2. +** Pos-condition: a[lo .. i - 1] <= a[i] == P <= a[i + 1 .. up] +** returns 'i'. +*/ +static IdxT partition (lua_State *L, IdxT lo, IdxT up) { + IdxT i = lo; /* will be incremented before first use */ + IdxT j = up - 1; /* will be decremented before first use */ + /* loop invariant: a[lo .. i] <= P <= a[j .. up] */ + for (;;) { + /* next loop: repeat ++i while a[i] < P */ + while (lua_geti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i == up - 1) /* a[i] < P but a[up - 1] == P ?? */ + luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* after the loop, a[i] >= P and a[lo .. i - 1] < P */ + /* next loop: repeat --j while P < a[j] */ + while (lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j < i) /* j < i but a[j] > P ?? */ + luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[j] */ + } + /* after the loop, a[j] <= P and a[j + 1 .. up] >= P */ + if (j < i) { /* no elements out of place? */ + /* a[lo .. i - 1] <= P <= a[j + 1 .. i .. up] */ + lua_pop(L, 1); /* pop a[j] */ + /* swap pivot (a[up - 1]) with a[i] to satisfy pos-condition */ + set2(L, up - 1, i); + return i; + } + /* otherwise, swap a[i] - a[j] to restore invariant and repeat */ + set2(L, i, j); + } +} + + +/* +** Choose an element in the middle (2nd-3th quarters) of [lo,up] +** "randomized" by 'rnd' +*/ +static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) { + IdxT r4 = (up - lo) / 4; /* range/4 */ + IdxT p = rnd % (r4 * 2) + (lo + r4); + lua_assert(lo + r4 <= p && p <= up - r4); + return p; +} + + +/* +** QuickSort algorithm (recursive function) +*/ +static void auxsort (lua_State *L, IdxT lo, IdxT up, + unsigned int rnd) { + while (lo < up) { /* loop for tail recursion */ + IdxT p; /* Pivot index */ + IdxT n; /* to be used later */ + /* sort elements 'lo', 'p', and 'up' */ + lua_geti(L, 1, lo); + lua_geti(L, 1, up); + if (sort_comp(L, -1, -2)) /* a[up] < a[lo]? */ + set2(L, lo, up); /* swap a[lo] - a[up] */ + else + lua_pop(L, 2); /* remove both values */ + if (up - lo == 1) /* only 2 elements? */ + return; /* already sorted */ + if (up - lo < RANLIMIT || rnd == 0) /* small interval or no randomize? */ + p = (lo + up)/2; /* middle element is a good pivot */ + else /* for larger intervals, it is worth a random pivot */ + p = choosePivot(lo, up, rnd); + lua_geti(L, 1, p); + lua_geti(L, 1, lo); + if (sort_comp(L, -2, -1)) /* a[p] < a[lo]? */ + set2(L, p, lo); /* swap a[p] - a[lo] */ + else { + lua_pop(L, 1); /* remove a[lo] */ + lua_geti(L, 1, up); + if (sort_comp(L, -1, -2)) /* a[up] < a[p]? */ + set2(L, p, up); /* swap a[up] - a[p] */ + else + lua_pop(L, 2); + } + if (up - lo == 2) /* only 3 elements? */ + return; /* already sorted */ + lua_geti(L, 1, p); /* get middle element (Pivot) */ + lua_pushvalue(L, -1); /* push Pivot */ + lua_geti(L, 1, up - 1); /* push a[up - 1] */ + set2(L, p, up - 1); /* swap Pivot (a[p]) with a[up - 1] */ + p = partition(L, lo, up); + /* a[lo .. p - 1] <= a[p] == P <= a[p + 1 .. up] */ + if (p - lo < up - p) { /* lower interval is smaller? */ + auxsort(L, lo, p - 1, rnd); /* call recursively for lower interval */ + n = p - lo; /* size of smaller interval */ + lo = p + 1; /* tail call for [p + 1 .. up] (upper interval) */ + } + else { + auxsort(L, p + 1, up, rnd); /* call recursively for upper interval */ + n = up - p; /* size of smaller interval */ + up = p - 1; /* tail call for [lo .. p - 1] (lower interval) */ + } + if ((up - lo) / 128 > n) /* partition too imbalanced? */ + rnd = l_randomizePivot(); /* try a new randomization */ + } /* tail call auxsort(L, lo, up, rnd) */ +} + + +static int sort (lua_State *L) { + lua_Integer n = aux_getn(L, 1, TAB_RW); + if (n > 1) { /* non-trivial interval? */ + luaL_argcheck(L, n < INT_MAX, 1, "array too big"); + if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */ + luaL_checktype(L, 2, LUA_TFUNCTION); /* must be a function */ + lua_settop(L, 2); /* make sure there are two arguments */ + auxsort(L, 1, (IdxT)n, 0); + } + return 0; +} + +/* }====================================================== */ + + +static const luaL_Reg tab_funcs[] = { + {"concat", tconcat}, +#if defined(LUA_COMPAT_MAXN) + {"maxn", maxn}, +#endif + {"insert", tinsert}, + {"pack", pack}, + {"unpack", unpack}, + {"remove", tremove}, + {"move", tmove}, + {"sort", sort}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_table (lua_State *L) { + luaL_newlib(L, tab_funcs); +#if defined(LUA_COMPAT_UNPACK) + /* _G.unpack = table.unpack */ + lua_getfield(L, -1, "unpack"); + lua_setglobal(L, "unpack"); +#endif + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/ltm.c b/deps/rcheevos/test/lua/src/ltm.c new file mode 100644 index 0000000000..bc8f64eb31 --- /dev/null +++ b/deps/rcheevos/test/lua/src/ltm.c @@ -0,0 +1,165 @@ +/* +** $Id: ltm.c,v 2.38 2016/12/22 13:08:50 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#define ltm_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + +static const char udatatypename[] = "userdata"; + +LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = { + "no value", + "nil", "boolean", udatatypename, "number", + "string", "table", "function", udatatypename, "thread", + "proto" /* this last case is used for tests only */ +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__len", "__eq", + "__add", "__sub", "__mul", "__mod", "__pow", + "__div", "__idiv", + "__band", "__bor", "__bxor", "__shl", "__shr", + "__unm", "__bnot", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaC_fix(L, obj2gco(G(L)->tmname[i])); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getshortstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttnov(o)]; + } + return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + + +/* +** Return the name of the type of an object. For tables and userdata +** with metatable, use their '__name' metafield, if present. +*/ +const char *luaT_objtypename (lua_State *L, const TValue *o) { + Table *mt; + if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) || + (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) { + const TValue *name = luaH_getshortstr(mt, luaS_new(L, "__name")); + if (ttisstring(name)) /* is '__name' a string? */ + return getstr(tsvalue(name)); /* use it as type name */ + } + return ttypename(ttnov(o)); /* else use standard type name */ +} + + +void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, TValue *p3, int hasres) { + ptrdiff_t result = savestack(L, p3); + StkId func = L->top; + setobj2s(L, func, f); /* push function (assume EXTRC_STACK) */ + setobj2s(L, func + 1, p1); /* 1st argument */ + setobj2s(L, func + 2, p2); /* 2nd argument */ + L->top += 3; + if (!hasres) /* no result? 'p3' is third argument */ + setobj2s(L, L->top++, p3); /* 3rd argument */ + /* metamethod may yield only when called from Lua code */ + if (isLua(L->ci)) + luaD_call(L, func, hasres); + else + luaD_callnoyield(L, func, hasres); + if (hasres) { /* if has result, move it to its place */ + p3 = restorestack(L, result); + setobjs2s(L, p3, --L->top); + } +} + + +int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + luaT_callTM(L, tm, p1, p2, res, 1); + return 1; +} + + +void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + if (!luaT_callbinTM(L, p1, p2, res, event)) { + switch (event) { + case TM_CONCAT: + luaG_concaterror(L, p1, p2); + /* call never returns, but to avoid warnings: *//* FALLTHROUGH */ + case TM_BAND: case TM_BOR: case TM_BXOR: + case TM_SHL: case TM_SHR: case TM_BNOT: { + lua_Number dummy; + if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) + luaG_tointerror(L, p1, p2); + else + luaG_opinterror(L, p1, p2, "perform bitwise operation on"); + } + /* calls never return, but to avoid warnings: *//* FALLTHROUGH */ + default: + luaG_opinterror(L, p1, p2, "perform arithmetic on"); + } + } +} + + +int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + if (!luaT_callbinTM(L, p1, p2, L->top, event)) + return -1; /* no metamethod */ + else + return !l_isfalse(L->top); +} + diff --git a/deps/rcheevos/test/lua/src/ltm.h b/deps/rcheevos/test/lua/src/ltm.h new file mode 100644 index 0000000000..63db7269bb --- /dev/null +++ b/deps/rcheevos/test/lua/src/ltm.h @@ -0,0 +1,76 @@ +/* +** $Id: ltm.h,v 2.22 2016/02/26 19:20:15 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" and "ORDER OP" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_LEN, + TM_EQ, /* last tag method with fast access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_MOD, + TM_POW, + TM_DIV, + TM_IDIV, + TM_BAND, + TM_BOR, + TM_BXOR, + TM_SHL, + TM_SHR, + TM_UNM, + TM_BNOT, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +#define ttypename(x) luaT_typenames_[(x) + 1] + +LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; + + +LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o); + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, TValue *p3, int hasres); +LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event); +LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event); +LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, + const TValue *p2, TMS event); + + + +#endif diff --git a/deps/rcheevos/test/lua/src/lua.c b/deps/rcheevos/test/lua/src/lua.c new file mode 100644 index 0000000000..3f082da6be --- /dev/null +++ b/deps/rcheevos/test/lua/src/lua.c @@ -0,0 +1,612 @@ +/* +** $Id: lua.c,v 1.230 2017/01/12 17:14:26 roberto Exp $ +** Lua stand-alone interpreter +** See Copyright Notice in lua.h +*/ + +#define lua_c + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#if !defined(LUA_PROMPT) +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " +#endif + +#if !defined(LUA_PROGNAME) +#define LUA_PROGNAME "lua" +#endif + +#if !defined(LUA_MAXINPUT) +#define LUA_MAXINPUT 512 +#endif + +#if !defined(LUA_INIT_VAR) +#define LUA_INIT_VAR "LUA_INIT" +#endif + +#define LUA_INITVARVERSION LUA_INIT_VAR LUA_VERSUFFIX + + +/* +** lua_stdin_is_tty detects whether the standard input is a 'tty' (that +** is, whether we're running lua interactively). +*/ +#if !defined(lua_stdin_is_tty) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#include +#define lua_stdin_is_tty() isatty(0) + +#elif defined(LUA_USE_WINDOWS) /* }{ */ + +#include +#include + +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) + +#else /* }{ */ + +/* ISO C definition */ +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ + +#endif /* } */ + +#endif /* } */ + + +/* +** lua_readline defines how to show a prompt and then read a line from +** the standard input. +** lua_saveline defines how to "save" a read line in a "history". +** lua_freeline defines how to free a line read by lua_readline. +*/ +#if !defined(lua_readline) /* { */ + +#if defined(LUA_USE_READLINE) /* { */ + +#include +#include +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,line) ((void)L, add_history(line)) +#define lua_freeline(L,b) ((void)L, free(b)) + +#else /* }{ */ + +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,line) { (void)L; (void)line; } +#define lua_freeline(L,b) { (void)L; (void)b; } + +#endif /* } */ + +#endif /* } */ + + + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; + + +/* +** Hook set by signal function to stop the interpreter. +*/ +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); /* reset hook */ + luaL_error(L, "interrupted!"); +} + + +/* +** Function to be called at a C signal. Because a C signal cannot +** just change a Lua state (as there is no proper synchronization), +** this function only sets a hook that, when called, will stop the +** interpreter. +*/ +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens, terminate process */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void print_usage (const char *badoption) { + lua_writestringerror("%s: ", progname); + if (badoption[1] == 'e' || badoption[1] == 'l') + lua_writestringerror("'%s' needs argument\n", badoption); + else + lua_writestringerror("unrecognized option '%s'\n", badoption); + lua_writestringerror( + "usage: %s [options] [script [args]]\n" + "Available options are:\n" + " -e stat execute string 'stat'\n" + " -i enter interactive mode after executing 'script'\n" + " -l name require library 'name'\n" + " -v show version information\n" + " -E ignore environment variables\n" + " -- stop handling options\n" + " - stop handling options and execute stdin\n" + , + progname); +} + + +/* +** Prints an error message, adding the program name in front of it +** (if present) +*/ +static void l_message (const char *pname, const char *msg) { + if (pname) lua_writestringerror("%s: ", pname); + lua_writestringerror("%s\n", msg); +} + + +/* +** Check whether 'status' is not OK and, if so, prints the error +** message on the top of the stack. It assumes that the error object +** is a string, as it was either generated by Lua or by 'msghandler'. +*/ +static int report (lua_State *L, int status) { + if (status != LUA_OK) { + const char *msg = lua_tostring(L, -1); + l_message(progname, msg); + lua_pop(L, 1); /* remove message */ + } + return status; +} + + +/* +** Message handler used to run all chunks +*/ +static int msghandler (lua_State *L) { + const char *msg = lua_tostring(L, 1); + if (msg == NULL) { /* is error object not a string? */ + if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ + lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ + return 1; /* that is the message */ + else + msg = lua_pushfstring(L, "(error object is a %s value)", + luaL_typename(L, 1)); + } + luaL_traceback(L, L, msg, 1); /* append a standard traceback */ + return 1; /* return the traceback */ +} + + +/* +** Interface to 'lua_pcall', which sets appropriate message function +** and C-signal handler. Used to run all chunks. +*/ +static int docall (lua_State *L, int narg, int nres) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, msghandler); /* push message handler */ + lua_insert(L, base); /* put it under function and args */ + globalL = L; /* to be available to 'laction' */ + signal(SIGINT, laction); /* set C-signal handler */ + status = lua_pcall(L, narg, nres, base); + signal(SIGINT, SIG_DFL); /* reset C-signal handler */ + lua_remove(L, base); /* remove message handler from the stack */ + return status; +} + + +static void print_version (void) { + lua_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT)); + lua_writeline(); +} + + +/* +** Create the 'arg' table, which stores all arguments from the +** command line ('argv'). It should be aligned so that, at index 0, +** it has 'argv[script]', which is the script name. The arguments +** to the script (everything after 'script') go to positive indices; +** other arguments (before the script name) go to negative indices. +** If there is no script name, assume interpreter's name as base. +*/ +static void createargtable (lua_State *L, char **argv, int argc, int script) { + int i, narg; + if (script == argc) script = 0; /* no script name? */ + narg = argc - (script + 1); /* number of positive indices */ + lua_createtable(L, narg, script + 1); + for (i = 0; i < argc; i++) { + lua_pushstring(L, argv[i]); + lua_rawseti(L, -2, i - script); + } + lua_setglobal(L, "arg"); +} + + +static int dochunk (lua_State *L, int status) { + if (status == LUA_OK) status = docall(L, 0, 0); + return report(L, status); +} + + +static int dofile (lua_State *L, const char *name) { + return dochunk(L, luaL_loadfile(L, name)); +} + + +static int dostring (lua_State *L, const char *s, const char *name) { + return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name)); +} + + +/* +** Calls 'require(name)' and stores the result in a global variable +** with the given name. +*/ +static int dolibrary (lua_State *L, const char *name) { + int status; + lua_getglobal(L, "require"); + lua_pushstring(L, name); + status = docall(L, 1, 1); /* call 'require(name)' */ + if (status == LUA_OK) + lua_setglobal(L, name); /* global[name] = require return */ + return report(L, status); +} + + +/* +** Returns the string to be used as a prompt by the interpreter. +*/ +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + return p; +} + +/* mark in error messages for incomplete statements */ +#define EOFMARK "" +#define marklen (sizeof(EOFMARK)/sizeof(char) - 1) + + +/* +** Check whether 'status' signals a syntax error and the error +** message at the top of the stack ends with the above mark for +** incomplete statements. +*/ +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +/* +** Prompt the user, read a line, and push it into the Lua stack. +*/ +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + int readstatus = lua_readline(L, b, prmt); + if (readstatus == 0) + return 0; /* no input (prompt will be popped by caller) */ + lua_pop(L, 1); /* remove prompt */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[--l] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ + lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ + else + lua_pushlstring(L, b, l); + lua_freeline(L, b); + return 1; +} + + +/* +** Try to compile line on the stack as 'return ;'; on return, stack +** has either compiled chunk or original line (if compilation failed). +*/ +static int addreturn (lua_State *L) { + const char *line = lua_tostring(L, -1); /* original line */ + const char *retline = lua_pushfstring(L, "return %s;", line); + int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin"); + if (status == LUA_OK) { + lua_remove(L, -2); /* remove modified line */ + if (line[0] != '\0') /* non empty? */ + lua_saveline(L, line); /* keep history */ + } + else + lua_pop(L, 2); /* pop result from 'luaL_loadbuffer' and modified line */ + return status; +} + + +/* +** Read multiple lines until a complete Lua statement +*/ +static int multiline (lua_State *L) { + for (;;) { /* repeat until gets a complete statement */ + size_t len; + const char *line = lua_tolstring(L, 1, &len); /* get what it has */ + int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ + if (!incomplete(L, status) || !pushline(L, 0)) { + lua_saveline(L, line); /* keep history */ + return status; /* cannot or should not try to add continuation line */ + } + lua_pushliteral(L, "\n"); /* add newline... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } +} + + +/* +** Read a line and try to load (compile) it first as an expression (by +** adding "return " in front of it) and second as a statement. Return +** the final status of load/call with the resulting function (if any) +** in the top of the stack. +*/ +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */ + status = multiline(L); /* try as command, maybe with continuation lines */ + lua_remove(L, 1); /* remove line from the stack */ + lua_assert(lua_gettop(L) == 1); + return status; +} + + +/* +** Prints (calling the Lua 'print' function) any values on the stack +*/ +static void l_print (lua_State *L) { + int n = lua_gettop(L); + if (n > 0) { /* any result to be printed? */ + luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, n, 0, 0) != LUA_OK) + l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", + lua_tostring(L, -1))); + } +} + + +/* +** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and +** print any results. +*/ +static void doREPL (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; /* no 'progname' on errors in interactive mode */ + while ((status = loadline(L)) != -1) { + if (status == LUA_OK) + status = docall(L, 0, LUA_MULTRET); + if (status == LUA_OK) l_print(L); + else report(L, status); + } + lua_settop(L, 0); /* clear stack */ + lua_writeline(); + progname = oldprogname; +} + + +/* +** Push on the stack the contents of table 'arg' from 1 to #arg +*/ +static int pushargs (lua_State *L) { + int i, n; + if (lua_getglobal(L, "arg") != LUA_TTABLE) + luaL_error(L, "'arg' is not a table"); + n = (int)luaL_len(L, -1); + luaL_checkstack(L, n + 3, "too many arguments to script"); + for (i = 1; i <= n; i++) + lua_rawgeti(L, -i, i); + lua_remove(L, -i); /* remove table from the stack */ + return n; +} + + +static int handle_script (lua_State *L, char **argv) { + int status; + const char *fname = argv[0]; + if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + if (status == LUA_OK) { + int n = pushargs(L); /* push arguments to script */ + status = docall(L, n, LUA_MULTRET); + } + return report(L, status); +} + + + +/* bits of various argument indicators in 'args' */ +#define has_error 1 /* bad option */ +#define has_i 2 /* -i */ +#define has_v 4 /* -v */ +#define has_e 8 /* -e */ +#define has_E 16 /* -E */ + +/* +** Traverses all arguments from 'argv', returning a mask with those +** needed before running any Lua code (or an error code if it finds +** any invalid argument). 'first' returns the first not-handled argument +** (either the script name or a bad argument in case of error). +*/ +static int collectargs (char **argv, int *first) { + int args = 0; + int i; + for (i = 1; argv[i] != NULL; i++) { + *first = i; + if (argv[i][0] != '-') /* not an option? */ + return args; /* stop handling options */ + switch (argv[i][1]) { /* else check option */ + case '-': /* '--' */ + if (argv[i][2] != '\0') /* extra characters after '--'? */ + return has_error; /* invalid option */ + *first = i + 1; + return args; + case '\0': /* '-' */ + return args; /* script "name" is '-' */ + case 'E': + if (argv[i][2] != '\0') /* extra characters after 1st? */ + return has_error; /* invalid option */ + args |= has_E; + break; + case 'i': + args |= has_i; /* (-i implies -v) *//* FALLTHROUGH */ + case 'v': + if (argv[i][2] != '\0') /* extra characters after 1st? */ + return has_error; /* invalid option */ + args |= has_v; + break; + case 'e': + args |= has_e; /* FALLTHROUGH */ + case 'l': /* both options need an argument */ + if (argv[i][2] == '\0') { /* no concatenated argument? */ + i++; /* try next 'argv' */ + if (argv[i] == NULL || argv[i][0] == '-') + return has_error; /* no next argument or it is another option */ + } + break; + default: /* invalid option */ + return has_error; + } + } + *first = i; /* no script name */ + return args; +} + + +/* +** Processes options 'e' and 'l', which involve running Lua code. +** Returns 0 if some code raises an error. +*/ +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + int option = argv[i][1]; + lua_assert(argv[i][0] == '-'); /* already checked */ + if (option == 'e' || option == 'l') { + int status; + const char *extra = argv[i] + 2; /* both options need an argument */ + if (*extra == '\0') extra = argv[++i]; + lua_assert(extra != NULL); + status = (option == 'e') + ? dostring(L, extra, "=(command line)") + : dolibrary(L, extra); + if (status != LUA_OK) return 0; + } + } + return 1; +} + + + +static int handle_luainit (lua_State *L) { + const char *name = "=" LUA_INITVARVERSION; + const char *init = getenv(name + 1); + if (init == NULL) { + name = "=" LUA_INIT_VAR; + init = getenv(name + 1); /* try alternative name */ + } + if (init == NULL) return LUA_OK; + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, name); +} + + +/* +** Main body of stand-alone interpreter (to be called in protected mode). +** Reads the options and handles them all. +*/ +static int pmain (lua_State *L) { + int argc = (int)lua_tointeger(L, 1); + char **argv = (char **)lua_touserdata(L, 2); + int script; + int args = collectargs(argv, &script); + luaL_checkversion(L); /* check that interpreter has correct version */ + if (argv[0] && argv[0][0]) progname = argv[0]; + if (args == has_error) { /* bad arg? */ + print_usage(argv[script]); /* 'script' has index of bad arg. */ + return 0; + } + if (args & has_v) /* option '-v'? */ + print_version(); + if (args & has_E) { /* option '-E'? */ + lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */ + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); + } + luaL_openlibs(L); /* open standard libraries */ + createargtable(L, argv, argc, script); /* create table 'arg' */ + if (!(args & has_E)) { /* no option '-E'? */ + if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ + return 0; /* error running LUA_INIT */ + } + if (!runargs(L, argv, script)) /* execute arguments -e and -l */ + return 0; /* something failed */ + if (script < argc && /* execute main script (if there is one) */ + handle_script(L, argv + script) != LUA_OK) + return 0; + if (args & has_i) /* -i option? */ + doREPL(L); /* do read-eval-print loop */ + else if (script == argc && !(args & (has_e | has_v))) { /* no arguments? */ + if (lua_stdin_is_tty()) { /* running in interactive mode? */ + print_version(); + doREPL(L); /* do read-eval-print loop */ + } + else dofile(L, NULL); /* executes stdin as a file */ + } + lua_pushboolean(L, 1); /* signal no errors */ + return 1; +} + + +int main (int argc, char **argv) { + int status, result; + lua_State *L = luaL_newstate(); /* create state */ + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); + return EXIT_FAILURE; + } + lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ + lua_pushinteger(L, argc); /* 1st argument */ + lua_pushlightuserdata(L, argv); /* 2nd argument */ + status = lua_pcall(L, 2, 1, 0); /* do the call */ + result = lua_toboolean(L, -1); /* get result */ + report(L, status); + lua_close(L); + return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE; +} + diff --git a/deps/rcheevos/test/lua/src/lua.h b/deps/rcheevos/test/lua/src/lua.h new file mode 100644 index 0000000000..26c0e2d698 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lua.h @@ -0,0 +1,486 @@ +/* +** $Id: lua.h,v 1.332 2016/12/22 15:51:20 roberto Exp $ +** Lua - A Scripting Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION_MAJOR "5" +#define LUA_VERSION_MINOR "3" +#define LUA_VERSION_NUM 503 +#define LUA_VERSION_RELEASE "4" + +#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2017 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" + + +/* mark for precompiled code ('Lua') */ +#define LUA_SIGNATURE "\x1bLua" + +/* option for multiple returns in 'lua_pcall' and 'lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** Pseudo-indices +** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty +** space after that to help overflow detection) +*/ +#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) +#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) + + +/* thread status */ +#define LUA_OK 0 +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRGCMM 5 +#define LUA_ERRERR 6 + + +typedef struct lua_State lua_State; + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + +#define LUA_NUMTAGS 9 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* predefined values in the registry */ +#define LUA_RIDX_MAINTHREAD 1 +#define LUA_RIDX_GLOBALS 2 +#define LUA_RIDX_LAST LUA_RIDX_GLOBALS + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + +/* unsigned integer type */ +typedef LUA_UNSIGNED lua_Unsigned; + +/* type for continuation-function contexts */ +typedef LUA_KCONTEXT lua_KContext; + + +/* +** Type for C functions registered with Lua +*/ +typedef int (*lua_CFunction) (lua_State *L); + +/* +** Type for continuation functions +*/ +typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); + + +/* +** Type for functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); + + +/* +** Type for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* +** RCS ident string +*/ +extern const char lua_ident[]; + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +LUA_API const lua_Number *(lua_version) (lua_State *L); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_absindex) (lua_State *L, int idx); +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_rotate) (lua_State *L, int idx, int n); +LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); +LUA_API int (lua_checkstack) (lua_State *L, int n); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isinteger) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); +LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_rawlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** Comparison and arithmetic functions +*/ + +#define LUA_OPADD 0 /* ORDER TM, ORDER OP */ +#define LUA_OPSUB 1 +#define LUA_OPMUL 2 +#define LUA_OPMOD 3 +#define LUA_OPPOW 4 +#define LUA_OPDIV 5 +#define LUA_OPIDIV 6 +#define LUA_OPBAND 7 +#define LUA_OPBOR 8 +#define LUA_OPBXOR 9 +#define LUA_OPSHL 10 +#define LUA_OPSHR 11 +#define LUA_OPUNM 12 +#define LUA_OPBNOT 13 + +LUA_API void (lua_arith) (lua_State *L, int op); + +#define LUA_OPEQ 0 +#define LUA_OPLT 1 +#define LUA_OPLE 2 + +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); +LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API int (lua_getglobal) (lua_State *L, const char *name); +LUA_API int (lua_gettable) (lua_State *L, int idx); +LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n); +LUA_API int (lua_rawget) (lua_State *L, int idx); +LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); +LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); + +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API int (lua_getuservalue) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_setglobal) (lua_State *L, const char *name); +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_seti) (lua_State *L, int idx, lua_Integer n); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); +LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API void (lua_setuservalue) (lua_State *L, int idx); + + +/* +** 'load' and 'call' functions (load and run Lua code) +*/ +LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, + lua_KContext ctx, lua_KFunction k); +#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) + +LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, + lua_KContext ctx, lua_KFunction k); +#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) + +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname, const char *mode); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, + lua_KFunction k); +LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); +LUA_API int (lua_status) (lua_State *L); +LUA_API int (lua_isyieldable) (lua_State *L); + +#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) + + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 +#define LUA_GCISRUNNING 9 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); +LUA_API void (lua_len) (lua_State *L, int idx); + +LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** {============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE)) + +#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) +#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) lua_pushstring(L, "" s) + +#define lua_pushglobaltable(L) \ + ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + +#define lua_insert(L,idx) lua_rotate(L, (idx), 1) + +#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1)) + +#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1)) + +/* }============================================================== */ + + +/* +** {============================================================== +** compatibility macros for unsigned conversions +** =============================================================== +*/ +#if defined(LUA_COMPAT_APIINTCASTS) + +#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) +#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is)) +#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) + +#endif +/* }============================================================== */ + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILCALL 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debugger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); +LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n); +LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); + +LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); +LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, + int fidx2, int n2); + +LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook (lua_gethook) (lua_State *L); +LUA_API int (lua_gethookmask) (lua_State *L); +LUA_API int (lua_gethookcount) (lua_State *L); + + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ + const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + unsigned char nups; /* (u) number of upvalues */ + unsigned char nparams;/* (u) number of parameters */ + char isvararg; /* (u) */ + char istailcall; /* (t) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + struct CallInfo *i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2017 Lua.org, PUC-Rio. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/deps/rcheevos/test/lua/src/lua.hpp b/deps/rcheevos/test/lua/src/lua.hpp new file mode 100644 index 0000000000..ec417f5946 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lua.hpp @@ -0,0 +1,9 @@ +// lua.hpp +// Lua header files for C++ +// <> not supplied automatically because Lua also compiles as C++ + +extern "C" { +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" +} diff --git a/deps/rcheevos/test/lua/src/luac.c b/deps/rcheevos/test/lua/src/luac.c new file mode 100644 index 0000000000..c0c91d017a --- /dev/null +++ b/deps/rcheevos/test/lua/src/luac.c @@ -0,0 +1,449 @@ +/* +** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $ +** Lua compiler (saves bytecodes to files; also lists bytecodes) +** See Copyright Notice in lua.h +*/ + +#define luac_c +#define LUA_CORE + +#include "lprefix.h" + +#include +#include +#include +#include +#include + +#include "lua.h" +#include "lauxlib.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +static void PrintFunction(const Proto* f, int full); +#define luaU_print PrintFunction + +#define PROGNAME "luac" /* default program name */ +#define OUTPUT PROGNAME ".out" /* default output file */ + +static int listing=0; /* list bytecodes? */ +static int dumping=1; /* dump bytecodes? */ +static int stripping=0; /* strip debug information? */ +static char Output[]={ OUTPUT }; /* default output file name */ +static const char* output=Output; /* actual output file name */ +static const char* progname=PROGNAME; /* actual program name */ + +static void fatal(const char* message) +{ + fprintf(stderr,"%s: %s\n",progname,message); + exit(EXIT_FAILURE); +} + +static void cannot(const char* what) +{ + fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); + exit(EXIT_FAILURE); +} + +static void usage(const char* message) +{ + if (*message=='-') + fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); + else + fprintf(stderr,"%s: %s\n",progname,message); + fprintf(stderr, + "usage: %s [options] [filenames]\n" + "Available options are:\n" + " -l list (use -l -l for full listing)\n" + " -o name output to file 'name' (default is \"%s\")\n" + " -p parse only\n" + " -s strip debug information\n" + " -v show version information\n" + " -- stop handling options\n" + " - stop handling options and process stdin\n" + ,progname,Output); + exit(EXIT_FAILURE); +} + +#define IS(s) (strcmp(argv[i],s)==0) + +static int doargs(int argc, char* argv[]) +{ + int i; + int version=0; + if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; + for (i=1; itop+(i)) + +static const Proto* combine(lua_State* L, int n) +{ + if (n==1) + return toproto(L,-1); + else + { + Proto* f; + int i=n; + if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1)); + f=toproto(L,-1); + for (i=0; ip[i]=toproto(L,i-n-1); + if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0; + } + f->sizelineinfo=0; + return f; + } +} + +static int writer(lua_State* L, const void* p, size_t size, void* u) +{ + UNUSED(L); + return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); +} + +static int pmain(lua_State* L) +{ + int argc=(int)lua_tointeger(L,1); + char** argv=(char**)lua_touserdata(L,2); + const Proto* f; + int i; + if (!lua_checkstack(L,argc)) fatal("too many input files"); + for (i=0; i1); + if (dumping) + { + FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); + if (D==NULL) cannot("open"); + lua_lock(L); + luaU_dump(L,f,writer,D,stripping); + lua_unlock(L); + if (ferror(D)) cannot("write"); + if (fclose(D)) cannot("close"); + } + return 0; +} + +int main(int argc, char* argv[]) +{ + lua_State* L; + int i=doargs(argc,argv); + argc-=i; argv+=i; + if (argc<=0) usage("no input files given"); + L=luaL_newstate(); + if (L==NULL) fatal("cannot create state: not enough memory"); + lua_pushcfunction(L,&pmain); + lua_pushinteger(L,argc); + lua_pushlightuserdata(L,argv); + if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1)); + lua_close(L); + return EXIT_SUCCESS; +} + +/* +** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include +#include + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" + +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=tsslen(ts); + printf("%c",'"'); + for (i=0; ik[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMFLT: + { + char buff[100]; + sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); + printf("%s",buff); + if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); + break; + } + case LUA_TNUMINT: + printf(LUA_INTEGER_FMT,ivalue(o)); + break; + case LUA_TSHRSTR: case LUA_TLNGSTR: + PrintString(tsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") +#define MYK(x) (-1-(x)) + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (MYK(INDEXK(b))) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (MYK(INDEXK(c))) : c); + break; + case iABx: + printf("%d",a); + if (getBMode(o)==OpArgK) printf(" %d",MYK(bx)); + if (getBMode(o)==OpArgU) printf(" %d",bx); + break; + case iAsBx: + printf("%d %d",a,sbx); + break; + case iAx: + printf("%d",MYK(ax)); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s",UPVALNAME(b)); + break; + case OP_GETTABUP: + printf("\t; %s",UPVALNAME(b)); + if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABUP: + printf("\t; %s",UPVALNAME(a)); + if (ISK(b)) { printf(" "); PrintConstant(f,INDEXK(b)); } + if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_POW: + case OP_DIV: + case OP_IDIV: + case OP_BAND: + case OP_BOR: + case OP_BXOR: + case OP_SHL: + case OP_SHR: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + case OP_TFORLOOP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); else printf("\t; %d",c); + break; + case OP_EXTRAARG: + printf("\t; "); PrintConstant(f,ax); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) ((x==1)?"":"s") +#define S(x) (int)(x),SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=f->source ? getstr(f->source) : "=?"; + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->sizeupvalues)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintDebug(const Proto* f) +{ + int i,n; + n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } + n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + for (i=0; iupvalues[i].instack,f->upvalues[i].idx); + } +} + +static void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) PrintDebug(f); + for (i=0; ip[i],full); +} diff --git a/deps/rcheevos/test/lua/src/luaconf.h b/deps/rcheevos/test/lua/src/luaconf.h new file mode 100644 index 0000000000..f37bea0964 --- /dev/null +++ b/deps/rcheevos/test/lua/src/luaconf.h @@ -0,0 +1,783 @@ +/* +** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef luaconf_h +#define luaconf_h + +#include +#include + + +/* +** =================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +** {==================================================================== +** System Configuration: macros to adapt (if needed) Lua to some +** particular platform, for instance compiling it with 32-bit numbers or +** restricting it to C89. +** ===================================================================== +*/ + +/* +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You +** can also define LUA_32BITS in the make file, but changing here you +** ensure that all software connected to Lua will be compiled with the +** same configuration. +*/ +/* #define LUA_32BITS */ + + +/* +@@ LUA_USE_C89 controls the use of non-ISO-C89 features. +** Define it if you want Lua to avoid the use of a few C99 features +** or Windows-specific features on Windows. +*/ +/* #define LUA_USE_C89 */ + + +/* +** By default, Lua on Windows use (some) specific Windows features +*/ +#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) +#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ +#endif + + +#if defined(LUA_USE_WINDOWS) +#define LUA_DL_DLL /* enable support for DLL */ +#define LUA_USE_C89 /* broadly, Windows is C89 */ +#endif + + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ +#define LUA_USE_READLINE /* needs an extra library: -lreadline */ +#endif + + +/* +@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for +** C89 ('long' and 'double'); Windows always has '__int64', so it does +** not need to use this case. +*/ +#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) +#define LUA_C89_NUMBERS +#endif + + + +/* +@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. +*/ +/* avoid undefined shifts */ +#if ((INT_MAX >> 15) >> 15) >= 1 +#define LUAI_BITSINT 32 +#else +/* 'int' always must have at least 16 bits */ +#define LUAI_BITSINT 16 +#endif + + +/* +@@ LUA_INT_TYPE defines the type for Lua integers. +@@ LUA_FLOAT_TYPE defines the type for Lua floats. +** Lua should work fine with any mix of these options (if supported +** by your C compiler). The usual configurations are 64-bit integers +** and 'double' (the default), 32-bit integers and 'float' (for +** restricted platforms), and 'long'/'double' (for C compilers not +** compliant with C99, which may not have support for 'long long'). +*/ + +/* predefined options for LUA_INT_TYPE */ +#define LUA_INT_INT 1 +#define LUA_INT_LONG 2 +#define LUA_INT_LONGLONG 3 + +/* predefined options for LUA_FLOAT_TYPE */ +#define LUA_FLOAT_FLOAT 1 +#define LUA_FLOAT_DOUBLE 2 +#define LUA_FLOAT_LONGDOUBLE 3 + +#if defined(LUA_32BITS) /* { */ +/* +** 32-bit integers and 'float' +*/ +#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ +#define LUA_INT_TYPE LUA_INT_INT +#else /* otherwise use 'long' */ +#define LUA_INT_TYPE LUA_INT_LONG +#endif +#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT + +#elif defined(LUA_C89_NUMBERS) /* }{ */ +/* +** largest types available for C89 ('long' and 'double') +*/ +#define LUA_INT_TYPE LUA_INT_LONG +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE + +#endif /* } */ + + +/* +** default configuration for 64-bit Lua ('long long' and 'double') +*/ +#if !defined(LUA_INT_TYPE) +#define LUA_INT_TYPE LUA_INT_LONGLONG +#endif + +#if !defined(LUA_FLOAT_TYPE) +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE +#endif + +/* }================================================================== */ + + + + +/* +** {================================================================== +** Configuration for Paths. +** =================================================================== +*/ + +/* +** LUA_PATH_SEP is the character that separates templates in a path. +** LUA_PATH_MARK is the string that marks the substitution points in a +** template. +** LUA_EXEC_DIR in a Windows path is replaced by the executable's +** directory. +*/ +#define LUA_PATH_SEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXEC_DIR "!" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +** Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +** C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#if defined(_WIN32) /* { */ +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ + LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ + ".\\?.lua;" ".\\?\\init.lua" +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.dll;" \ + LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ + LUA_CDIR"loadall.dll;" ".\\?.dll" + +#else /* }{ */ + +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" +#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ + "./?.lua;" "./?/init.lua" +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" +#endif /* } */ + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Marks for exported symbols in the C code +** =================================================================== +*/ + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all auxiliary library functions. +@@ LUAMOD_API is a mark for all standard library opening functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) /* { */ + +#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +#define LUA_API __declspec(dllexport) +#else /* }{ */ +#define LUA_API __declspec(dllimport) +#endif /* } */ + +#else /* }{ */ + +#define LUA_API extern + +#endif /* } */ + + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API +#define LUAMOD_API LUALIB_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +** exported to outside modules. +@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables +** that are not to be exported to outside modules (LUAI_DDEF for +** definitions and LUAI_DDEC for declarations). +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. Not all elf targets support +** this attribute. Unfortunately, gcc does not offer a way to check +** whether the target offers that support, and those without support +** give a warning about it. To avoid these warnings, change to the +** default definition. +*/ +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) /* { */ +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#else /* }{ */ +#define LUAI_FUNC extern +#endif /* } */ + +#define LUAI_DDEC LUAI_FUNC +#define LUAI_DDEF /* empty */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Compatibility with previous versions +** =================================================================== +*/ + +/* +@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. +@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. +** You can define it to get all options, or change specific options +** to fit your specific needs. +*/ +#if defined(LUA_COMPAT_5_2) /* { */ + +/* +@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated +** functions in the mathematical library. +*/ +#define LUA_COMPAT_MATHLIB + +/* +@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. +*/ +#define LUA_COMPAT_BITLIB + +/* +@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. +*/ +#define LUA_COMPAT_IPAIRS + +/* +@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for +** manipulating other integer types (lua_pushunsigned, lua_tounsigned, +** luaL_checkint, luaL_checklong, etc.) +*/ +#define LUA_COMPAT_APIINTCASTS + +#endif /* } */ + + +#if defined(LUA_COMPAT_5_1) /* { */ + +/* Incompatibilities from 5.2 -> 5.3 */ +#define LUA_COMPAT_MATHLIB +#define LUA_COMPAT_APIINTCASTS + +/* +@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. +** You can replace it with 'table.unpack'. +*/ +#define LUA_COMPAT_UNPACK + +/* +@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. +** You can replace it with 'package.searchers'. +*/ +#define LUA_COMPAT_LOADERS + +/* +@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. +** You can call your C function directly (with light C functions). +*/ +#define lua_cpcall(L,f,u) \ + (lua_pushcfunction(L, (f)), \ + lua_pushlightuserdata(L,(u)), \ + lua_pcall(L,1,0,0)) + + +/* +@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. +** You can rewrite 'log10(x)' as 'log(x, 10)'. +*/ +#define LUA_COMPAT_LOG10 + +/* +@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base +** library. You can rewrite 'loadstring(s)' as 'load(s)'. +*/ +#define LUA_COMPAT_LOADSTRING + +/* +@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. +*/ +#define LUA_COMPAT_MAXN + +/* +@@ The following macros supply trivial compatibility for some +** changes in the API. The macros themselves document how to +** change your code to avoid using them. +*/ +#define lua_strlen(L,i) lua_rawlen(L, (i)) + +#define lua_objlen(L,i) lua_rawlen(L, (i)) + +#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) + +/* +@@ LUA_COMPAT_MODULE controls compatibility with previous +** module functions 'module' (Lua) and 'luaL_register' (C). +*/ +#define LUA_COMPAT_MODULE + +#endif /* } */ + + +/* +@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a +@@ a float mark ('.0'). +** This macro is not on by default even in compatibility mode, +** because this is not really an incompatibility. +*/ +/* #define LUA_COMPAT_FLOATSTRING */ + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Numbers. +** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* +** satisfy your needs. +** =================================================================== +*/ + +/* +@@ LUA_NUMBER is the floating-point type used by Lua. +@@ LUAI_UACNUMBER is the result of a 'default argument promotion' +@@ over a floating number. +@@ l_mathlim(x) corrects limit name 'x' to the proper float type +** by prefixing it with one of FLT/DBL/LDBL. +@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. +@@ LUA_NUMBER_FMT is the format for writing floats. +@@ lua_number2str converts a float to a string. +@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. +@@ l_floor takes the floor of a float. +@@ lua_str2number converts a decimal numeric string to a number. +*/ + + +/* The following definitions are good for most cases here */ + +#define l_floor(x) (l_mathop(floor)(x)) + +#define lua_number2str(s,sz,n) \ + l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) + +/* +@@ lua_numbertointeger converts a float number to an integer, or +** returns 0 if float is not within the range of a lua_Integer. +** (The range comparisons are tricky because of rounding. The tests +** here assume a two-complement representation, where MININTEGER always +** has an exact representation as a float; MAXINTEGER may not have one, +** and therefore its conversion to float may have an ill-defined value.) +*/ +#define lua_numbertointeger(n,p) \ + ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ + (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ + (*(p) = (LUA_INTEGER)(n), 1)) + + +/* now the variable definitions */ + +#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ + +#define LUA_NUMBER float + +#define l_mathlim(n) (FLT_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.7g" + +#define l_mathop(op) op##f + +#define lua_str2number(s,p) strtof((s), (p)) + + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ + +#define LUA_NUMBER long double + +#define l_mathlim(n) (LDBL_##n) + +#define LUAI_UACNUMBER long double + +#define LUA_NUMBER_FRMLEN "L" +#define LUA_NUMBER_FMT "%.19Lg" + +#define l_mathop(op) op##l + +#define lua_str2number(s,p) strtold((s), (p)) + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ + +#define LUA_NUMBER double + +#define l_mathlim(n) (DBL_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.14g" + +#define l_mathop(op) op + +#define lua_str2number(s,p) strtod((s), (p)) + +#else /* }{ */ + +#error "numeric float type not defined" + +#endif /* } */ + + + +/* +@@ LUA_INTEGER is the integer type used by Lua. +** +@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. +** +@@ LUAI_UACINT is the result of a 'default argument promotion' +@@ over a lUA_INTEGER. +@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. +@@ LUA_INTEGER_FMT is the format for writing integers. +@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. +@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. +@@ lua_integer2str converts an integer to a string. +*/ + + +/* The following definitions are good for most cases here */ + +#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" + +#define LUAI_UACINT LUA_INTEGER + +#define lua_integer2str(s,sz,n) \ + l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) + +/* +** use LUAI_UACINT here to avoid problems with promotions (which +** can turn a comparison between unsigneds into a signed comparison) +*/ +#define LUA_UNSIGNED unsigned LUAI_UACINT + + +/* now the variable definitions */ + +#if LUA_INT_TYPE == LUA_INT_INT /* { int */ + +#define LUA_INTEGER int +#define LUA_INTEGER_FRMLEN "" + +#define LUA_MAXINTEGER INT_MAX +#define LUA_MININTEGER INT_MIN + +#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ + +#define LUA_INTEGER long +#define LUA_INTEGER_FRMLEN "l" + +#define LUA_MAXINTEGER LONG_MAX +#define LUA_MININTEGER LONG_MIN + +#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ + +/* use presence of macro LLONG_MAX as proxy for C99 compliance */ +#if defined(LLONG_MAX) /* { */ +/* use ISO C99 stuff */ + +#define LUA_INTEGER long long +#define LUA_INTEGER_FRMLEN "ll" + +#define LUA_MAXINTEGER LLONG_MAX +#define LUA_MININTEGER LLONG_MIN + +#elif defined(LUA_USE_WINDOWS) /* }{ */ +/* in Windows, can use specific Windows types */ + +#define LUA_INTEGER __int64 +#define LUA_INTEGER_FRMLEN "I64" + +#define LUA_MAXINTEGER _I64_MAX +#define LUA_MININTEGER _I64_MIN + +#else /* }{ */ + +#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ + or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" + +#endif /* } */ + +#else /* }{ */ + +#error "numeric integer type not defined" + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Dependencies with C99 and other C details +** =================================================================== +*/ + +/* +@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. +** (All uses in Lua have only one format item.) +*/ +#if !defined(LUA_USE_C89) +#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) +#else +#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) +#endif + + +/* +@@ lua_strx2number converts an hexadecimal numeric string to a number. +** In C99, 'strtod' does that conversion. Otherwise, you can +** leave 'lua_strx2number' undefined and Lua will provide its own +** implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_strx2number(s,p) lua_str2number(s,p) +#endif + + +/* +@@ lua_number2strx converts a float to an hexadecimal numeric string. +** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. +** Otherwise, you can leave 'lua_number2strx' undefined and Lua will +** provide its own implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_number2strx(L,b,sz,f,n) \ + ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) +#endif + + +/* +** 'strtof' and 'opf' variants for math functions are not valid in +** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the +** availability of these variants. ('math.h' is already included in +** all files that use these macros.) +*/ +#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) +#undef l_mathop /* variants not available */ +#undef lua_str2number +#define l_mathop(op) (lua_Number)op /* no variant */ +#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) +#endif + + +/* +@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation +** functions. It must be a numerical type; Lua will use 'intptr_t' if +** available, otherwise it will use 'ptrdiff_t' (the nearest thing to +** 'intptr_t' in C89) +*/ +#define LUA_KCONTEXT ptrdiff_t + +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include +#if defined(INTPTR_MAX) /* even in C99 this type is optional */ +#undef LUA_KCONTEXT +#define LUA_KCONTEXT intptr_t +#endif +#endif + + +/* +@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). +** Change that if you do not want to use C locales. (Code using this +** macro must include header 'locale.h'.) +*/ +#if !defined(lua_getlocaledecpoint) +#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Language Variations +** ===================================================================== +*/ + +/* +@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some +** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from +** numbers to strings. Define LUA_NOCVTS2N to turn off automatic +** coercion from strings to numbers. +*/ +/* #define LUA_NOCVTN2S */ +/* #define LUA_NOCVTS2N */ + + +/* +@@ LUA_USE_APICHECK turns on several consistency checks on the C API. +** Define it as a help when debugging C code. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(l,e) assert(e) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Macros that affect the API and must be stable (that is, must be the +** same when you compile Lua and when you compile code that links to +** Lua). You probably do not want/need to change them. +** ===================================================================== +*/ + +/* +@@ LUAI_MAXSTACK limits the size of the Lua stack. +** CHANGE it if you need a different limit. This limit is arbitrary; +** its only purpose is to stop Lua from consuming unlimited stack +** space (and to reserve some numbers for pseudo-indices). +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_MAXSTACK 1000000 +#else +#define LUAI_MAXSTACK 15000 +#endif + + +/* +@@ LUA_EXTRASPACE defines the size of a raw memory area associated with +** a Lua state with very fast access. +** CHANGE it if you need a different size. +*/ +#define LUA_EXTRASPACE (sizeof(void *)) + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@@ of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +** CHANGE it if it uses too much C-stack space. (For long double, +** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a +** smaller buffer would force a memory allocation for each call to +** 'string.format'.) +*/ +#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE +#define LUAL_BUFFERSIZE 8192 +#else +#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) +#endif + +/* }================================================================== */ + + +/* +@@ LUA_QL describes how error messages quote program elements. +** Lua does not use these macros anymore; they are here for +** compatibility only. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + + + +#endif + diff --git a/deps/rcheevos/test/lua/src/lualib.h b/deps/rcheevos/test/lua/src/lualib.h new file mode 100644 index 0000000000..6c0bc4cb08 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lualib.h @@ -0,0 +1,61 @@ +/* +** $Id: lualib.h,v 1.45 2017/01/12 17:14:26 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* version suffix for environment variable names */ +#define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR + + +LUAMOD_API int (luaopen_base) (lua_State *L); + +#define LUA_COLIBNAME "coroutine" +LUAMOD_API int (luaopen_coroutine) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUAMOD_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUAMOD_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUAMOD_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUAMOD_API int (luaopen_string) (lua_State *L); + +#define LUA_UTF8LIBNAME "utf8" +LUAMOD_API int (luaopen_utf8) (lua_State *L); + +#define LUA_BITLIBNAME "bit32" +LUAMOD_API int (luaopen_bit32) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUAMOD_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUAMOD_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUAMOD_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#if !defined(lua_assert) +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/deps/rcheevos/test/lua/src/lundump.c b/deps/rcheevos/test/lua/src/lundump.c new file mode 100644 index 0000000000..4080af9c0d --- /dev/null +++ b/deps/rcheevos/test/lua/src/lundump.c @@ -0,0 +1,279 @@ +/* +** $Id: lundump.c,v 2.44 2015/11/02 16:09:30 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#define lundump_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + + +#if !defined(luai_verifycode) +#define luai_verifycode(L,b,f) /* empty */ +#endif + + +typedef struct { + lua_State *L; + ZIO *Z; + const char *name; +} LoadState; + + +static l_noret error(LoadState *S, const char *why) { + luaO_pushfstring(S->L, "%s: %s precompiled chunk", S->name, why); + luaD_throw(S->L, LUA_ERRSYNTAX); +} + + +/* +** All high-level loads go through LoadVector; you can change it to +** adapt to the endianness of the input +*/ +#define LoadVector(S,b,n) LoadBlock(S,b,(n)*sizeof((b)[0])) + +static void LoadBlock (LoadState *S, void *b, size_t size) { + if (luaZ_read(S->Z, b, size) != 0) + error(S, "truncated"); +} + + +#define LoadVar(S,x) LoadVector(S,&x,1) + + +static lu_byte LoadByte (LoadState *S) { + lu_byte x; + LoadVar(S, x); + return x; +} + + +static int LoadInt (LoadState *S) { + int x; + LoadVar(S, x); + return x; +} + + +static lua_Number LoadNumber (LoadState *S) { + lua_Number x; + LoadVar(S, x); + return x; +} + + +static lua_Integer LoadInteger (LoadState *S) { + lua_Integer x; + LoadVar(S, x); + return x; +} + + +static TString *LoadString (LoadState *S) { + size_t size = LoadByte(S); + if (size == 0xFF) + LoadVar(S, size); + if (size == 0) + return NULL; + else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ + char buff[LUAI_MAXSHORTLEN]; + LoadVector(S, buff, size); + return luaS_newlstr(S->L, buff, size); + } + else { /* long string */ + TString *ts = luaS_createlngstrobj(S->L, size); + LoadVector(S, getstr(ts), size); /* load directly in final place */ + return ts; + } +} + + +static void LoadCode (LoadState *S, Proto *f) { + int n = LoadInt(S); + f->code = luaM_newvector(S->L, n, Instruction); + f->sizecode = n; + LoadVector(S, f->code, n); +} + + +static void LoadFunction(LoadState *S, Proto *f, TString *psource); + + +static void LoadConstants (LoadState *S, Proto *f) { + int i; + int n = LoadInt(S); + f->k = luaM_newvector(S->L, n, TValue); + f->sizek = n; + for (i = 0; i < n; i++) + setnilvalue(&f->k[i]); + for (i = 0; i < n; i++) { + TValue *o = &f->k[i]; + int t = LoadByte(S); + switch (t) { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o, LoadByte(S)); + break; + case LUA_TNUMFLT: + setfltvalue(o, LoadNumber(S)); + break; + case LUA_TNUMINT: + setivalue(o, LoadInteger(S)); + break; + case LUA_TSHRSTR: + case LUA_TLNGSTR: + setsvalue2n(S->L, o, LoadString(S)); + break; + default: + lua_assert(0); + } + } +} + + +static void LoadProtos (LoadState *S, Proto *f) { + int i; + int n = LoadInt(S); + f->p = luaM_newvector(S->L, n, Proto *); + f->sizep = n; + for (i = 0; i < n; i++) + f->p[i] = NULL; + for (i = 0; i < n; i++) { + f->p[i] = luaF_newproto(S->L); + LoadFunction(S, f->p[i], f->source); + } +} + + +static void LoadUpvalues (LoadState *S, Proto *f) { + int i, n; + n = LoadInt(S); + f->upvalues = luaM_newvector(S->L, n, Upvaldesc); + f->sizeupvalues = n; + for (i = 0; i < n; i++) + f->upvalues[i].name = NULL; + for (i = 0; i < n; i++) { + f->upvalues[i].instack = LoadByte(S); + f->upvalues[i].idx = LoadByte(S); + } +} + + +static void LoadDebug (LoadState *S, Proto *f) { + int i, n; + n = LoadInt(S); + f->lineinfo = luaM_newvector(S->L, n, int); + f->sizelineinfo = n; + LoadVector(S, f->lineinfo, n); + n = LoadInt(S); + f->locvars = luaM_newvector(S->L, n, LocVar); + f->sizelocvars = n; + for (i = 0; i < n; i++) + f->locvars[i].varname = NULL; + for (i = 0; i < n; i++) { + f->locvars[i].varname = LoadString(S); + f->locvars[i].startpc = LoadInt(S); + f->locvars[i].endpc = LoadInt(S); + } + n = LoadInt(S); + for (i = 0; i < n; i++) + f->upvalues[i].name = LoadString(S); +} + + +static void LoadFunction (LoadState *S, Proto *f, TString *psource) { + f->source = LoadString(S); + if (f->source == NULL) /* no source in dump? */ + f->source = psource; /* reuse parent's source */ + f->linedefined = LoadInt(S); + f->lastlinedefined = LoadInt(S); + f->numparams = LoadByte(S); + f->is_vararg = LoadByte(S); + f->maxstacksize = LoadByte(S); + LoadCode(S, f); + LoadConstants(S, f); + LoadUpvalues(S, f); + LoadProtos(S, f); + LoadDebug(S, f); +} + + +static void checkliteral (LoadState *S, const char *s, const char *msg) { + char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ + size_t len = strlen(s); + LoadVector(S, buff, len); + if (memcmp(s, buff, len) != 0) + error(S, msg); +} + + +static void fchecksize (LoadState *S, size_t size, const char *tname) { + if (LoadByte(S) != size) + error(S, luaO_pushfstring(S->L, "%s size mismatch in", tname)); +} + + +#define checksize(S,t) fchecksize(S,sizeof(t),#t) + +static void checkHeader (LoadState *S) { + checkliteral(S, LUA_SIGNATURE + 1, "not a"); /* 1st char already checked */ + if (LoadByte(S) != LUAC_VERSION) + error(S, "version mismatch in"); + if (LoadByte(S) != LUAC_FORMAT) + error(S, "format mismatch in"); + checkliteral(S, LUAC_DATA, "corrupted"); + checksize(S, int); + checksize(S, size_t); + checksize(S, Instruction); + checksize(S, lua_Integer); + checksize(S, lua_Number); + if (LoadInteger(S) != LUAC_INT) + error(S, "endianness mismatch in"); + if (LoadNumber(S) != LUAC_NUM) + error(S, "float format mismatch in"); +} + + +/* +** load precompiled chunk +*/ +LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) { + LoadState S; + LClosure *cl; + if (*name == '@' || *name == '=') + S.name = name + 1; + else if (*name == LUA_SIGNATURE[0]) + S.name = "binary string"; + else + S.name = name; + S.L = L; + S.Z = Z; + checkHeader(&S); + cl = luaF_newLclosure(L, LoadByte(&S)); + setclLvalue(L, L->top, cl); + luaD_inctop(L); + cl->p = luaF_newproto(L); + LoadFunction(&S, cl->p, NULL); + lua_assert(cl->nupvalues == cl->p->sizeupvalues); + luai_verifycode(L, buff, cl->p); + return cl; +} + diff --git a/deps/rcheevos/test/lua/src/lundump.h b/deps/rcheevos/test/lua/src/lundump.h new file mode 100644 index 0000000000..aa5cc82f1b --- /dev/null +++ b/deps/rcheevos/test/lua/src/lundump.h @@ -0,0 +1,32 @@ +/* +** $Id: lundump.h,v 1.45 2015/09/08 15:41:05 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* data to catch conversion errors */ +#define LUAC_DATA "\x19\x93\r\n\x1a\n" + +#define LUAC_INT 0x5678 +#define LUAC_NUM cast_num(370.5) + +#define MYINT(s) (s[0]-'0') +#define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) +#define LUAC_FORMAT 0 /* this is the official format */ + +/* load one chunk; from lundump.c */ +LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, + void* data, int strip); + +#endif diff --git a/deps/rcheevos/test/lua/src/lutf8lib.c b/deps/rcheevos/test/lua/src/lutf8lib.c new file mode 100644 index 0000000000..de9e3dcdd6 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lutf8lib.c @@ -0,0 +1,256 @@ +/* +** $Id: lutf8lib.c,v 1.16 2016/12/22 13:08:50 roberto Exp $ +** Standard library for UTF-8 manipulation +** See Copyright Notice in lua.h +*/ + +#define lutf8lib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + +#define MAXUNICODE 0x10FFFF + +#define iscont(p) ((*(p) & 0xC0) == 0x80) + + +/* from strlib */ +/* translate a relative string position: negative means back from end */ +static lua_Integer u_posrelat (lua_Integer pos, size_t len) { + if (pos >= 0) return pos; + else if (0u - (size_t)pos > len) return 0; + else return (lua_Integer)len + pos + 1; +} + + +/* +** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. +*/ +static const char *utf8_decode (const char *o, int *val) { + static const unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; + const unsigned char *s = (const unsigned char *)o; + unsigned int c = s[0]; + unsigned int res = 0; /* final result */ + if (c < 0x80) /* ascii? */ + res = c; + else { + int count = 0; /* to count number of continuation bytes */ + while (c & 0x40) { /* still have continuation bytes? */ + int cc = s[++count]; /* read next byte */ + if ((cc & 0xC0) != 0x80) /* not a continuation byte? */ + return NULL; /* invalid byte sequence */ + res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ + c <<= 1; /* to test next bit */ + } + res |= ((c & 0x7F) << (count * 5)); /* add first byte */ + if (count > 3 || res > MAXUNICODE || res <= limits[count]) + return NULL; /* invalid byte sequence */ + s += count; /* skip continuation bytes read */ + } + if (val) *val = res; + return (const char *)s + 1; /* +1 to include first byte */ +} + + +/* +** utf8len(s [, i [, j]]) --> number of characters that start in the +** range [i,j], or nil + current position if 's' is not well formed in +** that interval +*/ +static int utflen (lua_State *L) { + int n = 0; + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); + lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); + luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, + "initial position out of string"); + luaL_argcheck(L, --posj < (lua_Integer)len, 3, + "final position out of string"); + while (posi <= posj) { + const char *s1 = utf8_decode(s + posi, NULL); + if (s1 == NULL) { /* conversion error? */ + lua_pushnil(L); /* return nil ... */ + lua_pushinteger(L, posi + 1); /* ... and current position */ + return 2; + } + posi = s1 - s; + n++; + } + lua_pushinteger(L, n); + return 1; +} + + +/* +** codepoint(s, [i, [j]]) -> returns codepoints for all characters +** that start in the range [i,j] +*/ +static int codepoint (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); + lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); + int n; + const char *se; + luaL_argcheck(L, posi >= 1, 2, "out of range"); + luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of range"); + if (posi > pose) return 0; /* empty interval; return no values */ + if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ + return luaL_error(L, "string slice too long"); + n = (int)(pose - posi) + 1; + luaL_checkstack(L, n, "string slice too long"); + n = 0; + se = s + pose; + for (s += posi - 1; s < se;) { + int code; + s = utf8_decode(s, &code); + if (s == NULL) + return luaL_error(L, "invalid UTF-8 code"); + lua_pushinteger(L, code); + n++; + } + return n; +} + + +static void pushutfchar (lua_State *L, int arg) { + lua_Integer code = luaL_checkinteger(L, arg); + luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); + lua_pushfstring(L, "%U", (long)code); +} + + +/* +** utfchar(n1, n2, ...) -> char(n1)..char(n2)... +*/ +static int utfchar (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + if (n == 1) /* optimize common case of single char */ + pushutfchar(L, 1); + else { + int i; + luaL_Buffer b; + luaL_buffinit(L, &b); + for (i = 1; i <= n; i++) { + pushutfchar(L, i); + luaL_addvalue(&b); + } + luaL_pushresult(&b); + } + return 1; +} + + +/* +** offset(s, n, [i]) -> index where n-th character counting from +** position 'i' starts; 0 means character at 'i'. +*/ +static int byteoffset (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer n = luaL_checkinteger(L, 2); + lua_Integer posi = (n >= 0) ? 1 : len + 1; + posi = u_posrelat(luaL_optinteger(L, 3, posi), len); + luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, + "position out of range"); + if (n == 0) { + /* find beginning of current byte sequence */ + while (posi > 0 && iscont(s + posi)) posi--; + } + else { + if (iscont(s + posi)) + luaL_error(L, "initial position is a continuation byte"); + if (n < 0) { + while (n < 0 && posi > 0) { /* move back */ + do { /* find beginning of previous character */ + posi--; + } while (posi > 0 && iscont(s + posi)); + n++; + } + } + else { + n--; /* do not move for 1st character */ + while (n > 0 && posi < (lua_Integer)len) { + do { /* find beginning of next character */ + posi++; + } while (iscont(s + posi)); /* (cannot pass final '\0') */ + n--; + } + } + } + if (n == 0) /* did it find given character? */ + lua_pushinteger(L, posi + 1); + else /* no such character */ + lua_pushnil(L); + return 1; +} + + +static int iter_aux (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer n = lua_tointeger(L, 2) - 1; + if (n < 0) /* first iteration? */ + n = 0; /* start from here */ + else if (n < (lua_Integer)len) { + n++; /* skip current byte */ + while (iscont(s + n)) n++; /* and its continuations */ + } + if (n >= (lua_Integer)len) + return 0; /* no more codepoints */ + else { + int code; + const char *next = utf8_decode(s + n, &code); + if (next == NULL || iscont(next)) + return luaL_error(L, "invalid UTF-8 code"); + lua_pushinteger(L, n + 1); + lua_pushinteger(L, code); + return 2; + } +} + + +static int iter_codes (lua_State *L) { + luaL_checkstring(L, 1); + lua_pushcfunction(L, iter_aux); + lua_pushvalue(L, 1); + lua_pushinteger(L, 0); + return 3; +} + + +/* pattern to match a single UTF-8 character */ +#define UTF8PATT "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" + + +static const luaL_Reg funcs[] = { + {"offset", byteoffset}, + {"codepoint", codepoint}, + {"char", utfchar}, + {"len", utflen}, + {"codes", iter_codes}, + /* placeholders */ + {"charpattern", NULL}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_utf8 (lua_State *L) { + luaL_newlib(L, funcs); + lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT)/sizeof(char) - 1); + lua_setfield(L, -2, "charpattern"); + return 1; +} + diff --git a/deps/rcheevos/test/lua/src/lvm.c b/deps/rcheevos/test/lua/src/lvm.c new file mode 100644 index 0000000000..84ade6b2fa --- /dev/null +++ b/deps/rcheevos/test/lua/src/lvm.c @@ -0,0 +1,1322 @@ +/* +** $Id: lvm.c,v 2.268 2016/02/05 19:59:14 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#define lvm_c +#define LUA_CORE + +#include "lprefix.h" + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 2000 + + + +/* +** 'l_intfitsf' checks whether a given integer can be converted to a +** float without rounding. Used in comparisons. Left undefined if +** all integers fit in a float precisely. +*/ +#if !defined(l_intfitsf) + +/* number of bits in the mantissa of a float */ +#define NBM (l_mathlim(MANT_DIG)) + +/* +** Check whether some integers may not fit in a float, that is, whether +** (maxinteger >> NBM) > 0 (that implies (1 << NBM) <= maxinteger). +** (The shifts are done in parts to avoid shifting by more than the size +** of an integer. In a worst case, NBM == 113 for long double and +** sizeof(integer) == 32.) +*/ +#if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \ + >> (NBM - (3 * (NBM / 4)))) > 0 + +#define l_intfitsf(i) \ + (-((lua_Integer)1 << NBM) <= (i) && (i) <= ((lua_Integer)1 << NBM)) + +#endif + +#endif + + + +/* +** Try to convert a value to a float. The float case is already handled +** by the macro 'tonumber'. +*/ +int luaV_tonumber_ (const TValue *obj, lua_Number *n) { + TValue v; + if (ttisinteger(obj)) { + *n = cast_num(ivalue(obj)); + return 1; + } + else if (cvt2num(obj) && /* string convertible to number? */ + luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { + *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */ + return 1; + } + else + return 0; /* conversion failed */ +} + + +/* +** try to convert a value to an integer, rounding according to 'mode': +** mode == 0: accepts only integral values +** mode == 1: takes the floor of the number +** mode == 2: takes the ceil of the number +*/ +int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode) { + TValue v; + again: + if (ttisfloat(obj)) { + lua_Number n = fltvalue(obj); + lua_Number f = l_floor(n); + if (n != f) { /* not an integral value? */ + if (mode == 0) return 0; /* fails if mode demands integral value */ + else if (mode > 1) /* needs ceil? */ + f += 1; /* convert floor to ceil (remember: n != f) */ + } + return lua_numbertointeger(f, p); + } + else if (ttisinteger(obj)) { + *p = ivalue(obj); + return 1; + } + else if (cvt2num(obj) && + luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { + obj = &v; + goto again; /* convert result from 'luaO_str2num' to an integer */ + } + return 0; /* conversion failed */ +} + + +/* +** Try to convert a 'for' limit to an integer, preserving the +** semantics of the loop. +** (The following explanation assumes a non-negative step; it is valid +** for negative steps mutatis mutandis.) +** If the limit can be converted to an integer, rounding down, that is +** it. +** Otherwise, check whether the limit can be converted to a number. If +** the number is too large, it is OK to set the limit as LUA_MAXINTEGER, +** which means no limit. If the number is too negative, the loop +** should not run, because any initial integer value is larger than the +** limit. So, it sets the limit to LUA_MININTEGER. 'stopnow' corrects +** the extreme case when the initial value is LUA_MININTEGER, in which +** case the LUA_MININTEGER limit would still run the loop once. +*/ +static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step, + int *stopnow) { + *stopnow = 0; /* usually, let loops run */ + if (!luaV_tointeger(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */ + lua_Number n; /* try to convert to float */ + if (!tonumber(obj, &n)) /* cannot convert to float? */ + return 0; /* not a number */ + if (luai_numlt(0, n)) { /* if true, float is larger than max integer */ + *p = LUA_MAXINTEGER; + if (step < 0) *stopnow = 1; + } + else { /* float is smaller than min integer */ + *p = LUA_MININTEGER; + if (step >= 0) *stopnow = 1; + } + } + return 1; +} + + +/* +** Finish the table access 'val = t[key]'. +** if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to +** t[k] entry (which must be nil). +*/ +void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val, + const TValue *slot) { + int loop; /* counter to avoid infinite loops */ + const TValue *tm; /* metamethod */ + for (loop = 0; loop < MAXTAGLOOP; loop++) { + if (slot == NULL) { /* 't' is not a table? */ + lua_assert(!ttistable(t)); + tm = luaT_gettmbyobj(L, t, TM_INDEX); + if (ttisnil(tm)) + luaG_typeerror(L, t, "index"); /* no metamethod */ + /* else will try the metamethod */ + } + else { /* 't' is a table */ + lua_assert(ttisnil(slot)); + tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); /* table's metamethod */ + if (tm == NULL) { /* no metamethod? */ + setnilvalue(val); /* result is nil */ + return; + } + /* else will try the metamethod */ + } + if (ttisfunction(tm)) { /* is metamethod a function? */ + luaT_callTM(L, tm, t, key, val, 1); /* call it */ + return; + } + t = tm; /* else try to access 'tm[key]' */ + if (luaV_fastget(L,t,key,slot,luaH_get)) { /* fast track? */ + setobj2s(L, val, slot); /* done */ + return; + } + /* else repeat (tail call 'luaV_finishget') */ + } + luaG_runerror(L, "'__index' chain too long; possible loop"); +} + + +/* +** Finish a table assignment 't[key] = val'. +** If 'slot' is NULL, 't' is not a table. Otherwise, 'slot' points +** to the entry 't[key]', or to 'luaO_nilobject' if there is no such +** entry. (The value at 'slot' must be nil, otherwise 'luaV_fastset' +** would have done the job.) +*/ +void luaV_finishset (lua_State *L, const TValue *t, TValue *key, + StkId val, const TValue *slot) { + int loop; /* counter to avoid infinite loops */ + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; /* '__newindex' metamethod */ + if (slot != NULL) { /* is 't' a table? */ + Table *h = hvalue(t); /* save 't' table */ + lua_assert(ttisnil(slot)); /* old value must be nil */ + tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */ + if (tm == NULL) { /* no metamethod? */ + if (slot == luaO_nilobject) /* no previous entry? */ + slot = luaH_newkey(L, h, key); /* create one */ + /* no metamethod and (now) there is an entry with given key */ + setobj2t(L, cast(TValue *, slot), val); /* set its new value */ + invalidateTMcache(h); + luaC_barrierback(L, h, val); + return; + } + /* else will try the metamethod */ + } + else { /* not a table; check metamethod */ + if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + } + /* try the metamethod */ + if (ttisfunction(tm)) { + luaT_callTM(L, tm, t, key, val, 0); + return; + } + t = tm; /* else repeat assignment over 'tm' */ + if (luaV_fastset(L, t, key, slot, luaH_get, val)) + return; /* done */ + /* else loop */ + } + luaG_runerror(L, "'__newindex' chain too long; possible loop"); +} + + +/* +** Compare two strings 'ls' x 'rs', returning an integer smaller-equal- +** -larger than zero if 'ls' is smaller-equal-larger than 'rs'. +** The code is a little tricky because it allows '\0' in the strings +** and it uses 'strcoll' (to respect locales) for each segments +** of the strings. +*/ +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = tsslen(ls); + const char *r = getstr(rs); + size_t lr = tsslen(rs); + for (;;) { /* for each segment */ + int temp = strcoll(l, r); + if (temp != 0) /* not equal? */ + return temp; /* done */ + else { /* strings are equal up to a '\0' */ + size_t len = strlen(l); /* index of first '\0' in both strings */ + if (len == lr) /* 'rs' is finished? */ + return (len == ll) ? 0 : 1; /* check 'ls' */ + else if (len == ll) /* 'ls' is finished? */ + return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */ + /* both strings longer than 'len'; go on comparing after the '\0' */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +/* +** Check whether integer 'i' is less than float 'f'. If 'i' has an +** exact representation as a float ('l_intfitsf'), compare numbers as +** floats. Otherwise, if 'f' is outside the range for integers, result +** is trivial. Otherwise, compare them as integers. (When 'i' has no +** float representation, either 'f' is "far away" from 'i' or 'f' has +** no precision left for a fractional part; either way, how 'f' is +** truncated is irrelevant.) When 'f' is NaN, comparisons must result +** in false. +*/ +static int LTintfloat (lua_Integer i, lua_Number f) { +#if defined(l_intfitsf) + if (!l_intfitsf(i)) { + if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ + return 1; /* f >= maxint + 1 > i */ + else if (f > cast_num(LUA_MININTEGER)) /* minint < f <= maxint ? */ + return (i < cast(lua_Integer, f)); /* compare them as integers */ + else /* f <= minint <= i (or 'f' is NaN) --> not(i < f) */ + return 0; + } +#endif + return luai_numlt(cast_num(i), f); /* compare them as floats */ +} + + +/* +** Check whether integer 'i' is less than or equal to float 'f'. +** See comments on previous function. +*/ +static int LEintfloat (lua_Integer i, lua_Number f) { +#if defined(l_intfitsf) + if (!l_intfitsf(i)) { + if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ + return 1; /* f >= maxint + 1 > i */ + else if (f >= cast_num(LUA_MININTEGER)) /* minint <= f <= maxint ? */ + return (i <= cast(lua_Integer, f)); /* compare them as integers */ + else /* f < minint <= i (or 'f' is NaN) --> not(i <= f) */ + return 0; + } +#endif + return luai_numle(cast_num(i), f); /* compare them as floats */ +} + + +/* +** Return 'l < r', for numbers. +*/ +static int LTnum (const TValue *l, const TValue *r) { + if (ttisinteger(l)) { + lua_Integer li = ivalue(l); + if (ttisinteger(r)) + return li < ivalue(r); /* both are integers */ + else /* 'l' is int and 'r' is float */ + return LTintfloat(li, fltvalue(r)); /* l < r ? */ + } + else { + lua_Number lf = fltvalue(l); /* 'l' must be float */ + if (ttisfloat(r)) + return luai_numlt(lf, fltvalue(r)); /* both are float */ + else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ + return 0; /* NaN < i is always false */ + else /* without NaN, (l < r) <--> not(r <= l) */ + return !LEintfloat(ivalue(r), lf); /* not (r <= l) ? */ + } +} + + +/* +** Return 'l <= r', for numbers. +*/ +static int LEnum (const TValue *l, const TValue *r) { + if (ttisinteger(l)) { + lua_Integer li = ivalue(l); + if (ttisinteger(r)) + return li <= ivalue(r); /* both are integers */ + else /* 'l' is int and 'r' is float */ + return LEintfloat(li, fltvalue(r)); /* l <= r ? */ + } + else { + lua_Number lf = fltvalue(l); /* 'l' must be float */ + if (ttisfloat(r)) + return luai_numle(lf, fltvalue(r)); /* both are float */ + else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ + return 0; /* NaN <= i is always false */ + else /* without NaN, (l <= r) <--> not(r < l) */ + return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */ + } +} + + +/* +** Main operation less than; return 'l < r'. +*/ +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */ + return LTnum(l, r); + else if (ttisstring(l) && ttisstring(r)) /* both are strings? */ + return l_strcmp(tsvalue(l), tsvalue(r)) < 0; + else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) /* no metamethod? */ + luaG_ordererror(L, l, r); /* error */ + return res; +} + + +/* +** Main operation less than or equal to; return 'l <= r'. If it needs +** a metamethod and there is no '__le', try '__lt', based on +** l <= r iff !(r < l) (assuming a total order). If the metamethod +** yields during this substitution, the continuation has to know +** about it (to negate the result of r= 0) /* try 'le' */ + return res; + else { /* try 'lt': */ + L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ + res = luaT_callorderTM(L, r, l, TM_LT); + L->ci->callstatus ^= CIST_LEQ; /* clear mark */ + if (res < 0) + luaG_ordererror(L, l, r); + return !res; /* result is negated */ + } +} + + +/* +** Main operation for equality of Lua values; return 't1 == t2'. +** L == NULL means raw equality (no metamethods) +*/ +int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + if (ttype(t1) != ttype(t2)) { /* not the same variant? */ + if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER) + return 0; /* only numbers can be equal with different variants */ + else { /* two numbers with different variants */ + lua_Integer i1, i2; /* compare them as integers */ + return (tointeger(t1, &i1) && tointeger(t2, &i2) && i1 == i2); + } + } + /* values have same type and same variant */ + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); + case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TLCF: return fvalue(t1) == fvalue(t2); + case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); + case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2)); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + else if (L == NULL) return 0; + tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); + if (tm == NULL) + tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + else if (L == NULL) return 0; + tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); + if (tm == NULL) + tm = fasttm(L, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: + return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) /* no TM? */ + return 0; /* objects are different */ + luaT_callTM(L, tm, t1, t2, L->top, 1); /* call TM */ + return !l_isfalse(L->top); +} + + +/* macro used by 'luaV_concat' to ensure that element at 'o' is a string */ +#define tostring(L,o) \ + (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) + +#define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) + +/* copy strings in stack from top - n up to top - 1 to buffer */ +static void copy2buff (StkId top, int n, char *buff) { + size_t tl = 0; /* size already copied */ + do { + size_t l = vslen(top - n); /* length of string being copied */ + memcpy(buff + tl, svalue(top - n), l * sizeof(char)); + tl += l; + } while (--n > 0); +} + + +/* +** Main operation for concatenation: concat 'total' values in the stack, +** from 'L->top - total' up to 'L->top - 1'. +*/ +void luaV_concat (lua_State *L, int total) { + lua_assert(total >= 2); + do { + StkId top = L->top; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || cvt2str(top-2)) || !tostring(L, top-1)) + luaT_trybinTM(L, top-2, top-1, top-2, TM_CONCAT); + else if (isemptystr(top - 1)) /* second operand is empty? */ + cast_void(tostring(L, top - 2)); /* result is first operand */ + else if (isemptystr(top - 2)) { /* first operand is an empty string? */ + setobjs2s(L, top - 2, top - 1); /* result is second op. */ + } + else { + /* at least two non-empty string values; get as many as possible */ + size_t tl = vslen(top - 1); + TString *ts; + /* collect total length and number of strings */ + for (n = 1; n < total && tostring(L, top - n - 1); n++) { + size_t l = vslen(top - n - 1); + if (l >= (MAX_SIZE/sizeof(char)) - tl) + luaG_runerror(L, "string length overflow"); + tl += l; + } + if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */ + char buff[LUAI_MAXSHORTLEN]; + copy2buff(top, n, buff); /* copy strings to buffer */ + ts = luaS_newlstr(L, buff, tl); + } + else { /* long string; copy strings directly to final result */ + ts = luaS_createlngstrobj(L, tl); + copy2buff(top, n, getstr(ts)); + } + setsvalue2s(L, top - n, ts); /* create result */ + } + total -= n-1; /* got 'n' strings to create 1 new */ + L->top -= n-1; /* popped 'n' strings and pushed one */ + } while (total > 1); /* repeat until only 1 result left */ +} + + +/* +** Main operation 'ra' = #rb'. +*/ +void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { + const TValue *tm; + switch (ttype(rb)) { + case LUA_TTABLE: { + Table *h = hvalue(rb); + tm = fasttm(L, h->metatable, TM_LEN); + if (tm) break; /* metamethod? break switch to call it */ + setivalue(ra, luaH_getn(h)); /* else primitive len */ + return; + } + case LUA_TSHRSTR: { + setivalue(ra, tsvalue(rb)->shrlen); + return; + } + case LUA_TLNGSTR: { + setivalue(ra, tsvalue(rb)->u.lnglen); + return; + } + default: { /* try metamethod */ + tm = luaT_gettmbyobj(L, rb, TM_LEN); + if (ttisnil(tm)) /* no metamethod? */ + luaG_typeerror(L, rb, "get length of"); + break; + } + } + luaT_callTM(L, tm, rb, rb, ra, 1); +} + + +/* +** Integer division; return 'm // n', that is, floor(m/n). +** C division truncates its result (rounds towards zero). +** 'floor(q) == trunc(q)' when 'q >= 0' or when 'q' is integer, +** otherwise 'floor(q) == trunc(q) - 1'. +*/ +lua_Integer luaV_div (lua_State *L, lua_Integer m, lua_Integer n) { + if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ + if (n == 0) + luaG_runerror(L, "attempt to divide by zero"); + return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */ + } + else { + lua_Integer q = m / n; /* perform C division */ + if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */ + q -= 1; /* correct result for different rounding */ + return q; + } +} + + +/* +** Integer modulus; return 'm % n'. (Assume that C '%' with +** negative operands follows C99 behavior. See previous comment +** about luaV_div.) +*/ +lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) { + if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ + if (n == 0) + luaG_runerror(L, "attempt to perform 'n%%0'"); + return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */ + } + else { + lua_Integer r = m % n; + if (r != 0 && (m ^ n) < 0) /* 'm/n' would be non-integer negative? */ + r += n; /* correct result for different rounding */ + return r; + } +} + + +/* number of bits in an integer */ +#define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT) + +/* +** Shift left operation. (Shift right just negates 'y'.) +*/ +lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { + if (y < 0) { /* shift right? */ + if (y <= -NBITS) return 0; + else return intop(>>, x, -y); + } + else { /* shift left */ + if (y >= NBITS) return 0; + else return intop(<<, x, y); + } +} + + +/* +** check whether cached closure in prototype 'p' may be reused, that is, +** whether there is a cached closure with the same upvalues needed by +** new closure to be created. +*/ +static LClosure *getcached (Proto *p, UpVal **encup, StkId base) { + LClosure *c = p->cache; + if (c != NULL) { /* is there a cached closure? */ + int nup = p->sizeupvalues; + Upvaldesc *uv = p->upvalues; + int i; + for (i = 0; i < nup; i++) { /* check whether it has right upvalues */ + TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v; + if (c->upvals[i]->v != v) + return NULL; /* wrong upvalue; cannot reuse closure */ + } + } + return c; /* return cached closure (or NULL if no cached closure) */ +} + + +/* +** create a new Lua closure, push it in the stack, and initialize +** its upvalues. Note that the closure is not cached if prototype is +** already black (which means that 'cache' was already cleared by the +** GC). +*/ +static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, + StkId ra) { + int nup = p->sizeupvalues; + Upvaldesc *uv = p->upvalues; + int i; + LClosure *ncl = luaF_newLclosure(L, nup); + ncl->p = p; + setclLvalue(L, ra, ncl); /* anchor new closure in stack */ + for (i = 0; i < nup; i++) { /* fill in its upvalues */ + if (uv[i].instack) /* upvalue refers to local variable? */ + ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); + else /* get upvalue from enclosing function */ + ncl->upvals[i] = encup[uv[i].idx]; + ncl->upvals[i]->refcount++; + /* new closure is white, so we do not need a barrier here */ + } + if (!isblack(p)) /* cache will not break GC invariant? */ + p->cache = ncl; /* save it on cache for reuse */ +} + + +/* +** finish execution of an opcode interrupted by an yield +*/ +void luaV_finishOp (lua_State *L) { + CallInfo *ci = L->ci; + StkId base = ci->u.l.base; + Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ + OpCode op = GET_OPCODE(inst); + switch (op) { /* finish its execution */ + case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV: + case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: + case OP_MOD: case OP_POW: + case OP_UNM: case OP_BNOT: case OP_LEN: + case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { + setobjs2s(L, base + GETARG_A(inst), --L->top); + break; + } + case OP_LE: case OP_LT: case OP_EQ: { + int res = !l_isfalse(L->top - 1); + L->top--; + if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ + lua_assert(op == OP_LE); + ci->callstatus ^= CIST_LEQ; /* clear mark */ + res = !res; /* negate result */ + } + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); + if (res != GETARG_A(inst)) /* condition failed? */ + ci->u.l.savedpc++; /* skip jump instruction */ + break; + } + case OP_CONCAT: { + StkId top = L->top - 1; /* top when 'luaT_trybinTM' was called */ + int b = GETARG_B(inst); /* first element to concatenate */ + int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */ + setobj2s(L, top - 2, top); /* put TM result in proper position */ + if (total > 1) { /* are there elements to concat? */ + L->top = top - 1; /* top is one after last element (at top-2) */ + luaV_concat(L, total); /* concat them (may yield again) */ + } + /* move final result to final position */ + setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1); + L->top = ci->top; /* restore top */ + break; + } + case OP_TFORCALL: { + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP); + L->top = ci->top; /* correct top */ + break; + } + case OP_CALL: { + if (GETARG_C(inst) - 1 >= 0) /* nresults >= 0? */ + L->top = ci->top; /* adjust results */ + break; + } + case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE: + break; + default: lua_assert(0); + } +} + + + + +/* +** {================================================================== +** Function 'luaV_execute': main interpreter loop +** =================================================================== +*/ + + +/* +** some macros for common tasks in 'luaV_execute' +*/ + + +#define RA(i) (base+GETARG_A(i)) +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) + + +/* execute a jump instruction */ +#define dojump(ci,i,e) \ + { int a = GETARG_A(i); \ + if (a != 0) luaF_close(L, ci->u.l.base + a - 1); \ + ci->u.l.savedpc += GETARG_sBx(i) + e; } + +/* for test instructions, execute the jump instruction that follows it */ +#define donextjump(ci) { i = *ci->u.l.savedpc; dojump(ci, i, 1); } + + +#define Protect(x) { {x;}; base = ci->u.l.base; } + +#define checkGC(L,c) \ + { luaC_condGC(L, L->top = (c), /* limit of live values */ \ + Protect(L->top = ci->top)); /* restore top */ \ + luai_threadyield(L); } + + +/* fetch an instruction and prepare its execution */ +#define vmfetch() { \ + i = *(ci->u.l.savedpc++); \ + if (L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) \ + Protect(luaG_traceexec(L)); \ + ra = RA(i); /* WARNING: any stack reallocation invalidates 'ra' */ \ + lua_assert(base == ci->u.l.base); \ + lua_assert(base <= L->top && L->top < L->stack + L->stacksize); \ +} + +#define vmdispatch(o) switch(o) +#define vmcase(l) case l: +#define vmbreak break + + +/* +** copy of 'luaV_gettable', but protecting the call to potential +** metamethod (which can reallocate the stack) +*/ +#define gettableProtected(L,t,k,v) { const TValue *slot; \ + if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ + else Protect(luaV_finishget(L,t,k,v,slot)); } + + +/* same for 'luaV_settable' */ +#define settableProtected(L,t,k,v) { const TValue *slot; \ + if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ + Protect(luaV_finishset(L,t,k,v,slot)); } + + + +void luaV_execute (lua_State *L) { + CallInfo *ci = L->ci; + LClosure *cl; + TValue *k; + StkId base; + ci->callstatus |= CIST_FRESH; /* fresh invocation of 'luaV_execute" */ + newframe: /* reentry point when frame changes (call/return) */ + lua_assert(ci == L->ci); + cl = clLvalue(ci->func); /* local reference to function's closure */ + k = cl->p->k; /* local reference to function's constant table */ + base = ci->u.l.base; /* local copy of function's base */ + /* main loop of interpreter */ + for (;;) { + Instruction i; + StkId ra; + vmfetch(); + vmdispatch (GET_OPCODE(i)) { + vmcase(OP_MOVE) { + setobjs2s(L, ra, RB(i)); + vmbreak; + } + vmcase(OP_LOADK) { + TValue *rb = k + GETARG_Bx(i); + setobj2s(L, ra, rb); + vmbreak; + } + vmcase(OP_LOADKX) { + TValue *rb; + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); + rb = k + GETARG_Ax(*ci->u.l.savedpc++); + setobj2s(L, ra, rb); + vmbreak; + } + vmcase(OP_LOADBOOL) { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */ + vmbreak; + } + vmcase(OP_LOADNIL) { + int b = GETARG_B(i); + do { + setnilvalue(ra++); + } while (b--); + vmbreak; + } + vmcase(OP_GETUPVAL) { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + vmbreak; + } + vmcase(OP_GETTABUP) { + TValue *upval = cl->upvals[GETARG_B(i)]->v; + TValue *rc = RKC(i); + gettableProtected(L, upval, rc, ra); + vmbreak; + } + vmcase(OP_GETTABLE) { + StkId rb = RB(i); + TValue *rc = RKC(i); + gettableProtected(L, rb, rc, ra); + vmbreak; + } + vmcase(OP_SETTABUP) { + TValue *upval = cl->upvals[GETARG_A(i)]->v; + TValue *rb = RKB(i); + TValue *rc = RKC(i); + settableProtected(L, upval, rb, rc); + vmbreak; + } + vmcase(OP_SETUPVAL) { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_upvalbarrier(L, uv); + vmbreak; + } + vmcase(OP_SETTABLE) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + settableProtected(L, ra, rb, rc); + vmbreak; + } + vmcase(OP_NEWTABLE) { + int b = GETARG_B(i); + int c = GETARG_C(i); + Table *t = luaH_new(L); + sethvalue(L, ra, t); + if (b != 0 || c != 0) + luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); + checkGC(L, ra + 1); + vmbreak; + } + vmcase(OP_SELF) { + const TValue *aux; + StkId rb = RB(i); + TValue *rc = RKC(i); + TString *key = tsvalue(rc); /* key must be a string */ + setobjs2s(L, ra + 1, rb); + if (luaV_fastget(L, rb, key, aux, luaH_getstr)) { + setobj2s(L, ra, aux); + } + else Protect(luaV_finishget(L, rb, rc, ra, aux)); + vmbreak; + } + vmcase(OP_ADD) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, intop(+, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numadd(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } + vmbreak; + } + vmcase(OP_SUB) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, intop(-, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numsub(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } + vmbreak; + } + vmcase(OP_MUL) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, intop(*, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_nummul(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } + vmbreak; + } + vmcase(OP_DIV) { /* float division (always with floats) */ + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numdiv(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } + vmbreak; + } + vmcase(OP_BAND) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, intop(&, ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BAND)); } + vmbreak; + } + vmcase(OP_BOR) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, intop(|, ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BOR)); } + vmbreak; + } + vmcase(OP_BXOR) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, intop(^, ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BXOR)); } + vmbreak; + } + vmcase(OP_SHL) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, luaV_shiftl(ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHL)); } + vmbreak; + } + vmcase(OP_SHR) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, luaV_shiftl(ib, -ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHR)); } + vmbreak; + } + vmcase(OP_MOD) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, luaV_mod(L, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + lua_Number m; + luai_nummod(L, nb, nc, m); + setfltvalue(ra, m); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } + vmbreak; + } + vmcase(OP_IDIV) { /* floor division */ + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, luaV_div(L, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numidiv(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); } + vmbreak; + } + vmcase(OP_POW) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numpow(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } + vmbreak; + } + vmcase(OP_UNM) { + TValue *rb = RB(i); + lua_Number nb; + if (ttisinteger(rb)) { + lua_Integer ib = ivalue(rb); + setivalue(ra, intop(-, 0, ib)); + } + else if (tonumber(rb, &nb)) { + setfltvalue(ra, luai_numunm(L, nb)); + } + else { + Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); + } + vmbreak; + } + vmcase(OP_BNOT) { + TValue *rb = RB(i); + lua_Integer ib; + if (tointeger(rb, &ib)) { + setivalue(ra, intop(^, ~l_castS2U(0), ib)); + } + else { + Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); + } + vmbreak; + } + vmcase(OP_NOT) { + TValue *rb = RB(i); + int res = l_isfalse(rb); /* next assignment may change this value */ + setbvalue(ra, res); + vmbreak; + } + vmcase(OP_LEN) { + Protect(luaV_objlen(L, ra, RB(i))); + vmbreak; + } + vmcase(OP_CONCAT) { + int b = GETARG_B(i); + int c = GETARG_C(i); + StkId rb; + L->top = base + c + 1; /* mark the end of concat operands */ + Protect(luaV_concat(L, c - b + 1)); + ra = RA(i); /* 'luaV_concat' may invoke TMs and move the stack */ + rb = base + b; + setobjs2s(L, ra, rb); + checkGC(L, (ra >= rb ? ra + 1 : rb)); + L->top = ci->top; /* restore top */ + vmbreak; + } + vmcase(OP_JMP) { + dojump(ci, i, 0); + vmbreak; + } + vmcase(OP_EQ) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (luaV_equalobj(L, rb, rc) != GETARG_A(i)) + ci->u.l.savedpc++; + else + donextjump(ci); + ) + vmbreak; + } + vmcase(OP_LT) { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i)) + ci->u.l.savedpc++; + else + donextjump(ci); + ) + vmbreak; + } + vmcase(OP_LE) { + Protect( + if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) + ci->u.l.savedpc++; + else + donextjump(ci); + ) + vmbreak; + } + vmcase(OP_TEST) { + if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra)) + ci->u.l.savedpc++; + else + donextjump(ci); + vmbreak; + } + vmcase(OP_TESTSET) { + TValue *rb = RB(i); + if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb)) + ci->u.l.savedpc++; + else { + setobjs2s(L, ra, rb); + donextjump(ci); + } + vmbreak; + } + vmcase(OP_CALL) { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + if (luaD_precall(L, ra, nresults)) { /* C function? */ + if (nresults >= 0) + L->top = ci->top; /* adjust results */ + Protect((void)0); /* update 'base' */ + } + else { /* Lua function */ + ci = L->ci; + goto newframe; /* restart luaV_execute over new Lua function */ + } + vmbreak; + } + vmcase(OP_TAILCALL) { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + if (luaD_precall(L, ra, LUA_MULTRET)) { /* C function? */ + Protect((void)0); /* update 'base' */ + } + else { + /* tail call: put called frame (n) in place of caller one (o) */ + CallInfo *nci = L->ci; /* called frame */ + CallInfo *oci = nci->previous; /* caller frame */ + StkId nfunc = nci->func; /* called function */ + StkId ofunc = oci->func; /* caller function */ + /* last stack slot filled by 'precall' */ + StkId lim = nci->u.l.base + getproto(nfunc)->numparams; + int aux; + /* close all upvalues from previous call */ + if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base); + /* move new frame into old one */ + for (aux = 0; nfunc + aux < lim; aux++) + setobjs2s(L, ofunc + aux, nfunc + aux); + oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ + oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ + oci->u.l.savedpc = nci->u.l.savedpc; + oci->callstatus |= CIST_TAIL; /* function was tail called */ + ci = L->ci = oci; /* remove new frame */ + lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); + goto newframe; /* restart luaV_execute over new Lua function */ + } + vmbreak; + } + vmcase(OP_RETURN) { + int b = GETARG_B(i); + if (cl->p->sizep > 0) luaF_close(L, base); + b = luaD_poscall(L, ci, ra, (b != 0 ? b - 1 : cast_int(L->top - ra))); + if (ci->callstatus & CIST_FRESH) /* local 'ci' still from callee */ + return; /* external invocation: return */ + else { /* invocation via reentry: continue execution */ + ci = L->ci; + if (b) L->top = ci->top; + lua_assert(isLua(ci)); + lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL); + goto newframe; /* restart luaV_execute over new Lua function */ + } + } + vmcase(OP_FORLOOP) { + if (ttisinteger(ra)) { /* integer loop? */ + lua_Integer step = ivalue(ra + 2); + lua_Integer idx = intop(+, ivalue(ra), step); /* increment index */ + lua_Integer limit = ivalue(ra + 1); + if ((0 < step) ? (idx <= limit) : (limit <= idx)) { + ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ + chgivalue(ra, idx); /* update internal index... */ + setivalue(ra + 3, idx); /* ...and external index */ + } + } + else { /* floating loop */ + lua_Number step = fltvalue(ra + 2); + lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ + lua_Number limit = fltvalue(ra + 1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ + chgfltvalue(ra, idx); /* update internal index... */ + setfltvalue(ra + 3, idx); /* ...and external index */ + } + } + vmbreak; + } + vmcase(OP_FORPREP) { + TValue *init = ra; + TValue *plimit = ra + 1; + TValue *pstep = ra + 2; + lua_Integer ilimit; + int stopnow; + if (ttisinteger(init) && ttisinteger(pstep) && + forlimit(plimit, &ilimit, ivalue(pstep), &stopnow)) { + /* all values are integer */ + lua_Integer initv = (stopnow ? 0 : ivalue(init)); + setivalue(plimit, ilimit); + setivalue(init, intop(-, initv, ivalue(pstep))); + } + else { /* try making all values floats */ + lua_Number ninit; lua_Number nlimit; lua_Number nstep; + if (!tonumber(plimit, &nlimit)) + luaG_runerror(L, "'for' limit must be a number"); + setfltvalue(plimit, nlimit); + if (!tonumber(pstep, &nstep)) + luaG_runerror(L, "'for' step must be a number"); + setfltvalue(pstep, nstep); + if (!tonumber(init, &ninit)) + luaG_runerror(L, "'for' initial value must be a number"); + setfltvalue(init, luai_numsub(L, ninit, nstep)); + } + ci->u.l.savedpc += GETARG_sBx(i); + vmbreak; + } + vmcase(OP_TFORCALL) { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb + 3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = ci->top; + i = *(ci->u.l.savedpc++); /* go to next instruction */ + ra = RA(i); + lua_assert(GET_OPCODE(i) == OP_TFORLOOP); + goto l_tforloop; + } + vmcase(OP_TFORLOOP) { + l_tforloop: + if (!ttisnil(ra + 1)) { /* continue loop? */ + setobjs2s(L, ra, ra + 1); /* save control variable */ + ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ + } + vmbreak; + } + vmcase(OP_SETLIST) { + int n = GETARG_B(i); + int c = GETARG_C(i); + unsigned int last; + Table *h; + if (n == 0) n = cast_int(L->top - ra) - 1; + if (c == 0) { + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); + c = GETARG_Ax(*ci->u.l.savedpc++); + } + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* preallocate it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + luaH_setint(L, h, last--, val); + luaC_barrierback(L, h, val); + } + L->top = ci->top; /* correct top (in case of previous open call) */ + vmbreak; + } + vmcase(OP_CLOSURE) { + Proto *p = cl->p->p[GETARG_Bx(i)]; + LClosure *ncl = getcached(p, cl->upvals, base); /* cached closure */ + if (ncl == NULL) /* no match? */ + pushclosure(L, p, cl->upvals, base, ra); /* create a new one */ + else + setclLvalue(L, ra, ncl); /* push cashed closure */ + checkGC(L, ra + 1); + vmbreak; + } + vmcase(OP_VARARG) { + int b = GETARG_B(i) - 1; /* required results */ + int j; + int n = cast_int(base - ci->func) - cl->p->numparams - 1; + if (n < 0) /* less arguments than parameters? */ + n = 0; /* no vararg arguments */ + if (b < 0) { /* B == 0? */ + b = n; /* get all var. arguments */ + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + L->top = ra + n; + } + for (j = 0; j < b && j < n; j++) + setobjs2s(L, ra + j, base - n + j); + for (; j < b; j++) /* complete required results with nil */ + setnilvalue(ra + j); + vmbreak; + } + vmcase(OP_EXTRAARG) { + lua_assert(0); + vmbreak; + } + } + } +} + +/* }================================================================== */ + diff --git a/deps/rcheevos/test/lua/src/lvm.h b/deps/rcheevos/test/lua/src/lvm.h new file mode 100644 index 0000000000..422f871949 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lvm.h @@ -0,0 +1,113 @@ +/* +** $Id: lvm.h,v 2.41 2016/12/22 13:08:50 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#if !defined(LUA_NOCVTN2S) +#define cvt2str(o) ttisnumber(o) +#else +#define cvt2str(o) 0 /* no conversion from numbers to strings */ +#endif + + +#if !defined(LUA_NOCVTS2N) +#define cvt2num(o) ttisstring(o) +#else +#define cvt2num(o) 0 /* no conversion from strings to numbers */ +#endif + + +/* +** You can define LUA_FLOORN2I if you want to convert floats to integers +** by flooring them (instead of raising an error if they are not +** integral values) +*/ +#if !defined(LUA_FLOORN2I) +#define LUA_FLOORN2I 0 +#endif + + +#define tonumber(o,n) \ + (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) + +#define tointeger(o,i) \ + (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) + +#define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) + +#define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) + + +/* +** fast track for 'gettable': if 't' is a table and 't[k]' is not nil, +** return 1 with 'slot' pointing to 't[k]' (final result). Otherwise, +** return 0 (meaning it will have to check metamethod) with 'slot' +** pointing to a nil 't[k]' (if 't' is a table) or NULL (otherwise). +** 'f' is the raw get function to use. +*/ +#define luaV_fastget(L,t,k,slot,f) \ + (!ttistable(t) \ + ? (slot = NULL, 0) /* not a table; 'slot' is NULL and result is 0 */ \ + : (slot = f(hvalue(t), k), /* else, do raw access */ \ + !ttisnil(slot))) /* result not nil? */ + +/* +** standard implementation for 'gettable' +*/ +#define luaV_gettable(L,t,k,v) { const TValue *slot; \ + if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ + else luaV_finishget(L,t,k,v,slot); } + + +/* +** Fast track for set table. If 't' is a table and 't[k]' is not nil, +** call GC barrier, do a raw 't[k]=v', and return true; otherwise, +** return false with 'slot' equal to NULL (if 't' is not a table) or +** 'nil'. (This is needed by 'luaV_finishget'.) Note that, if the macro +** returns true, there is no need to 'invalidateTMcache', because the +** call is not creating a new entry. +*/ +#define luaV_fastset(L,t,k,slot,f,v) \ + (!ttistable(t) \ + ? (slot = NULL, 0) \ + : (slot = f(hvalue(t), k), \ + ttisnil(slot) ? 0 \ + : (luaC_barrierback(L, hvalue(t), v), \ + setobj2t(L, cast(TValue *,slot), v), \ + 1))) + + +#define luaV_settable(L,t,k,v) { const TValue *slot; \ + if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ + luaV_finishset(L,t,k,v,slot); } + + + +LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); +LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); +LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, + StkId val, const TValue *slot); +LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, + StkId val, const TValue *slot); +LUAI_FUNC void luaV_finishOp (lua_State *L); +LUAI_FUNC void luaV_execute (lua_State *L); +LUAI_FUNC void luaV_concat (lua_State *L, int total); +LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); +LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); +LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); +LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); + +#endif diff --git a/deps/rcheevos/test/lua/src/lzio.c b/deps/rcheevos/test/lua/src/lzio.c new file mode 100644 index 0000000000..c9e1f491f3 --- /dev/null +++ b/deps/rcheevos/test/lua/src/lzio.c @@ -0,0 +1,68 @@ +/* +** $Id: lzio.c,v 1.37 2015/09/08 15:41:05 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + +#define lzio_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) + return EOZ; + z->n = size - 1; /* discount char being returned */ + z->p = buff; + return cast_uchar(*(z->p++)); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (z->n == 0) { /* no bytes in buffer? */ + if (luaZ_fill(z) == EOZ) /* try to read more */ + return n; /* no more input; return number of missing bytes */ + else { + z->n++; /* luaZ_fill consumed first byte; put it back */ + z->p--; + } + } + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + diff --git a/deps/rcheevos/test/lua/src/lzio.h b/deps/rcheevos/test/lua/src/lzio.h new file mode 100644 index 0000000000..e7b6f34b1e --- /dev/null +++ b/deps/rcheevos/test/lua/src/lzio.h @@ -0,0 +1,66 @@ +/* +** $Id: lzio.h,v 1.31 2015/09/08 15:41:05 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) + + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_buffremove(buff,i) ((buff)->n -= (i)) +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ + (buff)->buffsize, size), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; /* reader function */ + void *data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif diff --git a/deps/rcheevos/test/smw_snes.json b/deps/rcheevos/test/smw_snes.json new file mode 100644 index 0000000000..767b526df8 --- /dev/null +++ b/deps/rcheevos/test/smw_snes.json @@ -0,0 +1,606 @@ +{ + "Success": true, + "PatchData": { + "ID": 228, + "Title": "Super Mario World", + "ConsoleID": 3, + "ForumTopicID": 135, + "Flags": 0, + "ImageIcon": "\/Images\/006972.png", + "ImageTitle": "\/Images\/000021.png", + "ImageIngame": "\/Images\/000022.png", + "ImageBoxArt": "\/Images\/000138.png", + "Publisher": "Nintendo", + "Developer": "Nintendo EAD", + "Genre": "Platforming", + "Released": "JP 1990 , NA 1991 Europe 1992", + "IsFinal": false, + "ConsoleName": "SNES", + "RichPresencePatch": "Lookup:LevelName\r\n0x0=Title Screen\r\n0x14=Yellow Switch Palace\r\n0x28=Yoshi's House\r\n0x29=Yoshi's Island 1\r\n0x2a=Yoshi's Island 2\r\n0x27=Yoshi's Island 3\r\n0x26=Yoshi's Island 4\r\n0x25=#1 Iggy's Castle\r\n0x15=Donut Plains 1\r\n0x9=Donut Plains 2\r\n0x8=Green Switch Palace\r\n0x4=Donut Ghost House\r\n0x3=Top Secret Area\r\n0x5=Donut Plains 3\r\n0x6=Donut Plains 4\r\n0x7=#2 Morton's Castle\r\n0xa=Donut Secret 1\r\n0x13=Donut Secret House\r\n0x2f=Donut Secret 2\r\n0x3e=Vanilla Dome 1\r\n0x3c=Vanilla Dome 2\r\n0x3f=Red Switch Palace\r\n0x2b=Vanilla Ghost House\r\n0x2e=Vanilla Dome 3\r\n0x3d=Vanilla Dome 4\r\n0x40=#3 Lemmy's Castle\r\n0x2d=Vanilla Secret 1\r\n0x1=Vanilla Secret 2\r\n0x2=Vanilla Secret 3\r\n0xb=Vanilla Fortress\r\n0xc=Butter Bridge 1\r\n0xd=Butter Bridge 2\r\n0xe=#4 Ludwig's Castle\r\n0xf=Cheese Bridge Area\r\n0x10=Cookie Mountain\r\n0x11=Soda Lake\r\n0x41=Forest Ghost House\r\n0x42=Forest of Illusion 1\r\n0x43=Forest of Illusion 4\r\n0x44=Forest of Illusion 2\r\n0x45=Blue Switch Palace\r\n0x46=Forest Secret Area\r\n0x47=Forest of Illusion 3\r\n0x1f=Forest Fortress\r\n0x20=#5 Roy's Castle\r\n0x21=Choco-Ghost House\r\n0x22=Chocolate Island 1\r\n0x23=Chocolate Island 3\r\n0x24=Chocolate Island 2\r\n0x1b=Chocolate Fortress\r\n0x1d=Chocolate Island 4\r\n0x1c=Chocolate Island 5\r\n0x1a=#6 Wendy's Castle\r\n0x18=Sunken Ghost Ship\r\n0x3b=Chocolate Secret\r\n0x3a=Valley of Bowser 1\r\n0x39=Valley of Bowser 2\r\n0x38=Valley Ghost House\r\n0x37=Valley of Bowser 3\r\n0x33=Valley of Bowser 4\r\n0x34=#7 Larry's Castle\r\n0x35=Valley Fortress\r\n0x31=Front Door\r\n0x32=Back Door\r\n0x58=Star World 1\r\n0x54=Star World 2\r\n0x56=Star World 3\r\n0x59=Star World 4\r\n0x5a=Star World 5\r\n0x4e=Gnarly\r\n0x4f=Tubular\r\n0x50=Way Cool\r\n0x51=Awesome\r\n0x4c=Groovy\r\n0x4b=Mondo\r\n0x4a=Outrageous\r\n0x49=Funky\r\n\r\nFormat:Lives\r\nFormatType=VALUE\r\n\r\nDisplay:\r\n@LevelName(0xh0013bf), @Lives(0xh0dbe_v+1) lives", + "Achievements": [{ + "ID": 4874, + "MemAddr": "0xH000019=2", + "Title": "I Believe I Can Fly", + "Description": "Collect a feather", + "Points": 2, + "Author": "UNHchabo", + "Modified": 1452548368, + "Created": 1391908064, + "BadgeName": "05506", + "Flags": 3 + }, { + "ID": 4933, + "MemAddr": "0xH0018c2=1", + "Title": "Floating Through The Clouds", + "Description": "Hijack a Lakitu's cloud", + "Points": 2, + "Author": "UNHchabo", + "Modified": 1445779700, + "Created": 1392010935, + "BadgeName": "30357", + "Flags": 3 + }, { + "ID": 341, + "MemAddr": "0x001420=5", + "Title": "Unleash The Dragon", + "Description": "Collect 5 Dragon Coins in a level", + "Points": 3, + "Author": "Scott", + "Modified": 1445783661, + "Created": 1367266583, + "BadgeName": "00549", + "Flags": 3 + }, { + "ID": 342, + "MemAddr": "0xH000dc1=1_0xH0013bf>0", + "Title": "Giddy Up!", + "Description": "Catch a ride with a friend", + "Points": 2, + "Author": "Scott", + "Modified": 1445754183, + "Created": 1367266931, + "BadgeName": "00550", + "Flags": 3 + }, { + "ID": 340, + "MemAddr": "0xH000dbf=99", + "Title": "Rich Mario", + "Description": "Collect 99 coins", + "Points": 5, + "Author": "Scott", + "Modified": 1445757056, + "Created": 1367254976, + "BadgeName": "00547", + "Flags": 3 + }, { + "ID": 1706, + "MemAddr": "0xH001900=80", + "Title": "Maximum Finish", + "Description": "Cross the finish line at the end of the stage and collect the max 50 stars", + "Points": 10, + "Author": "jackolantern", + "Modified": 1372762549, + "Created": 1372674230, + "BadgeName": "02014", + "Flags": 3 + }, { + "ID": 2246, + "MemAddr": "0xH000f31=0.20._R:0xH000f31!=0_0xH000f32=0.20._R:0xH000f32!=0_0xH000f33=0.20._R:0xH000f33!=0_0xH000dbe>d0xH000dbe.8._0xH001411=1.20._R:0xH001411=0", + "Title": "Perfect Bonus Stage", + "Description": "Score 8 extra lives in the 'Bonus Game'", + "Points": 10, + "Author": "Jaarl", + "Modified": 1445783578, + "Created": 1376582613, + "BadgeName": "02739", + "Flags": 3 + }, { + "ID": 2199, + "MemAddr": "0xH001f28=1_0xH001f27=1_0xH001f29=1_0xH001f2a=1", + "Title": "Filling All The Blocks In", + "Description": "Hit the buttons in all four coloured switch palaces", + "Points": 10, + "Author": "jackolantern", + "Modified": 1445756980, + "Created": 1376514114, + "BadgeName": "02720", + "Flags": 3 + }, { + "ID": 2253, + "MemAddr": "0xH0013bf=37_0xH000dd5=1", + "Title": "Iggy Koopa", + "Description": "Defeat Iggy Koopa of Castle #1", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445751693, + "Created": 1376616356, + "BadgeName": "00562", + "Flags": 3 + }, { + "ID": 347, + "MemAddr": "0xH0013bf=7_0xH000dd5=1", + "Title": "Morton Koopa Jr.", + "Description": "Defeat Morton Koopa Jr. of Castle #2", + "Points": 5, + "Author": "Scott", + "Modified": 1445783647, + "Created": 1367322700, + "BadgeName": "00562", + "Flags": 3 + }, { + "ID": 2261, + "MemAddr": "0xH0013bf=64_0xH000dd5=1", + "Title": "Lemmy Koopa", + "Description": "Defeat Lemmy Koopa of Castle #3", + "Points": 10, + "Author": "Jaarl", + "Modified": 1425959153, + "Created": 1376652522, + "BadgeName": "00562", + "Flags": 3 + }, { + "ID": 2262, + "MemAddr": "0xH0013bf=14_0xH000dd5=1", + "Title": "Ludwig von Koopa", + "Description": "Defeat Ludwig von Koopa of Castle #4", + "Points": 10, + "Author": "Jaarl", + "Modified": 1425959133, + "Created": 1376653163, + "BadgeName": "00562", + "Flags": 3 + }, { + "ID": 2306, + "MemAddr": "0xH0013bf=32_0xH000dd5=1", + "Title": "Roy Koopa", + "Description": "Defeat Roy Koopa of Castle #5", + "Points": 10, + "Author": "Jaarl", + "Modified": 1425956637, + "Created": 1376938808, + "BadgeName": "00562", + "Flags": 3 + }, { + "ID": 2309, + "MemAddr": "0xH0013bf=26_0xH000906=1.400._R:0xH0013bf!=26", + "Title": "Wendy O. Koopa", + "Description": "Defeat Wendy O. Koopa of Castle #6", + "Points": 10, + "Author": "Jaarl", + "Modified": 1390938088, + "Created": 1376939582, + "BadgeName": "00562", + "Flags": 3 + }, { + "ID": 2342, + "MemAddr": "0xH0013bf=52_0xH000dd5=1", + "Title": "Larry Koopa", + "Description": "Defeat Larry Koopa of Castle #7", + "Points": 10, + "Author": "Jaarl", + "Modified": 1425959095, + "Created": 1376970283, + "BadgeName": "00562", + "Flags": 3 + }, { + "ID": 2250, + "MemAddr": "0xH0013bf=11(20)_0xH000906=1(20)_R:0xH001411!=1", + "Title": "Reznor", + "Description": "Defeat the Reznor atop Vanilla Dome", + "Points": 10, + "Author": "Jaarl", + "Modified": 1376615087, + "Created": 1376615073, + "BadgeName": "02742", + "Flags": 3 + }, { + "ID": 2307, + "MemAddr": "0xH0013bf=31(20)_0xH000906=1(20)_R:0xH001411!=1", + "Title": "Reznor Again?", + "Description": "Defeat the Reznor in the clearing of the Forest of Illusion", + "Points": 10, + "Author": "Jaarl", + "Modified": 1376938847, + "Created": 1376938811, + "BadgeName": "02742", + "Flags": 3 + }, { + "ID": 2308, + "MemAddr": "0xH0013bf=27.20._0xH000906=1.20._R:0xH001411!=1", + "Title": "Reznor, Do You Ever Give Up?", + "Description": "Defeat the Reznor at the center of Chocolate Island", + "Points": 10, + "Author": "Jaarl", + "Modified": 1445751771, + "Created": 1376938815, + "BadgeName": "02742", + "Flags": 3 + }, { + "ID": 2338, + "MemAddr": "0xH0013bf=53.20._0xH000906=1.20._R:0xH001411!=1", + "Title": "Reznor...", + "Description": "Defeat the Reznor in the Valley of Bowser", + "Points": 10, + "Author": "Jaarl", + "Modified": 1445783707, + "Created": 1376969412, + "BadgeName": "02742", + "Flags": 3 + }, { + "ID": 2275, + "MemAddr": "0xH0013bf=49_R:0xH0013bf!=49_0xH0013f9=3_R:0xH0013f9!=3_0xH0013ef=1_R:0xH0013ef!=1", + "Title": "King Bowser Koopa", + "Description": "Beat Bowser and save the princess (Front Door!)", + "Points": 10, + "Author": "Jaarl", + "Modified": 1445783312, + "Created": 1376742802, + "BadgeName": "02764", + "Flags": 3 + }, { + "ID": 2276, + "MemAddr": "0xH0013bf=49_R:0xH0013bf!=49_0xH0013f9=3_R:0xH0013f9!=3_0xH0013ef=1_R:0xH0013ef!=1_0xH000019=0_R:0xH000019!=0", + "Title": "Baby's First Kiss", + "Description": "Get the princess kiss as Little Mario (Front Door!)", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445783313, + "Created": 1376742805, + "BadgeName": "02765", + "Flags": 3 + }, { + "ID": 2277, + "MemAddr": "0xH0013bf=49_R:0xH0013bf!=49_0xH0013f9=3_R:0xH0013f9!=3_0xH0013ef=1_R:0xH0013ef!=1_0xH000019=3_R:0xH000019!=3", + "Title": "Burning Bowser", + "Description": "Get the princess kiss as Fire Mario (Front Door!)", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445783314, + "Created": 1376742808, + "BadgeName": "02766", + "Flags": 3 + }, { + "ID": 2278, + "MemAddr": "0xH0013bf=49_R:0xH0013bf!=49_0xH0013f9=3_R:0xH0013f9!=3_0xH0013ef=1_R:0xH0013ef!=1_0xH000019=2_R:0xH000019!=2", + "Title": "Flying Finish", + "Description": "Get the princess kiss as Cape Mario (Front Door!)", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445783315, + "Created": 1376742811, + "BadgeName": "02767", + "Flags": 3 + }, { + "ID": 2299, + "MemAddr": "0xH000020=168_R:0xH000020!=168_0xH00001e=248_R:0xH00001e!=248_0xH0013c3=0_R:0xH0013c3!=0_0xH0013bf=19_R:0xH0013bf!=19_0xH001411=0", + "Title": "The Big Boo", + "Description": "Defeat the Big Boo in Donut Secret House", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445751707, + "Created": 1376918022, + "BadgeName": "02797", + "Flags": 3 + }, { + "ID": 2298, + "MemAddr": "0xH0013c3=6", + "Title": "To the Stars!", + "Description": "Reach the Star Road", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445751709, + "Created": 1376918019, + "BadgeName": "02798", + "Flags": 3 + }, { + "ID": 2264, + "MemAddr": "0xH0013c3=3_R:0xH0013c3!=3_0xH001411=0_0xH000007>112_0xH000007<128_0xH000008>112_0xH000008<128", + "Title": "I Could've Sworn...", + "Description": "Get lost in the Forest of Illusion", + "Points": 3, + "Author": "Jaarl", + "Modified": 1445751711, + "Created": 1376657732, + "BadgeName": "02753", + "Flags": 3 + }, { + "ID": 2305, + "MemAddr": "0xH00001e=169_0xH000020=28_0xH0013c3=0_0xH001411=0", + "Title": "Chocolate Donut", + "Description": "Walk in a circle on Chocolate Island", + "Points": 3, + "Author": "Jaarl", + "Modified": 1445754204, + "Created": 1376938805, + "BadgeName": "02806", + "Flags": 3 + }, { + "ID": 2300, + "MemAddr": "0xH0013c3=5", + "Title": "Mario's Special Place", + "Description": "Get to the challenging Special Zone", + "Points": 10, + "Author": "Jaarl", + "Modified": 1445783441, + "Created": 1376918026, + "BadgeName": "02800", + "Flags": 3 + }, { + "ID": 2302, + "MemAddr": "0xH0013c3=5(1)_0xH0013c3=1(1)_R:0xH0013c3=6_R:0xH0013c3=0_R:0xH001f79=0", + "Title": "Change of Scenery", + "Description": "Clear the Special Zone and change the seasons in Mushroom Kingdom", + "Points": 10, + "Author": "Jaarl", + "Modified": 1376929315, + "Created": 1376929303, + "BadgeName": "02803", + "Flags": 3 + }, { + "ID": 2252, + "MemAddr": "0xH0013f3=1.20._0xH001411=1.20._R:0xH001411=0_0xH000019=0.20._R:0xH000019!=0.20.", + "Title": "Too Much Pasta", + "Description": "Let Little Mario load up on mama Luigi's Famous P(asta)-gas!", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445751717, + "Created": 1376615082, + "BadgeName": "02744", + "Flags": 3 + }, { + "ID": 2251, + "MemAddr": "0xH0013f3=1.20._0xH001411=1.20._R:0xH001411=0_0xH000019!=0_R:0xH000019=0", + "Title": "Another Kind of Flying", + "Description": "Send Mario flying with P-gas", + "Points": 5, + "Author": "Jaarl", + "Modified": 1445751754, + "Created": 1376615078, + "BadgeName": "02743", + "Flags": 3 + }, { + "ID": 2263, + "MemAddr": "0xH001697=12_0xH0013bf=66_R:0xH001697=0", + "Title": "Bother The Wigglers", + "Description": "Jump on yellow Wigglers in Forest of Illusion 12 times in a row for a surprise!", + "Points": 10, + "Author": "Jaarl", + "Modified": 1445751796, + "Created": 1376655155, + "BadgeName": "02752", + "Flags": 3 + }, { + "ID": 2274, + "MemAddr": "0xH0013bf=49_R:0xH0013bf!=49_0xH0013f9=3_R:0xH0013f9!=3_0xH001f2e=11_R:0xH001f2e!=11_0xH0013ef=1_R:0xH0013ef!=1", + "Title": "Shortest Route", + "Description": "Clear the fewest stages possible and beat the game", + "Points": 10, + "Author": "Jaarl", + "Modified": 1376742834, + "Created": 1376742799, + "BadgeName": "02768", + "Flags": 3 + }, { + "ID": 2297, + "MemAddr": "0xH001f2e=0.1._0xH001f2e=1.1._0xH001f2e=2.1._0xH001f2e=3.1._0xH001f2e=4.1._0xH001f2e=5.1._0xH001f2e=6.1._0xH001f2e=7.1._0xH001f2e=8.1._0xH001f2e=9.1._0xH001f2e=10.1._0xH001f2e=11.1._0xH0013f9=3_R:0xH000dbe +#include +#include + +#include "lua.h" +#include "lauxlib.h" + +typedef struct { + unsigned char* ram; + int size; +} +memory_t; + +static unsigned peekb(unsigned address, memory_t* memory) { + return address < memory->size ? memory->ram[address] : 0; +} + +static unsigned peek(unsigned address, unsigned num_bytes, void* ud) { + memory_t* memory = (memory_t*)ud; + + switch (num_bytes) { + case 1: return peekb(address, memory); + + case 2: return peekb(address, memory) | + peekb(address + 1, memory) << 8; + + case 4: return peekb(address, memory) | + peekb(address + 1, memory) << 8 | + peekb(address + 2, memory) << 16 | + peekb(address + 3, memory) << 24; + } + + return 0; +} + +static void parse_operand(rc_operand_t* self, const char** memaddr) { + int ret = rc_parse_operand(self, memaddr, 1, NULL, 0); + assert(ret >= 0); + assert(**memaddr == 0); + self->previous = 0; +} + +static void comp_operand(rc_operand_t* self, char expected_type, char expected_size, unsigned expected_value) { + assert(expected_type == self->type); + assert(expected_size == self->size); + assert(expected_value == self->value); +} + +static void parse_comp_operand(const char* memaddr, char expected_type, char expected_size, unsigned expected_value) { + rc_operand_t self; + int ret; + + ret = rc_parse_operand(&self, &memaddr, 1, NULL, 0); + assert(ret >= 0); + assert(*memaddr == 0); + + comp_operand(&self, expected_type, expected_size, expected_value); +} + +static void parse_error_operand(const char* memaddr, int valid_chars) { + rc_operand_t self; + int ret; + const char* begin = memaddr; + + ret = rc_parse_operand(&self, &memaddr, 1, NULL, 0); + assert(ret < 0); + assert(memaddr - begin == valid_chars); +} + +static void parse_comp_operand_value(const char* memaddr, memory_t* memory, unsigned expected_value) { + rc_operand_t self; + unsigned value; + + rc_parse_operand(&self, &memaddr, 1, NULL, 0); + value = rc_evaluate_operand(&self, peek, memory, NULL); + + assert(value == expected_value); +} + +static void test_operand(void) { + { + /*------------------------------------------------------------------------ + TestParseVariableAddress + ------------------------------------------------------------------------*/ + + /* sizes */ + parse_comp_operand("0xH1234", RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U); + parse_comp_operand("0x 1234", RC_OPERAND_ADDRESS, RC_OPERAND_16_BITS, 0x1234U); + parse_comp_operand("0x1234", RC_OPERAND_ADDRESS, RC_OPERAND_16_BITS, 0x1234U); + parse_comp_operand("0xW1234", RC_OPERAND_ADDRESS, RC_OPERAND_24_BITS, 0x1234U); + parse_comp_operand("0xX1234", RC_OPERAND_ADDRESS, RC_OPERAND_32_BITS, 0x1234U); + parse_comp_operand("0xL1234", RC_OPERAND_ADDRESS, RC_OPERAND_LOW, 0x1234U); + parse_comp_operand("0xU1234", RC_OPERAND_ADDRESS, RC_OPERAND_HIGH, 0x1234U); + parse_comp_operand("0xM1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_0, 0x1234U); + parse_comp_operand("0xN1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_1, 0x1234U); + parse_comp_operand("0xO1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_2, 0x1234U); + parse_comp_operand("0xP1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_3, 0x1234U); + parse_comp_operand("0xQ1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_4, 0x1234U); + parse_comp_operand("0xR1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_5, 0x1234U); + parse_comp_operand("0xS1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_6, 0x1234U); + parse_comp_operand("0xT1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_7, 0x1234U); + + /* sizes (ignore case) */ + parse_comp_operand("0Xh1234", RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U); + parse_comp_operand("0xx1234", RC_OPERAND_ADDRESS, RC_OPERAND_32_BITS, 0x1234U); + parse_comp_operand("0xl1234", RC_OPERAND_ADDRESS, RC_OPERAND_LOW, 0x1234U); + parse_comp_operand("0xu1234", RC_OPERAND_ADDRESS, RC_OPERAND_HIGH, 0x1234U); + parse_comp_operand("0xm1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_0, 0x1234U); + parse_comp_operand("0xn1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_1, 0x1234U); + parse_comp_operand("0xo1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_2, 0x1234U); + parse_comp_operand("0xp1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_3, 0x1234U); + parse_comp_operand("0xq1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_4, 0x1234U); + parse_comp_operand("0xr1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_5, 0x1234U); + parse_comp_operand("0xs1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_6, 0x1234U); + parse_comp_operand("0xt1234", RC_OPERAND_ADDRESS, RC_OPERAND_BIT_7, 0x1234U); + + /* addresses */ + parse_comp_operand("0xH0000", RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x0000U); + parse_comp_operand("0xH12345678", RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x12345678U); + parse_comp_operand("0xHABCD", RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0xABCDU); + parse_comp_operand("0xhabcd", RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0xABCDU); + } + + { + /*------------------------------------------------------------------------ + TestParseVariableDeltaMem + ------------------------------------------------------------------------*/ + + /* sizes */ + parse_comp_operand("d0xH1234", RC_OPERAND_DELTA, RC_OPERAND_8_BITS, 0x1234U); + parse_comp_operand("d0x 1234", RC_OPERAND_DELTA, RC_OPERAND_16_BITS, 0x1234U); + parse_comp_operand("d0x1234", RC_OPERAND_DELTA, RC_OPERAND_16_BITS, 0x1234U); + parse_comp_operand("d0xW1234", RC_OPERAND_DELTA, RC_OPERAND_24_BITS, 0x1234U); + parse_comp_operand("d0xX1234", RC_OPERAND_DELTA, RC_OPERAND_32_BITS, 0x1234U); + parse_comp_operand("d0xL1234", RC_OPERAND_DELTA, RC_OPERAND_LOW, 0x1234U); + parse_comp_operand("d0xU1234", RC_OPERAND_DELTA, RC_OPERAND_HIGH, 0x1234U); + parse_comp_operand("d0xM1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_0, 0x1234U); + parse_comp_operand("d0xN1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_1, 0x1234U); + parse_comp_operand("d0xO1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_2, 0x1234U); + parse_comp_operand("d0xP1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_3, 0x1234U); + parse_comp_operand("d0xQ1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_4, 0x1234U); + parse_comp_operand("d0xR1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_5, 0x1234U); + parse_comp_operand("d0xS1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_6, 0x1234U); + parse_comp_operand("d0xT1234", RC_OPERAND_DELTA, RC_OPERAND_BIT_7, 0x1234U); + + /* ignores case */ + parse_comp_operand("D0Xh1234", RC_OPERAND_DELTA, RC_OPERAND_8_BITS, 0x1234U); + + /* addresses */ + parse_comp_operand("d0xH0000", RC_OPERAND_DELTA, RC_OPERAND_8_BITS, 0x0000U); + parse_comp_operand("d0xH12345678", RC_OPERAND_DELTA, RC_OPERAND_8_BITS, 0x12345678U); + parse_comp_operand("d0xHABCD", RC_OPERAND_DELTA, RC_OPERAND_8_BITS, 0xABCDU); + parse_comp_operand("d0xhabcd", RC_OPERAND_DELTA, RC_OPERAND_8_BITS, 0xABCDU); + } + + { + /*------------------------------------------------------------------------ + TestParseVariableValue + ------------------------------------------------------------------------*/ + + /* decimal - values don't actually have size, default is RC_OPERAND_8_BITS */ + parse_comp_operand("123", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 123U); + parse_comp_operand("123456", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 123456U); + parse_comp_operand("0", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 0U); + parse_comp_operand("0000000000", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 0U); + parse_comp_operand("4294967295", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 4294967295U); + + /* hex - 'H' prefix, not '0x'! */ + parse_comp_operand("H123", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 0x123U); + parse_comp_operand("HABCD", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 0xABCDU); + parse_comp_operand("h123", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 0x123U); + parse_comp_operand("habcd", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 0xABCDU); + parse_comp_operand("HFFFFFFFF", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 4294967295U); + + /* '0x' is an address */ + parse_comp_operand("0x123", RC_OPERAND_ADDRESS, RC_OPERAND_16_BITS, 0x123U); + + /* hex without prefix */ + parse_error_operand("ABCD", 0); + + /* more than 32-bits (error), will be constrained to 32-bits */ + parse_comp_operand("4294967296", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 4294967295U); + + /* negative value (error), will be "wrapped around": -1 = 0x100000000 - 1 = 0xFFFFFFFF = 4294967295 */ + parse_comp_operand("-1", RC_OPERAND_CONST, RC_OPERAND_8_BITS, 4294967295U); + } + + { + /*------------------------------------------------------------------------ + TestVariableGetValue + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + memory.ram = ram; + memory.size = sizeof(ram); + + /* value */ + parse_comp_operand_value("0", &memory, 0x00U); + + /* eight-bit */ + parse_comp_operand_value("0xh0", &memory, 0x00U); + parse_comp_operand_value("0xh1", &memory, 0x12U); + parse_comp_operand_value("0xh4", &memory, 0x56U); + parse_comp_operand_value("0xh5", &memory, 0x00U); /* out of range */ + + /* sixteen-bit */ + parse_comp_operand_value("0x 0", &memory, 0x1200U); + parse_comp_operand_value("0x 3", &memory, 0x56ABU); + parse_comp_operand_value("0x 4", &memory, 0x0056U); /* out of range */ + + /* thirty-two-bit */ + parse_comp_operand_value("0xx0", &memory, 0xAB341200U); + parse_comp_operand_value("0xx1", &memory, 0x56AB3412U); + parse_comp_operand_value("0xx3", &memory, 0x000056ABU); /* out of range */ + + /* nibbles */ + parse_comp_operand_value("0xu0", &memory, 0x0U); + parse_comp_operand_value("0xu1", &memory, 0x1U); + parse_comp_operand_value("0xu4", &memory, 0x5U); + parse_comp_operand_value("0xu5", &memory, 0x0U); /* out of range */ + + parse_comp_operand_value("0xl0", &memory, 0x0U); + parse_comp_operand_value("0xl1", &memory, 0x2U); + parse_comp_operand_value("0xl4", &memory, 0x6U); + parse_comp_operand_value("0xl5", &memory, 0x0U); /* out of range */ + + /* bits */ + parse_comp_operand_value("0xm0", &memory, 0x0U); + parse_comp_operand_value("0xm3", &memory, 0x1U); + parse_comp_operand_value("0xn3", &memory, 0x1U); + parse_comp_operand_value("0xo3", &memory, 0x0U); + parse_comp_operand_value("0xp3", &memory, 0x1U); + parse_comp_operand_value("0xq3", &memory, 0x0U); + parse_comp_operand_value("0xr3", &memory, 0x1U); + parse_comp_operand_value("0xs3", &memory, 0x0U); + parse_comp_operand_value("0xt3", &memory, 0x1U); + parse_comp_operand_value("0xm5", &memory, 0x0U); /* out of range */ + } + + { + /*------------------------------------------------------------------------ + TestVariableGetValueDelta + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_operand_t op; + const char* memaddr; + + memory.ram = ram; + memory.size = sizeof(ram); + + memaddr = "d0xh1"; + parse_operand(&op, &memaddr); + + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x00); /* first call gets uninitialized value */ + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x12); /* second gets current value */ + + /* RC_OPERAND_DELTA is always one frame behind */ + ram[1] = 0x13; + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x12U); + + ram[1] = 0x14; + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x13U); + + ram[1] = 0x15; + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x14U); + + ram[1] = 0x16; + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x15U); + + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x16U); + assert(rc_evaluate_operand(&op, peek, &memory, NULL) == 0x16U); + } +} + +static void parse_condition(rc_condition_t* self, const char* memaddr) { + int ret; + rc_scratch_t scratch; + + ret = 0; + rc_parse_condition(&ret, self, &scratch, &memaddr, NULL, 0); + assert(ret >= 0); + assert(*memaddr == 0); +} + +static void parse_comp_condition( + const char* memaddr, char expected_type, + char expected_left_type, char expected_left_size, unsigned expected_left_value, + char expected_operator, + char expected_right_type, char expected_right_size, unsigned expected_right_value, + int expected_required_hits +) { + rc_condition_t self; + parse_condition(&self, memaddr); + + assert(self.type == expected_type); + comp_operand(&self.operand1, expected_left_type, expected_left_size, expected_left_value); + assert(self.oper == expected_operator); + comp_operand(&self.operand2, expected_right_type, expected_right_size, expected_right_value); + assert(self.required_hits == expected_required_hits); +} + +static void parse_test_condition(const char* memaddr, memory_t* memory, int value) { + rc_condition_t self; + int ret; + rc_scratch_t scratch; + + ret = 0; + rc_parse_condition(&ret, &self, &scratch, &memaddr, NULL, 0); + assert(ret >= 0); + assert(*memaddr == 0); + + ret = rc_test_condition(&self, 0, peek, memory, NULL); + + assert((ret && value) || (!ret && !value)); +} + +static void test_condition(void) { + { + /*------------------------------------------------------------------------ + TestParseConditionMemoryComparisonValue + ------------------------------------------------------------------------*/ + + /* different comparisons */ + parse_comp_condition( + "0xH1234=8", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "0xH1234==8", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "0xH1234!=8", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_NE, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "0xH1234<8", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_LT, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "0xH1234<=8", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_LE, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "0xH1234>8", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_GT, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "0xH1234>=8", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_GE, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + /* delta */ + parse_comp_condition( + "d0xH1234=8", + RC_CONDITION_STANDARD, + RC_OPERAND_DELTA, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + /* flags */ + parse_comp_condition( + "R:0xH1234=8", + RC_CONDITION_RESET_IF, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "P:0xH1234=8", + RC_CONDITION_PAUSE_IF, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "A:0xH1234=8", + RC_CONDITION_ADD_SOURCE, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "B:0xH1234=8", + RC_CONDITION_SUB_SOURCE, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + parse_comp_condition( + "C:0xH1234=8", + RC_CONDITION_ADD_HITS, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 0 + ); + + /* hit count */ + parse_comp_condition( + "0xH1234=8(1)", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 1 + ); + + parse_comp_condition( + "0xH1234=8.1.", /* legacy format */ + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 1 + ); + + parse_comp_condition( + "0xH1234=8(100)", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_CONST, RC_OPERAND_8_BITS, 8U, + 100 + ); + } + + { + /*------------------------------------------------------------------------ + TestParseConditionMemoryComparisonHexValue + ------------------------------------------------------------------------*/ + + /* hex value is interpreted as a 16-bit memory reference */ + parse_comp_condition( + "0xH1234=0x80", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_8_BITS, 0x1234U, + RC_CONDITION_EQ, + RC_OPERAND_ADDRESS, RC_OPERAND_16_BITS, 0x80U, + 0 + ); + } + + { + /*------------------------------------------------------------------------ + TestParseConditionMemoryComparisonMemory + ------------------------------------------------------------------------*/ + + parse_comp_condition( + "0xL1234!=0xU3456", + RC_CONDITION_STANDARD, + RC_OPERAND_ADDRESS, RC_OPERAND_LOW, 0x1234U, + RC_CONDITION_NE, + RC_OPERAND_ADDRESS, RC_OPERAND_HIGH, 0x3456U, + 0 + ); + } + + { + /*------------------------------------------------------------------------ + TestConditionCompare + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + + memory.ram = ram; + memory.size = sizeof(ram); + + /* values */ + parse_test_condition("0xH0001=18", &memory, 1); + parse_test_condition("0xH0001!=18", &memory, 0); + parse_test_condition("0xH0001<=18", &memory, 1); + parse_test_condition("0xH0001>=18", &memory, 1); + parse_test_condition("0xH0001<18", &memory, 0); + parse_test_condition("0xH0001>18", &memory, 0); + parse_test_condition("0xH0001>0", &memory, 1); + parse_test_condition("0xH0001!=0", &memory, 1); + + /* memory */ + parse_test_condition("0xH0001<0xH0002", &memory, 1); + parse_test_condition("0xH0001>0xH0002", &memory, 0); + parse_test_condition("0xH0001=0xH0001", &memory, 1); + parse_test_condition("0xH0001!=0xH0002", &memory, 1); + } + + { + /*------------------------------------------------------------------------ + TestConditionCompareDelta + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_condition_t cond; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_condition(&cond, "0xH0001>d0xH0001"); + + /* initial delta value is 0, 0x12 > 0 */ + assert(rc_test_condition(&cond, 0, peek, &memory, NULL) == 1); + + /* delta value is now 0x12, 0x12 = 0x12 */ + assert(rc_test_condition(&cond, 0, peek, &memory, NULL) == 0); + + /* delta value is now 0x12, 0x11 < 0x12 */ + ram[1] = 0x11; + assert(rc_test_condition(&cond, 0, peek, &memory, NULL) == 0); + + /* delta value is now 0x13, 0x12 > 0x11 */ + ram[1] = 0x12; + assert(rc_test_condition(&cond, 0, peek, &memory, NULL) == 1); + } +} + +static void parse_trigger(rc_trigger_t** self, void* buffer, const char* memaddr) { + assert(rc_trigger_size(memaddr) >= 0); + *self = rc_parse_trigger(buffer, memaddr, NULL, 0); + assert(*self != NULL); +} + +static void comp_trigger(rc_trigger_t* self, memory_t* memory, int expected_result) { + int ret = rc_test_trigger(self, peek, memory, NULL); + assert(expected_result == ret); +} + +static rc_condition_t* condset_get_cond(rc_condset_t* condset, int ndx) { + rc_condition_t* cond = condset->conditions; + + while (ndx-- != 0) { + assert(cond != NULL); + cond = cond->next; + } + + assert(cond != NULL); + return cond; +} + +static rc_condset_t* trigger_get_set(rc_trigger_t* trigger, int ndx) { + rc_condset_t* condset = trigger->alternative; + + if (ndx-- == 0) { + assert(trigger->requirement != NULL); + return trigger->requirement; + } + + while (ndx-- != 0) { + condset = condset->next; + assert(condset != NULL); + } + + assert(condset != NULL); + return condset; +} + +static void test_trigger(void) { + { + /*------------------------------------------------------------------------ + TestSimpleSets + Only standard conditions, no alt groups + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18"); /* one condition, true */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + + parse_trigger(&trigger, buffer, "0xH0001!=18"); /* one condition, false */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + + parse_trigger(&trigger, buffer, "0xH0001=18_0xH0002=52"); /* two conditions, true */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + parse_trigger(&trigger, buffer, "0xH0001=18_0xH0002>52"); /* two conditions, false */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + + parse_trigger(&trigger, buffer, "0xH0001=18_0xH0002=52_0xL0004=6"); /* three conditions, true */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); + + parse_trigger(&trigger, buffer, "0xH0001=16_0xH0002=52_0xL0004=6"); /* three conditions, first false */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); + + parse_trigger(&trigger, buffer, "0xH0001=18_0xH0002=50_0xL0004=6"); /* three conditions, first false */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); + + parse_trigger(&trigger, buffer, "0xH0001=18_0xH0002=52_0xL0004=4"); /* three conditions, first false */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + + parse_trigger(&trigger, buffer, "0xH0001=16_0xH0002=50_0xL0004=4"); /* three conditions, all false */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + } + + { + /*------------------------------------------------------------------------ + TestPauseIf + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18_P:0xH0002=52_P:0xL0x0004=6"); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* Also true, but processing stops on first PauseIf */ + + ram[2] = 0; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); /* PauseIf goes to 0 when false */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); /* PauseIf stays at 1 when false */ + + ram[4] = 0; + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* PauseIf goes to 0 when false */ + } + + { + /*------------------------------------------------------------------------ + TestPauseIfHitCountOne + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18_P:0xH0002=52.1."); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[2] = 0; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); /* PauseIf with HitCount doesn't automatically go back to 0 */ + } + + { + /*------------------------------------------------------------------------ + TestPauseIfHitCountTwo + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18_P:0xH0002=52.2."); + comp_trigger(trigger, &memory, 1); /* PauseIf counter hasn't reached HitCount target, non-PauseIf condition still true */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + comp_trigger(trigger, &memory, 0); /* PauseIf counter has reached HitCount target, non-PauseIf conditions ignored */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + + ram[2] = 0; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); /* PauseIf with HitCount doesn't automatically go back to 0 */ + } + + { + /*------------------------------------------------------------------------ + TestPauseIfHitReset + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18_P:0xH0002=52.1._R:0xH0003=1SR:0xH0003=2"); + comp_trigger(trigger, &memory, 0); /* Trigger PauseIf, non-PauseIf conditions ignored */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 0U); + + ram[2] = 0; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); /* PauseIf with HitCount doesn't automatically go back to 0 */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 0U); + + ram[3] = 1; + comp_trigger(trigger, &memory, 0); /* ResetIf in Paused group is ignored */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 0U); + + ram[3] = 2; + comp_trigger(trigger, &memory, 0); /* ResetIf in alternate group is honored, PauseIf does not retrigger and non-PauseIf condition is true */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* ResetIf causes entire achievement to fail */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 0U); + + ram[3] = 3; + comp_trigger(trigger, &memory, 1); /* ResetIf no longer true, achievement allowed to trigger */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 0U); + } + + { + /*------------------------------------------------------------------------ + TestResetIf + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18_R:0xH0002=50_R:0xL0x0004=4"); + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + + ram[2] = 50; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); /* True, but ResetIf also resets true marker */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + + ram[4] = 0x54; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); /* True, but ResetIf also resets true marker */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* Also true, but processing stop on first ResetIf */ + + ram[2] = 52; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* True, but ResetIf also resets true marker */ + + ram[4] = 0x56; + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + } + + { + /*------------------------------------------------------------------------ + TestHitCount + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=20(2)_0xH0002=52"); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[1] = 20; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 3U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); /* hits stop increment once count it reached */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 4U); + } + + { + /*------------------------------------------------------------------------ + TestHitCountResetIf + Verifies that ResetIf resets HitCounts + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18(2)_0xH0002=52_R:0xL0004=4"); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 3U); + + ram[4] = 0x54; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + + ram[4] = 0x56; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + } + + { + /*------------------------------------------------------------------------ + TestHitCountResetIfHitCount + Verifies that ResetIf with HitCount target only resets HitCounts when target is met + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18(2)_0xH0002=52_R:0xL0004=4.2."); + comp_trigger(trigger, &memory, 0); /* HitCounts on conditions 1 and 2 are incremented */ + comp_trigger(trigger, &memory, 1); /* HitCounts on conditions 1 and 2 are incremented, cond 1 is now true so entire achievement is true */ + comp_trigger(trigger, &memory, 1); /* HitCount on condition 2 is incremented, cond 1 already met its target HitCount */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* ResetIf HitCount should still be 0 */ + + ram[4] = 0x54; + + /* first hit on ResetIf should not reset anything */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); /* condition 1 stopped at it's HitCount target */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 4U); /* condition 2 continues to increment */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); /* ResetIf HitCount should be 1 */ + + /* second hit on ResetIf should reset everything */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* ResetIf HitCount should also be reset */ + } + + { + /*------------------------------------------------------------------------ + TestAddHitsResetIf + Verifies that ResetIf works with AddHits + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "C:0xH0001=18_R:0xL0004=6(3)"); /* never(repeated(3, byte(1) == 18 || low(4) == 6)) */ + comp_trigger(trigger, &memory, 1); /* result is true, no non-reset conditions */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + comp_trigger(trigger, &memory, 0); /* total hits met (2 for each condition, only needed 3 total) (2 hits on condition 2 is not enough), result is always false if reset */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + } + + { + /*------------------------------------------------------------------------ + TestHitCountResetIfHitCountOne + Verifies that ResetIf HitCount(1) behaves like ResetIf without a HitCount + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18(2)_0xH0002=52_R:0xL0004=4.1."); + comp_trigger(trigger, &memory, 0); /* HitCounts on conditions 1 and 2 are incremented */ + comp_trigger(trigger, &memory, 1); /* HitCounts on conditions 1 and 2 are incremented, cond 1 is now true so entire achievement is true */ + comp_trigger(trigger, &memory, 1); /* HitCount on condition 2 is incremented, cond 1 already met its target HitCount */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* ResetIf HitCount should still be 0 */ + + ram[4] = 0x54; + + /* ResetIf HitCount(1) should behave just like ResetIf without a HitCount - all items, including ResetIf should be reset. */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); /* ResetIf HitCount should also be reset */ + } + + { + /*------------------------------------------------------------------------ + TestHitCountPauseIf + Verifies that PauseIf stops HitCount processing + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18(2)_0xH0002=52_P:0xL0004=4"); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[4] = 0x54; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[4] = 0x56; + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + + ram[4] = 0x54; + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + + ram[4] = 0x56; + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 3U); + } + + { + /*------------------------------------------------------------------------ + TestHitCountPauseIfResetIf + Verifies that PauseIf prevents ResetIf processing + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18(2)_R:0xH0002=50_P:0xL0004=4"); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + + ram[4] = 0x54; /* pause */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + + ram[2] = 50; /* reset (but still paused) */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + + ram[4] = 0x56; /* unpause (still reset) */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + + ram[2] = 52; /* unreset */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + } + + { + /*------------------------------------------------------------------------ + TestAddSource + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "A:0xH0001=0_0xH0002=22"); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + + ram[2] = 4; /* sum is correct */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* AddSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[1] = 0; /* first condition is true, but not sum */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* AddSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[2] = 22; /* first condition is true, sum is correct */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* AddSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + } + + { + /*------------------------------------------------------------------------ + TestSubSource + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "B:0xH0002=0_0xH0001=14"); /* NOTE: SubSource subtracts the first value from the second! */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + + ram[2] = 4; /* difference is correct */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[1] = 0; /* first condition is true, but not difference */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[2] = 14; /* first condition is true, value is negative inverse of expected value */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[1] = 28; /* difference is correct again */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + } + + { + /*------------------------------------------------------------------------ + TestAddSubSource + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "A:0xH0001=0_B:0xL0002=0_0xL0004=14"); /* byte(1) - low(2) + low(4) == 14 */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 0U); + + ram[1] = 12; /* total is correct */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* AddSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); + + ram[1] = 0; /* first condition is true, but not total */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* AddSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); + + ram[4] = 18; /* byte(4) would make total true, but not low(4) */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* AddSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 1U); + + ram[2] = 1; + ram[4] = 15; /* difference is correct again */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); /* AddSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 0U); /* SubSource condition does not have hit tracking */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 2)->current_hits == 2U); + } + + { + /*------------------------------------------------------------------------ + TestAddHits + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + rc_condset_t* condset; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "C:0xH0001=18(2)_0xL0004=6(4)"); /* repeated(4, byte(1) == 18 || low(4) == 6) */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + comp_trigger(trigger, &memory, 1); /* total hits met (2 for each condition) */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); /* threshold met, stop incrementing */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); /* total met prevents incrementing even though individual tally has not reached total */ + + rc_reset_condset(trigger->requirement); + + for (condset = trigger->alternative; condset != NULL; condset = condset->next) { + rc_reset_condset(condset); + } + + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 1U); + + ram[1] = 16; + comp_trigger(trigger, &memory, 0); /* 1 + 2 < 4, not met */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 2U); + + comp_trigger(trigger, &memory, 1); /* 1 + 3 = 4, met */ + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 0), 1)->current_hits == 3U); + } + + { + /*------------------------------------------------------------------------ + TestAltGroups + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=16S0xH0002=52S0xL0004=6"); + + /* core not true, both alts are */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 1U); + + ram[1] = 16; /* core and both alts true */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 2U); + + ram[4] = 0; /* core and first alt true */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 2U); + + ram[2] = 0; /* core true, but neither alt is */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 2U); + + ram[4] = 6; /* core and second alt true */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 4U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 3U); + } + + { + /*------------------------------------------------------------------------ + TestResetIfInAltGroup + Verifies that a ResetIf resets everything regardless of where it is + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18(1)_R:0xH0000=1S0xH0002=52(1)S0xL0004=6(1)_R:0xH0000=2"); + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 1U); + + ram[0] = 1; /* reset in core group resets everything */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 0U); + + ram[0] = 0; + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 1U); + + ram[0] = 2; /* reset in alt group resets everything */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 0U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 0U); + } + + { + /*------------------------------------------------------------------------ + TestPauseIfInAltGroup + Verifies that PauseIf only pauses the group it's in + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0001=18_P:0xH0000=1S0xH0002=52S0xL0004=6_P:0xH0000=2"); + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 1U); + + ram[0] = 1; /* pause in core group only pauses core group */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 2U); + + ram[0] = 0; + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 2U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 3U); + + ram[0] = 2; /* pause in alt group only pauses alt group */ + comp_trigger(trigger, &memory, 1); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 3U); + assert(condset_get_cond(trigger_get_set(trigger, 1), 0)->current_hits == 4U); + assert(condset_get_cond(trigger_get_set(trigger, 2), 0)->current_hits == 3U); + } + + { + /*------------------------------------------------------------------------ + TestPauseIfResetIfAltGroup + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_trigger(&trigger, buffer, "0xH0000=0.1._0xH0000=2SP:0xH0001=18_R:0xH0002=52"); + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + + ram[0] = 1; /* move off HitCount */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + + ram[1] = 16; /* unpause alt group, HitCount should be reset */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 0U); + + ram[0] = 0; + ram[1] = 18; /* repause alt group, reset hitcount target, hitcount should be set */ + comp_trigger(trigger, &memory, 0); + assert(condset_get_cond(trigger_get_set(trigger, 0), 0)->current_hits == 1U); + + ram[0] = 2; /* trigger win condition. alt group has no normal conditions, it should be considered false */ + comp_trigger(trigger, &memory, 0); + } +} + +static void parse_comp_term(const char* memaddr, char expected_var_size, unsigned expected_address, int is_bcd, int is_const) { + rc_term_t self; + rc_scratch_t scratch; + int ret; + + ret = 0; + rc_parse_term(&ret, &self, &scratch, &memaddr, NULL, 0); + assert(ret >= 0); + assert(*memaddr == 0); + + assert(is_const || self.operand1.size == expected_var_size); + assert(self.operand1.value == expected_address); + assert(self.operand1.is_bcd == is_bcd); + assert(self.invert == 0); + assert(self.operand2.size == RC_OPERAND_8_BITS); + assert(self.operand2.value == 0U); + assert(!is_const || self.operand1.type == RC_OPERAND_CONST); +} + +static void parse_comp_term_fp(const char* memaddr, char expected_var_size, unsigned expected_address, double fp) { + rc_term_t self; + rc_scratch_t scratch; + int ret; + + ret = 0; + rc_parse_term(&ret, &self, &scratch, &memaddr, NULL, 0); + assert(ret >= 0); + assert(*memaddr == 0); + + assert(self.operand1.size == expected_var_size); + assert(self.operand1.value == expected_address); + assert(self.operand2.type == RC_OPERAND_FP); + assert(self.operand2.fp_value == fp); +} + +static void parse_comp_term_mem(const char* memaddr, char expected_size_1, unsigned expected_address_1, char expected_size_2, unsigned expected_address_2) { + rc_term_t self; + rc_scratch_t scratch; + int ret; + + ret = 0; + rc_parse_term(&ret, &self, &scratch, &memaddr, NULL, 0); + assert(ret >= 0); + assert(*memaddr == 0); + + assert(self.operand1.size == expected_size_1); + assert(self.operand1.value == expected_address_1); + assert(self.operand2.size == expected_size_2); + assert(self.operand2.value == expected_address_2); +} + +static void parse_comp_term_value(const char* memaddr, memory_t* memory, unsigned value) { + rc_term_t self; + rc_scratch_t scratch; + int ret; + + ret = 0; + rc_parse_term(&ret, &self, &scratch, &memaddr, NULL, 0); + assert(ret >= 0); + assert(*memaddr == 0); + + assert(rc_evaluate_term(&self, peek, memory, NULL) == value); +} + +static void test_term(void) { + { + /*------------------------------------------------------------------------ + TestClauseParseFromString + ------------------------------------------------------------------------*/ + + /* sizes */ + parse_comp_term("0xH1234", RC_OPERAND_8_BITS, 0x1234U, 0, 0); + parse_comp_term("0x 1234", RC_OPERAND_16_BITS, 0x1234U, 0, 0); + parse_comp_term("0x1234", RC_OPERAND_16_BITS, 0x1234U, 0, 0); + parse_comp_term("0xW1234", RC_OPERAND_24_BITS, 0x1234U, 0, 0); + parse_comp_term("0xX1234", RC_OPERAND_32_BITS, 0x1234U, 0, 0); + parse_comp_term("0xL1234", RC_OPERAND_LOW, 0x1234U, 0, 0); + parse_comp_term("0xU1234", RC_OPERAND_HIGH, 0x1234U, 0, 0); + parse_comp_term("0xM1234", RC_OPERAND_BIT_0, 0x1234U, 0, 0); + parse_comp_term("0xN1234", RC_OPERAND_BIT_1, 0x1234U, 0, 0); + parse_comp_term("0xO1234", RC_OPERAND_BIT_2, 0x1234U, 0, 0); + parse_comp_term("0xP1234", RC_OPERAND_BIT_3, 0x1234U, 0, 0); + parse_comp_term("0xQ1234", RC_OPERAND_BIT_4, 0x1234U, 0, 0); + parse_comp_term("0xR1234", RC_OPERAND_BIT_5, 0x1234U, 0, 0); + parse_comp_term("0xS1234", RC_OPERAND_BIT_6, 0x1234U, 0, 0); + parse_comp_term("0xT1234", RC_OPERAND_BIT_7, 0x1234U, 0, 0); + + /* BCD */ + parse_comp_term("B0xH1234", RC_OPERAND_8_BITS, 0x1234U, 1, 0); + parse_comp_term("B0xX1234", RC_OPERAND_32_BITS, 0x1234U, 1, 0); + parse_comp_term("b0xH1234", RC_OPERAND_8_BITS, 0x1234U, 1, 0); + + /* Value */ + parse_comp_term("V1234", 0, 1234, 0, 1); + parse_comp_term("V+1", 0, 1, 0, 1); + parse_comp_term("V-1", 0, 0xFFFFFFFFU, 0, 1); + parse_comp_term("V-2", 0, 0xFFFFFFFEU, 0, 1); /* twos compliment still works for addition */ + } + + { + /*------------------------------------------------------------------------ + TestClauseParseFromStringMultiply + ------------------------------------------------------------------------*/ + + parse_comp_term_fp("0xH1234", RC_OPERAND_8_BITS, 0x1234U, 1.0); + parse_comp_term_fp("0xH1234*1", RC_OPERAND_8_BITS, 0x1234U, 1.0); + parse_comp_term_fp("0xH1234*3", RC_OPERAND_8_BITS, 0x1234U, 3.0); + parse_comp_term_fp("0xH1234*0.5", RC_OPERAND_8_BITS, 0x1234U, 0.5); + parse_comp_term_fp("0xH1234*-1", RC_OPERAND_8_BITS, 0x1234U, -1.0); + } + + { + /*------------------------------------------------------------------------ + TestClauseParseFromStringMultiplyAddress + ------------------------------------------------------------------------*/ + + parse_comp_term_mem("0xH1234", RC_OPERAND_8_BITS, 0x1234U, RC_OPERAND_8_BITS, 0U); + parse_comp_term_mem("0xH1234*0xH3456", RC_OPERAND_8_BITS, 0x1234U, RC_OPERAND_8_BITS, 0x3456U); + parse_comp_term_mem("0xH1234*0xL2222", RC_OPERAND_8_BITS, 0x1234U, RC_OPERAND_LOW, 0x2222U); + parse_comp_term_mem("0xH1234*0x1111", RC_OPERAND_8_BITS, 0x1234U, RC_OPERAND_16_BITS, 0x1111U); + } + + { + /*------------------------------------------------------------------------ + TestClauseGetValue + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + + memory.ram = ram; + memory.size = sizeof(ram); + + /* value */ + parse_comp_term_value("V6", &memory, 6); + parse_comp_term_value("V6*2", &memory, 12); + parse_comp_term_value("V6*0.5", &memory, 3); + + /* memory */ + parse_comp_term_value("0xH01", &memory, 0x12); + parse_comp_term_value("0x0001", &memory, 0x3412); + + /* BCD encoding */ + parse_comp_term_value("B0xH01", &memory, 12); + parse_comp_term_value("B0x0001", &memory, 3412); + + /* multiplication */ + parse_comp_term_value("0xH01*4", &memory, 0x12 * 4); /* multiply by constant */ + parse_comp_term_value("0xH01*0.5", &memory, 0x12 / 2); /* multiply by fraction */ + parse_comp_term_value("0xH01*0xH02", &memory, 0x12 * 0x34); /* multiply by second address */ + parse_comp_term_value("0xH01*0xT02", &memory, 0); /* multiply by bit */ + parse_comp_term_value("0xH01*~0xT02", &memory, 0x12); /* multiply by inverse bit */ + parse_comp_term_value("0xH01*~0xH02", &memory, 0x12 * (0x34 ^ 0xff)); /* multiply by inverse byte */ + } +} + +static void parse_comp_value(const char* memaddr, memory_t* memory, unsigned expected_value) { + rc_value_t* self; + char buffer[2048]; + int ret; + + ret = rc_value_size(memaddr); + assert(ret >= 0); + + self = rc_parse_value(buffer, memaddr, NULL, 0); + assert(self != NULL); + + assert(rc_evaluate_value(self, peek, memory, NULL) == expected_value); +} + +static void test_value(void) { + { + /*------------------------------------------------------------------------ + TestAdditionSimple + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + + memory.ram = ram; + memory.size = sizeof(ram); + + parse_comp_value("0xH0001_0xH0002", &memory, 0x12U + 0x34U); /* TestAdditionSimple */ + parse_comp_value("0xH0001*100_0xH0002*0.5_0xL0003", &memory, 0x12U * 100 + 0x34U / 2 + 0x0B);/* TestAdditionComplex */ + parse_comp_value("0xH0001$0xH0002", &memory, 0x34U);/* TestMaximumSimple */ + parse_comp_value("0xH0001_0xH0004*3$0xH0002*0xL0003", &memory, 0x34U * 0xBU);/* TestMaximumComplex */ + } + + { + /*------------------------------------------------------------------------ + TestFormatValue + ------------------------------------------------------------------------*/ + + char buffer[64]; + + rc_format_value(buffer, sizeof(buffer), 12345, RC_FORMAT_VALUE); + assert(!strcmp("12345", buffer)); + + rc_format_value(buffer, sizeof(buffer), 12345, RC_FORMAT_OTHER); + assert(!strcmp("012345", buffer)); + + rc_format_value(buffer, sizeof(buffer), 12345, RC_FORMAT_SCORE); + assert(!strcmp("012345 Points", buffer)); + + rc_format_value(buffer, sizeof(buffer), 12345, RC_FORMAT_SECONDS); + assert(!strcmp("205:45", buffer)); + + rc_format_value(buffer, sizeof(buffer), 12345, RC_FORMAT_CENTISECS); + assert(!strcmp("02:03.45", buffer)); + + rc_format_value(buffer, sizeof(buffer), 12345, RC_FORMAT_FRAMES); + assert(!strcmp("03:25.75", buffer)); + + rc_format_value(buffer, sizeof(buffer), 345, RC_FORMAT_SECONDS); + assert(!strcmp("05:45", buffer)); + + rc_format_value(buffer, sizeof(buffer), 345, RC_FORMAT_CENTISECS); + assert(!strcmp("00:03.45", buffer)); + + rc_format_value(buffer, sizeof(buffer), 345, RC_FORMAT_FRAMES); + assert(!strcmp("00:05.75", buffer)); + } + + { + /*------------------------------------------------------------------------ + TestParseMemValueFormat + ------------------------------------------------------------------------*/ + + assert(rc_parse_format("VALUE") == RC_FORMAT_VALUE); + assert(rc_parse_format("SECS") == RC_FORMAT_SECONDS); + assert(rc_parse_format("TIMESECS") == RC_FORMAT_SECONDS); + assert(rc_parse_format("TIME") == RC_FORMAT_FRAMES); + assert(rc_parse_format("FRAMES") == RC_FORMAT_FRAMES); + assert(rc_parse_format("SCORE") == RC_FORMAT_SCORE); + assert(rc_parse_format("POINTS") == RC_FORMAT_SCORE); + assert(rc_parse_format("MILLISECS") == RC_FORMAT_CENTISECS); + assert(rc_parse_format("OTHER") == RC_FORMAT_OTHER); + assert(rc_parse_format("INVALID") == RC_FORMAT_VALUE); + } +} + +static rc_lboard_t* parse_lboard(const char* memaddr, void* buffer) { + int ret; + rc_lboard_t* self; + + ret = rc_lboard_size(memaddr); + assert(ret >= 0); + self = rc_parse_lboard(buffer, memaddr, NULL, 0); + assert(self != NULL); + return self; +} + +static void lboard_check(const char* memaddr, int expected_ret) { + int ret = rc_lboard_size(memaddr); + assert(ret == expected_ret); +} + +typedef struct { + int active, submitted; +} +lboard_test_state_t; + +static void lboard_reset(rc_lboard_t* lboard, lboard_test_state_t* state) { + rc_reset_lboard(lboard); + state->active = state->submitted = 0; +} + +static unsigned lboard_evaluate(rc_lboard_t* lboard, lboard_test_state_t* test, memory_t* memory) { + unsigned value; + + switch (rc_evaluate_lboard(lboard, &value, peek, memory, NULL)) { + case RC_LBOARD_STARTED: + test->active = 1; + break; + + case RC_LBOARD_CANCELED: + test->active = 0; + break; + + case RC_LBOARD_TRIGGERED: + test->active = 0; + test->submitted = 1; + break; + } + + return value; +} + +static void test_lboard(void) { + { + /*------------------------------------------------------------------------ + TestSimpleLeaderboard + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + unsigned value; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=1::CAN:0xH00=2::SUB:0xH00=3::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + assert(!state.active); + assert(!state.submitted); + + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[0] = 3; /* submit value, but not active */ + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[0] = 2; /* cancel value, but not active */ + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[0] = 1; /* start value */ + value = lboard_evaluate(lboard, &state, &memory); + assert(state.active); + assert(!state.submitted); + + ram[0] = 2; /* cancel value */ + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[0] = 3; /* submit value, but not active */ + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[0] = 1; /* start value */ + value = lboard_evaluate(lboard, &state, &memory); + assert(state.active); + assert(!state.submitted); + + ram[0] = 3; /* submit value */ + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(state.submitted); + assert(value == 0x34U); + } + + { + /*------------------------------------------------------------------------ + TestStartAndCancelSameFrame + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=0::CAN:0xH01=18::SUB:0xH00=3::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[1] = 0x13; /* disables cancel */ + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + assert(!state.submitted); + + ram[1] = 0x12; /* enables cancel */ + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[1] = 0x13; /* disables cancel, but start condition still true, so it shouldn't restart */ + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[0] = 0x01; /* disables start; no effect this frame, but next frame can restart */ + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(!state.submitted); + + ram[0] = 0x00; /* enables start */ + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + assert(!state.submitted); + } + + { + /*------------------------------------------------------------------------ + TestStartAndSubmitSameFrame + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + unsigned value; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=0::CAN:0xH01=10::SUB:0xH01=18::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(state.submitted); + assert(value == 0x34U); + + ram[1] = 0; /* disable submit, value should not be resubmitted, */ + value = lboard_evaluate(lboard, &state, &memory); /* start is still true, but leaderboard should not reactivate */ + assert(!state.active); + + ram[0] = 1; /* disable start */ + value = lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + + ram[0] = 0; /* reenable start, leaderboard should reactivate */ + value = lboard_evaluate(lboard, &state, &memory); + assert(state.active); + } + + { + /*------------------------------------------------------------------------ + TestProgress + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + unsigned value; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + value = lboard_evaluate(lboard, &state, &memory); + assert(state.active); + assert(value == 0x56U); + + lboard = parse_lboard("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + value = lboard_evaluate(lboard, &state, &memory); + assert(state.active); + assert(value == 0x34U); + } + + { + /*------------------------------------------------------------------------ + TestStartAndCondition + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=0_0xH01=0::CAN:0xH01=10::SUB:0xH01=18::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + + ram[1] = 0; /* second part of start condition is true */ + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + } + + { + /*------------------------------------------------------------------------ + TestStartOrCondition + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:S0xH00=1S0xH01=1::CAN:0xH01=10::SUB:0xH01=18::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + + ram[1] = 1; /* second part of start condition is true */ + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + + ram[1] = 0; + lboard_reset(lboard, &state); + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + + ram[0] = 1; /* first part of start condition is true */ + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + } + + { + /*------------------------------------------------------------------------ + TestCancelOrCondition + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=0::CAN:S0xH01=12S0xH02=12::SUB:0xH00=3::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + + ram[2] = 12; /* second part of cancel condition is true */ + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + + ram[2] = 0; /* second part of cancel condition is false */ + lboard_reset(lboard, &state); + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + + ram[1] = 12; /* first part of cancel condition is true */ + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + } + + { + /*------------------------------------------------------------------------ + TestSubmitAndCondition + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=0::CAN:0xH01=10::SUB:0xH01=18_0xH03=18::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + + ram[3] = 18; + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(state.submitted); + } + + { + /*------------------------------------------------------------------------ + TestSubmitOrCondition + ------------------------------------------------------------------------*/ + + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_lboard_t* lboard; + lboard_test_state_t state; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + lboard = parse_lboard("STA:0xH00=0::CAN:0xH01=10::SUB:S0xH01=12S0xH03=12::VAL:0xH02", buffer); + state.active = state.submitted = 0; + + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + + ram[3] = 12; /* second part of submit condition is true */ + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(state.submitted); + + ram[3] = 0; + lboard_reset(lboard, &state); + lboard_evaluate(lboard, &state, &memory); + assert(state.active); + + ram[1] = 12; /* first part of submit condition is true */ + lboard_evaluate(lboard, &state, &memory); + assert(!state.active); + assert(state.submitted); + } + + { + /*------------------------------------------------------------------------ + TestUnparsableStringWillNotStart + We'll test for errors in the memaddr field instead + ------------------------------------------------------------------------*/ + + lboard_check("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02::GARBAGE", RC_INVALID_LBOARD_FIELD); + lboard_check("CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02", RC_MISSING_START); + lboard_check("STA:0xH00=0::SUB:0xH00=3::PRO:0xH04::VAL:0xH02", RC_MISSING_CANCEL); + lboard_check("STA:0xH00=0::CAN:0xH00=2::PRO:0xH04::VAL:0xH02", RC_MISSING_SUBMIT); + lboard_check("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04", RC_MISSING_VALUE); + lboard_check("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02::STA:0=0", RC_DUPLICATED_START); + lboard_check("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02::CAN:0=0", RC_DUPLICATED_CANCEL); + lboard_check("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02::SUB:0=0", RC_DUPLICATED_SUBMIT); + lboard_check("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02::VAL:0", RC_DUPLICATED_VALUE); + lboard_check("STA:0xH00=0::CAN:0xH00=2::SUB:0xH00=3::PRO:0xH04::VAL:0xH02::PRO:0", RC_DUPLICATED_PROGRESS); + } +} + +static void test_lua(void) { + { + /*------------------------------------------------------------------------ + TestJson + ------------------------------------------------------------------------*/ + + lua_State* L; + const char* luacheevo = "return { test = function(peek, ud) return peek(0, 4, ud) end }"; + unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56}; + memory_t memory; + rc_trigger_t* trigger; + char buffer[2048]; + + memory.ram = ram; + memory.size = sizeof(ram); + + L = luaL_newstate(); + luaL_loadbufferx(L, luacheevo, strlen(luacheevo), "luacheevo.lua", "t"); + lua_call(L, 0, 1); + + memory.ram = ram; + memory.size = sizeof(ram); + + trigger = rc_parse_trigger(buffer, "@test=0xX0", L, 1); + assert(rc_test_trigger(trigger, peek, &memory, L) != 0); + } +} + +static void test_json(void) { + { + /*------------------------------------------------------------------------ + TestJson + ------------------------------------------------------------------------*/ + + char json[65536]; + char buffer[65536]; + int res; + const rc_json_patch_t* patch; + + memcpy(json, smw_snes_json, smw_snes_json_len); + json[smw_snes_json_len] = 0; + + res = rc_json_get_patch_size(json); + assert(res >= 0); + patch = rc_json_parse_patch(buffer, json); + + assert(patch->success); + assert(patch->patchdata.id == 228); + assert(!strcmp(patch->patchdata.title, "Super Mario World")); + assert(patch->patchdata.consoleid == 3); + assert(patch->patchdata.topicid == 135); + assert(patch->patchdata.flags == 0); + assert(!strcmp(patch->patchdata.image_icon, "/Images/006972.png")); + assert(!strcmp(patch->patchdata.image_title, "/Images/000021.png")); + assert(!strcmp(patch->patchdata.image_ingame, "/Images/000022.png")); + assert(!strcmp(patch->patchdata.image_boxart, "/Images/000138.png")); + assert(!strcmp(patch->patchdata.publisher, "Nintendo")); + assert(!strcmp(patch->patchdata.developer, "Nintendo EAD")); + assert(!strcmp(patch->patchdata.genre, "Platforming")); + assert(!strcmp(patch->patchdata.released, "JP 1990 , NA 1991 Europe 1992")); + assert(patch->patchdata.is_final == 0); + assert(!strcmp(patch->patchdata.console, "SNES")); + assert(patch->patchdata.presence != NULL); + assert(!strcmp(*patch->patchdata.presence, "Lookup:LevelName\r\n0x0=Title Screen\r\n0x14=Yellow Switch Palace\r\n0x28=Yoshi's House\r\n0x29=Yoshi's Island 1\r\n0x2a=Yoshi's Island 2\r\n0x27=Yoshi's Island 3\r\n0x26=Yoshi's Island 4\r\n0x25=#1 Iggy's Castle\r\n0x15=Donut Plains 1\r\n0x9=Donut Plains 2\r\n0x8=Green Switch Palace\r\n0x4=Donut Ghost House\r\n0x3=Top Secret Area\r\n0x5=Donut Plains 3\r\n0x6=Donut Plains 4\r\n0x7=#2 Morton's Castle\r\n0xa=Donut Secret 1\r\n0x13=Donut Secret House\r\n0x2f=Donut Secret 2\r\n0x3e=Vanilla Dome 1\r\n0x3c=Vanilla Dome 2\r\n0x3f=Red Switch Palace\r\n0x2b=Vanilla Ghost House\r\n0x2e=Vanilla Dome 3\r\n0x3d=Vanilla Dome 4\r\n0x40=#3 Lemmy's Castle\r\n0x2d=Vanilla Secret 1\r\n0x1=Vanilla Secret 2\r\n0x2=Vanilla Secret 3\r\n0xb=Vanilla Fortress\r\n0xc=Butter Bridge 1\r\n0xd=Butter Bridge 2\r\n0xe=#4 Ludwig's Castle\r\n0xf=Cheese Bridge Area\r\n0x10=Cookie Mountain\r\n0x11=Soda Lake\r\n0x41=Forest Ghost House\r\n0x42=Forest of Illusion 1\r\n0x43=Forest of Illusion 4\r\n0x44=Forest of Illusion 2\r\n0x45=Blue Switch Palace\r\n0x46=Forest Secret Area\r\n0x47=Forest of Illusion 3\r\n0x1f=Forest Fortress\r\n0x20=#5 Roy's Castle\r\n0x21=Choco-Ghost House\r\n0x22=Chocolate Island 1\r\n0x23=Chocolate Island 3\r\n0x24=Chocolate Island 2\r\n0x1b=Chocolate Fortress\r\n0x1d=Chocolate Island 4\r\n0x1c=Chocolate Island 5\r\n0x1a=#6 Wendy's Castle\r\n0x18=Sunken Ghost Ship\r\n0x3b=Chocolate Secret\r\n0x3a=Valley of Bowser 1\r\n0x39=Valley of Bowser 2\r\n0x38=Valley Ghost House\r\n0x37=Valley of Bowser 3\r\n0x33=Valley of Bowser 4\r\n0x34=#7 Larry's Castle\r\n0x35=Valley Fortress\r\n0x31=Front Door\r\n0x32=Back Door\r\n0x58=Star World 1\r\n0x54=Star World 2\r\n0x56=Star World 3\r\n0x59=Star World 4\r\n0x5a=Star World 5\r\n0x4e=Gnarly\r\n0x4f=Tubular\r\n0x50=Way Cool\r\n0x51=Awesome\r\n0x4c=Groovy\r\n0x4b=Mondo\r\n0x4a=Outrageous\r\n0x49=Funky\r\n\r\nFormat:Lives\r\nFormatType=VALUE\r\n\r\nDisplay:\r\n@LevelName(0xh0013bf), @Lives(0xh0dbe_v+1) lives")); + assert(patch->patchdata.cheevos_count == 53); + assert(patch->patchdata.lboards_count == 0); + + assert(patch->patchdata.cheevos[0].id == 4874); + assert(!strcmp(patch->patchdata.cheevos[0].memaddr, "0xH000019=2")); + assert(!strcmp(patch->patchdata.cheevos[0].title, "I Believe I Can Fly")); + assert(!strcmp(patch->patchdata.cheevos[0].description, "Collect a feather")); + assert(patch->patchdata.cheevos[0].points == 2); + assert(!strcmp(patch->patchdata.cheevos[0].author, "UNHchabo")); + assert(patch->patchdata.cheevos[0].modified == 1452548368ULL); + assert(patch->patchdata.cheevos[0].created == 1391908064ULL); + assert(!strcmp(patch->patchdata.cheevos[0].badge, "05506")); + assert(patch->patchdata.cheevos[0].flags == 3); + + assert(patch->patchdata.cheevos[52].id == 29667); + assert(!strcmp(patch->patchdata.cheevos[52].memaddr, "0xR001ff5=1_0xH0013bf=58")); + assert(!strcmp(patch->patchdata.cheevos[52].title, "Under A Koopa Moon")); + assert(!strcmp(patch->patchdata.cheevos[52].description, "Collect the 3-Up Moon in the Valley of Bowser")); + assert(patch->patchdata.cheevos[52].points == 2); + assert(!strcmp(patch->patchdata.cheevos[52].author, "Dexterspet")); + assert(patch->patchdata.cheevos[52].modified == 1445783716ULL); + assert(patch->patchdata.cheevos[52].created == 1445754036ULL); + assert(!strcmp(patch->patchdata.cheevos[52].badge, "30351")); + assert(patch->patchdata.cheevos[52].flags == 3); + + memcpy(json, galaga_nes_json, galaga_nes_json_len); + json[galaga_nes_json_len] = 0; + + res = rc_json_get_patch_size(json); + assert(res >= 0); + patch = rc_json_parse_patch(buffer, json); + + assert(patch->patchdata.lboards_count == 1); + + assert(patch->patchdata.lboards[0].id == 310); + assert(!strcmp(patch->patchdata.lboards[0].mem, "STA:0xh0482=1::CAN:0xh0470=0_0xh0471=0::SUB:0xh0485=0_d0xh007a=0_0xh007a=1::VAL:0xh00e5*10_0xh00e4*100_0xh00e3*1000_0xh00e2*10000_0xh00e1*100000_0xh00e0*1000000")); + assert(!strcmp(patch->patchdata.lboards[0].format, "SCORE")); + assert(!strcmp(patch->patchdata.lboards[0].title, "Hi-Score")); + assert(!strcmp(patch->patchdata.lboards[0].description, "Get the highest score possible.")); + } +} + +int main(void) { + test_operand(); + test_condition(); + test_trigger(); + test_term(); + test_value(); + test_lboard(); + test_lua(); + test_json(); + + return 0; +} From 1c3ae4f01db67ce0bed4dcfd72897128ad05b519 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Tue, 31 Jul 2018 22:21:49 +0100 Subject: [PATCH 0003/1292] Added Lua as a dependency --- deps/lua/Makefile | 114 + deps/lua/README | 6 + deps/lua/doc/contents.html | 619 ++ deps/lua/doc/index.css | 21 + deps/lua/doc/logo.gif | Bin 0 -> 9893 bytes deps/lua/doc/lua.1 | 112 + deps/lua/doc/lua.css | 161 + deps/lua/doc/luac.1 | 118 + deps/lua/doc/manual.css | 21 + deps/lua/doc/manual.html | 10982 +++++++++++++++++++++++++ deps/lua/doc/osi-certified-72x60.png | Bin 0 -> 3774 bytes deps/lua/doc/readme.html | 365 + deps/lua/src/Makefile | 197 + deps/lua/src/lapi.c | 1299 +++ deps/lua/src/lapi.h | 24 + deps/lua/src/lauxlib.c | 1043 +++ deps/lua/src/lauxlib.h | 264 + deps/lua/src/lbaselib.c | 498 ++ deps/lua/src/lbitlib.c | 233 + deps/lua/src/lcode.c | 1203 +++ deps/lua/src/lcode.h | 88 + deps/lua/src/lcorolib.c | 168 + deps/lua/src/lctype.c | 55 + deps/lua/src/lctype.h | 95 + deps/lua/src/ldblib.c | 456 + deps/lua/src/ldebug.c | 699 ++ deps/lua/src/ldebug.h | 39 + deps/lua/src/ldo.c | 802 ++ deps/lua/src/ldo.h | 58 + deps/lua/src/ldump.c | 215 + deps/lua/src/lfunc.c | 151 + deps/lua/src/lfunc.h | 61 + deps/lua/src/lgc.c | 1179 +++ deps/lua/src/lgc.h | 147 + deps/lua/src/linit.c | 68 + deps/lua/src/liolib.c | 776 ++ deps/lua/src/llex.c | 565 ++ deps/lua/src/llex.h | 85 + deps/lua/src/llimits.h | 323 + deps/lua/src/lmathlib.c | 410 + deps/lua/src/lmem.c | 100 + deps/lua/src/lmem.h | 69 + deps/lua/src/loadlib.c | 790 ++ deps/lua/src/lobject.c | 522 ++ deps/lua/src/lobject.h | 549 ++ deps/lua/src/lopcodes.c | 124 + deps/lua/src/lopcodes.h | 297 + deps/lua/src/loslib.c | 409 + deps/lua/src/lparser.c | 1650 ++++ deps/lua/src/lparser.h | 133 + deps/lua/src/lprefix.h | 45 + deps/lua/src/lstate.c | 347 + deps/lua/src/lstate.h | 253 + deps/lua/src/lstring.c | 248 + deps/lua/src/lstring.h | 49 + deps/lua/src/lstrlib.c | 1584 ++++ deps/lua/src/ltable.c | 688 ++ deps/lua/src/ltable.h | 66 + deps/lua/src/ltablib.c | 450 + deps/lua/src/ltm.c | 165 + deps/lua/src/ltm.h | 76 + deps/lua/src/lua.c | 612 ++ deps/lua/src/lua.h | 486 ++ deps/lua/src/lua.hpp | 9 + deps/lua/src/luac.c | 450 + deps/lua/src/luaconf.h | 790 ++ deps/lua/src/lualib.h | 61 + deps/lua/src/lundump.c | 279 + deps/lua/src/lundump.h | 32 + deps/lua/src/lutf8lib.c | 256 + deps/lua/src/lvm.c | 1322 +++ deps/lua/src/lvm.h | 113 + deps/lua/src/lzio.c | 68 + deps/lua/src/lzio.h | 66 + 74 files changed, 36878 insertions(+) create mode 100644 deps/lua/Makefile create mode 100644 deps/lua/README create mode 100644 deps/lua/doc/contents.html create mode 100644 deps/lua/doc/index.css create mode 100644 deps/lua/doc/logo.gif create mode 100644 deps/lua/doc/lua.1 create mode 100644 deps/lua/doc/lua.css create mode 100644 deps/lua/doc/luac.1 create mode 100644 deps/lua/doc/manual.css create mode 100644 deps/lua/doc/manual.html create mode 100644 deps/lua/doc/osi-certified-72x60.png create mode 100644 deps/lua/doc/readme.html create mode 100644 deps/lua/src/Makefile create mode 100644 deps/lua/src/lapi.c create mode 100644 deps/lua/src/lapi.h create mode 100644 deps/lua/src/lauxlib.c create mode 100644 deps/lua/src/lauxlib.h create mode 100644 deps/lua/src/lbaselib.c create mode 100644 deps/lua/src/lbitlib.c create mode 100644 deps/lua/src/lcode.c create mode 100644 deps/lua/src/lcode.h create mode 100644 deps/lua/src/lcorolib.c create mode 100644 deps/lua/src/lctype.c create mode 100644 deps/lua/src/lctype.h create mode 100644 deps/lua/src/ldblib.c create mode 100644 deps/lua/src/ldebug.c create mode 100644 deps/lua/src/ldebug.h create mode 100644 deps/lua/src/ldo.c create mode 100644 deps/lua/src/ldo.h create mode 100644 deps/lua/src/ldump.c create mode 100644 deps/lua/src/lfunc.c create mode 100644 deps/lua/src/lfunc.h create mode 100644 deps/lua/src/lgc.c create mode 100644 deps/lua/src/lgc.h create mode 100644 deps/lua/src/linit.c create mode 100644 deps/lua/src/liolib.c create mode 100644 deps/lua/src/llex.c create mode 100644 deps/lua/src/llex.h create mode 100644 deps/lua/src/llimits.h create mode 100644 deps/lua/src/lmathlib.c create mode 100644 deps/lua/src/lmem.c create mode 100644 deps/lua/src/lmem.h create mode 100644 deps/lua/src/loadlib.c create mode 100644 deps/lua/src/lobject.c create mode 100644 deps/lua/src/lobject.h create mode 100644 deps/lua/src/lopcodes.c create mode 100644 deps/lua/src/lopcodes.h create mode 100644 deps/lua/src/loslib.c create mode 100644 deps/lua/src/lparser.c create mode 100644 deps/lua/src/lparser.h create mode 100644 deps/lua/src/lprefix.h create mode 100644 deps/lua/src/lstate.c create mode 100644 deps/lua/src/lstate.h create mode 100644 deps/lua/src/lstring.c create mode 100644 deps/lua/src/lstring.h create mode 100644 deps/lua/src/lstrlib.c create mode 100644 deps/lua/src/ltable.c create mode 100644 deps/lua/src/ltable.h create mode 100644 deps/lua/src/ltablib.c create mode 100644 deps/lua/src/ltm.c create mode 100644 deps/lua/src/ltm.h create mode 100644 deps/lua/src/lua.c create mode 100644 deps/lua/src/lua.h create mode 100644 deps/lua/src/lua.hpp create mode 100644 deps/lua/src/luac.c create mode 100644 deps/lua/src/luaconf.h create mode 100644 deps/lua/src/lualib.h create mode 100644 deps/lua/src/lundump.c create mode 100644 deps/lua/src/lundump.h create mode 100644 deps/lua/src/lutf8lib.c create mode 100644 deps/lua/src/lvm.c create mode 100644 deps/lua/src/lvm.h create mode 100644 deps/lua/src/lzio.c create mode 100644 deps/lua/src/lzio.h diff --git a/deps/lua/Makefile b/deps/lua/Makefile new file mode 100644 index 0000000000..119110d2f0 --- /dev/null +++ b/deps/lua/Makefile @@ -0,0 +1,114 @@ +# Makefile for installing Lua +# See doc/readme.html for installation and customization instructions. + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +# Where to install. The installation starts in the src and doc directories, +# so take care if INSTALL_TOP is not an absolute path. See the local target. +# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with +# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. +INSTALL_TOP= /usr/local +INSTALL_BIN= $(INSTALL_TOP)/bin +INSTALL_INC= $(INSTALL_TOP)/include +INSTALL_LIB= $(INSTALL_TOP)/lib +INSTALL_MAN= $(INSTALL_TOP)/man/man1 +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V + +# How to install. If your install program does not support "-p", then +# you may have to run ranlib on the installed liblua.a. +INSTALL= install -p +INSTALL_EXEC= $(INSTALL) -m 0755 +INSTALL_DATA= $(INSTALL) -m 0644 +# +# If you don't have "install" you can use "cp" instead. +# INSTALL= cp -p +# INSTALL_EXEC= $(INSTALL) +# INSTALL_DATA= $(INSTALL) + +# Other utilities. +MKDIR= mkdir -p +RM= rm -f + +# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + +# Convenience platforms targets. +PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris + +# What to install. +TO_BIN= lua luac +TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp +TO_LIB= liblua.a +TO_MAN= lua.1 luac.1 + +# Lua version and release. +V= 5.3 +R= $V.4 + +# Targets start here. +all: $(PLAT) + +$(PLATS) clean: + cd src && $(MAKE) $@ + +test: dummy + src/lua -v + +install: dummy + cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) + cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) + +uninstall: + cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) + cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC) + cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB) + cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN) + +local: + $(MAKE) install INSTALL_TOP=../install + +none: + @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" + @echo " $(PLATS)" + @echo "See doc/readme.html for complete instructions." + +# make may get confused with test/ and install/ +dummy: + +# echo config parameters +echo: + @cd src && $(MAKE) -s echo + @echo "PLAT= $(PLAT)" + @echo "V= $V" + @echo "R= $R" + @echo "TO_BIN= $(TO_BIN)" + @echo "TO_INC= $(TO_INC)" + @echo "TO_LIB= $(TO_LIB)" + @echo "TO_MAN= $(TO_MAN)" + @echo "INSTALL_TOP= $(INSTALL_TOP)" + @echo "INSTALL_BIN= $(INSTALL_BIN)" + @echo "INSTALL_INC= $(INSTALL_INC)" + @echo "INSTALL_LIB= $(INSTALL_LIB)" + @echo "INSTALL_MAN= $(INSTALL_MAN)" + @echo "INSTALL_LMOD= $(INSTALL_LMOD)" + @echo "INSTALL_CMOD= $(INSTALL_CMOD)" + @echo "INSTALL_EXEC= $(INSTALL_EXEC)" + @echo "INSTALL_DATA= $(INSTALL_DATA)" + +# echo pkg-config data +pc: + @echo "version=$R" + @echo "prefix=$(INSTALL_TOP)" + @echo "libdir=$(INSTALL_LIB)" + @echo "includedir=$(INSTALL_INC)" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho + +# (end of Makefile) diff --git a/deps/lua/README b/deps/lua/README new file mode 100644 index 0000000000..ed424defe0 --- /dev/null +++ b/deps/lua/README @@ -0,0 +1,6 @@ + +This is Lua 5.3.5, released on 26 Jun 2018. + +For installation instructions, license details, and +further information about Lua, see doc/readme.html. + diff --git a/deps/lua/doc/contents.html b/deps/lua/doc/contents.html new file mode 100644 index 0000000000..c4eb267790 --- /dev/null +++ b/deps/lua/doc/contents.html @@ -0,0 +1,619 @@ + + + +Lua 5.3 Reference Manual - contents + + + + + + + +

+Lua +Lua 5.3 Reference Manual +

+ +

+The reference manual is the official definition of the Lua language. +
+For a complete introduction to Lua programming, see the book +Programming in Lua. + +

+ +

+ +Copyright © 2015–2018 Lua.org, PUC-Rio. +Freely available under the terms of the +Lua license. + + +

Contents

+ + +

Index

+ + + + + + + + + + + + + + diff --git a/deps/lua/doc/index.css b/deps/lua/doc/index.css new file mode 100644 index 0000000000..c961835731 --- /dev/null +++ b/deps/lua/doc/index.css @@ -0,0 +1,21 @@ +ul { + list-style-type: none ; +} + +ul.contents { + padding: 0 ; +} + +table { + border: none ; + border-spacing: 0 ; + border-collapse: collapse ; +} + +td { + vertical-align: top ; + padding: 0 ; + text-align: left ; + line-height: 1.25 ; + width: 15% ; +} diff --git a/deps/lua/doc/logo.gif b/deps/lua/doc/logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..5c77eacc3b8f397fb2e87d2aaecd89128e53a117 GIT binary patch literal 9893 zcmZ`JAZZ!6FBhF{g-pRY z?mq`C!p1xV^4?ZTR7k~j;V9G1HDS87U+{!}P$o&rgc4zX0NDT~riS`~QEcMXc4?@W z^+STR)$~fm_`ABgqdI|BbFIpHF{r}hP+etgD8-NQs7W75NaJI?Ql(hqjVakK+HRty zUXfx9(Bq-+-?*K3uw9ID@9?*;-eo#?myt-t^)SGPba%#*OB5Fu=j7)HeEWuc=*-K) z!oqjj0S)u!&5gi;Bahobc>^^a9XUOHT z2|mFhODfM>_&5x-TrvTHjN4n=t}cJHz|Oj&#(Ac#A<;QYj?%w(I{6NHetKEy88L^C$rQ3l)#a6 zoT#z!d-$MNnQ|f0h4|+;?CDm7g1UnqCpv3AVbZ0g!y5D)ht6oJG9OD4(C|vg-ir+_ zH4QGgnPSh+=ffel34{g3QbJKkb?GxJXlu)W&M4!QB^7H4b450C&zK>m4Sy@4- z6QwcXU;C4g#1AgjGlY}HQLNi?RV^MlIy=8Y#lo5nG5DcI$LoBU)7F-?yK5#MO(ZKV z4S#la_H=)P#gQKG^HdgSn#J9BwwdVYIM>{c*8F@wEO$d}R+sxjn>$#7D0Sp=?`**6 zSgb455aPSEq?K#BY9czOB~w zbadnT{PaZ|6MyUb3JQ8>r#+FkD@XhNG?}o-!{}_4A*5_Nyi-4?sw$?YhV}1AdjC?B zgUxkSi}=^CG*t3gMjJh01>e6T@3$!ESeZ^i-|I!u zS;Y;*lPMP-5pj1|J68PThiJLljogBy_@_?@umOG-J7a9_muB|%_5%Y0xG`uvyho24 zIB%XLJt0uPbhhSAqhnKw*C!-wew~ll#zHvKqtx}hu;K?rot-)2DP`g3vIG)P#bW#V z#78r@yHnXrnbSui-|;3*m#OEgl|Ar3-?ZbLj*ECy&1Z-(e4BAv822YtIM?~_>A{XCM0gm<2F`yi=~k^Qpkaj;z9R!JMds*m*#io0jdc7= z_32qZaeQ{RyoLtu;NW0GM#|0W?QI53?3wlUfYmFzOS9J|wG7ON3R+r2E3FBfX*p?^~m1 z6V|U~sT|y#!d_|FC~juNn3R-(U?c)K1cYB-XL+RJsusn5sJ+RfCJjfoveJPB2E8VY ze>-6GiZ=08p%V7#QAzD2(fGeZ=h&GUh!qrTD!o3Hx0HW92SHt(m5Rzw1vQg>ESIRL zceqjS=8oh<74zz*;XjH7mM-Q|N>rkd^6&&UHrgsF*A*1*Ny>erU}PL7XDcg0?d{O* z1OHq$wC4kBW@%Z_)RY<-8R=VoJu1hW%$PbbR=GYYPsi<1pLKq2BJ*9&lH*Mr1@h?- zk$H2rr%((U;g63+%JFe|?|D5i*-R){z1;cs_IMilux#weYs=fwFeyZelpm6zO3TXT zYfVu=SRoN`fR)c~#H3%xLrrVG){XLs%W+C*j!X)3XXS=o9L4Y7Y4c4Nn3e6iqIP!B$P!~=+%bVCorwZbea_d%{9_@+x)gMD z!A=L1w$D$>lAk8s9b;tVXJZqwMyRqA-fVf9jLHaCqMT)d%(`(nU#mfn-S)W6#P; z=3~G1aSyeny@xz{sqe(QAtQ%m7HZiLcGoU!#=I^tB;>)$tUp@4#&}2onV7?oPE35i zlo$@3HMJv8Y>)4(2i;^?lJIo!@e!ZH+B3jmXa9^CL-NPx#NG&|6hO2b&vPRZ#5%&5>oeqS2brR1*C$NtWqMvwVDOx5Y@S#^ z&_6%4yRdnC(v!H)L}^Ka+LW}D-Cm1w)+quD5+xy*Ed+psxoShNndF8Bm$M#>koguj z6f7);EM(I_VR11rgmli6^)M>r$(5Du>ykxlf{`JnO5?K)MC~1O8|-vR+p3I8AN~*= zT@6_!CDC>&*w)uvnR50H4tI|iW17v5G!4tni~8OiB$0i{-skaNkDJ7=p?>-!QAtuK zGH&qwyZv(MezW5r9PF&?$r6pDH(b=RG{xXlS@d8_Q?g~x9Zwmx@oP1+_x>s#?yX&A zJ<$i~41SNKh86dSYQui}G5(udqd)BUytgYi|Dx4(X$bQst#fSOqxZjt63ThVELa(< z=wI@Opzy_vOv)kuWxt8eUN7D5>|Apl8>nubM5%c9f7!7;r$k%CGhCKXT2 z-k!qzYR%Czzyy-azx++9a_n;OQf4Lr3KX3NpT!_=3b$18MH`>vz-i^}tMTVUZ z>>6?`x}LOt@qT{D&)`uV`Y3Z+ZZooW)2=6EW~SdY0o?^b4jI6ZC)@y&ZP@Uz`5D7Z zl7dqFba9n&vrI2DRB5j@vG&K0)N-wxvoW8ny|(k~ASD{ZgPGTs%RJA)pGADun)w|a z9dCPO-ENNA_?|AQmW!TZVZ#avB>&ydPA~a9V`hh<#3X&+zS}w3vd~Kp=B*6_p}bcV zUE^_+>f5sHi>P1s`6V5{K_R*fd;9HOnbE7L83#ush~4-^y8hd8)pE5F z;(t~CR|ixR&)!V>9E-Q}W7qM?>PHTG9O>l`kbNR(){jzBZ*ds4KT^iK9nC2MFeUHP z9338RB2IKBlpAx=O+0EmU0UsJqgAF_Yqf}8Q@d%~4+9$z#-MfW^efyWWMSd6uGf_+ zqjn?n8k;pT-XZ&lpw~#O~n_8?Twhc9ed6YFyb#LI=KCJ zvxB&XLT&i`?-Sp}FiYifPlEId6de`PfSdd$>PIn)jd(&d4rO4 z)`gJ$(5q|9mZSEj+U-Jyj68(nd8|~`FqMr8&xOZFD(-ejPhfMcleKc;TX^`F^Q}P@ zH8mx*zim<8h~pUTMM@?2#=mgs!BWd|-=d!OJHi|z39ur+V?Et3D{3|8<={wSG3*04*38Uo_r^=G9s|a2cvz-V z?>h*Y_J3Cw*8EqJ+E0vUf*#IF9rqE@D5hP3xQMXi$A5?SFx~#$VJzA8YVz(7Q})(U6RbGxnUHX$I?6)oBrzO(9Gijguu~Q)mrI3TvYr5V zlecf*E;%n+iHt!C3&ov}`Pd8MvETwj-e6#3A9{!ob!->gJ&Dyi?9fPmit;{cNQQD} zRloJu`6cIqVp~w*ZEHNPfMO=t?uJUuz+PjK>|*NYH$DV0sZDM5xKUD4+E5i?XUAS~ z&ENey8k;>nVL)7Oe!#gxo%g+OLzzHbZ^Q#Hr?fQO-~Uyl_=%{Dwe=v}>VpS~e)Zfd zq6(`zp2q6M3EN{ptaCKVO!w*q^{zTx5U{s93}a&p(^r#9_g$4P^C zhOAD1#@AZmX9yCK(qOMLy4SZxI3t?z`q%(R0dXh+nA(Xct8Ixl9UWcRw{PM_lWt44 zii-UG-&9%8)deq&#<(253+VH6aJtz4m08Z|cR8Fh9?iD7Y$R^gm6wr0OlHzMRz(`> zc#of!mL@4Fxf?IyQ+0dVt(2A~UOH1LC^|9d2W<@XX~FiNC;9vL0sMRjA2{kA)_ivs zeWeS@SXj{VCnOyl*v3ad<_MUZ(*T3SXZzS^K0w(^57NRwPnw6=RAub}_Hv4CRcFz|73xTIY87ZN%Eu-R<#d?Y0Mk9Z}Bv zYr7mCuc_(%=s#ii#emwHHkH8m#t`<|2Vzt7Ll=jtqy z)$u#R!;`EfUY`u5UOo|I+42}XT)zUCA%0A-^7`I=ZfR-o#M>pI(&x#FQO~-wA&6X` z)yeVAwEKme93k?X@U%31d;)%TT8MV@)M27H{Ks-Nz!g>w@Q)m&r)ECy?&D|eyj2WD z5o~z@y`E18lT9aWgGMI%u|qa35ieo1_7QK4-^D*)V(2O9s-SjK2ozF~_xSI1JUn=b zy>CfBmtzObTZ)&fd8j^&zW*o2Cny~%la4)hePrQ&alp>0b+@msxA}OtZYdw5sBHN6 ztY2{B#7A&&qxUPlZbskj8B0%J@YVO!y3g-G)<+CB0VRNfvmr2^%A)G?(XzvKx_J8c@z3|&{Jf#Q6hf-12#XCn z7r*I(05aTlBn=FvRV={-z0+e8P%4{pPQ2F+ylIcnR!zi{>dI$k4-)qKT;6A1muF^S zK@RG@;X6RE3#zLPC5zl$yRohr!qFKRGMCf%c85Adviqy5tKWrm?BiqK zJlr6{$2}y}emwh4R~Zu<+v)!rAvhG56B@nNgK8~TG-+s&BVCBA0)MH6Qz1MY zE!g%GI++q<31}P~DeNho66M2rTY);Fw)_xu*nZscis(d#~c9jyj zlO_C&>f}=Bs;a6})6=1f$k$?UuQo zZj|=1ToL2BBQGZkFdJ#5n4sGI_w=9=6GwLu$gdFr zh@3YGgbkL}(_R~PjdJ9F=gAn_f;2xJN7|XcD)GfrMW1)WQ8+fEHZ(*N2vyEHta{ym zJ9?aozqKTFj7fv5GVqnYQ;U7M9$e-XJy*c9ovSeEAX* z_qjGGA8%scLJA^GI>}8 z0u=`bV!4{EnHef=;?l|Mk|G&AF^v?P#5t_BW^7QU-Bp)8{tk;~`REdzZuECUqksL% z({@#k_d|!*Zz7-EdY61|W+q6R@mAYKgEF4Y!6Z-K>LVxg*3OQyfuyN0BkoWHzR ze@`Hb)#sM}c1JEkE<$Ag03DiREQpYh&<73>=auitEdPKE5Zio;M8>8#N3>mg$0#?fpooPYP3zvz$nr7G*V7M zL14Z_bdBXaYg~N14k9WJj)Z~&Du{QYWN+27M0$-FY3mA?660V3@hEr#80d}w6uBc2 z&xqbW5PdYDPRl#h-K81fsXxHpZz5AyS!#Y)UzBun<3>V4@)GI(`I&(y^V|Nuxg|$> ze-xu$mXxC-bvJjTp)D$GT`3va6usUGXWYHK56@_&k5|l4vR1Rs&x#osT?6V=nbSGf zNgVWviClW^l>IX%D-Hsnz=(>8T~WS@?M&=}0=Gz!$qFHiCcqgvoX^J_MPyEqLP0_T zb4;*2p#vi+Gj-|xXMBA0c)93JEa7Bg!0Ez*S5~L7_vr6)zKF6xBOtNG78De$aK-4l zeXw5Q`YxaS?ekGnkbI$1mB|Q9bQHQsm_-1i4t)GUm|kp&@+NF2q~fM^;guaSW5drtx9X1l{5mNq(_-&+XiTn`hG7xNubGh-OWvXylx2D+uyhNHEuTL`TXFZQESqr z@1Eb*h7^$7wv@4yyalP)=k5 ztp@8qNET4Yfq*ppnVftWU#Mi{zggx?1(g1hR?AF7gL#a<0p2DqkruOp>mR#??h!I0 zR-@x!50K!O9L8=}OuaAjnD3C{Cg-mEz^5}70Z{c=dST~_(OVbQUEHQ(>p!wd^mKqDerqMHD0f3E%r6}(tKvECnk z>(}yvt*>g`NS`kR``z|Sx)B}Knx6mB7#X>$cNmgf9t?h|w!Pd{EG=yrimJ8SROySp zxuRb~X=L@Xny;x`ErtJobBCTDE_E2|(CyLn{pxKWFOZv&h2JqMsGF|GO01kDe+PLy zCZ(8^n>%hm63f2HmqH2?iyi3eCughAUJ3jj;WSJ(drz_eRlI$h2K7!_=*#0RE{Ao- z{*C5-|KIZRazbu<7{D8Zh5h?Y13)cK=N#LbkXY?s#|?c8LrbUScHD&FT@po=jF7=Q zJI5p{jk#{)GgMSu>}TW67Q*eI6dHvD9)d)Qv9+aheE8Q%){c!2T~2dz&_sUSJl^?GmyDOdBCvz1``m^V5AmdwV#F{P!Yxje4v0fRqp zR0c8$iZ^pI5Eo^>9~8zQBpiJV?j}{#S(bKkib!XHvlbwrhY>}irA;d-W^Q^~(ea4e zl0Mr=%l4D*`m}qM3wX^%3z*^8)%&}$Pbt3P> zOI`DB@Oua*(rNKvFMnQaQ+!Zge6uu-jy?DDE9}LNN5%DPX8foO0k5=z0*XJA%Lm9y ztbj*;>5IhMb>xX|4e|g(z<0lEnM5zuuOs!7$(B5nUNdeqKYH|f!C65=1I!#H6_sfR z=11rir@n9RK8cG5s}JUTpuT(eJ6@i#@aGiQ8q^L#V}Pi6={Kru?FEmZD@?f}3`I;l z;N&?eL*5j)-;QP$&9%6V!Icvenn?mi!1w&9^B-mEvpr8HKt003u*hp~LzSO_-gw)I z^7mfb?O_#4x-f(IQQz9d;Oi<$@=)a`&r@G0chPW81!^O{>$xM(O#*HriRwpQA=EX3 z)q(Zueoq!$w_u^GFC6J^H_I;EZhw9?J3(@DrR%MAF1?v>rYjb&#x|B z5wUP^;**nilr?XOC|@QARsjTzb= zPGt)L{w+KLLbZnHC*_LSkkb&sA8R{;dV%7T@fN$QuPe${#(dgB1s@H9#(J0-7`DM} zDJUqIO-BjG&iP#b#ERz|OqZ(89XU4yh4PD;6~_@jyE2xP#6BLHKCs}*EZwjFB`Yc6 z0b|q!M&DE5=u=!zZv>7aH731o3vN^&n@_hdwLfe?ON)8E<$S*%bh7($vo%BGkKhQL zqKmEgPhOFT`v?)e!oXPs(1~bKHy8;T@`2sy6zKR1nfzs$S`zr7AgVnd7He-uT};rh z*gcgFZigXx)L&RrLn9+EOZVsMY`H{Vbge06VuxE>%?2;e0%_=3A)8MB4?w@Z8_rB8 zWPUxSzs?4&-QpUHB5(^FJ`A7AS5mo6Q4Msp|kLZhOt3Y&C` zRp8q$3q{o`2t|wv(n@LB7#R4k-Uic=H^OCSRqXJtrjERL4#q>QE$|z-aHeBf+eZzn zebx;(4rkY}-rUeC>gvF8IvJmt>HD2Xm&$D5ze)ksDA%0K$X@GlgXerA&<#W>E<(ne zlk_pfilr|2pbP*qG}^t<4`$`b_;n7{O>q@5X=rIT0#F1DMDS_WA zWNXXpvh0++8j2!fi*)&6r%G^q{%gO!S#C~FFa{MZ4gHU9eX~BJ{SI>{5~-Ec>eoUu zndqE>Qz{H#Q$Y$hTi6TFm5sXO9vRXn4JRusEHtb8oR`lZ4c~Um3oDF*D)~KzLLEj< zM~46lYXldOAt9MlS=IP^Nl8Fbk{l1u(gSyJAaz)z3I-OI@Rz*c1WX1H^%PVVz|8~O zE^@R+ec87V^{X{*Z#Sdy04dRvD_;?gqaZ{^OCOonX{;6mwFubrnDFzm1Vz;0KkMq; z603#?5Z&5tl9I4TGkN>LmWx!d{JFWgiExTe-vE`N*l06rN#-yV{Z zmKLUr_Y!)v29ArE*lXIvaO0sQ7J!kX5AWK(%xOSp%2Bb-kMMdf%cP8$K%%Yg{&iI8 zLy9H`I|JUt4jRd1@?e$Ew3|<@L!{zB=>UmiV`Ib9W?UW@TQ$46xfxv3ZnX6Sw`T)& z4^$^fkmWiOrT+y}hvP=Q><17rFdzl&!Q-TLwkU?z=Zl6U#8$PM8sw&nF~Opm8uUcz z-aN4gpf)$ni(KFXa2}Cp8usb85tYDcFb-k3J!vSsEeNWgkcO046OYr z{Pf~Ng@%Tv^V4T5C@KmmDxv|ZYGi5}pO(g>pKv_VRTT@F1+IT{xw)>AlK+Gm1vfWP z`h6yCF!&dfr3;12j?%k&zf_MeEc`B3%zxZqV8_JG%74{BrW8l<;yDQkL3MU^ib_bt z$HaUzH>XWaO@%@${PAKDC@6e%a$={Uq4C1a*_lGBI1(#S$y1B5Vy~sbIHg zXlS_TBd{4CAO8qA92mL7LrYe+$|)KmDcpLkj;L`AxUa0Kwp@fju)Rw4ESvsaq4Nva z^FaB+AS7H$$Mjh53i3+nShux3oMWM-qqF151Vs4H#DtK&J!_eIpscPg0R-yyDh@@= zCfjvk8=@y5_kgd#`0twjR-;WEPGdhXX>VISeU@4^LTa0+cn3CNy>}GTa5OS-H0Ck1 zHwGsND>DlR0}Cqy^9L0cW*$~{9#(D!W>y|%X0efPKmV(Nm5tF?6Sx1};6n@t9B2TM M5|b0H5Z3qqKj-ldMF0Q* literal 0 HcmV?d00001 diff --git a/deps/lua/doc/lua.1 b/deps/lua/doc/lua.1 new file mode 100644 index 0000000000..d728d0b80c --- /dev/null +++ b/deps/lua/doc/lua.1 @@ -0,0 +1,112 @@ +.\" $Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp $ +.TH LUA 1 "$Date: 2016/10/17 15:43:50 $" +.SH NAME +lua \- Lua interpreter +.SH SYNOPSIS +.B lua +[ +.I options +] +[ +.I script +[ +.I args +] +] +.SH DESCRIPTION +.B lua +is the standalone Lua interpreter. +It loads and executes Lua programs, +either in textual source form or +in precompiled binary form. +(Precompiled binaries are output by +.BR luac , +the Lua compiler.) +.B lua +can be used as a batch interpreter and also interactively. +.LP +The given +.I options +are handled in order and then +the Lua program in file +.I script +is loaded and executed. +The given +.I args +are available to +.I script +as strings in a global table named +.BR arg . +If no options or arguments are given, +then +.B "\-v \-i" +is assumed when the standard input is a terminal; +otherwise, +.B "\-" +is assumed. +.LP +In interactive mode, +.B lua +prompts the user, +reads lines from the standard input, +and executes them as they are read. +If the line contains an expression or list of expressions, +then the line is evaluated and the results are printed. +If a line does not contain a complete statement, +then a secondary prompt is displayed and +lines are read until a complete statement is formed or +a syntax error is found. +.LP +At the very start, +before even handling the command line, +.B lua +checks the contents of the environment variables +.B LUA_INIT_5_3 +or +.BR LUA_INIT , +in that order. +If the contents is of the form +.RI '@ filename ', +then +.I filename +is executed. +Otherwise, the string is assumed to be a Lua statement and is executed. +.SH OPTIONS +.TP +.BI \-e " stat" +execute statement +.IR stat . +.TP +.B \-i +enter interactive mode after executing +.IR script . +.TP +.BI \-l " name" +execute the equivalent of +.IB name =require(' name ') +before executing +.IR script . +.TP +.B \-v +show version information. +.TP +.B \-E +ignore environment variables. +.TP +.B \-\- +stop handling options. +.TP +.B \- +stop handling options and execute the standard input as a file. +.SH "SEE ALSO" +.BR luac (1) +.br +The documentation at lua.org, +especially section 7 of the reference manual. +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH AUTHORS +R. Ierusalimschy, +L. H. de Figueiredo, +W. Celes +.\" EOF diff --git a/deps/lua/doc/lua.css b/deps/lua/doc/lua.css new file mode 100644 index 0000000000..cbd0799d15 --- /dev/null +++ b/deps/lua/doc/lua.css @@ -0,0 +1,161 @@ +html { + background-color: #F8F8F8 ; +} + +body { + background-color: #FFFFFF ; + color: #000000 ; + font-family: Helvetica, Arial, sans-serif ; + text-align: justify ; + line-height: 1.25 ; + margin: 16px auto ; + padding: 32px ; + border: solid #ccc 1px ; + border-radius: 20px ; + max-width: 70em ; + width: 90% ; +} + +h1, h2, h3, h4 { + color: #000080 ; + font-family: Verdana, Geneva, sans-serif ; + font-weight: normal ; + font-style: normal ; + text-align: left ; +} + +h1 { + font-size: 28pt ; +} + +h1 img { + vertical-align: text-bottom ; +} + +h2:before { + content: "\2756" ; + padding-right: 0.5em ; +} + +a { + text-decoration: none ; +} + +a:link { + color: #000080 ; +} + +a:link:hover, a:visited:hover { + background-color: #D0D0FF ; + color: #000080 ; + border-radius: 4px ; +} + +a:link:active, a:visited:active { + color: #FF0000 ; +} + +div.menubar { + padding-bottom: 0.5em ; +} + +p.menubar { + margin-left: 2.5em ; +} + +.menubar a:hover { + margin: -3px -3px -3px -3px ; + padding: 3px 3px 3px 3px ; + border-radius: 4px ; +} + +:target { + background-color: #F0F0F0 ; + margin: -8px ; + padding: 8px ; + border-radius: 8px ; + outline: none ; +} + +hr { + display: none ; +} + +table hr { + background-color: #a0a0a0 ; + color: #a0a0a0 ; + border: 0 ; + height: 1px ; + display: block ; +} + +.footer { + color: gray ; + font-size: x-small ; + text-transform: lowercase ; +} + +input[type=text] { + border: solid #a0a0a0 2px ; + border-radius: 2em ; + background-image: url('images/search.png') ; + background-repeat: no-repeat ; + background-position: 4px center ; + padding-left: 20px ; + height: 2em ; +} + +pre.session { + background-color: #F8F8F8 ; + padding: 1em ; + border-radius: 8px ; +} + +table { + border: none ; + border-spacing: 0 ; + border-collapse: collapse ; +} + +td { + padding: 0 ; + margin: 0 ; +} + +td.gutter { + width: 4% ; +} + +table.columns td { + vertical-align: top ; + padding-bottom: 1em ; + text-align: justify ; + line-height: 1.25 ; +} + +table.book td { + vertical-align: top ; +} + +table.book td.cover { + padding-right: 1em ; +} + +table.book img { + border: solid #000080 1px ; +} + +table.book span { + font-size: small ; + text-align: left ; + display: block ; + margin-top: 0.25em ; +} + +p.logos a:link:hover, p.logos a:visited:hover { + background-color: inherit ; +} + +img { + background-color: white ; +} diff --git a/deps/lua/doc/luac.1 b/deps/lua/doc/luac.1 new file mode 100644 index 0000000000..33a4ed00ac --- /dev/null +++ b/deps/lua/doc/luac.1 @@ -0,0 +1,118 @@ +.\" $Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp $ +.TH LUAC 1 "$Date: 2011/11/16 13:53:40 $" +.SH NAME +luac \- Lua compiler +.SH SYNOPSIS +.B luac +[ +.I options +] [ +.I filenames +] +.SH DESCRIPTION +.B luac +is the Lua compiler. +It translates programs written in the Lua programming language +into binary files containing precompiled chunks +that can be later loaded and executed. +.LP +The main advantages of precompiling chunks are: +faster loading, +protecting source code from accidental user changes, +and +off-line syntax checking. +Precompiling does not imply faster execution +because in Lua chunks are always compiled into bytecodes before being executed. +.B luac +simply allows those bytecodes to be saved in a file for later execution. +Precompiled chunks are not necessarily smaller than the corresponding source. +The main goal in precompiling is faster loading. +.LP +In the command line, +you can mix +text files containing Lua source and +binary files containing precompiled chunks. +.B luac +produces a single output file containing the combined bytecodes +for all files given. +Executing the combined file is equivalent to executing the given files. +By default, +the output file is named +.BR luac.out , +but you can change this with the +.B \-o +option. +.LP +Precompiled chunks are +.I not +portable across different architectures. +Moreover, +the internal format of precompiled chunks +is likely to change when a new version of Lua is released. +Make sure you save the source files of all Lua programs that you precompile. +.LP +.SH OPTIONS +.TP +.B \-l +produce a listing of the compiled bytecode for Lua's virtual machine. +Listing bytecodes is useful to learn about Lua's virtual machine. +If no files are given, then +.B luac +loads +.B luac.out +and lists its contents. +Use +.B \-l \-l +for a full listing. +.TP +.BI \-o " file" +output to +.IR file , +instead of the default +.BR luac.out . +(You can use +.B "'\-'" +for standard output, +but not on platforms that open standard output in text mode.) +The output file may be one of the given files because +all files are loaded before the output file is written. +Be careful not to overwrite precious files. +.TP +.B \-p +load files but do not generate any output file. +Used mainly for syntax checking and for testing precompiled chunks: +corrupted files will probably generate errors when loaded. +If no files are given, then +.B luac +loads +.B luac.out +and tests its contents. +No messages are displayed if the file loads without errors. +.TP +.B \-s +strip debug information before writing the output file. +This saves some space in very large chunks, +but if errors occur when running a stripped chunk, +then the error messages may not contain the full information they usually do. +In particular, +line numbers and names of local variables are lost. +.TP +.B \-v +show version information. +.TP +.B \-\- +stop handling options. +.TP +.B \- +stop handling options and process standard input. +.SH "SEE ALSO" +.BR lua (1) +.br +The documentation at lua.org. +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH AUTHORS +R. Ierusalimschy, +L. H. de Figueiredo, +W. Celes +.\" EOF diff --git a/deps/lua/doc/manual.css b/deps/lua/doc/manual.css new file mode 100644 index 0000000000..aa0e677dd5 --- /dev/null +++ b/deps/lua/doc/manual.css @@ -0,0 +1,21 @@ +h3 code { + font-family: inherit ; + font-size: inherit ; +} + +pre, code { + font-size: 12pt ; +} + +span.apii { + color: gray ; + float: right ; + font-family: inherit ; + font-style: normal ; + font-size: small ; +} + +h2:before { + content: "" ; + padding-right: 0em ; +} diff --git a/deps/lua/doc/manual.html b/deps/lua/doc/manual.html new file mode 100644 index 0000000000..89a642a45d --- /dev/null +++ b/deps/lua/doc/manual.html @@ -0,0 +1,10982 @@ + + + +Lua 5.3 Reference Manual + + + + + + + +

+Lua +Lua 5.3 Reference Manual +

+ +

+by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes + +

+ +Copyright © 2015–2018 Lua.org, PUC-Rio. +Freely available under the terms of the +Lua license. + + +

+ + +

+ + + + + + +

1 – Introduction

+ +

+Lua is a powerful, efficient, lightweight, embeddable scripting language. +It supports procedural programming, +object-oriented programming, functional programming, +data-driven programming, and data description. + + +

+Lua combines simple procedural syntax with powerful data description +constructs based on associative arrays and extensible semantics. +Lua is dynamically typed, +runs by interpreting bytecode with a register-based +virtual machine, +and has automatic memory management with +incremental garbage collection, +making it ideal for configuration, scripting, +and rapid prototyping. + + +

+Lua is implemented as a library, written in clean C, +the common subset of Standard C and C++. +The Lua distribution includes a host program called lua, +which uses the Lua library to offer a complete, +standalone Lua interpreter, +for interactive or batch use. +Lua is intended to be used both as a powerful, lightweight, +embeddable scripting language for any program that needs one, +and as a powerful but lightweight and efficient stand-alone language. + + +

+As an extension language, Lua has no notion of a "main" program: +it works embedded in a host client, +called the embedding program or simply the host. +(Frequently, this host is the stand-alone lua program.) +The host program can invoke functions to execute a piece of Lua code, +can write and read Lua variables, +and can register C functions to be called by Lua code. +Through the use of C functions, Lua can be augmented to cope with +a wide range of different domains, +thus creating customized programming languages sharing a syntactical framework. + + +

+Lua is free software, +and is provided as usual with no guarantees, +as stated in its license. +The implementation described in this manual is available +at Lua's official web site, www.lua.org. + + +

+Like any other reference manual, +this document is dry in places. +For a discussion of the decisions behind the design of Lua, +see the technical papers available at Lua's web site. +For a detailed introduction to programming in Lua, +see Roberto's book, Programming in Lua. + + + +

2 – Basic Concepts

+ +

+This section describes the basic concepts of the language. + + + +

2.1 – Values and Types

+ +

+Lua is a dynamically typed language. +This means that +variables do not have types; only values do. +There are no type definitions in the language. +All values carry their own type. + + +

+All values in Lua are first-class values. +This means that all values can be stored in variables, +passed as arguments to other functions, and returned as results. + + +

+There are eight basic types in Lua: +nil, boolean, number, +string, function, userdata, +thread, and table. +The type nil has one single value, nil, +whose main property is to be different from any other value; +it usually represents the absence of a useful value. +The type boolean has two values, false and true. +Both nil and false make a condition false; +any other value makes it true. +The type number represents both +integer numbers and real (floating-point) numbers. +The type string represents immutable sequences of bytes. + +Lua is 8-bit clean: +strings can contain any 8-bit value, +including embedded zeros ('\0'). +Lua is also encoding-agnostic; +it makes no assumptions about the contents of a string. + + +

+The type number uses two internal representations, +or two subtypes, +one called integer and the other called float. +Lua has explicit rules about when each representation is used, +but it also converts between them automatically as needed (see §3.4.3). +Therefore, +the programmer may choose to mostly ignore the difference +between integers and floats +or to assume complete control over the representation of each number. +Standard Lua uses 64-bit integers and double-precision (64-bit) floats, +but you can also compile Lua so that it +uses 32-bit integers and/or single-precision (32-bit) floats. +The option with 32 bits for both integers and floats +is particularly attractive +for small machines and embedded systems. +(See macro LUA_32BITS in file luaconf.h.) + + +

+Lua can call (and manipulate) functions written in Lua and +functions written in C (see §3.4.10). +Both are represented by the type function. + + +

+The type userdata is provided to allow arbitrary C data to +be stored in Lua variables. +A userdata value represents a block of raw memory. +There are two kinds of userdata: +full userdata, +which is an object with a block of memory managed by Lua, +and light userdata, +which is simply a C pointer value. +Userdata has no predefined operations in Lua, +except assignment and identity test. +By using metatables, +the programmer can define operations for full userdata values +(see §2.4). +Userdata values cannot be created or modified in Lua, +only through the C API. +This guarantees the integrity of data owned by the host program. + + +

+The type thread represents independent threads of execution +and it is used to implement coroutines (see §2.6). +Lua threads are not related to operating-system threads. +Lua supports coroutines on all systems, +even those that do not support threads natively. + + +

+The type table implements associative arrays, +that is, arrays that can have as indices not only numbers, +but any Lua value except nil and NaN. +(Not a Number is a special value used to represent +undefined or unrepresentable numerical results, such as 0/0.) +Tables can be heterogeneous; +that is, they can contain values of all types (except nil). +Any key with value nil is not considered part of the table. +Conversely, any key that is not part of a table has +an associated value nil. + + +

+Tables are the sole data-structuring mechanism in Lua; +they can be used to represent ordinary arrays, lists, +symbol tables, sets, records, graphs, trees, etc. +To represent records, Lua uses the field name as an index. +The language supports this representation by +providing a.name as syntactic sugar for a["name"]. +There are several convenient ways to create tables in Lua +(see §3.4.9). + + +

+Like indices, +the values of table fields can be of any type. +In particular, +because functions are first-class values, +table fields can contain functions. +Thus tables can also carry methods (see §3.4.11). + + +

+The indexing of tables follows +the definition of raw equality in the language. +The expressions a[i] and a[j] +denote the same table element +if and only if i and j are raw equal +(that is, equal without metamethods). +In particular, floats with integral values +are equal to their respective integers +(e.g., 1.0 == 1). +To avoid ambiguities, +any float with integral value used as a key +is converted to its respective integer. +For instance, if you write a[2.0] = true, +the actual key inserted into the table will be the +integer 2. +(On the other hand, +2 and "2" are different Lua values and therefore +denote different table entries.) + + +

+Tables, functions, threads, and (full) userdata values are objects: +variables do not actually contain these values, +only references to them. +Assignment, parameter passing, and function returns +always manipulate references to such values; +these operations do not imply any kind of copy. + + +

+The library function type returns a string describing the type +of a given value (see §6.1). + + + + + +

2.2 – Environments and the Global Environment

+ +

+As will be discussed in §3.2 and §3.3.3, +any reference to a free name +(that is, a name not bound to any declaration) var +is syntactically translated to _ENV.var. +Moreover, every chunk is compiled in the scope of +an external local variable named _ENV (see §3.3.2), +so _ENV itself is never a free name in a chunk. + + +

+Despite the existence of this external _ENV variable and +the translation of free names, +_ENV is a completely regular name. +In particular, +you can define new variables and parameters with that name. +Each reference to a free name uses the _ENV that is +visible at that point in the program, +following the usual visibility rules of Lua (see §3.5). + + +

+Any table used as the value of _ENV is called an environment. + + +

+Lua keeps a distinguished environment called the global environment. +This value is kept at a special index in the C registry (see §4.5). +In Lua, the global variable _G is initialized with this same value. +(_G is never used internally.) + + +

+When Lua loads a chunk, +the default value for its _ENV upvalue +is the global environment (see load). +Therefore, by default, +free names in Lua code refer to entries in the global environment +(and, therefore, they are also called global variables). +Moreover, all standard libraries are loaded in the global environment +and some functions there operate on that environment. +You can use load (or loadfile) +to load a chunk with a different environment. +(In C, you have to load the chunk and then change the value +of its first upvalue.) + + + + + +

2.3 – Error Handling

+ +

+Because Lua is an embedded extension language, +all Lua actions start from C code in the host program +calling a function from the Lua library. +(When you use Lua standalone, +the lua application is the host program.) +Whenever an error occurs during +the compilation or execution of a Lua chunk, +control returns to the host, +which can take appropriate measures +(such as printing an error message). + + +

+Lua code can explicitly generate an error by calling the +error function. +If you need to catch errors in Lua, +you can use pcall or xpcall +to call a given function in protected mode. + + +

+Whenever there is an error, +an error object (also called an error message) +is propagated with information about the error. +Lua itself only generates errors whose error object is a string, +but programs may generate errors with +any value as the error object. +It is up to the Lua program or its host to handle such error objects. + + +

+When you use xpcall or lua_pcall, +you may give a message handler +to be called in case of errors. +This function is called with the original error object +and returns a new error object. +It is called before the error unwinds the stack, +so that it can gather more information about the error, +for instance by inspecting the stack and creating a stack traceback. +This message handler is still protected by the protected call; +so, an error inside the message handler +will call the message handler again. +If this loop goes on for too long, +Lua breaks it and returns an appropriate message. +(The message handler is called only for regular runtime errors. +It is not called for memory-allocation errors +nor for errors while running finalizers.) + + + + + +

2.4 – Metatables and Metamethods

+ +

+Every value in Lua can have a metatable. +This metatable is an ordinary Lua table +that defines the behavior of the original value +under certain special operations. +You can change several aspects of the behavior +of operations over a value by setting specific fields in its metatable. +For instance, when a non-numeric value is the operand of an addition, +Lua checks for a function in the field "__add" of the value's metatable. +If it finds one, +Lua calls this function to perform the addition. + + +

+The key for each event in a metatable is a string +with the event name prefixed by two underscores; +the corresponding values are called metamethods. +In the previous example, the key is "__add" +and the metamethod is the function that performs the addition. +Unless stated otherwise, +metamethods should be function values. + + +

+You can query the metatable of any value +using the getmetatable function. +Lua queries metamethods in metatables using a raw access (see rawget). +So, to retrieve the metamethod for event ev in object o, +Lua does the equivalent to the following code: + +

+     rawget(getmetatable(o) or {}, "__ev")
+
+ +

+You can replace the metatable of tables +using the setmetatable function. +You cannot change the metatable of other types from Lua code +(except by using the debug library (§6.10)); +you should use the C API for that. + + +

+Tables and full userdata have individual metatables +(although multiple tables and userdata can share their metatables). +Values of all other types share one single metatable per type; +that is, there is one single metatable for all numbers, +one for all strings, etc. +By default, a value has no metatable, +but the string library sets a metatable for the string type (see §6.4). + + +

+A metatable controls how an object behaves in +arithmetic operations, bitwise operations, +order comparisons, concatenation, length operation, calls, and indexing. +A metatable also can define a function to be called +when a userdata or a table is garbage collected (§2.5). + + +

+For the unary operators (negation, length, and bitwise NOT), +the metamethod is computed and called with a dummy second operand, +equal to the first one. +This extra operand is only to simplify Lua's internals +(by making these operators behave like a binary operation) +and may be removed in future versions. +(For most uses this extra operand is irrelevant.) + + +

+A detailed list of events controlled by metatables is given next. +Each operation is identified by its corresponding key. + + + +

    + +
  • __add: +the addition (+) operation. +If any operand for an addition is not a number +(nor a string coercible to a number), +Lua will try to call a metamethod. +First, Lua will check the first operand (even if it is valid). +If that operand does not define a metamethod for __add, +then Lua will check the second operand. +If Lua can find a metamethod, +it calls the metamethod with the two operands as arguments, +and the result of the call +(adjusted to one value) +is the result of the operation. +Otherwise, +it raises an error. +
  • + +
  • __sub: +the subtraction (-) operation. +Behavior similar to the addition operation. +
  • + +
  • __mul: +the multiplication (*) operation. +Behavior similar to the addition operation. +
  • + +
  • __div: +the division (/) operation. +Behavior similar to the addition operation. +
  • + +
  • __mod: +the modulo (%) operation. +Behavior similar to the addition operation. +
  • + +
  • __pow: +the exponentiation (^) operation. +Behavior similar to the addition operation. +
  • + +
  • __unm: +the negation (unary -) operation. +Behavior similar to the addition operation. +
  • + +
  • __idiv: +the floor division (//) operation. +Behavior similar to the addition operation. +
  • + +
  • __band: +the bitwise AND (&) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod +if any operand is neither an integer +nor a value coercible to an integer (see §3.4.3). +
  • + +
  • __bor: +the bitwise OR (|) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __bxor: +the bitwise exclusive OR (binary ~) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __bnot: +the bitwise NOT (unary ~) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __shl: +the bitwise left shift (<<) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __shr: +the bitwise right shift (>>) operation. +Behavior similar to the bitwise AND operation. +
  • + +
  • __concat: +the concatenation (..) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod +if any operand is neither a string nor a number +(which is always coercible to a string). +
  • + +
  • __len: +the length (#) operation. +If the object is not a string, +Lua will try its metamethod. +If there is a metamethod, +Lua calls it with the object as argument, +and the result of the call +(always adjusted to one value) +is the result of the operation. +If there is no metamethod but the object is a table, +then Lua uses the table length operation (see §3.4.7). +Otherwise, Lua raises an error. +
  • + +
  • __eq: +the equal (==) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod only when the values +being compared are either both tables or both full userdata +and they are not primitively equal. +The result of the call is always converted to a boolean. +
  • + +
  • __lt: +the less than (<) operation. +Behavior similar to the addition operation, +except that Lua will try a metamethod only when the values +being compared are neither both numbers nor both strings. +The result of the call is always converted to a boolean. +
  • + +
  • __le: +the less equal (<=) operation. +Unlike other operations, +the less-equal operation can use two different events. +First, Lua looks for the __le metamethod in both operands, +like in the less than operation. +If it cannot find such a metamethod, +then it will try the __lt metamethod, +assuming that a <= b is equivalent to not (b < a). +As with the other comparison operators, +the result is always a boolean. +(This use of the __lt event can be removed in future versions; +it is also slower than a real __le metamethod.) +
  • + +
  • __index: +The indexing access operation table[key]. +This event happens when table is not a table or +when key is not present in table. +The metamethod is looked up in table. + + +

    +Despite the name, +the metamethod for this event can be either a function or a table. +If it is a function, +it is called with table and key as arguments, +and the result of the call +(adjusted to one value) +is the result of the operation. +If it is a table, +the final result is the result of indexing this table with key. +(This indexing is regular, not raw, +and therefore can trigger another metamethod.) +

  • + +
  • __newindex: +The indexing assignment table[key] = value. +Like the index event, +this event happens when table is not a table or +when key is not present in table. +The metamethod is looked up in table. + + +

    +Like with indexing, +the metamethod for this event can be either a function or a table. +If it is a function, +it is called with table, key, and value as arguments. +If it is a table, +Lua does an indexing assignment to this table with the same key and value. +(This assignment is regular, not raw, +and therefore can trigger another metamethod.) + + +

    +Whenever there is a __newindex metamethod, +Lua does not perform the primitive assignment. +(If necessary, +the metamethod itself can call rawset +to do the assignment.) +

  • + +
  • __call: +The call operation func(args). +This event happens when Lua tries to call a non-function value +(that is, func is not a function). +The metamethod is looked up in func. +If present, +the metamethod is called with func as its first argument, +followed by the arguments of the original call (args). +All results of the call +are the result of the operation. +(This is the only metamethod that allows multiple results.) +
  • + +
+ +

+It is a good practice to add all needed metamethods to a table +before setting it as a metatable of some object. +In particular, the __gc metamethod works only when this order +is followed (see §2.5.1). + + +

+Because metatables are regular tables, +they can contain arbitrary fields, +not only the event names defined above. +Some functions in the standard library +(e.g., tostring) +use other fields in metatables for their own purposes. + + + + + +

2.5 – Garbage Collection

+ +

+Lua performs automatic memory management. +This means that +you do not have to worry about allocating memory for new objects +or freeing it when the objects are no longer needed. +Lua manages memory automatically by running +a garbage collector to collect all dead objects +(that is, objects that are no longer accessible from Lua). +All memory used by Lua is subject to automatic management: +strings, tables, userdata, functions, threads, internal structures, etc. + + +

+Lua implements an incremental mark-and-sweep collector. +It uses two numbers to control its garbage-collection cycles: +the garbage-collector pause and +the garbage-collector step multiplier. +Both use percentage points as units +(e.g., a value of 100 means an internal value of 1). + + +

+The garbage-collector pause +controls how long the collector waits before starting a new cycle. +Larger values make the collector less aggressive. +Values smaller than 100 mean the collector will not wait to +start a new cycle. +A value of 200 means that the collector waits for the total memory in use +to double before starting a new cycle. + + +

+The garbage-collector step multiplier +controls the relative speed of the collector relative to +memory allocation. +Larger values make the collector more aggressive but also increase +the size of each incremental step. +You should not use values smaller than 100, +because they make the collector too slow and +can result in the collector never finishing a cycle. +The default is 200, +which means that the collector runs at "twice" +the speed of memory allocation. + + +

+If you set the step multiplier to a very large number +(larger than 10% of the maximum number of +bytes that the program may use), +the collector behaves like a stop-the-world collector. +If you then set the pause to 200, +the collector behaves as in old Lua versions, +doing a complete collection every time Lua doubles its +memory usage. + + +

+You can change these numbers by calling lua_gc in C +or collectgarbage in Lua. +You can also use these functions to control +the collector directly (e.g., stop and restart it). + + + +

2.5.1 – Garbage-Collection Metamethods

+ +

+You can set garbage-collector metamethods for tables +and, using the C API, +for full userdata (see §2.4). +These metamethods are also called finalizers. +Finalizers allow you to coordinate Lua's garbage collection +with external resource management +(such as closing files, network or database connections, +or freeing your own memory). + + +

+For an object (table or userdata) to be finalized when collected, +you must mark it for finalization. + +You mark an object for finalization when you set its metatable +and the metatable has a field indexed by the string "__gc". +Note that if you set a metatable without a __gc field +and later create that field in the metatable, +the object will not be marked for finalization. + + +

+When a marked object becomes garbage, +it is not collected immediately by the garbage collector. +Instead, Lua puts it in a list. +After the collection, +Lua goes through that list. +For each object in the list, +it checks the object's __gc metamethod: +If it is a function, +Lua calls it with the object as its single argument; +if the metamethod is not a function, +Lua simply ignores it. + + +

+At the end of each garbage-collection cycle, +the finalizers for objects are called in +the reverse order that the objects were marked for finalization, +among those collected in that cycle; +that is, the first finalizer to be called is the one associated +with the object marked last in the program. +The execution of each finalizer may occur at any point during +the execution of the regular code. + + +

+Because the object being collected must still be used by the finalizer, +that object (and other objects accessible only through it) +must be resurrected by Lua. +Usually, this resurrection is transient, +and the object memory is freed in the next garbage-collection cycle. +However, if the finalizer stores the object in some global place +(e.g., a global variable), +then the resurrection is permanent. +Moreover, if the finalizer marks a finalizing object for finalization again, +its finalizer will be called again in the next cycle where the +object is unreachable. +In any case, +the object memory is freed only in a GC cycle where +the object is unreachable and not marked for finalization. + + +

+When you close a state (see lua_close), +Lua calls the finalizers of all objects marked for finalization, +following the reverse order that they were marked. +If any finalizer marks objects for collection during that phase, +these marks have no effect. + + + + + +

2.5.2 – Weak Tables

+ +

+A weak table is a table whose elements are +weak references. +A weak reference is ignored by the garbage collector. +In other words, +if the only references to an object are weak references, +then the garbage collector will collect that object. + + +

+A weak table can have weak keys, weak values, or both. +A table with weak values allows the collection of its values, +but prevents the collection of its keys. +A table with both weak keys and weak values allows the collection of +both keys and values. +In any case, if either the key or the value is collected, +the whole pair is removed from the table. +The weakness of a table is controlled by the +__mode field of its metatable. +If the __mode field is a string containing the character 'k', +the keys in the table are weak. +If __mode contains 'v', +the values in the table are weak. + + +

+A table with weak keys and strong values +is also called an ephemeron table. +In an ephemeron table, +a value is considered reachable only if its key is reachable. +In particular, +if the only reference to a key comes through its value, +the pair is removed. + + +

+Any change in the weakness of a table may take effect only +at the next collect cycle. +In particular, if you change the weakness to a stronger mode, +Lua may still collect some items from that table +before the change takes effect. + + +

+Only objects that have an explicit construction +are removed from weak tables. +Values, such as numbers and light C functions, +are not subject to garbage collection, +and therefore are not removed from weak tables +(unless their associated values are collected). +Although strings are subject to garbage collection, +they do not have an explicit construction, +and therefore are not removed from weak tables. + + +

+Resurrected objects +(that is, objects being finalized +and objects accessible only through objects being finalized) +have a special behavior in weak tables. +They are removed from weak values before running their finalizers, +but are removed from weak keys only in the next collection +after running their finalizers, when such objects are actually freed. +This behavior allows the finalizer to access properties +associated with the object through weak tables. + + +

+If a weak table is among the resurrected objects in a collection cycle, +it may not be properly cleared until the next cycle. + + + + + + + +

2.6 – Coroutines

+ +

+Lua supports coroutines, +also called collaborative multithreading. +A coroutine in Lua represents an independent thread of execution. +Unlike threads in multithread systems, however, +a coroutine only suspends its execution by explicitly calling +a yield function. + + +

+You create a coroutine by calling coroutine.create. +Its sole argument is a function +that is the main function of the coroutine. +The create function only creates a new coroutine and +returns a handle to it (an object of type thread); +it does not start the coroutine. + + +

+You execute a coroutine by calling coroutine.resume. +When you first call coroutine.resume, +passing as its first argument +a thread returned by coroutine.create, +the coroutine starts its execution by +calling its main function. +Extra arguments passed to coroutine.resume are passed +as arguments to that function. +After the coroutine starts running, +it runs until it terminates or yields. + + +

+A coroutine can terminate its execution in two ways: +normally, when its main function returns +(explicitly or implicitly, after the last instruction); +and abnormally, if there is an unprotected error. +In case of normal termination, +coroutine.resume returns true, +plus any values returned by the coroutine main function. +In case of errors, coroutine.resume returns false +plus an error object. + + +

+A coroutine yields by calling coroutine.yield. +When a coroutine yields, +the corresponding coroutine.resume returns immediately, +even if the yield happens inside nested function calls +(that is, not in the main function, +but in a function directly or indirectly called by the main function). +In the case of a yield, coroutine.resume also returns true, +plus any values passed to coroutine.yield. +The next time you resume the same coroutine, +it continues its execution from the point where it yielded, +with the call to coroutine.yield returning any extra +arguments passed to coroutine.resume. + + +

+Like coroutine.create, +the coroutine.wrap function also creates a coroutine, +but instead of returning the coroutine itself, +it returns a function that, when called, resumes the coroutine. +Any arguments passed to this function +go as extra arguments to coroutine.resume. +coroutine.wrap returns all the values returned by coroutine.resume, +except the first one (the boolean error code). +Unlike coroutine.resume, +coroutine.wrap does not catch errors; +any error is propagated to the caller. + + +

+As an example of how coroutines work, +consider the following code: + +

+     function foo (a)
+       print("foo", a)
+       return coroutine.yield(2*a)
+     end
+     
+     co = coroutine.create(function (a,b)
+           print("co-body", a, b)
+           local r = foo(a+1)
+           print("co-body", r)
+           local r, s = coroutine.yield(a+b, a-b)
+           print("co-body", r, s)
+           return b, "end"
+     end)
+     
+     print("main", coroutine.resume(co, 1, 10))
+     print("main", coroutine.resume(co, "r"))
+     print("main", coroutine.resume(co, "x", "y"))
+     print("main", coroutine.resume(co, "x", "y"))
+

+When you run it, it produces the following output: + +

+     co-body 1       10
+     foo     2
+     main    true    4
+     co-body r
+     main    true    11      -9
+     co-body x       y
+     main    true    10      end
+     main    false   cannot resume dead coroutine
+
+ +

+You can also create and manipulate coroutines through the C API: +see functions lua_newthread, lua_resume, +and lua_yield. + + + + + +

3 – The Language

+ +

+This section describes the lexis, the syntax, and the semantics of Lua. +In other words, +this section describes +which tokens are valid, +how they can be combined, +and what their combinations mean. + + +

+Language constructs will be explained using the usual extended BNF notation, +in which +{a} means 0 or more a's, and +[a] means an optional a. +Non-terminals are shown like non-terminal, +keywords are shown like kword, +and other terminal symbols are shown like ‘=’. +The complete syntax of Lua can be found in §9 +at the end of this manual. + + + +

3.1 – Lexical Conventions

+ +

+Lua is a free-form language. +It ignores spaces (including new lines) and comments +between lexical elements (tokens), +except as delimiters between names and keywords. + + +

+Names +(also called identifiers) +in Lua can be any string of letters, +digits, and underscores, +not beginning with a digit and +not being a reserved word. +Identifiers are used to name variables, table fields, and labels. + + +

+The following keywords are reserved +and cannot be used as names: + + +

+     and       break     do        else      elseif    end
+     false     for       function  goto      if        in
+     local     nil       not       or        repeat    return
+     then      true      until     while
+
+ +

+Lua is a case-sensitive language: +and is a reserved word, but And and AND +are two different, valid names. +As a convention, +programs should avoid creating +names that start with an underscore followed by +one or more uppercase letters (such as _VERSION). + + +

+The following strings denote other tokens: + +

+     +     -     *     /     %     ^     #
+     &     ~     |     <<    >>    //
+     ==    ~=    <=    >=    <     >     =
+     (     )     {     }     [     ]     ::
+     ;     :     ,     .     ..    ...
+
+ +

+A short literal string +can be delimited by matching single or double quotes, +and can contain the following C-like escape sequences: +'\a' (bell), +'\b' (backspace), +'\f' (form feed), +'\n' (newline), +'\r' (carriage return), +'\t' (horizontal tab), +'\v' (vertical tab), +'\\' (backslash), +'\"' (quotation mark [double quote]), +and '\'' (apostrophe [single quote]). +A backslash followed by a line break +results in a newline in the string. +The escape sequence '\z' skips the following span +of white-space characters, +including line breaks; +it is particularly useful to break and indent a long literal string +into multiple lines without adding the newlines and spaces +into the string contents. +A short literal string cannot contain unescaped line breaks +nor escapes not forming a valid escape sequence. + + +

+We can specify any byte in a short literal string by its numeric value +(including embedded zeros). +This can be done +with the escape sequence \xXX, +where XX is a sequence of exactly two hexadecimal digits, +or with the escape sequence \ddd, +where ddd is a sequence of up to three decimal digits. +(Note that if a decimal escape sequence is to be followed by a digit, +it must be expressed using exactly three digits.) + + +

+The UTF-8 encoding of a Unicode character +can be inserted in a literal string with +the escape sequence \u{XXX} +(note the mandatory enclosing brackets), +where XXX is a sequence of one or more hexadecimal digits +representing the character code point. + + +

+Literal strings can also be defined using a long format +enclosed by long brackets. +We define an opening long bracket of level n as an opening +square bracket followed by n equal signs followed by another +opening square bracket. +So, an opening long bracket of level 0 is written as [[, +an opening long bracket of level 1 is written as [=[, +and so on. +A closing long bracket is defined similarly; +for instance, +a closing long bracket of level 4 is written as ]====]. +A long literal starts with an opening long bracket of any level and +ends at the first closing long bracket of the same level. +It can contain any text except a closing bracket of the same level. +Literals in this bracketed form can run for several lines, +do not interpret any escape sequences, +and ignore long brackets of any other level. +Any kind of end-of-line sequence +(carriage return, newline, carriage return followed by newline, +or newline followed by carriage return) +is converted to a simple newline. + + +

+For convenience, +when the opening long bracket is immediately followed by a newline, +the newline is not included in the string. +As an example, in a system using ASCII +(in which 'a' is coded as 97, +newline is coded as 10, and '1' is coded as 49), +the five literal strings below denote the same string: + +

+     a = 'alo\n123"'
+     a = "alo\n123\""
+     a = '\97lo\10\04923"'
+     a = [[alo
+     123"]]
+     a = [==[
+     alo
+     123"]==]
+
+ +

+Any byte in a literal string not +explicitly affected by the previous rules represents itself. +However, Lua opens files for parsing in text mode, +and the system file functions may have problems with +some control characters. +So, it is safer to represent +non-text data as a quoted literal with +explicit escape sequences for the non-text characters. + + +

+A numeric constant (or numeral) +can be written with an optional fractional part +and an optional decimal exponent, +marked by a letter 'e' or 'E'. +Lua also accepts hexadecimal constants, +which start with 0x or 0X. +Hexadecimal constants also accept an optional fractional part +plus an optional binary exponent, +marked by a letter 'p' or 'P'. +A numeric constant with a radix point or an exponent +denotes a float; +otherwise, +if its value fits in an integer, +it denotes an integer. +Examples of valid integer constants are + +

+     3   345   0xff   0xBEBADA
+

+Examples of valid float constants are + +

+     3.0     3.1416     314.16e-2     0.31416E1     34e1
+     0x0.1E  0xA23p-4   0X1.921FB54442D18P+1
+
+ +

+A comment starts with a double hyphen (--) +anywhere outside a string. +If the text immediately after -- is not an opening long bracket, +the comment is a short comment, +which runs until the end of the line. +Otherwise, it is a long comment, +which runs until the corresponding closing long bracket. +Long comments are frequently used to disable code temporarily. + + + + + +

3.2 – Variables

+ +

+Variables are places that store values. +There are three kinds of variables in Lua: +global variables, local variables, and table fields. + + +

+A single name can denote a global variable or a local variable +(or a function's formal parameter, +which is a particular kind of local variable): + +

+	var ::= Name
+

+Name denotes identifiers, as defined in §3.1. + + +

+Any variable name is assumed to be global unless explicitly declared +as a local (see §3.3.7). +Local variables are lexically scoped: +local variables can be freely accessed by functions +defined inside their scope (see §3.5). + + +

+Before the first assignment to a variable, its value is nil. + + +

+Square brackets are used to index a table: + +

+	var ::= prefixexp ‘[’ exp ‘]’
+

+The meaning of accesses to table fields can be changed via metatables +(see §2.4). + + +

+The syntax var.Name is just syntactic sugar for +var["Name"]: + +

+	var ::= prefixexp ‘.’ Name
+
+ +

+An access to a global variable x +is equivalent to _ENV.x. +Due to the way that chunks are compiled, +_ENV is never a global name (see §2.2). + + + + + +

3.3 – Statements

+ +

+Lua supports an almost conventional set of statements, +similar to those in Pascal or C. +This set includes +assignments, control structures, function calls, +and variable declarations. + + + +

3.3.1 – Blocks

+ +

+A block is a list of statements, +which are executed sequentially: + +

+	block ::= {stat}
+

+Lua has empty statements +that allow you to separate statements with semicolons, +start a block with a semicolon +or write two semicolons in sequence: + +

+	stat ::= ‘;’
+
+ +

+Function calls and assignments +can start with an open parenthesis. +This possibility leads to an ambiguity in Lua's grammar. +Consider the following fragment: + +

+     a = b + c
+     (print or io.write)('done')
+

+The grammar could see it in two ways: + +

+     a = b + c(print or io.write)('done')
+     
+     a = b + c; (print or io.write)('done')
+

+The current parser always sees such constructions +in the first way, +interpreting the open parenthesis +as the start of the arguments to a call. +To avoid this ambiguity, +it is a good practice to always precede with a semicolon +statements that start with a parenthesis: + +

+     ;(print or io.write)('done')
+
+ +

+A block can be explicitly delimited to produce a single statement: + +

+	stat ::= do block end
+

+Explicit blocks are useful +to control the scope of variable declarations. +Explicit blocks are also sometimes used to +add a return statement in the middle +of another block (see §3.3.4). + + + + + +

3.3.2 – Chunks

+ +

+The unit of compilation of Lua is called a chunk. +Syntactically, +a chunk is simply a block: + +

+	chunk ::= block
+
+ +

+Lua handles a chunk as the body of an anonymous function +with a variable number of arguments +(see §3.4.11). +As such, chunks can define local variables, +receive arguments, and return values. +Moreover, such anonymous function is compiled as in the +scope of an external local variable called _ENV (see §2.2). +The resulting function always has _ENV as its only upvalue, +even if it does not use that variable. + + +

+A chunk can be stored in a file or in a string inside the host program. +To execute a chunk, +Lua first loads it, +precompiling the chunk's code into instructions for a virtual machine, +and then Lua executes the compiled code +with an interpreter for the virtual machine. + + +

+Chunks can also be precompiled into binary form; +see program luac and function string.dump for details. +Programs in source and compiled forms are interchangeable; +Lua automatically detects the file type and acts accordingly (see load). + + + + + +

3.3.3 – Assignment

+ +

+Lua allows multiple assignments. +Therefore, the syntax for assignment +defines a list of variables on the left side +and a list of expressions on the right side. +The elements in both lists are separated by commas: + +

+	stat ::= varlist ‘=’ explist
+	varlist ::= var {‘,’ var}
+	explist ::= exp {‘,’ exp}
+

+Expressions are discussed in §3.4. + + +

+Before the assignment, +the list of values is adjusted to the length of +the list of variables. +If there are more values than needed, +the excess values are thrown away. +If there are fewer values than needed, +the list is extended with as many nil's as needed. +If the list of expressions ends with a function call, +then all values returned by that call enter the list of values, +before the adjustment +(except when the call is enclosed in parentheses; see §3.4). + + +

+The assignment statement first evaluates all its expressions +and only then the assignments are performed. +Thus the code + +

+     i = 3
+     i, a[i] = i+1, 20
+

+sets a[3] to 20, without affecting a[4] +because the i in a[i] is evaluated (to 3) +before it is assigned 4. +Similarly, the line + +

+     x, y = y, x
+

+exchanges the values of x and y, +and + +

+     x, y, z = y, z, x
+

+cyclically permutes the values of x, y, and z. + + +

+An assignment to a global name x = val +is equivalent to the assignment +_ENV.x = val (see §2.2). + + +

+The meaning of assignments to table fields and +global variables (which are actually table fields, too) +can be changed via metatables (see §2.4). + + + + + +

3.3.4 – Control Structures

+The control structures +if, while, and repeat have the usual meaning and +familiar syntax: + + + + +

+	stat ::= while exp do block end
+	stat ::= repeat block until exp
+	stat ::= if exp then block {elseif exp then block} [else block] end
+

+Lua also has a for statement, in two flavors (see §3.3.5). + + +

+The condition expression of a +control structure can return any value. +Both false and nil are considered false. +All values different from nil and false are considered true +(in particular, the number 0 and the empty string are also true). + + +

+In the repeatuntil loop, +the inner block does not end at the until keyword, +but only after the condition. +So, the condition can refer to local variables +declared inside the loop block. + + +

+The goto statement transfers the program control to a label. +For syntactical reasons, +labels in Lua are considered statements too: + + + +

+	stat ::= goto Name
+	stat ::= label
+	label ::= ‘::’ Name ‘::’
+
+ +

+A label is visible in the entire block where it is defined, +except +inside nested blocks where a label with the same name is defined and +inside nested functions. +A goto may jump to any visible label as long as it does not +enter into the scope of a local variable. + + +

+Labels and empty statements are called void statements, +as they perform no actions. + + +

+The break statement terminates the execution of a +while, repeat, or for loop, +skipping to the next statement after the loop: + + +

+	stat ::= break
+

+A break ends the innermost enclosing loop. + + +

+The return statement is used to return values +from a function or a chunk +(which is an anonymous function). + +Functions can return more than one value, +so the syntax for the return statement is + +

+	stat ::= return [explist] [‘;’]
+
+ +

+The return statement can only be written +as the last statement of a block. +If it is really necessary to return in the middle of a block, +then an explicit inner block can be used, +as in the idiom do return end, +because now return is the last statement in its (inner) block. + + + + + +

3.3.5 – For Statement

+ +

+ +The for statement has two forms: +one numerical and one generic. + + +

+The numerical for loop repeats a block of code while a +control variable runs through an arithmetic progression. +It has the following syntax: + +

+	stat ::= for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end
+

+The block is repeated for name starting at the value of +the first exp, until it passes the second exp by steps of the +third exp. +More precisely, a for statement like + +

+     for v = e1, e2, e3 do block end
+

+is equivalent to the code: + +

+     do
+       local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
+       if not (var and limit and step) then error() end
+       var = var - step
+       while true do
+         var = var + step
+         if (step >= 0 and var > limit) or (step < 0 and var < limit) then
+           break
+         end
+         local v = var
+         block
+       end
+     end
+
+ +

+Note the following: + +

    + +
  • +All three control expressions are evaluated only once, +before the loop starts. +They must all result in numbers. +
  • + +
  • +var, limit, and step are invisible variables. +The names shown here are for explanatory purposes only. +
  • + +
  • +If the third expression (the step) is absent, +then a step of 1 is used. +
  • + +
  • +You can use break and goto to exit a for loop. +
  • + +
  • +The loop variable v is local to the loop body. +If you need its value after the loop, +assign it to another variable before exiting the loop. +
  • + +
+ +

+The generic for statement works over functions, +called iterators. +On each iteration, the iterator function is called to produce a new value, +stopping when this new value is nil. +The generic for loop has the following syntax: + +

+	stat ::= for namelist in explist do block end
+	namelist ::= Name {‘,’ Name}
+

+A for statement like + +

+     for var_1, ···, var_n in explist do block end
+

+is equivalent to the code: + +

+     do
+       local f, s, var = explist
+       while true do
+         local var_1, ···, var_n = f(s, var)
+         if var_1 == nil then break end
+         var = var_1
+         block
+       end
+     end
+

+Note the following: + +

    + +
  • +explist is evaluated only once. +Its results are an iterator function, +a state, +and an initial value for the first iterator variable. +
  • + +
  • +f, s, and var are invisible variables. +The names are here for explanatory purposes only. +
  • + +
  • +You can use break to exit a for loop. +
  • + +
  • +The loop variables var_i are local to the loop; +you cannot use their values after the for ends. +If you need these values, +then assign them to other variables before breaking or exiting the loop. +
  • + +
+ + + + +

3.3.6 – Function Calls as Statements

+To allow possible side-effects, +function calls can be executed as statements: + +

+	stat ::= functioncall
+

+In this case, all returned values are thrown away. +Function calls are explained in §3.4.10. + + + + + +

3.3.7 – Local Declarations

+Local variables can be declared anywhere inside a block. +The declaration can include an initial assignment: + +

+	stat ::= local namelist [‘=’ explist]
+

+If present, an initial assignment has the same semantics +of a multiple assignment (see §3.3.3). +Otherwise, all variables are initialized with nil. + + +

+A chunk is also a block (see §3.3.2), +and so local variables can be declared in a chunk outside any explicit block. + + +

+The visibility rules for local variables are explained in §3.5. + + + + + + + +

3.4 – Expressions

+ +

+The basic expressions in Lua are the following: + +

+	exp ::= prefixexp
+	exp ::= nil | false | true
+	exp ::= Numeral
+	exp ::= LiteralString
+	exp ::= functiondef
+	exp ::= tableconstructor
+	exp ::= ‘...’
+	exp ::= exp binop exp
+	exp ::= unop exp
+	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
+
+ +

+Numerals and literal strings are explained in §3.1; +variables are explained in §3.2; +function definitions are explained in §3.4.11; +function calls are explained in §3.4.10; +table constructors are explained in §3.4.9. +Vararg expressions, +denoted by three dots ('...'), can only be used when +directly inside a vararg function; +they are explained in §3.4.11. + + +

+Binary operators comprise arithmetic operators (see §3.4.1), +bitwise operators (see §3.4.2), +relational operators (see §3.4.4), logical operators (see §3.4.5), +and the concatenation operator (see §3.4.6). +Unary operators comprise the unary minus (see §3.4.1), +the unary bitwise NOT (see §3.4.2), +the unary logical not (see §3.4.5), +and the unary length operator (see §3.4.7). + + +

+Both function calls and vararg expressions can result in multiple values. +If a function call is used as a statement (see §3.3.6), +then its return list is adjusted to zero elements, +thus discarding all returned values. +If an expression is used as the last (or the only) element +of a list of expressions, +then no adjustment is made +(unless the expression is enclosed in parentheses). +In all other contexts, +Lua adjusts the result list to one element, +either discarding all values except the first one +or adding a single nil if there are no values. + + +

+Here are some examples: + +

+     f()                -- adjusted to 0 results
+     g(f(), x)          -- f() is adjusted to 1 result
+     g(x, f())          -- g gets x plus all results from f()
+     a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
+     a,b = ...          -- a gets the first vararg argument, b gets
+                        -- the second (both a and b can get nil if there
+                        -- is no corresponding vararg argument)
+     
+     a,b,c = x, f()     -- f() is adjusted to 2 results
+     a,b,c = f()        -- f() is adjusted to 3 results
+     return f()         -- returns all results from f()
+     return ...         -- returns all received vararg arguments
+     return x,y,f()     -- returns x, y, and all results from f()
+     {f()}              -- creates a list with all results from f()
+     {...}              -- creates a list with all vararg arguments
+     {f(), nil}         -- f() is adjusted to 1 result
+
+ +

+Any expression enclosed in parentheses always results in only one value. +Thus, +(f(x,y,z)) is always a single value, +even if f returns several values. +(The value of (f(x,y,z)) is the first value returned by f +or nil if f does not return any values.) + + + +

3.4.1 – Arithmetic Operators

+Lua supports the following arithmetic operators: + +

    +
  • +: addition
  • +
  • -: subtraction
  • +
  • *: multiplication
  • +
  • /: float division
  • +
  • //: floor division
  • +
  • %: modulo
  • +
  • ^: exponentiation
  • +
  • -: unary minus
  • +
+ +

+With the exception of exponentiation and float division, +the arithmetic operators work as follows: +If both operands are integers, +the operation is performed over integers and the result is an integer. +Otherwise, if both operands are numbers +or strings that can be converted to +numbers (see §3.4.3), +then they are converted to floats, +the operation is performed following the usual rules +for floating-point arithmetic +(usually the IEEE 754 standard), +and the result is a float. + + +

+Exponentiation and float division (/) +always convert their operands to floats +and the result is always a float. +Exponentiation uses the ISO C function pow, +so that it works for non-integer exponents too. + + +

+Floor division (//) is a division +that rounds the quotient towards minus infinity, +that is, the floor of the division of its operands. + + +

+Modulo is defined as the remainder of a division +that rounds the quotient towards minus infinity (floor division). + + +

+In case of overflows in integer arithmetic, +all operations wrap around, +according to the usual rules of two-complement arithmetic. +(In other words, +they return the unique representable integer +that is equal modulo 264 to the mathematical result.) + + + +

3.4.2 – Bitwise Operators

+Lua supports the following bitwise operators: + +

    +
  • &: bitwise AND
  • +
  • |: bitwise OR
  • +
  • ~: bitwise exclusive OR
  • +
  • >>: right shift
  • +
  • <<: left shift
  • +
  • ~: unary bitwise NOT
  • +
+ +

+All bitwise operations convert its operands to integers +(see §3.4.3), +operate on all bits of those integers, +and result in an integer. + + +

+Both right and left shifts fill the vacant bits with zeros. +Negative displacements shift to the other direction; +displacements with absolute values equal to or higher than +the number of bits in an integer +result in zero (as all bits are shifted out). + + + + + +

3.4.3 – Coercions and Conversions

+Lua provides some automatic conversions between some +types and representations at run time. +Bitwise operators always convert float operands to integers. +Exponentiation and float division +always convert integer operands to floats. +All other arithmetic operations applied to mixed numbers +(integers and floats) convert the integer operand to a float; +this is called the usual rule. +The C API also converts both integers to floats and +floats to integers, as needed. +Moreover, string concatenation accepts numbers as arguments, +besides strings. + + +

+Lua also converts strings to numbers, +whenever a number is expected. + + +

+In a conversion from integer to float, +if the integer value has an exact representation as a float, +that is the result. +Otherwise, +the conversion gets the nearest higher or +the nearest lower representable value. +This kind of conversion never fails. + + +

+The conversion from float to integer +checks whether the float has an exact representation as an integer +(that is, the float has an integral value and +it is in the range of integer representation). +If it does, that representation is the result. +Otherwise, the conversion fails. + + +

+The conversion from strings to numbers goes as follows: +First, the string is converted to an integer or a float, +following its syntax and the rules of the Lua lexer. +(The string may have also leading and trailing spaces and a sign.) +Then, the resulting number (float or integer) +is converted to the type (float or integer) required by the context +(e.g., the operation that forced the conversion). + + +

+All conversions from strings to numbers +accept both a dot and the current locale mark +as the radix character. +(The Lua lexer, however, accepts only a dot.) + + +

+The conversion from numbers to strings uses a +non-specified human-readable format. +For complete control over how numbers are converted to strings, +use the format function from the string library +(see string.format). + + + + + +

3.4.4 – Relational Operators

+Lua supports the following relational operators: + +

    +
  • ==: equality
  • +
  • ~=: inequality
  • +
  • <: less than
  • +
  • >: greater than
  • +
  • <=: less or equal
  • +
  • >=: greater or equal
  • +

+These operators always result in false or true. + + +

+Equality (==) first compares the type of its operands. +If the types are different, then the result is false. +Otherwise, the values of the operands are compared. +Strings are compared in the obvious way. +Numbers are equal if they denote the same mathematical value. + + +

+Tables, userdata, and threads +are compared by reference: +two objects are considered equal only if they are the same object. +Every time you create a new object +(a table, userdata, or thread), +this new object is different from any previously existing object. +A closure is always equal to itself. +Closures with any detectable difference +(different behavior, different definition) are always different. +Closures created at different times but with no detectable differences +may be classified as equal or not +(depending on internal caching details). + + +

+You can change the way that Lua compares tables and userdata +by using the "eq" metamethod (see §2.4). + + +

+Equality comparisons do not convert strings to numbers +or vice versa. +Thus, "0"==0 evaluates to false, +and t[0] and t["0"] denote different +entries in a table. + + +

+The operator ~= is exactly the negation of equality (==). + + +

+The order operators work as follows. +If both arguments are numbers, +then they are compared according to their mathematical values +(regardless of their subtypes). +Otherwise, if both arguments are strings, +then their values are compared according to the current locale. +Otherwise, Lua tries to call the "lt" or the "le" +metamethod (see §2.4). +A comparison a > b is translated to b < a +and a >= b is translated to b <= a. + + +

+Following the IEEE 754 standard, +NaN is considered neither smaller than, +nor equal to, nor greater than any value (including itself). + + + + + +

3.4.5 – Logical Operators

+The logical operators in Lua are +and, or, and not. +Like the control structures (see §3.3.4), +all logical operators consider both false and nil as false +and anything else as true. + + +

+The negation operator not always returns false or true. +The conjunction operator and returns its first argument +if this value is false or nil; +otherwise, and returns its second argument. +The disjunction operator or returns its first argument +if this value is different from nil and false; +otherwise, or returns its second argument. +Both and and or use short-circuit evaluation; +that is, +the second operand is evaluated only if necessary. +Here are some examples: + +

+     10 or 20            --> 10
+     10 or error()       --> 10
+     nil or "a"          --> "a"
+     nil and 10          --> nil
+     false and error()   --> false
+     false and nil       --> false
+     false or nil        --> nil
+     10 and 20           --> 20
+

+(In this manual, +--> indicates the result of the preceding expression.) + + + + + +

3.4.6 – Concatenation

+The string concatenation operator in Lua is +denoted by two dots ('..'). +If both operands are strings or numbers, then they are converted to +strings according to the rules described in §3.4.3. +Otherwise, the __concat metamethod is called (see §2.4). + + + + + +

3.4.7 – The Length Operator

+ +

+The length operator is denoted by the unary prefix operator #. + + +

+The length of a string is its number of bytes +(that is, the usual meaning of string length when each +character is one byte). + + +

+The length operator applied on a table +returns a border in that table. +A border in a table t is any natural number +that satisfies the following condition: + +

+     (border == 0 or t[border] ~= nil) and t[border + 1] == nil
+

+In words, +a border is any (natural) index in a table +where a non-nil value is followed by a nil value +(or zero, when index 1 is nil). + + +

+A table with exactly one border is called a sequence. +For instance, the table {10, 20, 30, 40, 50} is a sequence, +as it has only one border (5). +The table {10, 20, 30, nil, 50} has two borders (3 and 5), +and therefore it is not a sequence. +The table {nil, 20, 30, nil, nil, 60, nil} +has three borders (0, 3, and 6), +so it is not a sequence, too. +The table {} is a sequence with border 0. +Note that non-natural keys do not interfere +with whether a table is a sequence. + + +

+When t is a sequence, +#t returns its only border, +which corresponds to the intuitive notion of the length of the sequence. +When t is not a sequence, +#t can return any of its borders. +(The exact one depends on details of +the internal representation of the table, +which in turn can depend on how the table was populated and +the memory addresses of its non-numeric keys.) + + +

+The computation of the length of a table +has a guaranteed worst time of O(log n), +where n is the largest natural key in the table. + + +

+A program can modify the behavior of the length operator for +any value but strings through the __len metamethod (see §2.4). + + + + + +

3.4.8 – Precedence

+Operator precedence in Lua follows the table below, +from lower to higher priority: + +

+     or
+     and
+     <     >     <=    >=    ~=    ==
+     |
+     ~
+     &
+     <<    >>
+     ..
+     +     -
+     *     /     //    %
+     unary operators (not   #     -     ~)
+     ^
+

+As usual, +you can use parentheses to change the precedences of an expression. +The concatenation ('..') and exponentiation ('^') +operators are right associative. +All other binary operators are left associative. + + + + + +

3.4.9 – Table Constructors

+Table constructors are expressions that create tables. +Every time a constructor is evaluated, a new table is created. +A constructor can be used to create an empty table +or to create a table and initialize some of its fields. +The general syntax for constructors is + +

+	tableconstructor ::= ‘{’ [fieldlist] ‘}’
+	fieldlist ::= field {fieldsep field} [fieldsep]
+	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
+	fieldsep ::= ‘,’ | ‘;’
+
+ +

+Each field of the form [exp1] = exp2 adds to the new table an entry +with key exp1 and value exp2. +A field of the form name = exp is equivalent to +["name"] = exp. +Finally, fields of the form exp are equivalent to +[i] = exp, where i are consecutive integers +starting with 1. +Fields in the other formats do not affect this counting. +For example, + +

+     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
+

+is equivalent to + +

+     do
+       local t = {}
+       t[f(1)] = g
+       t[1] = "x"         -- 1st exp
+       t[2] = "y"         -- 2nd exp
+       t.x = 1            -- t["x"] = 1
+       t[3] = f(x)        -- 3rd exp
+       t[30] = 23
+       t[4] = 45          -- 4th exp
+       a = t
+     end
+
+ +

+The order of the assignments in a constructor is undefined. +(This order would be relevant only when there are repeated keys.) + + +

+If the last field in the list has the form exp +and the expression is a function call or a vararg expression, +then all values returned by this expression enter the list consecutively +(see §3.4.10). + + +

+The field list can have an optional trailing separator, +as a convenience for machine-generated code. + + + + + +

3.4.10 – Function Calls

+A function call in Lua has the following syntax: + +

+	functioncall ::= prefixexp args
+

+In a function call, +first prefixexp and args are evaluated. +If the value of prefixexp has type function, +then this function is called +with the given arguments. +Otherwise, the prefixexp "call" metamethod is called, +having as first argument the value of prefixexp, +followed by the original call arguments +(see §2.4). + + +

+The form + +

+	functioncall ::= prefixexp ‘:’ Name args
+

+can be used to call "methods". +A call v:name(args) +is syntactic sugar for v.name(v,args), +except that v is evaluated only once. + + +

+Arguments have the following syntax: + +

+	args ::= ‘(’ [explist] ‘)’
+	args ::= tableconstructor
+	args ::= LiteralString
+

+All argument expressions are evaluated before the call. +A call of the form f{fields} is +syntactic sugar for f({fields}); +that is, the argument list is a single new table. +A call of the form f'string' +(or f"string" or f[[string]]) +is syntactic sugar for f('string'); +that is, the argument list is a single literal string. + + +

+A call of the form return functioncall is called +a tail call. +Lua implements proper tail calls +(or proper tail recursion): +in a tail call, +the called function reuses the stack entry of the calling function. +Therefore, there is no limit on the number of nested tail calls that +a program can execute. +However, a tail call erases any debug information about the +calling function. +Note that a tail call only happens with a particular syntax, +where the return has one single function call as argument; +this syntax makes the calling function return exactly +the returns of the called function. +So, none of the following examples are tail calls: + +

+     return (f(x))        -- results adjusted to 1
+     return 2 * f(x)
+     return x, f(x)       -- additional results
+     f(x); return         -- results discarded
+     return x or f(x)     -- results adjusted to 1
+
+ + + + +

3.4.11 – Function Definitions

+ +

+The syntax for function definition is + +

+	functiondef ::= function funcbody
+	funcbody ::= ‘(’ [parlist] ‘)’ block end
+
+ +

+The following syntactic sugar simplifies function definitions: + +

+	stat ::= function funcname funcbody
+	stat ::= local function Name funcbody
+	funcname ::= Name {‘.’ Name} [‘:’ Name]
+

+The statement + +

+     function f () body end
+

+translates to + +

+     f = function () body end
+

+The statement + +

+     function t.a.b.c.f () body end
+

+translates to + +

+     t.a.b.c.f = function () body end
+

+The statement + +

+     local function f () body end
+

+translates to + +

+     local f; f = function () body end
+

+not to + +

+     local f = function () body end
+

+(This only makes a difference when the body of the function +contains references to f.) + + +

+A function definition is an executable expression, +whose value has type function. +When Lua precompiles a chunk, +all its function bodies are precompiled too. +Then, whenever Lua executes the function definition, +the function is instantiated (or closed). +This function instance (or closure) +is the final value of the expression. + + +

+Parameters act as local variables that are +initialized with the argument values: + +

+	parlist ::= namelist [‘,’ ‘...’] | ‘...’
+

+When a function is called, +the list of arguments is adjusted to +the length of the list of parameters, +unless the function is a vararg function, +which is indicated by three dots ('...') +at the end of its parameter list. +A vararg function does not adjust its argument list; +instead, it collects all extra arguments and supplies them +to the function through a vararg expression, +which is also written as three dots. +The value of this expression is a list of all actual extra arguments, +similar to a function with multiple results. +If a vararg expression is used inside another expression +or in the middle of a list of expressions, +then its return list is adjusted to one element. +If the expression is used as the last element of a list of expressions, +then no adjustment is made +(unless that last expression is enclosed in parentheses). + + +

+As an example, consider the following definitions: + +

+     function f(a, b) end
+     function g(a, b, ...) end
+     function r() return 1,2,3 end
+

+Then, we have the following mapping from arguments to parameters and +to the vararg expression: + +

+     CALL            PARAMETERS
+     
+     f(3)             a=3, b=nil
+     f(3, 4)          a=3, b=4
+     f(3, 4, 5)       a=3, b=4
+     f(r(), 10)       a=1, b=10
+     f(r())           a=1, b=2
+     
+     g(3)             a=3, b=nil, ... -->  (nothing)
+     g(3, 4)          a=3, b=4,   ... -->  (nothing)
+     g(3, 4, 5, 8)    a=3, b=4,   ... -->  5  8
+     g(5, r())        a=5, b=1,   ... -->  2  3
+
+ +

+Results are returned using the return statement (see §3.3.4). +If control reaches the end of a function +without encountering a return statement, +then the function returns with no results. + + +

+ +There is a system-dependent limit on the number of values +that a function may return. +This limit is guaranteed to be larger than 1000. + + +

+The colon syntax +is used for defining methods, +that is, functions that have an implicit extra parameter self. +Thus, the statement + +

+     function t.a.b.c:f (params) body end
+

+is syntactic sugar for + +

+     t.a.b.c.f = function (self, params) body end
+
+ + + + + + +

3.5 – Visibility Rules

+ +

+ +Lua is a lexically scoped language. +The scope of a local variable begins at the first statement after +its declaration and lasts until the last non-void statement +of the innermost block that includes the declaration. +Consider the following example: + +

+     x = 10                -- global variable
+     do                    -- new block
+       local x = x         -- new 'x', with value 10
+       print(x)            --> 10
+       x = x+1
+       do                  -- another block
+         local x = x+1     -- another 'x'
+         print(x)          --> 12
+       end
+       print(x)            --> 11
+     end
+     print(x)              --> 10  (the global one)
+
+ +

+Notice that, in a declaration like local x = x, +the new x being declared is not in scope yet, +and so the second x refers to the outside variable. + + +

+Because of the lexical scoping rules, +local variables can be freely accessed by functions +defined inside their scope. +A local variable used by an inner function is called +an upvalue, or external local variable, +inside the inner function. + + +

+Notice that each execution of a local statement +defines new local variables. +Consider the following example: + +

+     a = {}
+     local x = 20
+     for i=1,10 do
+       local y = 0
+       a[i] = function () y=y+1; return x+y end
+     end
+

+The loop creates ten closures +(that is, ten instances of the anonymous function). +Each of these closures uses a different y variable, +while all of them share the same x. + + + + + +

4 – The Application Program Interface

+ +

+ +This section describes the C API for Lua, that is, +the set of C functions available to the host program to communicate +with Lua. +All API functions and related types and constants +are declared in the header file lua.h. + + +

+Even when we use the term "function", +any facility in the API may be provided as a macro instead. +Except where stated otherwise, +all such macros use each of their arguments exactly once +(except for the first argument, which is always a Lua state), +and so do not generate any hidden side-effects. + + +

+As in most C libraries, +the Lua API functions do not check their arguments for validity or consistency. +However, you can change this behavior by compiling Lua +with the macro LUA_USE_APICHECK defined. + + +

+The Lua library is fully reentrant: +it has no global variables. +It keeps all information it needs in a dynamic structure, +called the Lua state. + + +

+Each Lua state has one or more threads, +which correspond to independent, cooperative lines of execution. +The type lua_State (despite its name) refers to a thread. +(Indirectly, through the thread, it also refers to the +Lua state associated to the thread.) + + +

+A pointer to a thread must be passed as the first argument to +every function in the library, except to lua_newstate, +which creates a Lua state from scratch and returns a pointer +to the main thread in the new state. + + + +

4.1 – The Stack

+ +

+Lua uses a virtual stack to pass values to and from C. +Each element in this stack represents a Lua value +(nil, number, string, etc.). +Functions in the API can access this stack through the +Lua state parameter that they receive. + + +

+Whenever Lua calls C, the called function gets a new stack, +which is independent of previous stacks and of stacks of +C functions that are still active. +This stack initially contains any arguments to the C function +and it is where the C function can store temporary +Lua values and must push its results +to be returned to the caller (see lua_CFunction). + + +

+For convenience, +most query operations in the API do not follow a strict stack discipline. +Instead, they can refer to any element in the stack +by using an index: +A positive index represents an absolute stack position +(starting at 1); +a negative index represents an offset relative to the top of the stack. +More specifically, if the stack has n elements, +then index 1 represents the first element +(that is, the element that was pushed onto the stack first) +and +index n represents the last element; +index -1 also represents the last element +(that is, the element at the top) +and index -n represents the first element. + + + + + +

4.2 – Stack Size

+ +

+When you interact with the Lua API, +you are responsible for ensuring consistency. +In particular, +you are responsible for controlling stack overflow. +You can use the function lua_checkstack +to ensure that the stack has enough space for pushing new elements. + + +

+Whenever Lua calls C, +it ensures that the stack has space for +at least LUA_MINSTACK extra slots. +LUA_MINSTACK is defined as 20, +so that usually you do not have to worry about stack space +unless your code has loops pushing elements onto the stack. + + +

+When you call a Lua function +without a fixed number of results (see lua_call), +Lua ensures that the stack has enough space for all results, +but it does not ensure any extra space. +So, before pushing anything in the stack after such a call +you should use lua_checkstack. + + + + + +

4.3 – Valid and Acceptable Indices

+ +

+Any function in the API that receives stack indices +works only with valid indices or acceptable indices. + + +

+A valid index is an index that refers to a +position that stores a modifiable Lua value. +It comprises stack indices between 1 and the stack top +(1 ≤ abs(index) ≤ top) + +plus pseudo-indices, +which represent some positions that are accessible to C code +but that are not in the stack. +Pseudo-indices are used to access the registry (see §4.5) +and the upvalues of a C function (see §4.4). + + +

+Functions that do not need a specific mutable position, +but only a value (e.g., query functions), +can be called with acceptable indices. +An acceptable index can be any valid index, +but it also can be any positive index after the stack top +within the space allocated for the stack, +that is, indices up to the stack size. +(Note that 0 is never an acceptable index.) +Except when noted otherwise, +functions in the API work with acceptable indices. + + +

+Acceptable indices serve to avoid extra tests +against the stack top when querying the stack. +For instance, a C function can query its third argument +without the need to first check whether there is a third argument, +that is, without the need to check whether 3 is a valid index. + + +

+For functions that can be called with acceptable indices, +any non-valid index is treated as if it +contains a value of a virtual type LUA_TNONE, +which behaves like a nil value. + + + + + +

4.4 – C Closures

+ +

+When a C function is created, +it is possible to associate some values with it, +thus creating a C closure +(see lua_pushcclosure); +these values are called upvalues and are +accessible to the function whenever it is called. + + +

+Whenever a C function is called, +its upvalues are located at specific pseudo-indices. +These pseudo-indices are produced by the macro +lua_upvalueindex. +The first upvalue associated with a function is at index +lua_upvalueindex(1), and so on. +Any access to lua_upvalueindex(n), +where n is greater than the number of upvalues of the +current function +(but not greater than 256, +which is one plus the maximum number of upvalues in a closure), +produces an acceptable but invalid index. + + + + + +

4.5 – Registry

+ +

+Lua provides a registry, +a predefined table that can be used by any C code to +store whatever Lua values it needs to store. +The registry table is always located at pseudo-index +LUA_REGISTRYINDEX. +Any C library can store data into this table, +but it must take care to choose keys +that are different from those used +by other libraries, to avoid collisions. +Typically, you should use as key a string containing your library name, +or a light userdata with the address of a C object in your code, +or any Lua object created by your code. +As with variable names, +string keys starting with an underscore followed by +uppercase letters are reserved for Lua. + + +

+The integer keys in the registry are used +by the reference mechanism (see luaL_ref) +and by some predefined values. +Therefore, integer keys must not be used for other purposes. + + +

+When you create a new Lua state, +its registry comes with some predefined values. +These predefined values are indexed with integer keys +defined as constants in lua.h. +The following constants are defined: + +

    +
  • LUA_RIDX_MAINTHREAD: At this index the registry has +the main thread of the state. +(The main thread is the one created together with the state.) +
  • + +
  • LUA_RIDX_GLOBALS: At this index the registry has +the global environment. +
  • +
+ + + + +

4.6 – Error Handling in C

+ +

+Internally, Lua uses the C longjmp facility to handle errors. +(Lua will use exceptions if you compile it as C++; +search for LUAI_THROW in the source code for details.) +When Lua faces any error +(such as a memory allocation error or a type error) +it raises an error; +that is, it does a long jump. +A protected environment uses setjmp +to set a recovery point; +any error jumps to the most recent active recovery point. + + +

+Inside a C function you can raise an error by calling lua_error. + + +

+Most functions in the API can raise an error, +for instance due to a memory allocation error. +The documentation for each function indicates whether +it can raise errors. + + +

+If an error happens outside any protected environment, +Lua calls a panic function (see lua_atpanic) +and then calls abort, +thus exiting the host application. +Your panic function can avoid this exit by +never returning +(e.g., doing a long jump to your own recovery point outside Lua). + + +

+The panic function, +as its name implies, +is a mechanism of last resort. +Programs should avoid it. +As a general rule, +when a C function is called by Lua with a Lua state, +it can do whatever it wants on that Lua state, +as it should be already protected. +However, +when C code operates on other Lua states +(e.g., a Lua argument to the function, +a Lua state stored in the registry, or +the result of lua_newthread), +it should use them only in API calls that cannot raise errors. + + +

+The panic function runs as if it were a message handler (see §2.3); +in particular, the error object is at the top of the stack. +However, there is no guarantee about stack space. +To push anything on the stack, +the panic function must first check the available space (see §4.2). + + + + + +

4.7 – Handling Yields in C

+ +

+Internally, Lua uses the C longjmp facility to yield a coroutine. +Therefore, if a C function foo calls an API function +and this API function yields +(directly or indirectly by calling another function that yields), +Lua cannot return to foo any more, +because the longjmp removes its frame from the C stack. + + +

+To avoid this kind of problem, +Lua raises an error whenever it tries to yield across an API call, +except for three functions: +lua_yieldk, lua_callk, and lua_pcallk. +All those functions receive a continuation function +(as a parameter named k) to continue execution after a yield. + + +

+We need to set some terminology to explain continuations. +We have a C function called from Lua which we will call +the original function. +This original function then calls one of those three functions in the C API, +which we will call the callee function, +that then yields the current thread. +(This can happen when the callee function is lua_yieldk, +or when the callee function is either lua_callk or lua_pcallk +and the function called by them yields.) + + +

+Suppose the running thread yields while executing the callee function. +After the thread resumes, +it eventually will finish running the callee function. +However, +the callee function cannot return to the original function, +because its frame in the C stack was destroyed by the yield. +Instead, Lua calls a continuation function, +which was given as an argument to the callee function. +As the name implies, +the continuation function should continue the task +of the original function. + + +

+As an illustration, consider the following function: + +

+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       status = lua_pcall(L, n, m, h);  /* calls Lua */
+       ...     /* code 2 */
+     }
+

+Now we want to allow +the Lua code being run by lua_pcall to yield. +First, we can rewrite our function like here: + +

+     int k (lua_State *L, int status, lua_KContext ctx) {
+       ...  /* code 2 */
+     }
+     
+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       return k(L, lua_pcall(L, n, m, h), ctx);
+     }
+

+In the above code, +the new function k is a +continuation function (with type lua_KFunction), +which should do all the work that the original function +was doing after calling lua_pcall. +Now, we must inform Lua that it must call k if the Lua code +being executed by lua_pcall gets interrupted in some way +(errors or yielding), +so we rewrite the code as here, +replacing lua_pcall by lua_pcallk: + +

+     int original_function (lua_State *L) {
+       ...     /* code 1 */
+       return k(L, lua_pcallk(L, n, m, h, ctx2, k), ctx1);
+     }
+

+Note the external, explicit call to the continuation: +Lua will call the continuation only if needed, that is, +in case of errors or resuming after a yield. +If the called function returns normally without ever yielding, +lua_pcallk (and lua_callk) will also return normally. +(Of course, instead of calling the continuation in that case, +you can do the equivalent work directly inside the original function.) + + +

+Besides the Lua state, +the continuation function has two other parameters: +the final status of the call plus the context value (ctx) that +was passed originally to lua_pcallk. +(Lua does not use this context value; +it only passes this value from the original function to the +continuation function.) +For lua_pcallk, +the status is the same value that would be returned by lua_pcallk, +except that it is LUA_YIELD when being executed after a yield +(instead of LUA_OK). +For lua_yieldk and lua_callk, +the status is always LUA_YIELD when Lua calls the continuation. +(For these two functions, +Lua will not call the continuation in case of errors, +because they do not handle errors.) +Similarly, when using lua_callk, +you should call the continuation function +with LUA_OK as the status. +(For lua_yieldk, there is not much point in calling +directly the continuation function, +because lua_yieldk usually does not return.) + + +

+Lua treats the continuation function as if it were the original function. +The continuation function receives the same Lua stack +from the original function, +in the same state it would be if the callee function had returned. +(For instance, +after a lua_callk the function and its arguments are +removed from the stack and replaced by the results from the call.) +It also has the same upvalues. +Whatever it returns is handled by Lua as if it were the return +of the original function. + + + + + +

4.8 – Functions and Types

+ +

+Here we list all functions and types from the C API in +alphabetical order. +Each function has an indicator like this: +[-o, +p, x] + + +

+The first field, o, +is how many elements the function pops from the stack. +The second field, p, +is how many elements the function pushes onto the stack. +(Any function always pushes its results after popping its arguments.) +A field in the form x|y means the function can push (or pop) +x or y elements, +depending on the situation; +an interrogation mark '?' means that +we cannot know how many elements the function pops/pushes +by looking only at its arguments +(e.g., they may depend on what is on the stack). +The third field, x, +tells whether the function may raise errors: +'-' means the function never raises any error; +'m' means the function may raise out-of-memory errors +and errors running a __gc metamethod; +'e' means the function may raise any errors +(it can run arbitrary Lua code, +either directly or through metamethods); +'v' means the function may raise an error on purpose. + + + +


lua_absindex

+[-0, +0, –] +

int lua_absindex (lua_State *L, int idx);
+ +

+Converts the acceptable index idx +into an equivalent absolute index +(that is, one that does not depend on the stack top). + + + + + +


lua_Alloc

+
typedef void * (*lua_Alloc) (void *ud,
+                             void *ptr,
+                             size_t osize,
+                             size_t nsize);
+ +

+The type of the memory-allocation function used by Lua states. +The allocator function must provide a +functionality similar to realloc, +but not exactly the same. +Its arguments are +ud, an opaque pointer passed to lua_newstate; +ptr, a pointer to the block being allocated/reallocated/freed; +osize, the original size of the block or some code about what +is being allocated; +and nsize, the new size of the block. + + +

+When ptr is not NULL, +osize is the size of the block pointed by ptr, +that is, the size given when it was allocated or reallocated. + + +

+When ptr is NULL, +osize encodes the kind of object that Lua is allocating. +osize is any of +LUA_TSTRING, LUA_TTABLE, LUA_TFUNCTION, +LUA_TUSERDATA, or LUA_TTHREAD when (and only when) +Lua is creating a new object of that type. +When osize is some other value, +Lua is allocating memory for something else. + + +

+Lua assumes the following behavior from the allocator function: + + +

+When nsize is zero, +the allocator must behave like free +and return NULL. + + +

+When nsize is not zero, +the allocator must behave like realloc. +The allocator returns NULL +if and only if it cannot fulfill the request. +Lua assumes that the allocator never fails when +osize >= nsize. + + +

+Here is a simple implementation for the allocator function. +It is used in the auxiliary library by luaL_newstate. + +

+     static void *l_alloc (void *ud, void *ptr, size_t osize,
+                                                size_t nsize) {
+       (void)ud;  (void)osize;  /* not used */
+       if (nsize == 0) {
+         free(ptr);
+         return NULL;
+       }
+       else
+         return realloc(ptr, nsize);
+     }
+

+Note that Standard C ensures +that free(NULL) has no effect and that +realloc(NULL,size) is equivalent to malloc(size). +This code assumes that realloc does not fail when shrinking a block. +(Although Standard C does not ensure this behavior, +it seems to be a safe assumption.) + + + + + +


lua_arith

+[-(2|1), +1, e] +

void lua_arith (lua_State *L, int op);
+ +

+Performs an arithmetic or bitwise operation over the two values +(or one, in the case of negations) +at the top of the stack, +with the value at the top being the second operand, +pops these values, and pushes the result of the operation. +The function follows the semantics of the corresponding Lua operator +(that is, it may call metamethods). + + +

+The value of op must be one of the following constants: + +

+ + + + +

lua_atpanic

+[-0, +0, –] +

lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
+ +

+Sets a new panic function and returns the old one (see §4.6). + + + + + +


lua_call

+[-(nargs+1), +nresults, e] +

void lua_call (lua_State *L, int nargs, int nresults);
+ +

+Calls a function. + + +

+To call a function you must use the following protocol: +first, the function to be called is pushed onto the stack; +then, the arguments to the function are pushed +in direct order; +that is, the first argument is pushed first. +Finally you call lua_call; +nargs is the number of arguments that you pushed onto the stack. +All arguments and the function value are popped from the stack +when the function is called. +The function results are pushed onto the stack when the function returns. +The number of results is adjusted to nresults, +unless nresults is LUA_MULTRET. +In this case, all results from the function are pushed; +Lua takes care that the returned values fit into the stack space, +but it does not ensure any extra space in the stack. +The function results are pushed onto the stack in direct order +(the first result is pushed first), +so that after the call the last result is on the top of the stack. + + +

+Any error inside the called function is propagated upwards +(with a longjmp). + + +

+The following example shows how the host program can do the +equivalent to this Lua code: + +

+     a = f("how", t.x, 14)
+

+Here it is in C: + +

+     lua_getglobal(L, "f");                  /* function to be called */
+     lua_pushliteral(L, "how");                       /* 1st argument */
+     lua_getglobal(L, "t");                    /* table to be indexed */
+     lua_getfield(L, -1, "x");        /* push result of t.x (2nd arg) */
+     lua_remove(L, -2);                  /* remove 't' from the stack */
+     lua_pushinteger(L, 14);                          /* 3rd argument */
+     lua_call(L, 3, 1);     /* call 'f' with 3 arguments and 1 result */
+     lua_setglobal(L, "a");                         /* set global 'a' */
+

+Note that the code above is balanced: +at its end, the stack is back to its original configuration. +This is considered good programming practice. + + + + + +


lua_callk

+[-(nargs + 1), +nresults, e] +

void lua_callk (lua_State *L,
+                int nargs,
+                int nresults,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+This function behaves exactly like lua_call, +but allows the called function to yield (see §4.7). + + + + + +


lua_CFunction

+
typedef int (*lua_CFunction) (lua_State *L);
+ +

+Type for C functions. + + +

+In order to communicate properly with Lua, +a C function must use the following protocol, +which defines the way parameters and results are passed: +a C function receives its arguments from Lua in its stack +in direct order (the first argument is pushed first). +So, when the function starts, +lua_gettop(L) returns the number of arguments received by the function. +The first argument (if any) is at index 1 +and its last argument is at index lua_gettop(L). +To return values to Lua, a C function just pushes them onto the stack, +in direct order (the first result is pushed first), +and returns the number of results. +Any other value in the stack below the results will be properly +discarded by Lua. +Like a Lua function, a C function called by Lua can also return +many results. + + +

+As an example, the following function receives a variable number +of numeric arguments and returns their average and their sum: + +

+     static int foo (lua_State *L) {
+       int n = lua_gettop(L);    /* number of arguments */
+       lua_Number sum = 0.0;
+       int i;
+       for (i = 1; i <= n; i++) {
+         if (!lua_isnumber(L, i)) {
+           lua_pushliteral(L, "incorrect argument");
+           lua_error(L);
+         }
+         sum += lua_tonumber(L, i);
+       }
+       lua_pushnumber(L, sum/n);        /* first result */
+       lua_pushnumber(L, sum);         /* second result */
+       return 2;                   /* number of results */
+     }
+
+ + + + +

lua_checkstack

+[-0, +0, –] +

int lua_checkstack (lua_State *L, int n);
+ +

+Ensures that the stack has space for at least n extra slots +(that is, that you can safely push up to n values into it). +It returns false if it cannot fulfill the request, +either because it would cause the stack +to be larger than a fixed maximum size +(typically at least several thousand elements) or +because it cannot allocate memory for the extra space. +This function never shrinks the stack; +if the stack already has space for the extra slots, +it is left unchanged. + + + + + +


lua_close

+[-0, +0, –] +

void lua_close (lua_State *L);
+ +

+Destroys all objects in the given Lua state +(calling the corresponding garbage-collection metamethods, if any) +and frees all dynamic memory used by this state. +In several platforms, you may not need to call this function, +because all resources are naturally released when the host program ends. +On the other hand, long-running programs that create multiple states, +such as daemons or web servers, +will probably need to close states as soon as they are not needed. + + + + + +


lua_compare

+[-0, +0, e] +

int lua_compare (lua_State *L, int index1, int index2, int op);
+ +

+Compares two Lua values. +Returns 1 if the value at index index1 satisfies op +when compared with the value at index index2, +following the semantics of the corresponding Lua operator +(that is, it may call metamethods). +Otherwise returns 0. +Also returns 0 if any of the indices is not valid. + + +

+The value of op must be one of the following constants: + +

    + +
  • LUA_OPEQ: compares for equality (==)
  • +
  • LUA_OPLT: compares for less than (<)
  • +
  • LUA_OPLE: compares for less or equal (<=)
  • + +
+ + + + +

lua_concat

+[-n, +1, e] +

void lua_concat (lua_State *L, int n);
+ +

+Concatenates the n values at the top of the stack, +pops them, and leaves the result at the top. +If n is 1, the result is the single value on the stack +(that is, the function does nothing); +if n is 0, the result is the empty string. +Concatenation is performed following the usual semantics of Lua +(see §3.4.6). + + + + + +


lua_copy

+[-0, +0, –] +

void lua_copy (lua_State *L, int fromidx, int toidx);
+ +

+Copies the element at index fromidx +into the valid index toidx, +replacing the value at that position. +Values at other positions are not affected. + + + + + +


lua_createtable

+[-0, +1, m] +

void lua_createtable (lua_State *L, int narr, int nrec);
+ +

+Creates a new empty table and pushes it onto the stack. +Parameter narr is a hint for how many elements the table +will have as a sequence; +parameter nrec is a hint for how many other elements +the table will have. +Lua may use these hints to preallocate memory for the new table. +This preallocation is useful for performance when you know in advance +how many elements the table will have. +Otherwise you can use the function lua_newtable. + + + + + +


lua_dump

+[-0, +0, –] +

int lua_dump (lua_State *L,
+                        lua_Writer writer,
+                        void *data,
+                        int strip);
+ +

+Dumps a function as a binary chunk. +Receives a Lua function on the top of the stack +and produces a binary chunk that, +if loaded again, +results in a function equivalent to the one dumped. +As it produces parts of the chunk, +lua_dump calls function writer (see lua_Writer) +with the given data +to write them. + + +

+If strip is true, +the binary representation may not include all debug information +about the function, +to save space. + + +

+The value returned is the error code returned by the last +call to the writer; +0 means no errors. + + +

+This function does not pop the Lua function from the stack. + + + + + +


lua_error

+[-1, +0, v] +

int lua_error (lua_State *L);
+ +

+Generates a Lua error, +using the value at the top of the stack as the error object. +This function does a long jump, +and therefore never returns +(see luaL_error). + + + + + +


lua_gc

+[-0, +0, m] +

int lua_gc (lua_State *L, int what, int data);
+ +

+Controls the garbage collector. + + +

+This function performs several tasks, +according to the value of the parameter what: + +

    + +
  • LUA_GCSTOP: +stops the garbage collector. +
  • + +
  • LUA_GCRESTART: +restarts the garbage collector. +
  • + +
  • LUA_GCCOLLECT: +performs a full garbage-collection cycle. +
  • + +
  • LUA_GCCOUNT: +returns the current amount of memory (in Kbytes) in use by Lua. +
  • + +
  • LUA_GCCOUNTB: +returns the remainder of dividing the current amount of bytes of +memory in use by Lua by 1024. +
  • + +
  • LUA_GCSTEP: +performs an incremental step of garbage collection. +
  • + +
  • LUA_GCSETPAUSE: +sets data as the new value +for the pause of the collector (see §2.5) +and returns the previous value of the pause. +
  • + +
  • LUA_GCSETSTEPMUL: +sets data as the new value for the step multiplier of +the collector (see §2.5) +and returns the previous value of the step multiplier. +
  • + +
  • LUA_GCISRUNNING: +returns a boolean that tells whether the collector is running +(i.e., not stopped). +
  • + +
+ +

+For more details about these options, +see collectgarbage. + + + + + +


lua_getallocf

+[-0, +0, –] +

lua_Alloc lua_getallocf (lua_State *L, void **ud);
+ +

+Returns the memory-allocation function of a given state. +If ud is not NULL, Lua stores in *ud the +opaque pointer given when the memory-allocator function was set. + + + + + +


lua_getfield

+[-0, +1, e] +

int lua_getfield (lua_State *L, int index, const char *k);
+ +

+Pushes onto the stack the value t[k], +where t is the value at the given index. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_getextraspace

+[-0, +0, –] +

void *lua_getextraspace (lua_State *L);
+ +

+Returns a pointer to a raw memory area associated with the +given Lua state. +The application can use this area for any purpose; +Lua does not use it for anything. + + +

+Each new thread has this area initialized with a copy +of the area of the main thread. + + +

+By default, this area has the size of a pointer to void, +but you can recompile Lua with a different size for this area. +(See LUA_EXTRASPACE in luaconf.h.) + + + + + +


lua_getglobal

+[-0, +1, e] +

int lua_getglobal (lua_State *L, const char *name);
+ +

+Pushes onto the stack the value of the global name. +Returns the type of that value. + + + + + +


lua_geti

+[-0, +1, e] +

int lua_geti (lua_State *L, int index, lua_Integer i);
+ +

+Pushes onto the stack the value t[i], +where t is the value at the given index. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_getmetatable

+[-0, +(0|1), –] +

int lua_getmetatable (lua_State *L, int index);
+ +

+If the value at the given index has a metatable, +the function pushes that metatable onto the stack and returns 1. +Otherwise, +the function returns 0 and pushes nothing on the stack. + + + + + +


lua_gettable

+[-1, +1, e] +

int lua_gettable (lua_State *L, int index);
+ +

+Pushes onto the stack the value t[k], +where t is the value at the given index +and k is the value at the top of the stack. + + +

+This function pops the key from the stack, +pushing the resulting value in its place. +As in Lua, this function may trigger a metamethod +for the "index" event (see §2.4). + + +

+Returns the type of the pushed value. + + + + + +


lua_gettop

+[-0, +0, –] +

int lua_gettop (lua_State *L);
+ +

+Returns the index of the top element in the stack. +Because indices start at 1, +this result is equal to the number of elements in the stack; +in particular, 0 means an empty stack. + + + + + +


lua_getuservalue

+[-0, +1, –] +

int lua_getuservalue (lua_State *L, int index);
+ +

+Pushes onto the stack the Lua value associated with the full userdata +at the given index. + + +

+Returns the type of the pushed value. + + + + + +


lua_insert

+[-1, +1, –] +

void lua_insert (lua_State *L, int index);
+ +

+Moves the top element into the given valid index, +shifting up the elements above this index to open space. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_Integer

+
typedef ... lua_Integer;
+ +

+The type of integers in Lua. + + +

+By default this type is long long, +(usually a 64-bit two-complement integer), +but that can be changed to long or int +(usually a 32-bit two-complement integer). +(See LUA_INT_TYPE in luaconf.h.) + + +

+Lua also defines the constants +LUA_MININTEGER and LUA_MAXINTEGER, +with the minimum and the maximum values that fit in this type. + + + + + +


lua_isboolean

+[-0, +0, –] +

int lua_isboolean (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a boolean, +and 0 otherwise. + + + + + +


lua_iscfunction

+[-0, +0, –] +

int lua_iscfunction (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a C function, +and 0 otherwise. + + + + + +


lua_isfunction

+[-0, +0, –] +

int lua_isfunction (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a function +(either C or Lua), and 0 otherwise. + + + + + +


lua_isinteger

+[-0, +0, –] +

int lua_isinteger (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is an integer +(that is, the value is a number and is represented as an integer), +and 0 otherwise. + + + + + +


lua_islightuserdata

+[-0, +0, –] +

int lua_islightuserdata (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a light userdata, +and 0 otherwise. + + + + + +


lua_isnil

+[-0, +0, –] +

int lua_isnil (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is nil, +and 0 otherwise. + + + + + +


lua_isnone

+[-0, +0, –] +

int lua_isnone (lua_State *L, int index);
+ +

+Returns 1 if the given index is not valid, +and 0 otherwise. + + + + + +


lua_isnoneornil

+[-0, +0, –] +

int lua_isnoneornil (lua_State *L, int index);
+ +

+Returns 1 if the given index is not valid +or if the value at this index is nil, +and 0 otherwise. + + + + + +


lua_isnumber

+[-0, +0, –] +

int lua_isnumber (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a number +or a string convertible to a number, +and 0 otherwise. + + + + + +


lua_isstring

+[-0, +0, –] +

int lua_isstring (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a string +or a number (which is always convertible to a string), +and 0 otherwise. + + + + + +


lua_istable

+[-0, +0, –] +

int lua_istable (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a table, +and 0 otherwise. + + + + + +


lua_isthread

+[-0, +0, –] +

int lua_isthread (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a thread, +and 0 otherwise. + + + + + +


lua_isuserdata

+[-0, +0, –] +

int lua_isuserdata (lua_State *L, int index);
+ +

+Returns 1 if the value at the given index is a userdata +(either full or light), and 0 otherwise. + + + + + +


lua_isyieldable

+[-0, +0, –] +

int lua_isyieldable (lua_State *L);
+ +

+Returns 1 if the given coroutine can yield, +and 0 otherwise. + + + + + +


lua_KContext

+
typedef ... lua_KContext;
+ +

+The type for continuation-function contexts. +It must be a numeric type. +This type is defined as intptr_t +when intptr_t is available, +so that it can store pointers too. +Otherwise, it is defined as ptrdiff_t. + + + + + +


lua_KFunction

+
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
+ +

+Type for continuation functions (see §4.7). + + + + + +


lua_len

+[-0, +1, e] +

void lua_len (lua_State *L, int index);
+ +

+Returns the length of the value at the given index. +It is equivalent to the '#' operator in Lua (see §3.4.7) and +may trigger a metamethod for the "length" event (see §2.4). +The result is pushed on the stack. + + + + + +


lua_load

+[-0, +1, –] +

int lua_load (lua_State *L,
+              lua_Reader reader,
+              void *data,
+              const char *chunkname,
+              const char *mode);
+ +

+Loads a Lua chunk without running it. +If there are no errors, +lua_load pushes the compiled chunk as a Lua +function on top of the stack. +Otherwise, it pushes an error message. + + +

+The return values of lua_load are: + +

    + +
  • LUA_OK: no errors;
  • + +
  • LUA_ERRSYNTAX: +syntax error during precompilation;
  • + +
  • LUA_ERRMEM: +memory allocation (out-of-memory) error;
  • + +
  • LUA_ERRGCMM: +error while running a __gc metamethod. +(This error has no relation with the chunk being loaded. +It is generated by the garbage collector.) +
  • + +
+ +

+The lua_load function uses a user-supplied reader function +to read the chunk (see lua_Reader). +The data argument is an opaque value passed to the reader function. + + +

+The chunkname argument gives a name to the chunk, +which is used for error messages and in debug information (see §4.9). + + +

+lua_load automatically detects whether the chunk is text or binary +and loads it accordingly (see program luac). +The string mode works as in function load, +with the addition that +a NULL value is equivalent to the string "bt". + + +

+lua_load uses the stack internally, +so the reader function must always leave the stack +unmodified when returning. + + +

+If the resulting function has upvalues, +its first upvalue is set to the value of the global environment +stored at index LUA_RIDX_GLOBALS in the registry (see §4.5). +When loading main chunks, +this upvalue will be the _ENV variable (see §2.2). +Other upvalues are initialized with nil. + + + + + +


lua_newstate

+[-0, +0, –] +

lua_State *lua_newstate (lua_Alloc f, void *ud);
+ +

+Creates a new thread running in a new, independent state. +Returns NULL if it cannot create the thread or the state +(due to lack of memory). +The argument f is the allocator function; +Lua does all memory allocation for this state +through this function (see lua_Alloc). +The second argument, ud, is an opaque pointer that Lua +passes to the allocator in every call. + + + + + +


lua_newtable

+[-0, +1, m] +

void lua_newtable (lua_State *L);
+ +

+Creates a new empty table and pushes it onto the stack. +It is equivalent to lua_createtable(L, 0, 0). + + + + + +


lua_newthread

+[-0, +1, m] +

lua_State *lua_newthread (lua_State *L);
+ +

+Creates a new thread, pushes it on the stack, +and returns a pointer to a lua_State that represents this new thread. +The new thread returned by this function shares with the original thread +its global environment, +but has an independent execution stack. + + +

+There is no explicit function to close or to destroy a thread. +Threads are subject to garbage collection, +like any Lua object. + + + + + +


lua_newuserdata

+[-0, +1, m] +

void *lua_newuserdata (lua_State *L, size_t size);
+ +

+This function allocates a new block of memory with the given size, +pushes onto the stack a new full userdata with the block address, +and returns this address. +The host program can freely use this memory. + + + + + +


lua_next

+[-1, +(2|0), e] +

int lua_next (lua_State *L, int index);
+ +

+Pops a key from the stack, +and pushes a key–value pair from the table at the given index +(the "next" pair after the given key). +If there are no more elements in the table, +then lua_next returns 0 (and pushes nothing). + + +

+A typical traversal looks like this: + +

+     /* table is in the stack at index 't' */
+     lua_pushnil(L);  /* first key */
+     while (lua_next(L, t) != 0) {
+       /* uses 'key' (at index -2) and 'value' (at index -1) */
+       printf("%s - %s\n",
+              lua_typename(L, lua_type(L, -2)),
+              lua_typename(L, lua_type(L, -1)));
+       /* removes 'value'; keeps 'key' for next iteration */
+       lua_pop(L, 1);
+     }
+
+ +

+While traversing a table, +do not call lua_tolstring directly on a key, +unless you know that the key is actually a string. +Recall that lua_tolstring may change +the value at the given index; +this confuses the next call to lua_next. + + +

+See function next for the caveats of modifying +the table during its traversal. + + + + + +


lua_Number

+
typedef ... lua_Number;
+ +

+The type of floats in Lua. + + +

+By default this type is double, +but that can be changed to a single float or a long double. +(See LUA_FLOAT_TYPE in luaconf.h.) + + + + + +


lua_numbertointeger

+
int lua_numbertointeger (lua_Number n, lua_Integer *p);
+ +

+Converts a Lua float to a Lua integer. +This macro assumes that n has an integral value. +If that value is within the range of Lua integers, +it is converted to an integer and assigned to *p. +The macro results in a boolean indicating whether the +conversion was successful. +(Note that this range test can be tricky to do +correctly without this macro, +due to roundings.) + + +

+This macro may evaluate its arguments more than once. + + + + + +


lua_pcall

+[-(nargs + 1), +(nresults|1), –] +

int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);
+ +

+Calls a function in protected mode. + + +

+Both nargs and nresults have the same meaning as +in lua_call. +If there are no errors during the call, +lua_pcall behaves exactly like lua_call. +However, if there is any error, +lua_pcall catches it, +pushes a single value on the stack (the error object), +and returns an error code. +Like lua_call, +lua_pcall always removes the function +and its arguments from the stack. + + +

+If msgh is 0, +then the error object returned on the stack +is exactly the original error object. +Otherwise, msgh is the stack index of a +message handler. +(This index cannot be a pseudo-index.) +In case of runtime errors, +this function will be called with the error object +and its return value will be the object +returned on the stack by lua_pcall. + + +

+Typically, the message handler is used to add more debug +information to the error object, such as a stack traceback. +Such information cannot be gathered after the return of lua_pcall, +since by then the stack has unwound. + + +

+The lua_pcall function returns one of the following constants +(defined in lua.h): + +

    + +
  • LUA_OK (0): +success.
  • + +
  • LUA_ERRRUN: +a runtime error. +
  • + +
  • LUA_ERRMEM: +memory allocation error. +For such errors, Lua does not call the message handler. +
  • + +
  • LUA_ERRERR: +error while running the message handler. +
  • + +
  • LUA_ERRGCMM: +error while running a __gc metamethod. +For such errors, Lua does not call the message handler +(as this kind of error typically has no relation +with the function being called). +
  • + +
+ + + + +

lua_pcallk

+[-(nargs + 1), +(nresults|1), –] +

int lua_pcallk (lua_State *L,
+                int nargs,
+                int nresults,
+                int msgh,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+This function behaves exactly like lua_pcall, +but allows the called function to yield (see §4.7). + + + + + +


lua_pop

+[-n, +0, –] +

void lua_pop (lua_State *L, int n);
+ +

+Pops n elements from the stack. + + + + + +


lua_pushboolean

+[-0, +1, –] +

void lua_pushboolean (lua_State *L, int b);
+ +

+Pushes a boolean value with value b onto the stack. + + + + + +


lua_pushcclosure

+[-n, +1, m] +

void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
+ +

+Pushes a new C closure onto the stack. + + +

+When a C function is created, +it is possible to associate some values with it, +thus creating a C closure (see §4.4); +these values are then accessible to the function whenever it is called. +To associate values with a C function, +first these values must be pushed onto the stack +(when there are multiple values, the first value is pushed first). +Then lua_pushcclosure +is called to create and push the C function onto the stack, +with the argument n telling how many values will be +associated with the function. +lua_pushcclosure also pops these values from the stack. + + +

+The maximum value for n is 255. + + +

+When n is zero, +this function creates a light C function, +which is just a pointer to the C function. +In that case, it never raises a memory error. + + + + + +


lua_pushcfunction

+[-0, +1, –] +

void lua_pushcfunction (lua_State *L, lua_CFunction f);
+ +

+Pushes a C function onto the stack. +This function receives a pointer to a C function +and pushes onto the stack a Lua value of type function that, +when called, invokes the corresponding C function. + + +

+Any function to be callable by Lua must +follow the correct protocol to receive its parameters +and return its results (see lua_CFunction). + + + + + +


lua_pushfstring

+[-0, +1, e] +

const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
+ +

+Pushes onto the stack a formatted string +and returns a pointer to this string. +It is similar to the ISO C function sprintf, +but has some important differences: + +

    + +
  • +You do not have to allocate space for the result: +the result is a Lua string and Lua takes care of memory allocation +(and deallocation, through garbage collection). +
  • + +
  • +The conversion specifiers are quite restricted. +There are no flags, widths, or precisions. +The conversion specifiers can only be +'%%' (inserts the character '%'), +'%s' (inserts a zero-terminated string, with no size restrictions), +'%f' (inserts a lua_Number), +'%I' (inserts a lua_Integer), +'%p' (inserts a pointer as a hexadecimal numeral), +'%d' (inserts an int), +'%c' (inserts an int as a one-byte character), and +'%U' (inserts a long int as a UTF-8 byte sequence). +
  • + +
+ +

+Unlike other push functions, +this function checks for the stack space it needs, +including the slot for its result. + + + + + +


lua_pushglobaltable

+[-0, +1, –] +

void lua_pushglobaltable (lua_State *L);
+ +

+Pushes the global environment onto the stack. + + + + + +


lua_pushinteger

+[-0, +1, –] +

void lua_pushinteger (lua_State *L, lua_Integer n);
+ +

+Pushes an integer with value n onto the stack. + + + + + +


lua_pushlightuserdata

+[-0, +1, –] +

void lua_pushlightuserdata (lua_State *L, void *p);
+ +

+Pushes a light userdata onto the stack. + + +

+Userdata represent C values in Lua. +A light userdata represents a pointer, a void*. +It is a value (like a number): +you do not create it, it has no individual metatable, +and it is not collected (as it was never created). +A light userdata is equal to "any" +light userdata with the same C address. + + + + + +


lua_pushliteral

+[-0, +1, m] +

const char *lua_pushliteral (lua_State *L, const char *s);
+ +

+This macro is equivalent to lua_pushstring, +but should be used only when s is a literal string. + + + + + +


lua_pushlstring

+[-0, +1, m] +

const char *lua_pushlstring (lua_State *L, const char *s, size_t len);
+ +

+Pushes the string pointed to by s with size len +onto the stack. +Lua makes (or reuses) an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. +The string can contain any binary data, +including embedded zeros. + + +

+Returns a pointer to the internal copy of the string. + + + + + +


lua_pushnil

+[-0, +1, –] +

void lua_pushnil (lua_State *L);
+ +

+Pushes a nil value onto the stack. + + + + + +


lua_pushnumber

+[-0, +1, –] +

void lua_pushnumber (lua_State *L, lua_Number n);
+ +

+Pushes a float with value n onto the stack. + + + + + +


lua_pushstring

+[-0, +1, m] +

const char *lua_pushstring (lua_State *L, const char *s);
+ +

+Pushes the zero-terminated string pointed to by s +onto the stack. +Lua makes (or reuses) an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. + + +

+Returns a pointer to the internal copy of the string. + + +

+If s is NULL, pushes nil and returns NULL. + + + + + +


lua_pushthread

+[-0, +1, –] +

int lua_pushthread (lua_State *L);
+ +

+Pushes the thread represented by L onto the stack. +Returns 1 if this thread is the main thread of its state. + + + + + +


lua_pushvalue

+[-0, +1, –] +

void lua_pushvalue (lua_State *L, int index);
+ +

+Pushes a copy of the element at the given index +onto the stack. + + + + + +


lua_pushvfstring

+[-0, +1, m] +

const char *lua_pushvfstring (lua_State *L,
+                              const char *fmt,
+                              va_list argp);
+ +

+Equivalent to lua_pushfstring, except that it receives a va_list +instead of a variable number of arguments. + + + + + +


lua_rawequal

+[-0, +0, –] +

int lua_rawequal (lua_State *L, int index1, int index2);
+ +

+Returns 1 if the two values in indices index1 and +index2 are primitively equal +(that is, without calling the __eq metamethod). +Otherwise returns 0. +Also returns 0 if any of the indices are not valid. + + + + + +


lua_rawget

+[-1, +1, –] +

int lua_rawget (lua_State *L, int index);
+ +

+Similar to lua_gettable, but does a raw access +(i.e., without metamethods). + + + + + +


lua_rawgeti

+[-0, +1, –] +

int lua_rawgeti (lua_State *L, int index, lua_Integer n);
+ +

+Pushes onto the stack the value t[n], +where t is the table at the given index. +The access is raw, +that is, it does not invoke the __index metamethod. + + +

+Returns the type of the pushed value. + + + + + +


lua_rawgetp

+[-0, +1, –] +

int lua_rawgetp (lua_State *L, int index, const void *p);
+ +

+Pushes onto the stack the value t[k], +where t is the table at the given index and +k is the pointer p represented as a light userdata. +The access is raw; +that is, it does not invoke the __index metamethod. + + +

+Returns the type of the pushed value. + + + + + +


lua_rawlen

+[-0, +0, –] +

size_t lua_rawlen (lua_State *L, int index);
+ +

+Returns the raw "length" of the value at the given index: +for strings, this is the string length; +for tables, this is the result of the length operator ('#') +with no metamethods; +for userdata, this is the size of the block of memory allocated +for the userdata; +for other values, it is 0. + + + + + +


lua_rawset

+[-2, +0, m] +

void lua_rawset (lua_State *L, int index);
+ +

+Similar to lua_settable, but does a raw assignment +(i.e., without metamethods). + + + + + +


lua_rawseti

+[-1, +0, m] +

void lua_rawseti (lua_State *L, int index, lua_Integer i);
+ +

+Does the equivalent of t[i] = v, +where t is the table at the given index +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +The assignment is raw, +that is, it does not invoke the __newindex metamethod. + + + + + +


lua_rawsetp

+[-1, +0, m] +

void lua_rawsetp (lua_State *L, int index, const void *p);
+ +

+Does the equivalent of t[p] = v, +where t is the table at the given index, +p is encoded as a light userdata, +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +The assignment is raw, +that is, it does not invoke __newindex metamethod. + + + + + +


lua_Reader

+
typedef const char * (*lua_Reader) (lua_State *L,
+                                    void *data,
+                                    size_t *size);
+ +

+The reader function used by lua_load. +Every time it needs another piece of the chunk, +lua_load calls the reader, +passing along its data parameter. +The reader must return a pointer to a block of memory +with a new piece of the chunk +and set size to the block size. +The block must exist until the reader function is called again. +To signal the end of the chunk, +the reader must return NULL or set size to zero. +The reader function may return pieces of any size greater than zero. + + + + + +


lua_register

+[-0, +0, e] +

void lua_register (lua_State *L, const char *name, lua_CFunction f);
+ +

+Sets the C function f as the new value of global name. +It is defined as a macro: + +

+     #define lua_register(L,n,f) \
+            (lua_pushcfunction(L, f), lua_setglobal(L, n))
+
+ + + + +

lua_remove

+[-1, +0, –] +

void lua_remove (lua_State *L, int index);
+ +

+Removes the element at the given valid index, +shifting down the elements above this index to fill the gap. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_replace

+[-1, +0, –] +

void lua_replace (lua_State *L, int index);
+ +

+Moves the top element into the given valid index +without shifting any element +(therefore replacing the value at that given index), +and then pops the top element. + + + + + +


lua_resume

+[-?, +?, –] +

int lua_resume (lua_State *L, lua_State *from, int nargs);
+ +

+Starts and resumes a coroutine in the given thread L. + + +

+To start a coroutine, +you push onto the thread stack the main function plus any arguments; +then you call lua_resume, +with nargs being the number of arguments. +This call returns when the coroutine suspends or finishes its execution. +When it returns, the stack contains all values passed to lua_yield, +or all values returned by the body function. +lua_resume returns +LUA_YIELD if the coroutine yields, +LUA_OK if the coroutine finishes its execution +without errors, +or an error code in case of errors (see lua_pcall). + + +

+In case of errors, +the stack is not unwound, +so you can use the debug API over it. +The error object is on the top of the stack. + + +

+To resume a coroutine, +you remove any results from the last lua_yield, +put on its stack only the values to +be passed as results from yield, +and then call lua_resume. + + +

+The parameter from represents the coroutine that is resuming L. +If there is no such coroutine, +this parameter can be NULL. + + + + + +


lua_rotate

+[-0, +0, –] +

void lua_rotate (lua_State *L, int idx, int n);
+ +

+Rotates the stack elements between the valid index idx +and the top of the stack. +The elements are rotated n positions in the direction of the top, +for a positive n, +or -n positions in the direction of the bottom, +for a negative n. +The absolute value of n must not be greater than the size +of the slice being rotated. +This function cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + + + + + +


lua_setallocf

+[-0, +0, –] +

void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
+ +

+Changes the allocator function of a given state to f +with user data ud. + + + + + +


lua_setfield

+[-1, +0, e] +

void lua_setfield (lua_State *L, int index, const char *k);
+ +

+Does the equivalent to t[k] = v, +where t is the value at the given index +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_setglobal

+[-1, +0, e] +

void lua_setglobal (lua_State *L, const char *name);
+ +

+Pops a value from the stack and +sets it as the new value of global name. + + + + + +


lua_seti

+[-1, +0, e] +

void lua_seti (lua_State *L, int index, lua_Integer n);
+ +

+Does the equivalent to t[n] = v, +where t is the value at the given index +and v is the value at the top of the stack. + + +

+This function pops the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_setmetatable

+[-1, +0, –] +

void lua_setmetatable (lua_State *L, int index);
+ +

+Pops a table from the stack and +sets it as the new metatable for the value at the given index. + + + + + +


lua_settable

+[-2, +0, e] +

void lua_settable (lua_State *L, int index);
+ +

+Does the equivalent to t[k] = v, +where t is the value at the given index, +v is the value at the top of the stack, +and k is the value just below the top. + + +

+This function pops both the key and the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see §2.4). + + + + + +


lua_settop

+[-?, +?, –] +

void lua_settop (lua_State *L, int index);
+ +

+Accepts any index, or 0, +and sets the stack top to this index. +If the new top is larger than the old one, +then the new elements are filled with nil. +If index is 0, then all stack elements are removed. + + + + + +


lua_setuservalue

+[-1, +0, –] +

void lua_setuservalue (lua_State *L, int index);
+ +

+Pops a value from the stack and sets it as +the new value associated to the full userdata at the given index. + + + + + +


lua_State

+
typedef struct lua_State lua_State;
+ +

+An opaque structure that points to a thread and indirectly +(through the thread) to the whole state of a Lua interpreter. +The Lua library is fully reentrant: +it has no global variables. +All information about a state is accessible through this structure. + + +

+A pointer to this structure must be passed as the first argument to +every function in the library, except to lua_newstate, +which creates a Lua state from scratch. + + + + + +


lua_status

+[-0, +0, –] +

int lua_status (lua_State *L);
+ +

+Returns the status of the thread L. + + +

+The status can be 0 (LUA_OK) for a normal thread, +an error code if the thread finished the execution +of a lua_resume with an error, +or LUA_YIELD if the thread is suspended. + + +

+You can only call functions in threads with status LUA_OK. +You can resume threads with status LUA_OK +(to start a new coroutine) or LUA_YIELD +(to resume a coroutine). + + + + + +


lua_stringtonumber

+[-0, +1, –] +

size_t lua_stringtonumber (lua_State *L, const char *s);
+ +

+Converts the zero-terminated string s to a number, +pushes that number into the stack, +and returns the total size of the string, +that is, its length plus one. +The conversion can result in an integer or a float, +according to the lexical conventions of Lua (see §3.1). +The string may have leading and trailing spaces and a sign. +If the string is not a valid numeral, +returns 0 and pushes nothing. +(Note that the result can be used as a boolean, +true if the conversion succeeds.) + + + + + +


lua_toboolean

+[-0, +0, –] +

int lua_toboolean (lua_State *L, int index);
+ +

+Converts the Lua value at the given index to a C boolean +value (0 or 1). +Like all tests in Lua, +lua_toboolean returns true for any Lua value +different from false and nil; +otherwise it returns false. +(If you want to accept only actual boolean values, +use lua_isboolean to test the value's type.) + + + + + +


lua_tocfunction

+[-0, +0, –] +

lua_CFunction lua_tocfunction (lua_State *L, int index);
+ +

+Converts a value at the given index to a C function. +That value must be a C function; +otherwise, returns NULL. + + + + + +


lua_tointeger

+[-0, +0, –] +

lua_Integer lua_tointeger (lua_State *L, int index);
+ +

+Equivalent to lua_tointegerx with isnum equal to NULL. + + + + + +


lua_tointegerx

+[-0, +0, –] +

lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);
+ +

+Converts the Lua value at the given index +to the signed integral type lua_Integer. +The Lua value must be an integer, +or a number or string convertible to an integer (see §3.4.3); +otherwise, lua_tointegerx returns 0. + + +

+If isnum is not NULL, +its referent is assigned a boolean value that +indicates whether the operation succeeded. + + + + + +


lua_tolstring

+[-0, +0, m] +

const char *lua_tolstring (lua_State *L, int index, size_t *len);
+ +

+Converts the Lua value at the given index to a C string. +If len is not NULL, +it sets *len with the string length. +The Lua value must be a string or a number; +otherwise, the function returns NULL. +If the value is a number, +then lua_tolstring also +changes the actual value in the stack to a string. +(This change confuses lua_next +when lua_tolstring is applied to keys during a table traversal.) + + +

+lua_tolstring returns a pointer +to a string inside the Lua state. +This string always has a zero ('\0') +after its last character (as in C), +but can contain other zeros in its body. + + +

+Because Lua has garbage collection, +there is no guarantee that the pointer returned by lua_tolstring +will be valid after the corresponding Lua value is removed from the stack. + + + + + +


lua_tonumber

+[-0, +0, –] +

lua_Number lua_tonumber (lua_State *L, int index);
+ +

+Equivalent to lua_tonumberx with isnum equal to NULL. + + + + + +


lua_tonumberx

+[-0, +0, –] +

lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);
+ +

+Converts the Lua value at the given index +to the C type lua_Number (see lua_Number). +The Lua value must be a number or a string convertible to a number +(see §3.4.3); +otherwise, lua_tonumberx returns 0. + + +

+If isnum is not NULL, +its referent is assigned a boolean value that +indicates whether the operation succeeded. + + + + + +


lua_topointer

+[-0, +0, –] +

const void *lua_topointer (lua_State *L, int index);
+ +

+Converts the value at the given index to a generic +C pointer (void*). +The value can be a userdata, a table, a thread, or a function; +otherwise, lua_topointer returns NULL. +Different objects will give different pointers. +There is no way to convert the pointer back to its original value. + + +

+Typically this function is used only for hashing and debug information. + + + + + +


lua_tostring

+[-0, +0, m] +

const char *lua_tostring (lua_State *L, int index);
+ +

+Equivalent to lua_tolstring with len equal to NULL. + + + + + +


lua_tothread

+[-0, +0, –] +

lua_State *lua_tothread (lua_State *L, int index);
+ +

+Converts the value at the given index to a Lua thread +(represented as lua_State*). +This value must be a thread; +otherwise, the function returns NULL. + + + + + +


lua_touserdata

+[-0, +0, –] +

void *lua_touserdata (lua_State *L, int index);
+ +

+If the value at the given index is a full userdata, +returns its block address. +If the value is a light userdata, +returns its pointer. +Otherwise, returns NULL. + + + + + +


lua_type

+[-0, +0, –] +

int lua_type (lua_State *L, int index);
+ +

+Returns the type of the value in the given valid index, +or LUA_TNONE for a non-valid (but acceptable) index. +The types returned by lua_type are coded by the following constants +defined in lua.h: +LUA_TNIL (0), +LUA_TNUMBER, +LUA_TBOOLEAN, +LUA_TSTRING, +LUA_TTABLE, +LUA_TFUNCTION, +LUA_TUSERDATA, +LUA_TTHREAD, +and +LUA_TLIGHTUSERDATA. + + + + + +


lua_typename

+[-0, +0, –] +

const char *lua_typename (lua_State *L, int tp);
+ +

+Returns the name of the type encoded by the value tp, +which must be one the values returned by lua_type. + + + + + +


lua_Unsigned

+
typedef ... lua_Unsigned;
+ +

+The unsigned version of lua_Integer. + + + + + +


lua_upvalueindex

+[-0, +0, –] +

int lua_upvalueindex (int i);
+ +

+Returns the pseudo-index that represents the i-th upvalue of +the running function (see §4.4). + + + + + +


lua_version

+[-0, +0, –] +

const lua_Number *lua_version (lua_State *L);
+ +

+Returns the address of the version number +(a C static variable) +stored in the Lua core. +When called with a valid lua_State, +returns the address of the version used to create that state. +When called with NULL, +returns the address of the version running the call. + + + + + +


lua_Writer

+
typedef int (*lua_Writer) (lua_State *L,
+                           const void* p,
+                           size_t sz,
+                           void* ud);
+ +

+The type of the writer function used by lua_dump. +Every time it produces another piece of chunk, +lua_dump calls the writer, +passing along the buffer to be written (p), +its size (sz), +and the data parameter supplied to lua_dump. + + +

+The writer returns an error code: +0 means no errors; +any other value means an error and stops lua_dump from +calling the writer again. + + + + + +


lua_xmove

+[-?, +?, –] +

void lua_xmove (lua_State *from, lua_State *to, int n);
+ +

+Exchange values between different threads of the same state. + + +

+This function pops n values from the stack from, +and pushes them onto the stack to. + + + + + +


lua_yield

+[-?, +?, e] +

int lua_yield (lua_State *L, int nresults);
+ +

+This function is equivalent to lua_yieldk, +but it has no continuation (see §4.7). +Therefore, when the thread resumes, +it continues the function that called +the function calling lua_yield. + + + + + +


lua_yieldk

+[-?, +?, e] +

int lua_yieldk (lua_State *L,
+                int nresults,
+                lua_KContext ctx,
+                lua_KFunction k);
+ +

+Yields a coroutine (thread). + + +

+When a C function calls lua_yieldk, +the running coroutine suspends its execution, +and the call to lua_resume that started this coroutine returns. +The parameter nresults is the number of values from the stack +that will be passed as results to lua_resume. + + +

+When the coroutine is resumed again, +Lua calls the given continuation function k to continue +the execution of the C function that yielded (see §4.7). +This continuation function receives the same stack +from the previous function, +with the n results removed and +replaced by the arguments passed to lua_resume. +Moreover, +the continuation function receives the value ctx +that was passed to lua_yieldk. + + +

+Usually, this function does not return; +when the coroutine eventually resumes, +it continues executing the continuation function. +However, there is one special case, +which is when this function is called +from inside a line or a count hook (see §4.9). +In that case, lua_yieldk should be called with no continuation +(probably in the form of lua_yield) and no results, +and the hook should return immediately after the call. +Lua will yield and, +when the coroutine resumes again, +it will continue the normal execution +of the (Lua) function that triggered the hook. + + +

+This function can raise an error if it is called from a thread +with a pending C call with no continuation function, +or it is called from a thread that is not running inside a resume +(e.g., the main thread). + + + + + + + +

4.9 – The Debug Interface

+ +

+Lua has no built-in debugging facilities. +Instead, it offers a special interface +by means of functions and hooks. +This interface allows the construction of different +kinds of debuggers, profilers, and other tools +that need "inside information" from the interpreter. + + + +


lua_Debug

+
typedef struct lua_Debug {
+  int event;
+  const char *name;           /* (n) */
+  const char *namewhat;       /* (n) */
+  const char *what;           /* (S) */
+  const char *source;         /* (S) */
+  int currentline;            /* (l) */
+  int linedefined;            /* (S) */
+  int lastlinedefined;        /* (S) */
+  unsigned char nups;         /* (u) number of upvalues */
+  unsigned char nparams;      /* (u) number of parameters */
+  char isvararg;              /* (u) */
+  char istailcall;            /* (t) */
+  char short_src[LUA_IDSIZE]; /* (S) */
+  /* private part */
+  other fields
+} lua_Debug;
+ +

+A structure used to carry different pieces of +information about a function or an activation record. +lua_getstack fills only the private part +of this structure, for later use. +To fill the other fields of lua_Debug with useful information, +call lua_getinfo. + + +

+The fields of lua_Debug have the following meaning: + +

    + +
  • source: +the name of the chunk that created the function. +If source starts with a '@', +it means that the function was defined in a file where +the file name follows the '@'. +If source starts with a '=', +the remainder of its contents describe the source in a user-dependent manner. +Otherwise, +the function was defined in a string where +source is that string. +
  • + +
  • short_src: +a "printable" version of source, to be used in error messages. +
  • + +
  • linedefined: +the line number where the definition of the function starts. +
  • + +
  • lastlinedefined: +the line number where the definition of the function ends. +
  • + +
  • what: +the string "Lua" if the function is a Lua function, +"C" if it is a C function, +"main" if it is the main part of a chunk. +
  • + +
  • currentline: +the current line where the given function is executing. +When no line information is available, +currentline is set to -1. +
  • + +
  • name: +a reasonable name for the given function. +Because functions in Lua are first-class values, +they do not have a fixed name: +some functions can be the value of multiple global variables, +while others can be stored only in a table field. +The lua_getinfo function checks how the function was +called to find a suitable name. +If it cannot find a name, +then name is set to NULL. +
  • + +
  • namewhat: +explains the name field. +The value of namewhat can be +"global", "local", "method", +"field", "upvalue", or "" (the empty string), +according to how the function was called. +(Lua uses the empty string when no other option seems to apply.) +
  • + +
  • istailcall: +true if this function invocation was called by a tail call. +In this case, the caller of this level is not in the stack. +
  • + +
  • nups: +the number of upvalues of the function. +
  • + +
  • nparams: +the number of fixed parameters of the function +(always 0 for C functions). +
  • + +
  • isvararg: +true if the function is a vararg function +(always true for C functions). +
  • + +
+ + + + +

lua_gethook

+[-0, +0, –] +

lua_Hook lua_gethook (lua_State *L);
+ +

+Returns the current hook function. + + + + + +


lua_gethookcount

+[-0, +0, –] +

int lua_gethookcount (lua_State *L);
+ +

+Returns the current hook count. + + + + + +


lua_gethookmask

+[-0, +0, –] +

int lua_gethookmask (lua_State *L);
+ +

+Returns the current hook mask. + + + + + +


lua_getinfo

+[-(0|1), +(0|1|2), e] +

int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
+ +

+Gets information about a specific function or function invocation. + + +

+To get information about a function invocation, +the parameter ar must be a valid activation record that was +filled by a previous call to lua_getstack or +given as argument to a hook (see lua_Hook). + + +

+To get information about a function, you push it onto the stack +and start the what string with the character '>'. +(In that case, +lua_getinfo pops the function from the top of the stack.) +For instance, to know in which line a function f was defined, +you can write the following code: + +

+     lua_Debug ar;
+     lua_getglobal(L, "f");  /* get global 'f' */
+     lua_getinfo(L, ">S", &ar);
+     printf("%d\n", ar.linedefined);
+
+ +

+Each character in the string what +selects some fields of the structure ar to be filled or +a value to be pushed on the stack: + +

    + +
  • 'n': fills in the field name and namewhat; +
  • + +
  • 'S': +fills in the fields source, short_src, +linedefined, lastlinedefined, and what; +
  • + +
  • 'l': fills in the field currentline; +
  • + +
  • 't': fills in the field istailcall; +
  • + +
  • 'u': fills in the fields +nups, nparams, and isvararg; +
  • + +
  • 'f': +pushes onto the stack the function that is +running at the given level; +
  • + +
  • 'L': +pushes onto the stack a table whose indices are the +numbers of the lines that are valid on the function. +(A valid line is a line with some associated code, +that is, a line where you can put a break point. +Non-valid lines include empty lines and comments.) + + +

    +If this option is given together with option 'f', +its table is pushed after the function. +

  • + +
+ +

+This function returns 0 on error +(for instance, an invalid option in what). + + + + + +


lua_getlocal

+[-0, +(0|1), –] +

const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+ +

+Gets information about a local variable of +a given activation record or a given function. + + +

+In the first case, +the parameter ar must be a valid activation record that was +filled by a previous call to lua_getstack or +given as argument to a hook (see lua_Hook). +The index n selects which local variable to inspect; +see debug.getlocal for details about variable indices +and names. + + +

+lua_getlocal pushes the variable's value onto the stack +and returns its name. + + +

+In the second case, ar must be NULL and the function +to be inspected must be at the top of the stack. +In this case, only parameters of Lua functions are visible +(as there is no information about what variables are active) +and no values are pushed onto the stack. + + +

+Returns NULL (and pushes nothing) +when the index is greater than +the number of active local variables. + + + + + +


lua_getstack

+[-0, +0, –] +

int lua_getstack (lua_State *L, int level, lua_Debug *ar);
+ +

+Gets information about the interpreter runtime stack. + + +

+This function fills parts of a lua_Debug structure with +an identification of the activation record +of the function executing at a given level. +Level 0 is the current running function, +whereas level n+1 is the function that has called level n +(except for tail calls, which do not count on the stack). +When there are no errors, lua_getstack returns 1; +when called with a level greater than the stack depth, +it returns 0. + + + + + +


lua_getupvalue

+[-0, +(0|1), –] +

const char *lua_getupvalue (lua_State *L, int funcindex, int n);
+ +

+Gets information about the n-th upvalue +of the closure at index funcindex. +It pushes the upvalue's value onto the stack +and returns its name. +Returns NULL (and pushes nothing) +when the index n is greater than the number of upvalues. + + +

+For C functions, this function uses the empty string "" +as a name for all upvalues. +(For Lua functions, +upvalues are the external local variables that the function uses, +and that are consequently included in its closure.) + + +

+Upvalues have no particular order, +as they are active through the whole function. +They are numbered in an arbitrary order. + + + + + +


lua_Hook

+
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+ +

+Type for debugging hook functions. + + +

+Whenever a hook is called, its ar argument has its field +event set to the specific event that triggered the hook. +Lua identifies these events with the following constants: +LUA_HOOKCALL, LUA_HOOKRET, +LUA_HOOKTAILCALL, LUA_HOOKLINE, +and LUA_HOOKCOUNT. +Moreover, for line events, the field currentline is also set. +To get the value of any other field in ar, +the hook must call lua_getinfo. + + +

+For call events, event can be LUA_HOOKCALL, +the normal value, or LUA_HOOKTAILCALL, for a tail call; +in this case, there will be no corresponding return event. + + +

+While Lua is running a hook, it disables other calls to hooks. +Therefore, if a hook calls back Lua to execute a function or a chunk, +this execution occurs without any calls to hooks. + + +

+Hook functions cannot have continuations, +that is, they cannot call lua_yieldk, +lua_pcallk, or lua_callk with a non-null k. + + +

+Hook functions can yield under the following conditions: +Only count and line events can yield; +to yield, a hook function must finish its execution +calling lua_yield with nresults equal to zero +(that is, with no values). + + + + + +


lua_sethook

+[-0, +0, –] +

void lua_sethook (lua_State *L, lua_Hook f, int mask, int count);
+ +

+Sets the debugging hook function. + + +

+Argument f is the hook function. +mask specifies on which events the hook will be called: +it is formed by a bitwise OR of the constants +LUA_MASKCALL, +LUA_MASKRET, +LUA_MASKLINE, +and LUA_MASKCOUNT. +The count argument is only meaningful when the mask +includes LUA_MASKCOUNT. +For each event, the hook is called as explained below: + +

    + +
  • The call hook: is called when the interpreter calls a function. +The hook is called just after Lua enters the new function, +before the function gets its arguments. +
  • + +
  • The return hook: is called when the interpreter returns from a function. +The hook is called just before Lua leaves the function. +There is no standard way to access the values +to be returned by the function. +
  • + +
  • The line hook: is called when the interpreter is about to +start the execution of a new line of code, +or when it jumps back in the code (even to the same line). +(This event only happens while Lua is executing a Lua function.) +
  • + +
  • The count hook: is called after the interpreter executes every +count instructions. +(This event only happens while Lua is executing a Lua function.) +
  • + +
+ +

+A hook is disabled by setting mask to zero. + + + + + +


lua_setlocal

+[-(0|1), +0, –] +

const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+ +

+Sets the value of a local variable of a given activation record. +It assigns the value at the top of the stack +to the variable and returns its name. +It also pops the value from the stack. + + +

+Returns NULL (and pops nothing) +when the index is greater than +the number of active local variables. + + +

+Parameters ar and n are as in function lua_getlocal. + + + + + +


lua_setupvalue

+[-(0|1), +0, –] +

const char *lua_setupvalue (lua_State *L, int funcindex, int n);
+ +

+Sets the value of a closure's upvalue. +It assigns the value at the top of the stack +to the upvalue and returns its name. +It also pops the value from the stack. + + +

+Returns NULL (and pops nothing) +when the index n is greater than the number of upvalues. + + +

+Parameters funcindex and n are as in function lua_getupvalue. + + + + + +


lua_upvalueid

+[-0, +0, –] +

void *lua_upvalueid (lua_State *L, int funcindex, int n);
+ +

+Returns a unique identifier for the upvalue numbered n +from the closure at index funcindex. + + +

+These unique identifiers allow a program to check whether different +closures share upvalues. +Lua closures that share an upvalue +(that is, that access a same external local variable) +will return identical ids for those upvalue indices. + + +

+Parameters funcindex and n are as in function lua_getupvalue, +but n cannot be greater than the number of upvalues. + + + + + +


lua_upvaluejoin

+[-0, +0, –] +

void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
+                                    int funcindex2, int n2);
+ +

+Make the n1-th upvalue of the Lua closure at index funcindex1 +refer to the n2-th upvalue of the Lua closure at index funcindex2. + + + + + + + +

5 – The Auxiliary Library

+ +

+ +The auxiliary library provides several convenient functions +to interface C with Lua. +While the basic API provides the primitive functions for all +interactions between C and Lua, +the auxiliary library provides higher-level functions for some +common tasks. + + +

+All functions and types from the auxiliary library +are defined in header file lauxlib.h and +have a prefix luaL_. + + +

+All functions in the auxiliary library are built on +top of the basic API, +and so they provide nothing that cannot be done with that API. +Nevertheless, the use of the auxiliary library ensures +more consistency to your code. + + +

+Several functions in the auxiliary library use internally some +extra stack slots. +When a function in the auxiliary library uses less than five slots, +it does not check the stack size; +it simply assumes that there are enough slots. + + +

+Several functions in the auxiliary library are used to +check C function arguments. +Because the error message is formatted for arguments +(e.g., "bad argument #1"), +you should not use these functions for other stack values. + + +

+Functions called luaL_check* +always raise an error if the check is not satisfied. + + + +

5.1 – Functions and Types

+ +

+Here we list all functions and types from the auxiliary library +in alphabetical order. + + + +


luaL_addchar

+[-?, +?, m] +

void luaL_addchar (luaL_Buffer *B, char c);
+ +

+Adds the byte c to the buffer B +(see luaL_Buffer). + + + + + +


luaL_addlstring

+[-?, +?, m] +

void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
+ +

+Adds the string pointed to by s with length l to +the buffer B +(see luaL_Buffer). +The string can contain embedded zeros. + + + + + +


luaL_addsize

+[-?, +?, –] +

void luaL_addsize (luaL_Buffer *B, size_t n);
+ +

+Adds to the buffer B (see luaL_Buffer) +a string of length n previously copied to the +buffer area (see luaL_prepbuffer). + + + + + +


luaL_addstring

+[-?, +?, m] +

void luaL_addstring (luaL_Buffer *B, const char *s);
+ +

+Adds the zero-terminated string pointed to by s +to the buffer B +(see luaL_Buffer). + + + + + +


luaL_addvalue

+[-1, +?, m] +

void luaL_addvalue (luaL_Buffer *B);
+ +

+Adds the value at the top of the stack +to the buffer B +(see luaL_Buffer). +Pops the value. + + +

+This is the only function on string buffers that can (and must) +be called with an extra element on the stack, +which is the value to be added to the buffer. + + + + + +


luaL_argcheck

+[-0, +0, v] +

void luaL_argcheck (lua_State *L,
+                    int cond,
+                    int arg,
+                    const char *extramsg);
+ +

+Checks whether cond is true. +If it is not, raises an error with a standard message (see luaL_argerror). + + + + + +


luaL_argerror

+[-0, +0, v] +

int luaL_argerror (lua_State *L, int arg, const char *extramsg);
+ +

+Raises an error reporting a problem with argument arg +of the C function that called it, +using a standard message +that includes extramsg as a comment: + +

+     bad argument #arg to 'funcname' (extramsg)
+

+This function never returns. + + + + + +


luaL_Buffer

+
typedef struct luaL_Buffer luaL_Buffer;
+ +

+Type for a string buffer. + + +

+A string buffer allows C code to build Lua strings piecemeal. +Its pattern of use is as follows: + +

    + +
  • First declare a variable b of type luaL_Buffer.
  • + +
  • Then initialize it with a call luaL_buffinit(L, &b).
  • + +
  • +Then add string pieces to the buffer calling any of +the luaL_add* functions. +
  • + +
  • +Finish by calling luaL_pushresult(&b). +This call leaves the final string on the top of the stack. +
  • + +
+ +

+If you know beforehand the total size of the resulting string, +you can use the buffer like this: + +

    + +
  • First declare a variable b of type luaL_Buffer.
  • + +
  • Then initialize it and preallocate a space of +size sz with a call luaL_buffinitsize(L, &b, sz).
  • + +
  • Then copy the string into that space.
  • + +
  • +Finish by calling luaL_pushresultsize(&b, sz), +where sz is the total size of the resulting string +copied into that space. +
  • + +
+ +

+During its normal operation, +a string buffer uses a variable number of stack slots. +So, while using a buffer, you cannot assume that you know where +the top of the stack is. +You can use the stack between successive calls to buffer operations +as long as that use is balanced; +that is, +when you call a buffer operation, +the stack is at the same level +it was immediately after the previous buffer operation. +(The only exception to this rule is luaL_addvalue.) +After calling luaL_pushresult the stack is back to its +level when the buffer was initialized, +plus the final string on its top. + + + + + +


luaL_buffinit

+[-0, +0, –] +

void luaL_buffinit (lua_State *L, luaL_Buffer *B);
+ +

+Initializes a buffer B. +This function does not allocate any space; +the buffer must be declared as a variable +(see luaL_Buffer). + + + + + +


luaL_buffinitsize

+[-?, +?, m] +

char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);
+ +

+Equivalent to the sequence +luaL_buffinit, luaL_prepbuffsize. + + + + + +


luaL_callmeta

+[-0, +(0|1), e] +

int luaL_callmeta (lua_State *L, int obj, const char *e);
+ +

+Calls a metamethod. + + +

+If the object at index obj has a metatable and this +metatable has a field e, +this function calls this field passing the object as its only argument. +In this case this function returns true and pushes onto the +stack the value returned by the call. +If there is no metatable or no metamethod, +this function returns false (without pushing any value on the stack). + + + + + +


luaL_checkany

+[-0, +0, v] +

void luaL_checkany (lua_State *L, int arg);
+ +

+Checks whether the function has an argument +of any type (including nil) at position arg. + + + + + +


luaL_checkinteger

+[-0, +0, v] +

lua_Integer luaL_checkinteger (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is an integer +(or can be converted to an integer) +and returns this integer cast to a lua_Integer. + + + + + +


luaL_checklstring

+[-0, +0, v] +

const char *luaL_checklstring (lua_State *L, int arg, size_t *l);
+ +

+Checks whether the function argument arg is a string +and returns this string; +if l is not NULL fills *l +with the string's length. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_checknumber

+[-0, +0, v] +

lua_Number luaL_checknumber (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is a number +and returns this number. + + + + + +


luaL_checkoption

+[-0, +0, v] +

int luaL_checkoption (lua_State *L,
+                      int arg,
+                      const char *def,
+                      const char *const lst[]);
+ +

+Checks whether the function argument arg is a string and +searches for this string in the array lst +(which must be NULL-terminated). +Returns the index in the array where the string was found. +Raises an error if the argument is not a string or +if the string cannot be found. + + +

+If def is not NULL, +the function uses def as a default value when +there is no argument arg or when this argument is nil. + + +

+This is a useful function for mapping strings to C enums. +(The usual convention in Lua libraries is +to use strings instead of numbers to select options.) + + + + + +


luaL_checkstack

+[-0, +0, v] +

void luaL_checkstack (lua_State *L, int sz, const char *msg);
+ +

+Grows the stack size to top + sz elements, +raising an error if the stack cannot grow to that size. +msg is an additional text to go into the error message +(or NULL for no additional text). + + + + + +


luaL_checkstring

+[-0, +0, v] +

const char *luaL_checkstring (lua_State *L, int arg);
+ +

+Checks whether the function argument arg is a string +and returns this string. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_checktype

+[-0, +0, v] +

void luaL_checktype (lua_State *L, int arg, int t);
+ +

+Checks whether the function argument arg has type t. +See lua_type for the encoding of types for t. + + + + + +


luaL_checkudata

+[-0, +0, v] +

void *luaL_checkudata (lua_State *L, int arg, const char *tname);
+ +

+Checks whether the function argument arg is a userdata +of the type tname (see luaL_newmetatable) and +returns the userdata address (see lua_touserdata). + + + + + +


luaL_checkversion

+[-0, +0, v] +

void luaL_checkversion (lua_State *L);
+ +

+Checks whether the core running the call, +the core that created the Lua state, +and the code making the call are all using the same version of Lua. +Also checks whether the core running the call +and the core that created the Lua state +are using the same address space. + + + + + +


luaL_dofile

+[-0, +?, e] +

int luaL_dofile (lua_State *L, const char *filename);
+ +

+Loads and runs the given file. +It is defined as the following macro: + +

+     (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
+

+It returns false if there are no errors +or true in case of errors. + + + + + +


luaL_dostring

+[-0, +?, –] +

int luaL_dostring (lua_State *L, const char *str);
+ +

+Loads and runs the given string. +It is defined as the following macro: + +

+     (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
+

+It returns false if there are no errors +or true in case of errors. + + + + + +


luaL_error

+[-0, +0, v] +

int luaL_error (lua_State *L, const char *fmt, ...);
+ +

+Raises an error. +The error message format is given by fmt +plus any extra arguments, +following the same rules of lua_pushfstring. +It also adds at the beginning of the message the file name and +the line number where the error occurred, +if this information is available. + + +

+This function never returns, +but it is an idiom to use it in C functions +as return luaL_error(args). + + + + + +


luaL_execresult

+[-0, +3, m] +

int luaL_execresult (lua_State *L, int stat);
+ +

+This function produces the return values for +process-related functions in the standard library +(os.execute and io.close). + + + + + +


luaL_fileresult

+[-0, +(1|3), m] +

int luaL_fileresult (lua_State *L, int stat, const char *fname);
+ +

+This function produces the return values for +file-related functions in the standard library +(io.open, os.rename, file:seek, etc.). + + + + + +


luaL_getmetafield

+[-0, +(0|1), m] +

int luaL_getmetafield (lua_State *L, int obj, const char *e);
+ +

+Pushes onto the stack the field e from the metatable +of the object at index obj and returns the type of the pushed value. +If the object does not have a metatable, +or if the metatable does not have this field, +pushes nothing and returns LUA_TNIL. + + + + + +


luaL_getmetatable

+[-0, +1, m] +

int luaL_getmetatable (lua_State *L, const char *tname);
+ +

+Pushes onto the stack the metatable associated with name tname +in the registry (see luaL_newmetatable) +(nil if there is no metatable associated with that name). +Returns the type of the pushed value. + + + + + +


luaL_getsubtable

+[-0, +1, e] +

int luaL_getsubtable (lua_State *L, int idx, const char *fname);
+ +

+Ensures that the value t[fname], +where t is the value at index idx, +is a table, +and pushes that table onto the stack. +Returns true if it finds a previous table there +and false if it creates a new table. + + + + + +


luaL_gsub

+[-0, +1, m] +

const char *luaL_gsub (lua_State *L,
+                       const char *s,
+                       const char *p,
+                       const char *r);
+ +

+Creates a copy of string s by replacing +any occurrence of the string p +with the string r. +Pushes the resulting string on the stack and returns it. + + + + + +


luaL_len

+[-0, +0, e] +

lua_Integer luaL_len (lua_State *L, int index);
+ +

+Returns the "length" of the value at the given index +as a number; +it is equivalent to the '#' operator in Lua (see §3.4.7). +Raises an error if the result of the operation is not an integer. +(This case only can happen through metamethods.) + + + + + +


luaL_loadbuffer

+[-0, +1, –] +

int luaL_loadbuffer (lua_State *L,
+                     const char *buff,
+                     size_t sz,
+                     const char *name);
+ +

+Equivalent to luaL_loadbufferx with mode equal to NULL. + + + + + +


luaL_loadbufferx

+[-0, +1, –] +

int luaL_loadbufferx (lua_State *L,
+                      const char *buff,
+                      size_t sz,
+                      const char *name,
+                      const char *mode);
+ +

+Loads a buffer as a Lua chunk. +This function uses lua_load to load the chunk in the +buffer pointed to by buff with size sz. + + +

+This function returns the same results as lua_load. +name is the chunk name, +used for debug information and error messages. +The string mode works as in function lua_load. + + + + + +


luaL_loadfile

+[-0, +1, m] +

int luaL_loadfile (lua_State *L, const char *filename);
+ +

+Equivalent to luaL_loadfilex with mode equal to NULL. + + + + + +


luaL_loadfilex

+[-0, +1, m] +

int luaL_loadfilex (lua_State *L, const char *filename,
+                                            const char *mode);
+ +

+Loads a file as a Lua chunk. +This function uses lua_load to load the chunk in the file +named filename. +If filename is NULL, +then it loads from the standard input. +The first line in the file is ignored if it starts with a #. + + +

+The string mode works as in function lua_load. + + +

+This function returns the same results as lua_load, +but it has an extra error code LUA_ERRFILE +for file-related errors +(e.g., it cannot open or read the file). + + +

+As lua_load, this function only loads the chunk; +it does not run it. + + + + + +


luaL_loadstring

+[-0, +1, –] +

int luaL_loadstring (lua_State *L, const char *s);
+ +

+Loads a string as a Lua chunk. +This function uses lua_load to load the chunk in +the zero-terminated string s. + + +

+This function returns the same results as lua_load. + + +

+Also as lua_load, this function only loads the chunk; +it does not run it. + + + + + +


luaL_newlib

+[-0, +1, m] +

void luaL_newlib (lua_State *L, const luaL_Reg l[]);
+ +

+Creates a new table and registers there +the functions in list l. + + +

+It is implemented as the following macro: + +

+     (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
+

+The array l must be the actual array, +not a pointer to it. + + + + + +


luaL_newlibtable

+[-0, +1, m] +

void luaL_newlibtable (lua_State *L, const luaL_Reg l[]);
+ +

+Creates a new table with a size optimized +to store all entries in the array l +(but does not actually store them). +It is intended to be used in conjunction with luaL_setfuncs +(see luaL_newlib). + + +

+It is implemented as a macro. +The array l must be the actual array, +not a pointer to it. + + + + + +


luaL_newmetatable

+[-0, +1, m] +

int luaL_newmetatable (lua_State *L, const char *tname);
+ +

+If the registry already has the key tname, +returns 0. +Otherwise, +creates a new table to be used as a metatable for userdata, +adds to this new table the pair __name = tname, +adds to the registry the pair [tname] = new table, +and returns 1. +(The entry __name is used by some error-reporting functions.) + + +

+In both cases pushes onto the stack the final value associated +with tname in the registry. + + + + + +


luaL_newstate

+[-0, +0, –] +

lua_State *luaL_newstate (void);
+ +

+Creates a new Lua state. +It calls lua_newstate with an +allocator based on the standard C realloc function +and then sets a panic function (see §4.6) that prints +an error message to the standard error output in case of fatal +errors. + + +

+Returns the new state, +or NULL if there is a memory allocation error. + + + + + +


luaL_openlibs

+[-0, +0, e] +

void luaL_openlibs (lua_State *L);
+ +

+Opens all standard Lua libraries into the given state. + + + + + +


luaL_opt

+[-0, +0, e] +

T luaL_opt (L, func, arg, dflt);
+ +

+This macro is defined as follows: + +

+     (lua_isnoneornil(L,(arg)) ? (dflt) : func(L,(arg)))
+

+In words, if the argument arg is nil or absent, +the macro results in the default dflt. +Otherwise, it results in the result of calling func +with the state L and the argument index arg as +arguments. +Note that it evaluates the expression dflt only if needed. + + + + + +


luaL_optinteger

+[-0, +0, v] +

lua_Integer luaL_optinteger (lua_State *L,
+                             int arg,
+                             lua_Integer d);
+ +

+If the function argument arg is an integer +(or convertible to an integer), +returns this integer. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_optlstring

+[-0, +0, v] +

const char *luaL_optlstring (lua_State *L,
+                             int arg,
+                             const char *d,
+                             size_t *l);
+ +

+If the function argument arg is a string, +returns this string. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + +

+If l is not NULL, +fills the position *l with the result's length. +If the result is NULL +(only possible when returning d and d == NULL), +its length is considered zero. + + +

+This function uses lua_tolstring to get its result, +so all conversions and caveats of that function apply here. + + + + + +


luaL_optnumber

+[-0, +0, v] +

lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number d);
+ +

+If the function argument arg is a number, +returns this number. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_optstring

+[-0, +0, v] +

const char *luaL_optstring (lua_State *L,
+                            int arg,
+                            const char *d);
+ +

+If the function argument arg is a string, +returns this string. +If this argument is absent or is nil, +returns d. +Otherwise, raises an error. + + + + + +


luaL_prepbuffer

+[-?, +?, m] +

char *luaL_prepbuffer (luaL_Buffer *B);
+ +

+Equivalent to luaL_prepbuffsize +with the predefined size LUAL_BUFFERSIZE. + + + + + +


luaL_prepbuffsize

+[-?, +?, m] +

char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);
+ +

+Returns an address to a space of size sz +where you can copy a string to be added to buffer B +(see luaL_Buffer). +After copying the string into this space you must call +luaL_addsize with the size of the string to actually add +it to the buffer. + + + + + +


luaL_pushresult

+[-?, +1, m] +

void luaL_pushresult (luaL_Buffer *B);
+ +

+Finishes the use of buffer B leaving the final string on +the top of the stack. + + + + + +


luaL_pushresultsize

+[-?, +1, m] +

void luaL_pushresultsize (luaL_Buffer *B, size_t sz);
+ +

+Equivalent to the sequence luaL_addsize, luaL_pushresult. + + + + + +


luaL_ref

+[-1, +0, m] +

int luaL_ref (lua_State *L, int t);
+ +

+Creates and returns a reference, +in the table at index t, +for the object at the top of the stack (and pops the object). + + +

+A reference is a unique integer key. +As long as you do not manually add integer keys into table t, +luaL_ref ensures the uniqueness of the key it returns. +You can retrieve an object referred by reference r +by calling lua_rawgeti(L, t, r). +Function luaL_unref frees a reference and its associated object. + + +

+If the object at the top of the stack is nil, +luaL_ref returns the constant LUA_REFNIL. +The constant LUA_NOREF is guaranteed to be different +from any reference returned by luaL_ref. + + + + + +


luaL_Reg

+
typedef struct luaL_Reg {
+  const char *name;
+  lua_CFunction func;
+} luaL_Reg;
+ +

+Type for arrays of functions to be registered by +luaL_setfuncs. +name is the function name and func is a pointer to +the function. +Any array of luaL_Reg must end with a sentinel entry +in which both name and func are NULL. + + + + + +


luaL_requiref

+[-0, +1, e] +

void luaL_requiref (lua_State *L, const char *modname,
+                    lua_CFunction openf, int glb);
+ +

+If modname is not already present in package.loaded, +calls function openf with string modname as an argument +and sets the call result in package.loaded[modname], +as if that function has been called through require. + + +

+If glb is true, +also stores the module into global modname. + + +

+Leaves a copy of the module on the stack. + + + + + +


luaL_setfuncs

+[-nup, +0, m] +

void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
+ +

+Registers all functions in the array l +(see luaL_Reg) into the table on the top of the stack +(below optional upvalues, see next). + + +

+When nup is not zero, +all functions are created sharing nup upvalues, +which must be previously pushed on the stack +on top of the library table. +These values are popped from the stack after the registration. + + + + + +


luaL_setmetatable

+[-0, +0, –] +

void luaL_setmetatable (lua_State *L, const char *tname);
+ +

+Sets the metatable of the object at the top of the stack +as the metatable associated with name tname +in the registry (see luaL_newmetatable). + + + + + +


luaL_Stream

+
typedef struct luaL_Stream {
+  FILE *f;
+  lua_CFunction closef;
+} luaL_Stream;
+ +

+The standard representation for file handles, +which is used by the standard I/O library. + + +

+A file handle is implemented as a full userdata, +with a metatable called LUA_FILEHANDLE +(where LUA_FILEHANDLE is a macro with the actual metatable's name). +The metatable is created by the I/O library +(see luaL_newmetatable). + + +

+This userdata must start with the structure luaL_Stream; +it can contain other data after this initial structure. +Field f points to the corresponding C stream +(or it can be NULL to indicate an incompletely created handle). +Field closef points to a Lua function +that will be called to close the stream +when the handle is closed or collected; +this function receives the file handle as its sole argument and +must return either true (in case of success) +or nil plus an error message (in case of error). +Once Lua calls this field, +it changes the field value to NULL +to signal that the handle is closed. + + + + + +


luaL_testudata

+[-0, +0, m] +

void *luaL_testudata (lua_State *L, int arg, const char *tname);
+ +

+This function works like luaL_checkudata, +except that, when the test fails, +it returns NULL instead of raising an error. + + + + + +


luaL_tolstring

+[-0, +1, e] +

const char *luaL_tolstring (lua_State *L, int idx, size_t *len);
+ +

+Converts any Lua value at the given index to a C string +in a reasonable format. +The resulting string is pushed onto the stack and also +returned by the function. +If len is not NULL, +the function also sets *len with the string length. + + +

+If the value has a metatable with a __tostring field, +then luaL_tolstring calls the corresponding metamethod +with the value as argument, +and uses the result of the call as its result. + + + + + +


luaL_traceback

+[-0, +1, m] +

void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
+                     int level);
+ +

+Creates and pushes a traceback of the stack L1. +If msg is not NULL it is appended +at the beginning of the traceback. +The level parameter tells at which level +to start the traceback. + + + + + +


luaL_typename

+[-0, +0, –] +

const char *luaL_typename (lua_State *L, int index);
+ +

+Returns the name of the type of the value at the given index. + + + + + +


luaL_unref

+[-0, +0, –] +

void luaL_unref (lua_State *L, int t, int ref);
+ +

+Releases reference ref from the table at index t +(see luaL_ref). +The entry is removed from the table, +so that the referred object can be collected. +The reference ref is also freed to be used again. + + +

+If ref is LUA_NOREF or LUA_REFNIL, +luaL_unref does nothing. + + + + + +


luaL_where

+[-0, +1, m] +

void luaL_where (lua_State *L, int lvl);
+ +

+Pushes onto the stack a string identifying the current position +of the control at level lvl in the call stack. +Typically this string has the following format: + +

+     chunkname:currentline:
+

+Level 0 is the running function, +level 1 is the function that called the running function, +etc. + + +

+This function is used to build a prefix for error messages. + + + + + + + +

6 – Standard Libraries

+ +

+The standard Lua libraries provide useful functions +that are implemented directly through the C API. +Some of these functions provide essential services to the language +(e.g., type and getmetatable); +others provide access to "outside" services (e.g., I/O); +and others could be implemented in Lua itself, +but are quite useful or have critical performance requirements that +deserve an implementation in C (e.g., table.sort). + + +

+All libraries are implemented through the official C API +and are provided as separate C modules. +Currently, Lua has the following standard libraries: + +

    + +
  • basic library (§6.1);
  • + +
  • coroutine library (§6.2);
  • + +
  • package library (§6.3);
  • + +
  • string manipulation (§6.4);
  • + +
  • basic UTF-8 support (§6.5);
  • + +
  • table manipulation (§6.6);
  • + +
  • mathematical functions (§6.7) (sin, log, etc.);
  • + +
  • input and output (§6.8);
  • + +
  • operating system facilities (§6.9);
  • + +
  • debug facilities (§6.10).
  • + +

+Except for the basic and the package libraries, +each library provides all its functions as fields of a global table +or as methods of its objects. + + +

+To have access to these libraries, +the C host program should call the luaL_openlibs function, +which opens all standard libraries. +Alternatively, +the host program can open them individually by using +luaL_requiref to call +luaopen_base (for the basic library), +luaopen_package (for the package library), +luaopen_coroutine (for the coroutine library), +luaopen_string (for the string library), +luaopen_utf8 (for the UTF8 library), +luaopen_table (for the table library), +luaopen_math (for the mathematical library), +luaopen_io (for the I/O library), +luaopen_os (for the operating system library), +and luaopen_debug (for the debug library). +These functions are declared in lualib.h. + + + +

6.1 – Basic Functions

+ +

+The basic library provides core functions to Lua. +If you do not include this library in your application, +you should check carefully whether you need to provide +implementations for some of its facilities. + + +

+


assert (v [, message])

+ + +

+Calls error if +the value of its argument v is false (i.e., nil or false); +otherwise, returns all its arguments. +In case of error, +message is the error object; +when absent, it defaults to "assertion failed!" + + + + +

+


collectgarbage ([opt [, arg]])

+ + +

+This function is a generic interface to the garbage collector. +It performs different functions according to its first argument, opt: + +

    + +
  • "collect": +performs a full garbage-collection cycle. +This is the default option. +
  • + +
  • "stop": +stops automatic execution of the garbage collector. +The collector will run only when explicitly invoked, +until a call to restart it. +
  • + +
  • "restart": +restarts automatic execution of the garbage collector. +
  • + +
  • "count": +returns the total memory in use by Lua in Kbytes. +The value has a fractional part, +so that it multiplied by 1024 +gives the exact number of bytes in use by Lua +(except for overflows). +
  • + +
  • "step": +performs a garbage-collection step. +The step "size" is controlled by arg. +With a zero value, +the collector will perform one basic (indivisible) step. +For non-zero values, +the collector will perform as if that amount of memory +(in KBytes) had been allocated by Lua. +Returns true if the step finished a collection cycle. +
  • + +
  • "setpause": +sets arg as the new value for the pause of +the collector (see §2.5). +Returns the previous value for pause. +
  • + +
  • "setstepmul": +sets arg as the new value for the step multiplier of +the collector (see §2.5). +Returns the previous value for step. +
  • + +
  • "isrunning": +returns a boolean that tells whether the collector is running +(i.e., not stopped). +
  • + +
+ + + +

+


dofile ([filename])

+Opens the named file and executes its contents as a Lua chunk. +When called without arguments, +dofile executes the contents of the standard input (stdin). +Returns all values returned by the chunk. +In case of errors, dofile propagates the error +to its caller (that is, dofile does not run in protected mode). + + + + +

+


error (message [, level])

+Terminates the last protected function called +and returns message as the error object. +Function error never returns. + + +

+Usually, error adds some information about the error position +at the beginning of the message, if the message is a string. +The level argument specifies how to get the error position. +With level 1 (the default), the error position is where the +error function was called. +Level 2 points the error to where the function +that called error was called; and so on. +Passing a level 0 avoids the addition of error position information +to the message. + + + + +

+


_G

+A global variable (not a function) that +holds the global environment (see §2.2). +Lua itself does not use this variable; +changing its value does not affect any environment, +nor vice versa. + + + + +

+


getmetatable (object)

+ + +

+If object does not have a metatable, returns nil. +Otherwise, +if the object's metatable has a __metatable field, +returns the associated value. +Otherwise, returns the metatable of the given object. + + + + +

+


ipairs (t)

+ + +

+Returns three values (an iterator function, the table t, and 0) +so that the construction + +

+     for i,v in ipairs(t) do body end
+

+will iterate over the key–value pairs +(1,t[1]), (2,t[2]), ..., +up to the first nil value. + + + + +

+


load (chunk [, chunkname [, mode [, env]]])

+ + +

+Loads a chunk. + + +

+If chunk is a string, the chunk is this string. +If chunk is a function, +load calls it repeatedly to get the chunk pieces. +Each call to chunk must return a string that concatenates +with previous results. +A return of an empty string, nil, or no value signals the end of the chunk. + + +

+If there are no syntactic errors, +returns the compiled chunk as a function; +otherwise, returns nil plus the error message. + + +

+If the resulting function has upvalues, +the first upvalue is set to the value of env, +if that parameter is given, +or to the value of the global environment. +Other upvalues are initialized with nil. +(When you load a main chunk, +the resulting function will always have exactly one upvalue, +the _ENV variable (see §2.2). +However, +when you load a binary chunk created from a function (see string.dump), +the resulting function can have an arbitrary number of upvalues.) +All upvalues are fresh, that is, +they are not shared with any other function. + + +

+chunkname is used as the name of the chunk for error messages +and debug information (see §4.9). +When absent, +it defaults to chunk, if chunk is a string, +or to "=(load)" otherwise. + + +

+The string mode controls whether the chunk can be text or binary +(that is, a precompiled chunk). +It may be the string "b" (only binary chunks), +"t" (only text chunks), +or "bt" (both binary and text). +The default is "bt". + + +

+Lua does not check the consistency of binary chunks. +Maliciously crafted binary chunks can crash +the interpreter. + + + + +

+


loadfile ([filename [, mode [, env]]])

+ + +

+Similar to load, +but gets the chunk from file filename +or from the standard input, +if no file name is given. + + + + +

+


next (table [, index])

+ + +

+Allows a program to traverse all fields of a table. +Its first argument is a table and its second argument +is an index in this table. +next returns the next index of the table +and its associated value. +When called with nil as its second argument, +next returns an initial index +and its associated value. +When called with the last index, +or with nil in an empty table, +next returns nil. +If the second argument is absent, then it is interpreted as nil. +In particular, +you can use next(t) to check whether a table is empty. + + +

+The order in which the indices are enumerated is not specified, +even for numeric indices. +(To traverse a table in numerical order, +use a numerical for.) + + +

+The behavior of next is undefined if, +during the traversal, +you assign any value to a non-existent field in the table. +You may however modify existing fields. +In particular, you may clear existing fields. + + + + +

+


pairs (t)

+ + +

+If t has a metamethod __pairs, +calls it with t as argument and returns the first three +results from the call. + + +

+Otherwise, +returns three values: the next function, the table t, and nil, +so that the construction + +

+     for k,v in pairs(t) do body end
+

+will iterate over all key–value pairs of table t. + + +

+See function next for the caveats of modifying +the table during its traversal. + + + + +

+


pcall (f [, arg1, ···])

+ + +

+Calls function f with +the given arguments in protected mode. +This means that any error inside f is not propagated; +instead, pcall catches the error +and returns a status code. +Its first result is the status code (a boolean), +which is true if the call succeeds without errors. +In such case, pcall also returns all results from the call, +after this first result. +In case of any error, pcall returns false plus the error message. + + + + +

+


print (···)

+Receives any number of arguments +and prints their values to stdout, +using the tostring function to convert each argument to a string. +print is not intended for formatted output, +but only as a quick way to show a value, +for instance for debugging. +For complete control over the output, +use string.format and io.write. + + + + +

+


rawequal (v1, v2)

+Checks whether v1 is equal to v2, +without invoking the __eq metamethod. +Returns a boolean. + + + + +

+


rawget (table, index)

+Gets the real value of table[index], +without invoking the __index metamethod. +table must be a table; +index may be any value. + + + + +

+


rawlen (v)

+Returns the length of the object v, +which must be a table or a string, +without invoking the __len metamethod. +Returns an integer. + + + + +

+


rawset (table, index, value)

+Sets the real value of table[index] to value, +without invoking the __newindex metamethod. +table must be a table, +index any value different from nil and NaN, +and value any Lua value. + + +

+This function returns table. + + + + +

+


select (index, ···)

+ + +

+If index is a number, +returns all arguments after argument number index; +a negative number indexes from the end (-1 is the last argument). +Otherwise, index must be the string "#", +and select returns the total number of extra arguments it received. + + + + +

+


setmetatable (table, metatable)

+ + +

+Sets the metatable for the given table. +(To change the metatable of other types from Lua code, +you must use the debug library (§6.10).) +If metatable is nil, +removes the metatable of the given table. +If the original metatable has a __metatable field, +raises an error. + + +

+This function returns table. + + + + +

+


tonumber (e [, base])

+ + +

+When called with no base, +tonumber tries to convert its argument to a number. +If the argument is already a number or +a string convertible to a number, +then tonumber returns this number; +otherwise, it returns nil. + + +

+The conversion of strings can result in integers or floats, +according to the lexical conventions of Lua (see §3.1). +(The string may have leading and trailing spaces and a sign.) + + +

+When called with base, +then e must be a string to be interpreted as +an integer numeral in that base. +The base may be any integer between 2 and 36, inclusive. +In bases above 10, the letter 'A' (in either upper or lower case) +represents 10, 'B' represents 11, and so forth, +with 'Z' representing 35. +If the string e is not a valid numeral in the given base, +the function returns nil. + + + + +

+


tostring (v)

+Receives a value of any type and +converts it to a string in a human-readable format. +(For complete control of how numbers are converted, +use string.format.) + + +

+If the metatable of v has a __tostring field, +then tostring calls the corresponding value +with v as argument, +and uses the result of the call as its result. + + + + +

+


type (v)

+Returns the type of its only argument, coded as a string. +The possible results of this function are +"nil" (a string, not the value nil), +"number", +"string", +"boolean", +"table", +"function", +"thread", +and "userdata". + + + + +

+


_VERSION

+ + +

+A global variable (not a function) that +holds a string containing the running Lua version. +The current value of this variable is "Lua 5.3". + + + + +

+


xpcall (f, msgh [, arg1, ···])

+ + +

+This function is similar to pcall, +except that it sets a new message handler msgh. + + + + + + + +

6.2 – Coroutine Manipulation

+ +

+This library comprises the operations to manipulate coroutines, +which come inside the table coroutine. +See §2.6 for a general description of coroutines. + + +

+


coroutine.create (f)

+ + +

+Creates a new coroutine, with body f. +f must be a function. +Returns this new coroutine, +an object with type "thread". + + + + +

+


coroutine.isyieldable ()

+ + +

+Returns true when the running coroutine can yield. + + +

+A running coroutine is yieldable if it is not the main thread and +it is not inside a non-yieldable C function. + + + + +

+


coroutine.resume (co [, val1, ···])

+ + +

+Starts or continues the execution of coroutine co. +The first time you resume a coroutine, +it starts running its body. +The values val1, ... are passed +as the arguments to the body function. +If the coroutine has yielded, +resume restarts it; +the values val1, ... are passed +as the results from the yield. + + +

+If the coroutine runs without any errors, +resume returns true plus any values passed to yield +(when the coroutine yields) or any values returned by the body function +(when the coroutine terminates). +If there is any error, +resume returns false plus the error message. + + + + +

+


coroutine.running ()

+ + +

+Returns the running coroutine plus a boolean, +true when the running coroutine is the main one. + + + + +

+


coroutine.status (co)

+ + +

+Returns the status of coroutine co, as a string: +"running", +if the coroutine is running (that is, it called status); +"suspended", if the coroutine is suspended in a call to yield, +or if it has not started running yet; +"normal" if the coroutine is active but not running +(that is, it has resumed another coroutine); +and "dead" if the coroutine has finished its body function, +or if it has stopped with an error. + + + + +

+


coroutine.wrap (f)

+ + +

+Creates a new coroutine, with body f. +f must be a function. +Returns a function that resumes the coroutine each time it is called. +Any arguments passed to the function behave as the +extra arguments to resume. +Returns the same values returned by resume, +except the first boolean. +In case of error, propagates the error. + + + + +

+


coroutine.yield (···)

+ + +

+Suspends the execution of the calling coroutine. +Any arguments to yield are passed as extra results to resume. + + + + + + + +

6.3 – Modules

+ +

+The package library provides basic +facilities for loading modules in Lua. +It exports one function directly in the global environment: +require. +Everything else is exported in a table package. + + +

+


require (modname)

+ + +

+Loads the given module. +The function starts by looking into the package.loaded table +to determine whether modname is already loaded. +If it is, then require returns the value stored +at package.loaded[modname]. +Otherwise, it tries to find a loader for the module. + + +

+To find a loader, +require is guided by the package.searchers sequence. +By changing this sequence, +we can change how require looks for a module. +The following explanation is based on the default configuration +for package.searchers. + + +

+First require queries package.preload[modname]. +If it has a value, +this value (which must be a function) is the loader. +Otherwise require searches for a Lua loader using the +path stored in package.path. +If that also fails, it searches for a C loader using the +path stored in package.cpath. +If that also fails, +it tries an all-in-one loader (see package.searchers). + + +

+Once a loader is found, +require calls the loader with two arguments: +modname and an extra value dependent on how it got the loader. +(If the loader came from a file, +this extra value is the file name.) +If the loader returns any non-nil value, +require assigns the returned value to package.loaded[modname]. +If the loader does not return a non-nil value and +has not assigned any value to package.loaded[modname], +then require assigns true to this entry. +In any case, require returns the +final value of package.loaded[modname]. + + +

+If there is any error loading or running the module, +or if it cannot find any loader for the module, +then require raises an error. + + + + +

+


package.config

+ + +

+A string describing some compile-time configurations for packages. +This string is a sequence of lines: + +

    + +
  • The first line is the directory separator string. +Default is '\' for Windows and '/' for all other systems.
  • + +
  • The second line is the character that separates templates in a path. +Default is ';'.
  • + +
  • The third line is the string that marks the +substitution points in a template. +Default is '?'.
  • + +
  • The fourth line is a string that, in a path in Windows, +is replaced by the executable's directory. +Default is '!'.
  • + +
  • The fifth line is a mark to ignore all text after it +when building the luaopen_ function name. +Default is '-'.
  • + +
+ + + +

+


package.cpath

+ + +

+The path used by require to search for a C loader. + + +

+Lua initializes the C path package.cpath in the same way +it initializes the Lua path package.path, +using the environment variable LUA_CPATH_5_3, +or the environment variable LUA_CPATH, +or a default path defined in luaconf.h. + + + + +

+


package.loaded

+ + +

+A table used by require to control which +modules are already loaded. +When you require a module modname and +package.loaded[modname] is not false, +require simply returns the value stored there. + + +

+This variable is only a reference to the real table; +assignments to this variable do not change the +table used by require. + + + + +

+


package.loadlib (libname, funcname)

+ + +

+Dynamically links the host program with the C library libname. + + +

+If funcname is "*", +then it only links with the library, +making the symbols exported by the library +available to other dynamically linked libraries. +Otherwise, +it looks for a function funcname inside the library +and returns this function as a C function. +So, funcname must follow the lua_CFunction prototype +(see lua_CFunction). + + +

+This is a low-level function. +It completely bypasses the package and module system. +Unlike require, +it does not perform any path searching and +does not automatically adds extensions. +libname must be the complete file name of the C library, +including if necessary a path and an extension. +funcname must be the exact name exported by the C library +(which may depend on the C compiler and linker used). + + +

+This function is not supported by Standard C. +As such, it is only available on some platforms +(Windows, Linux, Mac OS X, Solaris, BSD, +plus other Unix systems that support the dlfcn standard). + + + + +

+


package.path

+ + +

+The path used by require to search for a Lua loader. + + +

+At start-up, Lua initializes this variable with +the value of the environment variable LUA_PATH_5_3 or +the environment variable LUA_PATH or +with a default path defined in luaconf.h, +if those environment variables are not defined. +Any ";;" in the value of the environment variable +is replaced by the default path. + + + + +

+


package.preload

+ + +

+A table to store loaders for specific modules +(see require). + + +

+This variable is only a reference to the real table; +assignments to this variable do not change the +table used by require. + + + + +

+


package.searchers

+ + +

+A table used by require to control how to load modules. + + +

+Each entry in this table is a searcher function. +When looking for a module, +require calls each of these searchers in ascending order, +with the module name (the argument given to require) as its +sole parameter. +The function can return another function (the module loader) +plus an extra value that will be passed to that loader, +or a string explaining why it did not find that module +(or nil if it has nothing to say). + + +

+Lua initializes this table with four searcher functions. + + +

+The first searcher simply looks for a loader in the +package.preload table. + + +

+The second searcher looks for a loader as a Lua library, +using the path stored at package.path. +The search is done as described in function package.searchpath. + + +

+The third searcher looks for a loader as a C library, +using the path given by the variable package.cpath. +Again, +the search is done as described in function package.searchpath. +For instance, +if the C path is the string + +

+     "./?.so;./?.dll;/usr/local/?/init.so"
+

+the searcher for module foo +will try to open the files ./foo.so, ./foo.dll, +and /usr/local/foo/init.so, in that order. +Once it finds a C library, +this searcher first uses a dynamic link facility to link the +application with the library. +Then it tries to find a C function inside the library to +be used as the loader. +The name of this C function is the string "luaopen_" +concatenated with a copy of the module name where each dot +is replaced by an underscore. +Moreover, if the module name has a hyphen, +its suffix after (and including) the first hyphen is removed. +For instance, if the module name is a.b.c-v2.1, +the function name will be luaopen_a_b_c. + + +

+The fourth searcher tries an all-in-one loader. +It searches the C path for a library for +the root name of the given module. +For instance, when requiring a.b.c, +it will search for a C library for a. +If found, it looks into it for an open function for +the submodule; +in our example, that would be luaopen_a_b_c. +With this facility, a package can pack several C submodules +into one single library, +with each submodule keeping its original open function. + + +

+All searchers except the first one (preload) return as the extra value +the file name where the module was found, +as returned by package.searchpath. +The first searcher returns no extra value. + + + + +

+


package.searchpath (name, path [, sep [, rep]])

+ + +

+Searches for the given name in the given path. + + +

+A path is a string containing a sequence of +templates separated by semicolons. +For each template, +the function replaces each interrogation mark (if any) +in the template with a copy of name +wherein all occurrences of sep +(a dot, by default) +were replaced by rep +(the system's directory separator, by default), +and then tries to open the resulting file name. + + +

+For instance, if the path is the string + +

+     "./?.lua;./?.lc;/usr/local/?/init.lua"
+

+the search for the name foo.a +will try to open the files +./foo/a.lua, ./foo/a.lc, and +/usr/local/foo/a/init.lua, in that order. + + +

+Returns the resulting name of the first file that it can +open in read mode (after closing the file), +or nil plus an error message if none succeeds. +(This error message lists all file names it tried to open.) + + + + + + + +

6.4 – String Manipulation

+ +

+This library provides generic functions for string manipulation, +such as finding and extracting substrings, and pattern matching. +When indexing a string in Lua, the first character is at position 1 +(not at 0, as in C). +Indices are allowed to be negative and are interpreted as indexing backwards, +from the end of the string. +Thus, the last character is at position -1, and so on. + + +

+The string library provides all its functions inside the table +string. +It also sets a metatable for strings +where the __index field points to the string table. +Therefore, you can use the string functions in object-oriented style. +For instance, string.byte(s,i) +can be written as s:byte(i). + + +

+The string library assumes one-byte character encodings. + + +

+


string.byte (s [, i [, j]])

+Returns the internal numeric codes of the characters s[i], +s[i+1], ..., s[j]. +The default value for i is 1; +the default value for j is i. +These indices are corrected +following the same rules of function string.sub. + + +

+Numeric codes are not necessarily portable across platforms. + + + + +

+


string.char (···)

+Receives zero or more integers. +Returns a string with length equal to the number of arguments, +in which each character has the internal numeric code equal +to its corresponding argument. + + +

+Numeric codes are not necessarily portable across platforms. + + + + +

+


string.dump (function [, strip])

+ + +

+Returns a string containing a binary representation +(a binary chunk) +of the given function, +so that a later load on this string returns +a copy of the function (but with new upvalues). +If strip is a true value, +the binary representation may not include all debug information +about the function, +to save space. + + +

+Functions with upvalues have only their number of upvalues saved. +When (re)loaded, +those upvalues receive fresh instances containing nil. +(You can use the debug library to serialize +and reload the upvalues of a function +in a way adequate to your needs.) + + + + +

+


string.find (s, pattern [, init [, plain]])

+ + +

+Looks for the first match of +pattern (see §6.4.1) in the string s. +If it finds a match, then find returns the indices of s +where this occurrence starts and ends; +otherwise, it returns nil. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative. +A value of true as a fourth, optional argument plain +turns off the pattern matching facilities, +so the function does a plain "find substring" operation, +with no characters in pattern being considered magic. +Note that if plain is given, then init must be given as well. + + +

+If the pattern has captures, +then in a successful match +the captured values are also returned, +after the two indices. + + + + +

+


string.format (formatstring, ···)

+ + +

+Returns a formatted version of its variable number of arguments +following the description given in its first argument (which must be a string). +The format string follows the same rules as the ISO C function sprintf. +The only differences are that the options/modifiers +*, h, L, l, n, +and p are not supported +and that there is an extra option, q. + + +

+The q option formats a string between double quotes, +using escape sequences when necessary to ensure that +it can safely be read back by the Lua interpreter. +For instance, the call + +

+     string.format('%q', 'a string with "quotes" and \n new line')
+

+may produce the string: + +

+     "a string with \"quotes\" and \
+      new line"
+
+ +

+Options +A, a, E, e, f, +G, and g all expect a number as argument. +Options c, d, +i, o, u, X, and x +expect an integer. +When Lua is compiled with a C89 compiler, +options A and a (hexadecimal floats) +do not support any modifier (flags, width, length). + + +

+Option s expects a string; +if its argument is not a string, +it is converted to one following the same rules of tostring. +If the option has any modifier (flags, width, length), +the string argument should not contain embedded zeros. + + + + +

+


string.gmatch (s, pattern)

+Returns an iterator function that, +each time it is called, +returns the next captures from pattern (see §6.4.1) +over the string s. +If pattern specifies no captures, +then the whole match is produced in each call. + + +

+As an example, the following loop +will iterate over all the words from string s, +printing one per line: + +

+     s = "hello world from Lua"
+     for w in string.gmatch(s, "%a+") do
+       print(w)
+     end
+

+The next example collects all pairs key=value from the +given string into a table: + +

+     t = {}
+     s = "from=world, to=Lua"
+     for k, v in string.gmatch(s, "(%w+)=(%w+)") do
+       t[k] = v
+     end
+
+ +

+For this function, a caret '^' at the start of a pattern does not +work as an anchor, as this would prevent the iteration. + + + + +

+


string.gsub (s, pattern, repl [, n])

+Returns a copy of s +in which all (or the first n, if given) +occurrences of the pattern (see §6.4.1) have been +replaced by a replacement string specified by repl, +which can be a string, a table, or a function. +gsub also returns, as its second value, +the total number of matches that occurred. +The name gsub comes from Global SUBstitution. + + +

+If repl is a string, then its value is used for replacement. +The character % works as an escape character: +any sequence in repl of the form %d, +with d between 1 and 9, +stands for the value of the d-th captured substring. +The sequence %0 stands for the whole match. +The sequence %% stands for a single %. + + +

+If repl is a table, then the table is queried for every match, +using the first capture as the key. + + +

+If repl is a function, then this function is called every time a +match occurs, with all captured substrings passed as arguments, +in order. + + +

+In any case, +if the pattern specifies no captures, +then it behaves as if the whole pattern was inside a capture. + + +

+If the value returned by the table query or by the function call +is a string or a number, +then it is used as the replacement string; +otherwise, if it is false or nil, +then there is no replacement +(that is, the original match is kept in the string). + + +

+Here are some examples: + +

+     x = string.gsub("hello world", "(%w+)", "%1 %1")
+     --> x="hello hello world world"
+     
+     x = string.gsub("hello world", "%w+", "%0 %0", 1)
+     --> x="hello hello world"
+     
+     x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
+     --> x="world hello Lua from"
+     
+     x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
+     --> x="home = /home/roberto, user = roberto"
+     
+     x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
+           return load(s)()
+         end)
+     --> x="4+5 = 9"
+     
+     local t = {name="lua", version="5.3"}
+     x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
+     --> x="lua-5.3.tar.gz"
+
+ + + +

+


string.len (s)

+Receives a string and returns its length. +The empty string "" has length 0. +Embedded zeros are counted, +so "a\000bc\000" has length 5. + + + + +

+


string.lower (s)

+Receives a string and returns a copy of this string with all +uppercase letters changed to lowercase. +All other characters are left unchanged. +The definition of what an uppercase letter is depends on the current locale. + + + + +

+


string.match (s, pattern [, init])

+Looks for the first match of +pattern (see §6.4.1) in the string s. +If it finds one, then match returns +the captures from the pattern; +otherwise it returns nil. +If pattern specifies no captures, +then the whole match is returned. +A third, optional numeric argument init specifies +where to start the search; +its default value is 1 and can be negative. + + + + +

+


string.pack (fmt, v1, v2, ···)

+ + +

+Returns a binary string containing the values v1, v2, etc. +packed (that is, serialized in binary form) +according to the format string fmt (see §6.4.2). + + + + +

+


string.packsize (fmt)

+ + +

+Returns the size of a string resulting from string.pack +with the given format. +The format string cannot have the variable-length options +'s' or 'z' (see §6.4.2). + + + + +

+


string.rep (s, n [, sep])

+Returns a string that is the concatenation of n copies of +the string s separated by the string sep. +The default value for sep is the empty string +(that is, no separator). +Returns the empty string if n is not positive. + + +

+(Note that it is very easy to exhaust the memory of your machine +with a single call to this function.) + + + + +

+


string.reverse (s)

+Returns a string that is the string s reversed. + + + + +

+


string.sub (s, i [, j])

+Returns the substring of s that +starts at i and continues until j; +i and j can be negative. +If j is absent, then it is assumed to be equal to -1 +(which is the same as the string length). +In particular, +the call string.sub(s,1,j) returns a prefix of s +with length j, +and string.sub(s, -i) (for a positive i) +returns a suffix of s +with length i. + + +

+If, after the translation of negative indices, +i is less than 1, +it is corrected to 1. +If j is greater than the string length, +it is corrected to that length. +If, after these corrections, +i is greater than j, +the function returns the empty string. + + + + +

+


string.unpack (fmt, s [, pos])

+ + +

+Returns the values packed in string s (see string.pack) +according to the format string fmt (see §6.4.2). +An optional pos marks where +to start reading in s (default is 1). +After the read values, +this function also returns the index of the first unread byte in s. + + + + +

+


string.upper (s)

+Receives a string and returns a copy of this string with all +lowercase letters changed to uppercase. +All other characters are left unchanged. +The definition of what a lowercase letter is depends on the current locale. + + + + + +

6.4.1 – Patterns

+ +

+Patterns in Lua are described by regular strings, +which are interpreted as patterns by the pattern-matching functions +string.find, +string.gmatch, +string.gsub, +and string.match. +This section describes the syntax and the meaning +(that is, what they match) of these strings. + + + +

Character Class:

+A character class is used to represent a set of characters. +The following combinations are allowed in describing a character class: + +

    + +
  • x: +(where x is not one of the magic characters +^$()%.[]*+-?) +represents the character x itself. +
  • + +
  • .: (a dot) represents all characters.
  • + +
  • %a: represents all letters.
  • + +
  • %c: represents all control characters.
  • + +
  • %d: represents all digits.
  • + +
  • %g: represents all printable characters except space.
  • + +
  • %l: represents all lowercase letters.
  • + +
  • %p: represents all punctuation characters.
  • + +
  • %s: represents all space characters.
  • + +
  • %u: represents all uppercase letters.
  • + +
  • %w: represents all alphanumeric characters.
  • + +
  • %x: represents all hexadecimal digits.
  • + +
  • %x: (where x is any non-alphanumeric character) +represents the character x. +This is the standard way to escape the magic characters. +Any non-alphanumeric character +(including all punctuation characters, even the non-magical) +can be preceded by a '%' +when used to represent itself in a pattern. +
  • + +
  • [set]: +represents the class which is the union of all +characters in set. +A range of characters can be specified by +separating the end characters of the range, +in ascending order, with a '-'. +All classes %x described above can also be used as +components in set. +All other characters in set represent themselves. +For example, [%w_] (or [_%w]) +represents all alphanumeric characters plus the underscore, +[0-7] represents the octal digits, +and [0-7%l%-] represents the octal digits plus +the lowercase letters plus the '-' character. + + +

    +You can put a closing square bracket in a set +by positioning it as the first character in the set. +You can put a hyphen in a set +by positioning it as the first or the last character in the set. +(You can also use an escape for both cases.) + + +

    +The interaction between ranges and classes is not defined. +Therefore, patterns like [%a-z] or [a-%%] +have no meaning. +

  • + +
  • [^set]: +represents the complement of set, +where set is interpreted as above. +
  • + +

+For all classes represented by single letters (%a, %c, etc.), +the corresponding uppercase letter represents the complement of the class. +For instance, %S represents all non-space characters. + + +

+The definitions of letter, space, and other character groups +depend on the current locale. +In particular, the class [a-z] may not be equivalent to %l. + + + + + +

Pattern Item:

+A pattern item can be + +

    + +
  • +a single character class, +which matches any single character in the class; +
  • + +
  • +a single character class followed by '*', +which matches zero or more repetitions of characters in the class. +These repetition items will always match the longest possible sequence; +
  • + +
  • +a single character class followed by '+', +which matches one or more repetitions of characters in the class. +These repetition items will always match the longest possible sequence; +
  • + +
  • +a single character class followed by '-', +which also matches zero or more repetitions of characters in the class. +Unlike '*', +these repetition items will always match the shortest possible sequence; +
  • + +
  • +a single character class followed by '?', +which matches zero or one occurrence of a character in the class. +It always matches one occurrence if possible; +
  • + +
  • +%n, for n between 1 and 9; +such item matches a substring equal to the n-th captured string +(see below); +
  • + +
  • +%bxy, where x and y are two distinct characters; +such item matches strings that start with x, end with y, +and where the x and y are balanced. +This means that, if one reads the string from left to right, +counting +1 for an x and -1 for a y, +the ending y is the first y where the count reaches 0. +For instance, the item %b() matches expressions with +balanced parentheses. +
  • + +
  • +%f[set], a frontier pattern; +such item matches an empty string at any position such that +the next character belongs to set +and the previous character does not belong to set. +The set set is interpreted as previously described. +The beginning and the end of the subject are handled as if +they were the character '\0'. +
  • + +
+ + + + +

Pattern:

+A pattern is a sequence of pattern items. +A caret '^' at the beginning of a pattern anchors the match at the +beginning of the subject string. +A '$' at the end of a pattern anchors the match at the +end of the subject string. +At other positions, +'^' and '$' have no special meaning and represent themselves. + + + + + +

Captures:

+A pattern can contain sub-patterns enclosed in parentheses; +they describe captures. +When a match succeeds, the substrings of the subject string +that match captures are stored (captured) for future use. +Captures are numbered according to their left parentheses. +For instance, in the pattern "(a*(.)%w(%s*))", +the part of the string matching "a*(.)%w(%s*)" is +stored as the first capture (and therefore has number 1); +the character matching "." is captured with number 2, +and the part matching "%s*" has number 3. + + +

+As a special case, the empty capture () captures +the current string position (a number). +For instance, if we apply the pattern "()aa()" on the +string "flaaap", there will be two captures: 3 and 5. + + + + + + + +

6.4.2 – Format Strings for Pack and Unpack

+ +

+The first argument to string.pack, +string.packsize, and string.unpack +is a format string, +which describes the layout of the structure being created or read. + + +

+A format string is a sequence of conversion options. +The conversion options are as follows: + +

    +
  • <: sets little endian
  • +
  • >: sets big endian
  • +
  • =: sets native endian
  • +
  • ![n]: sets maximum alignment to n +(default is native alignment)
  • +
  • b: a signed byte (char)
  • +
  • B: an unsigned byte (char)
  • +
  • h: a signed short (native size)
  • +
  • H: an unsigned short (native size)
  • +
  • l: a signed long (native size)
  • +
  • L: an unsigned long (native size)
  • +
  • j: a lua_Integer
  • +
  • J: a lua_Unsigned
  • +
  • T: a size_t (native size)
  • +
  • i[n]: a signed int with n bytes +(default is native size)
  • +
  • I[n]: an unsigned int with n bytes +(default is native size)
  • +
  • f: a float (native size)
  • +
  • d: a double (native size)
  • +
  • n: a lua_Number
  • +
  • cn: a fixed-sized string with n bytes
  • +
  • z: a zero-terminated string
  • +
  • s[n]: a string preceded by its length +coded as an unsigned integer with n bytes +(default is a size_t)
  • +
  • x: one byte of padding
  • +
  • Xop: an empty item that aligns +according to option op +(which is otherwise ignored)
  • +
  • ' ': (empty space) ignored
  • +

+(A "[n]" means an optional integral numeral.) +Except for padding, spaces, and configurations +(options "xX <=>!"), +each option corresponds to an argument (in string.pack) +or a result (in string.unpack). + + +

+For options "!n", "sn", "in", and "In", +n can be any integer between 1 and 16. +All integral options check overflows; +string.pack checks whether the given value fits in the given size; +string.unpack checks whether the read value fits in a Lua integer. + + +

+Any format string starts as if prefixed by "!1=", +that is, +with maximum alignment of 1 (no alignment) +and native endianness. + + +

+Alignment works as follows: +For each option, +the format gets extra padding until the data starts +at an offset that is a multiple of the minimum between the +option size and the maximum alignment; +this minimum must be a power of 2. +Options "c" and "z" are not aligned; +option "s" follows the alignment of its starting integer. + + +

+All padding is filled with zeros by string.pack +(and ignored by string.unpack). + + + + + + + +

6.5 – UTF-8 Support

+ +

+This library provides basic support for UTF-8 encoding. +It provides all its functions inside the table utf8. +This library does not provide any support for Unicode other +than the handling of the encoding. +Any operation that needs the meaning of a character, +such as character classification, is outside its scope. + + +

+Unless stated otherwise, +all functions that expect a byte position as a parameter +assume that the given position is either the start of a byte sequence +or one plus the length of the subject string. +As in the string library, +negative indices count from the end of the string. + + +

+


utf8.char (···)

+Receives zero or more integers, +converts each one to its corresponding UTF-8 byte sequence +and returns a string with the concatenation of all these sequences. + + + + +

+


utf8.charpattern

+The pattern (a string, not a function) "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" +(see §6.4.1), +which matches exactly one UTF-8 byte sequence, +assuming that the subject is a valid UTF-8 string. + + + + +

+


utf8.codes (s)

+ + +

+Returns values so that the construction + +

+     for p, c in utf8.codes(s) do body end
+

+will iterate over all characters in string s, +with p being the position (in bytes) and c the code point +of each character. +It raises an error if it meets any invalid byte sequence. + + + + +

+


utf8.codepoint (s [, i [, j]])

+Returns the codepoints (as integers) from all characters in s +that start between byte position i and j (both included). +The default for i is 1 and for j is i. +It raises an error if it meets any invalid byte sequence. + + + + +

+


utf8.len (s [, i [, j]])

+Returns the number of UTF-8 characters in string s +that start between positions i and j (both inclusive). +The default for i is 1 and for j is -1. +If it finds any invalid byte sequence, +returns a false value plus the position of the first invalid byte. + + + + +

+


utf8.offset (s, n [, i])

+Returns the position (in bytes) where the encoding of the +n-th character of s +(counting from position i) starts. +A negative n gets characters before position i. +The default for i is 1 when n is non-negative +and #s + 1 otherwise, +so that utf8.offset(s, -n) gets the offset of the +n-th character from the end of the string. +If the specified character is neither in the subject +nor right after its end, +the function returns nil. + + +

+As a special case, +when n is 0 the function returns the start of the encoding +of the character that contains the i-th byte of s. + + +

+This function assumes that s is a valid UTF-8 string. + + + + + + + +

6.6 – Table Manipulation

+ +

+This library provides generic functions for table manipulation. +It provides all its functions inside the table table. + + +

+Remember that, whenever an operation needs the length of a table, +all caveats about the length operator apply (see §3.4.7). +All functions ignore non-numeric keys +in the tables given as arguments. + + +

+


table.concat (list [, sep [, i [, j]]])

+ + +

+Given a list where all elements are strings or numbers, +returns the string list[i]..sep..list[i+1] ··· sep..list[j]. +The default value for sep is the empty string, +the default for i is 1, +and the default for j is #list. +If i is greater than j, returns the empty string. + + + + +

+


table.insert (list, [pos,] value)

+ + +

+Inserts element value at position pos in list, +shifting up the elements +list[pos], list[pos+1], ···, list[#list]. +The default value for pos is #list+1, +so that a call table.insert(t,x) inserts x at the end +of list t. + + + + +

+


table.move (a1, f, e, t [,a2])

+ + +

+Moves elements from table a1 to table a2, +performing the equivalent to the following +multiple assignment: +a2[t],··· = a1[f],···,a1[e]. +The default for a2 is a1. +The destination range can overlap with the source range. +The number of elements to be moved must fit in a Lua integer. + + +

+Returns the destination table a2. + + + + +

+


table.pack (···)

+ + +

+Returns a new table with all arguments stored into keys 1, 2, etc. +and with a field "n" with the total number of arguments. +Note that the resulting table may not be a sequence. + + + + +

+


table.remove (list [, pos])

+ + +

+Removes from list the element at position pos, +returning the value of the removed element. +When pos is an integer between 1 and #list, +it shifts down the elements +list[pos+1], list[pos+2], ···, list[#list] +and erases element list[#list]; +The index pos can also be 0 when #list is 0, +or #list + 1; +in those cases, the function erases the element list[pos]. + + +

+The default value for pos is #list, +so that a call table.remove(l) removes the last element +of list l. + + + + +

+


table.sort (list [, comp])

+ + +

+Sorts list elements in a given order, in-place, +from list[1] to list[#list]. +If comp is given, +then it must be a function that receives two list elements +and returns true when the first element must come +before the second in the final order +(so that, after the sort, +i < j implies not comp(list[j],list[i])). +If comp is not given, +then the standard Lua operator < is used instead. + + +

+Note that the comp function must define +a strict partial order over the elements in the list; +that is, it must be asymmetric and transitive. +Otherwise, no valid sort may be possible. + + +

+The sort algorithm is not stable: +elements considered equal by the given order +may have their relative positions changed by the sort. + + + + +

+


table.unpack (list [, i [, j]])

+ + +

+Returns the elements from the given list. +This function is equivalent to + +

+     return list[i], list[i+1], ···, list[j]
+

+By default, i is 1 and j is #list. + + + + + + + +

6.7 – Mathematical Functions

+ +

+This library provides basic mathematical functions. +It provides all its functions and constants inside the table math. +Functions with the annotation "integer/float" give +integer results for integer arguments +and float results for float (or mixed) arguments. +Rounding functions +(math.ceil, math.floor, and math.modf) +return an integer when the result fits in the range of an integer, +or a float otherwise. + + +

+


math.abs (x)

+ + +

+Returns the absolute value of x. (integer/float) + + + + +

+


math.acos (x)

+ + +

+Returns the arc cosine of x (in radians). + + + + +

+


math.asin (x)

+ + +

+Returns the arc sine of x (in radians). + + + + +

+


math.atan (y [, x])

+ + +

+ +Returns the arc tangent of y/x (in radians), +but uses the signs of both arguments to find the +quadrant of the result. +(It also handles correctly the case of x being zero.) + + +

+The default value for x is 1, +so that the call math.atan(y) +returns the arc tangent of y. + + + + +

+


math.ceil (x)

+ + +

+Returns the smallest integral value larger than or equal to x. + + + + +

+


math.cos (x)

+ + +

+Returns the cosine of x (assumed to be in radians). + + + + +

+


math.deg (x)

+ + +

+Converts the angle x from radians to degrees. + + + + +

+


math.exp (x)

+ + +

+Returns the value ex +(where e is the base of natural logarithms). + + + + +

+


math.floor (x)

+ + +

+Returns the largest integral value smaller than or equal to x. + + + + +

+


math.fmod (x, y)

+ + +

+Returns the remainder of the division of x by y +that rounds the quotient towards zero. (integer/float) + + + + +

+


math.huge

+ + +

+The float value HUGE_VAL, +a value larger than any other numeric value. + + + + +

+


math.log (x [, base])

+ + +

+Returns the logarithm of x in the given base. +The default for base is e +(so that the function returns the natural logarithm of x). + + + + +

+


math.max (x, ···)

+ + +

+Returns the argument with the maximum value, +according to the Lua operator <. (integer/float) + + + + +

+


math.maxinteger

+An integer with the maximum value for an integer. + + + + +

+


math.min (x, ···)

+ + +

+Returns the argument with the minimum value, +according to the Lua operator <. (integer/float) + + + + +

+


math.mininteger

+An integer with the minimum value for an integer. + + + + +

+


math.modf (x)

+ + +

+Returns the integral part of x and the fractional part of x. +Its second result is always a float. + + + + +

+


math.pi

+ + +

+The value of π. + + + + +

+


math.rad (x)

+ + +

+Converts the angle x from degrees to radians. + + + + +

+


math.random ([m [, n]])

+ + +

+When called without arguments, +returns a pseudo-random float with uniform distribution +in the range [0,1). +When called with two integers m and n, +math.random returns a pseudo-random integer +with uniform distribution in the range [m, n]. +(The value n-m cannot be negative and must fit in a Lua integer.) +The call math.random(n) is equivalent to math.random(1,n). + + +

+This function is an interface to the underling +pseudo-random generator function provided by C. + + + + +

+


math.randomseed (x)

+ + +

+Sets x as the "seed" +for the pseudo-random generator: +equal seeds produce equal sequences of numbers. + + + + +

+


math.sin (x)

+ + +

+Returns the sine of x (assumed to be in radians). + + + + +

+


math.sqrt (x)

+ + +

+Returns the square root of x. +(You can also use the expression x^0.5 to compute this value.) + + + + +

+


math.tan (x)

+ + +

+Returns the tangent of x (assumed to be in radians). + + + + +

+


math.tointeger (x)

+ + +

+If the value x is convertible to an integer, +returns that integer. +Otherwise, returns nil. + + + + +

+


math.type (x)

+ + +

+Returns "integer" if x is an integer, +"float" if it is a float, +or nil if x is not a number. + + + + +

+


math.ult (m, n)

+ + +

+Returns a boolean, +true if and only if integer m is below integer n when +they are compared as unsigned integers. + + + + + + + +

6.8 – Input and Output Facilities

+ +

+The I/O library provides two different styles for file manipulation. +The first one uses implicit file handles; +that is, there are operations to set a default input file and a +default output file, +and all input/output operations are over these default files. +The second style uses explicit file handles. + + +

+When using implicit file handles, +all operations are supplied by table io. +When using explicit file handles, +the operation io.open returns a file handle +and then all operations are supplied as methods of the file handle. + + +

+The table io also provides +three predefined file handles with their usual meanings from C: +io.stdin, io.stdout, and io.stderr. +The I/O library never closes these files. + + +

+Unless otherwise stated, +all I/O functions return nil on failure +(plus an error message as a second result and +a system-dependent error code as a third result) +and some value different from nil on success. +In non-POSIX systems, +the computation of the error message and error code +in case of errors +may be not thread safe, +because they rely on the global C variable errno. + + +

+


io.close ([file])

+ + +

+Equivalent to file:close(). +Without a file, closes the default output file. + + + + +

+


io.flush ()

+ + +

+Equivalent to io.output():flush(). + + + + +

+


io.input ([file])

+ + +

+When called with a file name, it opens the named file (in text mode), +and sets its handle as the default input file. +When called with a file handle, +it simply sets this file handle as the default input file. +When called without arguments, +it returns the current default input file. + + +

+In case of errors this function raises the error, +instead of returning an error code. + + + + +

+


io.lines ([filename, ···])

+ + +

+Opens the given file name in read mode +and returns an iterator function that +works like file:lines(···) over the opened file. +When the iterator function detects the end of file, +it returns no values (to finish the loop) and automatically closes the file. + + +

+The call io.lines() (with no file name) is equivalent +to io.input():lines("*l"); +that is, it iterates over the lines of the default input file. +In this case, the iterator does not close the file when the loop ends. + + +

+In case of errors this function raises the error, +instead of returning an error code. + + + + +

+


io.open (filename [, mode])

+ + +

+This function opens a file, +in the mode specified in the string mode. +In case of success, +it returns a new file handle. + + +

+The mode string can be any of the following: + +

    +
  • "r": read mode (the default);
  • +
  • "w": write mode;
  • +
  • "a": append mode;
  • +
  • "r+": update mode, all previous data is preserved;
  • +
  • "w+": update mode, all previous data is erased;
  • +
  • "a+": append update mode, previous data is preserved, + writing is only allowed at the end of file.
  • +

+The mode string can also have a 'b' at the end, +which is needed in some systems to open the file in binary mode. + + + + +

+


io.output ([file])

+ + +

+Similar to io.input, but operates over the default output file. + + + + +

+


io.popen (prog [, mode])

+ + +

+This function is system dependent and is not available +on all platforms. + + +

+Starts program prog in a separated process and returns +a file handle that you can use to read data from this program +(if mode is "r", the default) +or to write data to this program +(if mode is "w"). + + + + +

+


io.read (···)

+ + +

+Equivalent to io.input():read(···). + + + + +

+


io.tmpfile ()

+ + +

+In case of success, +returns a handle for a temporary file. +This file is opened in update mode +and it is automatically removed when the program ends. + + + + +

+


io.type (obj)

+ + +

+Checks whether obj is a valid file handle. +Returns the string "file" if obj is an open file handle, +"closed file" if obj is a closed file handle, +or nil if obj is not a file handle. + + + + +

+


io.write (···)

+ + +

+Equivalent to io.output():write(···). + + + + +

+


file:close ()

+ + +

+Closes file. +Note that files are automatically closed when +their handles are garbage collected, +but that takes an unpredictable amount of time to happen. + + +

+When closing a file handle created with io.popen, +file:close returns the same values +returned by os.execute. + + + + +

+


file:flush ()

+ + +

+Saves any written data to file. + + + + +

+


file:lines (···)

+ + +

+Returns an iterator function that, +each time it is called, +reads the file according to the given formats. +When no format is given, +uses "l" as a default. +As an example, the construction + +

+     for c in file:lines(1) do body end
+

+will iterate over all characters of the file, +starting at the current position. +Unlike io.lines, this function does not close the file +when the loop ends. + + +

+In case of errors this function raises the error, +instead of returning an error code. + + + + +

+


file:read (···)

+ + +

+Reads the file file, +according to the given formats, which specify what to read. +For each format, +the function returns a string or a number with the characters read, +or nil if it cannot read data with the specified format. +(In this latter case, +the function does not read subsequent formats.) +When called without formats, +it uses a default format that reads the next line +(see below). + + +

+The available formats are + +

    + +
  • "n": +reads a numeral and returns it as a float or an integer, +following the lexical conventions of Lua. +(The numeral may have leading spaces and a sign.) +This format always reads the longest input sequence that +is a valid prefix for a numeral; +if that prefix does not form a valid numeral +(e.g., an empty string, "0x", or "3.4e-"), +it is discarded and the function returns nil. +
  • + +
  • "a": +reads the whole file, starting at the current position. +On end of file, it returns the empty string. +
  • + +
  • "l": +reads the next line skipping the end of line, +returning nil on end of file. +This is the default format. +
  • + +
  • "L": +reads the next line keeping the end-of-line character (if present), +returning nil on end of file. +
  • + +
  • number: +reads a string with up to this number of bytes, +returning nil on end of file. +If number is zero, +it reads nothing and returns an empty string, +or nil on end of file. +
  • + +

+The formats "l" and "L" should be used only for text files. + + + + +

+


file:seek ([whence [, offset]])

+ + +

+Sets and gets the file position, +measured from the beginning of the file, +to the position given by offset plus a base +specified by the string whence, as follows: + +

    +
  • "set": base is position 0 (beginning of the file);
  • +
  • "cur": base is current position;
  • +
  • "end": base is end of file;
  • +

+In case of success, seek returns the final file position, +measured in bytes from the beginning of the file. +If seek fails, it returns nil, +plus a string describing the error. + + +

+The default value for whence is "cur", +and for offset is 0. +Therefore, the call file:seek() returns the current +file position, without changing it; +the call file:seek("set") sets the position to the +beginning of the file (and returns 0); +and the call file:seek("end") sets the position to the +end of the file, and returns its size. + + + + +

+


file:setvbuf (mode [, size])

+ + +

+Sets the buffering mode for an output file. +There are three available modes: + +

    + +
  • "no": +no buffering; the result of any output operation appears immediately. +
  • + +
  • "full": +full buffering; output operation is performed only +when the buffer is full or when +you explicitly flush the file (see io.flush). +
  • + +
  • "line": +line buffering; output is buffered until a newline is output +or there is any input from some special files +(such as a terminal device). +
  • + +

+For the last two cases, size +specifies the size of the buffer, in bytes. +The default is an appropriate size. + + + + +

+


file:write (···)

+ + +

+Writes the value of each of its arguments to file. +The arguments must be strings or numbers. + + +

+In case of success, this function returns file. +Otherwise it returns nil plus a string describing the error. + + + + + + + +

6.9 – Operating System Facilities

+ +

+This library is implemented through table os. + + +

+


os.clock ()

+ + +

+Returns an approximation of the amount in seconds of CPU time +used by the program. + + + + +

+


os.date ([format [, time]])

+ + +

+Returns a string or a table containing date and time, +formatted according to the given string format. + + +

+If the time argument is present, +this is the time to be formatted +(see the os.time function for a description of this value). +Otherwise, date formats the current time. + + +

+If format starts with '!', +then the date is formatted in Coordinated Universal Time. +After this optional character, +if format is the string "*t", +then date returns a table with the following fields: +year, month (1–12), day (1–31), +hour (0–23), min (0–59), sec (0–61), +wday (weekday, 1–7, Sunday is 1), +yday (day of the year, 1–366), +and isdst (daylight saving flag, a boolean). +This last field may be absent +if the information is not available. + + +

+If format is not "*t", +then date returns the date as a string, +formatted according to the same rules as the ISO C function strftime. + + +

+When called without arguments, +date returns a reasonable date and time representation that depends on +the host system and on the current locale. +(More specifically, os.date() is equivalent to os.date("%c").) + + +

+In non-POSIX systems, +this function may be not thread safe +because of its reliance on C function gmtime and C function localtime. + + + + +

+


os.difftime (t2, t1)

+ + +

+Returns the difference, in seconds, +from time t1 to time t2 +(where the times are values returned by os.time). +In POSIX, Windows, and some other systems, +this value is exactly t2-t1. + + + + +

+


os.execute ([command])

+ + +

+This function is equivalent to the ISO C function system. +It passes command to be executed by an operating system shell. +Its first result is true +if the command terminated successfully, +or nil otherwise. +After this first result +the function returns a string plus a number, +as follows: + +

    + +
  • "exit": +the command terminated normally; +the following number is the exit status of the command. +
  • + +
  • "signal": +the command was terminated by a signal; +the following number is the signal that terminated the command. +
  • + +
+ +

+When called without a command, +os.execute returns a boolean that is true if a shell is available. + + + + +

+


os.exit ([code [, close]])

+ + +

+Calls the ISO C function exit to terminate the host program. +If code is true, +the returned status is EXIT_SUCCESS; +if code is false, +the returned status is EXIT_FAILURE; +if code is a number, +the returned status is this number. +The default value for code is true. + + +

+If the optional second argument close is true, +closes the Lua state before exiting. + + + + +

+


os.getenv (varname)

+ + +

+Returns the value of the process environment variable varname, +or nil if the variable is not defined. + + + + +

+


os.remove (filename)

+ + +

+Deletes the file (or empty directory, on POSIX systems) +with the given name. +If this function fails, it returns nil, +plus a string describing the error and the error code. +Otherwise, it returns true. + + + + +

+


os.rename (oldname, newname)

+ + +

+Renames the file or directory named oldname to newname. +If this function fails, it returns nil, +plus a string describing the error and the error code. +Otherwise, it returns true. + + + + +

+


os.setlocale (locale [, category])

+ + +

+Sets the current locale of the program. +locale is a system-dependent string specifying a locale; +category is an optional string describing which category to change: +"all", "collate", "ctype", +"monetary", "numeric", or "time"; +the default category is "all". +The function returns the name of the new locale, +or nil if the request cannot be honored. + + +

+If locale is the empty string, +the current locale is set to an implementation-defined native locale. +If locale is the string "C", +the current locale is set to the standard C locale. + + +

+When called with nil as the first argument, +this function only returns the name of the current locale +for the given category. + + +

+This function may be not thread safe +because of its reliance on C function setlocale. + + + + +

+


os.time ([table])

+ + +

+Returns the current time when called without arguments, +or a time representing the local date and time specified by the given table. +This table must have fields year, month, and day, +and may have fields +hour (default is 12), +min (default is 0), +sec (default is 0), +and isdst (default is nil). +Other fields are ignored. +For a description of these fields, see the os.date function. + + +

+The values in these fields do not need to be inside their valid ranges. +For instance, if sec is -10, +it means -10 seconds from the time specified by the other fields; +if hour is 1000, +it means +1000 hours from the time specified by the other fields. + + +

+The returned value is a number, whose meaning depends on your system. +In POSIX, Windows, and some other systems, +this number counts the number +of seconds since some given start time (the "epoch"). +In other systems, the meaning is not specified, +and the number returned by time can be used only as an argument to +os.date and os.difftime. + + + + +

+


os.tmpname ()

+ + +

+Returns a string with a file name that can +be used for a temporary file. +The file must be explicitly opened before its use +and explicitly removed when no longer needed. + + +

+In POSIX systems, +this function also creates a file with that name, +to avoid security risks. +(Someone else might create the file with wrong permissions +in the time between getting the name and creating the file.) +You still have to open the file to use it +and to remove it (even if you do not use it). + + +

+When possible, +you may prefer to use io.tmpfile, +which automatically removes the file when the program ends. + + + + + + + +

6.10 – The Debug Library

+ +

+This library provides +the functionality of the debug interface (§4.9) to Lua programs. +You should exert care when using this library. +Several of its functions +violate basic assumptions about Lua code +(e.g., that variables local to a function +cannot be accessed from outside; +that userdata metatables cannot be changed by Lua code; +that Lua programs do not crash) +and therefore can compromise otherwise secure code. +Moreover, some functions in this library may be slow. + + +

+All functions in this library are provided +inside the debug table. +All functions that operate over a thread +have an optional first argument which is the +thread to operate over. +The default is always the current thread. + + +

+


debug.debug ()

+ + +

+Enters an interactive mode with the user, +running each string that the user enters. +Using simple commands and other debug facilities, +the user can inspect global and local variables, +change their values, evaluate expressions, and so on. +A line containing only the word cont finishes this function, +so that the caller continues its execution. + + +

+Note that commands for debug.debug are not lexically nested +within any function and so have no direct access to local variables. + + + + +

+


debug.gethook ([thread])

+ + +

+Returns the current hook settings of the thread, as three values: +the current hook function, the current hook mask, +and the current hook count +(as set by the debug.sethook function). + + + + +

+


debug.getinfo ([thread,] f [, what])

+ + +

+Returns a table with information about a function. +You can give the function directly +or you can give a number as the value of f, +which means the function running at level f of the call stack +of the given thread: +level 0 is the current function (getinfo itself); +level 1 is the function that called getinfo +(except for tail calls, which do not count on the stack); +and so on. +If f is a number larger than the number of active functions, +then getinfo returns nil. + + +

+The returned table can contain all the fields returned by lua_getinfo, +with the string what describing which fields to fill in. +The default for what is to get all information available, +except the table of valid lines. +If present, +the option 'f' +adds a field named func with the function itself. +If present, +the option 'L' +adds a field named activelines with the table of +valid lines. + + +

+For instance, the expression debug.getinfo(1,"n").name returns +a name for the current function, +if a reasonable name can be found, +and the expression debug.getinfo(print) +returns a table with all available information +about the print function. + + + + +

+


debug.getlocal ([thread,] f, local)

+ + +

+This function returns the name and the value of the local variable +with index local of the function at level f of the stack. +This function accesses not only explicit local variables, +but also parameters, temporaries, etc. + + +

+The first parameter or local variable has index 1, and so on, +following the order that they are declared in the code, +counting only the variables that are active +in the current scope of the function. +Negative indices refer to vararg arguments; +-1 is the first vararg argument. +The function returns nil if there is no variable with the given index, +and raises an error when called with a level out of range. +(You can call debug.getinfo to check whether the level is valid.) + + +

+Variable names starting with '(' (open parenthesis) +represent variables with no known names +(internal variables such as loop control variables, +and variables from chunks saved without debug information). + + +

+The parameter f may also be a function. +In that case, getlocal returns only the name of function parameters. + + + + +

+


debug.getmetatable (value)

+ + +

+Returns the metatable of the given value +or nil if it does not have a metatable. + + + + +

+


debug.getregistry ()

+ + +

+Returns the registry table (see §4.5). + + + + +

+


debug.getupvalue (f, up)

+ + +

+This function returns the name and the value of the upvalue +with index up of the function f. +The function returns nil if there is no upvalue with the given index. + + +

+Variable names starting with '(' (open parenthesis) +represent variables with no known names +(variables from chunks saved without debug information). + + + + +

+


debug.getuservalue (u)

+ + +

+Returns the Lua value associated to u. +If u is not a full userdata, +returns nil. + + + + +

+


debug.sethook ([thread,] hook, mask [, count])

+ + +

+Sets the given function as a hook. +The string mask and the number count describe +when the hook will be called. +The string mask may have any combination of the following characters, +with the given meaning: + +

    +
  • 'c': the hook is called every time Lua calls a function;
  • +
  • 'r': the hook is called every time Lua returns from a function;
  • +
  • 'l': the hook is called every time Lua enters a new line of code.
  • +

+Moreover, +with a count different from zero, +the hook is called also after every count instructions. + + +

+When called without arguments, +debug.sethook turns off the hook. + + +

+When the hook is called, its first argument is a string +describing the event that has triggered its call: +"call" (or "tail call"), +"return", +"line", and "count". +For line events, +the hook also gets the new line number as its second parameter. +Inside a hook, +you can call getinfo with level 2 to get more information about +the running function +(level 0 is the getinfo function, +and level 1 is the hook function). + + + + +

+


debug.setlocal ([thread,] level, local, value)

+ + +

+This function assigns the value value to the local variable +with index local of the function at level level of the stack. +The function returns nil if there is no local +variable with the given index, +and raises an error when called with a level out of range. +(You can call getinfo to check whether the level is valid.) +Otherwise, it returns the name of the local variable. + + +

+See debug.getlocal for more information about +variable indices and names. + + + + +

+


debug.setmetatable (value, table)

+ + +

+Sets the metatable for the given value to the given table +(which can be nil). +Returns value. + + + + +

+


debug.setupvalue (f, up, value)

+ + +

+This function assigns the value value to the upvalue +with index up of the function f. +The function returns nil if there is no upvalue +with the given index. +Otherwise, it returns the name of the upvalue. + + + + +

+


debug.setuservalue (udata, value)

+ + +

+Sets the given value as +the Lua value associated to the given udata. +udata must be a full userdata. + + +

+Returns udata. + + + + +

+


debug.traceback ([thread,] [message [, level]])

+ + +

+If message is present but is neither a string nor nil, +this function returns message without further processing. +Otherwise, +it returns a string with a traceback of the call stack. +The optional message string is appended +at the beginning of the traceback. +An optional level number tells at which level +to start the traceback +(default is 1, the function calling traceback). + + + + +

+


debug.upvalueid (f, n)

+ + +

+Returns a unique identifier (as a light userdata) +for the upvalue numbered n +from the given function. + + +

+These unique identifiers allow a program to check whether different +closures share upvalues. +Lua closures that share an upvalue +(that is, that access a same external local variable) +will return identical ids for those upvalue indices. + + + + +

+


debug.upvaluejoin (f1, n1, f2, n2)

+ + +

+Make the n1-th upvalue of the Lua closure f1 +refer to the n2-th upvalue of the Lua closure f2. + + + + + + + +

7 – Lua Standalone

+ +

+Although Lua has been designed as an extension language, +to be embedded in a host C program, +it is also frequently used as a standalone language. +An interpreter for Lua as a standalone language, +called simply lua, +is provided with the standard distribution. +The standalone interpreter includes +all standard libraries, including the debug library. +Its usage is: + +

+     lua [options] [script [args]]
+

+The options are: + +

    +
  • -e stat: executes string stat;
  • +
  • -l mod: "requires" mod and assigns the + result to global @mod;
  • +
  • -i: enters interactive mode after running script;
  • +
  • -v: prints version information;
  • +
  • -E: ignores environment variables;
  • +
  • --: stops handling options;
  • +
  • -: executes stdin as a file and stops handling options.
  • +

+After handling its options, lua runs the given script. +When called without arguments, +lua behaves as lua -v -i +when the standard input (stdin) is a terminal, +and as lua - otherwise. + + +

+When called without option -E, +the interpreter checks for an environment variable LUA_INIT_5_3 +(or LUA_INIT if the versioned name is not defined) +before running any argument. +If the variable content has the format @filename, +then lua executes the file. +Otherwise, lua executes the string itself. + + +

+When called with option -E, +besides ignoring LUA_INIT, +Lua also ignores +the values of LUA_PATH and LUA_CPATH, +setting the values of +package.path and package.cpath +with the default paths defined in luaconf.h. + + +

+All options are handled in order, except -i and -E. +For instance, an invocation like + +

+     $ lua -e'a=1' -e 'print(a)' script.lua
+

+will first set a to 1, then print the value of a, +and finally run the file script.lua with no arguments. +(Here $ is the shell prompt. Your prompt may be different.) + + +

+Before running any code, +lua collects all command-line arguments +in a global table called arg. +The script name goes to index 0, +the first argument after the script name goes to index 1, +and so on. +Any arguments before the script name +(that is, the interpreter name plus its options) +go to negative indices. +For instance, in the call + +

+     $ lua -la b.lua t1 t2
+

+the table is like this: + +

+     arg = { [-2] = "lua", [-1] = "-la",
+             [0] = "b.lua",
+             [1] = "t1", [2] = "t2" }
+

+If there is no script in the call, +the interpreter name goes to index 0, +followed by the other arguments. +For instance, the call + +

+     $ lua -e "print(arg[1])"
+

+will print "-e". +If there is a script, +the script is called with arguments +arg[1], ···, arg[#arg]. +(Like all chunks in Lua, +the script is compiled as a vararg function.) + + +

+In interactive mode, +Lua repeatedly prompts and waits for a line. +After reading a line, +Lua first try to interpret the line as an expression. +If it succeeds, it prints its value. +Otherwise, it interprets the line as a statement. +If you write an incomplete statement, +the interpreter waits for its completion +by issuing a different prompt. + + +

+If the global variable _PROMPT contains a string, +then its value is used as the prompt. +Similarly, if the global variable _PROMPT2 contains a string, +its value is used as the secondary prompt +(issued during incomplete statements). + + +

+In case of unprotected errors in the script, +the interpreter reports the error to the standard error stream. +If the error object is not a string but +has a metamethod __tostring, +the interpreter calls this metamethod to produce the final message. +Otherwise, the interpreter converts the error object to a string +and adds a stack traceback to it. + + +

+When finishing normally, +the interpreter closes its main Lua state +(see lua_close). +The script can avoid this step by +calling os.exit to terminate. + + +

+To allow the use of Lua as a +script interpreter in Unix systems, +the standalone interpreter skips +the first line of a chunk if it starts with #. +Therefore, Lua scripts can be made into executable programs +by using chmod +x and the #! form, +as in + +

+     #!/usr/local/bin/lua
+

+(Of course, +the location of the Lua interpreter may be different in your machine. +If lua is in your PATH, +then + +

+     #!/usr/bin/env lua
+

+is a more portable solution.) + + + +

8 – Incompatibilities with the Previous Version

+ +

+Here we list the incompatibilities that you may find when moving a program +from Lua 5.2 to Lua 5.3. +You can avoid some incompatibilities by compiling Lua with +appropriate options (see file luaconf.h). +However, +all these compatibility options will be removed in the future. + + +

+Lua versions can always change the C API in ways that +do not imply source-code changes in a program, +such as the numeric values for constants +or the implementation of functions as macros. +Therefore, +you should not assume that binaries are compatible between +different Lua versions. +Always recompile clients of the Lua API when +using a new version. + + +

+Similarly, Lua versions can always change the internal representation +of precompiled chunks; +precompiled chunks are not compatible between different Lua versions. + + +

+The standard paths in the official distribution may +change between versions. + + + +

8.1 – Changes in the Language

+
    + +
  • +The main difference between Lua 5.2 and Lua 5.3 is the +introduction of an integer subtype for numbers. +Although this change should not affect "normal" computations, +some computations +(mainly those that involve some kind of overflow) +can give different results. + + +

    +You can fix these differences by forcing a number to be a float +(in Lua 5.2 all numbers were float), +in particular writing constants with an ending .0 +or using x = x + 0.0 to convert a variable. +(This recommendation is only for a quick fix +for an occasional incompatibility; +it is not a general guideline for good programming. +For good programming, +use floats where you need floats +and integers where you need integers.) +

  • + +
  • +The conversion of a float to a string now adds a .0 suffix +to the result if it looks like an integer. +(For instance, the float 2.0 will be printed as 2.0, +not as 2.) +You should always use an explicit format +when you need a specific format for numbers. + + +

    +(Formally this is not an incompatibility, +because Lua does not specify how numbers are formatted as strings, +but some programs assumed a specific format.) +

  • + +
  • +The generational mode for the garbage collector was removed. +(It was an experimental feature in Lua 5.2.) +
  • + +
+ + + + +

8.2 – Changes in the Libraries

+
    + +
  • +The bit32 library has been deprecated. +It is easy to require a compatible external library or, +better yet, to replace its functions with appropriate bitwise operations. +(Keep in mind that bit32 operates on 32-bit integers, +while the bitwise operators in Lua 5.3 operate on Lua integers, +which by default have 64 bits.) +
  • + +
  • +The Table library now respects metamethods +for setting and getting elements. +
  • + +
  • +The ipairs iterator now respects metamethods and +its __ipairs metamethod has been deprecated. +
  • + +
  • +Option names in io.read do not have a starting '*' anymore. +For compatibility, Lua will continue to accept (and ignore) this character. +
  • + +
  • +The following functions were deprecated in the mathematical library: +atan2, cosh, sinh, tanh, pow, +frexp, and ldexp. +You can replace math.pow(x,y) with x^y; +you can replace math.atan2 with math.atan, +which now accepts one or two arguments; +you can replace math.ldexp(x,exp) with x * 2.0^exp. +For the other operations, +you can either use an external library or +implement them in Lua. +
  • + +
  • +The searcher for C loaders used by require +changed the way it handles versioned names. +Now, the version should come after the module name +(as is usual in most other tools). +For compatibility, that searcher still tries the old format +if it cannot find an open function according to the new style. +(Lua 5.2 already worked that way, +but it did not document the change.) +
  • + +
  • +The call collectgarbage("count") now returns only one result. +(You can compute that second result from the fractional part +of the first result.) +
  • + +
+ + + + +

8.3 – Changes in the API

+ + +
    + +
  • +Continuation functions now receive as arguments what they needed +to get through lua_getctx, +so lua_getctx has been removed. +Adapt your code accordingly. +
  • + +
  • +Function lua_dump has an extra parameter, strip. +Use 0 as the value of this parameter to get the old behavior. +
  • + +
  • +Functions to inject/project unsigned integers +(lua_pushunsigned, lua_tounsigned, lua_tounsignedx, +luaL_checkunsigned, luaL_optunsigned) +were deprecated. +Use their signed equivalents with a type cast. +
  • + +
  • +Macros to project non-default integer types +(luaL_checkint, luaL_optint, luaL_checklong, luaL_optlong) +were deprecated. +Use their equivalent over lua_Integer with a type cast +(or, when possible, use lua_Integer in your code). +
  • + +
+ + + + +

9 – The Complete Syntax of Lua

+ +

+Here is the complete syntax of Lua in extended BNF. +As usual in extended BNF, +{A} means 0 or more As, +and [A] means an optional A. +(For operator precedences, see §3.4.8; +for a description of the terminals +Name, Numeral, +and LiteralString, see §3.1.) + + + + +

+
+	chunk ::= block
+
+	block ::= {stat} [retstat]
+
+	stat ::=  ‘;’ | 
+		 varlist ‘=’ explist | 
+		 functioncall | 
+		 label | 
+		 break | 
+		 goto Name | 
+		 do block end | 
+		 while exp do block end | 
+		 repeat block until exp | 
+		 if exp then block {elseif exp then block} [else block] end | 
+		 for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 
+		 for namelist in explist do block end | 
+		 function funcname funcbody | 
+		 local function Name funcbody | 
+		 local namelist [‘=’ explist] 
+
+	retstat ::= return [explist] [‘;’]
+
+	label ::= ‘::’ Name ‘::’
+
+	funcname ::= Name {‘.’ Name} [‘:’ Name]
+
+	varlist ::= var {‘,’ var}
+
+	var ::=  Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name 
+
+	namelist ::= Name {‘,’ Name}
+
+	explist ::= exp {‘,’ exp}
+
+	exp ::=  nil | false | true | Numeral | LiteralString | ‘...’ | functiondef | 
+		 prefixexp | tableconstructor | exp binop exp | unop exp 
+
+	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
+
+	functioncall ::=  prefixexp args | prefixexp ‘:’ Name args 
+
+	args ::=  ‘(’ [explist] ‘)’ | tableconstructor | LiteralString 
+
+	functiondef ::= function funcbody
+
+	funcbody ::= ‘(’ [parlist] ‘)’ block end
+
+	parlist ::= namelist [‘,’ ‘...’] | ‘...’
+
+	tableconstructor ::= ‘{’ [fieldlist] ‘}’
+
+	fieldlist ::= field {fieldsep field} [fieldsep]
+
+	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
+
+	fieldsep ::= ‘,’ | ‘;’
+
+	binop ::=  ‘+’ | ‘-’ | ‘*’ | ‘/’ | ‘//’ | ‘^’ | ‘%’ | 
+		 ‘&’ | ‘~’ | ‘|’ | ‘>>’ | ‘<<’ | ‘..’ | 
+		 ‘<’ | ‘<=’ | ‘>’ | ‘>=’ | ‘==’ | ‘~=’ | 
+		 and | or
+
+	unop ::= ‘-’ | not | ‘#’ | ‘~’
+
+
+ +

+ + + + + + + + +

+ + + + diff --git a/deps/lua/doc/osi-certified-72x60.png b/deps/lua/doc/osi-certified-72x60.png new file mode 100644 index 0000000000000000000000000000000000000000..07df5f6ee7a7a8b2108025dcd815f73f145a83af GIT binary patch literal 3774 zcmV;v4ngsWP)$kl5 zqcT7g&?zu8?ezWYz4zUB-|zR9d+&Qy2xAN{qY(ew0A7^*gV^7jytKqPFV3{hZfovn zs%x!l>(m&Gdb8C+5XeR7>h0kj=o=X3A39;2KLYfEMt>p1YMW~dt`rpAC{lN~P>5pq zH1L4nAdCT17}*hN=LnEsvMl=5Ij^QArAa&_V~zoht-Ei~)E~(Ivhe0#jik{t$isEK znCH$TxCB8EKmcF>3@pRaHpbR%Gqm*dsZA4H{j(NjZFp^iNFW+RBx6R*X19J*`0XG5 z^Y>cR=^Hi9#ovYGlbFSr#Q*^PgCGC^gb*SC5TcBfzQLe-r2m!Quik&_g9XzTj0qSR zD`FkG_RYWDa^+#UUxL&t+!K+&(ion@Fd`5l5p7{Qsva9vegC|4^NzJUMvn)^gqWsF zvu^j=%FfCVg^cgbXDRl1DE$lsfe;BjjmFmRHER~E-MeWoNsyyNHCpG%Y}igd_(Md;&9La8_B075NDRX9gTD zIHY`}9E~aGi9Kk1@P~rmPna=*=gz~UTdTpsQmjX)J23%v9NliQS)8`xJh6Qz_nE~e z&tP|!dcJdo;JMNa3>afSx$lko8>fp-I}OiCVz(dOF1u6e8$IrsSP?=5mp~lkaFqm? zAUMxRq%ecIu3WE)Uf=%p8g z+RSY?G=VO%wAfdICj?Uzb+5jr{8m|)i#{M}JjaDIoXf#1=DYLwX;1EW&sijPvm6EkBGuOx6r~lKv`g`yH?)|&PRUr$5Ibw2HBM7C74XvE@gaPjN+@;j$J)AgYhnT-U5m+wj|Wz8K630AfO8PUoGD^^Mcq zY9C<~%wUm^u%ox5P21)KNN0$(v^OI$A~?iwsS_fRu1+`EH|CRdpA4zsk8Z#|?x@^vVEAL+2JxH%&^{JUU%B=?EU7`Ar*Q|JvqPofcBt765(*f5JI$>=3{<%K)4ei zogo$)5XP}_X$y^pIYyWTt}EAnhTq}u4sAdBvC(WC{I#x4^>$vCvQ0UDs^18sAQG9o zEaP0qjrSSv1W0FyO%9&y$@em~n@8}}EXBG6x%ew49J_q%l@As_XnNpi|MTTPr~ca_ zW%uon6dBKL*pvzYFvf<~p6K8hK9BDNNN0$7xp^hWC3n^7FoQ?P(=m(6!Pj&S2f1fqH=`(w)KcPl5aEi2}~4hF*f*g}vaS-=c7v>N8c z{yNM*%+azq=@prWtgpi~^3?^AsJqS(>=pb=6PrGH#=O{Hcho$_F#MtsK$$3e2fZvg zy}!-V%`+uFMOW87LIgu3vKuMgqwY0}*Sd;aokQp(F#-{}Ss(Iy1iekY1ZQX?1WEL? z7=zq`lH-#Hw=bHRio3yPun%`c5rI1Hb|wTSWTs|12Mg#QkkwTmy zAYul0H*_b(BnkP#!R_&p@d54uz0JKthGv3C^fdKS%~alookE`QX@%#MQN2=SFWrOha7Ij7ImStNaWsy~? zsylUeT02_-z-G4s0L!v=+Wx|cxr$tmY&$a1by8z#6HBp!*9{@mU9XQ0h@L%V_R}4g z&s#2{MCOj4`5ux-SUautC5@{U895o-biKMWWoQ09{|jx8wz}@_(ep%Yk4{90C#s6-sa}fU5{}m>#>VtE_b#5bn8O+3k{&6GoEkB;yGie;A_5Uy zqPN*tU()pE+_&~``5XX({el-xT_}%`%fsc>_0@m5{+FhXru>rpyLESe31R>cK^FFrCm+#WL$-D{Z3*9>Lg{wi}xEYn_`@Hy`-d z1N}kIY%@Eu&Bpe|Rr6N;%Yk>6&RI$lgpIO26BYT%C!dU-o4bqqQpGY?p6lPru6Hzc z@WuSDI^BYaDH*>R)~)$V1J0Edn4r(9vo>E<2XjOJr2*G124;t^U+p{iUnZN5oapCpCk(F}}<#3ZZli!Nk z^UWT;Q9qm-i`i$kJS}5P%puBJ<&krTO;*#$Y7d$o96EbQ{aF1XFpTj}wf}eI|IOba z%w}_CWu?JjkV>U-ad9L$@Mu$CU;pUQBZgt5QmI@n=W@9K(A(SF-rnxzy|_!5ekKqCQTad`sa|&&Q6jfy}iAEst?|mH*emIjg9SB zRVWlHl?r3bvh2qnf6V6(+>4TulB%kzFveeh{k1?K*t&J=m>dk9P8SjqQdn4sF;*&- z(b3VFnVH$y*$Rb%rs zefJ#z#KpyZ_0?C$jvY%)O?7a?7#}%u1OT>d*)keF*REZ=c=4j6tkr5MilS*cB_$;< zFArmEv)Oby-7}4>TD9uE_ulKT4s6Bp@^Y0*rBEo&o;?cy8#Zi^%jH+DTv4f1SFc_L zfc5LwXJ=;vKt@K!?%liR&!6Almmq$2R@G|tg$oyGnpP+jQBhF<(9qCOR8%AuiBtJCSc zyu1LQw6wIQre^Zw$^E0N)#}R1%J}$rkw`Qc#z0A{)dIkjDN`I(PfyS2=x9f~R4N64 zPe1*1=gytQ#l=RWao4V0bLY-=?Bpl*dQDA@LZMJ9l{Gar$;rvzfB$`Tb#+==T0=ua zSy@?1N{UXWyL9Q&#*G`Zv$GE#JXljxBauj2T3VD!rO9N<%F3#*uP-Sn(P%W=w{Jgx z{(NC!VNOmC0OaN6ZQHg@tJQw^;fGtdZUulVSFX&NGv~~iGoO9-nNq0~2n78w23E{L zmth7T3|W>10ISuSm6cUgRCMXmr5!tV0D!x@`?6)rcI?<8lgZ#IIehqVOiYYpi@x#3 z8xau^+1c4ER;th&( zVHk--A`l3|!os9dsYatANm8TH96x@%qM{-&FmUtc&2qVX-MV%A_U(J~%{TY#*<&ym zX3Ur|c$No?u%e>k#EBDaZEY7XUVLH`0zh|n zw_~XRz;RH!y1MS)zn_X$Km70mNs@ZKo~G$z$BuD09F}FpVzEY}F&d2ug#rLPJUpgPpKh}a^y$-i zJl@%}XHT6vRaaNHckf=MQYn>6Fk&*D<+ja0B z5C{a#&CQN-V`HPyXe3EeAP~gH#>U3RayT5ZSd1}tbaaSNDAZ^)j%n&QHMoE=7KubA zlWEeVNpiV7Dk=&gzM|0Dz(>0HA5Q-_F}_znz(xxqbU~E|+`a#EH|V zPjA|^DJLg~rs?+f_6rv-T)upnAP7fChoq;cFJHcV=gyt)zWXjs(+gZ<%kMDTlOd1+TFW%&z(D`)oKF*0@Bmd zLqkIy?RvewprGK+ojWv5%Ve?@D^>&r1p$CcrMhuv}x1&joiO~|IC>)G) + + +Lua 5.3 readme + + + + + + + +

+Lua +Welcome to Lua 5.3 +

+ + + +

About Lua

+

+Lua is a powerful, fast, lightweight, embeddable scripting language +developed by a +team +at +PUC-Rio, +the Pontifical Catholic University of Rio de Janeiro in Brazil. +Lua is +free software +used in many products and projects around the world. + +

+Lua's +official web site +provides complete information +about Lua, +including +an +executive summary +and +updated +documentation, +especially the +reference manual, +which may differ slightly from the +local copy +distributed in this package. + +

Installing Lua

+

+Lua is distributed in +source +form. +You need to build it before using it. +Building Lua should be straightforward +because +Lua is implemented in pure ANSI C and compiles unmodified in all known +platforms that have an ANSI C compiler. +Lua also compiles unmodified as C++. +The instructions given below for building Lua are for Unix-like platforms. +See also +instructions for other systems +and +customization options. + +

+If you don't have the time or the inclination to compile Lua yourself, +get a binary from +LuaBinaries. +Try also +LuaDist, +a multi-platform distribution of Lua that includes batteries. + +

Building Lua

+

+In most Unix-like platforms, simply do "make" with a suitable target. +Here are the details. + +

    +
  1. +Open a terminal window and move to +the top-level directory, which is named lua-5.3.5. +The Makefile there controls both the build process and the installation process. +

    +

  2. + Do "make" and see if your platform is listed. + The platforms currently supported are: +

    +

    + aix bsd c89 freebsd generic linux macosx mingw posix solaris +

    +

    + If your platform is listed, just do "make xxx", where xxx + is your platform name. +

    + If your platform is not listed, try the closest one or posix, generic, + c89, in this order. +

    +

  3. +The compilation takes only a few moments +and produces three files in the src directory: +lua (the interpreter), +luac (the compiler), +and liblua.a (the library). +

    +

  4. + To check that Lua has been built correctly, do "make test" + after building Lua. This will run the interpreter and print its version. +
+

+If you're running Linux and get compilation errors, +make sure you have installed the readline development package +(which is probably named libreadline-dev or readline-devel). +If you get link errors after that, +then try "make linux MYLIBS=-ltermcap". + +

Installing Lua

+

+ Once you have built Lua, you may want to install it in an official + place in your system. In this case, do "make install". The official + place and the way to install files are defined in the Makefile. You'll + probably need the right permissions to install files. + +

+ To build and install Lua in one step, do "make xxx install", + where xxx is your platform name. + +

+ To install Lua locally, do "make local". + This will create a directory install with subdirectories + bin, include, lib, man, share, + and install Lua as listed below. + + To install Lua locally, but in some other directory, do + "make install INSTALL_TOP=xxx", where xxx is your chosen directory. + The installation starts in the src and doc directories, + so take care if INSTALL_TOP is not an absolute path. + +

+
+ bin: +
+ lua luac +
+ include: +
+ lua.h luaconf.h lualib.h lauxlib.h lua.hpp +
+ lib: +
+ liblua.a +
+ man/man1: +
+ lua.1 luac.1 +
+ +

+ These are the only directories you need for development. + If you only want to run Lua programs, + you only need the files in bin and man. + The files in include and lib are needed for + embedding Lua in C or C++ programs. + +

Customization

+

+ Three kinds of things can be customized by editing a file: +

    +
  • Where and how to install Lua — edit Makefile. +
  • How to build Lua — edit src/Makefile. +
  • Lua features — edit src/luaconf.h. +
+ +

+ You don't actually need to edit the Makefiles because you may set the + relevant variables in the command line when invoking make. + Nevertheless, it's probably best to edit and save the Makefiles to + record the changes you've made. + +

+ On the other hand, if you need to customize some Lua features, you'll need + to edit src/luaconf.h before building and installing Lua. + The edited file will be the one installed, and + it will be used by any Lua clients that you build, to ensure consistency. + Further customization is available to experts by editing the Lua sources. + +

Building Lua on other systems

+

+ If you're not using the usual Unix tools, then the instructions for + building Lua depend on the compiler you use. You'll need to create + projects (or whatever your compiler uses) for building the library, + the interpreter, and the compiler, as follows: + +

+
+library: +
+lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c +lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c +ltm.c lundump.c lvm.c lzio.c +lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c +lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c +
+interpreter: +
+ library, lua.c +
+compiler: +
+ library, luac.c +
+ +

+ To use Lua as a library in your own programs you'll need to know how to + create and use libraries with your compiler. Moreover, to dynamically load + C libraries for Lua you'll need to know how to create dynamic libraries + and you'll need to make sure that the Lua API functions are accessible to + those dynamic libraries — but don't link the Lua library + into each dynamic library. For Unix, we recommend that the Lua library + be linked statically into the host program and its symbols exported for + dynamic linking; src/Makefile does this for the Lua interpreter. + For Windows, we recommend that the Lua library be a DLL. + In all cases, the compiler luac should be linked statically. + +

+ As mentioned above, you may edit src/luaconf.h to customize + some features before building Lua. + +

Changes since Lua 5.2

+

+Here are the main changes introduced in Lua 5.3. +The +reference manual +lists the +incompatibilities that had to be introduced. + +

Main changes

+
    +
  • integers (64-bit by default) +
  • official support for 32-bit numbers +
  • bitwise operators +
  • basic utf-8 support +
  • functions for packing and unpacking values + +
+ +Here are the other changes introduced in Lua 5.3: +

Language

+
    +
  • userdata can have any Lua value as uservalue +
  • floor division +
  • more flexible rules for some metamethods +
+ +

Libraries

+
    +
  • ipairs and the table library respect metamethods +
  • strip option in string.dump +
  • table library respects metamethods +
  • new function table.move +
  • new function string.pack +
  • new function string.unpack +
  • new function string.packsize +
+ +

C API

+
    +
  • simpler API for continuation functions in C +
  • lua_gettable and similar functions return type of resulted value +
  • strip option in lua_dump +
  • new function: lua_geti +
  • new function: lua_seti +
  • new function: lua_isyieldable +
  • new function: lua_numbertointeger +
  • new function: lua_rotate +
  • new function: lua_stringtonumber +
+ +

Lua standalone interpreter

+
    +
  • can be used as calculator; no need to prefix with '=' +
  • arg table available to all code +
+ +

License

+

+ +[osi certified] + +Lua is free software distributed under the terms of the +MIT license +reproduced below; +it may be used for any purpose, including commercial purposes, +at absolutely no cost without having to ask us. + +The only requirement is that if you do use Lua, +then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. + +For details, see +this. + +

+Copyright © 1994–2017 Lua.org, PUC-Rio. + +

+Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +

+The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +

+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +

+

+ +

+ + + + diff --git a/deps/lua/src/Makefile b/deps/lua/src/Makefile new file mode 100644 index 0000000000..64c78f775b --- /dev/null +++ b/deps/lua/src/Makefile @@ -0,0 +1,197 @@ +# Makefile for building Lua +# See ../doc/readme.html for installation and customization instructions. + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +CC= gcc -std=gnu99 +CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) +LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) +LIBS= -lm $(SYSLIBS) $(MYLIBS) + +AR= ar rcu +RANLIB= ranlib +RM= rm -f + +SYSCFLAGS= +SYSLDFLAGS= +SYSLIBS= + +MYCFLAGS= +MYLDFLAGS= +MYLIBS= +MYOBJS= + +# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= + +PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris + +LUA_A= liblua.a +CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ + lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ + ltm.o lundump.o lvm.o lzio.o +LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \ + lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o +BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) + +LUA_T= lua +LUA_O= lua.o + +LUAC_T= luac +LUAC_O= luac.o + +ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_A= $(LUA_A) + +# Targets start here. +default: $(PLAT) + +all: $(ALL_T) + +o: $(ALL_O) + +a: $(ALL_A) + +$(LUA_A): $(BASE_O) + $(AR) $@ $(BASE_O) + $(RANLIB) $@ + +$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + +clean: + $(RM) $(ALL_T) $(ALL_O) + +depend: + @$(CC) $(CFLAGS) -MM l*.c + +echo: + @echo "PLAT= $(PLAT)" + @echo "CC= $(CC)" + @echo "CFLAGS= $(CFLAGS)" + @echo "LDFLAGS= $(SYSLDFLAGS)" + @echo "LIBS= $(LIBS)" + @echo "AR= $(AR)" + @echo "RANLIB= $(RANLIB)" + @echo "RM= $(RM)" + +# Convenience targets for popular platforms +ALL= all + +none: + @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" + @echo " $(PLATS)" + +aix: + $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" + +bsd: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" + +c89: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" + @echo '' + @echo '*** C89 does not guarantee 64-bit integers for Lua.' + @echo '' + + +freebsd: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" + +generic: $(ALL) + +linux: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" + +macosx: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" + +mingw: + $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ + "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe + $(MAKE) "LUAC_T=luac.exe" luac.exe + +posix: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" + +solaris: + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) default o a clean depend echo none + +# DO NOT DELETE + +lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \ + ltable.h lundump.h lvm.h +lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h +lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ + llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ + ldo.h lgc.h lstring.h ltable.h lvm.h +lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h +ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \ + ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h +ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \ + lparser.h lstring.h ltable.h lundump.h lvm.h +ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ + ltm.h lzio.h lmem.h lundump.h +lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \ + lgc.h lstate.h ltm.h lzio.h lmem.h +lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h +linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h +liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \ + lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \ + lstring.h ltable.h +lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h +loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \ + ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \ + lvm.h +lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h +loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ + llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ + ldo.h lfunc.h lstring.h lgc.h ltable.h +lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ + lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \ + lstring.h ltable.h +lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ + lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h +lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h +ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h ltable.h lvm.h +lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h lobject.h llimits.h \ + lstate.h ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h +lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ + lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ + lundump.h +lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h +lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ + ltable.h lvm.h +lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ + lobject.h ltm.h lzio.h + +# (end of Makefile) diff --git a/deps/lua/src/lapi.c b/deps/lua/src/lapi.c new file mode 100644 index 0000000000..02b7fab7ea --- /dev/null +++ b/deps/lua/src/lapi.c @@ -0,0 +1,1299 @@ +/* +** $Id: lapi.c,v 2.259.1.2 2017/12/06 18:35:12 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + +#define lapi_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$LuaVersion: " LUA_COPYRIGHT " $" + "$LuaAuthors: " LUA_AUTHORS " $"; + + +/* value at a non-valid index */ +#define NONVALIDVALUE cast(TValue *, luaO_nilobject) + +/* corresponding test */ +#define isvalid(o) ((o) != luaO_nilobject) + +/* test for pseudo index */ +#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX) + +/* test for upvalue */ +#define isupvalue(i) ((i) < LUA_REGISTRYINDEX) + +/* test for valid but not pseudo index */ +#define isstackindex(i, o) (isvalid(o) && !ispseudo(i)) + +#define api_checkvalidindex(l,o) api_check(l, isvalid(o), "invalid index") + +#define api_checkstackindex(l, i, o) \ + api_check(l, isstackindex(i, o), "index not in the stack") + + +static TValue *index2addr (lua_State *L, int idx) { + CallInfo *ci = L->ci; + if (idx > 0) { + TValue *o = ci->func + idx; + api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index"); + if (o >= L->top) return NONVALIDVALUE; + else return o; + } + else if (!ispseudo(idx)) { /* negative index */ + api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); + return L->top + idx; + } + else if (idx == LUA_REGISTRYINDEX) + return &G(L)->l_registry; + else { /* upvalues */ + idx = LUA_REGISTRYINDEX - idx; + api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); + if (ttislcf(ci->func)) /* light C function? */ + return NONVALIDVALUE; /* it has no upvalues */ + else { + CClosure *func = clCvalue(ci->func); + return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE; + } + } +} + + +/* +** to be called by 'lua_checkstack' in protected mode, to grow stack +** capturing memory errors +*/ +static void growstack (lua_State *L, void *ud) { + int size = *(int *)ud; + luaD_growstack(L, size); +} + + +LUA_API int lua_checkstack (lua_State *L, int n) { + int res; + CallInfo *ci = L->ci; + lua_lock(L); + api_check(L, n >= 0, "negative 'n'"); + if (L->stack_last - L->top > n) /* stack large enough? */ + res = 1; /* yes; check is OK */ + else { /* no; need to grow stack */ + int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; + if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */ + res = 0; /* no */ + else /* try to grow stack */ + res = (luaD_rawrunprotected(L, &growstack, &n) == LUA_OK); + } + if (res && ci->top < L->top + n) + ci->top = L->top + n; /* adjust frame top */ + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to), "moving among independent states"); + api_check(from, to->ci->top - to->top >= n, "stack overflow"); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top, from->top + i); + to->top++; /* stack already checked by previous 'api_check' */ + } + lua_unlock(to); +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API const lua_Number *lua_version (lua_State *L) { + static const lua_Number version = LUA_VERSION_NUM; + if (L == NULL) return &version; + else return G(L)->version; +} + + + +/* +** basic stack manipulation +*/ + + +/* +** convert an acceptable stack index into an absolute index +*/ +LUA_API int lua_absindex (lua_State *L, int idx) { + return (idx > 0 || ispseudo(idx)) + ? idx + : cast_int(L->top - L->ci->func) + idx; +} + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - (L->ci->func + 1)); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + StkId func = L->ci->func; + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); + while (L->top < (func + 1) + idx) + setnilvalue(L->top++); + L->top = (func + 1) + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); + L->top += idx+1; /* 'subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +/* +** Reverse the stack segment from 'from' to 'to' +** (auxiliary to 'lua_rotate') +*/ +static void reverse (lua_State *L, StkId from, StkId to) { + for (; from < to; from++, to--) { + TValue temp; + setobj(L, &temp, from); + setobjs2s(L, from, to); + setobj2s(L, to, &temp); + } +} + + +/* +** Let x = AB, where A is a prefix of length 'n'. Then, +** rotate x n == BA. But BA == (A^r . B^r)^r. +*/ +LUA_API void lua_rotate (lua_State *L, int idx, int n) { + StkId p, t, m; + lua_lock(L); + t = L->top - 1; /* end of stack segment being rotated */ + p = index2addr(L, idx); /* start of segment */ + api_checkstackindex(L, idx, p); + api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); + m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ + reverse(L, p, m); /* reverse the prefix with length 'n' */ + reverse(L, m + 1, t); /* reverse the suffix */ + reverse(L, p, t); /* reverse the entire segment */ + lua_unlock(L); +} + + +LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { + TValue *fr, *to; + lua_lock(L); + fr = index2addr(L, fromidx); + to = index2addr(L, toidx); + api_checkvalidindex(L, to); + setobj(L, to, fr); + if (isupvalue(toidx)) /* function upvalue? */ + luaC_barrier(L, clCvalue(L->ci->func), fr); + /* LUA_REGISTRYINDEX does not need gc barrier + (collector revisits it before finishing collection) */ + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2addr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return (isvalid(o) ? ttnov(o) : LUA_TNONE); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + api_check(L, LUA_TNONE <= t && t < LUA_NUMTAGS, "invalid tag"); + return ttypename(t); +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return (ttislcf(o) || (ttisCclosure(o))); +} + + +LUA_API int lua_isinteger (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return ttisinteger(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + lua_Number n; + const TValue *o = index2addr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + const TValue *o = index2addr(L, idx); + return (ttisstring(o) || cvt2str(o)); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2addr(L, idx); + return (ttisfulluserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2addr(L, index1); + StkId o2 = index2addr(L, index2); + return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0; +} + + +LUA_API void lua_arith (lua_State *L, int op) { + lua_lock(L); + if (op != LUA_OPUNM && op != LUA_OPBNOT) + api_checknelems(L, 2); /* all other operations expect two operands */ + else { /* for unary operations, add fake 2nd operand */ + api_checknelems(L, 1); + setobjs2s(L, L->top, L->top - 1); + api_incr_top(L); + } + /* first operand at top - 2, second at top - 1; result go to top - 2 */ + luaO_arith(L, op, L->top - 2, L->top - 1, L->top - 2); + L->top--; /* remove second operand */ + lua_unlock(L); +} + + +LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { + StkId o1, o2; + int i = 0; + lua_lock(L); /* may call tag method */ + o1 = index2addr(L, index1); + o2 = index2addr(L, index2); + if (isvalid(o1) && isvalid(o2)) { + switch (op) { + case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; + case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; + case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; + default: api_check(L, 0, "invalid option"); + } + } + lua_unlock(L); + return i; +} + + +LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { + size_t sz = luaO_str2num(s, L->top); + if (sz != 0) + api_incr_top(L); + return sz; +} + + +LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum) { + lua_Number n; + const TValue *o = index2addr(L, idx); + int isnum = tonumber(o, &n); + if (!isnum) + n = 0; /* call to 'tonumber' may change 'n' even if it fails */ + if (pisnum) *pisnum = isnum; + return n; +} + + +LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum) { + lua_Integer res; + const TValue *o = index2addr(L, idx); + int isnum = tointeger(o, &res); + if (!isnum) + res = 0; /* call to 'tointeger' may change 'n' even if it fails */ + if (pisnum) *pisnum = isnum; + return res; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2addr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2addr(L, idx); + if (!ttisstring(o)) { + if (!cvt2str(o)) { /* not convertible? */ + if (len != NULL) *len = 0; + return NULL; + } + lua_lock(L); /* 'luaO_tostring' may create a new string */ + luaO_tostring(L, o); + luaC_checkGC(L); + o = index2addr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) + *len = vslen(o); + return svalue(o); +} + + +LUA_API size_t lua_rawlen (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + switch (ttype(o)) { + case LUA_TSHRSTR: return tsvalue(o)->shrlen; + case LUA_TLNGSTR: return tsvalue(o)->u.lnglen; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + if (ttislcf(o)) return fvalue(o); + else if (ttisCclosure(o)) + return clCvalue(o)->f; + else return NULL; /* not a C function */ +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + switch (ttnov(o)) { + case LUA_TUSERDATA: return getudatamem(uvalue(o)); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2addr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TLCL: return clLvalue(o); + case LUA_TCCL: return clCvalue(o); + case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: return getudatamem(uvalue(o)); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setfltvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setivalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +/* +** Pushes on the stack a string with given length. Avoid using 's' when +** 'len' == 0 (as 's' can be NULL in that case), due to later use of +** 'memcmp' and 'memcpy'. +*/ +LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { + TString *ts; + lua_lock(L); + ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); + setsvalue2s(L, L->top, ts); + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return getstr(ts); +} + + +LUA_API const char *lua_pushstring (lua_State *L, const char *s) { + lua_lock(L); + if (s == NULL) + setnilvalue(L->top); + else { + TString *ts; + ts = luaS_new(L, s); + setsvalue2s(L, L->top, ts); + s = getstr(ts); /* internal copy's address */ + } + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return s; +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + ret = luaO_pushvfstring(L, fmt, argp); + luaC_checkGC(L); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + luaC_checkGC(L); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + lua_lock(L); + if (n == 0) { + setfvalue(L->top, fn); + api_incr_top(L); + } + else { + CClosure *cl; + api_checknelems(L, n); + api_check(L, n <= MAXUPVAL, "upvalue index too large"); + cl = luaF_newCclosure(L, n); + cl->f = fn; + L->top -= n; + while (n--) { + setobj2n(L, &cl->upvalue[n], L->top + n); + /* does not need barrier because closure is white */ + } + setclCvalue(L, L->top, cl); + api_incr_top(L); + luaC_checkGC(L); + } + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +static int auxgetstr (lua_State *L, const TValue *t, const char *k) { + const TValue *slot; + TString *str = luaS_new(L, k); + if (luaV_fastget(L, t, str, slot, luaH_getstr)) { + setobj2s(L, L->top, slot); + api_incr_top(L); + } + else { + setsvalue2s(L, L->top, str); + api_incr_top(L); + luaV_finishget(L, t, L->top - 1, L->top - 1, slot); + } + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_getglobal (lua_State *L, const char *name) { + Table *reg = hvalue(&G(L)->l_registry); + lua_lock(L); + return auxgetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); +} + + +LUA_API int lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_getfield (lua_State *L, int idx, const char *k) { + lua_lock(L); + return auxgetstr(L, index2addr(L, idx), k); +} + + +LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { + StkId t; + const TValue *slot; + lua_lock(L); + t = index2addr(L, idx); + if (luaV_fastget(L, t, n, slot, luaH_getint)) { + setobj2s(L, L->top, slot); + api_incr_top(L); + } + else { + setivalue(L->top, n); + api_incr_top(L); + luaV_finishget(L, t, L->top - 1, L->top - 1, slot); + } + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + setobj2s(L, L->top, luaH_getint(hvalue(t), n)); + api_incr_top(L); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { + StkId t; + TValue k; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + setpvalue(&k, cast(void *, p)); + setobj2s(L, L->top, luaH_get(hvalue(t), &k)); + api_incr_top(L); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + Table *t; + lua_lock(L); + t = luaH_new(L); + sethvalue(L, L->top, t); + api_incr_top(L); + if (narray > 0 || nrec > 0) + luaH_resize(L, t, narray, nrec); + luaC_checkGC(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt; + int res = 0; + lua_lock(L); + obj = index2addr(L, objindex); + switch (ttnov(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttnov(obj)]; + break; + } + if (mt != NULL) { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API int lua_getuservalue (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2addr(L, idx); + api_check(L, ttisfulluserdata(o), "full userdata expected"); + getuservalue(L, uvalue(o), L->top); + api_incr_top(L); + lua_unlock(L); + return ttnov(L->top - 1); +} + + +/* +** set functions (stack -> Lua) +*/ + +/* +** t[k] = value at the top of the stack (where 'k' is a string) +*/ +static void auxsetstr (lua_State *L, const TValue *t, const char *k) { + const TValue *slot; + TString *str = luaS_new(L, k); + api_checknelems(L, 1); + if (luaV_fastset(L, t, str, slot, luaH_getstr, L->top - 1)) + L->top--; /* pop value */ + else { + setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */ + api_incr_top(L); + luaV_finishset(L, t, L->top - 1, L->top - 2, slot); + L->top -= 2; /* pop value and key */ + } + lua_unlock(L); /* lock done by caller */ +} + + +LUA_API void lua_setglobal (lua_State *L, const char *name) { + Table *reg = hvalue(&G(L)->l_registry); + lua_lock(L); /* unlock done in 'auxsetstr' */ + auxsetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); +} + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2addr(L, idx); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + lua_lock(L); /* unlock done in 'auxsetstr' */ + auxsetstr(L, index2addr(L, idx), k); +} + + +LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { + StkId t; + const TValue *slot; + lua_lock(L); + api_checknelems(L, 1); + t = index2addr(L, idx); + if (luaV_fastset(L, t, n, slot, luaH_getint, L->top - 1)) + L->top--; /* pop value */ + else { + setivalue(L->top, n); + api_incr_top(L); + luaV_finishset(L, t, L->top - 1, L->top - 2, slot); + L->top -= 2; /* pop value and key */ + } + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId o; + TValue *slot; + lua_lock(L); + api_checknelems(L, 2); + o = index2addr(L, idx); + api_check(L, ttistable(o), "table expected"); + slot = luaH_set(L, hvalue(o), L->top - 2); + setobj2t(L, slot, L->top - 1); + invalidateTMcache(hvalue(o)); + luaC_barrierback(L, hvalue(o), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2addr(L, idx); + api_check(L, ttistable(o), "table expected"); + luaH_setint(L, hvalue(o), n, L->top - 1); + luaC_barrierback(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { + StkId o; + TValue k, *slot; + lua_lock(L); + api_checknelems(L, 1); + o = index2addr(L, idx); + api_check(L, ttistable(o), "table expected"); + setpvalue(&k, cast(void *, p)); + slot = luaH_set(L, hvalue(o), &k); + setobj2t(L, slot, L->top - 1); + luaC_barrierback(L, hvalue(o), L->top - 1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2addr(L, objindex); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1), "table expected"); + mt = hvalue(L->top - 1); + } + switch (ttnov(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) { + luaC_objbarrier(L, gcvalue(obj), mt); + luaC_checkfinalizer(L, gcvalue(obj), mt); + } + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) { + luaC_objbarrier(L, uvalue(obj), mt); + luaC_checkfinalizer(L, gcvalue(obj), mt); + } + break; + } + default: { + G(L)->mt[ttnov(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API void lua_setuservalue (lua_State *L, int idx) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2addr(L, idx); + api_check(L, ttisfulluserdata(o), "full userdata expected"); + setuservalue(L, uvalue(o), L->top - 1); + luaC_barrier(L, gcvalue(o), L->top - 1); + L->top--; + lua_unlock(L); +} + + +/* +** 'load' and 'call' functions (run Lua code) +*/ + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ + "results from function overflow current stack size") + + +LUA_API void lua_callk (lua_State *L, int nargs, int nresults, + lua_KContext ctx, lua_KFunction k) { + StkId func; + lua_lock(L); + api_check(L, k == NULL || !isLua(L->ci), + "cannot use continuations inside hooks"); + api_checknelems(L, nargs+1); + api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ + L->ci->u.c.k = k; /* save continuation */ + L->ci->u.c.ctx = ctx; /* save context */ + luaD_call(L, func, nresults); /* do the call */ + } + else /* no continuation or no yieldable */ + luaD_callnoyield(L, func, nresults); /* just do the call */ + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to 'f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_callnoyield(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, + lua_KContext ctx, lua_KFunction k) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_check(L, k == NULL || !isLua(L->ci), + "cannot use continuations inside hooks"); + api_checknelems(L, nargs+1); + api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2addr(L, errfunc); + api_checkstackindex(L, errfunc, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */ + c.nresults = nresults; /* do a 'conventional' protected call */ + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + } + else { /* prepare continuation (call is already protected by 'resume') */ + CallInfo *ci = L->ci; + ci->u.c.k = k; /* save continuation */ + ci->u.c.ctx = ctx; /* save context */ + /* save information for error recovery */ + ci->extra = savestack(L, c.func); + ci->u.c.old_errfunc = L->errfunc; + L->errfunc = func; + setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */ + ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ + luaD_call(L, c.func, nresults); /* do the call */ + ci->callstatus &= ~CIST_YPCALL; + L->errfunc = ci->u.c.old_errfunc; + status = LUA_OK; /* if it is here, there were no errors */ + } + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname, const char *mode) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname, mode); + if (status == LUA_OK) { /* no errors? */ + LClosure *f = clLvalue(L->top - 1); /* get newly created function */ + if (f->nupvalues >= 1) { /* does it have an upvalue? */ + /* get global table from registry */ + Table *reg = hvalue(&G(L)->l_registry); + const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS); + /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ + setobj(L, f->upvals[0]->v, gt); + luaC_upvalbarrier(L, f->upvals[0]); + } + } + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, getproto(o), writer, data, strip); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->gcrunning = 0; + break; + } + case LUA_GCRESTART: { + luaE_setdebt(g, 0); + g->gcrunning = 1; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L, 0); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(gettotalbytes(g) >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(gettotalbytes(g) & 0x3ff); + break; + } + case LUA_GCSTEP: { + l_mem debt = 1; /* =1 to signal that it did an actual step */ + lu_byte oldrunning = g->gcrunning; + g->gcrunning = 1; /* allow GC to run */ + if (data == 0) { + luaE_setdebt(g, -GCSTEPSIZE); /* to do a "small" step */ + luaC_step(L); + } + else { /* add 'data' to total debt */ + debt = cast(l_mem, data) * 1024 + g->GCdebt; + luaE_setdebt(g, debt); + luaC_checkGC(L); + } + g->gcrunning = oldrunning; /* restore previous state */ + if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ + res = 1; /* signal it */ + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + if (data < 40) data = 40; /* avoid ridiculous low values (and 0) */ + g->gcstepmul = data; + break; + } + case LUA_GCISRUNNING: { + res = g->gcrunning; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + /* code unreachable; will unlock when control actually leaves the kernel */ + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2addr(L, idx); + api_check(L, ttistable(t), "table expected"); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaV_concat(L, n); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + luaC_checkGC(L); + lua_unlock(L); +} + + +LUA_API void lua_len (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2addr(L, idx); + luaV_objlen(L, L->top, t); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + u = luaS_newudata(L, size); + setuvalue(L, L->top, u); + api_incr_top(L); + luaC_checkGC(L); + lua_unlock(L); + return getudatamem(u); +} + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val, + CClosure **owner, UpVal **uv) { + switch (ttype(fi)) { + case LUA_TCCL: { /* C closure */ + CClosure *f = clCvalue(fi); + if (!(1 <= n && n <= f->nupvalues)) return NULL; + *val = &f->upvalue[n-1]; + if (owner) *owner = f; + return ""; + } + case LUA_TLCL: { /* Lua closure */ + LClosure *f = clLvalue(fi); + TString *name; + Proto *p = f->p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->upvals[n-1]->v; + if (uv) *uv = f->upvals[n - 1]; + name = p->upvalues[n-1].name; + return (name == NULL) ? "(*no name)" : getstr(name); + } + default: return NULL; /* not a closure */ + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val = NULL; /* to avoid warnings */ + lua_lock(L); + name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL, NULL); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val = NULL; /* to avoid warnings */ + CClosure *owner = NULL; + UpVal *uv = NULL; + StkId fi; + lua_lock(L); + fi = index2addr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val, &owner, &uv); + if (name) { + L->top--; + setobj(L, val, L->top); + if (owner) { luaC_barrier(L, owner, L->top); } + else if (uv) { luaC_upvalbarrier(L, uv); } + } + lua_unlock(L); + return name; +} + + +static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { + LClosure *f; + StkId fi = index2addr(L, fidx); + api_check(L, ttisLclosure(fi), "Lua function expected"); + f = clLvalue(fi); + api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); + if (pf) *pf = f; + return &f->upvals[n - 1]; /* get its upvalue pointer */ +} + + +LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { + StkId fi = index2addr(L, fidx); + switch (ttype(fi)) { + case LUA_TLCL: { /* lua closure */ + return *getupvalref(L, fidx, n, NULL); + } + case LUA_TCCL: { /* C closure */ + CClosure *f = clCvalue(fi); + api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); + return &f->upvalue[n - 1]; + } + default: { + api_check(L, 0, "closure expected"); + return NULL; + } + } +} + + +LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, + int fidx2, int n2) { + LClosure *f1; + UpVal **up1 = getupvalref(L, fidx1, n1, &f1); + UpVal **up2 = getupvalref(L, fidx2, n2, NULL); + luaC_upvdeccount(L, *up1); + *up1 = *up2; + (*up1)->refcount++; + if (upisopen(*up1)) (*up1)->u.open.touched = 1; + luaC_upvalbarrier(L, *up1); +} + + diff --git a/deps/lua/src/lapi.h b/deps/lua/src/lapi.h new file mode 100644 index 0000000000..8e16ad53d9 --- /dev/null +++ b/deps/lua/src/lapi.h @@ -0,0 +1,24 @@ +/* +** $Id: lapi.h,v 2.9.1.1 2017/04/19 17:20:42 roberto Exp $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "llimits.h" +#include "lstate.h" + +#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ + "stack overflow");} + +#define adjustresults(L,nres) \ + { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } + +#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ + "not enough elements in the stack") + + +#endif diff --git a/deps/lua/src/lauxlib.c b/deps/lua/src/lauxlib.c new file mode 100644 index 0000000000..8bdada50a7 --- /dev/null +++ b/deps/lua/src/lauxlib.c @@ -0,0 +1,1043 @@ +/* +** $Id: lauxlib.c,v 1.289.1.1 2017/04/19 17:20:42 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include + + +/* +** This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#include "lua.h" + +#include "lauxlib.h" + + +/* +** {====================================================== +** Traceback +** ======================================================= +*/ + + +#define LEVELS1 10 /* size of the first part of the stack */ +#define LEVELS2 11 /* size of the second part of the stack */ + + + +/* +** search for 'objidx' in table at index -1. +** return 1 + string at top if find a good name. +*/ +static int findfield (lua_State *L, int objidx, int level) { + if (level == 0 || !lua_istable(L, -1)) + return 0; /* not found */ + lua_pushnil(L); /* start 'next' loop */ + while (lua_next(L, -2)) { /* for each pair in table */ + if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ + if (lua_rawequal(L, objidx, -1)) { /* found object? */ + lua_pop(L, 1); /* remove value (but keep name) */ + return 1; + } + else if (findfield(L, objidx, level - 1)) { /* try recursively */ + lua_remove(L, -2); /* remove table (but keep name) */ + lua_pushliteral(L, "."); + lua_insert(L, -2); /* place '.' between the two names */ + lua_concat(L, 3); + return 1; + } + } + lua_pop(L, 1); /* remove value */ + } + return 0; /* not found */ +} + + +/* +** Search for a name for a function in all loaded modules +*/ +static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { + int top = lua_gettop(L); + lua_getinfo(L, "f", ar); /* push function */ + lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + if (findfield(L, top + 1, 2)) { + const char *name = lua_tostring(L, -1); + if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ + lua_pushstring(L, name + 3); /* push name without prefix */ + lua_remove(L, -2); /* remove original name */ + } + lua_copy(L, -1, top + 1); /* move name to proper place */ + lua_pop(L, 2); /* remove pushed values */ + return 1; + } + else { + lua_settop(L, top); /* remove function and global table */ + return 0; + } +} + + +static void pushfuncname (lua_State *L, lua_Debug *ar) { + if (pushglobalfuncname(L, ar)) { /* try first a global name */ + lua_pushfstring(L, "function '%s'", lua_tostring(L, -1)); + lua_remove(L, -2); /* remove name */ + } + else if (*ar->namewhat != '\0') /* is there a name from code? */ + lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */ + else if (*ar->what == 'm') /* main? */ + lua_pushliteral(L, "main chunk"); + else if (*ar->what != 'C') /* for Lua functions, use */ + lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); + else /* nothing left... */ + lua_pushliteral(L, "?"); +} + + +static int lastlevel (lua_State *L) { + lua_Debug ar; + int li = 1, le = 1; + /* find an upper bound */ + while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } + /* do a binary search */ + while (li < le) { + int m = (li + le)/2; + if (lua_getstack(L, m, &ar)) li = m + 1; + else le = m; + } + return le - 1; +} + + +LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, + const char *msg, int level) { + lua_Debug ar; + int top = lua_gettop(L); + int last = lastlevel(L1); + int n1 = (last - level > LEVELS1 + LEVELS2) ? LEVELS1 : -1; + if (msg) + lua_pushfstring(L, "%s\n", msg); + luaL_checkstack(L, 10, NULL); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (n1-- == 0) { /* too many levels? */ + lua_pushliteral(L, "\n\t..."); /* add a '...' */ + level = last - LEVELS2 + 1; /* and skip to last ones */ + } + else { + lua_getinfo(L1, "Slnt", &ar); + lua_pushfstring(L, "\n\t%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + lua_pushliteral(L, " in "); + pushfuncname(L, &ar); + if (ar.istailcall) + lua_pushliteral(L, "\n\t(...tail calls...)"); + lua_concat(L, lua_gettop(L) - top); + } + } + lua_concat(L, lua_gettop(L) - top); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + +LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + arg--; /* do not count 'self' */ + if (arg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling '%s' on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; + return luaL_error(L, "bad argument #%d to '%s' (%s)", + arg, ar.name, extramsg); +} + + +static int typeerror (lua_State *L, int arg, const char *tname) { + const char *msg; + const char *typearg; /* name for the type of the actual argument */ + if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING) + typearg = lua_tostring(L, -1); /* use the given type name */ + else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) + typearg = "light userdata"; /* special name for messages */ + else + typearg = luaL_typename(L, arg); /* standard name */ + msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); + return luaL_argerror(L, arg, msg); +} + + +static void tag_error (lua_State *L, int arg, int tag) { + typeerror(L, arg, lua_typename(L, tag)); +} + + +/* +** The use of 'lua_pushfstring' ensures this function does not +** need reserved stack space when called. +*/ +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushfstring(L, ""); /* else, no information available... */ +} + + +/* +** Again, the use of 'lua_pushvfstring' ensures this function does +** not need reserved stack space when called. (At worst, it generates +** an error with "stack overflow" instead of the given message.) +*/ +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + + +LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { + int en = errno; /* calls to Lua API may change this value */ + if (stat) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (fname) + lua_pushfstring(L, "%s: %s", fname, strerror(en)); + else + lua_pushstring(L, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +#if !defined(l_inspectstat) /* { */ + +#if defined(LUA_USE_POSIX) + +#include + +/* +** use appropriate macros to interpret 'pclose' return status +*/ +#define l_inspectstat(stat,what) \ + if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \ + else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; } + +#else + +#define l_inspectstat(stat,what) /* no op */ + +#endif + +#endif /* } */ + + +LUALIB_API int luaL_execresult (lua_State *L, int stat) { + const char *what = "exit"; /* type of termination */ + if (stat == -1) /* error? */ + return luaL_fileresult(L, 0, NULL); + else { + l_inspectstat(stat, what); /* interpret result */ + if (*what == 'e' && stat == 0) /* successful termination? */ + lua_pushboolean(L, 1); + else + lua_pushnil(L); + lua_pushstring(L, what); + lua_pushinteger(L, stat); + return 3; /* return true/nil,what,code */ + } +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Userdata's metatable manipulation +** ======================================================= +*/ + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + if (luaL_getmetatable(L, tname) != LUA_TNIL) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_createtable(L, 0, 2); /* create metatable */ + lua_pushstring(L, tname); + lua_setfield(L, -2, "__name"); /* metatable.__name = tname */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { + luaL_getmetatable(L, tname); + lua_setmetatable(L, -2); +} + + +LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + luaL_getmetatable(L, tname); /* get correct metatable */ + if (!lua_rawequal(L, -1, -2)) /* not the same? */ + p = NULL; /* value is a userdata with wrong metatable */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + return NULL; /* value is not a userdata with a metatable */ +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = luaL_testudata(L, ud, tname); + if (p == NULL) typeerror(L, ud, tname); + return p; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Argument check functions +** ======================================================= +*/ + +LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, arg, def) : + luaL_checkstring(L, arg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, arg, + lua_pushfstring(L, "invalid option '%s'", name)); +} + + +/* +** Ensures the stack has at least 'space' extra slots, raising an error +** if it cannot fulfill the request. (The error handling needs a few +** extra slots to format the error message. In case of an error without +** this extra space, Lua will generate the same 'stack overflow' error, +** but without 'msg'.) +*/ +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { + if (!lua_checkstack(L, space)) { + if (msg) + luaL_error(L, "stack overflow (%s)", msg); + else + luaL_error(L, "stack overflow"); + } +} + + +LUALIB_API void luaL_checktype (lua_State *L, int arg, int t) { + if (lua_type(L, arg) != t) + tag_error(L, arg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int arg) { + if (lua_type(L, arg) == LUA_TNONE) + luaL_argerror(L, arg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int arg, size_t *len) { + const char *s = lua_tolstring(L, arg, len); + if (!s) tag_error(L, arg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int arg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, arg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, arg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg) { + int isnum; + lua_Number d = lua_tonumberx(L, arg, &isnum); + if (!isnum) + tag_error(L, arg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, arg, def); +} + + +static void interror (lua_State *L, int arg) { + if (lua_isnumber(L, arg)) + luaL_argerror(L, arg, "number has no integer representation"); + else + tag_error(L, arg, LUA_TNUMBER); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg) { + int isnum; + lua_Integer d = lua_tointegerx(L, arg, &isnum); + if (!isnum) { + interror(L, arg); + } + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, arg, def); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + +/* userdata to box arbitrary data */ +typedef struct UBox { + void *box; + size_t bsize; +} UBox; + + +static void *resizebox (lua_State *L, int idx, size_t newsize) { + void *ud; + lua_Alloc allocf = lua_getallocf(L, &ud); + UBox *box = (UBox *)lua_touserdata(L, idx); + void *temp = allocf(ud, box->box, box->bsize, newsize); + if (temp == NULL && newsize > 0) { /* allocation error? */ + resizebox(L, idx, 0); /* free buffer */ + luaL_error(L, "not enough memory for buffer allocation"); + } + box->box = temp; + box->bsize = newsize; + return temp; +} + + +static int boxgc (lua_State *L) { + resizebox(L, 1, 0); + return 0; +} + + +static void *newbox (lua_State *L, size_t newsize) { + UBox *box = (UBox *)lua_newuserdata(L, sizeof(UBox)); + box->box = NULL; + box->bsize = 0; + if (luaL_newmetatable(L, "LUABOX")) { /* creating metatable? */ + lua_pushcfunction(L, boxgc); + lua_setfield(L, -2, "__gc"); /* metatable.__gc = boxgc */ + } + lua_setmetatable(L, -2); + return resizebox(L, -1, newsize); +} + + +/* +** check whether buffer is using a userdata on the stack as a temporary +** buffer +*/ +#define buffonstack(B) ((B)->b != (B)->initb) + + +/* +** returns a pointer to a free area with at least 'sz' bytes +*/ +LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) { + lua_State *L = B->L; + if (B->size - B->n < sz) { /* not enough space? */ + char *newbuff; + size_t newsize = B->size * 2; /* double buffer size */ + if (newsize - B->n < sz) /* not big enough? */ + newsize = B->n + sz; + if (newsize < B->n || newsize - B->n < sz) + luaL_error(L, "buffer too large"); + /* create larger buffer */ + if (buffonstack(B)) + newbuff = (char *)resizebox(L, -1, newsize); + else { /* no buffer yet */ + newbuff = (char *)newbox(L, newsize); + memcpy(newbuff, B->b, B->n * sizeof(char)); /* copy original content */ + } + B->b = newbuff; + B->size = newsize; + } + return &B->b[B->n]; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + if (l > 0) { /* avoid 'memcpy' when 's' can be NULL */ + char *b = luaL_prepbuffsize(B, l); + memcpy(b, s, l * sizeof(char)); + luaL_addsize(B, l); + } +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + lua_State *L = B->L; + lua_pushlstring(L, B->b, B->n); + if (buffonstack(B)) { + resizebox(L, -2, 0); /* delete old buffer */ + lua_remove(L, -2); /* remove its header from the stack */ + } +} + + +LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) { + luaL_addsize(B, sz); + luaL_pushresult(B); +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t l; + const char *s = lua_tolstring(L, -1, &l); + if (buffonstack(B)) + lua_insert(L, -2); /* put value below buffer */ + luaL_addlstring(B, s, l); + lua_remove(L, (buffonstack(B)) ? -2 : -1); /* remove value */ +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->b = B->initb; + B->n = 0; + B->size = LUAL_BUFFERSIZE; +} + + +LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) { + luaL_buffinit(L, B); + return luaL_prepbuffsize(B, sz); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Reference system +** ======================================================= +*/ + +/* index of free-list header */ +#define freelist 0 + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* 'nil' has a unique fixed reference */ + } + t = lua_absindex(L, t); + lua_rawgeti(L, t, freelist); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */ + } + else /* no free elements */ + ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = lua_absindex(L, t); + lua_rawgeti(L, t, freelist); + lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, freelist); /* t[freelist] = ref */ + } +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int n; /* number of pre-read characters */ + FILE *f; /* file being read */ + char buff[BUFSIZ]; /* area for reading file */ +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; /* not used */ + if (lf->n > 0) { /* are there pre-read characters to be read? */ + *size = lf->n; /* return them (chars already in buffer) */ + lf->n = 0; /* no more pre-read characters */ + } + else { /* read a block from file */ + /* 'fread' can return > 0 *and* set the EOF flag. If next call to + 'getF' called 'fread', it might still wait for user input. + The next check avoids this problem. */ + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ + } + return lf->buff; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +static int skipBOM (LoadF *lf) { + const char *p = "\xEF\xBB\xBF"; /* UTF-8 BOM mark */ + int c; + lf->n = 0; + do { + c = getc(lf->f); + if (c == EOF || c != *(const unsigned char *)p++) return c; + lf->buff[lf->n++] = c; /* to be read by the parser */ + } while (*p != '\0'); + lf->n = 0; /* prefix matched; discard it */ + return getc(lf->f); /* return next character */ +} + + +/* +** reads the first character of file 'f' and skips an optional BOM mark +** in its beginning plus its first line if it starts with '#'. Returns +** true if it skipped the first line. In any case, '*cp' has the +** first "valid" character of the file (after the optional BOM and +** a first-line comment). +*/ +static int skipcomment (LoadF *lf, int *cp) { + int c = *cp = skipBOM(lf); + if (c == '#') { /* first line is a comment (Unix exec. file)? */ + do { /* skip first line */ + c = getc(lf->f); + } while (c != EOF && c != '\n'); + *cp = getc(lf->f); /* skip end-of-line, if present */ + return 1; /* there was a comment */ + } + else return 0; /* no comment */ +} + + +LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, + const char *mode) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + if (skipcomment(&lf, &c)) /* read initial portion */ + lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */ + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + skipcomment(&lf, &c); /* re-read initial portion */ + } + if (c != EOF) + lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ + status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; /* not used */ + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, + const char *name, const char *mode) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name, mode); +} + + +LUALIB_API int luaL_loadstring (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + +/* }====================================================== */ + + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return LUA_TNIL; + else { + int tt; + lua_pushstring(L, event); + tt = lua_rawget(L, -2); + if (tt == LUA_TNIL) /* is metafield nil? */ + lua_pop(L, 2); /* remove metatable and metafield */ + else + lua_remove(L, -2); /* remove only metatable */ + return tt; /* return metafield type */ + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = lua_absindex(L, obj); + if (luaL_getmetafield(L, obj, event) == LUA_TNIL) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { + lua_Integer l; + int isnum; + lua_len(L, idx); + l = lua_tointegerx(L, -1, &isnum); + if (!isnum) + luaL_error(L, "object length is not an integer"); + lua_pop(L, 1); /* remove object */ + return l; +} + + +LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { + if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */ + if (!lua_isstring(L, -1)) + luaL_error(L, "'__tostring' must return a string"); + } + else { + switch (lua_type(L, idx)) { + case LUA_TNUMBER: { + if (lua_isinteger(L, idx)) + lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx)); + else + lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx)); + break; + } + case LUA_TSTRING: + lua_pushvalue(L, idx); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: { + int tt = luaL_getmetafield(L, idx, "__name"); /* try name */ + const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) : + luaL_typename(L, idx); + lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx)); + if (tt != LUA_TNIL) + lua_remove(L, -2); /* remove '__name' */ + break; + } + } + } + return lua_tolstring(L, -1, len); +} + + +/* +** {====================================================== +** Compatibility with 5.1 module functions +** ======================================================= +*/ +#if defined(LUA_COMPAT_MODULE) + +static const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + if (idx) lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + if (lua_rawget(L, -2) == LUA_TNIL) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + +/* +** Count number of elements in a luaL_Reg list. +*/ +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l && l->name; l++) size++; + return size; +} + + +/* +** Find or create a module table with a given name. The function +** first looks at the LOADED table and, if that fails, try a +** global variable with that name. In any case, leaves on the stack +** the module table. +*/ +LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, + int sizehint) { + luaL_findtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE, 1); + if (lua_getfield(L, -1, modname) != LUA_TTABLE) { /* no LOADED[modname]? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + lua_pushglobaltable(L); + if (luaL_findtable(L, 0, modname, sizehint) != NULL) + luaL_error(L, "name conflict for module '%s'", modname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, modname); /* LOADED[modname] = new table */ + } + lua_remove(L, -2); /* remove LOADED table */ +} + + +LUALIB_API void luaL_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + luaL_checkversion(L); + if (libname) { + luaL_pushmodule(L, libname, libsize(l)); /* get/create library table */ + lua_insert(L, -(nup + 1)); /* move library table to below upvalues */ + } + if (l) + luaL_setfuncs(L, l, nup); + else + lua_pop(L, nup); /* remove upvalues */ +} + +#endif +/* }====================================================== */ + +/* +** set functions from list 'l' into table at top - 'nup'; each +** function gets the 'nup' elements at the top as upvalues. +** Returns with only the table at the stack. +*/ +LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { + luaL_checkstack(L, nup, "too many upvalues"); + for (; l->name != NULL; l++) { /* fill the table with given functions */ + int i; + for (i = 0; i < nup; i++) /* copy upvalues to the top */ + lua_pushvalue(L, -nup); + lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ + lua_setfield(L, -(nup + 2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + +/* +** ensure that stack[idx][fname] has a table and push that table +** into the stack +*/ +LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { + if (lua_getfield(L, idx, fname) == LUA_TTABLE) + return 1; /* table already there */ + else { + lua_pop(L, 1); /* remove previous result */ + idx = lua_absindex(L, idx); + lua_newtable(L); + lua_pushvalue(L, -1); /* copy to be left at top */ + lua_setfield(L, idx, fname); /* assign new table to field */ + return 0; /* false, because did not find table there */ + } +} + + +/* +** Stripped-down 'require': After checking "loaded" table, calls 'openf' +** to open a module, registers the result in 'package.loaded' table and, +** if 'glb' is true, also registers the result in the global table. +** Leaves resulting module on the top. +*/ +LUALIB_API void luaL_requiref (lua_State *L, const char *modname, + lua_CFunction openf, int glb) { + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + lua_getfield(L, -1, modname); /* LOADED[modname] */ + if (!lua_toboolean(L, -1)) { /* package not already loaded? */ + lua_pop(L, 1); /* remove field */ + lua_pushcfunction(L, openf); + lua_pushstring(L, modname); /* argument to open function */ + lua_call(L, 1, 1); /* call 'openf' to open module */ + lua_pushvalue(L, -1); /* make copy of module (call result) */ + lua_setfield(L, -3, modname); /* LOADED[modname] = module */ + } + lua_remove(L, -2); /* remove LOADED table */ + if (glb) { + lua_pushvalue(L, -1); /* copy of module */ + lua_setglobal(L, modname); /* _G[modname] = module */ + } +} + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after 'p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; (void)osize; /* not used */ + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; /* return to Lua to abort */ +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + + +LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { + const lua_Number *v = lua_version(L); + if (sz != LUAL_NUMSIZES) /* check numeric types */ + luaL_error(L, "core and library have incompatible numeric types"); + if (v != lua_version(NULL)) + luaL_error(L, "multiple Lua VMs detected"); + else if (*v != ver) + luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", + (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v); +} + diff --git a/deps/lua/src/lauxlib.h b/deps/lua/src/lauxlib.h new file mode 100644 index 0000000000..9857d3a835 --- /dev/null +++ b/deps/lua/src/lauxlib.h @@ -0,0 +1,264 @@ +/* +** $Id: lauxlib.h,v 1.131.1.1 2017/04/19 17:20:42 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + + +/* extra error code for 'luaL_loadfilex' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +/* key, in the registry, for table of loaded modules */ +#define LUA_LOADED_TABLE "_LOADED" + + +/* key, in the registry, for table of preloaded loaders */ +#define LUA_PRELOAD_TABLE "_PRELOAD" + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + +#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number)) + +LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz); +#define luaL_checkversion(L) \ + luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES) + +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); +LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int arg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); +LUALIB_API int (luaL_execresult) (lua_State *L, int stat); + +/* predefined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, + const char *mode); + +#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) + +LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, + const char *name, const char *mode); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + +LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); + +LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); + +LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, + const char *msg, int level); + +LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, + lua_CFunction openf, int glb); + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + + +#define luaL_newlibtable(L,l) \ + lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) + +#define luaL_newlib(L,l) \ + (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) + +#define luaL_argcheck(L, cond,arg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (arg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + +typedef struct luaL_Buffer { + char *b; /* buffer address */ + size_t size; /* buffer size */ + size_t n; /* number of characters in buffer */ + lua_State *L; + char initb[LUAL_BUFFERSIZE]; /* initial buffer */ +} luaL_Buffer; + + +#define luaL_addchar(B,c) \ + ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ + ((B)->b[(B)->n++] = (c))) + +#define luaL_addsize(B,s) ((B)->n += (s)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); +LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); + +#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) + +/* }====================================================== */ + + + +/* +** {====================================================== +** File handles for IO library +** ======================================================= +*/ + +/* +** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and +** initial structure 'luaL_Stream' (it may contain other fields +** after that initial structure). +*/ + +#define LUA_FILEHANDLE "FILE*" + + +typedef struct luaL_Stream { + FILE *f; /* stream (NULL for incompletely created streams) */ + lua_CFunction closef; /* to close stream (NULL for closed streams) */ +} luaL_Stream; + +/* }====================================================== */ + + + +/* compatibility with old module system */ +#if defined(LUA_COMPAT_MODULE) + +LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, + int sizehint); +LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); + +#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) + +#endif + + +/* +** {================================================================== +** "Abstraction Layer" for basic report of messages and errors +** =================================================================== +*/ + +/* print a string */ +#if !defined(lua_writestring) +#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) +#endif + +/* print a newline and flush the output */ +#if !defined(lua_writeline) +#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) +#endif + +/* print an error message */ +#if !defined(lua_writestringerror) +#define lua_writestringerror(s,p) \ + (fprintf(stderr, (s), (p)), fflush(stderr)) +#endif + +/* }================================================================== */ + + +/* +** {============================================================ +** Compatibility with deprecated conversions +** ============================================================= +*/ +#if defined(LUA_COMPAT_APIINTCASTS) + +#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) +#define luaL_optunsigned(L,a,d) \ + ((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d))) + +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) + +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#endif +/* }============================================================ */ + + + +#endif + + diff --git a/deps/lua/src/lbaselib.c b/deps/lua/src/lbaselib.c new file mode 100644 index 0000000000..6460e4f8d4 --- /dev/null +++ b/deps/lua/src/lbaselib.c @@ -0,0 +1,498 @@ +/* +** $Id: lbaselib.c,v 1.314.1.1 2017/04/19 17:39:34 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + +#define lbaselib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + size_t l; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tolstring(L, -1, &l); /* get result */ + if (s == NULL) + return luaL_error(L, "'tostring' must return a string to 'print'"); + if (i>1) lua_writestring("\t", 1); + lua_writestring(s, l); + lua_pop(L, 1); /* pop result */ + } + lua_writeline(); + return 0; +} + + +#define SPACECHARS " \f\n\r\t\v" + +static const char *b_str2int (const char *s, int base, lua_Integer *pn) { + lua_Unsigned n = 0; + int neg = 0; + s += strspn(s, SPACECHARS); /* skip initial spaces */ + if (*s == '-') { s++; neg = 1; } /* handle signal */ + else if (*s == '+') s++; + if (!isalnum((unsigned char)*s)) /* no digit? */ + return NULL; + do { + int digit = (isdigit((unsigned char)*s)) ? *s - '0' + : (toupper((unsigned char)*s) - 'A') + 10; + if (digit >= base) return NULL; /* invalid numeral */ + n = n * base + digit; + s++; + } while (isalnum((unsigned char)*s)); + s += strspn(s, SPACECHARS); /* skip trailing spaces */ + *pn = (lua_Integer)((neg) ? (0u - n) : n); + return s; +} + + +static int luaB_tonumber (lua_State *L) { + if (lua_isnoneornil(L, 2)) { /* standard conversion? */ + luaL_checkany(L, 1); + if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ + lua_settop(L, 1); /* yes; return it */ + return 1; + } + else { + size_t l; + const char *s = lua_tolstring(L, 1, &l); + if (s != NULL && lua_stringtonumber(L, s) == l + 1) + return 1; /* successful conversion to number */ + /* else not a number */ + } + } + else { + size_t l; + const char *s; + lua_Integer n = 0; /* to avoid warnings */ + lua_Integer base = luaL_checkinteger(L, 2); + luaL_checktype(L, 1, LUA_TSTRING); /* no numbers as strings */ + s = lua_tolstring(L, 1, &l); + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + if (b_str2int(s, (int)base, &n) == s + l) { + lua_pushinteger(L, n); + return 1; + } /* else not a number */ + } /* else not a number */ + lua_pushnil(L); /* not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = (int)luaL_optinteger(L, 2, 1); + lua_settop(L, 1); + if (lua_type(L, 1) == LUA_TSTRING && level > 0) { + luaL_where(L, level); /* add extra information */ + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL) + return luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawlen (lua_State *L) { + int t = lua_type(L, 1); + luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1, + "table or string expected"); + lua_pushinteger(L, lua_rawlen(L, 1)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", + "isrunning", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, + LUA_GCISRUNNING}; + int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; + int ex = (int)luaL_optinteger(L, 2, 0); + int res = lua_gc(L, o, ex); + switch (o) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, (lua_Number)res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: case LUA_GCISRUNNING: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushinteger(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + int t = lua_type(L, 1); + luaL_argcheck(L, t != LUA_TNONE, 1, "value expected"); + lua_pushstring(L, lua_typename(L, t)); + return 1; +} + + +static int pairsmeta (lua_State *L, const char *method, int iszero, + lua_CFunction iter) { + luaL_checkany(L, 1); + if (luaL_getmetafield(L, 1, method) == LUA_TNIL) { /* no metamethod? */ + lua_pushcfunction(L, iter); /* will return generator, */ + lua_pushvalue(L, 1); /* state, */ + if (iszero) lua_pushinteger(L, 0); /* and initial value */ + else lua_pushnil(L); + } + else { + lua_pushvalue(L, 1); /* argument 'self' to metamethod */ + lua_call(L, 1, 3); /* get 3 values from metamethod */ + } + return 3; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + return pairsmeta(L, "__pairs", 0, luaB_next); +} + + +/* +** Traversal function for 'ipairs' +*/ +static int ipairsaux (lua_State *L) { + lua_Integer i = luaL_checkinteger(L, 2) + 1; + lua_pushinteger(L, i); + return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; +} + + +/* +** 'ipairs' function. Returns 'ipairsaux', given "table", 0. +** (The given "table" may not be a table.) +*/ +static int luaB_ipairs (lua_State *L) { +#if defined(LUA_COMPAT_IPAIRS) + return pairsmeta(L, "__ipairs", 1, ipairsaux); +#else + luaL_checkany(L, 1); + lua_pushcfunction(L, ipairsaux); /* iteration function */ + lua_pushvalue(L, 1); /* state */ + lua_pushinteger(L, 0); /* initial value */ + return 3; +#endif +} + + +static int load_aux (lua_State *L, int status, int envidx) { + if (status == LUA_OK) { + if (envidx != 0) { /* 'env' parameter? */ + lua_pushvalue(L, envidx); /* environment for loaded function */ + if (!lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */ + lua_pop(L, 1); /* remove 'env' if not used by previous call */ + } + return 1; + } + else { /* error (message is on top of the stack) */ + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + const char *mode = luaL_optstring(L, 2, NULL); + int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ + int status = luaL_loadfilex(L, fname, mode); + return load_aux(L, status, env); +} + + +/* +** {====================================================== +** Generic Read function +** ======================================================= +*/ + + +/* +** reserved slot, above all arguments, to hold a copy of the returned +** string to avoid it being collected while parsed. 'load' has four +** optional arguments (chunk, source name, mode, and environment). +*/ +#define RESERVEDSLOT 5 + + +/* +** Reader for generic 'load' function: 'lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)(ud); /* not used */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* pop result */ + *size = 0; + return NULL; + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "reader function must return a string"); + lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ + return lua_tolstring(L, RESERVEDSLOT, size); +} + + +static int luaB_load (lua_State *L) { + int status; + size_t l; + const char *s = lua_tolstring(L, 1, &l); + const char *mode = luaL_optstring(L, 3, "bt"); + int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ + if (s != NULL) { /* loading a string? */ + const char *chunkname = luaL_optstring(L, 2, s); + status = luaL_loadbufferx(L, s, l, chunkname, mode); + } + else { /* loading from a reader function */ + const char *chunkname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, RESERVEDSLOT); /* create reserved slot */ + status = lua_load(L, generic_reader, NULL, chunkname, mode); + } + return load_aux(L, status, env); +} + +/* }====================================================== */ + + +static int dofilecont (lua_State *L, int d1, lua_KContext d2) { + (void)d1; (void)d2; /* only to match 'lua_Kfunction' prototype */ + return lua_gettop(L) - 1; +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + lua_settop(L, 1); + if (luaL_loadfile(L, fname) != LUA_OK) + return lua_error(L); + lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); + return dofilecont(L, 0, 0); +} + + +static int luaB_assert (lua_State *L) { + if (lua_toboolean(L, 1)) /* condition is true? */ + return lua_gettop(L); /* return all arguments */ + else { /* error */ + luaL_checkany(L, 1); /* there must be a condition */ + lua_remove(L, 1); /* remove it */ + lua_pushliteral(L, "assertion failed!"); /* default message */ + lua_settop(L, 1); /* leave only message (default if no other one) */ + return luaB_error(L); /* call 'error' */ + } +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + lua_Integer i = luaL_checkinteger(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - (int)i; + } +} + + +/* +** Continuation function for 'pcall' and 'xpcall'. Both functions +** already pushed a 'true' before doing the call, so in case of success +** 'finishpcall' only has to return everything in the stack minus +** 'extra' values (where 'extra' is exactly the number of items to be +** ignored). +*/ +static int finishpcall (lua_State *L, int status, lua_KContext extra) { + if (status != LUA_OK && status != LUA_YIELD) { /* error? */ + lua_pushboolean(L, 0); /* first result (false) */ + lua_pushvalue(L, -2); /* error message */ + return 2; /* return false, msg */ + } + else + return lua_gettop(L) - (int)extra; /* return all results */ +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + lua_pushboolean(L, 1); /* first result if no errors */ + lua_insert(L, 1); /* put it in place */ + status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, finishpcall); + return finishpcall(L, status, 0); +} + + +/* +** Do a protected call with error handling. After 'lua_rotate', the +** stack will have ; so, the function passes +** 2 to 'finishpcall' to skip the 2 first values when returning results. +*/ +static int luaB_xpcall (lua_State *L) { + int status; + int n = lua_gettop(L); + luaL_checktype(L, 2, LUA_TFUNCTION); /* check error function */ + lua_pushboolean(L, 1); /* first result */ + lua_pushvalue(L, 1); /* function */ + lua_rotate(L, 3, 2); /* move them below function's arguments */ + status = lua_pcallk(L, n - 2, LUA_MULTRET, 2, 2, finishpcall); + return finishpcall(L, status, 2); +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + luaL_tolstring(L, 1, NULL); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"getmetatable", luaB_getmetatable}, + {"ipairs", luaB_ipairs}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, +#if defined(LUA_COMPAT_LOADSTRING) + {"loadstring", luaB_load}, +#endif + {"next", luaB_next}, + {"pairs", luaB_pairs}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawlen", luaB_rawlen}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"xpcall", luaB_xpcall}, + /* placeholders */ + {"_G", NULL}, + {"_VERSION", NULL}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_base (lua_State *L) { + /* open lib into global table */ + lua_pushglobaltable(L); + luaL_setfuncs(L, base_funcs, 0); + /* set global _G */ + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_G"); + /* set global _VERSION */ + lua_pushliteral(L, LUA_VERSION); + lua_setfield(L, -2, "_VERSION"); + return 1; +} + diff --git a/deps/lua/src/lbitlib.c b/deps/lua/src/lbitlib.c new file mode 100644 index 0000000000..4786c0d483 --- /dev/null +++ b/deps/lua/src/lbitlib.c @@ -0,0 +1,233 @@ +/* +** $Id: lbitlib.c,v 1.30.1.1 2017/04/19 17:20:42 roberto Exp $ +** Standard library for bitwise operations +** See Copyright Notice in lua.h +*/ + +#define lbitlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#if defined(LUA_COMPAT_BITLIB) /* { */ + + +#define pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) +#define checkunsigned(L,i) ((lua_Unsigned)luaL_checkinteger(L,i)) + + +/* number of bits to consider in a number */ +#if !defined(LUA_NBITS) +#define LUA_NBITS 32 +#endif + + +/* +** a lua_Unsigned with its first LUA_NBITS bits equal to 1. (Shift must +** be made in two parts to avoid problems when LUA_NBITS is equal to the +** number of bits in a lua_Unsigned.) +*/ +#define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1)) + + +/* macro to trim extra bits */ +#define trim(x) ((x) & ALLONES) + + +/* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */ +#define mask(n) (~((ALLONES << 1) << ((n) - 1))) + + + +static lua_Unsigned andaux (lua_State *L) { + int i, n = lua_gettop(L); + lua_Unsigned r = ~(lua_Unsigned)0; + for (i = 1; i <= n; i++) + r &= checkunsigned(L, i); + return trim(r); +} + + +static int b_and (lua_State *L) { + lua_Unsigned r = andaux(L); + pushunsigned(L, r); + return 1; +} + + +static int b_test (lua_State *L) { + lua_Unsigned r = andaux(L); + lua_pushboolean(L, r != 0); + return 1; +} + + +static int b_or (lua_State *L) { + int i, n = lua_gettop(L); + lua_Unsigned r = 0; + for (i = 1; i <= n; i++) + r |= checkunsigned(L, i); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_xor (lua_State *L) { + int i, n = lua_gettop(L); + lua_Unsigned r = 0; + for (i = 1; i <= n; i++) + r ^= checkunsigned(L, i); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_not (lua_State *L) { + lua_Unsigned r = ~checkunsigned(L, 1); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) { + if (i < 0) { /* shift right? */ + i = -i; + r = trim(r); + if (i >= LUA_NBITS) r = 0; + else r >>= i; + } + else { /* shift left */ + if (i >= LUA_NBITS) r = 0; + else r <<= i; + r = trim(r); + } + pushunsigned(L, r); + return 1; +} + + +static int b_lshift (lua_State *L) { + return b_shift(L, checkunsigned(L, 1), luaL_checkinteger(L, 2)); +} + + +static int b_rshift (lua_State *L) { + return b_shift(L, checkunsigned(L, 1), -luaL_checkinteger(L, 2)); +} + + +static int b_arshift (lua_State *L) { + lua_Unsigned r = checkunsigned(L, 1); + lua_Integer i = luaL_checkinteger(L, 2); + if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1)))) + return b_shift(L, r, -i); + else { /* arithmetic shift for 'negative' number */ + if (i >= LUA_NBITS) r = ALLONES; + else + r = trim((r >> i) | ~(trim(~(lua_Unsigned)0) >> i)); /* add signal bit */ + pushunsigned(L, r); + return 1; + } +} + + +static int b_rot (lua_State *L, lua_Integer d) { + lua_Unsigned r = checkunsigned(L, 1); + int i = d & (LUA_NBITS - 1); /* i = d % NBITS */ + r = trim(r); + if (i != 0) /* avoid undefined shift of LUA_NBITS when i == 0 */ + r = (r << i) | (r >> (LUA_NBITS - i)); + pushunsigned(L, trim(r)); + return 1; +} + + +static int b_lrot (lua_State *L) { + return b_rot(L, luaL_checkinteger(L, 2)); +} + + +static int b_rrot (lua_State *L) { + return b_rot(L, -luaL_checkinteger(L, 2)); +} + + +/* +** get field and width arguments for field-manipulation functions, +** checking whether they are valid. +** ('luaL_error' called without 'return' to avoid later warnings about +** 'width' being used uninitialized.) +*/ +static int fieldargs (lua_State *L, int farg, int *width) { + lua_Integer f = luaL_checkinteger(L, farg); + lua_Integer w = luaL_optinteger(L, farg + 1, 1); + luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); + luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); + if (f + w > LUA_NBITS) + luaL_error(L, "trying to access non-existent bits"); + *width = (int)w; + return (int)f; +} + + +static int b_extract (lua_State *L) { + int w; + lua_Unsigned r = trim(checkunsigned(L, 1)); + int f = fieldargs(L, 2, &w); + r = (r >> f) & mask(w); + pushunsigned(L, r); + return 1; +} + + +static int b_replace (lua_State *L) { + int w; + lua_Unsigned r = trim(checkunsigned(L, 1)); + lua_Unsigned v = trim(checkunsigned(L, 2)); + int f = fieldargs(L, 3, &w); + lua_Unsigned m = mask(w); + r = (r & ~(m << f)) | ((v & m) << f); + pushunsigned(L, r); + return 1; +} + + +static const luaL_Reg bitlib[] = { + {"arshift", b_arshift}, + {"band", b_and}, + {"bnot", b_not}, + {"bor", b_or}, + {"bxor", b_xor}, + {"btest", b_test}, + {"extract", b_extract}, + {"lrotate", b_lrot}, + {"lshift", b_lshift}, + {"replace", b_replace}, + {"rrotate", b_rrot}, + {"rshift", b_rshift}, + {NULL, NULL} +}; + + + +LUAMOD_API int luaopen_bit32 (lua_State *L) { + luaL_newlib(L, bitlib); + return 1; +} + + +#else /* }{ */ + + +LUAMOD_API int luaopen_bit32 (lua_State *L) { + return luaL_error(L, "library 'bit32' has been deprecated"); +} + +#endif /* } */ diff --git a/deps/lua/src/lcode.c b/deps/lua/src/lcode.c new file mode 100644 index 0000000000..12619f54a0 --- /dev/null +++ b/deps/lua/src/lcode.c @@ -0,0 +1,1203 @@ +/* +** $Id: lcode.c,v 2.112.1.1 2017/04/19 17:20:42 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#define lcode_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstring.h" +#include "ltable.h" +#include "lvm.h" + + +/* Maximum number of registers in a Lua function (must fit in 8 bits) */ +#define MAXREGS 255 + + +#define hasjumps(e) ((e)->t != (e)->f) + + +/* +** If expression is a numeric constant, fills 'v' with its value +** and returns 1. Otherwise, returns 0. +*/ +static int tonumeral(const expdesc *e, TValue *v) { + if (hasjumps(e)) + return 0; /* not a numeral */ + switch (e->k) { + case VKINT: + if (v) setivalue(v, e->u.ival); + return 1; + case VKFLT: + if (v) setfltvalue(v, e->u.nval); + return 1; + default: return 0; + } +} + + +/* +** Create a OP_LOADNIL instruction, but try to optimize: if the previous +** instruction is also OP_LOADNIL and ranges are compatible, adjust +** range of previous instruction instead of emitting a new one. (For +** instance, 'local a; local b' will generate a single opcode.) +*/ +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + int l = from + n - 1; /* last register to set nil */ + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { /* previous is LOADNIL? */ + int pfrom = GETARG_A(*previous); /* get previous range */ + int pl = pfrom + GETARG_B(*previous); + if ((pfrom <= from && from <= pl + 1) || + (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */ + if (pfrom < from) from = pfrom; /* from = min(from, pfrom) */ + if (pl > l) l = pl; /* l = max(l, pl) */ + SETARG_A(*previous, from); + SETARG_B(*previous, l - from); + return; + } + } /* else go through */ + } + luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */ +} + + +/* +** Gets the destination address of a jump instruction. Used to traverse +** a list of jumps. +*/ +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +/* +** Fix jump instruction at position 'pc' to jump to 'dest'. +** (Jump addresses are relative in Lua) +*/ +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest - (pc + 1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** Concatenate jump-list 'l2' into jump-list 'l1' +*/ +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; /* nothing to concatenate? */ + else if (*l1 == NO_JUMP) /* no original list? */ + *l1 = l2; /* 'l1' points to 'l2' */ + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); /* last element links to 'l2' */ + } +} + + +/* +** Create a jump instruction and return its position, so its destination +** can be fixed later (with 'fixjump'). If there are jumps to +** this position (kept in 'jpc'), link them all together so that +** 'patchlistaux' will fix all them directly to the final destination. +*/ +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; /* no more jumps to here */ + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +/* +** Code a 'return' instruction +*/ +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +/* +** Code a "conditional jump", that is, a test or comparison opcode +** followed by a jump. Return jump position. +*/ +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +/* +** returns current 'pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +/* +** Returns the position of the instruction "controlling" a given +** jump (that is, its condition), or the jump itself if it is +** unconditional. +*/ +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** Patch destination register for a TESTSET instruction. +** If instruction in position 'node' is not a TESTSET, return 0 ("fails"). +** Otherwise, if 'reg' is not 'NO_REG', set it as the destination +** register. Otherwise, change instruction to a simple 'TEST' (produces +** no register value) +*/ +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else { + /* no register to put value or register already has the value; + change instruction to simple test */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + } + return 1; +} + + +/* +** Traverse a list of tests ensuring no one produces a value +*/ +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +/* +** Traverse a list of tests, patching their destination address and +** registers: tests producing values jump to 'vtarget' (and put their +** values in 'reg'), other tests jump to 'dtarget'. +*/ +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +/* +** Ensure all pending jumps to current position are fixed (jumping +** to current position with no values) and reset list of pending +** jumps +*/ +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +/* +** Add elements in 'list' to list of pending jumps to "here" +** (current position) +*/ +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); /* mark "here" as a jump target */ + luaK_concat(fs, &fs->jpc, list); +} + + +/* +** Path all jumps in 'list' to jump to 'target'. +** (The assert means that we cannot fix a jump to a forward address +** because we only know addresses once code is generated.) +*/ +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) /* 'target' is current position? */ + luaK_patchtohere(fs, list); /* add list to pending jumps */ + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +/* +** Path all jumps in 'list' to close upvalues up to given 'level' +** (The assertion checks that jumps either were closing nothing +** or were closing higher levels, from inner blocks.) +*/ +void luaK_patchclose (FuncState *fs, int list, int level) { + level++; /* argument is +1 to reserve 0 as non-op */ + for (; list != NO_JUMP; list = getjump(fs, list)) { + lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP && + (GETARG_A(fs->f->code[list]) == 0 || + GETARG_A(fs->f->code[list]) >= level)); + SETARG_A(fs->f->code[list], level); + } +} + + +/* +** Emit instruction 'i', checking for array sizes and saving also its +** line information. Return 'i' position. +*/ +static int luaK_code (FuncState *fs, Instruction i) { + Proto *f = fs->f; + dischargejpc(fs); /* 'pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "opcodes"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "opcodes"); + f->lineinfo[fs->pc] = fs->ls->lastline; + return fs->pc++; +} + + +/* +** Format and emit an 'iABC' instruction. (Assertions check consistency +** of parameters versus opcode.) +*/ +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C); + return luaK_code(fs, CREATE_ABC(o, a, b, c)); +} + + +/* +** Format and emit an 'iABx' instruction. +*/ +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx); + return luaK_code(fs, CREATE_ABx(o, a, bc)); +} + + +/* +** Emit an "extra argument" instruction (format 'iAx') +*/ +static int codeextraarg (FuncState *fs, int a) { + lua_assert(a <= MAXARG_Ax); + return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a)); +} + + +/* +** Emit a "load constant" instruction, using either 'OP_LOADK' +** (if constant index 'k' fits in 18 bits) or an 'OP_LOADKX' +** instruction with "extra argument". +*/ +int luaK_codek (FuncState *fs, int reg, int k) { + if (k <= MAXARG_Bx) + return luaK_codeABx(fs, OP_LOADK, reg, k); + else { + int p = luaK_codeABx(fs, OP_LOADKX, reg, 0); + codeextraarg(fs, k); + return p; + } +} + + +/* +** Check register-stack level, keeping track of its maximum size +** in field 'maxstacksize' +*/ +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXREGS) + luaX_syntaxerror(fs->ls, + "function or expression needs too many registers"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +/* +** Reserve 'n' registers in register stack +*/ +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +/* +** Free register 'reg', if it is neither a constant index nor +** a local variable. +) +*/ +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +/* +** Free register used by expression 'e' (if any) +*/ +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.info); +} + + +/* +** Free registers used by expressions 'e1' and 'e2' (if any) in proper +** order. +*/ +static void freeexps (FuncState *fs, expdesc *e1, expdesc *e2) { + int r1 = (e1->k == VNONRELOC) ? e1->u.info : -1; + int r2 = (e2->k == VNONRELOC) ? e2->u.info : -1; + if (r1 > r2) { + freereg(fs, r1); + freereg(fs, r2); + } + else { + freereg(fs, r2); + freereg(fs, r1); + } +} + + +/* +** Add constant 'v' to prototype's list of constants (field 'k'). +** Use scanner's table to cache position of constants in constant list +** and try to reuse constants. Because some values should not be used +** as keys (nil cannot be a key, integer keys can collapse with float +** keys), the caller must provide a useful 'key' for indexing the cache. +*/ +static int addk (FuncState *fs, TValue *key, TValue *v) { + lua_State *L = fs->ls->L; + Proto *f = fs->f; + TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */ + int k, oldsize; + if (ttisinteger(idx)) { /* is there an index there? */ + k = cast_int(ivalue(idx)); + /* correct value? (warning: must distinguish floats from integers!) */ + if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && + luaV_rawequalobj(&f->k[k], v)) + return k; /* reuse index */ + } + /* constant not found; create a new entry */ + oldsize = f->sizek; + k = fs->nk; + /* numerical value does not need GC barrier; + table has no metatable, so it does not need to invalidate cache */ + setivalue(idx, k); + luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[k], v); + fs->nk++; + luaC_barrier(L, f, v); + return k; +} + + +/* +** Add a string to list of constants and return its index. +*/ +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->ls->L, &o, s); + return addk(fs, &o, &o); /* use string itself as key */ +} + + +/* +** Add an integer to list of constants and return its index. +** Integers use userdata as keys to avoid collision with floats with +** same value; conversion to 'void*' is used only for hashing, so there +** are no "precision" problems. +*/ +int luaK_intK (FuncState *fs, lua_Integer n) { + TValue k, o; + setpvalue(&k, cast(void*, cast(size_t, n))); + setivalue(&o, n); + return addk(fs, &k, &o); +} + +/* +** Add a float to list of constants and return its index. +*/ +static int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setfltvalue(&o, r); + return addk(fs, &o, &o); /* use number itself as key */ +} + + +/* +** Add a boolean to list of constants and return its index. +*/ +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); /* use boolean itself as key */ +} + + +/* +** Add nil to list of constants and return its index. +*/ +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->ls->L, &k, fs->ls->h); + return addk(fs, &k, &v); +} + + +/* +** Fix an expression to return the number of results 'nresults'. +** Either 'e' is a multi-ret expression (function call or vararg) +** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). +*/ +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getinstruction(fs, e), nresults + 1); + } + else if (e->k == VVARARG) { + Instruction *pc = &getinstruction(fs, e); + SETARG_B(*pc, nresults + 1); + SETARG_A(*pc, fs->freereg); + luaK_reserveregs(fs, 1); + } + else lua_assert(nresults == LUA_MULTRET); +} + + +/* +** Fix an expression to return one result. +** If expression is not a multi-ret expression (function call or +** vararg), it already returns one result, so nothing needs to be done. +** Function calls become VNONRELOC expressions (as its result comes +** fixed in the base register of the call), while vararg expressions +** become VRELOCABLE (as OP_VARARG puts its results where it wants). +** (Calls are created returning one result, so that does not need +** to be fixed.) +*/ +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + /* already returns 1 value */ + lua_assert(GETARG_C(getinstruction(fs, e)) == 2); + e->k = VNONRELOC; /* result has fixed position */ + e->u.info = GETARG_A(getinstruction(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getinstruction(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +/* +** Ensure that expression 'e' is not a variable. +*/ +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { /* already in a register */ + e->k = VNONRELOC; /* becomes a non-relocatable value */ + break; + } + case VUPVAL: { /* move value to some (pending) register */ + e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + OpCode op; + freereg(fs, e->u.ind.idx); + if (e->u.ind.vt == VLOCAL) { /* is 't' in a register? */ + freereg(fs, e->u.ind.t); + op = OP_GETTABLE; + } + else { + lua_assert(e->u.ind.vt == VUPVAL); + op = OP_GETTABUP; /* 't' is in an upvalue */ + } + e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx); + e->k = VRELOCABLE; + break; + } + case VVARARG: case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +/* +** Ensures expression value is in register 'reg' (and therefore +** 'e' will become a non-relocatable expression). +*/ +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codek(fs, reg, e->u.info); + break; + } + case VKFLT: { + luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VKINT: { + luaK_codek(fs, reg, luaK_intK(fs, e->u.ival)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getinstruction(fs, e); + SETARG_A(*pc, reg); /* instruction will put result in 'reg' */ + break; + } + case VNONRELOC: { + if (reg != e->u.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0); + break; + } + default: { + lua_assert(e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.info = reg; + e->k = VNONRELOC; +} + + +/* +** Ensures expression value is in any register. +*/ +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { /* no fixed register yet? */ + luaK_reserveregs(fs, 1); /* get a register */ + discharge2reg(fs, e, fs->freereg-1); /* put value there */ + } +} + + +static int code_loadbool (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +/* +** check whether list has any jump that do not produce a value +** or produce an inverted value +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +/* +** Ensures final expression result (including results from its jump +** lists) is in register 'reg'. +** If expression has jumps, need to patch these jumps either to +** its final position or to "load" instructions (for those tests +** that do not produce values). +*/ +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) /* expression itself is a test? */ + luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_loadbool(fs, reg, 0, 1); + p_t = code_loadbool(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.info = reg; + e->k = VNONRELOC; +} + + +/* +** Ensures final expression result (including results from its jump +** lists) is in next available register. +*/ +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +/* +** Ensures final expression result (including results from its jump +** lists) is in some (any) register and return that register. +*/ +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { /* expression already has a register? */ + if (!hasjumps(e)) /* no jumps? */ + return e->u.info; /* result is already in a register */ + if (e->u.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.info); /* put final result in it */ + return e->u.info; + } + } + luaK_exp2nextreg(fs, e); /* otherwise, use next available register */ + return e->u.info; +} + + +/* +** Ensures final expression result is either in a register or in an +** upvalue. +*/ +void luaK_exp2anyregup (FuncState *fs, expdesc *e) { + if (e->k != VUPVAL || hasjumps(e)) + luaK_exp2anyreg(fs, e); +} + + +/* +** Ensures final expression result is either in a register or it is +** a constant. +*/ +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +/* +** Ensures final expression result is in a valid R/K index +** (that is, it is either in a register or in 'k' with an index +** in the range of R/K indices). +** Returns R/K index. +*/ +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { /* move constants to 'k' */ + case VTRUE: e->u.info = boolK(fs, 1); goto vk; + case VFALSE: e->u.info = boolK(fs, 0); goto vk; + case VNIL: e->u.info = nilK(fs); goto vk; + case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk; + case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk; + case VK: + vk: + e->k = VK; + if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */ + return RKASK(e->u.info); + else break; + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +/* +** Generate code to store result of expression 'ex' into variable 'var'. +*/ +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.info); /* compute 'ex' into proper place */ + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); + break; + } + case VINDEXED: { + OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP; + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e); + break; + } + default: lua_assert(0); /* invalid var kind to store */ + } + freeexp(fs, ex); +} + + +/* +** Emit SELF instruction (convert expression 'e' into 'e:key(e,'). +*/ +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int ereg; + luaK_exp2anyreg(fs, e); + ereg = e->u.info; /* register where 'e' was placed */ + freeexp(fs, e); + e->u.info = fs->freereg; /* base register for op_self */ + e->k = VNONRELOC; /* self expression has a fixed register */ + luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ + luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key)); + freeexp(fs, key); +} + + +/* +** Negate condition 'e' (where 'e' is a comparison). +*/ +static void negatecondition (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +/* +** Emit instruction to jump if 'e' is 'cond' (that is, if 'cond' +** is true, code will jump if 'e' is true.) Return jump position. +** Optimize when 'e' is 'not' something, inverting the condition +** and removing the 'not'. +*/ +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getinstruction(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond); +} + + +/* +** Emit code to go through if 'e' is true, jump otherwise. +*/ +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of new jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VJMP: { /* condition? */ + negatecondition(fs, e); /* jump when it is false */ + pc = e->u.info; /* save jump position */ + break; + } + case VK: case VKFLT: case VKINT: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + default: { + pc = jumponcond(fs, e, 0); /* jump when false */ + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ + luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ + e->t = NO_JUMP; +} + + +/* +** Emit code to go through if 'e' is false, jump otherwise. +*/ +void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of new jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VJMP: { + pc = e->u.info; /* already jump if true */ + break; + } + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + default: { + pc = jumponcond(fs, e, 1); /* jump if true */ + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */ + luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */ + e->f = NO_JUMP; +} + + +/* +** Code 'not e', doing constant folding. +*/ +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; /* true == not nil == not false */ + break; + } + case VK: case VKFLT: case VKINT: case VTRUE: { + e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */ + break; + } + case VJMP: { + negatecondition(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0); + e->k = VRELOCABLE; + break; + } + default: lua_assert(0); /* cannot happen */ + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); /* values are useless when negated */ + removevalues(fs, e->t); +} + + +/* +** Create expression 't[k]'. 't' must have its final result already in a +** register or upvalue. +*/ +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + lua_assert(!hasjumps(t) && (vkisinreg(t->k) || t->k == VUPVAL)); + t->u.ind.t = t->u.info; /* register or upvalue index */ + t->u.ind.idx = luaK_exp2RK(fs, k); /* R/K index for key */ + t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL : VLOCAL; + t->k = VINDEXED; +} + + +/* +** Return false if folding can raise an error. +** Bitwise operations need operands convertible to integers; division +** operations cannot have 0 as divisor. +*/ +static int validop (int op, TValue *v1, TValue *v2) { + switch (op) { + case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: + case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: { /* conversion errors */ + lua_Integer i; + return (tointeger(v1, &i) && tointeger(v2, &i)); + } + case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */ + return (nvalue(v2) != 0); + default: return 1; /* everything else is valid */ + } +} + + +/* +** Try to "constant-fold" an operation; return 1 iff successful. +** (In this case, 'e1' has the final result.) +*/ +static int constfolding (FuncState *fs, int op, expdesc *e1, + const expdesc *e2) { + TValue v1, v2, res; + if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2)) + return 0; /* non-numeric operands or not safe to fold */ + luaO_arith(fs->ls->L, op, &v1, &v2, &res); /* does operation */ + if (ttisinteger(&res)) { + e1->k = VKINT; + e1->u.ival = ivalue(&res); + } + else { /* folds neither NaN nor 0.0 (to avoid problems with -0.0) */ + lua_Number n = fltvalue(&res); + if (luai_numisnan(n) || n == 0) + return 0; + e1->k = VKFLT; + e1->u.nval = n; + } + return 1; +} + + +/* +** Emit code for unary expressions that "produce values" +** (everything but 'not'). +** Expression to produce final result will be encoded in 'e'. +*/ +static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) { + int r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */ + freeexp(fs, e); + e->u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */ + e->k = VRELOCABLE; /* all those operations are relocatable */ + luaK_fixline(fs, line); +} + + +/* +** Emit code for binary expressions that "produce values" +** (everything but logical operators 'and'/'or' and comparison +** operators). +** Expression to produce final result will be encoded in 'e1'. +** Because 'luaK_exp2RK' can free registers, its calls must be +** in "stack order" (that is, first on 'e2', which may have more +** recent registers to be released). +*/ +static void codebinexpval (FuncState *fs, OpCode op, + expdesc *e1, expdesc *e2, int line) { + int rk2 = luaK_exp2RK(fs, e2); /* both operands are "RK" */ + int rk1 = luaK_exp2RK(fs, e1); + freeexps(fs, e1, e2); + e1->u.info = luaK_codeABC(fs, op, 0, rk1, rk2); /* generate opcode */ + e1->k = VRELOCABLE; /* all those operations are relocatable */ + luaK_fixline(fs, line); +} + + +/* +** Emit code for comparisons. +** 'e1' was already put in R/K form by 'luaK_infix'. +*/ +static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { + int rk1 = (e1->k == VK) ? RKASK(e1->u.info) + : check_exp(e1->k == VNONRELOC, e1->u.info); + int rk2 = luaK_exp2RK(fs, e2); + freeexps(fs, e1, e2); + switch (opr) { + case OPR_NE: { /* '(a ~= b)' ==> 'not (a == b)' */ + e1->u.info = condjump(fs, OP_EQ, 0, rk1, rk2); + break; + } + case OPR_GT: case OPR_GE: { + /* '(a > b)' ==> '(b < a)'; '(a >= b)' ==> '(b <= a)' */ + OpCode op = cast(OpCode, (opr - OPR_NE) + OP_EQ); + e1->u.info = condjump(fs, op, 1, rk2, rk1); /* invert operands */ + break; + } + default: { /* '==', '<', '<=' use their own opcodes */ + OpCode op = cast(OpCode, (opr - OPR_EQ) + OP_EQ); + e1->u.info = condjump(fs, op, 1, rk1, rk2); + break; + } + } + e1->k = VJMP; +} + + +/* +** Aplly prefix operation 'op' to expression 'e'. +*/ +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { + static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; + switch (op) { + case OPR_MINUS: case OPR_BNOT: /* use 'ef' as fake 2nd operand */ + if (constfolding(fs, op + LUA_OPUNM, e, &ef)) + break; + /* FALLTHROUGH */ + case OPR_LEN: + codeunexpval(fs, cast(OpCode, op + OP_UNM), e, line); + break; + case OPR_NOT: codenot(fs, e); break; + default: lua_assert(0); + } +} + + +/* +** Process 1st operand 'v' of binary operation 'op' before reading +** 2nd operand. +*/ +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the 'stack' */ + break; + } + case OPR_ADD: case OPR_SUB: + case OPR_MUL: case OPR_DIV: case OPR_IDIV: + case OPR_MOD: case OPR_POW: + case OPR_BAND: case OPR_BOR: case OPR_BXOR: + case OPR_SHL: case OPR_SHR: { + if (!tonumeral(v, NULL)) + luaK_exp2RK(fs, v); + /* else keep numeral, which may be folded with 2nd operand */ + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +/* +** Finalize code for binary operation, after reading 2nd operand. +** For '(a .. b .. c)' (which is '(a .. (b .. c))', because +** concatenation is right associative), merge second CONCAT into first +** one. +*/ +void luaK_posfix (FuncState *fs, BinOpr op, + expdesc *e1, expdesc *e2, int line) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list closed by 'luK_infix' */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list closed by 'luK_infix' */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && + GET_OPCODE(getinstruction(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.info == GETARG_B(getinstruction(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getinstruction(fs, e2), e1->u.info); + e1->k = VRELOCABLE; e1->u.info = e2->u.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codebinexpval(fs, OP_CONCAT, e1, e2, line); + } + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_IDIV: case OPR_MOD: case OPR_POW: + case OPR_BAND: case OPR_BOR: case OPR_BXOR: + case OPR_SHL: case OPR_SHR: { + if (!constfolding(fs, op + LUA_OPADD, e1, e2)) + codebinexpval(fs, cast(OpCode, op + OP_ADD), e1, e2, line); + break; + } + case OPR_EQ: case OPR_LT: case OPR_LE: + case OPR_NE: case OPR_GT: case OPR_GE: { + codecomp(fs, op, e1, e2); + break; + } + default: lua_assert(0); + } +} + + +/* +** Change line information associated with current position. +*/ +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +/* +** Emit a SETLIST instruction. +** 'base' is register that keeps table; +** 'nelems' is #table plus those to be stored now; +** 'tostore' is number of values (in registers 'base + 1',...) to add to +** table (or LUA_MULTRET to add up to stack top). +*/ +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else if (c <= MAXARG_Ax) { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + codeextraarg(fs, c); + } + else + luaX_syntaxerror(fs->ls, "constructor too long"); + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/deps/lua/src/lcode.h b/deps/lua/src/lcode.h new file mode 100644 index 0000000000..882dc9c156 --- /dev/null +++ b/deps/lua/src/lcode.h @@ -0,0 +1,88 @@ +/* +** $Id: lcode.h,v 1.64.1.1 2017/04/19 17:20:42 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums (ORDER OP) +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW, + OPR_DIV, + OPR_IDIV, + OPR_BAND, OPR_BOR, OPR_BXOR, + OPR_SHL, OPR_SHR, + OPR_CONCAT, + OPR_EQ, OPR_LT, OPR_LE, + OPR_NE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +/* get (pointer to) instruction of given 'expdesc' */ +#define getinstruction(fs,e) ((fs)->f->code[(e)->u.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_intK (FuncState *fs, lua_Integer n); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, + expdesc *v2, int line); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/deps/lua/src/lcorolib.c b/deps/lua/src/lcorolib.c new file mode 100644 index 0000000000..0b17af9e34 --- /dev/null +++ b/deps/lua/src/lcorolib.c @@ -0,0 +1,168 @@ +/* +** $Id: lcorolib.c,v 1.10.1.1 2017/04/19 17:20:42 roberto Exp $ +** Coroutine Library +** See Copyright Notice in lua.h +*/ + +#define lcorolib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static lua_State *getco (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "thread expected"); + return co; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status; + if (!lua_checkstack(co, narg)) { + lua_pushliteral(L, "too many arguments to resume"); + return -1; /* error flag */ + } + if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) { + lua_pushliteral(L, "cannot resume dead coroutine"); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + status = lua_resume(co, L, narg); + if (status == LUA_OK || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) { + lua_pop(co, nres); /* remove results anyway */ + lua_pushliteral(L, "too many results to resume"); + return -1; /* error flag */ + } + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = getco(L); + int r; + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + 'resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_type(L, -1) == LUA_TSTRING) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + return lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL; + luaL_checktype(L, 1, LUA_TFUNCTION); + NL = lua_newthread(L); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = getco(L); + if (L == co) lua_pushliteral(L, "running"); + else { + switch (lua_status(co)) { + case LUA_YIELD: + lua_pushliteral(L, "suspended"); + break; + case LUA_OK: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + lua_pushliteral(L, "normal"); /* it is running */ + else if (lua_gettop(co) == 0) + lua_pushliteral(L, "dead"); + else + lua_pushliteral(L, "suspended"); /* initial state */ + break; + } + default: /* some error occurred */ + lua_pushliteral(L, "dead"); + break; + } + } + return 1; +} + + +static int luaB_yieldable (lua_State *L) { + lua_pushboolean(L, lua_isyieldable(L)); + return 1; +} + + +static int luaB_corunning (lua_State *L) { + int ismain = lua_pushthread(L); + lua_pushboolean(L, ismain); + return 2; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {"isyieldable", luaB_yieldable}, + {NULL, NULL} +}; + + + +LUAMOD_API int luaopen_coroutine (lua_State *L) { + luaL_newlib(L, co_funcs); + return 1; +} + diff --git a/deps/lua/src/lctype.c b/deps/lua/src/lctype.c new file mode 100644 index 0000000000..f8ad7a2edf --- /dev/null +++ b/deps/lua/src/lctype.c @@ -0,0 +1,55 @@ +/* +** $Id: lctype.c,v 1.12.1.1 2017/04/19 17:20:42 roberto Exp $ +** 'ctype' functions for Lua +** See Copyright Notice in lua.h +*/ + +#define lctype_c +#define LUA_CORE + +#include "lprefix.h" + + +#include "lctype.h" + +#if !LUA_USE_CTYPE /* { */ + +#include + +LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { + 0x00, /* EOZ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ + 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ + 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ + 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, + 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ + 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +#endif /* } */ diff --git a/deps/lua/src/lctype.h b/deps/lua/src/lctype.h new file mode 100644 index 0000000000..b09b21a337 --- /dev/null +++ b/deps/lua/src/lctype.h @@ -0,0 +1,95 @@ +/* +** $Id: lctype.h,v 1.12.1.1 2013/04/12 18:48:47 roberto Exp $ +** 'ctype' functions for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lctype_h +#define lctype_h + +#include "lua.h" + + +/* +** WARNING: the functions defined here do not necessarily correspond +** to the similar functions in the standard C ctype.h. They are +** optimized for the specific needs of Lua +*/ + +#if !defined(LUA_USE_CTYPE) + +#if 'A' == 65 && '0' == 48 +/* ASCII case: can use its own tables; faster and fixed */ +#define LUA_USE_CTYPE 0 +#else +/* must use standard C ctype */ +#define LUA_USE_CTYPE 1 +#endif + +#endif + + +#if !LUA_USE_CTYPE /* { */ + +#include + +#include "llimits.h" + + +#define ALPHABIT 0 +#define DIGITBIT 1 +#define PRINTBIT 2 +#define SPACEBIT 3 +#define XDIGITBIT 4 + + +#define MASK(B) (1 << (B)) + + +/* +** add 1 to char to allow index -1 (EOZ) +*/ +#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) + +/* +** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' +*/ +#define lislalpha(c) testprop(c, MASK(ALPHABIT)) +#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) +#define lisdigit(c) testprop(c, MASK(DIGITBIT)) +#define lisspace(c) testprop(c, MASK(SPACEBIT)) +#define lisprint(c) testprop(c, MASK(PRINTBIT)) +#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) + +/* +** this 'ltolower' only works for alphabetic characters +*/ +#define ltolower(c) ((c) | ('A' ^ 'a')) + + +/* two more entries for 0 and -1 (EOZ) */ +LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; + + +#else /* }{ */ + +/* +** use standard C ctypes +*/ + +#include + + +#define lislalpha(c) (isalpha(c) || (c) == '_') +#define lislalnum(c) (isalnum(c) || (c) == '_') +#define lisdigit(c) (isdigit(c)) +#define lisspace(c) (isspace(c)) +#define lisprint(c) (isprint(c)) +#define lisxdigit(c) (isxdigit(c)) + +#define ltolower(c) (tolower(c)) + +#endif /* } */ + +#endif + diff --git a/deps/lua/src/ldblib.c b/deps/lua/src/ldblib.c new file mode 100644 index 0000000000..9d29afb0a8 --- /dev/null +++ b/deps/lua/src/ldblib.c @@ -0,0 +1,456 @@ +/* +** $Id: ldblib.c,v 1.151.1.1 2017/04/19 17:20:42 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + +#define ldblib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** The hook table at registry[&HOOKKEY] maps threads to their current +** hook function. (We only need the unique address of 'HOOKKEY'.) +*/ +static const int HOOKKEY = 0; + + +/* +** If L1 != L, L1 can be in any state, and therefore there are no +** guarantees about its stack space; any push in L1 must be +** checked. +*/ +static void checkstack (lua_State *L, lua_State *L1, int n) { + if (L != L1 && !lua_checkstack(L1, n)) + luaL_error(L, "stack overflow"); +} + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; /* return 1st argument */ +} + + +static int db_getuservalue (lua_State *L) { + if (lua_type(L, 1) != LUA_TUSERDATA) + lua_pushnil(L); + else + lua_getuservalue(L, 1); + return 1; +} + + +static int db_setuservalue (lua_State *L) { + luaL_checktype(L, 1, LUA_TUSERDATA); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_setuservalue(L, 1); + return 1; +} + + +/* +** Auxiliary function used by several library functions: check for +** an optional thread as function's first argument and set 'arg' with +** 1 if this argument is present (so that functions can skip it to +** access their other arguments) +*/ +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; /* function will operate over current thread */ + } +} + + +/* +** Variations of 'lua_settable', used by 'db_getinfo' to put results +** from 'lua_getinfo' into result table. Key is always a string; +** value can be a string, an int, or a boolean. +*/ +static void settabss (lua_State *L, const char *k, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, k); +} + +static void settabsi (lua_State *L, const char *k, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, k); +} + +static void settabsb (lua_State *L, const char *k, int v) { + lua_pushboolean(L, v); + lua_setfield(L, -2, k); +} + + +/* +** In function 'db_getinfo', the call to 'lua_getinfo' may push +** results on the stack; later it creates the result table to put +** these objects. Function 'treatstackoption' puts the result from +** 'lua_getinfo' on top of the result table so that it can call +** 'lua_setfield'. +*/ +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) + lua_rotate(L, -2, 1); /* exchange object and table */ + else + lua_xmove(L1, L, 1); /* move object to the "main" stack */ + lua_setfield(L, -2, fname); /* put object into table */ +} + + +/* +** Calls 'lua_getinfo' and collects all results in a new table. +** L1 needs stack space for an optional input (function) plus +** two optional outputs (function and line table) from function +** 'lua_getinfo'. +*/ +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnStu"); + checkstack(L, L1, 3); + if (lua_isfunction(L, arg + 1)) { /* info about a function? */ + options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ + lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ + lua_xmove(L, L1, 1); + } + else { /* stack level */ + if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_newtable(L); /* table to collect results */ + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) { + settabsi(L, "nups", ar.nups); + settabsi(L, "nparams", ar.nparams); + settabsb(L, "isvararg", ar.isvararg); + } + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 't')) + settabsb(L, "istailcall", ar.istailcall); + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ + if (lua_isfunction(L, arg + 1)) { /* function argument? */ + lua_pushvalue(L, arg + 1); /* push function */ + lua_pushstring(L, lua_getlocal(L, NULL, nvar)); /* push local name */ + return 1; /* return only name (there is no value) */ + } + else { /* stack-level argument */ + int level = (int)luaL_checkinteger(L, arg + 1); + if (!lua_getstack(L1, level, &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + checkstack(L, L1, 1); + name = lua_getlocal(L1, &ar, nvar); + if (name) { + lua_xmove(L1, L, 1); /* move local value */ + lua_pushstring(L, name); /* push name */ + lua_rotate(L, -2, 1); /* re-order */ + return 2; + } + else { + lua_pushnil(L); /* no name (nor value) */ + return 1; + } + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + const char *name; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + int level = (int)luaL_checkinteger(L, arg + 1); + int nvar = (int)luaL_checkinteger(L, arg + 2); + if (!lua_getstack(L1, level, &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + checkstack(L, L1, 1); + lua_xmove(L, L1, 1); + name = lua_setlocal(L1, &ar, nvar); + if (name == NULL) + lua_pop(L1, 1); /* pop value (if not popped by 'lua_setlocal') */ + lua_pushstring(L, name); + return 1; +} + + +/* +** get (if 'get' is true) or set an upvalue from a closure +*/ +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = (int)luaL_checkinteger(L, 2); /* upvalue index */ + luaL_checktype(L, 1, LUA_TFUNCTION); /* closure */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); /* no-op if get is false */ + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + +/* +** Check whether a given upvalue from a given closure exists and +** returns its index +*/ +static int checkupval (lua_State *L, int argf, int argnup) { + int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */ + luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */ + luaL_argcheck(L, (lua_getupvalue(L, argf, nup) != NULL), argnup, + "invalid upvalue index"); + return nup; +} + + +static int db_upvalueid (lua_State *L) { + int n = checkupval(L, 1, 2); + lua_pushlightuserdata(L, lua_upvalueid(L, 1, n)); + return 1; +} + + +static int db_upvaluejoin (lua_State *L) { + int n1 = checkupval(L, 1, 2); + int n2 = checkupval(L, 3, 4); + luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected"); + luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected"); + lua_upvaluejoin(L, 1, n1, 3, n2); + return 0; +} + + +/* +** Call hook function registered at hook table for the current +** thread (if there is one) +*/ +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail call"}; + lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); + lua_pushthread(L); + if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */ + lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */ + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); /* push current line */ + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); /* call hook function */ + } +} + + +/* +** Convert a string mask (for 'sethook') into a bit mask +*/ +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +/* +** Convert a bit mask (for 'gethook') into a string mask +*/ +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { /* no hook? */ + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = (int)luaL_optinteger(L, arg + 3, 0); + func = hookf; mask = makemask(smask, count); + } + if (lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY) == LUA_TNIL) { + lua_createtable(L, 0, 2); /* create a hook table */ + lua_pushvalue(L, -1); + lua_rawsetp(L, LUA_REGISTRYINDEX, &HOOKKEY); /* set it in position */ + lua_pushstring(L, "k"); + lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */ + lua_pushvalue(L, -1); + lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */ + } + checkstack(L, L1, 1); + lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */ + lua_pushvalue(L, arg + 1); /* value (hook function) */ + lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */ + lua_sethook(L1, func, mask, count); + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook == NULL) /* no hook? */ + lua_pushnil(L); + else if (hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { /* hook table must exist */ + lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); + checkstack(L, L1, 1); + lua_pushthread(L1); lua_xmove(L1, L, 1); + lua_rawget(L, -2); /* 1st result = hooktable[L1] */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */ + lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */ + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + lua_writestringerror("%s", "lua_debug> "); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) + lua_writestringerror("%s\n", lua_tostring(L, -1)); + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +static int db_traceback (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + const char *msg = lua_tostring(L, arg + 1); + if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */ + lua_pushvalue(L, arg + 1); /* return it untouched */ + else { + int level = (int)luaL_optinteger(L, arg + 2, (L == L1) ? 1 : 0); + luaL_traceback(L, L1, msg, level); + } + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getuservalue", db_getuservalue}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"upvaluejoin", db_upvaluejoin}, + {"upvalueid", db_upvalueid}, + {"setuservalue", db_setuservalue}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_traceback}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_debug (lua_State *L) { + luaL_newlib(L, dblib); + return 1; +} + diff --git a/deps/lua/src/ldebug.c b/deps/lua/src/ldebug.c new file mode 100644 index 0000000000..e1389296e9 --- /dev/null +++ b/deps/lua/src/ldebug.c @@ -0,0 +1,699 @@ +/* +** $Id: ldebug.c,v 2.121.1.2 2017/07/10 17:21:50 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + +#define ldebug_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +#define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) + + +/* Active Lua function (given call info) */ +#define ci_func(ci) (clLvalue((ci)->func)) + + +static const char *funcnamefromcode (lua_State *L, CallInfo *ci, + const char **name); + + +static int currentpc (CallInfo *ci) { + lua_assert(isLua(ci)); + return pcRel(ci->u.l.savedpc, ci_func(ci)->p); +} + + +static int currentline (CallInfo *ci) { + return getfuncline(ci_func(ci)->p, currentpc(ci)); +} + + +/* +** If function yielded, its 'func' can be in the 'extra' field. The +** next function restores 'func' to its correct value for debugging +** purposes. (It exchanges 'func' and 'extra'; so, when called again, +** after debugging, it also "re-restores" ** 'func' to its altered value. +*/ +static void swapextra (lua_State *L) { + if (L->status == LUA_YIELD) { + CallInfo *ci = L->ci; /* get function that yielded */ + StkId temp = ci->func; /* exchange its 'func' and 'extra' values */ + ci->func = restorestack(L, ci->extra); + ci->extra = savestack(L, temp); + } +} + + +/* +** This function can be called asynchronously (e.g. during a signal). +** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by +** 'resethookcount') are for debug only, and it is no problem if they +** get arbitrary values (causes at most one wrong hook call). 'hookmask' +** is an atomic value. We assume that pointers are atomic too (e.g., gcc +** ensures that for all platforms where it runs). Moreover, 'hook' is +** always checked before being called (see 'luaD_hook'). +*/ +LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + if (isLua(L->ci)) + L->oldpc = L->ci->u.l.savedpc; + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + if (level < 0) return 0; /* invalid (negative) level */ + lua_lock(L); + for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) + level--; + if (level == 0 && ci != &L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = ci; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static const char *upvalname (Proto *p, int uv) { + TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name); + if (s == NULL) return "?"; + else return getstr(s); +} + + +static const char *findvararg (CallInfo *ci, int n, StkId *pos) { + int nparams = clLvalue(ci->func)->p->numparams; + if (n >= cast_int(ci->u.l.base - ci->func) - nparams) + return NULL; /* no such vararg */ + else { + *pos = ci->func + nparams + n; + return "(*vararg)"; /* generic name for any vararg */ + } +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n, + StkId *pos) { + const char *name = NULL; + StkId base; + if (isLua(ci)) { + if (n < 0) /* access to vararg values? */ + return findvararg(ci, -n, pos); + else { + base = ci->u.l.base; + name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); + } + } + else + base = ci->func + 1; + if (name == NULL) { /* no 'standard' name? */ + StkId limit = (ci == L->ci) ? L->top : ci->next->func; + if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + name = "(*temporary)"; /* generic name for any valid slot */ + else + return NULL; /* no name */ + } + *pos = base + (n - 1); + return name; +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + const char *name; + lua_lock(L); + swapextra(L); + if (ar == NULL) { /* information about non-active function? */ + if (!isLfunction(L->top - 1)) /* not a Lua function? */ + name = NULL; + else /* consider live variables at function start (parameters) */ + name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); + } + else { /* active function; get information through 'ar' */ + StkId pos = NULL; /* to avoid warnings */ + name = findlocal(L, ar->i_ci, n, &pos); + if (name) { + setobj2s(L, L->top, pos); + api_incr_top(L); + } + } + swapextra(L); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + StkId pos = NULL; /* to avoid warnings */ + const char *name; + lua_lock(L); + swapextra(L); + name = findlocal(L, ar->i_ci, n, &pos); + if (name) { + setobjs2s(L, pos, L->top - 1); + L->top--; /* pop value */ + } + swapextra(L); + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (noLuaClosure(cl)) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + Proto *p = cl->l.p; + ar->source = p->source ? getstr(p->source) : "=?"; + ar->linedefined = p->linedefined; + ar->lastlinedefined = p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (noLuaClosure(f)) { + setnilvalue(L->top); + api_incr_top(L); + } + else { + int i; + TValue v; + int *lineinfo = f->l.p->lineinfo; + Table *t = luaH_new(L); /* new table to store active lines */ + sethvalue(L, L->top, t); /* push it on stack */ + api_incr_top(L); + setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ + for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */ + luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ + } +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + if (ci == NULL) /* no 'ci'? */ + return NULL; /* no info */ + else if (ci->callstatus & CIST_FIN) { /* is this a finalizer? */ + *name = "__gc"; + return "metamethod"; /* report it as such */ + } + /* calling function is a known Lua function? */ + else if (!(ci->callstatus & CIST_TAIL) && isLua(ci->previous)) + return funcnamefromcode(L, ci->previous, name); + else return NULL; /* no way to find a name */ +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1; + break; + } + case 'u': { + ar->nups = (f == NULL) ? 0 : f->c.nupvalues; + if (noLuaClosure(f)) { + ar->isvararg = 1; + ar->nparams = 0; + } + else { + ar->isvararg = f->l.p->is_vararg; + ar->nparams = f->l.p->numparams; + } + break; + } + case 't': { + ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; + break; + } + case 'n': { + ar->namewhat = getfuncname(L, ci, &ar->name); + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *cl; + CallInfo *ci; + StkId func; + lua_lock(L); + swapextra(L); + if (*what == '>') { + ci = NULL; + func = L->top - 1; + api_check(L, ttisfunction(func), "function expected"); + what++; /* skip the '>' */ + L->top--; /* pop function */ + } + else { + ci = ar->i_ci; + func = ci->func; + lua_assert(ttisfunction(ci->func)); + } + cl = ttisclosure(func) ? clvalue(func) : NULL; + status = auxgetinfo(L, what, ar, cl, ci); + if (strchr(what, 'f')) { + setobjs2s(L, L->top, func); + api_incr_top(L); + } + swapextra(L); /* correct before option 'L', which can raise a mem. error */ + if (strchr(what, 'L')) + collectvalidlines(L, cl); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution +** ======================================================= +*/ + +static const char *getobjname (Proto *p, int lastpc, int reg, + const char **name); + + +/* +** find a "name" for the RK value 'c' +*/ +static void kname (Proto *p, int pc, int c, const char **name) { + if (ISK(c)) { /* is 'c' a constant? */ + TValue *kvalue = &p->k[INDEXK(c)]; + if (ttisstring(kvalue)) { /* literal constant? */ + *name = svalue(kvalue); /* it is its own name */ + return; + } + /* else no reasonable name found */ + } + else { /* 'c' is a register */ + const char *what = getobjname(p, pc, c, name); /* search for 'c' */ + if (what && *what == 'c') { /* found a constant name? */ + return; /* 'name' already filled */ + } + /* else no reasonable name found */ + } + *name = "?"; /* no reasonable name found */ +} + + +static int filterpc (int pc, int jmptarget) { + if (pc < jmptarget) /* is code conditional (inside a jump)? */ + return -1; /* cannot know who sets that register */ + else return pc; /* current position sets that register */ +} + + +/* +** try to find last instruction before 'lastpc' that modified register 'reg' +*/ +static int findsetreg (Proto *p, int lastpc, int reg) { + int pc; + int setreg = -1; /* keep last instruction that changed 'reg' */ + int jmptarget = 0; /* any code before this address is conditional */ + for (pc = 0; pc < lastpc; pc++) { + Instruction i = p->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + switch (op) { + case OP_LOADNIL: { + int b = GETARG_B(i); + if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ + setreg = filterpc(pc, jmptarget); + break; + } + case OP_TFORCALL: { + if (reg >= a + 2) /* affect all regs above its base */ + setreg = filterpc(pc, jmptarget); + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (reg >= a) /* affect all registers above base */ + setreg = filterpc(pc, jmptarget); + break; + } + case OP_JMP: { + int b = GETARG_sBx(i); + int dest = pc + 1 + b; + /* jump is forward and do not skip 'lastpc'? */ + if (pc < dest && dest <= lastpc) { + if (dest > jmptarget) + jmptarget = dest; /* update 'jmptarget' */ + } + break; + } + default: + if (testAMode(op) && reg == a) /* any instruction that set A */ + setreg = filterpc(pc, jmptarget); + break; + } + } + return setreg; +} + + +static const char *getobjname (Proto *p, int lastpc, int reg, + const char **name) { + int pc; + *name = luaF_getlocalname(p, reg + 1, lastpc); + if (*name) /* is a local? */ + return "local"; + /* else try symbolic execution */ + pc = findsetreg(p, lastpc, reg); + if (pc != -1) { /* could find instruction? */ + Instruction i = p->code[pc]; + OpCode op = GET_OPCODE(i); + switch (op) { + case OP_MOVE: { + int b = GETARG_B(i); /* move from 'b' to 'a' */ + if (b < GETARG_A(i)) + return getobjname(p, pc, b, name); /* get name for 'b' */ + break; + } + case OP_GETTABUP: + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + int t = GETARG_B(i); /* table index */ + const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ + ? luaF_getlocalname(p, t + 1, pc) + : upvalname(p, t); + kname(p, pc, k, name); + return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; + } + case OP_GETUPVAL: { + *name = upvalname(p, GETARG_B(i)); + return "upvalue"; + } + case OP_LOADK: + case OP_LOADKX: { + int b = (op == OP_LOADK) ? GETARG_Bx(i) + : GETARG_Ax(p->code[pc + 1]); + if (ttisstring(&p->k[b])) { + *name = svalue(&p->k[b]); + return "constant"; + } + break; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + kname(p, pc, k, name); + return "method"; + } + default: break; /* go through to return NULL */ + } + } + return NULL; /* could not find reasonable name */ +} + + +/* +** Try to find a name for a function based on the code that called it. +** (Only works when function was called by a Lua function.) +** Returns what the name is (e.g., "for iterator", "method", +** "metamethod") and sets '*name' to point to the name. +*/ +static const char *funcnamefromcode (lua_State *L, CallInfo *ci, + const char **name) { + TMS tm = (TMS)0; /* (initial value avoids warnings) */ + Proto *p = ci_func(ci)->p; /* calling function */ + int pc = currentpc(ci); /* calling instruction index */ + Instruction i = p->code[pc]; /* calling instruction */ + if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ + *name = "?"; + return "hook"; + } + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + return getobjname(p, pc, GETARG_A(i), name); /* get function name */ + case OP_TFORCALL: { /* for iterator */ + *name = "for iterator"; + return "for iterator"; + } + /* other instructions can do calls through metamethods */ + case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: + tm = TM_INDEX; + break; + case OP_SETTABUP: case OP_SETTABLE: + tm = TM_NEWINDEX; + break; + case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: + case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: + case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { + int offset = cast_int(GET_OPCODE(i)) - cast_int(OP_ADD); /* ORDER OP */ + tm = cast(TMS, offset + cast_int(TM_ADD)); /* ORDER TM */ + break; + } + case OP_UNM: tm = TM_UNM; break; + case OP_BNOT: tm = TM_BNOT; break; + case OP_LEN: tm = TM_LEN; break; + case OP_CONCAT: tm = TM_CONCAT; break; + case OP_EQ: tm = TM_EQ; break; + case OP_LT: tm = TM_LT; break; + case OP_LE: tm = TM_LE; break; + default: + return NULL; /* cannot find a reasonable name */ + } + *name = getstr(G(L)->tmname[tm]); + return "metamethod"; +} + +/* }====================================================== */ + + + +/* +** The subtraction of two potentially unrelated pointers is +** not ISO C, but it should not crash a program; the subsequent +** checks are ISO C and ensure a correct result. +*/ +static int isinstack (CallInfo *ci, const TValue *o) { + ptrdiff_t i = o - ci->u.l.base; + return (0 <= i && i < (ci->top - ci->u.l.base) && ci->u.l.base + i == o); +} + + +/* +** Checks whether value 'o' came from an upvalue. (That can only happen +** with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on +** upvalues.) +*/ +static const char *getupvalname (CallInfo *ci, const TValue *o, + const char **name) { + LClosure *c = ci_func(ci); + int i; + for (i = 0; i < c->nupvalues; i++) { + if (c->upvals[i]->v == o) { + *name = upvalname(c->p, i); + return "upvalue"; + } + } + return NULL; +} + + +static const char *varinfo (lua_State *L, const TValue *o) { + const char *name = NULL; /* to avoid warnings */ + CallInfo *ci = L->ci; + const char *kind = NULL; + if (isLua(ci)) { + kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ + if (!kind && isinstack(ci, o)) /* no? try a register */ + kind = getobjname(ci_func(ci)->p, currentpc(ci), + cast_int(o - ci->u.l.base), &name); + } + return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; +} + + +l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *t = luaT_objtypename(L, o); + luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o)); +} + + +l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { + if (ttisstring(p1) || cvt2str(p1)) p1 = p2; + luaG_typeerror(L, p1, "concatenate"); +} + + +l_noret luaG_opinterror (lua_State *L, const TValue *p1, + const TValue *p2, const char *msg) { + lua_Number temp; + if (!tonumber(p1, &temp)) /* first operand is wrong? */ + p2 = p1; /* now second is wrong */ + luaG_typeerror(L, p2, msg); +} + + +/* +** Error when both values are convertible to numbers, but not to integers +*/ +l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2) { + lua_Integer temp; + if (!tointeger(p1, &temp)) + p2 = p1; + luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2)); +} + + +l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_objtypename(L, p1); + const char *t2 = luaT_objtypename(L, p2); + if (strcmp(t1, t2) == 0) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); +} + + +/* add src:line information to 'msg' */ +const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, + int line) { + char buff[LUA_IDSIZE]; + if (src) + luaO_chunkid(buff, getstr(src), LUA_IDSIZE); + else { /* no source available; use "?" instead */ + buff[0] = '?'; buff[1] = '\0'; + } + return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); +} + + +l_noret luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + L->top++; /* assume EXTRA_STACK */ + luaD_callnoyield(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { + CallInfo *ci = L->ci; + const char *msg; + va_list argp; + luaC_checkGC(L); /* error message uses memory */ + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); /* format message */ + va_end(argp); + if (isLua(ci)) /* if Lua function, add source:line information */ + luaG_addinfo(L, msg, ci_func(ci)->p->source, currentline(ci)); + luaG_errormsg(L); +} + + +void luaG_traceexec (lua_State *L) { + CallInfo *ci = L->ci; + lu_byte mask = L->hookmask; + int counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT)); + if (counthook) + resethookcount(L); /* reset count */ + else if (!(mask & LUA_MASKLINE)) + return; /* no line hook and count != 0; nothing to be done */ + if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */ + ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */ + return; /* do not call hook again (VM yielded, so it did not move) */ + } + if (counthook) + luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(ci)->p; + int npc = pcRel(ci->u.l.savedpc, p); + int newline = getfuncline(p, npc); + if (npc == 0 || /* call linehook when enter a new function, */ + ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ + newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ + luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ + } + L->oldpc = ci->u.l.savedpc; + if (L->status == LUA_YIELD) { /* did hook yield? */ + if (counthook) + L->hookcount = 1; /* undo decrement to zero */ + ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ + ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ + ci->func = L->top - 1; /* protect stack below results */ + luaD_throw(L, LUA_YIELD); + } +} + diff --git a/deps/lua/src/ldebug.h b/deps/lua/src/ldebug.h new file mode 100644 index 0000000000..8cea0ee0a7 --- /dev/null +++ b/deps/lua/src/ldebug.h @@ -0,0 +1,39 @@ +/* +** $Id: ldebug.h,v 2.14.1.1 2017/04/19 17:20:42 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, + const TValue *p2, + const char *msg); +LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, + TString *src, int line); +LUAI_FUNC l_noret luaG_errormsg (lua_State *L); +LUAI_FUNC void luaG_traceexec (lua_State *L); + + +#endif diff --git a/deps/lua/src/ldo.c b/deps/lua/src/ldo.c new file mode 100644 index 0000000000..316e45c8fe --- /dev/null +++ b/deps/lua/src/ldo.c @@ -0,0 +1,802 @@ +/* +** $Id: ldo.c,v 2.157.1.1 2017/04/19 17:20:42 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#define ldo_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + +#define errorstatus(s) ((s) > LUA_YIELD) + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + +/* +** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By +** default, Lua handles errors with exceptions when compiling as +** C++ code, with _longjmp/_setjmp when asked to use them, and with +** longjmp/setjmp otherwise. +*/ +#if !defined(LUAI_THROW) /* { */ + +#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */ + +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) \ + try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_POSIX) /* }{ */ + +/* in POSIX, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else /* }{ */ + +/* ISO C handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif /* } */ + +#endif /* } */ + + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { /* memory error? */ + setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + default: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +l_noret luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { /* thread has an error handler? */ + L->errorJmp->status = errcode; /* set status */ + LUAI_THROW(L, L->errorJmp); /* jump to it */ + } + else { /* thread has no error handler */ + global_State *g = G(L); + L->status = cast_byte(errcode); /* mark it as dead */ + if (g->mainthread->errorJmp) { /* main thread has a handler? */ + setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ + luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ + } + else { /* no handler at all; abort */ + if (g->panic) { /* panic function? */ + seterrorobj(L, errcode, L->top); /* assume EXTRA_STACK */ + if (L->ci->top < L->top) + L->ci->top = L->top; /* pushing msg. can break this invariant */ + lua_unlock(L); + g->panic(L); /* call panic function (last chance to jump out) */ + } + abort(); + } + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + unsigned short oldnCcalls = L->nCcalls; + struct lua_longjmp lj; + lj.status = LUA_OK; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + L->nCcalls = oldnCcalls; + return lj.status; +} + +/* }====================================================== */ + + +/* +** {================================================================== +** Stack reallocation +** =================================================================== +*/ +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + UpVal *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->u.open.next) + up->v = (up->v - oldstack) + L->stack; + for (ci = L->ci; ci != NULL; ci = ci->previous) { + ci->top = (ci->top - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + if (isLua(ci)) + ci->u.l.base = (ci->u.l.base - oldstack) + L->stack; + } +} + + +/* some space for error handling */ +#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int lim = L->stacksize; + lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK); + luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue); + for (; lim < newsize; lim++) + setnilvalue(L->stack + lim); /* erase new segment */ + L->stacksize = newsize; + L->stack_last = L->stack + newsize - EXTRA_STACK; + correctstack(L, oldstack); +} + + +void luaD_growstack (lua_State *L, int n) { + int size = L->stacksize; + if (size > LUAI_MAXSTACK) /* error after extra size? */ + luaD_throw(L, LUA_ERRERR); + else { + int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK; + int newsize = 2 * size; + if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; + if (newsize < needed) newsize = needed; + if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ + luaD_reallocstack(L, ERRORSTACKSIZE); + luaG_runerror(L, "stack overflow"); + } + else + luaD_reallocstack(L, newsize); + } +} + + +static int stackinuse (lua_State *L) { + CallInfo *ci; + StkId lim = L->top; + for (ci = L->ci; ci != NULL; ci = ci->previous) { + if (lim < ci->top) lim = ci->top; + } + lua_assert(lim <= L->stack_last); + return cast_int(lim - L->stack) + 1; /* part of stack in use */ +} + + +void luaD_shrinkstack (lua_State *L) { + int inuse = stackinuse(L); + int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; + if (goodsize > LUAI_MAXSTACK) + goodsize = LUAI_MAXSTACK; /* respect stack limit */ + if (L->stacksize > LUAI_MAXSTACK) /* had been handling stack overflow? */ + luaE_freeCI(L); /* free all CIs (list grew because of an error) */ + else + luaE_shrinkCI(L); /* shrink list */ + /* if thread is currently not handling a stack overflow and its + good size is smaller than current size, shrink its stack */ + if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && + goodsize < L->stacksize) + luaD_reallocstack(L, goodsize); + else /* don't change stack */ + condmovestack(L,{},{}); /* (change only for debugging) */ +} + + +void luaD_inctop (lua_State *L) { + luaD_checkstack(L, 1); + L->top++; +} + +/* }================================================================== */ + + +/* +** Call a hook for the given event. Make sure there is a hook to be +** called. (Both 'L->hook' and 'L->hookmask', which triggers this +** function, can be changed asynchronously by signals.) +*/ +void luaD_hook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { /* make sure there is a hook */ + CallInfo *ci = L->ci; + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + ar.i_ci = ci; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + ci->callstatus |= CIST_HOOKED; + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + ci->callstatus &= ~CIST_HOOKED; + } +} + + +static void callhook (lua_State *L, CallInfo *ci) { + int hook = LUA_HOOKCALL; + ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ + if (isLua(ci->previous) && + GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) { + ci->callstatus |= CIST_TAIL; + hook = LUA_HOOKTAILCALL; + } + luaD_hook(L, hook, -1); + ci->u.l.savedpc--; /* correct 'pc' */ +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + StkId base, fixed; + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i = 0; i < nfixargs && i < actual; i++) { + setobjs2s(L, L->top++, fixed + i); + setnilvalue(fixed + i); /* erase original copy (for GC) */ + } + for (; i < nfixargs; i++) + setnilvalue(L->top++); /* complete missing arguments */ + return base; +} + + +/* +** Check whether __call metafield of 'func' is a function. If so, put +** it in stack below original 'func' so that 'luaD_precall' can call +** it. Raise an error if __call metafield is not a function. +*/ +static void tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at 'func' */ + for (p = L->top; p > func; p--) + setobjs2s(L, p, p-1); + L->top++; /* slot ensured by caller */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ +} + + +/* +** Given 'nres' results at 'firstResult', move 'wanted' of them to 'res'. +** Handle most typical cases (zero results for commands, one result for +** expressions, multiple results for tail calls/single parameters) +** separated. +*/ +static int moveresults (lua_State *L, const TValue *firstResult, StkId res, + int nres, int wanted) { + switch (wanted) { /* handle typical cases separately */ + case 0: break; /* nothing to move */ + case 1: { /* one result needed */ + if (nres == 0) /* no results? */ + firstResult = luaO_nilobject; /* adjust with nil */ + setobjs2s(L, res, firstResult); /* move it to proper place */ + break; + } + case LUA_MULTRET: { + int i; + for (i = 0; i < nres; i++) /* move all results to correct place */ + setobjs2s(L, res + i, firstResult + i); + L->top = res + nres; + return 0; /* wanted == LUA_MULTRET */ + } + default: { + int i; + if (wanted <= nres) { /* enough results? */ + for (i = 0; i < wanted; i++) /* move wanted results to correct place */ + setobjs2s(L, res + i, firstResult + i); + } + else { /* not enough results; use all of them plus nils */ + for (i = 0; i < nres; i++) /* move all results to correct place */ + setobjs2s(L, res + i, firstResult + i); + for (; i < wanted; i++) /* complete wanted number of results */ + setnilvalue(res + i); + } + break; + } + } + L->top = res + wanted; /* top points after the last result */ + return 1; +} + + +/* +** Finishes a function call: calls hook if necessary, removes CallInfo, +** moves current number of results to proper place; returns 0 iff call +** wanted multiple (variable number of) results. +*/ +int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) { + StkId res; + int wanted = ci->nresults; + if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { + if (L->hookmask & LUA_MASKRET) { + ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ + luaD_hook(L, LUA_HOOKRET, -1); + firstResult = restorestack(L, fr); + } + L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ + } + res = ci->func; /* res == final position of 1st result */ + L->ci = ci->previous; /* back to caller */ + /* move results to proper place */ + return moveresults(L, firstResult, res, nres, wanted); +} + + + +#define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L))) + + +/* macro to check stack size, preserving 'p' */ +#define checkstackp(L,n,p) \ + luaD_checkstackaux(L, n, \ + ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ + luaC_checkGC(L), /* stack grow uses memory */ \ + p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ + + +/* +** Prepares a function call: checks the stack, creates a new CallInfo +** entry, fills in the relevant information, calls hook if needed. +** If function is a C function, does the call, too. (Otherwise, leave +** the execution ('luaV_execute') to the caller, to allow stackless +** calls.) Returns true iff function has been executed (C function). +*/ +int luaD_precall (lua_State *L, StkId func, int nresults) { + lua_CFunction f; + CallInfo *ci; + switch (ttype(func)) { + case LUA_TCCL: /* C closure */ + f = clCvalue(func)->f; + goto Cfunc; + case LUA_TLCF: /* light C function */ + f = fvalue(func); + Cfunc: { + int n; /* number of returns */ + checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ + ci = next_ci(L); /* now 'enter' new function */ + ci->nresults = nresults; + ci->func = func; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->callstatus = 0; + if (L->hookmask & LUA_MASKCALL) + luaD_hook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*f)(L); /* do the actual call */ + lua_lock(L); + api_checknelems(L, n); + luaD_poscall(L, ci, L->top - n, n); + return 1; + } + case LUA_TLCL: { /* Lua function: prepare its call */ + StkId base; + Proto *p = clLvalue(func)->p; + int n = cast_int(L->top - func) - 1; /* number of real arguments */ + int fsize = p->maxstacksize; /* frame size */ + checkstackp(L, fsize, func); + if (p->is_vararg) + base = adjust_varargs(L, p, n); + else { /* non vararg function */ + for (; n < p->numparams; n++) + setnilvalue(L->top++); /* complete missing arguments */ + base = func + 1; + } + ci = next_ci(L); /* now 'enter' new function */ + ci->nresults = nresults; + ci->func = func; + ci->u.l.base = base; + L->top = ci->top = base + fsize; + lua_assert(ci->top <= L->stack_last); + ci->u.l.savedpc = p->code; /* starting point */ + ci->callstatus = CIST_LUA; + if (L->hookmask & LUA_MASKCALL) + callhook(L, ci); + return 0; + } + default: { /* not a function */ + checkstackp(L, 1, func); /* ensure space for metamethod */ + tryfuncTM(L, func); /* try to get '__call' metamethod */ + return luaD_precall(L, func, nresults); /* now it must be a function */ + } + } +} + + +/* +** Check appropriate error for stack overflow ("regular" overflow or +** overflow while handling stack overflow). If 'nCalls' is larger than +** LUAI_MAXCCALLS (which means it is handling a "regular" overflow) but +** smaller than 9/8 of LUAI_MAXCCALLS, does not report an error (to +** allow overflow handling to work) +*/ +static void stackerror (lua_State *L) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) + stackerror(L); + if (!luaD_precall(L, func, nResults)) /* is a Lua function? */ + luaV_execute(L); /* call it */ + L->nCcalls--; +} + + +/* +** Similar to 'luaD_call', but does not allow yields during the call +*/ +void luaD_callnoyield (lua_State *L, StkId func, int nResults) { + L->nny++; + luaD_call(L, func, nResults); + L->nny--; +} + + +/* +** Completes the execution of an interrupted C function, calling its +** continuation function. +*/ +static void finishCcall (lua_State *L, int status) { + CallInfo *ci = L->ci; + int n; + /* must have a continuation and must be able to call it */ + lua_assert(ci->u.c.k != NULL && L->nny == 0); + /* error status can only happen in a protected call */ + lua_assert((ci->callstatus & CIST_YPCALL) || status == LUA_YIELD); + if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */ + ci->callstatus &= ~CIST_YPCALL; /* continuation is also inside it */ + L->errfunc = ci->u.c.old_errfunc; /* with the same error function */ + } + /* finish 'lua_callk'/'lua_pcall'; CIST_YPCALL and 'errfunc' already + handled */ + adjustresults(L, ci->nresults); + lua_unlock(L); + n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation function */ + lua_lock(L); + api_checknelems(L, n); + luaD_poscall(L, ci, L->top - n, n); /* finish 'luaD_precall' */ +} + + +/* +** Executes "full continuation" (everything in the stack) of a +** previously interrupted coroutine until the stack is empty (or another +** interruption long-jumps out of the loop). If the coroutine is +** recovering from an error, 'ud' points to the error status, which must +** be passed to the first continuation function (otherwise the default +** status is LUA_YIELD). +*/ +static void unroll (lua_State *L, void *ud) { + if (ud != NULL) /* error status? */ + finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */ + while (L->ci != &L->base_ci) { /* something in the stack */ + if (!isLua(L->ci)) /* C function? */ + finishCcall(L, LUA_YIELD); /* complete its execution */ + else { /* Lua function */ + luaV_finishOp(L); /* finish interrupted instruction */ + luaV_execute(L); /* execute down to higher C 'boundary' */ + } + } +} + + +/* +** Try to find a suspended protected call (a "recover point") for the +** given thread. +*/ +static CallInfo *findpcall (lua_State *L) { + CallInfo *ci; + for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ + if (ci->callstatus & CIST_YPCALL) + return ci; + } + return NULL; /* no pending pcall */ +} + + +/* +** Recovers from an error in a coroutine. Finds a recover point (if +** there is one) and completes the execution of the interrupted +** 'luaD_pcall'. If there is no recover point, returns zero. +*/ +static int recover (lua_State *L, int status) { + StkId oldtop; + CallInfo *ci = findpcall(L); + if (ci == NULL) return 0; /* no recovery point */ + /* "finish" luaD_pcall */ + oldtop = restorestack(L, ci->extra); + luaF_close(L, oldtop); + seterrorobj(L, status, oldtop); + L->ci = ci; + L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */ + L->nny = 0; /* should be zero to be yieldable */ + luaD_shrinkstack(L); + L->errfunc = ci->u.c.old_errfunc; + return 1; /* continue running the coroutine */ +} + + +/* +** Signal an error in the call to 'lua_resume', not in the execution +** of the coroutine itself. (Such errors should not be handled by any +** coroutine error handler and should not kill the coroutine.) +*/ +static int resume_error (lua_State *L, const char *msg, int narg) { + L->top -= narg; /* remove args from the stack */ + setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ + api_incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +/* +** Do the work for 'lua_resume' in protected mode. Most of the work +** depends on the status of the coroutine: initial state, suspended +** inside a hook, or regularly suspended (optionally with a continuation +** function), plus erroneous cases: non-suspended coroutine or dead +** coroutine. +*/ +static void resume (lua_State *L, void *ud) { + int n = *(cast(int*, ud)); /* number of arguments */ + StkId firstArg = L->top - n; /* first argument */ + CallInfo *ci = L->ci; + if (L->status == LUA_OK) { /* starting a coroutine? */ + if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) /* Lua function? */ + luaV_execute(L); /* call it */ + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = LUA_OK; /* mark that it is running (again) */ + ci->func = restorestack(L, ci->extra); + if (isLua(ci)) /* yielded inside a hook? */ + luaV_execute(L); /* just continue running Lua code */ + else { /* 'common' yield */ + if (ci->u.c.k != NULL) { /* does it have a continuation function? */ + lua_unlock(L); + n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */ + lua_lock(L); + api_checknelems(L, n); + firstArg = L->top - n; /* yield results come from continuation */ + } + luaD_poscall(L, ci, firstArg, n); /* finish 'luaD_precall' */ + } + unroll(L, NULL); /* run continuation */ + } +} + + +LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { + int status; + unsigned short oldnny = L->nny; /* save "number of non-yieldable" calls */ + lua_lock(L); + if (L->status == LUA_OK) { /* may be starting a coroutine */ + if (L->ci != &L->base_ci) /* not in base level? */ + return resume_error(L, "cannot resume non-suspended coroutine", nargs); + } + else if (L->status != LUA_YIELD) + return resume_error(L, "cannot resume dead coroutine", nargs); + L->nCcalls = (from) ? from->nCcalls + 1 : 1; + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow", nargs); + luai_userstateresume(L, nargs); + L->nny = 0; /* allow yields */ + api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); + status = luaD_rawrunprotected(L, resume, &nargs); + if (status == -1) /* error calling 'lua_resume'? */ + status = LUA_ERRRUN; + else { /* continue running after recoverable errors */ + while (errorstatus(status) && recover(L, status)) { + /* unroll continuation */ + status = luaD_rawrunprotected(L, unroll, &status); + } + if (errorstatus(status)) { /* unrecoverable error? */ + L->status = cast_byte(status); /* mark thread as 'dead' */ + seterrorobj(L, status, L->top); /* push error message */ + L->ci->top = L->top; + } + else lua_assert(status == L->status); /* normal end or yield */ + } + L->nny = oldnny; /* restore 'nny' */ + L->nCcalls--; + lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); + lua_unlock(L); + return status; +} + + +LUA_API int lua_isyieldable (lua_State *L) { + return (L->nny == 0); +} + + +LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, + lua_KFunction k) { + CallInfo *ci = L->ci; + luai_userstateyield(L, nresults); + lua_lock(L); + api_checknelems(L, nresults); + if (L->nny > 0) { + if (L != G(L)->mainthread) + luaG_runerror(L, "attempt to yield across a C-call boundary"); + else + luaG_runerror(L, "attempt to yield from outside a coroutine"); + } + L->status = LUA_YIELD; + ci->extra = savestack(L, ci->func); /* save current 'func' */ + if (isLua(ci)) { /* inside a hook? */ + api_check(L, k == NULL, "hooks cannot continue after yielding"); + } + else { + if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ + ci->u.c.ctx = ctx; /* save context */ + ci->func = L->top - nresults - 1; /* protect stack below results */ + luaD_throw(L, LUA_YIELD); + } + lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ + lua_unlock(L); + return 0; /* return to 'luaD_hook' */ +} + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + CallInfo *old_ci = L->ci; + lu_byte old_allowhooks = L->allowhook; + unsigned short old_nny = L->nny; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != LUA_OK) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close possible pending closures */ + seterrorobj(L, status, oldtop); + L->ci = old_ci; + L->allowhook = old_allowhooks; + L->nny = old_nny; + luaD_shrinkstack(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to 'f_parser' */ + ZIO *z; + Mbuffer buff; /* dynamic structure used by the scanner */ + Dyndata dyd; /* dynamic structures used by the parser */ + const char *mode; + const char *name; +}; + + +static void checkmode (lua_State *L, const char *mode, const char *x) { + if (mode && strchr(mode, x[0]) == NULL) { + luaO_pushfstring(L, + "attempt to load a %s chunk (mode is '%s')", x, mode); + luaD_throw(L, LUA_ERRSYNTAX); + } +} + + +static void f_parser (lua_State *L, void *ud) { + LClosure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = zgetc(p->z); /* read first character */ + if (c == LUA_SIGNATURE[0]) { + checkmode(L, p->mode, "binary"); + cl = luaU_undump(L, p->z, p->name); + } + else { + checkmode(L, p->mode, "text"); + cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); + } + lua_assert(cl->nupvalues == cl->p->sizeupvalues); + luaF_initupvals(L, cl); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, + const char *mode) { + struct SParser p; + int status; + L->nny++; /* cannot yield during parsing */ + p.z = z; p.name = name; p.mode = mode; + p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0; + p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; + p.dyd.label.arr = NULL; p.dyd.label.size = 0; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); + luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); + luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size); + L->nny--; + return status; +} + + diff --git a/deps/lua/src/ldo.h b/deps/lua/src/ldo.h new file mode 100644 index 0000000000..3b2983a386 --- /dev/null +++ b/deps/lua/src/ldo.h @@ -0,0 +1,58 @@ +/* +** $Id: ldo.h,v 2.29.1.1 2017/04/19 17:20:42 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +/* +** Macro to check stack size and grow stack if needed. Parameters +** 'pre'/'pos' allow the macro to preserve a pointer into the +** stack across reallocations, doing the work only when needed. +** 'condmovestack' is used in heavy tests to force a stack reallocation +** at every check. +*/ +#define luaD_checkstackaux(L,n,pre,pos) \ + if (L->stack_last - L->top <= (n)) \ + { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); } + +/* In general, 'pre'/'pos' are empty (nothing to save) */ +#define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) + + + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + + +/* type of protected functions, to be ran by 'runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, + const char *mode); +LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, + int nres); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); +LUAI_FUNC void luaD_shrinkstack (lua_State *L); +LUAI_FUNC void luaD_inctop (lua_State *L); + +LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +#endif + diff --git a/deps/lua/src/ldump.c b/deps/lua/src/ldump.c new file mode 100644 index 0000000000..f025acac3c --- /dev/null +++ b/deps/lua/src/ldump.c @@ -0,0 +1,215 @@ +/* +** $Id: ldump.c,v 2.37.1.1 2017/04/19 17:20:42 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#define ldump_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + + +typedef struct { + lua_State *L; + lua_Writer writer; + void *data; + int strip; + int status; +} DumpState; + + +/* +** All high-level dumps go through DumpVector; you can change it to +** change the endianness of the result +*/ +#define DumpVector(v,n,D) DumpBlock(v,(n)*sizeof((v)[0]),D) + +#define DumpLiteral(s,D) DumpBlock(s, sizeof(s) - sizeof(char), D) + + +static void DumpBlock (const void *b, size_t size, DumpState *D) { + if (D->status == 0 && size > 0) { + lua_unlock(D->L); + D->status = (*D->writer)(D->L, b, size, D->data); + lua_lock(D->L); + } +} + + +#define DumpVar(x,D) DumpVector(&x,1,D) + + +static void DumpByte (int y, DumpState *D) { + lu_byte x = (lu_byte)y; + DumpVar(x, D); +} + + +static void DumpInt (int x, DumpState *D) { + DumpVar(x, D); +} + + +static void DumpNumber (lua_Number x, DumpState *D) { + DumpVar(x, D); +} + + +static void DumpInteger (lua_Integer x, DumpState *D) { + DumpVar(x, D); +} + + +static void DumpString (const TString *s, DumpState *D) { + if (s == NULL) + DumpByte(0, D); + else { + size_t size = tsslen(s) + 1; /* include trailing '\0' */ + const char *str = getstr(s); + if (size < 0xFF) + DumpByte(cast_int(size), D); + else { + DumpByte(0xFF, D); + DumpVar(size, D); + } + DumpVector(str, size - 1, D); /* no need to save '\0' */ + } +} + + +static void DumpCode (const Proto *f, DumpState *D) { + DumpInt(f->sizecode, D); + DumpVector(f->code, f->sizecode, D); +} + + +static void DumpFunction(const Proto *f, TString *psource, DumpState *D); + +static void DumpConstants (const Proto *f, DumpState *D) { + int i; + int n = f->sizek; + DumpInt(n, D); + for (i = 0; i < n; i++) { + const TValue *o = &f->k[i]; + DumpByte(ttype(o), D); + switch (ttype(o)) { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpByte(bvalue(o), D); + break; + case LUA_TNUMFLT: + DumpNumber(fltvalue(o), D); + break; + case LUA_TNUMINT: + DumpInteger(ivalue(o), D); + break; + case LUA_TSHRSTR: + case LUA_TLNGSTR: + DumpString(tsvalue(o), D); + break; + default: + lua_assert(0); + } + } +} + + +static void DumpProtos (const Proto *f, DumpState *D) { + int i; + int n = f->sizep; + DumpInt(n, D); + for (i = 0; i < n; i++) + DumpFunction(f->p[i], f->source, D); +} + + +static void DumpUpvalues (const Proto *f, DumpState *D) { + int i, n = f->sizeupvalues; + DumpInt(n, D); + for (i = 0; i < n; i++) { + DumpByte(f->upvalues[i].instack, D); + DumpByte(f->upvalues[i].idx, D); + } +} + + +static void DumpDebug (const Proto *f, DumpState *D) { + int i, n; + n = (D->strip) ? 0 : f->sizelineinfo; + DumpInt(n, D); + DumpVector(f->lineinfo, n, D); + n = (D->strip) ? 0 : f->sizelocvars; + DumpInt(n, D); + for (i = 0; i < n; i++) { + DumpString(f->locvars[i].varname, D); + DumpInt(f->locvars[i].startpc, D); + DumpInt(f->locvars[i].endpc, D); + } + n = (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n, D); + for (i = 0; i < n; i++) + DumpString(f->upvalues[i].name, D); +} + + +static void DumpFunction (const Proto *f, TString *psource, DumpState *D) { + if (D->strip || f->source == psource) + DumpString(NULL, D); /* no debug info or same source as its parent */ + else + DumpString(f->source, D); + DumpInt(f->linedefined, D); + DumpInt(f->lastlinedefined, D); + DumpByte(f->numparams, D); + DumpByte(f->is_vararg, D); + DumpByte(f->maxstacksize, D); + DumpCode(f, D); + DumpConstants(f, D); + DumpUpvalues(f, D); + DumpProtos(f, D); + DumpDebug(f, D); +} + + +static void DumpHeader (DumpState *D) { + DumpLiteral(LUA_SIGNATURE, D); + DumpByte(LUAC_VERSION, D); + DumpByte(LUAC_FORMAT, D); + DumpLiteral(LUAC_DATA, D); + DumpByte(sizeof(int), D); + DumpByte(sizeof(size_t), D); + DumpByte(sizeof(Instruction), D); + DumpByte(sizeof(lua_Integer), D); + DumpByte(sizeof(lua_Number), D); + DumpInteger(LUAC_INT, D); + DumpNumber(LUAC_NUM, D); +} + + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, + int strip) { + DumpState D; + D.L = L; + D.writer = w; + D.data = data; + D.strip = strip; + D.status = 0; + DumpHeader(&D); + DumpByte(f->sizeupvalues, &D); + DumpFunction(f, NULL, &D); + return D.status; +} + diff --git a/deps/lua/src/lfunc.c b/deps/lua/src/lfunc.c new file mode 100644 index 0000000000..ccafbb8ab3 --- /dev/null +++ b/deps/lua/src/lfunc.c @@ -0,0 +1,151 @@ +/* +** $Id: lfunc.c,v 2.45.1.1 2017/04/19 17:39:34 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#define lfunc_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +CClosure *luaF_newCclosure (lua_State *L, int n) { + GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n)); + CClosure *c = gco2ccl(o); + c->nupvalues = cast_byte(n); + return c; +} + + +LClosure *luaF_newLclosure (lua_State *L, int n) { + GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n)); + LClosure *c = gco2lcl(o); + c->p = NULL; + c->nupvalues = cast_byte(n); + while (n--) c->upvals[n] = NULL; + return c; +} + +/* +** fill a closure with new closed upvalues +*/ +void luaF_initupvals (lua_State *L, LClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) { + UpVal *uv = luaM_new(L, UpVal); + uv->refcount = 1; + uv->v = &uv->u.value; /* make it closed */ + setnilvalue(uv->v); + cl->upvals[i] = uv; + } +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + UpVal **pp = &L->openupval; + UpVal *p; + UpVal *uv; + lua_assert(isintwups(L) || L->openupval == NULL); + while (*pp != NULL && (p = *pp)->v >= level) { + lua_assert(upisopen(p)); + if (p->v == level) /* found a corresponding upvalue? */ + return p; /* return it */ + pp = &p->u.open.next; + } + /* not found: create a new upvalue */ + uv = luaM_new(L, UpVal); + uv->refcount = 0; + uv->u.open.next = *pp; /* link it to list of open upvalues */ + uv->u.open.touched = 1; + *pp = uv; + uv->v = level; /* current value lives in the stack */ + if (!isintwups(L)) { /* thread not in list of threads with upvalues? */ + L->twups = G(L)->twups; /* link it to the list */ + G(L)->twups = L; + } + return uv; +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + while (L->openupval != NULL && (uv = L->openupval)->v >= level) { + lua_assert(upisopen(uv)); + L->openupval = uv->u.open.next; /* remove from 'open' list */ + if (uv->refcount == 0) /* no references? */ + luaM_free(L, uv); /* free upvalue */ + else { + setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ + uv->v = &uv->u.value; /* now current value lives here */ + luaC_upvalbarrier(L, uv); + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + GCObject *o = luaC_newobj(L, LUA_TPROTO, sizeof(Proto)); + Proto *f = gco2p(o); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->cache = NULL; + f->sizecode = 0; + f->lineinfo = NULL; + f->sizelineinfo = 0; + f->upvalues = NULL; + f->sizeupvalues = 0; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->locvars = NULL; + f->sizelocvars = 0; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode); + luaM_freearray(L, f->p, f->sizep); + luaM_freearray(L, f->k, f->sizek); + luaM_freearray(L, f->lineinfo, f->sizelineinfo); + luaM_freearray(L, f->locvars, f->sizelocvars); + luaM_freearray(L, f->upvalues, f->sizeupvalues); + luaM_free(L, f); +} + + +/* +** Look for n-th local variable at line 'line' in function 'func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/deps/lua/src/lfunc.h b/deps/lua/src/lfunc.h new file mode 100644 index 0000000000..c916e9878a --- /dev/null +++ b/deps/lua/src/lfunc.h @@ -0,0 +1,61 @@ +/* +** $Id: lfunc.h,v 2.15.1.1 2017/04/19 17:39:34 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +/* test whether thread is in 'twups' list */ +#define isintwups(L) (L->twups != L) + + +/* +** maximum number of upvalues in a closure (both C and Lua). (Value +** must fit in a VM register.) +*/ +#define MAXUPVAL 255 + + +/* +** Upvalues for Lua closures +*/ +struct UpVal { + TValue *v; /* points to stack or to its own value */ + lu_mem refcount; /* reference counter */ + union { + struct { /* (when open) */ + UpVal *next; /* linked list */ + int touched; /* mark to avoid cycles with dead threads */ + } open; + TValue value; /* the value (when closed) */ + } u; +}; + +#define upisopen(up) ((up)->v != &(up)->u.value) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); +LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); +LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/deps/lua/src/lgc.c b/deps/lua/src/lgc.c new file mode 100644 index 0000000000..db4df82922 --- /dev/null +++ b/deps/lua/src/lgc.c @@ -0,0 +1,1179 @@ +/* +** $Id: lgc.c,v 2.215.1.2 2017/08/31 16:15:27 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#define lgc_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +/* +** internal state for collector while inside the atomic phase. The +** collector should never be in this state while running regular code. +*/ +#define GCSinsideatomic (GCSpause + 1) + +/* +** cost of sweeping one element (the size of a small object divided +** by some adjust for the sweep speed) +*/ +#define GCSWEEPCOST ((sizeof(TString) + 4) / 4) + +/* maximum number of elements to sweep in each single step */ +#define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) + +/* cost of calling one finalizer */ +#define GCFINALIZECOST GCSWEEPCOST + + +/* +** macro to adjust 'stepmul': 'stepmul' is actually used like +** 'stepmul / STEPMULADJ' (value chosen by tests) +*/ +#define STEPMULADJ 200 + + +/* +** macro to adjust 'pause': 'pause' is actually used like +** 'pause / PAUSEADJ' (value chosen by tests) +*/ +#define PAUSEADJ 100 + + +/* +** 'makewhite' erases all color bits then sets only the current white +** bit +*/ +#define maskcolors (~(bitmask(BLACKBIT) | WHITEBITS)) +#define makewhite(g,x) \ + (x->marked = cast_byte((x->marked & maskcolors) | luaC_white(g))) + +#define white2gray(x) resetbits(x->marked, WHITEBITS) +#define black2gray(x) resetbit(x->marked, BLACKBIT) + + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define checkdeadkey(n) lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n))) + + +#define checkconsistency(obj) \ + lua_longassert(!iscollectable(obj) || righttt(obj)) + + +#define markvalue(g,o) { checkconsistency(o); \ + if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(t)) reallymarkobject(g, obj2gco(t)); } + +/* +** mark an object that can be NULL (either because it is really optional, +** or it was stripped as debug info, or inside an uncompleted structure) +*/ +#define markobjectN(g,t) { if (t) markobject(g,t); } + +static void reallymarkobject (global_State *g, GCObject *o); + + +/* +** {====================================================== +** Generic functions +** ======================================================= +*/ + + +/* +** one after last element in a hash array +*/ +#define gnodelast(h) gnode(h, cast(size_t, sizenode(h))) + + +/* +** link collectable object 'o' into list pointed by 'p' +*/ +#define linkgclist(o,p) ((o)->gclist = (p), (p) = obj2gco(o)) + + +/* +** If key is not marked, mark its entry as dead. This allows key to be +** collected, but keeps its entry in the table. A dead node is needed +** when Lua looks up for a key (it may be part of a chain) and when +** traversing a weak table (key might be removed from the table during +** traversal). Other places never manipulate dead keys, because its +** associated nil value is enough to signal that the entry is logically +** empty. +*/ +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (valiswhite(gkey(n))) + setdeadvalue(wgkey(n)); /* unused and unmarked key; remove it */ +} + + +/* +** tells whether a key or value can be cleared from a weak +** table. Non-collectable objects are never removed from weak +** tables. Strings behave as 'values', so are never removed too. for +** other objects: if really collected, cannot keep them; for objects +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (global_State *g, const TValue *o) { + if (!iscollectable(o)) return 0; + else if (ttisstring(o)) { + markobject(g, tsvalue(o)); /* strings are 'values', so are never weak */ + return 0; + } + else return iswhite(gcvalue(o)); +} + + +/* +** barrier that moves collector forward, that is, mark the white object +** being pointed by a black object. (If in sweep phase, clear the black +** object to white [sweep it] to avoid other barrier calls for this +** same object.) +*/ +void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + if (keepinvariant(g)) /* must keep invariant? */ + reallymarkobject(g, v); /* restore invariant */ + else { /* sweep phase */ + lua_assert(issweepphase(g)); + makewhite(g, o); /* mark main obj. as white to avoid other barriers */ + } +} + + +/* +** barrier that moves collector backward, that is, mark the black object +** pointing to a white object as gray again. +*/ +void luaC_barrierback_ (lua_State *L, Table *t) { + global_State *g = G(L); + lua_assert(isblack(t) && !isdead(g, t)); + black2gray(t); /* make table gray (again) */ + linkgclist(t, g->grayagain); +} + + +/* +** barrier for assignments to closed upvalues. Because upvalues are +** shared among closures, it is impossible to know the color of all +** closures pointing to it. So, we assume that the object being assigned +** must be marked. +*/ +void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = gcvalue(uv->v); + lua_assert(!upisopen(uv)); /* ensured by macro luaC_upvalbarrier */ + if (keepinvariant(g)) + markobject(g, o); +} + + +void luaC_fix (lua_State *L, GCObject *o) { + global_State *g = G(L); + lua_assert(g->allgc == o); /* object must be 1st in 'allgc' list! */ + white2gray(o); /* they will be gray forever */ + g->allgc = o->next; /* remove object from 'allgc' list */ + o->next = g->fixedgc; /* link it to 'fixedgc' list */ + g->fixedgc = o; +} + + +/* +** create a new collectable object (with given type and size) and link +** it to 'allgc' list. +*/ +GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { + global_State *g = G(L); + GCObject *o = cast(GCObject *, luaM_newobject(L, novariant(tt), sz)); + o->marked = luaC_white(g); + o->tt = tt; + o->next = g->allgc; + g->allgc = o; + return o; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** Mark functions +** ======================================================= +*/ + + +/* +** mark an object. Userdata, strings, and closed upvalues are visited +** and turned black here. Other objects are marked gray and added +** to appropriate list to be visited (and turned black) later. (Open +** upvalues are already linked in 'headuv' list.) +*/ +static void reallymarkobject (global_State *g, GCObject *o) { + reentry: + white2gray(o); + switch (o->tt) { + case LUA_TSHRSTR: { + gray2black(o); + g->GCmemtrav += sizelstring(gco2ts(o)->shrlen); + break; + } + case LUA_TLNGSTR: { + gray2black(o); + g->GCmemtrav += sizelstring(gco2ts(o)->u.lnglen); + break; + } + case LUA_TUSERDATA: { + TValue uvalue; + markobjectN(g, gco2u(o)->metatable); /* mark its metatable */ + gray2black(o); + g->GCmemtrav += sizeudata(gco2u(o)); + getuservalue(g->mainthread, gco2u(o), &uvalue); + if (valiswhite(&uvalue)) { /* markvalue(g, &uvalue); */ + o = gcvalue(&uvalue); + goto reentry; + } + break; + } + case LUA_TLCL: { + linkgclist(gco2lcl(o), g->gray); + break; + } + case LUA_TCCL: { + linkgclist(gco2ccl(o), g->gray); + break; + } + case LUA_TTABLE: { + linkgclist(gco2t(o), g->gray); + break; + } + case LUA_TTHREAD: { + linkgclist(gco2th(o), g->gray); + break; + } + case LUA_TPROTO: { + linkgclist(gco2p(o), g->gray); + break; + } + default: lua_assert(0); break; + } +} + + +/* +** mark metamethods for basic types +*/ +static void markmt (global_State *g) { + int i; + for (i=0; i < LUA_NUMTAGS; i++) + markobjectN(g, g->mt[i]); +} + + +/* +** mark all objects in list of being-finalized +*/ +static void markbeingfnz (global_State *g) { + GCObject *o; + for (o = g->tobefnz; o != NULL; o = o->next) + markobject(g, o); +} + + +/* +** Mark all values stored in marked open upvalues from non-marked threads. +** (Values from marked threads were already marked when traversing the +** thread.) Remove from the list threads that no longer have upvalues and +** not-marked threads. +*/ +static void remarkupvals (global_State *g) { + lua_State *thread; + lua_State **p = &g->twups; + while ((thread = *p) != NULL) { + lua_assert(!isblack(thread)); /* threads are never black */ + if (isgray(thread) && thread->openupval != NULL) + p = &thread->twups; /* keep marked thread with upvalues in the list */ + else { /* thread is not marked or without upvalues */ + UpVal *uv; + *p = thread->twups; /* remove thread from the list */ + thread->twups = thread; /* mark that it is out of list */ + for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { + if (uv->u.open.touched) { + markvalue(g, uv->v); /* remark upvalue's value */ + uv->u.open.touched = 0; + } + } + } + } +} + + +/* +** mark root set and reset all gray lists, to start a new collection +*/ +static void restartcollection (global_State *g) { + g->gray = g->grayagain = NULL; + g->weak = g->allweak = g->ephemeron = NULL; + markobject(g, g->mainthread); + markvalue(g, &g->l_registry); + markmt(g); + markbeingfnz(g); /* mark any finalizing object left from previous cycle */ +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Traverse functions +** ======================================================= +*/ + +/* +** Traverse a table with weak values and link it to proper list. During +** propagate phase, keep it in 'grayagain' list, to be revisited in the +** atomic phase. In the atomic phase, if table has any white value, +** put it in 'weak' list, to be cleared. +*/ +static void traverseweakvalue (global_State *g, Table *h) { + Node *n, *limit = gnodelast(h); + /* if there is array part, assume it may have white values (it is not + worth traversing it now just to check) */ + int hasclears = (h->sizearray > 0); + for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ + checkdeadkey(n); + if (ttisnil(gval(n))) /* entry is empty? */ + removeentry(n); /* remove it */ + else { + lua_assert(!ttisnil(gkey(n))); + markvalue(g, gkey(n)); /* mark key */ + if (!hasclears && iscleared(g, gval(n))) /* is there a white value? */ + hasclears = 1; /* table will have to be cleared */ + } + } + if (g->gcstate == GCSpropagate) + linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ + else if (hasclears) + linkgclist(h, g->weak); /* has to be cleared later */ +} + + +/* +** Traverse an ephemeron table and link it to proper list. Returns true +** iff any object was marked during this traversal (which implies that +** convergence has to continue). During propagation phase, keep table +** in 'grayagain' list, to be visited again in the atomic phase. In +** the atomic phase, if table has any white->white entry, it has to +** be revisited during ephemeron convergence (as that key may turn +** black). Otherwise, if it has any white key, table has to be cleared +** (in the atomic phase). +*/ +static int traverseephemeron (global_State *g, Table *h) { + int marked = 0; /* true if an object is marked in this traversal */ + int hasclears = 0; /* true if table has white keys */ + int hasww = 0; /* true if table has entry "white-key -> white-value" */ + Node *n, *limit = gnodelast(h); + unsigned int i; + /* traverse array part */ + for (i = 0; i < h->sizearray; i++) { + if (valiswhite(&h->array[i])) { + marked = 1; + reallymarkobject(g, gcvalue(&h->array[i])); + } + } + /* traverse hash part */ + for (n = gnode(h, 0); n < limit; n++) { + checkdeadkey(n); + if (ttisnil(gval(n))) /* entry is empty? */ + removeentry(n); /* remove it */ + else if (iscleared(g, gkey(n))) { /* key is not marked (yet)? */ + hasclears = 1; /* table must be cleared */ + if (valiswhite(gval(n))) /* value not marked yet? */ + hasww = 1; /* white-white entry */ + } + else if (valiswhite(gval(n))) { /* value not marked yet? */ + marked = 1; + reallymarkobject(g, gcvalue(gval(n))); /* mark it now */ + } + } + /* link table into proper list */ + if (g->gcstate == GCSpropagate) + linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ + else if (hasww) /* table has white->white entries? */ + linkgclist(h, g->ephemeron); /* have to propagate again */ + else if (hasclears) /* table has white keys? */ + linkgclist(h, g->allweak); /* may have to clean white keys */ + return marked; +} + + +static void traversestrongtable (global_State *g, Table *h) { + Node *n, *limit = gnodelast(h); + unsigned int i; + for (i = 0; i < h->sizearray; i++) /* traverse array part */ + markvalue(g, &h->array[i]); + for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ + checkdeadkey(n); + if (ttisnil(gval(n))) /* entry is empty? */ + removeentry(n); /* remove it */ + else { + lua_assert(!ttisnil(gkey(n))); + markvalue(g, gkey(n)); /* mark key */ + markvalue(g, gval(n)); /* mark value */ + } + } +} + + +static lu_mem traversetable (global_State *g, Table *h) { + const char *weakkey, *weakvalue; + const TValue *mode = gfasttm(g, h->metatable, TM_MODE); + markobjectN(g, h->metatable); + if (mode && ttisstring(mode) && /* is there a weak mode? */ + ((weakkey = strchr(svalue(mode), 'k')), + (weakvalue = strchr(svalue(mode), 'v')), + (weakkey || weakvalue))) { /* is really weak? */ + black2gray(h); /* keep table gray */ + if (!weakkey) /* strong keys? */ + traverseweakvalue(g, h); + else if (!weakvalue) /* strong values? */ + traverseephemeron(g, h); + else /* all weak */ + linkgclist(h, g->allweak); /* nothing to traverse now */ + } + else /* not weak */ + traversestrongtable(g, h); + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * cast(size_t, allocsizenode(h)); +} + + +/* +** Traverse a prototype. (While a prototype is being build, its +** arrays can be larger than needed; the extra slots are filled with +** NULL, so the use of 'markobjectN') +*/ +static int traverseproto (global_State *g, Proto *f) { + int i; + if (f->cache && iswhite(f->cache)) + f->cache = NULL; /* allow cache to be collected */ + markobjectN(g, f->source); + for (i = 0; i < f->sizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ + markobjectN(g, f->upvalues[i].name); + for (i = 0; i < f->sizep; i++) /* mark nested protos */ + markobjectN(g, f->p[i]); + for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ + markobjectN(g, f->locvars[i].varname); + return sizeof(Proto) + sizeof(Instruction) * f->sizecode + + sizeof(Proto *) * f->sizep + + sizeof(TValue) * f->sizek + + sizeof(int) * f->sizelineinfo + + sizeof(LocVar) * f->sizelocvars + + sizeof(Upvaldesc) * f->sizeupvalues; +} + + +static lu_mem traverseCclosure (global_State *g, CClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->upvalue[i]); + return sizeCclosure(cl->nupvalues); +} + +/* +** open upvalues point to values in a thread, so those values should +** be marked when the thread is traversed except in the atomic phase +** (because then the value cannot be changed by the thread and the +** thread may not be traversed again) +*/ +static lu_mem traverseLclosure (global_State *g, LClosure *cl) { + int i; + markobjectN(g, cl->p); /* mark its prototype */ + for (i = 0; i < cl->nupvalues; i++) { /* mark its upvalues */ + UpVal *uv = cl->upvals[i]; + if (uv != NULL) { + if (upisopen(uv) && g->gcstate != GCSinsideatomic) + uv->u.open.touched = 1; /* can be marked in 'remarkupvals' */ + else + markvalue(g, uv->v); + } + } + return sizeLclosure(cl->nupvalues); +} + + +static lu_mem traversethread (global_State *g, lua_State *th) { + StkId o = th->stack; + if (o == NULL) + return 1; /* stack not completely built yet */ + lua_assert(g->gcstate == GCSinsideatomic || + th->openupval == NULL || isintwups(th)); + for (; o < th->top; o++) /* mark live elements in the stack */ + markvalue(g, o); + if (g->gcstate == GCSinsideatomic) { /* final traversal? */ + StkId lim = th->stack + th->stacksize; /* real end of stack */ + for (; o < lim; o++) /* clear not-marked stack slice */ + setnilvalue(o); + /* 'remarkupvals' may have removed thread from 'twups' list */ + if (!isintwups(th) && th->openupval != NULL) { + th->twups = g->twups; /* link it back to the list */ + g->twups = th; + } + } + else if (g->gckind != KGC_EMERGENCY) + luaD_shrinkstack(th); /* do not change stack in emergency cycle */ + return (sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->nci); +} + + +/* +** traverse one gray object, turning it to black (except for threads, +** which are always gray). +*/ +static void propagatemark (global_State *g) { + lu_mem size; + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->tt) { + case LUA_TTABLE: { + Table *h = gco2t(o); + g->gray = h->gclist; /* remove from 'gray' list */ + size = traversetable(g, h); + break; + } + case LUA_TLCL: { + LClosure *cl = gco2lcl(o); + g->gray = cl->gclist; /* remove from 'gray' list */ + size = traverseLclosure(g, cl); + break; + } + case LUA_TCCL: { + CClosure *cl = gco2ccl(o); + g->gray = cl->gclist; /* remove from 'gray' list */ + size = traverseCclosure(g, cl); + break; + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; /* remove from 'gray' list */ + linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ + black2gray(o); + size = traversethread(g, th); + break; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; /* remove from 'gray' list */ + size = traverseproto(g, p); + break; + } + default: lua_assert(0); return; + } + g->GCmemtrav += size; +} + + +static void propagateall (global_State *g) { + while (g->gray) propagatemark(g); +} + + +static void convergeephemerons (global_State *g) { + int changed; + do { + GCObject *w; + GCObject *next = g->ephemeron; /* get ephemeron list */ + g->ephemeron = NULL; /* tables may return to this list when traversed */ + changed = 0; + while ((w = next) != NULL) { + next = gco2t(w)->gclist; + if (traverseephemeron(g, gco2t(w))) { /* traverse marked some value? */ + propagateall(g); /* propagate changes */ + changed = 1; /* will have to revisit all ephemeron tables */ + } + } + } while (changed); +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Sweep Functions +** ======================================================= +*/ + + +/* +** clear entries with unmarked keys from all weaktables in list 'l' up +** to element 'f' +*/ +static void clearkeys (global_State *g, GCObject *l, GCObject *f) { + for (; l != f; l = gco2t(l)->gclist) { + Table *h = gco2t(l); + Node *n, *limit = gnodelast(h); + for (n = gnode(h, 0); n < limit; n++) { + if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) { + setnilvalue(gval(n)); /* remove value ... */ + } + if (ttisnil(gval(n))) /* is entry empty? */ + removeentry(n); /* remove entry from table */ + } + } +} + + +/* +** clear entries with unmarked values from all weaktables in list 'l' up +** to element 'f' +*/ +static void clearvalues (global_State *g, GCObject *l, GCObject *f) { + for (; l != f; l = gco2t(l)->gclist) { + Table *h = gco2t(l); + Node *n, *limit = gnodelast(h); + unsigned int i; + for (i = 0; i < h->sizearray; i++) { + TValue *o = &h->array[i]; + if (iscleared(g, o)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + for (n = gnode(h, 0); n < limit; n++) { + if (!ttisnil(gval(n)) && iscleared(g, gval(n))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* and remove entry from table */ + } + } + } +} + + +void luaC_upvdeccount (lua_State *L, UpVal *uv) { + lua_assert(uv->refcount > 0); + uv->refcount--; + if (uv->refcount == 0 && !upisopen(uv)) + luaM_free(L, uv); +} + + +static void freeLclosure (lua_State *L, LClosure *cl) { + int i; + for (i = 0; i < cl->nupvalues; i++) { + UpVal *uv = cl->upvals[i]; + if (uv) + luaC_upvdeccount(L, uv); + } + luaM_freemem(L, cl, sizeLclosure(cl->nupvalues)); +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TLCL: { + freeLclosure(L, gco2lcl(o)); + break; + } + case LUA_TCCL: { + luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues)); + break; + } + case LUA_TTABLE: luaH_free(L, gco2t(o)); break; + case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break; + case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; + case LUA_TSHRSTR: + luaS_remove(L, gco2ts(o)); /* remove it from hash table */ + luaM_freemem(L, o, sizelstring(gco2ts(o)->shrlen)); + break; + case LUA_TLNGSTR: { + luaM_freemem(L, o, sizelstring(gco2ts(o)->u.lnglen)); + break; + } + default: lua_assert(0); + } +} + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count); + + +/* +** sweep at most 'count' elements from a list of GCObjects erasing dead +** objects, where a dead object is one marked with the old (non current) +** white; change all non-dead objects back to white, preparing for next +** collection cycle. Return where to continue the traversal or NULL if +** list is finished. +*/ +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + global_State *g = G(L); + int ow = otherwhite(g); + int white = luaC_white(g); /* current white */ + while (*p != NULL && count-- > 0) { + GCObject *curr = *p; + int marked = curr->marked; + if (isdeadm(ow, marked)) { /* is 'curr' dead? */ + *p = curr->next; /* remove 'curr' from list */ + freeobj(L, curr); /* erase 'curr' */ + } + else { /* change mark to 'white' */ + curr->marked = cast_byte((marked & maskcolors) | white); + p = &curr->next; /* go to next element */ + } + } + return (*p == NULL) ? NULL : p; +} + + +/* +** sweep a list until a live object (or end of list) +*/ +static GCObject **sweeptolive (lua_State *L, GCObject **p) { + GCObject **old = p; + do { + p = sweeplist(L, p, 1); + } while (p == old); + return p; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** Finalization +** ======================================================= +*/ + +/* +** If possible, shrink string table +*/ +static void checkSizes (lua_State *L, global_State *g) { + if (g->gckind != KGC_EMERGENCY) { + l_mem olddebt = g->GCdebt; + if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ + luaS_resize(L, g->strt.size / 2); /* shrink it a little */ + g->GCestimate += g->GCdebt - olddebt; /* update estimate */ + } +} + + +static GCObject *udata2finalize (global_State *g) { + GCObject *o = g->tobefnz; /* get first element */ + lua_assert(tofinalize(o)); + g->tobefnz = o->next; /* remove it from 'tobefnz' list */ + o->next = g->allgc; /* return it to 'allgc' list */ + g->allgc = o; + resetbit(o->marked, FINALIZEDBIT); /* object is "normal" again */ + if (issweepphase(g)) + makewhite(g, o); /* "sweep" object */ + return o; +} + + +static void dothecall (lua_State *L, void *ud) { + UNUSED(ud); + luaD_callnoyield(L, L->top - 2, 0); +} + + +static void GCTM (lua_State *L, int propagateerrors) { + global_State *g = G(L); + const TValue *tm; + TValue v; + setgcovalue(L, &v, udata2finalize(g)); + tm = luaT_gettmbyobj(L, &v, TM_GC); + if (tm != NULL && ttisfunction(tm)) { /* is there a finalizer? */ + int status; + lu_byte oldah = L->allowhook; + int running = g->gcrunning; + L->allowhook = 0; /* stop debug hooks during GC metamethod */ + g->gcrunning = 0; /* avoid GC steps */ + setobj2s(L, L->top, tm); /* push finalizer... */ + setobj2s(L, L->top + 1, &v); /* ... and its argument */ + L->top += 2; /* and (next line) call the finalizer */ + L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ + status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); + L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ + L->allowhook = oldah; /* restore hooks */ + g->gcrunning = running; /* restore state */ + if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ + if (status == LUA_ERRRUN) { /* is there an error object? */ + const char *msg = (ttisstring(L->top - 1)) + ? svalue(L->top - 1) + : "no message"; + luaO_pushfstring(L, "error in __gc metamethod (%s)", msg); + status = LUA_ERRGCMM; /* error in __gc metamethod */ + } + luaD_throw(L, status); /* re-throw error */ + } + } +} + + +/* +** call a few (up to 'g->gcfinnum') finalizers +*/ +static int runafewfinalizers (lua_State *L) { + global_State *g = G(L); + unsigned int i; + lua_assert(!g->tobefnz || g->gcfinnum > 0); + for (i = 0; g->tobefnz && i < g->gcfinnum; i++) + GCTM(L, 1); /* call one finalizer */ + g->gcfinnum = (!g->tobefnz) ? 0 /* nothing more to finalize? */ + : g->gcfinnum * 2; /* else call a few more next time */ + return i; +} + + +/* +** call all pending finalizers +*/ +static void callallpendingfinalizers (lua_State *L) { + global_State *g = G(L); + while (g->tobefnz) + GCTM(L, 0); +} + + +/* +** find last 'next' field in list 'p' list (to add elements in its end) +*/ +static GCObject **findlast (GCObject **p) { + while (*p != NULL) + p = &(*p)->next; + return p; +} + + +/* +** move all unreachable objects (or 'all' objects) that need +** finalization from list 'finobj' to list 'tobefnz' (to be finalized) +*/ +static void separatetobefnz (global_State *g, int all) { + GCObject *curr; + GCObject **p = &g->finobj; + GCObject **lastnext = findlast(&g->tobefnz); + while ((curr = *p) != NULL) { /* traverse all finalizable objects */ + lua_assert(tofinalize(curr)); + if (!(iswhite(curr) || all)) /* not being collected? */ + p = &curr->next; /* don't bother with it */ + else { + *p = curr->next; /* remove 'curr' from 'finobj' list */ + curr->next = *lastnext; /* link at the end of 'tobefnz' list */ + *lastnext = curr; + lastnext = &curr->next; + } + } +} + + +/* +** if object 'o' has a finalizer, remove it from 'allgc' list (must +** search the list to find it) and link it in 'finobj' list. +*/ +void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { + global_State *g = G(L); + if (tofinalize(o) || /* obj. is already marked... */ + gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */ + return; /* nothing to be done */ + else { /* move 'o' to 'finobj' list */ + GCObject **p; + if (issweepphase(g)) { + makewhite(g, o); /* "sweep" object 'o' */ + if (g->sweepgc == &o->next) /* should not remove 'sweepgc' object */ + g->sweepgc = sweeptolive(L, g->sweepgc); /* change 'sweepgc' */ + } + /* search for pointer pointing to 'o' */ + for (p = &g->allgc; *p != o; p = &(*p)->next) { /* empty */ } + *p = o->next; /* remove 'o' from 'allgc' list */ + o->next = g->finobj; /* link it in 'finobj' list */ + g->finobj = o; + l_setbit(o->marked, FINALIZEDBIT); /* mark it as such */ + } +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** GC control +** ======================================================= +*/ + + +/* +** Set a reasonable "time" to wait before starting a new GC cycle; cycle +** will start when memory use hits threshold. (Division by 'estimate' +** should be OK: it cannot be zero (because Lua cannot even start with +** less than PAUSEADJ bytes). +*/ +static void setpause (global_State *g) { + l_mem threshold, debt; + l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */ + lua_assert(estimate > 0); + threshold = (g->gcpause < MAX_LMEM / estimate) /* overflow? */ + ? estimate * g->gcpause /* no overflow */ + : MAX_LMEM; /* overflow; truncate to maximum */ + debt = gettotalbytes(g) - threshold; + luaE_setdebt(g, debt); +} + + +/* +** Enter first sweep phase. +** The call to 'sweeplist' tries to make pointer point to an object +** inside the list (instead of to the header), so that the real sweep do +** not need to skip objects created between "now" and the start of the +** real sweep. +*/ +static void entersweep (lua_State *L) { + global_State *g = G(L); + g->gcstate = GCSswpallgc; + lua_assert(g->sweepgc == NULL); + g->sweepgc = sweeplist(L, &g->allgc, 1); +} + + +void luaC_freeallobjects (lua_State *L) { + global_State *g = G(L); + separatetobefnz(g, 1); /* separate all objects with finalizers */ + lua_assert(g->finobj == NULL); + callallpendingfinalizers(L); + lua_assert(g->tobefnz == NULL); + g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */ + g->gckind = KGC_NORMAL; + sweepwholelist(L, &g->finobj); + sweepwholelist(L, &g->allgc); + sweepwholelist(L, &g->fixedgc); /* collect fixed objects */ + lua_assert(g->strt.nuse == 0); +} + + +static l_mem atomic (lua_State *L) { + global_State *g = G(L); + l_mem work; + GCObject *origweak, *origall; + GCObject *grayagain = g->grayagain; /* save original list */ + lua_assert(g->ephemeron == NULL && g->weak == NULL); + lua_assert(!iswhite(g->mainthread)); + g->gcstate = GCSinsideatomic; + g->GCmemtrav = 0; /* start counting work */ + markobject(g, L); /* mark running thread */ + /* registry and global metatables may be changed by API */ + markvalue(g, &g->l_registry); + markmt(g); /* mark global metatables */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + propagateall(g); /* propagate changes */ + work = g->GCmemtrav; /* stop counting (do not recount 'grayagain') */ + g->gray = grayagain; + propagateall(g); /* traverse 'grayagain' list */ + g->GCmemtrav = 0; /* restart counting */ + convergeephemerons(g); + /* at this point, all strongly accessible objects are marked. */ + /* Clear values from weak tables, before checking finalizers */ + clearvalues(g, g->weak, NULL); + clearvalues(g, g->allweak, NULL); + origweak = g->weak; origall = g->allweak; + work += g->GCmemtrav; /* stop counting (objects being finalized) */ + separatetobefnz(g, 0); /* separate objects to be finalized */ + g->gcfinnum = 1; /* there may be objects to be finalized */ + markbeingfnz(g); /* mark objects that will be finalized */ + propagateall(g); /* remark, to propagate 'resurrection' */ + g->GCmemtrav = 0; /* restart counting */ + convergeephemerons(g); + /* at this point, all resurrected objects are marked. */ + /* remove dead objects from weak tables */ + clearkeys(g, g->ephemeron, NULL); /* clear keys from all ephemeron tables */ + clearkeys(g, g->allweak, NULL); /* clear keys from all 'allweak' tables */ + /* clear values from resurrected weak tables */ + clearvalues(g, g->weak, origweak); + clearvalues(g, g->allweak, origall); + luaS_clearcache(g); + g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ + work += g->GCmemtrav; /* complete counting */ + return work; /* estimate of memory marked by 'atomic' */ +} + + +static lu_mem sweepstep (lua_State *L, global_State *g, + int nextstate, GCObject **nextlist) { + if (g->sweepgc) { + l_mem olddebt = g->GCdebt; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + g->GCestimate += g->GCdebt - olddebt; /* update estimate */ + if (g->sweepgc) /* is there still something to sweep? */ + return (GCSWEEPMAX * GCSWEEPCOST); + } + /* else enter next state */ + g->gcstate = nextstate; + g->sweepgc = nextlist; + return 0; +} + + +static lu_mem singlestep (lua_State *L) { + global_State *g = G(L); + switch (g->gcstate) { + case GCSpause: { + g->GCmemtrav = g->strt.size * sizeof(GCObject*); + restartcollection(g); + g->gcstate = GCSpropagate; + return g->GCmemtrav; + } + case GCSpropagate: { + g->GCmemtrav = 0; + lua_assert(g->gray); + propagatemark(g); + if (g->gray == NULL) /* no more gray objects? */ + g->gcstate = GCSatomic; /* finish propagate phase */ + return g->GCmemtrav; /* memory traversed in this step */ + } + case GCSatomic: { + lu_mem work; + propagateall(g); /* make sure gray list is empty */ + work = atomic(L); /* work is what was traversed by 'atomic' */ + entersweep(L); + g->GCestimate = gettotalbytes(g); /* first estimate */; + return work; + } + case GCSswpallgc: { /* sweep "regular" objects */ + return sweepstep(L, g, GCSswpfinobj, &g->finobj); + } + case GCSswpfinobj: { /* sweep objects with finalizers */ + return sweepstep(L, g, GCSswptobefnz, &g->tobefnz); + } + case GCSswptobefnz: { /* sweep objects to be finalized */ + return sweepstep(L, g, GCSswpend, NULL); + } + case GCSswpend: { /* finish sweeps */ + makewhite(g, g->mainthread); /* sweep main thread */ + checkSizes(L, g); + g->gcstate = GCScallfin; + return 0; + } + case GCScallfin: { /* call remaining finalizers */ + if (g->tobefnz && g->gckind != KGC_EMERGENCY) { + int n = runafewfinalizers(L); + return (n * GCFINALIZECOST); + } + else { /* emergency mode or no more finalizers */ + g->gcstate = GCSpause; /* finish collection */ + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +/* +** advances the garbage collector until it reaches a state allowed +** by 'statemask' +*/ +void luaC_runtilstate (lua_State *L, int statesmask) { + global_State *g = G(L); + while (!testbit(statesmask, g->gcstate)) + singlestep(L); +} + + +/* +** get GC debt and convert it from Kb to 'work units' (avoid zero debt +** and overflows) +*/ +static l_mem getdebt (global_State *g) { + l_mem debt = g->GCdebt; + int stepmul = g->gcstepmul; + if (debt <= 0) return 0; /* minimal debt */ + else { + debt = (debt / STEPMULADJ) + 1; + debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM; + return debt; + } +} + +/* +** performs a basic GC step when collector is running +*/ +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem debt = getdebt(g); /* GC deficit (be paid now) */ + if (!g->gcrunning) { /* not running? */ + luaE_setdebt(g, -GCSTEPSIZE * 10); /* avoid being called too often */ + return; + } + do { /* repeat until pause or enough "credit" (negative debt) */ + lu_mem work = singlestep(L); /* perform one single step */ + debt -= work; + } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause); + if (g->gcstate == GCSpause) + setpause(g); /* pause until next cycle */ + else { + debt = (debt / g->gcstepmul) * STEPMULADJ; /* convert 'work units' to Kb */ + luaE_setdebt(g, debt); + runafewfinalizers(L); + } +} + + +/* +** Performs a full GC cycle; if 'isemergency', set a flag to avoid +** some operations which could change the interpreter state in some +** unexpected ways (running finalizers and shrinking some structures). +** Before running the collection, check 'keepinvariant'; if it is true, +** there may be some objects marked as black, so the collector has +** to sweep all objects to turn them back to white (as white has not +** changed, nothing will be collected). +*/ +void luaC_fullgc (lua_State *L, int isemergency) { + global_State *g = G(L); + lua_assert(g->gckind == KGC_NORMAL); + if (isemergency) g->gckind = KGC_EMERGENCY; /* set flag */ + if (keepinvariant(g)) { /* black objects? */ + entersweep(L); /* sweep everything to turn them back to white */ + } + /* finish any pending sweep phase to start a new cycle */ + luaC_runtilstate(L, bitmask(GCSpause)); + luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */ + luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */ + /* estimate must be correct after a full GC cycle */ + lua_assert(g->GCestimate == gettotalbytes(g)); + luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ + g->gckind = KGC_NORMAL; + setpause(g); +} + +/* }====================================================== */ + + diff --git a/deps/lua/src/lgc.h b/deps/lua/src/lgc.h new file mode 100644 index 0000000000..425cd7cef3 --- /dev/null +++ b/deps/lua/src/lgc.h @@ -0,0 +1,147 @@ +/* +** $Id: lgc.h,v 2.91.1.1 2017/04/19 17:39:34 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" +#include "lstate.h" + +/* +** Collectable objects may have one of three colors: white, which +** means the object is not marked; gray, which means the +** object is marked, but its references may be not marked; and +** black, which means that the object and all its references are marked. +** The main invariant of the garbage collector, while marking objects, +** is that a black object can never point to a white one. Moreover, +** any gray object must be in a "gray list" (gray, grayagain, weak, +** allweak, ephemeron) so that it can be visited again before finishing +** the collection cycle. These lists have no meaning when the invariant +** is not being enforced (e.g., sweep phase). +*/ + + + +/* how much to allocate before next GC step */ +#if !defined(GCSTEPSIZE) +/* ~100 small strings */ +#define GCSTEPSIZE (cast_int(100 * sizeof(TString))) +#endif + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpropagate 0 +#define GCSatomic 1 +#define GCSswpallgc 2 +#define GCSswpfinobj 3 +#define GCSswptobefnz 4 +#define GCSswpend 5 +#define GCScallfin 6 +#define GCSpause 7 + + +#define issweepphase(g) \ + (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) + + +/* +** macro to tell when main invariant (white objects cannot point to black +** ones) must be kept. During a collection, the sweep +** phase may break the invariant, as objects turned white may point to +** still-black objects. The invariant is restored when sweep ends and +** all objects are white again. +*/ + +#define keepinvariant(g) ((g)->gcstate <= GCSatomic) + + +/* +** some useful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) + + +/* Layout for bit use in 'marked' field: */ +#define WHITE0BIT 0 /* object is white (type 0) */ +#define WHITE1BIT 1 /* object is white (type 1) */ +#define BLACKBIT 2 /* object is black */ +#define FINALIZEDBIT 3 /* object has been marked for finalization */ +/* bit 7 is currently used by tests (luaL_checkmemory) */ + +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) testbits((x)->marked, WHITEBITS) +#define isblack(x) testbit((x)->marked, BLACKBIT) +#define isgray(x) /* neither white nor black */ \ + (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT))) + +#define tofinalize(x) testbit((x)->marked, FINALIZEDBIT) + +#define otherwhite(g) ((g)->currentwhite ^ WHITEBITS) +#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) +#define isdead(g,v) isdeadm(otherwhite(g), (v)->marked) + +#define changewhite(x) ((x)->marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->marked, BLACKBIT) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +/* +** Does one step of collection when debt becomes positive. 'pre'/'pos' +** allows some adjustments to be done only when needed. macro +** 'condchangemem' is used only for heavy tests (forcing a full +** GC cycle on every opportunity) +*/ +#define luaC_condGC(L,pre,pos) \ + { if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; \ + condchangemem(L,pre,pos); } + +/* more often than not, 'pre'/'pos' are empty */ +#define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0) + + +#define luaC_barrier(L,p,v) ( \ + (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ + luaC_barrier_(L,obj2gco(p),gcvalue(v)) : cast_void(0)) + +#define luaC_barrierback(L,p,v) ( \ + (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ + luaC_barrierback_(L,p) : cast_void(0)) + +#define luaC_objbarrier(L,p,o) ( \ + (isblack(p) && iswhite(o)) ? \ + luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) + +#define luaC_upvalbarrier(L,uv) ( \ + (iscollectable((uv)->v) && !upisopen(uv)) ? \ + luaC_upvalbarrier_(L,uv) : cast_void(0)) + +LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); +LUAI_FUNC void luaC_freeallobjects (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); +LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); +LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); +LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o); +LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); +LUAI_FUNC void luaC_upvdeccount (lua_State *L, UpVal *uv); + + +#endif diff --git a/deps/lua/src/linit.c b/deps/lua/src/linit.c new file mode 100644 index 0000000000..480da52c7e --- /dev/null +++ b/deps/lua/src/linit.c @@ -0,0 +1,68 @@ +/* +** $Id: linit.c,v 1.39.1.1 2017/04/19 17:20:42 roberto Exp $ +** Initialization of libraries for lua.c and other clients +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +/* +** If you embed Lua in your program and need to open the standard +** libraries, call luaL_openlibs in your program. If you need a +** different set of libraries, copy this file to your project and edit +** it to suit your needs. +** +** You can also *preload* libraries, so that a later 'require' can +** open the library, which is already linked to the application. +** For that, do the following code: +** +** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); +** lua_pushcfunction(L, luaopen_modname); +** lua_setfield(L, -2, modname); +** lua_pop(L, 1); // remove PRELOAD table +*/ + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +/* +** these libs are loaded by lua.c and are readily available to any Lua +** program +*/ +static const luaL_Reg loadedlibs[] = { + {"_G", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_COLIBNAME, luaopen_coroutine}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_UTF8LIBNAME, luaopen_utf8}, + {LUA_DBLIBNAME, luaopen_debug}, +#if defined(LUA_COMPAT_BITLIB) + {LUA_BITLIBNAME, luaopen_bit32}, +#endif + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib; + /* "require" functions from 'loadedlibs' and set results to global table */ + for (lib = loadedlibs; lib->func; lib++) { + luaL_requiref(L, lib->name, lib->func, 1); + lua_pop(L, 1); /* remove lib */ + } +} + diff --git a/deps/lua/src/liolib.c b/deps/lua/src/liolib.c new file mode 100644 index 0000000000..8a9e75cd08 --- /dev/null +++ b/deps/lua/src/liolib.c @@ -0,0 +1,776 @@ +/* +** $Id: liolib.c,v 2.151.1.1 2017/04/19 17:29:57 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + +#define liolib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** Change this macro to accept other modes for 'fopen' besides +** the standard ones. +*/ +#if !defined(l_checkmode) + +/* accepted extensions to 'mode' in 'fopen' */ +#if !defined(L_MODEEXT) +#define L_MODEEXT "b" +#endif + +/* Check whether 'mode' matches '[rwa]%+?[L_MODEEXT]*' */ +static int l_checkmode (const char *mode) { + return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && + (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */ + (strspn(mode, L_MODEEXT) == strlen(mode))); /* check extensions */ +} + +#endif + +/* +** {====================================================== +** l_popen spawns a new process connected to the current +** one through the file streams. +** ======================================================= +*/ + +#if !defined(l_popen) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#define l_popen(L,c,m) (fflush(NULL), popen(c,m)) +#define l_pclose(L,file) (pclose(file)) + +#elif defined(LUA_USE_WINDOWS) /* }{ */ + +#define l_popen(L,c,m) (_popen(c,m)) +#define l_pclose(L,file) (_pclose(file)) + +#else /* }{ */ + +/* ISO C definitions */ +#define l_popen(L,c,m) \ + ((void)((void)c, m), \ + luaL_error(L, "'popen' not supported"), \ + (FILE*)0) +#define l_pclose(L,file) ((void)L, (void)file, -1) + +#endif /* } */ + +#endif /* } */ + +/* }====================================================== */ + + +#if !defined(l_getc) /* { */ + +#if defined(LUA_USE_POSIX) +#define l_getc(f) getc_unlocked(f) +#define l_lockfile(f) flockfile(f) +#define l_unlockfile(f) funlockfile(f) +#else +#define l_getc(f) getc(f) +#define l_lockfile(f) ((void)0) +#define l_unlockfile(f) ((void)0) +#endif + +#endif /* } */ + + +/* +** {====================================================== +** l_fseek: configuration for longer offsets +** ======================================================= +*/ + +#if !defined(l_fseek) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#include + +#define l_fseek(f,o,w) fseeko(f,o,w) +#define l_ftell(f) ftello(f) +#define l_seeknum off_t + +#elif defined(LUA_USE_WINDOWS) && !defined(_CRTIMP_TYPEINFO) \ + && defined(_MSC_VER) && (_MSC_VER >= 1400) /* }{ */ + +/* Windows (but not DDK) and Visual C++ 2005 or higher */ +#define l_fseek(f,o,w) _fseeki64(f,o,w) +#define l_ftell(f) _ftelli64(f) +#define l_seeknum __int64 + +#else /* }{ */ + +/* ISO C definitions */ +#define l_fseek(f,o,w) fseek(f,o,w) +#define l_ftell(f) ftell(f) +#define l_seeknum long + +#endif /* } */ + +#endif /* } */ + +/* }====================================================== */ + + +#define IO_PREFIX "_IO_" +#define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) +#define IO_INPUT (IO_PREFIX "input") +#define IO_OUTPUT (IO_PREFIX "output") + + +typedef luaL_Stream LStream; + + +#define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + +#define isclosed(p) ((p)->closef == NULL) + + +static int io_type (lua_State *L) { + LStream *p; + luaL_checkany(L, 1); + p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE); + if (p == NULL) + lua_pushnil(L); /* not a file */ + else if (isclosed(p)) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static int f_tostring (lua_State *L) { + LStream *p = tolstream(L); + if (isclosed(p)) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", p->f); + return 1; +} + + +static FILE *tofile (lua_State *L) { + LStream *p = tolstream(L); + if (isclosed(p)) + luaL_error(L, "attempt to use a closed file"); + lua_assert(p->f); + return p->f; +} + + +/* +** When creating file handles, always creates a 'closed' file handle +** before opening the actual file; so, if there is a memory error, the +** handle is in a consistent state. +*/ +static LStream *newprefile (lua_State *L) { + LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream)); + p->closef = NULL; /* mark file handle as 'closed' */ + luaL_setmetatable(L, LUA_FILEHANDLE); + return p; +} + + +/* +** Calls the 'close' function from a file handle. The 'volatile' avoids +** a bug in some versions of the Clang compiler (e.g., clang 3.0 for +** 32 bits). +*/ +static int aux_close (lua_State *L) { + LStream *p = tolstream(L); + volatile lua_CFunction cf = p->closef; + p->closef = NULL; /* mark stream as closed */ + return (*cf)(L); /* close it */ +} + + +static int f_close (lua_State *L) { + tofile(L); /* make sure argument is an open stream */ + return aux_close(L); +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) /* no argument? */ + lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ + return f_close(L); +} + + +static int f_gc (lua_State *L) { + LStream *p = tolstream(L); + if (!isclosed(p) && p->f != NULL) + aux_close(L); /* ignore closed and incompletely open files */ + return 0; +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + LStream *p = tolstream(L); + int res = fclose(p->f); + return luaL_fileresult(L, (res == 0), NULL); +} + + +static LStream *newfile (lua_State *L) { + LStream *p = newprefile(L); + p->f = NULL; + p->closef = &io_fclose; + return p; +} + + +static void opencheck (lua_State *L, const char *fname, const char *mode) { + LStream *p = newfile(L); + p->f = fopen(fname, mode); + if (p->f == NULL) + luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno)); +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + LStream *p = newfile(L); + const char *md = mode; /* to traverse/check mode */ + luaL_argcheck(L, l_checkmode(md), 2, "invalid mode"); + p->f = fopen(filename, mode); + return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + LStream *p = tolstream(L); + return luaL_execresult(L, l_pclose(L, p->f)); +} + + +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + LStream *p = newprefile(L); + p->f = l_popen(L, filename, mode); + p->closef = &io_pclose; + return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + LStream *p = newfile(L); + p->f = tmpfile(); + return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, const char *findex) { + LStream *p; + lua_getfield(L, LUA_REGISTRYINDEX, findex); + p = (LStream *)lua_touserdata(L, -1); + if (isclosed(p)) + luaL_error(L, "standard %s file is closed", findex + IOPREF_LEN); + return p->f; +} + + +static int g_iofile (lua_State *L, const char *f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) + opencheck(L, filename, mode); + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_setfield(L, LUA_REGISTRYINDEX, f); + } + /* return current value */ + lua_getfield(L, LUA_REGISTRYINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +/* +** maximum number of arguments to 'f:lines'/'io.lines' (it + 3 must fit +** in the limit for upvalues of a closure) +*/ +#define MAXARGLINE 250 + +static void aux_lines (lua_State *L, int toclose) { + int n = lua_gettop(L) - 1; /* number of arguments to read */ + luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments"); + lua_pushinteger(L, n); /* number of arguments to read */ + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ + lua_pushcclosure(L, io_readline, 3 + n); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + int toclose; + if (lua_isnone(L, 1)) lua_pushnil(L); /* at least one argument */ + if (lua_isnil(L, 1)) { /* no file name? */ + lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT); /* get default input */ + lua_replace(L, 1); /* put it at index 1 */ + tofile(L); /* check that it's a valid file handle */ + toclose = 0; /* do not close it after iteration */ + } + else { /* open a new file */ + const char *filename = luaL_checkstring(L, 1); + opencheck(L, filename, "r"); + lua_replace(L, 1); /* put file at index 1 */ + toclose = 1; /* close it after iteration */ + } + aux_lines(L, toclose); + return 1; +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +/* maximum length of a numeral */ +#if !defined (L_MAXLENNUM) +#define L_MAXLENNUM 200 +#endif + + +/* auxiliary structure used by 'read_number' */ +typedef struct { + FILE *f; /* file being read */ + int c; /* current character (look ahead) */ + int n; /* number of elements in buffer 'buff' */ + char buff[L_MAXLENNUM + 1]; /* +1 for ending '\0' */ +} RN; + + +/* +** Add current char to buffer (if not out of space) and read next one +*/ +static int nextc (RN *rn) { + if (rn->n >= L_MAXLENNUM) { /* buffer overflow? */ + rn->buff[0] = '\0'; /* invalidate result */ + return 0; /* fail */ + } + else { + rn->buff[rn->n++] = rn->c; /* save current char */ + rn->c = l_getc(rn->f); /* read next one */ + return 1; + } +} + + +/* +** Accept current char if it is in 'set' (of size 2) +*/ +static int test2 (RN *rn, const char *set) { + if (rn->c == set[0] || rn->c == set[1]) + return nextc(rn); + else return 0; +} + + +/* +** Read a sequence of (hex)digits +*/ +static int readdigits (RN *rn, int hex) { + int count = 0; + while ((hex ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) + count++; + return count; +} + + +/* +** Read a number: first reads a valid prefix of a numeral into a buffer. +** Then it calls 'lua_stringtonumber' to check whether the format is +** correct and to convert it to a Lua number +*/ +static int read_number (lua_State *L, FILE *f) { + RN rn; + int count = 0; + int hex = 0; + char decp[2]; + rn.f = f; rn.n = 0; + decp[0] = lua_getlocaledecpoint(); /* get decimal point from locale */ + decp[1] = '.'; /* always accept a dot */ + l_lockfile(rn.f); + do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ + test2(&rn, "-+"); /* optional signal */ + if (test2(&rn, "00")) { + if (test2(&rn, "xX")) hex = 1; /* numeral is hexadecimal */ + else count = 1; /* count initial '0' as a valid digit */ + } + count += readdigits(&rn, hex); /* integral part */ + if (test2(&rn, decp)) /* decimal point? */ + count += readdigits(&rn, hex); /* fractional part */ + if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) { /* exponent mark? */ + test2(&rn, "-+"); /* exponent signal */ + readdigits(&rn, 0); /* exponent digits */ + } + ungetc(rn.c, rn.f); /* unread look-ahead char */ + l_unlockfile(rn.f); + rn.buff[rn.n] = '\0'; /* finish string */ + if (lua_stringtonumber(L, rn.buff)) /* is this a valid number? */ + return 1; /* ok */ + else { /* invalid format */ + lua_pushnil(L); /* "result" to be removed */ + return 0; /* read fails */ + } +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); /* no-op when c == EOF */ + lua_pushliteral(L, ""); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f, int chop) { + luaL_Buffer b; + int c = '\0'; + luaL_buffinit(L, &b); + while (c != EOF && c != '\n') { /* repeat until end of line */ + char *buff = luaL_prepbuffer(&b); /* preallocate buffer */ + int i = 0; + l_lockfile(f); /* no memory errors can happen inside the lock */ + while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n') + buff[i++] = c; + l_unlockfile(f); + luaL_addsize(&b, i); + } + if (!chop && c == '\n') /* want a newline and have one? */ + luaL_addchar(&b, c); /* add ending newline to result */ + luaL_pushresult(&b); /* close buffer */ + /* return ok if read something (either a newline or something else) */ + return (c == '\n' || lua_rawlen(L, -1) > 0); +} + + +static void read_all (lua_State *L, FILE *f) { + size_t nr; + luaL_Buffer b; + luaL_buffinit(L, &b); + do { /* read file in chunks of LUAL_BUFFERSIZE bytes */ + char *p = luaL_prepbuffer(&b); + nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f); + luaL_addsize(&b, nr); + } while (nr == LUAL_BUFFERSIZE); + luaL_pushresult(&b); /* close buffer */ +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t nr; /* number of chars actually read */ + char *p; + luaL_Buffer b; + luaL_buffinit(L, &b); + p = luaL_prepbuffsize(&b, n); /* prepare buffer to read whole block */ + nr = fread(p, sizeof(char), n, f); /* try to read 'n' chars */ + luaL_addsize(&b, nr); + luaL_pushresult(&b); /* close buffer */ + return (nr > 0); /* true iff read something */ +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f, 1); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)luaL_checkinteger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = luaL_checkstring(L, n); + if (*p == '*') p++; /* skip optional '*' (for compatibility) */ + switch (*p) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f, 1); + break; + case 'L': /* line with end-of-line */ + success = read_line(L, f, 0); + break; + case 'a': /* file */ + read_all(L, f); /* read entire file */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return luaL_fileresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1)); + int i; + int n = (int)lua_tointeger(L, lua_upvalueindex(2)); + if (isclosed(p)) /* file is already closed? */ + return luaL_error(L, "file is already closed"); + lua_settop(L , 1); + luaL_checkstack(L, n, "too many arguments"); + for (i = 1; i <= n; i++) /* push arguments to 'g_read' */ + lua_pushvalue(L, lua_upvalueindex(3 + i)); + n = g_read(L, p->f, 2); /* 'n' is number of results */ + lua_assert(n > 0); /* should return at least a nil */ + if (lua_toboolean(L, -n)) /* read at least one value? */ + return n; /* return them */ + else { /* first result is nil: EOF or error */ + if (n > 1) { /* is there error information? */ + /* 2nd result is error message */ + return luaL_error(L, "%s", lua_tostring(L, -n + 1)); + } + if (lua_toboolean(L, lua_upvalueindex(3))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - arg; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + int len = lua_isinteger(L, arg) + ? fprintf(f, LUA_INTEGER_FMT, + (LUAI_UACINT)lua_tointeger(L, arg)) + : fprintf(f, LUA_NUMBER_FMT, + (LUAI_UACNUMBER)lua_tonumber(L, arg)); + status = status && (len > 0); + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + if (status) return 1; /* file handle already on stack top */ + else return luaL_fileresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + FILE *f = tofile(L); + lua_pushvalue(L, 1); /* push file at the stack top (to be returned) */ + return g_write(L, f, 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + lua_Integer p3 = luaL_optinteger(L, 3, 0); + l_seeknum offset = (l_seeknum)p3; + luaL_argcheck(L, (lua_Integer)offset == p3, 3, + "not an integer in proper range"); + op = l_fseek(f, offset, mode[op]); + if (op) + return luaL_fileresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, (lua_Integer)l_ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], (size_t)sz); + return luaL_fileresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL); +} + + +/* +** functions for 'io' library +*/ +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +/* +** methods for file handles +*/ +static const luaL_Reg flib[] = { + {"close", f_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", f_gc}, + {"__tostring", f_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */ + lua_pop(L, 1); /* pop new metatable */ +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + LStream *p = tolstream(L); + p->closef = &io_noclose; /* keep file opened */ + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +static void createstdfile (lua_State *L, FILE *f, const char *k, + const char *fname) { + LStream *p = newprefile(L); + p->f = f; + p->closef = &io_noclose; + if (k != NULL) { + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, k); /* add file to registry */ + } + lua_setfield(L, -2, fname); /* add file to module */ +} + + +LUAMOD_API int luaopen_io (lua_State *L) { + luaL_newlib(L, iolib); /* new module */ + createmeta(L); + /* create (and set) default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, NULL, "stderr"); + return 1; +} + diff --git a/deps/lua/src/llex.c b/deps/lua/src/llex.c new file mode 100644 index 0000000000..66fd411ba9 --- /dev/null +++ b/deps/lua/src/llex.c @@ -0,0 +1,565 @@ +/* +** $Id: llex.c,v 2.96.1.1 2017/04/19 17:20:42 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#define llex_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lctype.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +static const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "goto", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "//", "..", "...", "==", ">=", "<=", "~=", + "<<", ">>", "::", "", + "", "", "", "" +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static l_noret lexerror (LexState *ls, const char *msg, int token); + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) { + size_t newsize; + if (luaZ_sizebuffer(b) >= MAX_SIZE/2) + lexerror(ls, "lexical element too long", 0); + newsize = luaZ_sizebuffer(b) * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[luaZ_bufflen(b)++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + TString *e = luaS_newliteral(L, LUA_ENV); /* create env name */ + luaC_fix(L, obj2gco(e)); /* never collect this name */ + for (i=0; iextra = cast_byte(i+1); /* reserved word */ + } +} + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { /* single-byte symbols? */ + lua_assert(token == cast_uchar(token)); + return luaO_pushfstring(ls->L, "'%c'", token); + } + else { + const char *s = luaX_tokens[token - FIRST_RESERVED]; + if (token < TK_EOS) /* fixed format (symbols and reserved words)? */ + return luaO_pushfstring(ls->L, "'%s'", s); + else /* names, strings, and numerals */ + return s; + } +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: case TK_STRING: + case TK_FLT: case TK_INT: + save(ls, '\0'); + return luaO_pushfstring(ls->L, "'%s'", luaZ_buffer(ls->buff)); + default: + return luaX_token2str(ls, token); + } +} + + +static l_noret lexerror (LexState *ls, const char *msg, int token) { + msg = luaG_addinfo(ls->L, msg, ls->source, ls->linenumber); + if (token) + luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +l_noret luaX_syntaxerror (LexState *ls, const char *msg) { + lexerror(ls, msg, ls->t.token); +} + + +/* +** creates a new string and anchors it in scanner's table so that +** it will not be collected until the end of the compilation +** (by that time it should be anchored somewhere) +*/ +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TValue *o; /* entry for 'str' */ + TString *ts = luaS_newlstr(L, str, l); /* create new string */ + setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ + o = luaH_set(L, ls->h, L->top - 1); + if (ttisnil(o)) { /* not in use yet? */ + /* boolean value does not need GC barrier; + table has no metatable, so it does not need to invalidate cache */ + setbvalue(o, 1); /* t[string] = true */ + luaC_checkGC(L); + } + else { /* string already present */ + ts = tsvalue(keyfromval(o)); /* re-use value previously stored */ + } + L->top--; /* remove string from stack */ + return ts; +} + + +/* +** increment line number and skips newline sequence (any of +** \n, \r, \n\r, or \r\n) +*/ +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip '\n' or '\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip '\n\r' or '\r\n' */ + if (++ls->linenumber >= MAX_INT) + lexerror(ls, "chunk has too many lines", 0); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, + int firstchar) { + ls->t.token = 0; + ls->L = L; + ls->current = firstchar; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */ + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + +static int check_next1 (LexState *ls, int c) { + if (ls->current == c) { + next(ls); + return 1; + } + else return 0; +} + + +/* +** Check whether current char is in set 'set' (with two chars) and +** saves it +*/ +static int check_next2 (LexState *ls, const char *set) { + lua_assert(set[2] == '\0'); + if (ls->current == set[0] || ls->current == set[1]) { + save_and_next(ls); + return 1; + } + else return 0; +} + + +/* LUA_NUMBER */ +/* +** this function is quite liberal in what it accepts, as 'luaO_str2num' +** will reject ill-formed numerals. +*/ +static int read_numeral (LexState *ls, SemInfo *seminfo) { + TValue obj; + const char *expo = "Ee"; + int first = ls->current; + lua_assert(lisdigit(ls->current)); + save_and_next(ls); + if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ + expo = "Pp"; + for (;;) { + if (check_next2(ls, expo)) /* exponent part? */ + check_next2(ls, "-+"); /* optional exponent sign */ + if (lisxdigit(ls->current)) + save_and_next(ls); + else if (ls->current == '.') + save_and_next(ls); + else break; + } + save(ls, '\0'); + if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ + lexerror(ls, "malformed number", TK_FLT); + if (ttisinteger(&obj)) { + seminfo->i = ivalue(&obj); + return TK_INT; + } + else { + lua_assert(ttisfloat(&obj)); + seminfo->r = fltvalue(&obj); + return TK_FLT; + } +} + + +/* +** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return +** its number of '='s; otherwise, return a negative number (-1 iff there +** are no '='s after initial bracket) +*/ +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int line = ls->linenumber; /* initial line (for error message) */ + save_and_next(ls); /* skip 2nd '[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: { /* error */ + const char *what = (seminfo ? "string" : "comment"); + const char *msg = luaO_pushfstring(ls->L, + "unfinished long %s (starting at line %d)", what, line); + lexerror(ls, msg, TK_EOS); + break; /* to avoid warnings */ + } + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd ']' */ + goto endloop; + } + break; + } + case '\n': case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void esccheck (LexState *ls, int c, const char *msg) { + if (!c) { + if (ls->current != EOZ) + save_and_next(ls); /* add current to buffer for error message */ + lexerror(ls, msg, TK_STRING); + } +} + + +static int gethexa (LexState *ls) { + save_and_next(ls); + esccheck (ls, lisxdigit(ls->current), "hexadecimal digit expected"); + return luaO_hexavalue(ls->current); +} + + +static int readhexaesc (LexState *ls) { + int r = gethexa(ls); + r = (r << 4) + gethexa(ls); + luaZ_buffremove(ls->buff, 2); /* remove saved chars from buffer */ + return r; +} + + +static unsigned long readutf8esc (LexState *ls) { + unsigned long r; + int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ + save_and_next(ls); /* skip 'u' */ + esccheck(ls, ls->current == '{', "missing '{'"); + r = gethexa(ls); /* must have at least one digit */ + while ((save_and_next(ls), lisxdigit(ls->current))) { + i++; + r = (r << 4) + luaO_hexavalue(ls->current); + esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); + } + esccheck(ls, ls->current == '}', "missing '}'"); + next(ls); /* skip '}' */ + luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ + return r; +} + + +static void utf8esc (LexState *ls) { + char buff[UTF8BUFFSZ]; + int n = luaO_utf8esc(buff, readutf8esc(ls)); + for (; n > 0; n--) /* add 'buff' to string */ + save(ls, buff[UTF8BUFFSZ - n]); +} + + +static int readdecesc (LexState *ls) { + int i; + int r = 0; /* result accumulator */ + for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */ + r = 10*r + ls->current - '0'; + save_and_next(ls); + } + esccheck(ls, r <= UCHAR_MAX, "decimal escape too large"); + luaZ_buffremove(ls->buff, i); /* remove read digits from buffer */ + return r; +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); /* keep delimiter (for error messages) */ + while (ls->current != del) { + switch (ls->current) { + case EOZ: + lexerror(ls, "unfinished string", TK_EOS); + break; /* to avoid warnings */ + case '\n': + case '\r': + lexerror(ls, "unfinished string", TK_STRING); + break; /* to avoid warnings */ + case '\\': { /* escape sequences */ + int c; /* final character to be saved */ + save_and_next(ls); /* keep '\\' for error messages */ + switch (ls->current) { + case 'a': c = '\a'; goto read_save; + case 'b': c = '\b'; goto read_save; + case 'f': c = '\f'; goto read_save; + case 'n': c = '\n'; goto read_save; + case 'r': c = '\r'; goto read_save; + case 't': c = '\t'; goto read_save; + case 'v': c = '\v'; goto read_save; + case 'x': c = readhexaesc(ls); goto read_save; + case 'u': utf8esc(ls); goto no_save; + case '\n': case '\r': + inclinenumber(ls); c = '\n'; goto only_save; + case '\\': case '\"': case '\'': + c = ls->current; goto read_save; + case EOZ: goto no_save; /* will raise an error next loop */ + case 'z': { /* zap following span of spaces */ + luaZ_buffremove(ls->buff, 1); /* remove '\\' */ + next(ls); /* skip the 'z' */ + while (lisspace(ls->current)) { + if (currIsNewline(ls)) inclinenumber(ls); + else next(ls); + } + goto no_save; + } + default: { + esccheck(ls, lisdigit(ls->current), "invalid escape sequence"); + c = readdecesc(ls); /* digital escape '\ddd' */ + goto only_save; + } + } + read_save: + next(ls); + /* go through */ + only_save: + luaZ_buffremove(ls->buff, 1); /* remove '\\' */ + save(ls, c); + /* go through */ + no_save: break; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': case '\r': { /* line breaks */ + inclinenumber(ls); + break; + } + case ' ': case '\f': case '\t': case '\v': { /* spaces */ + next(ls); + break; + } + case '-': { /* '-' or '--' (comment) */ + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { /* long comment? */ + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* skip long comment */ + luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ + break; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); /* skip until end of line (or end of file) */ + break; + } + case '[': { /* long string or simply '[' */ + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep != -1) /* '[=...' missing second bracket */ + lexerror(ls, "invalid long string delimiter", TK_STRING); + return '['; + } + case '=': { + next(ls); + if (check_next1(ls, '=')) return TK_EQ; + else return '='; + } + case '<': { + next(ls); + if (check_next1(ls, '=')) return TK_LE; + else if (check_next1(ls, '<')) return TK_SHL; + else return '<'; + } + case '>': { + next(ls); + if (check_next1(ls, '=')) return TK_GE; + else if (check_next1(ls, '>')) return TK_SHR; + else return '>'; + } + case '/': { + next(ls); + if (check_next1(ls, '/')) return TK_IDIV; + else return '/'; + } + case '~': { + next(ls); + if (check_next1(ls, '=')) return TK_NE; + else return '~'; + } + case ':': { + next(ls); + if (check_next1(ls, ':')) return TK_DBCOLON; + else return ':'; + } + case '"': case '\'': { /* short literal strings */ + read_string(ls, ls->current, seminfo); + return TK_STRING; + } + case '.': { /* '.', '..', '...', or number */ + save_and_next(ls); + if (check_next1(ls, '.')) { + if (check_next1(ls, '.')) + return TK_DOTS; /* '...' */ + else return TK_CONCAT; /* '..' */ + } + else if (!lisdigit(ls->current)) return '.'; + else return read_numeral(ls, seminfo); + } + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': { + return read_numeral(ls, seminfo); + } + case EOZ: { + return TK_EOS; + } + default: { + if (lislalpha(ls->current)) { /* identifier or reserved word? */ + TString *ts; + do { + save_and_next(ls); + } while (lislalnum(ls->current)); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + seminfo->ts = ts; + if (isreserved(ts)) /* reserved word? */ + return ts->extra - 1 + FIRST_RESERVED; + else { + return TK_NAME; + } + } + else { /* single-char tokens (+ - / ...) */ + int c = ls->current; + next(ls); + return c; + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +int luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); + return ls->lookahead.token; +} + diff --git a/deps/lua/src/llex.h b/deps/lua/src/llex.h new file mode 100644 index 0000000000..2ed0af66a4 --- /dev/null +++ b/deps/lua/src/llex.h @@ -0,0 +1,85 @@ +/* +** $Id: llex.h,v 1.79.1.1 2017/04/19 17:20:42 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + + +#if !defined(LUA_ENV) +#define LUA_ENV "_ENV" +#endif + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, + TK_SHL, TK_SHR, + TK_DBCOLON, TK_EOS, + TK_FLT, TK_INT, TK_NAME, TK_STRING +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +typedef union { + lua_Number r; + lua_Integer i; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +/* state of the lexer plus state of the parser when shared by all + functions */ +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token 'consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* current function (parser) */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + Table *h; /* to avoid collection/reuse strings */ + struct Dyndata *dyd; /* dynamic structures used by the parser */ + TString *source; /* current source name */ + TString *envn; /* environment variable name */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source, int firstchar); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC int luaX_lookahead (LexState *ls); +LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/deps/lua/src/llimits.h b/deps/lua/src/llimits.h new file mode 100644 index 0000000000..d1036f6bc8 --- /dev/null +++ b/deps/lua/src/llimits.h @@ -0,0 +1,323 @@ +/* +** $Id: llimits.h,v 1.141.1.1 2017/04/19 17:20:42 roberto Exp $ +** Limits, basic types, and some other 'installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + +/* +** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count +** the total memory used by Lua (in bytes). Usually, 'size_t' and +** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. +*/ +#if defined(LUAI_MEM) /* { external definitions? */ +typedef LUAI_UMEM lu_mem; +typedef LUAI_MEM l_mem; +#elif LUAI_BITSINT >= 32 /* }{ */ +typedef size_t lu_mem; +typedef ptrdiff_t l_mem; +#else /* 16-bit ints */ /* }{ */ +typedef unsigned long lu_mem; +typedef long l_mem; +#endif /* } */ + + +/* chars used as small naturals (so that 'char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +/* maximum value for size_t */ +#define MAX_SIZET ((size_t)(~(size_t)0)) + +/* maximum size visible for Lua (must be representable in a lua_Integer */ +#define MAX_SIZE (sizeof(size_t) < sizeof(lua_Integer) ? MAX_SIZET \ + : (size_t)(LUA_MAXINTEGER)) + + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) + +#define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1)) + + +#define MAX_INT INT_MAX /* maximum value of an int */ + + +/* +** conversion of pointer to unsigned integer: +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX)) + + + +/* type to ensure maximum alignment */ +#if defined(LUAI_USER_ALIGNMENT_T) +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; +#else +typedef union { + lua_Number n; + double u; + void *s; + lua_Integer i; + long l; +} L_Umaxalign; +#endif + + + +/* types of 'usual argument conversions' for lua_Number and lua_Integer */ +typedef LUAI_UACNUMBER l_uacNumber; +typedef LUAI_UACINT l_uacInt; + + +/* internal assertions for in-house debugging */ +#if defined(lua_assert) +#define check_exp(c,e) (lua_assert(c), (e)) +/* to avoid problems with conditions too long */ +#define lua_longassert(c) ((c) ? (void)0 : lua_assert(0)) +#else +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define lua_longassert(c) ((void)0) +#endif + +/* +** assertion for checking API calls +*/ +#if !defined(luai_apicheck) +#define luai_apicheck(l,e) lua_assert(e) +#endif + +#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) + + +/* macro to avoid warnings about unused variables */ +#if !defined(UNUSED) +#define UNUSED(x) ((void)(x)) +#endif + + +/* type casts (a macro highlights casts in the code) */ +#define cast(t, exp) ((t)(exp)) + +#define cast_void(i) cast(void, (i)) +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) +#define cast_uchar(i) cast(unsigned char, (i)) + + +/* cast a signed lua_Integer to lua_Unsigned */ +#if !defined(l_castS2U) +#define l_castS2U(i) ((lua_Unsigned)(i)) +#endif + +/* +** cast a lua_Unsigned to a signed lua_Integer; this cast is +** not strict ISO C, but two-complement architectures should +** work fine. +*/ +#if !defined(l_castU2S) +#define l_castU2S(i) ((lua_Integer)(i)) +#endif + + +/* +** non-return type +*/ +#if defined(__GNUC__) +#define l_noret void __attribute__((noreturn)) +#elif defined(_MSC_VER) && _MSC_VER >= 1200 +#define l_noret void __declspec(noreturn) +#else +#define l_noret void +#endif + + + +/* +** maximum depth for nested C calls and syntactical nested non-terminals +** in a program. (Value must fit in an unsigned short int.) +*/ +#if !defined(LUAI_MAXCCALLS) +#define LUAI_MAXCCALLS 200 +#endif + + + +/* +** type for virtual-machine instructions; +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +#if LUAI_BITSINT >= 32 +typedef unsigned int Instruction; +#else +typedef unsigned long Instruction; +#endif + + + +/* +** Maximum length for short strings, that is, strings that are +** internalized. (Cannot be smaller than reserved words or tags for +** metamethods, as these strings must be internalized; +** #("function") = 8, #("__newindex") = 10.) +*/ +#if !defined(LUAI_MAXSHORTLEN) +#define LUAI_MAXSHORTLEN 40 +#endif + + +/* +** Initial size for the string table (must be power of 2). +** The Lua core alone registers ~50 strings (reserved words + +** metaevent keys + a few others). Libraries would typically add +** a few dozens more. +*/ +#if !defined(MINSTRTABSIZE) +#define MINSTRTABSIZE 128 +#endif + + +/* +** Size of cache for strings in the API. 'N' is the number of +** sets (better be a prime) and "M" is the size of each set (M == 1 +** makes a direct cache.) +*/ +#if !defined(STRCACHE_N) +#define STRCACHE_N 53 +#define STRCACHE_M 2 +#endif + + +/* minimum size for string buffer */ +#if !defined(LUA_MINBUFFER) +#define LUA_MINBUFFER 32 +#endif + + +/* +** macros that are executed whenever program enters the Lua core +** ('lua_lock') and leaves the core ('lua_unlock') +*/ +#if !defined(lua_lock) +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +/* +** macro executed during Lua functions at points where the +** function can yield. +*/ +#if !defined(luai_threadyield) +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** these macros allow user-specific actions on threads when you defined +** LUAI_EXTRASPACE and need to do something extra when a thread is +** created/deleted/resumed/yielded. +*/ +#if !defined(luai_userstateopen) +#define luai_userstateopen(L) ((void)L) +#endif + +#if !defined(luai_userstateclose) +#define luai_userstateclose(L) ((void)L) +#endif + +#if !defined(luai_userstatethread) +#define luai_userstatethread(L,L1) ((void)L) +#endif + +#if !defined(luai_userstatefree) +#define luai_userstatefree(L,L1) ((void)L) +#endif + +#if !defined(luai_userstateresume) +#define luai_userstateresume(L,n) ((void)L) +#endif + +#if !defined(luai_userstateyield) +#define luai_userstateyield(L,n) ((void)L) +#endif + + + +/* +** The luai_num* macros define the primitive operations over numbers. +*/ + +/* floor division (defined as 'floor(a/b)') */ +#if !defined(luai_numidiv) +#define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) +#endif + +/* float division */ +#if !defined(luai_numdiv) +#define luai_numdiv(L,a,b) ((a)/(b)) +#endif + +/* +** modulo: defined as 'a - floor(a/b)*b'; this definition gives NaN when +** 'b' is huge, but the result should be 'a'. 'fmod' gives the result of +** 'a - trunc(a/b)*b', and therefore must be corrected when 'trunc(a/b) +** ~= floor(a/b)'. That happens when the division has a non-integer +** negative result, which is equivalent to the test below. +*/ +#if !defined(luai_nummod) +#define luai_nummod(L,a,b,m) \ + { (m) = l_mathop(fmod)(a,b); if ((m)*(b) < 0) (m) += (b); } +#endif + +/* exponentiation */ +#if !defined(luai_numpow) +#define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b)) +#endif + +/* the others are quite standard operations */ +#if !defined(luai_numadd) +#define luai_numadd(L,a,b) ((a)+(b)) +#define luai_numsub(L,a,b) ((a)-(b)) +#define luai_nummul(L,a,b) ((a)*(b)) +#define luai_numunm(L,a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + + + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#if !defined(HARDSTACKTESTS) +#define condmovestack(L,pre,pos) ((void)0) +#else +/* realloc stack keeping its size */ +#define condmovestack(L,pre,pos) \ + { int sz_ = (L)->stacksize; pre; luaD_reallocstack((L), sz_); pos; } +#endif + +#if !defined(HARDMEMTESTS) +#define condchangemem(L,pre,pos) ((void)0) +#else +#define condchangemem(L,pre,pos) \ + { if (G(L)->gcrunning) { pre; luaC_fullgc(L, 0); pos; } } +#endif + +#endif diff --git a/deps/lua/src/lmathlib.c b/deps/lua/src/lmathlib.c new file mode 100644 index 0000000000..7ef7e593fd --- /dev/null +++ b/deps/lua/src/lmathlib.c @@ -0,0 +1,410 @@ +/* +** $Id: lmathlib.c,v 1.119.1.1 2017/04/19 17:20:42 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + +#define lmathlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (l_mathop(3.141592653589793238462643383279502884)) + + +#if !defined(l_rand) /* { */ +#if defined(LUA_USE_POSIX) +#define l_rand() random() +#define l_srand(x) srandom(x) +#define L_RANDMAX 2147483647 /* (2^31 - 1), following POSIX */ +#else +#define l_rand() rand() +#define l_srand(x) srand(x) +#define L_RANDMAX RAND_MAX +#endif +#endif /* } */ + + +static int math_abs (lua_State *L) { + if (lua_isinteger(L, 1)) { + lua_Integer n = lua_tointeger(L, 1); + if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n); + lua_pushinteger(L, n); + } + else + lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_Number y = luaL_checknumber(L, 1); + lua_Number x = luaL_optnumber(L, 2, 1); + lua_pushnumber(L, l_mathop(atan2)(y, x)); + return 1; +} + + +static int math_toint (lua_State *L) { + int valid; + lua_Integer n = lua_tointegerx(L, 1, &valid); + if (valid) + lua_pushinteger(L, n); + else { + luaL_checkany(L, 1); + lua_pushnil(L); /* value is not convertible to integer */ + } + return 1; +} + + +static void pushnumint (lua_State *L, lua_Number d) { + lua_Integer n; + if (lua_numbertointeger(d, &n)) /* does 'd' fit in an integer? */ + lua_pushinteger(L, n); /* result is integer */ + else + lua_pushnumber(L, d); /* result is float */ +} + + +static int math_floor (lua_State *L) { + if (lua_isinteger(L, 1)) + lua_settop(L, 1); /* integer is its own floor */ + else { + lua_Number d = l_mathop(floor)(luaL_checknumber(L, 1)); + pushnumint(L, d); + } + return 1; +} + + +static int math_ceil (lua_State *L) { + if (lua_isinteger(L, 1)) + lua_settop(L, 1); /* integer is its own ceil */ + else { + lua_Number d = l_mathop(ceil)(luaL_checknumber(L, 1)); + pushnumint(L, d); + } + return 1; +} + + +static int math_fmod (lua_State *L) { + if (lua_isinteger(L, 1) && lua_isinteger(L, 2)) { + lua_Integer d = lua_tointeger(L, 2); + if ((lua_Unsigned)d + 1u <= 1u) { /* special cases: -1 or 0 */ + luaL_argcheck(L, d != 0, 2, "zero"); + lua_pushinteger(L, 0); /* avoid overflow with 0x80000... / -1 */ + } + else + lua_pushinteger(L, lua_tointeger(L, 1) % d); + } + else + lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1), + luaL_checknumber(L, 2))); + return 1; +} + + +/* +** next function does not use 'modf', avoiding problems with 'double*' +** (which is not compatible with 'float*') when lua_Number is not +** 'double'. +*/ +static int math_modf (lua_State *L) { + if (lua_isinteger(L ,1)) { + lua_settop(L, 1); /* number is its own integer part */ + lua_pushnumber(L, 0); /* no fractional part */ + } + else { + lua_Number n = luaL_checknumber(L, 1); + /* integer part (rounds toward zero) */ + lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); + pushnumint(L, ip); + /* fractional part (test needed for inf/-inf) */ + lua_pushnumber(L, (n == ip) ? l_mathop(0.0) : (n - ip)); + } + return 2; +} + + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1))); + return 1; +} + + +static int math_ult (lua_State *L) { + lua_Integer a = luaL_checkinteger(L, 1); + lua_Integer b = luaL_checkinteger(L, 2); + lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b); + return 1; +} + +static int math_log (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + lua_Number res; + if (lua_isnoneornil(L, 2)) + res = l_mathop(log)(x); + else { + lua_Number base = luaL_checknumber(L, 2); +#if !defined(LUA_USE_C89) + if (base == l_mathop(2.0)) + res = l_mathop(log2)(x); else +#endif + if (base == l_mathop(10.0)) + res = l_mathop(log10)(x); + else + res = l_mathop(log)(x)/l_mathop(log)(base); + } + lua_pushnumber(L, res); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1) * (l_mathop(180.0) / PI)); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1) * (PI / l_mathop(180.0))); + return 1; +} + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int imin = 1; /* index of current minimum value */ + int i; + luaL_argcheck(L, n >= 1, 1, "value expected"); + for (i = 2; i <= n; i++) { + if (lua_compare(L, i, imin, LUA_OPLT)) + imin = i; + } + lua_pushvalue(L, imin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int imax = 1; /* index of current maximum value */ + int i; + luaL_argcheck(L, n >= 1, 1, "value expected"); + for (i = 2; i <= n; i++) { + if (lua_compare(L, imax, i, LUA_OPLT)) + imax = i; + } + lua_pushvalue(L, imax); + return 1; +} + +/* +** This function uses 'double' (instead of 'lua_Number') to ensure that +** all bits from 'l_rand' can be represented, and that 'RANDMAX + 1.0' +** will keep full precision (ensuring that 'r' is always less than 1.0.) +*/ +static int math_random (lua_State *L) { + lua_Integer low, up; + double r = (double)l_rand() * (1.0 / ((double)L_RANDMAX + 1.0)); + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, (lua_Number)r); /* Number between 0 and 1 */ + return 1; + } + case 1: { /* only upper limit */ + low = 1; + up = luaL_checkinteger(L, 1); + break; + } + case 2: { /* lower and upper limits */ + low = luaL_checkinteger(L, 1); + up = luaL_checkinteger(L, 2); + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + /* random integer in the interval [low, up] */ + luaL_argcheck(L, low <= up, 1, "interval is empty"); + luaL_argcheck(L, low >= 0 || up <= LUA_MAXINTEGER + low, 1, + "interval too large"); + r *= (double)(up - low) + 1.0; + lua_pushinteger(L, (lua_Integer)r + low); + return 1; +} + + +static int math_randomseed (lua_State *L) { + l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); + (void)l_rand(); /* discard first value to avoid undesirable correlations */ + return 0; +} + + +static int math_type (lua_State *L) { + if (lua_type(L, 1) == LUA_TNUMBER) { + if (lua_isinteger(L, 1)) + lua_pushliteral(L, "integer"); + else + lua_pushliteral(L, "float"); + } + else { + luaL_checkany(L, 1); + lua_pushnil(L); + } + return 1; +} + + +/* +** {================================================================== +** Deprecated functions (for compatibility only) +** =================================================================== +*/ +#if defined(LUA_COMPAT_MATHLIB) + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + lua_Number y = luaL_checknumber(L, 2); + lua_pushnumber(L, l_mathop(pow)(x, y)); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_Number x = luaL_checknumber(L, 1); + int ep = (int)luaL_checkinteger(L, 2); + lua_pushnumber(L, l_mathop(ldexp)(x, ep)); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1))); + return 1; +} + +#endif +/* }================================================================== */ + + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"tointeger", math_toint}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"ult", math_ult}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tan", math_tan}, + {"type", math_type}, +#if defined(LUA_COMPAT_MATHLIB) + {"atan2", math_atan}, + {"cosh", math_cosh}, + {"sinh", math_sinh}, + {"tanh", math_tanh}, + {"pow", math_pow}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, +#endif + /* placeholders */ + {"pi", NULL}, + {"huge", NULL}, + {"maxinteger", NULL}, + {"mininteger", NULL}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUAMOD_API int luaopen_math (lua_State *L) { + luaL_newlib(L, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, (lua_Number)HUGE_VAL); + lua_setfield(L, -2, "huge"); + lua_pushinteger(L, LUA_MAXINTEGER); + lua_setfield(L, -2, "maxinteger"); + lua_pushinteger(L, LUA_MININTEGER); + lua_setfield(L, -2, "mininteger"); + return 1; +} + diff --git a/deps/lua/src/lmem.c b/deps/lua/src/lmem.c new file mode 100644 index 0000000000..0241cc3bac --- /dev/null +++ b/deps/lua/src/lmem.c @@ -0,0 +1,100 @@ +/* +** $Id: lmem.c,v 1.91.1.1 2017/04/19 17:20:42 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#define lmem_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** ('osize' is the old size, 'nsize' is the new size) +** +** * frealloc(ud, NULL, x, s) creates a new block of size 's' (no +** matter 'x'). +** +** * frealloc(ud, p, x, 0) frees the block 'p' +** (in this specific case, frealloc must return NULL); +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ISO C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *what) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, "too many %s (limit is %d)", what, limit); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +l_noret luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + void *newblock; + global_State *g = G(L); + size_t realosize = (block) ? osize : 0; + lua_assert((realosize == 0) == (block == NULL)); +#if defined(HARDMEMTESTS) + if (nsize > realosize && g->gcrunning) + luaC_fullgc(L, 1); /* force a GC whenever possible */ +#endif + newblock = (*g->frealloc)(g->ud, block, osize, nsize); + if (newblock == NULL && nsize > 0) { + lua_assert(nsize > realosize); /* cannot fail when shrinking a block */ + if (g->version) { /* is state fully built? */ + luaC_fullgc(L, 1); /* try to free some memory... */ + newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ + } + if (newblock == NULL) + luaD_throw(L, LUA_ERRMEM); + } + lua_assert((nsize == 0) == (newblock == NULL)); + g->GCdebt = (g->GCdebt + nsize) - realosize; + return newblock; +} + diff --git a/deps/lua/src/lmem.h b/deps/lua/src/lmem.h new file mode 100644 index 0000000000..357b1e43e7 --- /dev/null +++ b/deps/lua/src/lmem.h @@ -0,0 +1,69 @@ +/* +** $Id: lmem.h,v 1.43.1.1 2017/04/19 17:20:42 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + + +/* +** This macro reallocs a vector 'b' from 'on' to 'n' elements, where +** each element has size 'e'. In case of arithmetic overflow of the +** product 'n'*'e', it raises an error (calling 'luaM_toobig'). Because +** 'e' is always constant, it avoids the runtime division MAX_SIZET/(e). +** +** (The macro is somewhat complex to avoid warnings: The 'sizeof' +** comparison avoids a runtime comparison when overflow cannot occur. +** The compiler should be able to optimize the real test by itself, but +** when it does it, it may give a warning about "comparison is always +** false due to limited range of data type"; the +1 tricks the compiler, +** avoiding this warning but also this optimization.) +*/ +#define luaM_reallocv(L,b,on,n,e) \ + (((sizeof(n) >= sizeof(size_t) && cast(size_t, (n)) + 1 > MAX_SIZET/(e)) \ + ? luaM_toobig(L) : cast_void(0)) , \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e))) + +/* +** Arrays of chars do not need any test +*/ +#define luaM_reallocvchar(L,b,on,n) \ + cast(char *, luaM_realloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) + +#define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + +LUAI_FUNC l_noret luaM_toobig (lua_State *L); + +/* not to be called directly */ +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *what); + +#endif + diff --git a/deps/lua/src/loadlib.c b/deps/lua/src/loadlib.c new file mode 100644 index 0000000000..45f44d3225 --- /dev/null +++ b/deps/lua/src/loadlib.c @@ -0,0 +1,790 @@ +/* +** $Id: loadlib.c,v 1.130.1.1 2017/04/19 17:20:42 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Windows, and a stub for other +** systems. +*/ + +#define loadlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** LUA_IGMARK is a mark to ignore all before it when building the +** luaopen_ function name. +*/ +#if !defined (LUA_IGMARK) +#define LUA_IGMARK "-" +#endif + + +/* +** LUA_CSUBSEP is the character that replaces dots in submodule names +** when searching for a C loader. +** LUA_LSUBSEP is the character that replaces dots in submodule names +** when searching for a Lua loader. +*/ +#if !defined(LUA_CSUBSEP) +#define LUA_CSUBSEP LUA_DIRSEP +#endif + +#if !defined(LUA_LSUBSEP) +#define LUA_LSUBSEP LUA_DIRSEP +#endif + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +/* +** unique key for table in the registry that keeps handles +** for all loaded C libraries +*/ +static const int CLIBS = 0; + +#define LIB_FAIL "open" + + +#define setprogdir(L) ((void)0) + + +/* +** system-dependent functions +*/ + +/* +** unload library 'lib' +*/ +static void lsys_unloadlib (void *lib); + +/* +** load C library in file 'path'. If 'seeglb', load with all names in +** the library global. +** Returns the library; in case of error, returns NULL plus an +** error string in the stack. +*/ +static void *lsys_load (lua_State *L, const char *path, int seeglb); + +/* +** Try to find a function named 'sym' in library 'lib'. +** Returns the function; in case of error, returns NULL plus an +** error string in the stack. +*/ +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym); + + + + +#if defined(LUA_USE_DLOPEN) /* { */ +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include + +/* +** Macro to convert pointer-to-void* to pointer-to-function. This cast +** is undefined according to ISO C, but POSIX assumes that it works. +** (The '__extension__' in gnu compilers is only to avoid warnings.) +*/ +#if defined(__GNUC__) +#define cast_func(p) (__extension__ (lua_CFunction)(p)) +#else +#define cast_func(p) ((lua_CFunction)(p)) +#endif + + +static void lsys_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *lsys_load (lua_State *L, const char *path, int seeglb) { + void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL)); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = cast_func(dlsym(lib, sym)); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) /* }{ */ +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include + + +/* +** optional flags for LoadLibraryEx +*/ +#if !defined(LUA_LLE_FLAGS) +#define LUA_LLE_FLAGS 0 +#endif + + +#undef setprogdir + + +/* +** Replace in the path (on the top of the stack) any occurrence +** of LUA_EXEC_DIR with the executable's path. +*/ +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); /* get exec. name */ + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; /* cut name on the last '\\' to get the path */ + luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void lsys_unloadlib (void *lib) { + FreeLibrary((HMODULE)lib); +} + + +static void *lsys_load (lua_State *L, const char *path, int seeglb) { + HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS); + (void)(seeglb); /* not used: symbols are 'global' by default */ + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + +#else /* }{ */ +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void lsys_unloadlib (void *lib) { + (void)(lib); /* not used */ +} + + +static void *lsys_load (lua_State *L, const char *path, int seeglb) { + (void)(path); (void)(seeglb); /* not used */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { + (void)(lib); (void)(sym); /* not used */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif /* } */ + + +/* +** {================================================================== +** Set Paths +** =================================================================== +*/ + +/* +** LUA_PATH_VAR and LUA_CPATH_VAR are the names of the environment +** variables that Lua check to set its paths. +*/ +#if !defined(LUA_PATH_VAR) +#define LUA_PATH_VAR "LUA_PATH" +#endif + +#if !defined(LUA_CPATH_VAR) +#define LUA_CPATH_VAR "LUA_CPATH" +#endif + + +#define AUXMARK "\1" /* auxiliary mark */ + + +/* +** return registry.LUA_NOENV as a boolean +*/ +static int noenv (lua_State *L) { + int b; + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); + b = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + return b; +} + + +/* +** Set a path +*/ +static void setpath (lua_State *L, const char *fieldname, + const char *envname, + const char *dft) { + const char *nver = lua_pushfstring(L, "%s%s", envname, LUA_VERSUFFIX); + const char *path = getenv(nver); /* use versioned name */ + if (path == NULL) /* no environment variable? */ + path = getenv(envname); /* try unversioned name */ + if (path == NULL || noenv(L)) /* no environment variable? */ + lua_pushstring(L, dft); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP, + LUA_PATH_SEP AUXMARK LUA_PATH_SEP); + luaL_gsub(L, path, AUXMARK, dft); + lua_remove(L, -2); /* remove result from 1st 'gsub' */ + } + setprogdir(L); + lua_setfield(L, -3, fieldname); /* package[fieldname] = path value */ + lua_pop(L, 1); /* pop versioned variable name */ +} + +/* }================================================================== */ + + +/* +** return registry.CLIBS[path] +*/ +static void *checkclib (lua_State *L, const char *path) { + void *plib; + lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); + lua_getfield(L, -1, path); + plib = lua_touserdata(L, -1); /* plib = CLIBS[path] */ + lua_pop(L, 2); /* pop CLIBS table and 'plib' */ + return plib; +} + + +/* +** registry.CLIBS[path] = plib -- for queries +** registry.CLIBS[#CLIBS + 1] = plib -- also keep a list of all libraries +*/ +static void addtoclib (lua_State *L, const char *path, void *plib) { + lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); + lua_pushlightuserdata(L, plib); + lua_pushvalue(L, -1); + lua_setfield(L, -3, path); /* CLIBS[path] = plib */ + lua_rawseti(L, -2, luaL_len(L, -2) + 1); /* CLIBS[#CLIBS + 1] = plib */ + lua_pop(L, 1); /* pop CLIBS table */ +} + + +/* +** __gc tag method for CLIBS table: calls 'lsys_unloadlib' for all lib +** handles in list CLIBS +*/ +static int gctm (lua_State *L) { + lua_Integer n = luaL_len(L, 1); + for (; n >= 1; n--) { /* for each handle, in reverse order */ + lua_rawgeti(L, 1, n); /* get handle CLIBS[n] */ + lsys_unloadlib(lua_touserdata(L, -1)); + lua_pop(L, 1); /* pop handle */ + } + return 0; +} + + + +/* error codes for 'lookforfunc' */ +#define ERRLIB 1 +#define ERRFUNC 2 + +/* +** Look for a C function named 'sym' in a dynamically loaded library +** 'path'. +** First, check whether the library is already loaded; if not, try +** to load it. +** Then, if 'sym' is '*', return true (as library has been loaded). +** Otherwise, look for symbol 'sym' in the library and push a +** C function with that symbol. +** Return 0 and 'true' or a function in the stack; in case of +** errors, return an error code and an error message in the stack. +*/ +static int lookforfunc (lua_State *L, const char *path, const char *sym) { + void *reg = checkclib(L, path); /* check loaded C libraries */ + if (reg == NULL) { /* must load library? */ + reg = lsys_load(L, path, *sym == '*'); /* global symbols if 'sym'=='*' */ + if (reg == NULL) return ERRLIB; /* unable to load library */ + addtoclib(L, path, reg); + } + if (*sym == '*') { /* loading only library (no function)? */ + lua_pushboolean(L, 1); /* return 'true' */ + return 0; /* no errors */ + } + else { + lua_CFunction f = lsys_sym(L, reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); /* else create new function */ + return 0; /* no errors */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = lookforfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATH_SEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATH_SEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *searchpath (lua_State *L, const char *name, + const char *path, + const char *sep, + const char *dirsep) { + luaL_Buffer msg; /* to build error message */ + luaL_buffinit(L, &msg); + if (*sep != '\0') /* non-empty separator? */ + name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename = luaL_gsub(L, lua_tostring(L, -1), + LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file '%s'", filename); + lua_remove(L, -2); /* remove file name */ + luaL_addvalue(&msg); /* concatenate error msg. entry */ + } + luaL_pushresult(&msg); /* create error message */ + return NULL; /* not found */ +} + + +static int ll_searchpath (lua_State *L) { + const char *f = searchpath(L, luaL_checkstring(L, 1), + luaL_checkstring(L, 2), + luaL_optstring(L, 3, "."), + luaL_optstring(L, 4, LUA_DIRSEP)); + if (f != NULL) return 1; + else { /* error message is on top of the stack */ + lua_pushnil(L); + lua_insert(L, -2); + return 2; /* return nil + error message */ + } +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname, + const char *dirsep) { + const char *path; + lua_getfield(L, lua_upvalueindex(1), pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, "'package.%s' must be a string", pname); + return searchpath(L, name, path, ".", dirsep); +} + + +static int checkload (lua_State *L, int stat, const char *filename) { + if (stat) { /* module loaded successfully? */ + lua_pushstring(L, filename); /* will be 2nd argument to module */ + return 2; /* return open function and file name */ + } + else + return luaL_error(L, "error loading module '%s' from file '%s':\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int searcher_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path", LUA_LSUBSEP); + if (filename == NULL) return 1; /* module not found in this path */ + return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename); +} + + +/* +** Try to find a load function for module 'modname' at file 'filename'. +** First, change '.' to '_' in 'modname'; then, if 'modname' has +** the form X-Y (that is, it has an "ignore mark"), build a function +** name "luaopen_X" and look for it. (For compatibility, if that +** fails, it also tries "luaopen_Y".) If there is no ignore mark, +** look for a function named "luaopen_modname". +*/ +static int loadfunc (lua_State *L, const char *filename, const char *modname) { + const char *openfunc; + const char *mark; + modname = luaL_gsub(L, modname, ".", LUA_OFSEP); + mark = strchr(modname, *LUA_IGMARK); + if (mark) { + int stat; + openfunc = lua_pushlstring(L, modname, mark - modname); + openfunc = lua_pushfstring(L, LUA_POF"%s", openfunc); + stat = lookforfunc(L, filename, openfunc); + if (stat != ERRFUNC) return stat; + modname = mark + 1; /* else go ahead and try old-style name */ + } + openfunc = lua_pushfstring(L, LUA_POF"%s", modname); + return lookforfunc(L, filename, openfunc); +} + + +static int searcher_C (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath", LUA_CSUBSEP); + if (filename == NULL) return 1; /* module not found in this path */ + return checkload(L, (loadfunc(L, filename, name) == 0), filename); +} + + +static int searcher_Croot (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP); + if (filename == NULL) return 1; /* root not found */ + if ((stat = loadfunc(L, filename, name)) != 0) { + if (stat != ERRFUNC) + return checkload(L, 0, filename); /* real error */ + else { /* open function not found */ + lua_pushfstring(L, "\n\tno module '%s' in file '%s'", name, filename); + return 1; + } + } + lua_pushstring(L, filename); /* will be 2nd argument to module */ + return 2; +} + + +static int searcher_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); + if (lua_getfield(L, -1, name) == LUA_TNIL) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static void findloader (lua_State *L, const char *name) { + int i; + luaL_Buffer msg; /* to build error message */ + luaL_buffinit(L, &msg); + /* push 'package.searchers' to index 3 in the stack */ + if (lua_getfield(L, lua_upvalueindex(1), "searchers") != LUA_TTABLE) + luaL_error(L, "'package.searchers' must be a table"); + /* iterate over available searchers to find a loader */ + for (i = 1; ; i++) { + if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ + lua_pop(L, 1); /* remove nil */ + luaL_pushresult(&msg); /* create error message */ + luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); + } + lua_pushstring(L, name); + lua_call(L, 1, 2); /* call it */ + if (lua_isfunction(L, -2)) /* did it find a loader? */ + return; /* module loader found */ + else if (lua_isstring(L, -2)) { /* searcher returned error message? */ + lua_pop(L, 1); /* remove extra return */ + luaL_addvalue(&msg); /* concatenate error message */ + } + else + lua_pop(L, 2); /* remove both returns */ + } +} + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_settop(L, 1); /* LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + lua_getfield(L, 2, name); /* LOADED[name] */ + if (lua_toboolean(L, -1)) /* is it there? */ + return 1; /* package is already loaded */ + /* else must load package */ + lua_pop(L, 1); /* remove 'getfield' result */ + findloader(L, name); + lua_pushstring(L, name); /* pass name as argument to module loader */ + lua_insert(L, -2); /* name is 1st argument (before search data) */ + lua_call(L, 2, 1); /* run loader to load module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* LOADED[name] = returned value */ + if (lua_getfield(L, 2, name) == LUA_TNIL) { /* module set no value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ +#if defined(LUA_COMPAT_MODULE) + +/* +** changes the environment variable of calling function +*/ +static void set_env (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, "'module' not called from a Lua function"); + lua_pushvalue(L, -2); /* copy new environment table to top */ + lua_setupvalue(L, -2, 1); + lua_pop(L, 1); /* remove function */ +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + if (lua_isfunction(L, i)) { /* avoid 'calling' extra info. */ + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int lastarg = lua_gettop(L); /* last parameter */ + luaL_pushmodule(L, modname, 1); /* get/create module table */ + /* check whether table already has a _NAME field */ + if (lua_getfield(L, -1, "_NAME") != LUA_TNIL) + lua_pop(L, 1); /* table is an initialized module */ + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + set_env(L); + dooptions(L, lastarg); + return 1; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushglobaltable(L); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + +#endif +/* }====================================================== */ + + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"searchpath", ll_searchpath}, +#if defined(LUA_COMPAT_MODULE) + {"seeall", ll_seeall}, +#endif + /* placeholders */ + {"preload", NULL}, + {"cpath", NULL}, + {"path", NULL}, + {"searchers", NULL}, + {"loaded", NULL}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { +#if defined(LUA_COMPAT_MODULE) + {"module", ll_module}, +#endif + {"require", ll_require}, + {NULL, NULL} +}; + + +static void createsearcherstable (lua_State *L) { + static const lua_CFunction searchers[] = + {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL}; + int i; + /* create 'searchers' table */ + lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0); + /* fill it with predefined searchers */ + for (i=0; searchers[i] != NULL; i++) { + lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */ + lua_pushcclosure(L, searchers[i], 1); + lua_rawseti(L, -2, i+1); + } +#if defined(LUA_COMPAT_LOADERS) + lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ + lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */ +#endif + lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ +} + + +/* +** create table CLIBS to keep track of loaded C libraries, +** setting a finalizer to close all libraries when closing state. +*/ +static void createclibstable (lua_State *L) { + lua_newtable(L); /* create CLIBS table */ + lua_createtable(L, 0, 1); /* create metatable for CLIBS */ + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */ + lua_setmetatable(L, -2); + lua_rawsetp(L, LUA_REGISTRYINDEX, &CLIBS); /* set CLIBS table in registry */ +} + + +LUAMOD_API int luaopen_package (lua_State *L) { + createclibstable(L); + luaL_newlib(L, pk_funcs); /* create 'package' table */ + createsearcherstable(L); + /* set paths */ + setpath(L, "path", LUA_PATH_VAR, LUA_PATH_DEFAULT); + setpath(L, "cpath", LUA_CPATH_VAR, LUA_CPATH_DEFAULT); + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n" + LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); + lua_setfield(L, -2, "config"); + /* set field 'loaded' */ + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); + lua_setfield(L, -2, "loaded"); + /* set field 'preload' */ + luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); + lua_setfield(L, -2, "preload"); + lua_pushglobaltable(L); + lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ + luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */ + lua_pop(L, 1); /* pop global table */ + return 1; /* return 'package' table */ +} + diff --git a/deps/lua/src/lobject.c b/deps/lua/src/lobject.c new file mode 100644 index 0000000000..2218c8cdd7 --- /dev/null +++ b/deps/lua/src/lobject.c @@ -0,0 +1,522 @@ +/* +** $Id: lobject.c,v 2.113.1.1 2017/04/19 17:29:57 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#define lobject_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lctype.h" +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +LUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* exponent */ + if (x < 8) return x; + while (x >= (8 << 4)) { /* coarse steps */ + x = (x + 0xf) >> 4; /* x = ceil(x / 16) */ + e += 4; + } + while (x >= (8 << 1)) { /* fine steps */ + x = (x + 1) >> 1; /* x = ceil(x / 2) */ + e++; + } + return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1); +} + + +/* +** Computes ceil(log2(x)) +*/ +int luaO_ceillog2 (unsigned int x) { + static const lu_byte log_2[256] = { /* log_2[i] = ceil(log2(i - 1)) */ + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = 0; + x--; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; +} + + +static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, + lua_Integer v2) { + switch (op) { + case LUA_OPADD: return intop(+, v1, v2); + case LUA_OPSUB:return intop(-, v1, v2); + case LUA_OPMUL:return intop(*, v1, v2); + case LUA_OPMOD: return luaV_mod(L, v1, v2); + case LUA_OPIDIV: return luaV_div(L, v1, v2); + case LUA_OPBAND: return intop(&, v1, v2); + case LUA_OPBOR: return intop(|, v1, v2); + case LUA_OPBXOR: return intop(^, v1, v2); + case LUA_OPSHL: return luaV_shiftl(v1, v2); + case LUA_OPSHR: return luaV_shiftl(v1, -v2); + case LUA_OPUNM: return intop(-, 0, v1); + case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); + default: lua_assert(0); return 0; + } +} + + +static lua_Number numarith (lua_State *L, int op, lua_Number v1, + lua_Number v2) { + switch (op) { + case LUA_OPADD: return luai_numadd(L, v1, v2); + case LUA_OPSUB: return luai_numsub(L, v1, v2); + case LUA_OPMUL: return luai_nummul(L, v1, v2); + case LUA_OPDIV: return luai_numdiv(L, v1, v2); + case LUA_OPPOW: return luai_numpow(L, v1, v2); + case LUA_OPIDIV: return luai_numidiv(L, v1, v2); + case LUA_OPUNM: return luai_numunm(L, v1); + case LUA_OPMOD: { + lua_Number m; + luai_nummod(L, v1, v2, m); + return m; + } + default: lua_assert(0); return 0; + } +} + + +void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, + TValue *res) { + switch (op) { + case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: + case LUA_OPSHL: case LUA_OPSHR: + case LUA_OPBNOT: { /* operate only on integers */ + lua_Integer i1; lua_Integer i2; + if (tointeger(p1, &i1) && tointeger(p2, &i2)) { + setivalue(res, intarith(L, op, i1, i2)); + return; + } + else break; /* go to the end */ + } + case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */ + lua_Number n1; lua_Number n2; + if (tonumber(p1, &n1) && tonumber(p2, &n2)) { + setfltvalue(res, numarith(L, op, n1, n2)); + return; + } + else break; /* go to the end */ + } + default: { /* other operations */ + lua_Number n1; lua_Number n2; + if (ttisinteger(p1) && ttisinteger(p2)) { + setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2))); + return; + } + else if (tonumber(p1, &n1) && tonumber(p2, &n2)) { + setfltvalue(res, numarith(L, op, n1, n2)); + return; + } + else break; /* go to the end */ + } + } + /* could not perform raw operation; try metamethod */ + lua_assert(L != NULL); /* should not fail when folding (compile time) */ + luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD)); +} + + +int luaO_hexavalue (int c) { + if (lisdigit(c)) return c - '0'; + else return (ltolower(c) - 'a') + 10; +} + + +static int isneg (const char **s) { + if (**s == '-') { (*s)++; return 1; } + else if (**s == '+') (*s)++; + return 0; +} + + + +/* +** {================================================================== +** Lua's implementation for 'lua_strx2number' +** =================================================================== +*/ + +#if !defined(lua_strx2number) + +/* maximum number of significant digits to read (to avoid overflows + even with single floats) */ +#define MAXSIGDIG 30 + +/* +** convert an hexadecimal numeric string to a number, following +** C99 specification for 'strtod' +*/ +static lua_Number lua_strx2number (const char *s, char **endptr) { + int dot = lua_getlocaledecpoint(); + lua_Number r = 0.0; /* result (accumulator) */ + int sigdig = 0; /* number of significant digits */ + int nosigdig = 0; /* number of non-significant digits */ + int e = 0; /* exponent correction */ + int neg; /* 1 if number is negative */ + int hasdot = 0; /* true after seen a dot */ + *endptr = cast(char *, s); /* nothing is valid yet */ + while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ + neg = isneg(&s); /* check signal */ + if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ + return 0.0; /* invalid format (no '0x') */ + for (s += 2; ; s++) { /* skip '0x' and read numeral */ + if (*s == dot) { + if (hasdot) break; /* second dot? stop loop */ + else hasdot = 1; + } + else if (lisxdigit(cast_uchar(*s))) { + if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ + nosigdig++; + else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ + r = (r * cast_num(16.0)) + luaO_hexavalue(*s); + else e++; /* too many digits; ignore, but still count for exponent */ + if (hasdot) e--; /* decimal digit? correct exponent */ + } + else break; /* neither a dot nor a digit */ + } + if (nosigdig + sigdig == 0) /* no digits? */ + return 0.0; /* invalid format */ + *endptr = cast(char *, s); /* valid up to here */ + e *= 4; /* each digit multiplies/divides value by 2^4 */ + if (*s == 'p' || *s == 'P') { /* exponent part? */ + int exp1 = 0; /* exponent value */ + int neg1; /* exponent signal */ + s++; /* skip 'p' */ + neg1 = isneg(&s); /* signal */ + if (!lisdigit(cast_uchar(*s))) + return 0.0; /* invalid; must have at least one digit */ + while (lisdigit(cast_uchar(*s))) /* read exponent */ + exp1 = exp1 * 10 + *(s++) - '0'; + if (neg1) exp1 = -exp1; + e += exp1; + *endptr = cast(char *, s); /* valid up to here */ + } + if (neg) r = -r; + return l_mathop(ldexp)(r, e); +} + +#endif +/* }====================================================== */ + + +/* maximum length of a numeral */ +#if !defined (L_MAXLENNUM) +#define L_MAXLENNUM 200 +#endif + +static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { + char *endptr; + *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ + : lua_str2number(s, &endptr); + if (endptr == s) return NULL; /* nothing recognized? */ + while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ + return (*endptr == '\0') ? endptr : NULL; /* OK if no trailing characters */ +} + + +/* +** Convert string 's' to a Lua number (put in 'result'). Return NULL +** on fail or the address of the ending '\0' on success. +** 'pmode' points to (and 'mode' contains) special things in the string: +** - 'x'/'X' means an hexadecimal numeral +** - 'n'/'N' means 'inf' or 'nan' (which should be rejected) +** - '.' just optimizes the search for the common case (nothing special) +** This function accepts both the current locale or a dot as the radix +** mark. If the convertion fails, it may mean number has a dot but +** locale accepts something else. In that case, the code copies 's' +** to a buffer (because 's' is read-only), changes the dot to the +** current locale radix mark, and tries to convert again. +*/ +static const char *l_str2d (const char *s, lua_Number *result) { + const char *endptr; + const char *pmode = strpbrk(s, ".xXnN"); + int mode = pmode ? ltolower(cast_uchar(*pmode)) : 0; + if (mode == 'n') /* reject 'inf' and 'nan' */ + return NULL; + endptr = l_str2dloc(s, result, mode); /* try to convert */ + if (endptr == NULL) { /* failed? may be a different locale */ + char buff[L_MAXLENNUM + 1]; + const char *pdot = strchr(s, '.'); + if (strlen(s) > L_MAXLENNUM || pdot == NULL) + return NULL; /* string too long or no dot; fail */ + strcpy(buff, s); /* copy string to buffer */ + buff[pdot - s] = lua_getlocaledecpoint(); /* correct decimal point */ + endptr = l_str2dloc(buff, result, mode); /* try again */ + if (endptr != NULL) + endptr = s + (endptr - buff); /* make relative to 's' */ + } + return endptr; +} + + +#define MAXBY10 cast(lua_Unsigned, LUA_MAXINTEGER / 10) +#define MAXLASTD cast_int(LUA_MAXINTEGER % 10) + +static const char *l_str2int (const char *s, lua_Integer *result) { + lua_Unsigned a = 0; + int empty = 1; + int neg; + while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ + neg = isneg(&s); + if (s[0] == '0' && + (s[1] == 'x' || s[1] == 'X')) { /* hex? */ + s += 2; /* skip '0x' */ + for (; lisxdigit(cast_uchar(*s)); s++) { + a = a * 16 + luaO_hexavalue(*s); + empty = 0; + } + } + else { /* decimal */ + for (; lisdigit(cast_uchar(*s)); s++) { + int d = *s - '0'; + if (a >= MAXBY10 && (a > MAXBY10 || d > MAXLASTD + neg)) /* overflow? */ + return NULL; /* do not accept it (as integer) */ + a = a * 10 + d; + empty = 0; + } + } + while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ + if (empty || *s != '\0') return NULL; /* something wrong in the numeral */ + else { + *result = l_castU2S((neg) ? 0u - a : a); + return s; + } +} + + +size_t luaO_str2num (const char *s, TValue *o) { + lua_Integer i; lua_Number n; + const char *e; + if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */ + setivalue(o, i); + } + else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */ + setfltvalue(o, n); + } + else + return 0; /* conversion failed */ + return (e - s) + 1; /* success; return string size */ +} + + +int luaO_utf8esc (char *buff, unsigned long x) { + int n = 1; /* number of bytes put in buffer (backwards) */ + lua_assert(x <= 0x10FFFF); + if (x < 0x80) /* ascii? */ + buff[UTF8BUFFSZ - 1] = cast(char, x); + else { /* need continuation bytes */ + unsigned int mfb = 0x3f; /* maximum that fits in first byte */ + do { /* add continuation bytes */ + buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f)); + x >>= 6; /* remove added bits */ + mfb >>= 1; /* now there is one less bit available in first byte */ + } while (x > mfb); /* still needs continuation byte? */ + buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */ + } + return n; +} + + +/* maximum length of the conversion of a number to a string */ +#define MAXNUMBER2STR 50 + + +/* +** Convert a number object to a string +*/ +void luaO_tostring (lua_State *L, StkId obj) { + char buff[MAXNUMBER2STR]; + size_t len; + lua_assert(ttisnumber(obj)); + if (ttisinteger(obj)) + len = lua_integer2str(buff, sizeof(buff), ivalue(obj)); + else { + len = lua_number2str(buff, sizeof(buff), fltvalue(obj)); +#if !defined(LUA_COMPAT_FLOATSTRING) + if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ + buff[len++] = lua_getlocaledecpoint(); + buff[len++] = '0'; /* adds '.0' to result */ + } +#endif + } + setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); +} + + +static void pushstr (lua_State *L, const char *str, size_t l) { + setsvalue2s(L, L->top, luaS_newlstr(L, str, l)); + luaD_inctop(L); +} + + +/* +** this function handles only '%d', '%c', '%f', '%p', and '%s' + conventional formats, plus Lua-specific '%I' and '%U' +*/ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 0; + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + pushstr(L, fmt, e - fmt); + switch (*(e+1)) { + case 's': { /* zero-terminated string */ + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s, strlen(s)); + break; + } + case 'c': { /* an 'int' as a character */ + char buff = cast(char, va_arg(argp, int)); + if (lisprint(cast_uchar(buff))) + pushstr(L, &buff, 1); + else /* non-printable character; print its code */ + luaO_pushfstring(L, "<\\%d>", cast_uchar(buff)); + break; + } + case 'd': { /* an 'int' */ + setivalue(L->top, va_arg(argp, int)); + goto top2str; + } + case 'I': { /* a 'lua_Integer' */ + setivalue(L->top, cast(lua_Integer, va_arg(argp, l_uacInt))); + goto top2str; + } + case 'f': { /* a 'lua_Number' */ + setfltvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + top2str: /* convert the top element to a string */ + luaD_inctop(L); + luaO_tostring(L, L->top - 1); + break; + } + case 'p': { /* a pointer */ + char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */ + void *p = va_arg(argp, void *); + int l = lua_pointer2str(buff, sizeof(buff), p); + pushstr(L, buff, l); + break; + } + case 'U': { /* an 'int' as a UTF-8 sequence */ + char buff[UTF8BUFFSZ]; + int l = luaO_utf8esc(buff, cast(long, va_arg(argp, long))); + pushstr(L, buff + UTF8BUFFSZ - l, l); + break; + } + case '%': { + pushstr(L, "%", 1); + break; + } + default: { + luaG_runerror(L, "invalid option '%%%c' to 'lua_pushfstring'", + *(e + 1)); + } + } + n += 2; + fmt = e+2; + } + luaD_checkstack(L, 1); + pushstr(L, fmt, strlen(fmt)); + if (n > 0) luaV_concat(L, n + 1); + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +/* number of chars of a literal string without the ending \0 */ +#define LL(x) (sizeof(x)/sizeof(char) - 1) + +#define RETS "..." +#define PRE "[string \"" +#define POS "\"]" + +#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) ) + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + size_t l = strlen(source); + if (*source == '=') { /* 'literal' source */ + if (l <= bufflen) /* small enough? */ + memcpy(out, source + 1, l * sizeof(char)); + else { /* truncate it */ + addstr(out, source + 1, bufflen - 1); + *out = '\0'; + } + } + else if (*source == '@') { /* file name */ + if (l <= bufflen) /* small enough? */ + memcpy(out, source + 1, l * sizeof(char)); + else { /* add '...' before rest of name */ + addstr(out, RETS, LL(RETS)); + bufflen -= LL(RETS); + memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char)); + } + } + else { /* string; format as [string "source"] */ + const char *nl = strchr(source, '\n'); /* find first new line (if any) */ + addstr(out, PRE, LL(PRE)); /* add prefix */ + bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */ + if (l < bufflen && nl == NULL) { /* small one-line source? */ + addstr(out, source, l); /* keep it */ + } + else { + if (nl != NULL) l = nl - source; /* stop at first newline */ + if (l > bufflen) l = bufflen; + addstr(out, source, l); + addstr(out, RETS, LL(RETS)); + } + memcpy(out, POS, (LL(POS) + 1) * sizeof(char)); + } +} + diff --git a/deps/lua/src/lobject.h b/deps/lua/src/lobject.h new file mode 100644 index 0000000000..2408861402 --- /dev/null +++ b/deps/lua/src/lobject.h @@ -0,0 +1,549 @@ +/* +** $Id: lobject.h,v 2.117.1.1 2017/04/19 17:39:34 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO LUA_NUMTAGS /* function prototypes */ +#define LUA_TDEADKEY (LUA_NUMTAGS+1) /* removed keys in tables */ + +/* +** number of all possible tags (including LUA_TNONE but excluding DEADKEY) +*/ +#define LUA_TOTALTAGS (LUA_TPROTO + 2) + + +/* +** tags for Tagged Values have the following use of bits: +** bits 0-3: actual tag (a LUA_T* value) +** bits 4-5: variant bits +** bit 6: whether value is collectable +*/ + + +/* +** LUA_TFUNCTION variants: +** 0 - Lua function +** 1 - light C function +** 2 - regular C function (closure) +*/ + +/* Variant tags for functions */ +#define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ +#define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ +#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ + + +/* Variant tags for strings */ +#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */ +#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */ + + +/* Variant tags for numbers */ +#define LUA_TNUMFLT (LUA_TNUMBER | (0 << 4)) /* float numbers */ +#define LUA_TNUMINT (LUA_TNUMBER | (1 << 4)) /* integer numbers */ + + +/* Bit mark for collectable types */ +#define BIT_ISCOLLECTABLE (1 << 6) + +/* mark a tag as collectable */ +#define ctb(t) ((t) | BIT_ISCOLLECTABLE) + + +/* +** Common type for all collectable objects +*/ +typedef struct GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common type has only the common header +*/ +struct GCObject { + CommonHeader; +}; + + + + +/* +** Tagged Values. This is the basic representation of values in Lua, +** an actual value plus a tag with its type. +*/ + +/* +** Union of all Lua values +*/ +typedef union Value { + GCObject *gc; /* collectable objects */ + void *p; /* light userdata */ + int b; /* booleans */ + lua_CFunction f; /* light C functions */ + lua_Integer i; /* integer numbers */ + lua_Number n; /* float numbers */ +} Value; + + +#define TValuefields Value value_; int tt_ + + +typedef struct lua_TValue { + TValuefields; +} TValue; + + + +/* macro defining a nil value */ +#define NILCONSTANT {NULL}, LUA_TNIL + + +#define val_(o) ((o)->value_) + + +/* raw type tag of a TValue */ +#define rttype(o) ((o)->tt_) + +/* tag with no variants (bits 0-3) */ +#define novariant(x) ((x) & 0x0F) + +/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ +#define ttype(o) (rttype(o) & 0x3F) + +/* type tag of a TValue with no variants (bits 0-3) */ +#define ttnov(o) (novariant(rttype(o))) + + +/* Macros to test type */ +#define checktag(o,t) (rttype(o) == (t)) +#define checktype(o,t) (ttnov(o) == (t)) +#define ttisnumber(o) checktype((o), LUA_TNUMBER) +#define ttisfloat(o) checktag((o), LUA_TNUMFLT) +#define ttisinteger(o) checktag((o), LUA_TNUMINT) +#define ttisnil(o) checktag((o), LUA_TNIL) +#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) +#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) +#define ttisstring(o) checktype((o), LUA_TSTRING) +#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) +#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) +#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) +#define ttisfunction(o) checktype(o, LUA_TFUNCTION) +#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) +#define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) +#define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) +#define ttislcf(o) checktag((o), LUA_TLCF) +#define ttisfulluserdata(o) checktag((o), ctb(LUA_TUSERDATA)) +#define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) +#define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) + + +/* Macros to access values */ +#define ivalue(o) check_exp(ttisinteger(o), val_(o).i) +#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) +#define nvalue(o) check_exp(ttisnumber(o), \ + (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o))) +#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) +#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) +#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) +#define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc)) +#define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc)) +#define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc)) +#define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc)) +#define fvalue(o) check_exp(ttislcf(o), val_(o).f) +#define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc)) +#define bvalue(o) check_exp(ttisboolean(o), val_(o).b) +#define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc)) +/* a dead value may get the 'gc' field, but cannot access its contents */ +#define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + + +#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) + + +/* Macros for internal tests */ +#define righttt(obj) (ttype(obj) == gcvalue(obj)->tt) + +#define checkliveness(L,obj) \ + lua_longassert(!iscollectable(obj) || \ + (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))) + + +/* Macros to set values */ +#define settt_(o,t) ((o)->tt_=(t)) + +#define setfltvalue(obj,x) \ + { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } + +#define chgfltvalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } + +#define setivalue(obj,x) \ + { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } + +#define chgivalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } + +#define setnilvalue(obj) settt_(obj, LUA_TNIL) + +#define setfvalue(obj,x) \ + { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } + +#define setpvalue(obj,x) \ + { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } + +#define setbvalue(obj,x) \ + { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } + +#define setgcovalue(L,obj,x) \ + { TValue *io = (obj); GCObject *i_g=(x); \ + val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); } + +#define setsvalue(L,obj,x) \ + { TValue *io = (obj); TString *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \ + checkliveness(L,io); } + +#define setuvalue(L,obj,x) \ + { TValue *io = (obj); Udata *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \ + checkliveness(L,io); } + +#define setthvalue(L,obj,x) \ + { TValue *io = (obj); lua_State *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \ + checkliveness(L,io); } + +#define setclLvalue(L,obj,x) \ + { TValue *io = (obj); LClosure *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \ + checkliveness(L,io); } + +#define setclCvalue(L,obj,x) \ + { TValue *io = (obj); CClosure *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \ + checkliveness(L,io); } + +#define sethvalue(L,obj,x) \ + { TValue *io = (obj); Table *x_ = (x); \ + val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \ + checkliveness(L,io); } + +#define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) + + + +#define setobj(L,obj1,obj2) \ + { TValue *io1=(obj1); *io1 = *(obj2); \ + (void)L; checkliveness(L,io1); } + + +/* +** different types of assignments, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +/* to table (define it as an expression to be used in macros) */ +#define setobj2t(L,o1,o2) ((void)L, *(o1)=*(o2), checkliveness(L,(o1))) + + + + +/* +** {====================================================== +** types and prototypes +** ======================================================= +*/ + + +typedef TValue *StkId; /* index to stack elements */ + + + + +/* +** Header for string value; string bytes follow the end of this structure +** (aligned according to 'UTString'; see next). +*/ +typedef struct TString { + CommonHeader; + lu_byte extra; /* reserved words for short strings; "has hash" for longs */ + lu_byte shrlen; /* length for short strings */ + unsigned int hash; + union { + size_t lnglen; /* length for long strings */ + struct TString *hnext; /* linked list for hash table */ + } u; +} TString; + + +/* +** Ensures that address after this type is always fully aligned. +*/ +typedef union UTString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + TString tsv; +} UTString; + + +/* +** Get the actual string (array of bytes) from a 'TString'. +** (Access to 'extra' ensures that value is really a 'TString'.) +*/ +#define getstr(ts) \ + check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) + + +/* get the actual string (array of bytes) from a Lua value */ +#define svalue(o) getstr(tsvalue(o)) + +/* get string length from 'TString *s' */ +#define tsslen(s) ((s)->tt == LUA_TSHRSTR ? (s)->shrlen : (s)->u.lnglen) + +/* get string length from 'TValue *o' */ +#define vslen(o) tsslen(tsvalue(o)) + + +/* +** Header for userdata; memory area follows the end of this structure +** (aligned according to 'UUdata'; see next). +*/ +typedef struct Udata { + CommonHeader; + lu_byte ttuv_; /* user value's tag */ + struct Table *metatable; + size_t len; /* number of bytes */ + union Value user_; /* user value */ +} Udata; + + +/* +** Ensures that address after this type is always fully aligned. +*/ +typedef union UUdata { + L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */ + Udata uv; +} UUdata; + + +/* +** Get the address of memory block inside 'Udata'. +** (Access to 'ttuv_' ensures that value is really a 'Udata'.) +*/ +#define getudatamem(u) \ + check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata))) + +#define setuservalue(L,u,o) \ + { const TValue *io=(o); Udata *iu = (u); \ + iu->user_ = io->value_; iu->ttuv_ = rttype(io); \ + checkliveness(L,io); } + + +#define getuservalue(L,u,o) \ + { TValue *io=(o); const Udata *iu = (u); \ + io->value_ = iu->user_; settt_(io, iu->ttuv_); \ + checkliveness(L,io); } + + +/* +** Description of an upvalue for function prototypes +*/ +typedef struct Upvaldesc { + TString *name; /* upvalue name (for debug information) */ + lu_byte instack; /* whether it is in stack (register) */ + lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ +} Upvaldesc; + + +/* +** Description of a local variable for function prototypes +** (used for debug information) +*/ +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + lu_byte numparams; /* number of fixed parameters */ + lu_byte is_vararg; + lu_byte maxstacksize; /* number of registers needed by this function */ + int sizeupvalues; /* size of 'upvalues' */ + int sizek; /* size of 'k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of 'p' */ + int sizelocvars; + int linedefined; /* debug information */ + int lastlinedefined; /* debug information */ + TValue *k; /* constants used by the function */ + Instruction *code; /* opcodes */ + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines (debug information) */ + LocVar *locvars; /* information about local variables (debug information) */ + Upvaldesc *upvalues; /* upvalue information */ + struct LClosure *cache; /* last-created closure with this prototype */ + TString *source; /* used for debug information */ + GCObject *gclist; +} Proto; + + + +/* +** Lua Upvalues +*/ +typedef struct UpVal UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte nupvalues; GCObject *gclist + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; /* list of upvalues */ +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; /* list of upvalues */ +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define isLfunction(o) ttisLclosure(o) + +#define getproto(o) (clLvalue(o)->p) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + int next; /* for chaining (offset for next node) */ + } nk; + TValue tvk; +} TKey; + + +/* copy a value into a key without messing up field 'next' */ +#define setnodekey(L,key,obj) \ + { TKey *k_=(key); const TValue *io_=(obj); \ + k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ + (void)L; checkliveness(L,io_); } + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

lsizenode)) + + +/* +** (address of) a fixed nil value +*/ +#define luaO_nilobject (&luaO_nilobject_) + + +LUAI_DDEC const TValue luaO_nilobject_; + +/* size of buffer for 'luaO_utf8esc' function */ +#define UTF8BUFFSZ 8 + +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); +LUAI_FUNC int luaO_ceillog2 (unsigned int x); +LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, + const TValue *p2, TValue *res); +LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); +LUAI_FUNC int luaO_hexavalue (int c); +LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/deps/lua/src/lopcodes.c b/deps/lua/src/lopcodes.c new file mode 100644 index 0000000000..5ca3eb261a --- /dev/null +++ b/deps/lua/src/lopcodes.c @@ -0,0 +1,124 @@ +/* +** $Id: lopcodes.c,v 1.55.1.1 2017/04/19 17:20:42 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#define lopcodes_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lopcodes.h" + + +/* ORDER OP */ + +LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADKX", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETTABUP", + "GETTABLE", + "SETTABUP", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "MOD", + "POW", + "DIV", + "IDIV", + "BAND", + "BOR", + "BXOR", + "SHL", + "SHR", + "UNM", + "BNOT", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORCALL", + "TFORLOOP", + "SETLIST", + "CLOSURE", + "VARARG", + "EXTRAARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_IDIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHR */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ + ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ +}; + diff --git a/deps/lua/src/lopcodes.h b/deps/lua/src/lopcodes.h new file mode 100644 index 0000000000..6feaa1cd07 --- /dev/null +++ b/deps/lua/src/lopcodes.h @@ -0,0 +1,297 @@ +/* +** $Id: lopcodes.h,v 1.149.1.1 2017/04/19 17:20:42 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + 'A' : 8 bits + 'B' : 9 bits + 'C' : 9 bits + 'Ax' : 26 bits ('A', 'B', and 'C' together) + 'Bx' : 18 bits ('B' and 'C' together) + 'sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 +#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C +#define POS_Ax POS_A + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<>1) /* 'sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + +#if SIZE_Ax < LUAI_BITSINT-1 +#define MAXARG_Ax ((1<>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>pos) & MASK1(size,0))) +#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ + ((cast(Instruction, v)<> RK(C) */ +OP_UNM,/* A B R(A) := -R(B) */ +OP_BNOT,/* A B R(A) := ~R(B) */ +OP_NOT,/* A B R(A) := not R(B) */ +OP_LEN,/* A B R(A) := length of R(B) */ + +OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ + +OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */ +OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ +OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ +OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ + +OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) > 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/deps/lua/src/loslib.c b/deps/lua/src/loslib.c new file mode 100644 index 0000000000..de590c6b71 --- /dev/null +++ b/deps/lua/src/loslib.c @@ -0,0 +1,409 @@ +/* +** $Id: loslib.c,v 1.65.1.1 2017/04/19 17:29:57 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + +#define loslib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** {================================================================== +** List of valid conversion specifiers for the 'strftime' function; +** options are grouped by length; group of length 2 start with '||'. +** =================================================================== +*/ +#if !defined(LUA_STRFTIMEOPTIONS) /* { */ + +/* options for ANSI C 89 (only 1-char options) */ +#define L_STRFTIMEC89 "aAbBcdHIjmMpSUwWxXyYZ%" + +/* options for ISO C 99 and POSIX */ +#define L_STRFTIMEC99 "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ + "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */ + +/* options for Windows */ +#define L_STRFTIMEWIN "aAbBcdHIjmMpSUwWxXyYzZ%" \ + "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */ + +#if defined(LUA_USE_WINDOWS) +#define LUA_STRFTIMEOPTIONS L_STRFTIMEWIN +#elif defined(LUA_USE_C89) +#define LUA_STRFTIMEOPTIONS L_STRFTIMEC89 +#else /* C99 specification */ +#define LUA_STRFTIMEOPTIONS L_STRFTIMEC99 +#endif + +#endif /* } */ +/* }================================================================== */ + + +/* +** {================================================================== +** Configuration for time-related stuff +** =================================================================== +*/ + +#if !defined(l_time_t) /* { */ +/* +** type to represent time_t in Lua +*/ +#define l_timet lua_Integer +#define l_pushtime(L,t) lua_pushinteger(L,(lua_Integer)(t)) + +static time_t l_checktime (lua_State *L, int arg) { + lua_Integer t = luaL_checkinteger(L, arg); + luaL_argcheck(L, (time_t)t == t, arg, "time out-of-bounds"); + return (time_t)t; +} + +#endif /* } */ + + +#if !defined(l_gmtime) /* { */ +/* +** By default, Lua uses gmtime/localtime, except when POSIX is available, +** where it uses gmtime_r/localtime_r +*/ + +#if defined(LUA_USE_POSIX) /* { */ + +#define l_gmtime(t,r) gmtime_r(t,r) +#define l_localtime(t,r) localtime_r(t,r) + +#else /* }{ */ + +/* ISO C definitions */ +#define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) +#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) + +#endif /* } */ + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Configuration for 'tmpnam': +** By default, Lua uses tmpnam except when POSIX is available, where +** it uses mkstemp. +** =================================================================== +*/ +#if !defined(lua_tmpnam) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#include + +#define LUA_TMPNAMBUFSIZE 32 + +#if !defined(LUA_TMPNAMTEMPLATE) +#define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX" +#endif + +#define lua_tmpnam(b,e) { \ + strcpy(b, LUA_TMPNAMTEMPLATE); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else /* }{ */ + +/* ISO C definitions */ +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } + +#endif /* } */ + +#endif /* } */ +/* }================================================================== */ + + + + +static int os_execute (lua_State *L) { + const char *cmd = luaL_optstring(L, 1, NULL); + int stat = system(cmd); + if (cmd != NULL) + return luaL_execresult(L, stat); + else { + lua_pushboolean(L, stat); /* true if there is a shell */ + return 1; + } +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return luaL_fileresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return luaL_fileresult(L, rename(fromname, toname) == 0, NULL); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + + +/* +** Set all fields from structure 'tm' in the table on top of the stack +*/ +static void setallfields (lua_State *L, struct tm *stm) { + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon + 1); + setfield(L, "year", stm->tm_year + 1900); + setfield(L, "wday", stm->tm_wday + 1); + setfield(L, "yday", stm->tm_yday + 1); + setboolfield(L, "isdst", stm->tm_isdst); +} + + +static int getboolfield (lua_State *L, const char *key) { + int res; + res = (lua_getfield(L, -1, key) == LUA_TNIL) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +/* maximum value for date fields (to avoid arithmetic overflows with 'int') */ +#if !defined(L_MAXDATEFIELD) +#define L_MAXDATEFIELD (INT_MAX / 2) +#endif + +static int getfield (lua_State *L, const char *key, int d, int delta) { + int isnum; + int t = lua_getfield(L, -1, key); /* get field and its type */ + lua_Integer res = lua_tointegerx(L, -1, &isnum); + if (!isnum) { /* field is not an integer? */ + if (t != LUA_TNIL) /* some other value? */ + return luaL_error(L, "field '%s' is not an integer", key); + else if (d < 0) /* absent field; no default? */ + return luaL_error(L, "field '%s' missing in date table", key); + res = d; + } + else { + if (!(-L_MAXDATEFIELD <= res && res <= L_MAXDATEFIELD)) + return luaL_error(L, "field '%s' is out-of-bound", key); + res -= delta; + } + lua_pop(L, 1); + return (int)res; +} + + +static const char *checkoption (lua_State *L, const char *conv, + ptrdiff_t convlen, char *buff) { + const char *option = LUA_STRFTIMEOPTIONS; + int oplen = 1; /* length of options being checked */ + for (; *option != '\0' && oplen <= convlen; option += oplen) { + if (*option == '|') /* next block? */ + oplen++; /* will check options with next length (+1) */ + else if (memcmp(conv, option, oplen) == 0) { /* match? */ + memcpy(buff, conv, oplen); /* copy valid option to buffer */ + buff[oplen] = '\0'; + return conv + oplen; /* return next item */ + } + } + luaL_argerror(L, 1, + lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv)); + return conv; /* to avoid warnings */ +} + + +/* maximum size for an individual 'strftime' item */ +#define SIZETIMEFMT 250 + + +static int os_date (lua_State *L) { + size_t slen; + const char *s = luaL_optlstring(L, 1, "%c", &slen); + time_t t = luaL_opt(L, l_checktime, 2, time(NULL)); + const char *se = s + slen; /* 's' end */ + struct tm tmr, *stm; + if (*s == '!') { /* UTC? */ + stm = l_gmtime(&t, &tmr); + s++; /* skip '!' */ + } + else + stm = l_localtime(&t, &tmr); + if (stm == NULL) /* invalid date? */ + return luaL_error(L, + "time result cannot be represented in this installation"); + if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setallfields(L, stm); + } + else { + char cc[4]; /* buffer for individual conversion specifiers */ + luaL_Buffer b; + cc[0] = '%'; + luaL_buffinit(L, &b); + while (s < se) { + if (*s != '%') /* not a conversion specifier? */ + luaL_addchar(&b, *s++); + else { + size_t reslen; + char *buff = luaL_prepbuffsize(&b, SIZETIMEFMT); + s++; /* skip '%' */ + s = checkoption(L, s, se - s, cc + 1); /* copy specifier to 'cc' */ + reslen = strftime(buff, SIZETIMEFMT, cc, stm); + luaL_addsize(&b, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0, 0); + ts.tm_min = getfield(L, "min", 0, 0); + ts.tm_hour = getfield(L, "hour", 12, 0); + ts.tm_mday = getfield(L, "day", -1, 0); + ts.tm_mon = getfield(L, "month", -1, 1); + ts.tm_year = getfield(L, "year", -1, 1900); + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + setallfields(L, &ts); /* update fields with normalized values */ + } + if (t != (time_t)(l_timet)t || t == (time_t)(-1)) + return luaL_error(L, + "time result cannot be represented in this installation"); + l_pushtime(L, t); + return 1; +} + + +static int os_difftime (lua_State *L) { + time_t t1 = l_checktime(L, 1); + time_t t2 = l_checktime(L, 2); + lua_pushnumber(L, (lua_Number)difftime(t1, t2)); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + int status; + if (lua_isboolean(L, 1)) + status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE); + else + status = (int)luaL_optinteger(L, 1, EXIT_SUCCESS); + if (lua_toboolean(L, 2)) + lua_close(L); + if (L) exit(status); /* 'if' to avoid warnings for unreachable 'return' */ + return 0; +} + + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUAMOD_API int luaopen_os (lua_State *L) { + luaL_newlib(L, syslib); + return 1; +} + diff --git a/deps/lua/src/lparser.c b/deps/lua/src/lparser.c new file mode 100644 index 0000000000..cc54de43c6 --- /dev/null +++ b/deps/lua/src/lparser.c @@ -0,0 +1,1650 @@ +/* +** $Id: lparser.c,v 2.155.1.2 2017/04/29 18:11:40 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#define lparser_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +/* maximum number of local variables per function (must be smaller + than 250, due to the bytecode format) */ +#define MAXVARS 200 + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + + +/* because all strings are unified by the scanner, the parser + can use pointer equality for string equality */ +#define eqstr(a,b) ((a) == (b)) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int firstlabel; /* index of first label in this block */ + int firstgoto; /* index of first pending goto in this block */ + lu_byte nactvar; /* # active locals outside the block */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isloop; /* true if 'block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void statement (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +/* semantic error */ +static l_noret semerror (LexState *ls, const char *msg) { + ls->t.token = 0; /* remove "near " from final message */ + luaX_syntaxerror(ls, msg); +} + + +static l_noret error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); +} + + +static l_noret errorlimit (FuncState *fs, int limit, const char *what) { + lua_State *L = fs->ls->L; + const char *msg; + int line = fs->f->linedefined; + const char *where = (line == 0) + ? "main function" + : luaO_pushfstring(L, "function at line %d", line); + msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s", + what, limit, where); + luaX_syntaxerror(fs->ls, msg); +} + + +static void checklimit (FuncState *fs, int v, int l, const char *what) { + if (v > l) errorlimit(fs, l, what); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + "%s expected (to close %s at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname (LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "local variables"); + while (oldsize < f->sizelocvars) + f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +static void new_localvar (LexState *ls, TString *name) { + FuncState *fs = ls->fs; + Dyndata *dyd = ls->dyd; + int reg = registerlocalvar(ls, name); + checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, + MAXVARS, "local variables"); + luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1, + dyd->actvar.size, Vardesc, MAX_INT, "local variables"); + dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg); +} + + +static void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) { + new_localvar(ls, luaX_newstring(ls, name, sz)); +} + +#define new_localvarliteral(ls,v) \ + new_localvarliteral_(ls, "" v, (sizeof(v)/sizeof(char))-1) + + +static LocVar *getlocvar (FuncState *fs, int i) { + int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx; + lua_assert(idx < fs->nlocvars); + return &fs->f->locvars[idx]; +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc; + } +} + + +static void removevars (FuncState *fs, int tolevel) { + fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel); + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar)->endpc = fs->pc; +} + + +static int searchupvalue (FuncState *fs, TString *name) { + int i; + Upvaldesc *up = fs->f->upvalues; + for (i = 0; i < fs->nups; i++) { + if (eqstr(up[i].name, name)) return i; + } + return -1; /* not found */ +} + + +static int newupvalue (FuncState *fs, TString *name, expdesc *v) { + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); + luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, + Upvaldesc, MAXUPVAL, "upvalues"); + while (oldsize < f->sizeupvalues) + f->upvalues[oldsize++].name = NULL; + f->upvalues[fs->nups].instack = (v->k == VLOCAL); + f->upvalues[fs->nups].idx = cast_byte(v->u.info); + f->upvalues[fs->nups].name = name; + luaC_objbarrier(fs->ls->L, f, name); + return fs->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) { + if (eqstr(n, getlocvar(fs, i)->varname)) + return i; + } + return -1; /* not found */ +} + + +/* + Mark block where variable at given level was defined + (to emit close instructions later). +*/ +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl->nactvar > level) + bl = bl->previous; + bl->upval = 1; +} + + +/* + Find variable with given name 'n'. If it is an upvalue, add this + upvalue into all intermediate functions. +*/ +static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) /* no more levels? */ + init_exp(var, VVOID, 0); /* default is global */ + else { + int v = searchvar(fs, n); /* look up locals at current level */ + if (v >= 0) { /* found? */ + init_exp(var, VLOCAL, v); /* variable is local */ + if (!base) + markupval(fs, v); /* local will be used as an upval */ + } + else { /* not found as local at current level; try upvalues */ + int idx = searchupvalue(fs, n); /* try existing upvalues */ + if (idx < 0) { /* not found? */ + singlevaraux(fs->prev, n, var, 0); /* try upper levels */ + if (var->k == VVOID) /* not found? */ + return; /* it is a global */ + /* else was LOCAL or UPVAL */ + idx = newupvalue(fs, n, var); /* will be a new upvalue */ + } + init_exp(var, VUPVAL, idx); /* new or old upvalue */ + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + singlevaraux(fs, varname, var, 1); + if (var->k == VVOID) { /* global name? */ + expdesc key; + singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ + lua_assert(var->k != VVOID); /* this one must exist */ + codestring(ls, &key, varname); /* key is variable name */ + luaK_indexed(fs, var, &key); /* env[varname] */ + } +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ +} + + +static void enterlevel (LexState *ls) { + lua_State *L = ls->L; + ++L->nCcalls; + checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels"); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void closegoto (LexState *ls, int g, Labeldesc *label) { + int i; + FuncState *fs = ls->fs; + Labellist *gl = &ls->dyd->gt; + Labeldesc *gt = &gl->arr[g]; + lua_assert(eqstr(gt->name, label->name)); + if (gt->nactvar < label->nactvar) { + TString *vname = getlocvar(fs, gt->nactvar)->varname; + const char *msg = luaO_pushfstring(ls->L, + " at line %d jumps into the scope of local '%s'", + getstr(gt->name), gt->line, getstr(vname)); + semerror(ls, msg); + } + luaK_patchlist(fs, gt->pc, label->pc); + /* remove goto from pending list */ + for (i = g; i < gl->n - 1; i++) + gl->arr[i] = gl->arr[i + 1]; + gl->n--; +} + + +/* +** try to close a goto with existing labels; this solves backward jumps +*/ +static int findlabel (LexState *ls, int g) { + int i; + BlockCnt *bl = ls->fs->bl; + Dyndata *dyd = ls->dyd; + Labeldesc *gt = &dyd->gt.arr[g]; + /* check labels in current block for a match */ + for (i = bl->firstlabel; i < dyd->label.n; i++) { + Labeldesc *lb = &dyd->label.arr[i]; + if (eqstr(lb->name, gt->name)) { /* correct label? */ + if (gt->nactvar > lb->nactvar && + (bl->upval || dyd->label.n > bl->firstlabel)) + luaK_patchclose(ls->fs, gt->pc, lb->nactvar); + closegoto(ls, g, lb); /* close it */ + return 1; + } + } + return 0; /* label not found; cannot close goto */ +} + + +static int newlabelentry (LexState *ls, Labellist *l, TString *name, + int line, int pc) { + int n = l->n; + luaM_growvector(ls->L, l->arr, n, l->size, + Labeldesc, SHRT_MAX, "labels/gotos"); + l->arr[n].name = name; + l->arr[n].line = line; + l->arr[n].nactvar = ls->fs->nactvar; + l->arr[n].pc = pc; + l->n = n + 1; + return n; +} + + +/* +** check whether new label 'lb' matches any pending gotos in current +** block; solves forward jumps +*/ +static void findgotos (LexState *ls, Labeldesc *lb) { + Labellist *gl = &ls->dyd->gt; + int i = ls->fs->bl->firstgoto; + while (i < gl->n) { + if (eqstr(gl->arr[i].name, lb->name)) + closegoto(ls, i, lb); + else + i++; + } +} + + +/* +** export pending gotos to outer level, to check them against +** outer labels; if the block being exited has upvalues, and +** the goto exits the scope of any variable (which can be the +** upvalue), close those variables being exited. +*/ +static void movegotosout (FuncState *fs, BlockCnt *bl) { + int i = bl->firstgoto; + Labellist *gl = &fs->ls->dyd->gt; + /* correct pending gotos to current block and try to close it + with visible labels */ + while (i < gl->n) { + Labeldesc *gt = &gl->arr[i]; + if (gt->nactvar > bl->nactvar) { + if (bl->upval) + luaK_patchclose(fs, gt->pc, bl->nactvar); + gt->nactvar = bl->nactvar; + } + if (!findlabel(fs->ls, i)) + i++; /* move to next one */ + } +} + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { + bl->isloop = isloop; + bl->nactvar = fs->nactvar; + bl->firstlabel = fs->ls->dyd->label.n; + bl->firstgoto = fs->ls->dyd->gt.n; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +/* +** create a label named 'break' to resolve break statements +*/ +static void breaklabel (LexState *ls) { + TString *n = luaS_new(ls->L, "break"); + int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc); + findgotos(ls, &ls->dyd->label.arr[l]); +} + +/* +** generates an error for an undefined 'goto'; choose appropriate +** message when label name is a reserved word (which can only be 'break') +*/ +static l_noret undefgoto (LexState *ls, Labeldesc *gt) { + const char *msg = isreserved(gt->name) + ? "<%s> at line %d not inside a loop" + : "no visible label '%s' for at line %d"; + msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); + semerror(ls, msg); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + LexState *ls = fs->ls; + if (bl->previous && bl->upval) { + /* create a 'jump to here' to close upvalues */ + int j = luaK_jump(fs); + luaK_patchclose(fs, j, bl->nactvar); + luaK_patchtohere(fs, j); + } + if (bl->isloop) + breaklabel(ls); /* close pending breaks */ + fs->bl = bl->previous; + removevars(fs, bl->nactvar); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + ls->dyd->label.n = bl->firstlabel; /* remove local labels */ + if (bl->previous) /* inner block? */ + movegotosout(fs, bl); /* update pending gotos to outer block */ + else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */ + undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */ +} + + +/* +** adds a new prototype into list of prototypes +*/ +static Proto *addprototype (LexState *ls) { + Proto *clp; + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; /* prototype of current function */ + if (fs->np >= f->sizep) { + int oldsize = f->sizep; + luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); + while (oldsize < f->sizep) + f->p[oldsize++] = NULL; + } + f->p[fs->np++] = clp = luaF_newproto(L); + luaC_objbarrier(L, f, clp); + return clp; +} + + +/* +** codes instruction to create new closure in parent function. +** The OP_CLOSURE instruction must use the last available register, +** so that, if it invokes the GC, the GC knows which registers +** are in use at that time. +*/ +static void codeclosure (LexState *ls, expdesc *v) { + FuncState *fs = ls->fs->prev; + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); + luaK_exp2nextreg(fs, v); /* fix it at the last register */ +} + + +static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { + Proto *f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = 0; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nups = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->firstlocal = ls->dyd->actvar.n; + fs->bl = NULL; + f = fs->f; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + enterblock(fs, bl, 0); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + luaK_ret(fs, 0, 0); /* final return */ + leaveblock(fs); + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc); + f->sizeupvalues = fs->nups; + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + luaC_checkGC(L); +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +/* +** check whether current token is in the follow set of a block. +** 'until' closes syntactical blocks, but do not close scope, +** so it is handled in separate. +*/ +static int block_follow (LexState *ls, int withuntil) { + switch (ls->t.token) { + case TK_ELSE: case TK_ELSEIF: + case TK_END: case TK_EOS: + return 1; + case TK_UNTIL: return withuntil; + default: return 0; + } +} + + +static void statlist (LexState *ls) { + /* statlist -> { stat [';'] } */ + while (!block_follow(ls, 1)) { + if (ls->t.token == TK_RETURN) { + statement(ls); + return; /* 'return' must be last statement */ + } + statement(ls); + } +} + + +static void fieldsel (LexState *ls, expdesc *v) { + /* fieldsel -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyregup(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of 'record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | '['exp1']') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + /* listfield -> exp */ + expr(ls, &cc->v); + checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void field (LexState *ls, struct ConsControl *cc) { + /* field -> listfield | recfield */ + switch(ls->t.token) { + case TK_NAME: { /* may be 'listfield' or 'recfield' */ + if (luaX_lookahead(ls) != '=') /* expression? */ + listfield(ls, cc); + else + recfield(ls, cc); + break; + } + case '[': { + recfield(ls, cc); + break; + } + default: { + listfield(ls, cc); + break; + } + } +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> '{' [ field { sep field } [sep] ] '}' + sep -> ',' | ';' */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + field(ls, &cc); + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { ',' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is 'parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls)); + nparams++; + break; + } + case TK_DOTS: { /* param -> '...' */ + luaX_next(ls); + f->is_vararg = 1; /* declared vararg */ + break; + } + default: luaX_syntaxerror(ls, " or '...' expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int ismethod, int line) { + /* body -> '(' parlist ')' block END */ + FuncState new_fs; + BlockCnt bl; + new_fs.f = addprototype(ls); + new_fs.f->linedefined = line; + open_func(ls, &new_fs, &bl); + checknext(ls, '('); + if (ismethod) { + new_localvarliteral(ls, "self"); /* create 'self' parameter */ + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + statlist(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + codeclosure(ls, e); + close_func(ls); +} + + +static int explist (LexState *ls, expdesc *v) { + /* explist -> expr { ',' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f, int line) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + switch (ls->t.token) { + case '(': { /* funcargs -> '(' [ explist ] ')' */ + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use 'seminfo' before 'next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + } + } +} + + +static void suffixedexp (LexState *ls, expdesc *v) { + /* suffixedexp -> + primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + primaryexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* fieldsel */ + fieldsel(ls, v); + break; + } + case '[': { /* '[' exp1 ']' */ + expdesc key; + luaK_exp2anyregup(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* ':' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v, line); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v, line); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | + constructor | FUNCTION body | suffixedexp */ + switch (ls->t.token) { + case TK_FLT: { + init_exp(v, VKFLT, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_INT: { + init_exp(v, VKINT, 0); + v->u.ival = ls->t.seminfo.i; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use '...' outside a vararg function"); + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + suffixedexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '~': return OPR_BNOT; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case '/': return OPR_DIV; + case TK_IDIV: return OPR_IDIV; + case '&': return OPR_BAND; + case '|': return OPR_BOR; + case '~': return OPR_BXOR; + case TK_SHL: return OPR_SHL; + case TK_SHR: return OPR_SHR; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {10, 10}, {10, 10}, /* '+' '-' */ + {11, 11}, {11, 11}, /* '*' '%' */ + {14, 13}, /* '^' (right associative) */ + {11, 11}, {11, 11}, /* '/' '//' */ + {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */ + {7, 7}, {7, 7}, /* '<<' '>>' */ + {9, 8}, /* '..' (right associative) */ + {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ + {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ + {2, 2}, {1, 1} /* and, or */ +}; + +#define UNARY_PRIORITY 12 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where 'binop' is any binary operator with a priority higher than 'limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + int line = ls->linenumber; + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v, line); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than 'limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + int line = ls->linenumber; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2, line); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static void block (LexState *ls) { + /* block -> statlist */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + statlist(ls); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to an upvalue/local variable, the +** upvalue/local variable is begin used in a previous assignment to a +** table. If so, save original upvalue/local value in a safe place and +** use this safe copy in the previous assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { /* check all previous assignments */ + if (lh->v.k == VINDEXED) { /* assigning to a table? */ + /* table is the upvalue/local being assigned now? */ + if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) { + conflict = 1; + lh->v.u.ind.vt = VLOCAL; + lh->v.u.ind.t = extra; /* previous assignment will use safe copy */ + } + /* index is the local being assigned? (index cannot be upvalue) */ + if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { + conflict = 1; + lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + /* copy upvalue/local value to a temporary (in position 'extra') */ + OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, op, extra, v->u.info, 0); + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, vkisvar(lh->v.k), "syntax error"); + if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + suffixedexp(ls, &nv.v); + if (nv.v.k != VINDEXED) + check_conflict(ls, lh, &nv.v); + checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS, + "C levels"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> '=' explist */ + int nexps; + checknext(ls, '='); + nexps = explist(ls, &e); + if (nexps != nvars) + adjust_assign(ls, nvars, nexps, &e); + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void gotostat (LexState *ls, int pc) { + int line = ls->linenumber; + TString *label; + int g; + if (testnext(ls, TK_GOTO)) + label = str_checkname(ls); + else { + luaX_next(ls); /* skip break */ + label = luaS_new(ls->L, "break"); + } + g = newlabelentry(ls, &ls->dyd->gt, label, line, pc); + findlabel(ls, g); /* close it if label already defined */ +} + + +/* check for repeated labels on the same block */ +static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) { + int i; + for (i = fs->bl->firstlabel; i < ll->n; i++) { + if (eqstr(label, ll->arr[i].name)) { + const char *msg = luaO_pushfstring(fs->ls->L, + "label '%s' already defined on line %d", + getstr(label), ll->arr[i].line); + semerror(fs->ls, msg); + } + } +} + + +/* skip no-op statements */ +static void skipnoopstat (LexState *ls) { + while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) + statement(ls); +} + + +static void labelstat (LexState *ls, TString *label, int line) { + /* label -> '::' NAME '::' */ + FuncState *fs = ls->fs; + Labellist *ll = &ls->dyd->label; + int l; /* index of new label being created */ + checkrepeated(fs, ll, label); /* check for repeated labels */ + checknext(ls, TK_DBCOLON); /* skip double colon */ + /* create new entry for this label */ + l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); + skipnoopstat(ls); /* skip other no-op statements */ + if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ + /* assume that locals are already out of scope */ + ll->arr[l].nactvar = fs->bl->nactvar; + } + findgotos(ls, &ll->arr[l]); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_jumpto(fs, whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + statlist(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (bl2.upval) /* upvalues? */ + luaK_patchclose(fs, condexit, bl2.nactvar); + leaveblock(fs); /* finish scope */ + luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int reg; + expr(ls, &e); + luaK_exp2nextreg(ls->fs, &e); + lua_assert(e.k == VNONRELOC); + reg = e.u.info; + return reg; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + if (isnum) /* numeric for? */ + endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP); + else { /* generic for */ + luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars); + luaK_fixline(fs, line); + endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP); + } + luaK_patchlist(fs, endfor, prep + 1); + luaK_fixline(fs, line); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)"); + new_localvarliteral(ls, "(for limit)"); + new_localvarliteral(ls, "(for step)"); + new_localvar(ls, varname); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codek(fs, fs->freereg, luaK_intK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 4; /* gen, state, control, plus at least one declared var */ + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)"); + new_localvarliteral(ls, "(for state)"); + new_localvarliteral(ls, "(for control)"); + /* create declared variables */ + new_localvar(ls, indexname); + while (testnext(ls, ',')) { + new_localvar(ls, str_checkname(ls)); + nvars++; + } + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip 'for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, "'=' or 'in' expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope ('break' jumps to this point) */ +} + + +static void test_then_block (LexState *ls, int *escapelist) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + BlockCnt bl; + FuncState *fs = ls->fs; + expdesc v; + int jf; /* instruction to skip 'then' code (if condition is false) */ + luaX_next(ls); /* skip IF or ELSEIF */ + expr(ls, &v); /* read condition */ + checknext(ls, TK_THEN); + if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) { + luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */ + enterblock(fs, &bl, 0); /* must enter block before 'goto' */ + gotostat(ls, v.t); /* handle goto/break */ + while (testnext(ls, ';')) {} /* skip colons */ + if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ + leaveblock(fs); + return; /* and that is it */ + } + else /* must skip over 'then' part if condition is false */ + jf = luaK_jump(fs); + } + else { /* regular case (not goto/break) */ + luaK_goiftrue(ls->fs, &v); /* skip over block if condition is false */ + enterblock(fs, &bl, 0); + jf = v.f; + } + statlist(ls); /* 'then' part */ + leaveblock(fs); + if (ls->t.token == TK_ELSE || + ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ + luaK_concat(fs, escapelist, luaK_jump(fs)); /* must jump over it */ + luaK_patchtohere(fs, jf); +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int escapelist = NO_JUMP; /* exit list for finished parts */ + test_then_block(ls, &escapelist); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) + test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ + if (testnext(ls, TK_ELSE)) + block(ls); /* 'else' part */ + check_match(ls, TK_END, TK_IF, line); + luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ +} + + +static void localfunc (LexState *ls) { + expdesc b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls)); /* new local variable */ + adjustlocalvars(ls, 1); /* enter its scope */ + body(ls, &b, 0, ls->linenumber); /* function created in next register */ + /* debug information will only see the variable after this point! */ + getlocvar(fs, b.u.info)->startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {',' NAME} ['=' explist] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls)); + nvars++; + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {fieldsel} [':' NAME] */ + int ismethod = 0; + singlevar(ls, v); + while (ls->t.token == '.') + fieldsel(ls, v); + if (ls->t.token == ':') { + ismethod = 1; + fieldsel(ls, v); + } + return ismethod; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int ismethod; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + ismethod = funcname(ls, &v); + body(ls, &b, ismethod, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + suffixedexp(ls, &v.v); + if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */ + v.prev = NULL; + assignment(ls, &v, 1); + } + else { /* stat -> func */ + check_condition(ls, v.v.k == VCALL, "syntax error"); + SETARG_C(getinstruction(fs, &v.v), 1); /* call statement uses no results */ + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN [explist] [';'] */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + if (block_follow(ls, 1) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getinstruction(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getinstruction(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the stack */ + first = fs->nactvar; /* return all active values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); + testnext(ls, ';'); /* skip optional semicolon */ +} + + +static void statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + enterlevel(ls); + switch (ls->t.token) { + case ';': { /* stat -> ';' (empty statement) */ + luaX_next(ls); /* skip ';' */ + break; + } + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + break; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + break; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + break; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + break; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + break; + } + case TK_FUNCTION: { /* stat -> funcstat */ + funcstat(ls, line); + break; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + break; + } + case TK_DBCOLON: { /* stat -> label */ + luaX_next(ls); /* skip double colon */ + labelstat(ls, str_checkname(ls), line); + break; + } + case TK_RETURN: { /* stat -> retstat */ + luaX_next(ls); /* skip RETURN */ + retstat(ls); + break; + } + case TK_BREAK: /* stat -> breakstat */ + case TK_GOTO: { /* stat -> 'goto' NAME */ + gotostat(ls, luaK_jump(ls->fs)); + break; + } + default: { /* stat -> func | assignment */ + exprstat(ls); + break; + } + } + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + leavelevel(ls); +} + +/* }====================================================================== */ + + +/* +** compiles the main function, which is a regular vararg function with an +** upvalue named LUA_ENV +*/ +static void mainfunc (LexState *ls, FuncState *fs) { + BlockCnt bl; + expdesc v; + open_func(ls, fs, &bl); + fs->f->is_vararg = 1; /* main function is always declared vararg */ + init_exp(&v, VLOCAL, 0); /* create and... */ + newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ + luaX_next(ls); /* read first token */ + statlist(ls); /* parse main body */ + check(ls, TK_EOS); + close_func(ls); +} + + +LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + Dyndata *dyd, const char *name, int firstchar) { + LexState lexstate; + FuncState funcstate; + LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ + setclLvalue(L, L->top, cl); /* anchor it (to avoid being collected) */ + luaD_inctop(L); + lexstate.h = luaH_new(L); /* create table for scanner */ + sethvalue(L, L->top, lexstate.h); /* anchor it */ + luaD_inctop(L); + funcstate.f = cl->p = luaF_newproto(L); + funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ + lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ + lexstate.buff = buff; + lexstate.dyd = dyd; + dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; + luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar); + mainfunc(&lexstate, &funcstate); + lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); + /* all scopes should be correctly finished */ + lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); + L->top--; /* remove scanner's table */ + return cl; /* closure is on the stack, too */ +} + diff --git a/deps/lua/src/lparser.h b/deps/lua/src/lparser.h new file mode 100644 index 0000000000..f45b23cba5 --- /dev/null +++ b/deps/lua/src/lparser.h @@ -0,0 +1,133 @@ +/* +** $Id: lparser.h,v 1.76.1.1 2017/04/19 17:20:42 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression and variable descriptor. +** Code generation for variables and expressions can be delayed to allow +** optimizations; An 'expdesc' structure describes a potentially-delayed +** variable/expression. It has a description of its "main" value plus a +** list of conditional jumps that can also produce its value (generated +** by short-circuit operators 'and'/'or'). +*/ + +/* kinds of variables/expressions */ +typedef enum { + VVOID, /* when 'expdesc' describes the last expression a list, + this kind means an empty list (so, no expression) */ + VNIL, /* constant nil */ + VTRUE, /* constant true */ + VFALSE, /* constant false */ + VK, /* constant in 'k'; info = index of constant in 'k' */ + VKFLT, /* floating constant; nval = numerical float value */ + VKINT, /* integer constant; nval = numerical integer value */ + VNONRELOC, /* expression has its value in a fixed register; + info = result register */ + VLOCAL, /* local variable; info = local register */ + VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ + VINDEXED, /* indexed variable; + ind.vt = whether 't' is register or upvalue; + ind.t = table register or upvalue; + ind.idx = key's R/K index */ + VJMP, /* expression is a test/comparison; + info = pc of corresponding jump instruction */ + VRELOCABLE, /* expression can put result in any register; + info = instruction pc */ + VCALL, /* expression is a function call; info = instruction pc */ + VVARARG /* vararg expression; info = instruction pc */ +} expkind; + + +#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) +#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) + +typedef struct expdesc { + expkind k; + union { + lua_Integer ival; /* for VKINT */ + lua_Number nval; /* for VKFLT */ + int info; /* for generic use */ + struct { /* for indexed variables (VINDEXED) */ + short idx; /* index (R/K) */ + lu_byte t; /* table (register or upvalue) */ + lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ + } ind; + } u; + int t; /* patch list of 'exit when true' */ + int f; /* patch list of 'exit when false' */ +} expdesc; + + +/* description of active local variable */ +typedef struct Vardesc { + short idx; /* variable index in stack */ +} Vardesc; + + +/* description of pending goto statements and label statements */ +typedef struct Labeldesc { + TString *name; /* label identifier */ + int pc; /* position in code */ + int line; /* line where it appeared */ + lu_byte nactvar; /* local level where it appears in current block */ +} Labeldesc; + + +/* list of labels or gotos */ +typedef struct Labellist { + Labeldesc *arr; /* array */ + int n; /* number of entries in use */ + int size; /* array size */ +} Labellist; + + +/* dynamic structures used by the parser */ +typedef struct Dyndata { + struct { /* list of active local variables */ + Vardesc *arr; + int n; + int size; + } actvar; + Labellist gt; /* list of pending gotos */ + Labellist label; /* list of active labels */ +} Dyndata; + + +/* control of blocks */ +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to 'ncode') */ + int lasttarget; /* 'label' of last 'jump label' */ + int jpc; /* list of pending jumps to 'pc' */ + int nk; /* number of elements in 'k' */ + int np; /* number of elements in 'p' */ + int firstlocal; /* index of first local var (in Dyndata array) */ + short nlocvars; /* number of elements in 'f->locvars' */ + lu_byte nactvar; /* number of active local variables */ + lu_byte nups; /* number of upvalues */ + lu_byte freereg; /* first free register */ +} FuncState; + + +LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + Dyndata *dyd, const char *name, int firstchar); + + +#endif diff --git a/deps/lua/src/lprefix.h b/deps/lua/src/lprefix.h new file mode 100644 index 0000000000..9a749a3f30 --- /dev/null +++ b/deps/lua/src/lprefix.h @@ -0,0 +1,45 @@ +/* +** $Id: lprefix.h,v 1.2.1.1 2017/04/19 17:20:42 roberto Exp $ +** Definitions for Lua code that must come before any other header file +** See Copyright Notice in lua.h +*/ + +#ifndef lprefix_h +#define lprefix_h + + +/* +** Allows POSIX/XSI stuff +*/ +#if !defined(LUA_USE_C89) /* { */ + +#if !defined(_XOPEN_SOURCE) +#define _XOPEN_SOURCE 600 +#elif _XOPEN_SOURCE == 0 +#undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ +#endif + +/* +** Allows manipulation of large files in gcc and some other compilers +*/ +#if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) +#define _LARGEFILE_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#endif + +#endif /* } */ + + +/* +** Windows stuff +*/ +#if defined(_WIN32) /* { */ + +#if !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ +#endif + +#endif /* } */ + +#endif + diff --git a/deps/lua/src/lstate.c b/deps/lua/src/lstate.c new file mode 100644 index 0000000000..c1a76643c3 --- /dev/null +++ b/deps/lua/src/lstate.c @@ -0,0 +1,347 @@ +/* +** $Id: lstate.c,v 2.133.1.1 2017/04/19 17:39:34 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#define lstate_c +#define LUA_CORE + +#include "lprefix.h" + + +#include +#include + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#if !defined(LUAI_GCPAUSE) +#define LUAI_GCPAUSE 200 /* 200% */ +#endif + +#if !defined(LUAI_GCMUL) +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ +#endif + + +/* +** a macro to help the creation of a unique random seed when a state is +** created; the seed is used to randomize hashes. +*/ +#if !defined(luai_makeseed) +#include +#define luai_makeseed() cast(unsigned int, time(NULL)) +#endif + + + +/* +** thread state + extra space +*/ +typedef struct LX { + lu_byte extra_[LUA_EXTRASPACE]; + lua_State l; +} LX; + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + LX l; + global_State g; +} LG; + + + +#define fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) + + +/* +** Compute an initial seed as random as possible. Rely on Address Space +** Layout Randomization (if present) to increase randomness.. +*/ +#define addbuff(b,p,e) \ + { size_t t = cast(size_t, e); \ + memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } + +static unsigned int makeseed (lua_State *L) { + char buff[4 * sizeof(size_t)]; + unsigned int h = luai_makeseed(); + int p = 0; + addbuff(buff, p, L); /* heap variable */ + addbuff(buff, p, &h); /* local variable */ + addbuff(buff, p, luaO_nilobject); /* global variable */ + addbuff(buff, p, &lua_newstate); /* public function */ + lua_assert(p == sizeof(buff)); + return luaS_hash(buff, p, h); +} + + +/* +** set GCdebt to a new value keeping the value (totalbytes + GCdebt) +** invariant (and avoiding underflows in 'totalbytes') +*/ +void luaE_setdebt (global_State *g, l_mem debt) { + l_mem tb = gettotalbytes(g); + lua_assert(tb > 0); + if (debt < tb - MAX_LMEM) + debt = tb - MAX_LMEM; /* will make 'totalbytes == MAX_LMEM' */ + g->totalbytes = tb - debt; + g->GCdebt = debt; +} + + +CallInfo *luaE_extendCI (lua_State *L) { + CallInfo *ci = luaM_new(L, CallInfo); + lua_assert(L->ci->next == NULL); + L->ci->next = ci; + ci->previous = L->ci; + ci->next = NULL; + L->nci++; + return ci; +} + + +/* +** free all CallInfo structures not in use by a thread +*/ +void luaE_freeCI (lua_State *L) { + CallInfo *ci = L->ci; + CallInfo *next = ci->next; + ci->next = NULL; + while ((ci = next) != NULL) { + next = ci->next; + luaM_free(L, ci); + L->nci--; + } +} + + +/* +** free half of the CallInfo structures not in use by a thread +*/ +void luaE_shrinkCI (lua_State *L) { + CallInfo *ci = L->ci; + CallInfo *next2; /* next's next */ + /* while there are two nexts */ + while (ci->next != NULL && (next2 = ci->next->next) != NULL) { + luaM_free(L, ci->next); /* free next */ + L->nci--; + ci->next = next2; /* remove 'next' from the list */ + next2->previous = ci; + ci = next2; /* keep next's next */ + } +} + + +static void stack_init (lua_State *L1, lua_State *L) { + int i; CallInfo *ci; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue); + L1->stacksize = BASIC_STACK_SIZE; + for (i = 0; i < BASIC_STACK_SIZE; i++) + setnilvalue(L1->stack + i); /* erase new stack */ + L1->top = L1->stack; + L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK; + /* initialize first ci */ + ci = &L1->base_ci; + ci->next = ci->previous = NULL; + ci->callstatus = 0; + ci->func = L1->top; + setnilvalue(L1->top++); /* 'function' entry for this 'ci' */ + ci->top = L1->top + LUA_MINSTACK; + L1->ci = ci; +} + + +static void freestack (lua_State *L) { + if (L->stack == NULL) + return; /* stack not completely built yet */ + L->ci = &L->base_ci; /* free the entire 'ci' list */ + luaE_freeCI(L); + lua_assert(L->nci == 0); + luaM_freearray(L, L->stack, L->stacksize); /* free stack array */ +} + + +/* +** Create registry table and its predefined values +*/ +static void init_registry (lua_State *L, global_State *g) { + TValue temp; + /* create registry */ + Table *registry = luaH_new(L); + sethvalue(L, &g->l_registry, registry); + luaH_resize(L, registry, LUA_RIDX_LAST, 0); + /* registry[LUA_RIDX_MAINTHREAD] = L */ + setthvalue(L, &temp, L); /* temp = L */ + luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); + /* registry[LUA_RIDX_GLOBALS] = table of globals */ + sethvalue(L, &temp, luaH_new(L)); /* temp = new table (global table) */ + luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp); +} + + +/* +** open parts of the state that may cause memory-allocation errors. +** ('g->version' != NULL flags that the state was completely build) +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + init_registry(L, g); + luaS_init(L); + luaT_init(L); + luaX_init(L); + g->gcrunning = 1; /* allow gc */ + g->version = lua_version(NULL); + luai_userstateopen(L); +} + + +/* +** preinitialize a thread with consistent values without allocating +** any memory (to avoid errors) +*/ +static void preinit_thread (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->ci = NULL; + L->nci = 0; + L->stacksize = 0; + L->twups = L; /* thread has no upvalues */ + L->errorJmp = NULL; + L->nCcalls = 0; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->nny = 1; + L->status = LUA_OK; + L->errfunc = 0; +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeallobjects(L); /* collect all objects */ + if (g->version) /* closing a fully built state? */ + luai_userstateclose(L); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); + freestack(L); + lua_assert(gettotalbytes(g) == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + global_State *g = G(L); + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + /* create new thread */ + L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; + L1->marked = luaC_white(g); + L1->tt = LUA_TTHREAD; + /* link it on list 'allgc' */ + L1->next = g->allgc; + g->allgc = obj2gco(L1); + /* anchor it on L stack */ + setthvalue(L, L->top, L1); + api_incr_top(L); + preinit_thread(L1, g); + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + /* initialize L1 extra space */ + memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread), + LUA_EXTRASPACE); + luai_userstatethread(L, L1); + stack_init(L1, L); /* init stack */ + lua_unlock(L); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + LX *l = fromstate(L1); + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L, L1); + freestack(L1); + luaM_free(L, l); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG))); + if (l == NULL) return NULL; + L = &l->l.l; + g = &l->g; + L->next = NULL; + L->tt = LUA_TTHREAD; + g->currentwhite = bitmask(WHITE0BIT); + L->marked = luaC_white(g); + preinit_thread(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->seed = makeseed(L); + g->gcrunning = 0; /* no GC while building state */ + g->GCestimate = 0; + g->strt.size = g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(&g->l_registry); + g->panic = NULL; + g->version = NULL; + g->gcstate = GCSpause; + g->gckind = KGC_NORMAL; + g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; + g->sweepgc = NULL; + g->gray = g->grayagain = NULL; + g->weak = g->ephemeron = g->allweak = NULL; + g->twups = NULL; + g->totalbytes = sizeof(LG); + g->GCdebt = 0; + g->gcfinnum = 0; + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + return L; +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + close_state(L); +} + + diff --git a/deps/lua/src/lstate.h b/deps/lua/src/lstate.h new file mode 100644 index 0000000000..56b3741000 --- /dev/null +++ b/deps/lua/src/lstate.h @@ -0,0 +1,253 @@ +/* +** $Id: lstate.h,v 2.133.1.1 2017/04/19 17:39:34 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + +/* + +** Some notes about garbage-collected objects: All objects in Lua must +** be kept somehow accessible until being freed, so all objects always +** belong to one (and only one) of these lists, using field 'next' of +** the 'CommonHeader' for the link: +** +** 'allgc': all objects not marked for finalization; +** 'finobj': all objects marked for finalization; +** 'tobefnz': all objects ready to be finalized; +** 'fixedgc': all objects that are not to be collected (currently +** only small strings, such as reserved words). +** +** Moreover, there is another set of lists that control gray objects. +** These lists are linked by fields 'gclist'. (All objects that +** can become gray have such a field. The field is not the same +** in all objects, but it always has this name.) Any gray object +** must belong to one of these lists, and all objects in these lists +** must be gray: +** +** 'gray': regular gray objects, still waiting to be visited. +** 'grayagain': objects that must be revisited at the atomic phase. +** That includes +** - black objects got in a write barrier; +** - all kinds of weak tables during propagation phase; +** - all threads. +** 'weak': tables with weak values to be cleared; +** 'ephemeron': ephemeron tables with white->white entries; +** 'allweak': tables with weak keys and/or weak values to be cleared. +** The last three lists are used only during the atomic phase. + +*/ + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* +** Atomic type (relative to signals) to better ensure that 'lua_sethook' +** is thread safe +*/ +#if !defined(l_signalT) +#include +#define l_signalT sig_atomic_t +#endif + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRA_STACK 5 + + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + +/* kinds of Garbage Collection */ +#define KGC_NORMAL 0 +#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ + + +typedef struct stringtable { + TString **hash; + int nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** Information about a call. +** When a thread yields, 'func' is adjusted to pretend that the +** top function has only the yielded values in its stack; in that +** case, the actual 'func' value is saved in field 'extra'. +** When a function calls another with a continuation, 'extra' keeps +** the function index so that, in case of errors, the continuation +** function can be called with the correct top. +*/ +typedef struct CallInfo { + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + struct CallInfo *previous, *next; /* dynamic call link */ + union { + struct { /* only for Lua functions */ + StkId base; /* base for this function */ + const Instruction *savedpc; + } l; + struct { /* only for C functions */ + lua_KFunction k; /* continuation in case of yields */ + ptrdiff_t old_errfunc; + lua_KContext ctx; /* context info. in case of yields */ + } c; + } u; + ptrdiff_t extra; + short nresults; /* expected number of results from this function */ + unsigned short callstatus; +} CallInfo; + + +/* +** Bits in CallInfo status +*/ +#define CIST_OAH (1<<0) /* original value of 'allowhook' */ +#define CIST_LUA (1<<1) /* call is running a Lua function */ +#define CIST_HOOKED (1<<2) /* call is running a debug hook */ +#define CIST_FRESH (1<<3) /* call is running on a fresh invocation + of luaV_execute */ +#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ +#define CIST_TAIL (1<<5) /* call was tail called */ +#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ +#define CIST_LEQ (1<<7) /* using __lt for __le */ +#define CIST_FIN (1<<8) /* call is running a finalizer */ + +#define isLua(ci) ((ci)->callstatus & CIST_LUA) + +/* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ +#define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) +#define getoah(st) ((st) & CIST_OAH) + + +/* +** 'global state', shared by all threads of this state +*/ +typedef struct global_State { + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to 'frealloc' */ + l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ + l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ + lu_mem GCmemtrav; /* memory traversed by the GC */ + lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ + stringtable strt; /* hash table for strings */ + TValue l_registry; + unsigned int seed; /* randomized seed for hashes */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + lu_byte gckind; /* kind of GC running */ + lu_byte gcrunning; /* true if GC is running */ + GCObject *allgc; /* list of all collectable objects */ + GCObject **sweepgc; /* current position of sweep in list */ + GCObject *finobj; /* list of collectable objects with finalizers */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of tables with weak values */ + GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ + GCObject *allweak; /* list of all-weak tables */ + GCObject *tobefnz; /* list of userdata to be GC */ + GCObject *fixedgc; /* list of objects not to be collected */ + struct lua_State *twups; /* list of threads with open upvalues */ + unsigned int gcfinnum; /* number of finalizers to call in each GC step */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC 'granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + struct lua_State *mainthread; + const lua_Number *version; /* pointer to version number */ + TString *memerrmsg; /* memory-error message */ + TString *tmname[TM_N]; /* array with tag-method names */ + struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ + TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ +} global_State; + + +/* +** 'per thread' state +*/ +struct lua_State { + CommonHeader; + unsigned short nci; /* number of items in 'ci' list */ + lu_byte status; + StkId top; /* first free slot in the stack */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *oldpc; /* last pc traced */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + UpVal *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_State *twups; /* list of threads with open upvalues */ + struct lua_longjmp *errorJmp; /* current error recover point */ + CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ + volatile lua_Hook hook; + ptrdiff_t errfunc; /* current error handling function (stack index) */ + int stacksize; + int basehookcount; + int hookcount; + unsigned short nny; /* number of non-yieldable calls in stack */ + unsigned short nCcalls; /* number of nested C calls */ + l_signalT hookmask; + lu_byte allowhook; +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects (only for conversions) +*/ +union GCUnion { + GCObject gc; /* common header */ + struct TString ts; + struct Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct lua_State th; /* thread */ +}; + + +#define cast_u(o) cast(union GCUnion *, (o)) + +/* macros to convert a GCObject into a specific value */ +#define gco2ts(o) \ + check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) +#define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) +#define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) +#define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) +#define gco2cl(o) \ + check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) +#define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) +#define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) +#define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) + + +/* macro to convert a Lua object into a GCObject */ +#define obj2gco(v) \ + check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc))) + + +/* actual number of total bytes allocated */ +#define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt) + +LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); +LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); +LUAI_FUNC void luaE_freeCI (lua_State *L); +LUAI_FUNC void luaE_shrinkCI (lua_State *L); + + +#endif + diff --git a/deps/lua/src/lstring.c b/deps/lua/src/lstring.c new file mode 100644 index 0000000000..6257f211d9 --- /dev/null +++ b/deps/lua/src/lstring.c @@ -0,0 +1,248 @@ +/* +** $Id: lstring.c,v 2.56.1.1 2017/04/19 17:20:42 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#define lstring_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + +#define MEMERRMSG "not enough memory" + + +/* +** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to +** compute its hash +*/ +#if !defined(LUAI_HASHLIMIT) +#define LUAI_HASHLIMIT 5 +#endif + + +/* +** equality for long strings +*/ +int luaS_eqlngstr (TString *a, TString *b) { + size_t len = a->u.lnglen; + lua_assert(a->tt == LUA_TLNGSTR && b->tt == LUA_TLNGSTR); + return (a == b) || /* same instance or... */ + ((len == b->u.lnglen) && /* equal length and ... */ + (memcmp(getstr(a), getstr(b), len) == 0)); /* equal contents */ +} + + +unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { + unsigned int h = seed ^ cast(unsigned int, l); + size_t step = (l >> LUAI_HASHLIMIT) + 1; + for (; l >= step; l -= step) + h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); + return h; +} + + +unsigned int luaS_hashlongstr (TString *ts) { + lua_assert(ts->tt == LUA_TLNGSTR); + if (ts->extra == 0) { /* no hash? */ + ts->hash = luaS_hash(getstr(ts), ts->u.lnglen, ts->hash); + ts->extra = 1; /* now it has its hash */ + } + return ts->hash; +} + + +/* +** resizes the string table +*/ +void luaS_resize (lua_State *L, int newsize) { + int i; + stringtable *tb = &G(L)->strt; + if (newsize > tb->size) { /* grow table if needed */ + luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); + for (i = tb->size; i < newsize; i++) + tb->hash[i] = NULL; + } + for (i = 0; i < tb->size; i++) { /* rehash */ + TString *p = tb->hash[i]; + tb->hash[i] = NULL; + while (p) { /* for each node in the list */ + TString *hnext = p->u.hnext; /* save next */ + unsigned int h = lmod(p->hash, newsize); /* new position */ + p->u.hnext = tb->hash[h]; /* chain it */ + tb->hash[h] = p; + p = hnext; + } + } + if (newsize < tb->size) { /* shrink table if needed */ + /* vanishing slice should be empty */ + lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL); + luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); + } + tb->size = newsize; +} + + +/* +** Clear API string cache. (Entries cannot be empty, so fill them with +** a non-collectable string.) +*/ +void luaS_clearcache (global_State *g) { + int i, j; + for (i = 0; i < STRCACHE_N; i++) + for (j = 0; j < STRCACHE_M; j++) { + if (iswhite(g->strcache[i][j])) /* will entry be collected? */ + g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */ + } +} + + +/* +** Initialize the string table and the string cache +*/ +void luaS_init (lua_State *L) { + global_State *g = G(L); + int i, j; + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + /* pre-create memory-error message */ + g->memerrmsg = luaS_newliteral(L, MEMERRMSG); + luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */ + for (i = 0; i < STRCACHE_N; i++) /* fill cache with valid strings */ + for (j = 0; j < STRCACHE_M; j++) + g->strcache[i][j] = g->memerrmsg; +} + + + +/* +** creates a new string object +*/ +static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) { + TString *ts; + GCObject *o; + size_t totalsize; /* total size of TString object */ + totalsize = sizelstring(l); + o = luaC_newobj(L, tag, totalsize); + ts = gco2ts(o); + ts->hash = h; + ts->extra = 0; + getstr(ts)[l] = '\0'; /* ending 0 */ + return ts; +} + + +TString *luaS_createlngstrobj (lua_State *L, size_t l) { + TString *ts = createstrobj(L, l, LUA_TLNGSTR, G(L)->seed); + ts->u.lnglen = l; + return ts; +} + + +void luaS_remove (lua_State *L, TString *ts) { + stringtable *tb = &G(L)->strt; + TString **p = &tb->hash[lmod(ts->hash, tb->size)]; + while (*p != ts) /* find previous element */ + p = &(*p)->u.hnext; + *p = (*p)->u.hnext; /* remove element from its list */ + tb->nuse--; +} + + +/* +** checks whether short string exists and reuses it or creates a new one +*/ +static TString *internshrstr (lua_State *L, const char *str, size_t l) { + TString *ts; + global_State *g = G(L); + unsigned int h = luaS_hash(str, l, g->seed); + TString **list = &g->strt.hash[lmod(h, g->strt.size)]; + lua_assert(str != NULL); /* otherwise 'memcmp'/'memcpy' are undefined */ + for (ts = *list; ts != NULL; ts = ts->u.hnext) { + if (l == ts->shrlen && + (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { + /* found! */ + if (isdead(g, ts)) /* dead (but not collected yet)? */ + changewhite(ts); /* resurrect it */ + return ts; + } + } + if (g->strt.nuse >= g->strt.size && g->strt.size <= MAX_INT/2) { + luaS_resize(L, g->strt.size * 2); + list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ + } + ts = createstrobj(L, l, LUA_TSHRSTR, h); + memcpy(getstr(ts), str, l * sizeof(char)); + ts->shrlen = cast_byte(l); + ts->u.hnext = *list; + *list = ts; + g->strt.nuse++; + return ts; +} + + +/* +** new string (with explicit length) +*/ +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + if (l <= LUAI_MAXSHORTLEN) /* short string? */ + return internshrstr(L, str, l); + else { + TString *ts; + if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = luaS_createlngstrobj(L, l); + memcpy(getstr(ts), str, l * sizeof(char)); + return ts; + } +} + + +/* +** Create or reuse a zero-terminated string, first checking in the +** cache (using the string address as a key). The cache can contain +** only zero-terminated strings, so it is safe to use 'strcmp' to +** check hits. +*/ +TString *luaS_new (lua_State *L, const char *str) { + unsigned int i = point2uint(str) % STRCACHE_N; /* hash */ + int j; + TString **p = G(L)->strcache[i]; + for (j = 0; j < STRCACHE_M; j++) { + if (strcmp(str, getstr(p[j])) == 0) /* hit? */ + return p[j]; /* that is it */ + } + /* normal route */ + for (j = STRCACHE_M - 1; j > 0; j--) + p[j] = p[j - 1]; /* move out last element */ + /* new element is first in the list */ + p[0] = luaS_newlstr(L, str, strlen(str)); + return p[0]; +} + + +Udata *luaS_newudata (lua_State *L, size_t s) { + Udata *u; + GCObject *o; + if (s > MAX_SIZE - sizeof(Udata)) + luaM_toobig(L); + o = luaC_newobj(L, LUA_TUSERDATA, sizeludata(s)); + u = gco2u(o); + u->len = s; + u->metatable = NULL; + setuservalue(L, u, luaO_nilobject); + return u; +} + diff --git a/deps/lua/src/lstring.h b/deps/lua/src/lstring.h new file mode 100644 index 0000000000..d612abd333 --- /dev/null +++ b/deps/lua/src/lstring.h @@ -0,0 +1,49 @@ +/* +** $Id: lstring.h,v 1.61.1.1 2017/04/19 17:20:42 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) + +#define sizeludata(l) (sizeof(union UUdata) + (l)) +#define sizeudata(u) sizeludata((u)->len) + +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + + +/* +** test whether a string is a reserved word +*/ +#define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) + + +/* +** equality for short strings, which are always internalized +*/ +#define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) + + +LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); +LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); +LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC void luaS_clearcache (global_State *g); +LUAI_FUNC void luaS_init (lua_State *L); +LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); +LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); +LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); + + +#endif diff --git a/deps/lua/src/lstrlib.c b/deps/lua/src/lstrlib.c new file mode 100644 index 0000000000..b4bed7e93d --- /dev/null +++ b/deps/lua/src/lstrlib.c @@ -0,0 +1,1584 @@ +/* +** $Id: lstrlib.c,v 1.254.1.1 2017/04/19 17:29:57 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + +#define lstrlib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** maximum number of captures that a pattern can do during +** pattern-matching. This limit is arbitrary, but must fit in +** an unsigned char. +*/ +#if !defined(LUA_MAXCAPTURES) +#define LUA_MAXCAPTURES 32 +#endif + + +/* macro to 'unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + +/* +** Some sizes are better limited to fit in 'int', but must also fit in +** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) +*/ +#define MAX_SIZET ((size_t)(~(size_t)0)) + +#define MAXSIZE \ + (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) + + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, (lua_Integer)l); + return 1; +} + + +/* translate a relative string position: negative means back from end */ +static lua_Integer posrelat (lua_Integer pos, size_t len) { + if (pos >= 0) return pos; + else if (0u - (size_t)pos > len) return 0; + else return (lua_Integer)len + pos + 1; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + lua_Integer start = posrelat(luaL_checkinteger(L, 2), l); + lua_Integer end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (lua_Integer)l) end = l; + if (start <= end) + lua_pushlstring(L, s + start - 1, (size_t)(end - start) + 1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l, i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + char *p = luaL_buffinitsize(L, &b, l); + for (i = 0; i < l; i++) + p[i] = s[l - i - 1]; + luaL_pushresultsize(&b, l); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + char *p = luaL_buffinitsize(L, &b, l); + for (i=0; i MAXSIZE / n) /* may overflow? */ + return luaL_error(L, "resulting string too large"); + else { + size_t totallen = (size_t)n * l + (size_t)(n - 1) * lsep; + luaL_Buffer b; + char *p = luaL_buffinitsize(L, &b, totallen); + while (n-- > 1) { /* first n-1 copies (followed by separator) */ + memcpy(p, s, l * sizeof(char)); p += l; + if (lsep > 0) { /* empty 'memcpy' is not that cheap */ + memcpy(p, sep, lsep * sizeof(char)); + p += lsep; + } + } + memcpy(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ + luaL_pushresultsize(&b, totallen); + } + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + lua_Integer posi = posrelat(luaL_optinteger(L, 2, 1), l); + lua_Integer pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi < 1) posi = 1; + if (pose > (lua_Integer)l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + if (pose - posi >= INT_MAX) /* arithmetic overflow? */ + return luaL_error(L, "string slice too long"); + n = (int)(pose - posi) + 1; + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index %%%d", l + 1); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (p == ms->p_end) + luaL_error(ms->L, "malformed pattern (ends with '%%')"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a ']' */ + if (p == ms->p_end) + luaL_error(ms->L, "malformed pattern (missing ']')"); + if (*(p++) == L_ESC && p < ms->p_end) + p++; /* skip escapes (e.g. '%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'g' : res = isgraph(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; /* deprecated option */ + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the '^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (MatchState *ms, const char *s, const char *p, + const char *ep) { + if (s >= ms->src_end) + return 0; + else { + int c = uchar(*s); + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } + } +} + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (p >= ms->p_end - 1) + luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while (singlematch(ms, s + i, p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (singlematch(ms, s, p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + if (ms->matchdepth-- == 0) + luaL_error(ms->L, "pattern too complex"); + init: /* using goto's to optimize tail recursion */ + if (p != ms->p_end) { /* end of pattern? */ + switch (*p) { + case '(': { /* start capture */ + if (*(p + 1) == ')') /* position capture? */ + s = start_capture(ms, s, p + 2, CAP_POSITION); + else + s = start_capture(ms, s, p + 1, CAP_UNFINISHED); + break; + } + case ')': { /* end capture */ + s = end_capture(ms, s, p + 1); + break; + } + case '$': { + if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */ + goto dflt; /* no; go to default */ + s = (s == ms->src_end) ? s : NULL; /* check end of string */ + break; + } + case L_ESC: { /* escaped sequences not in the format class[*+?-]? */ + switch (*(p + 1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p + 2); + if (s != NULL) { + p += 4; goto init; /* return match(ms, s, p + 4); */ + } /* else fail (s == NULL) */ + break; + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing '[' after '%%f' in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s - 1); + if (!matchbracketclass(uchar(previous), p, ep - 1) && + matchbracketclass(uchar(*s), p, ep - 1)) { + p = ep; goto init; /* return match(ms, s, ep); */ + } + s = NULL; /* match failed */ + break; + } + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p + 1))); + if (s != NULL) { + p += 2; goto init; /* return match(ms, s, p + 2) */ + } + break; + } + default: goto dflt; + } + break; + } + default: dflt: { /* pattern class plus optional suffix */ + const char *ep = classend(ms, p); /* points to optional suffix */ + /* does not match at least once? */ + if (!singlematch(ms, s, p, ep)) { + if (*ep == '*' || *ep == '?' || *ep == '-') { /* accept empty? */ + p = ep + 1; goto init; /* return match(ms, s, ep + 1); */ + } + else /* '+' or no suffix */ + s = NULL; /* fail */ + } + else { /* matched once */ + switch (*ep) { /* handle optional suffix */ + case '?': { /* optional */ + const char *res; + if ((res = match(ms, s + 1, ep + 1)) != NULL) + s = res; + else { + p = ep + 1; goto init; /* else return match(ms, s, ep + 1); */ + } + break; + } + case '+': /* 1 or more repetitions */ + s++; /* 1 match already done */ + /* FALLTHROUGH */ + case '*': /* 0 or more repetitions */ + s = max_expand(ms, s, p, ep); + break; + case '-': /* 0 or more repetitions (minimum) */ + s = min_expand(ms, s, p, ep); + break; + default: /* no suffix */ + s++; p = ep; goto init; /* return match(ms, s + 1, ep); */ + } + } + break; + } + } + } + ms->matchdepth++; + return s; +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative 'l1' */ + else { + const char *init; /* to search for a '*s2' inside 's1' */ + l2--; /* 1st char will be checked by 'memchr' */ + l1 = l1-l2; /* 's2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct 'l1' and 's1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index %%%d", i + 1); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +/* check whether pattern has no special characters */ +static int nospecials (const char *p, size_t l) { + size_t upto = 0; + do { + if (strpbrk(p + upto, SPECIALS)) + return 0; /* pattern has a special character */ + upto += strlen(p + upto) + 1; /* may have more after \0 */ + } while (upto <= l); + return 1; /* no special chars found */ +} + + +static void prepstate (MatchState *ms, lua_State *L, + const char *s, size_t ls, const char *p, size_t lp) { + ms->L = L; + ms->matchdepth = MAXCCALLS; + ms->src_init = s; + ms->src_end = s + ls; + ms->p_end = p + lp; +} + + +static void reprepstate (MatchState *ms) { + ms->level = 0; + lua_assert(ms->matchdepth == MAXCCALLS); +} + + +static int str_find_aux (lua_State *L, int find) { + size_t ls, lp; + const char *s = luaL_checklstring(L, 1, &ls); + const char *p = luaL_checklstring(L, 2, &lp); + lua_Integer init = posrelat(luaL_optinteger(L, 3, 1), ls); + if (init < 1) init = 1; + else if (init > (lua_Integer)ls + 1) { /* start after string's end? */ + lua_pushnil(L); /* cannot find anything */ + return 1; + } + /* explicit request or no special characters? */ + if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) { + /* do a plain search */ + const char *s2 = lmemfind(s + init - 1, ls - (size_t)init + 1, p, lp); + if (s2) { + lua_pushinteger(L, (s2 - s) + 1); + lua_pushinteger(L, (s2 - s) + lp); + return 2; + } + } + else { + MatchState ms; + const char *s1 = s + init - 1; + int anchor = (*p == '^'); + if (anchor) { + p++; lp--; /* skip anchor character */ + } + prepstate(&ms, L, s, ls, p, lp); + do { + const char *res; + reprepstate(&ms); + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, (s1 - s) + 1); /* start */ + lua_pushinteger(L, res - s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +/* state for 'gmatch' */ +typedef struct GMatchState { + const char *src; /* current position */ + const char *p; /* pattern */ + const char *lastmatch; /* end of last match */ + MatchState ms; /* match state */ +} GMatchState; + + +static int gmatch_aux (lua_State *L) { + GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); + const char *src; + gm->ms.L = L; + for (src = gm->src; src <= gm->ms.src_end; src++) { + const char *e; + reprepstate(&gm->ms); + if ((e = match(&gm->ms, src, gm->p)) != NULL && e != gm->lastmatch) { + gm->src = gm->lastmatch = e; + return push_captures(&gm->ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + size_t ls, lp; + const char *s = luaL_checklstring(L, 1, &ls); + const char *p = luaL_checklstring(L, 2, &lp); + GMatchState *gm; + lua_settop(L, 2); /* keep them on closure to avoid being collected */ + gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState)); + prepstate(&gm->ms, L, s, ls, p, lp); + gm->src = s; gm->p = p; gm->lastmatch = NULL; + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + lua_State *L = ms->L; + const char *news = lua_tolstring(L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) { + if (news[i] != L_ESC) + luaL_error(L, "invalid use of '%c' in replacement string", L_ESC); + luaL_addchar(b, news[i]); + } + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_tolstring(L, -1, NULL); /* if number, convert it to string */ + lua_remove(L, -2); /* remove original value */ + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e, int tr) { + lua_State *L = ms->L; + switch (tr) { + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + default: { /* LUA_TNUMBER or LUA_TSTRING */ + add_s(ms, b, s, e); + return; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl, lp; + const char *src = luaL_checklstring(L, 1, &srcl); /* subject */ + const char *p = luaL_checklstring(L, 2, &lp); /* pattern */ + const char *lastmatch = NULL; /* end of last match */ + int tr = lua_type(L, 3); /* replacement type */ + lua_Integer max_s = luaL_optinteger(L, 4, srcl + 1); /* max replacements */ + int anchor = (*p == '^'); + lua_Integer n = 0; /* replacement count */ + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + if (anchor) { + p++; lp--; /* skip anchor character */ + } + prepstate(&ms, L, src, srcl, p, lp); + while (n < max_s) { + const char *e; + reprepstate(&ms); /* (re)prepare state for new match */ + if ((e = match(&ms, src, p)) != NULL && e != lastmatch) { /* match? */ + n++; + add_value(&ms, &b, src, e, tr); /* add replacement to buffer */ + src = lastmatch = e; + } + else if (src < ms.src_end) /* otherwise, skip one character */ + luaL_addchar(&b, *src++); + else break; /* end of subject */ + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** STRING FORMAT +** ======================================================= +*/ + +#if !defined(lua_number2strx) /* { */ + +/* +** Hexadecimal floating-point formatter +*/ + +#include + +#define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) + + +/* +** Number of bits that goes into the first digit. It can be any value +** between 1 and 4; the following definition tries to align the number +** to nibble boundaries by making what is left after that first digit a +** multiple of 4. +*/ +#define L_NBFD ((l_mathlim(MANT_DIG) - 1)%4 + 1) + + +/* +** Add integer part of 'x' to buffer and return new 'x' +*/ +static lua_Number adddigit (char *buff, int n, lua_Number x) { + lua_Number dd = l_mathop(floor)(x); /* get integer part from 'x' */ + int d = (int)dd; + buff[n] = (d < 10 ? d + '0' : d - 10 + 'a'); /* add to buffer */ + return x - dd; /* return what is left */ +} + + +static int num2straux (char *buff, int sz, lua_Number x) { + /* if 'inf' or 'NaN', format it like '%g' */ + if (x != x || x == (lua_Number)HUGE_VAL || x == -(lua_Number)HUGE_VAL) + return l_sprintf(buff, sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)x); + else if (x == 0) { /* can be -0... */ + /* create "0" or "-0" followed by exponent */ + return l_sprintf(buff, sz, LUA_NUMBER_FMT "x0p+0", (LUAI_UACNUMBER)x); + } + else { + int e; + lua_Number m = l_mathop(frexp)(x, &e); /* 'x' fraction and exponent */ + int n = 0; /* character count */ + if (m < 0) { /* is number negative? */ + buff[n++] = '-'; /* add signal */ + m = -m; /* make it positive */ + } + buff[n++] = '0'; buff[n++] = 'x'; /* add "0x" */ + m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ + e -= L_NBFD; /* this digit goes before the radix point */ + if (m > 0) { /* more digits? */ + buff[n++] = lua_getlocaledecpoint(); /* add radix point */ + do { /* add as many digits as needed */ + m = adddigit(buff, n++, m * 16); + } while (m > 0); + } + n += l_sprintf(buff + n, sz - n, "p%+d", e); /* add exponent */ + lua_assert(n < sz); + return n; + } +} + + +static int lua_number2strx (lua_State *L, char *buff, int sz, + const char *fmt, lua_Number x) { + int n = num2straux(buff, sz, x); + if (fmt[SIZELENMOD] == 'A') { + int i; + for (i = 0; i < n; i++) + buff[i] = toupper(uchar(buff[i])); + } + else if (fmt[SIZELENMOD] != 'a') + return luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); + return n; +} + +#endif /* } */ + + +/* +** Maximum size of each formatted item. This maximum size is produced +** by format('%.99f', -maxfloat), and is equal to 99 + 3 ('-', '.', +** and '\0') + number of decimal digits to represent maxfloat (which +** is maximum exponent + 1). (99+3+1 then rounded to 120 for "extra +** expenses", such as locale-dependent stuff) +*/ +#define MAX_ITEM (120 + l_mathlim(MAX_10_EXP)) + + +/* valid flags in a format specification */ +#define FLAGS "-+ #0" + +/* +** maximum size of each format specification (such as "%-099.99d") +*/ +#define MAX_FORMAT 32 + + +static void addquoted (luaL_Buffer *b, const char *s, size_t len) { + luaL_addchar(b, '"'); + while (len--) { + if (*s == '"' || *s == '\\' || *s == '\n') { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + } + else if (iscntrl(uchar(*s))) { + char buff[10]; + if (!isdigit(uchar(*(s+1)))) + l_sprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s)); + else + l_sprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s)); + luaL_addstring(b, buff); + } + else + luaL_addchar(b, *s); + s++; + } + luaL_addchar(b, '"'); +} + + +/* +** Ensures the 'buff' string uses a dot as the radix character. +*/ +static void checkdp (char *buff, int nb) { + if (memchr(buff, '.', nb) == NULL) { /* no dot? */ + char point = lua_getlocaledecpoint(); /* try locale point */ + char *ppoint = (char *)memchr(buff, point, nb); + if (ppoint) *ppoint = '.'; /* change it to a dot */ + } +} + + +static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { + switch (lua_type(L, arg)) { + case LUA_TSTRING: { + size_t len; + const char *s = lua_tolstring(L, arg, &len); + addquoted(b, s, len); + break; + } + case LUA_TNUMBER: { + char *buff = luaL_prepbuffsize(b, MAX_ITEM); + int nb; + if (!lua_isinteger(L, arg)) { /* float? */ + lua_Number n = lua_tonumber(L, arg); /* write as hexa ('%a') */ + nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n); + checkdp(buff, nb); /* ensure it uses a dot */ + } + else { /* integers */ + lua_Integer n = lua_tointeger(L, arg); + const char *format = (n == LUA_MININTEGER) /* corner case? */ + ? "0x%" LUA_INTEGER_FRMLEN "x" /* use hexa */ + : LUA_INTEGER_FMT; /* else use default format */ + nb = l_sprintf(buff, MAX_ITEM, format, (LUAI_UACINT)n); + } + luaL_addsize(b, nb); + break; + } + case LUA_TNIL: case LUA_TBOOLEAN: { + luaL_tolstring(L, arg, NULL); + luaL_addvalue(b); + break; + } + default: { + luaL_argerror(L, arg, "value has no literal form"); + } + } +} + + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + memcpy(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char)); + form += (p - strfrmt) + 1; + *form = '\0'; + return p; +} + + +/* +** add length modifier into formats +*/ +static void addlenmod (char *form, const char *lenmod) { + size_t l = strlen(form); + size_t lm = strlen(lenmod); + char spec = form[l - 1]; + strcpy(form + l - 1, lenmod); + form[l + lm - 1] = spec; + form[l + lm] = '\0'; +} + + +static int str_format (lua_State *L) { + int top = lua_gettop(L); + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format ('%...') */ + char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ + int nb = 0; /* number of bytes in added item */ + if (++arg > top) + luaL_argerror(L, arg, "no value"); + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + nb = l_sprintf(buff, MAX_ITEM, form, (int)luaL_checkinteger(L, arg)); + break; + } + case 'd': case 'i': + case 'o': case 'u': case 'x': case 'X': { + lua_Integer n = luaL_checkinteger(L, arg); + addlenmod(form, LUA_INTEGER_FRMLEN); + nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACINT)n); + break; + } + case 'a': case 'A': + addlenmod(form, LUA_NUMBER_FRMLEN); + nb = lua_number2strx(L, buff, MAX_ITEM, form, + luaL_checknumber(L, arg)); + break; + case 'e': case 'E': case 'f': + case 'g': case 'G': { + lua_Number n = luaL_checknumber(L, arg); + addlenmod(form, LUA_NUMBER_FRMLEN); + nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACNUMBER)n); + break; + } + case 'q': { + addliteral(L, &b, arg); + break; + } + case 's': { + size_t l; + const char *s = luaL_tolstring(L, arg, &l); + if (form[2] == '\0') /* no modifiers? */ + luaL_addvalue(&b); /* keep entire string */ + else { + luaL_argcheck(L, l == strlen(s), arg, "string contains zeros"); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted */ + luaL_addvalue(&b); /* keep entire string */ + } + else { /* format the string into 'buff' */ + nb = l_sprintf(buff, MAX_ITEM, form, s); + lua_pop(L, 1); /* remove result from 'luaL_tolstring' */ + } + } + break; + } + default: { /* also treat cases 'pnLlh' */ + return luaL_error(L, "invalid option '%%%c' to 'format'", + *(strfrmt - 1)); + } + } + lua_assert(nb < MAX_ITEM); + luaL_addsize(&b, nb); + } + } + luaL_pushresult(&b); + return 1; +} + +/* }====================================================== */ + + +/* +** {====================================================== +** PACK/UNPACK +** ======================================================= +*/ + + +/* value used for padding */ +#if !defined(LUAL_PACKPADBYTE) +#define LUAL_PACKPADBYTE 0x00 +#endif + +/* maximum size for the binary representation of an integer */ +#define MAXINTSIZE 16 + +/* number of bits in a character */ +#define NB CHAR_BIT + +/* mask for one character (NB 1's) */ +#define MC ((1 << NB) - 1) + +/* size of a lua_Integer */ +#define SZINT ((int)sizeof(lua_Integer)) + + +/* dummy union to get native endianness */ +static const union { + int dummy; + char little; /* true iff machine is little endian */ +} nativeendian = {1}; + + +/* dummy structure to get native alignment requirements */ +struct cD { + char c; + union { double d; void *p; lua_Integer i; lua_Number n; } u; +}; + +#define MAXALIGN (offsetof(struct cD, u)) + + +/* +** Union for serializing floats +*/ +typedef union Ftypes { + float f; + double d; + lua_Number n; + char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ +} Ftypes; + + +/* +** information to pack/unpack stuff +*/ +typedef struct Header { + lua_State *L; + int islittle; + int maxalign; +} Header; + + +/* +** options for pack/unpack +*/ +typedef enum KOption { + Kint, /* signed integers */ + Kuint, /* unsigned integers */ + Kfloat, /* floating-point numbers */ + Kchar, /* fixed-length strings */ + Kstring, /* strings with prefixed length */ + Kzstr, /* zero-terminated strings */ + Kpadding, /* padding */ + Kpaddalign, /* padding for alignment */ + Knop /* no-op (configuration or spaces) */ +} KOption; + + +/* +** Read an integer numeral from string 'fmt' or return 'df' if +** there is no numeral +*/ +static int digit (int c) { return '0' <= c && c <= '9'; } + +static int getnum (const char **fmt, int df) { + if (!digit(**fmt)) /* no number? */ + return df; /* return default value */ + else { + int a = 0; + do { + a = a*10 + (*((*fmt)++) - '0'); + } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); + return a; + } +} + + +/* +** Read an integer numeral and raises an error if it is larger +** than the maximum size for integers. +*/ +static int getnumlimit (Header *h, const char **fmt, int df) { + int sz = getnum(fmt, df); + if (sz > MAXINTSIZE || sz <= 0) + return luaL_error(h->L, "integral size (%d) out of limits [1,%d]", + sz, MAXINTSIZE); + return sz; +} + + +/* +** Initialize Header +*/ +static void initheader (lua_State *L, Header *h) { + h->L = L; + h->islittle = nativeendian.little; + h->maxalign = 1; +} + + +/* +** Read and classify next option. 'size' is filled with option's size. +*/ +static KOption getoption (Header *h, const char **fmt, int *size) { + int opt = *((*fmt)++); + *size = 0; /* default */ + switch (opt) { + case 'b': *size = sizeof(char); return Kint; + case 'B': *size = sizeof(char); return Kuint; + case 'h': *size = sizeof(short); return Kint; + case 'H': *size = sizeof(short); return Kuint; + case 'l': *size = sizeof(long); return Kint; + case 'L': *size = sizeof(long); return Kuint; + case 'j': *size = sizeof(lua_Integer); return Kint; + case 'J': *size = sizeof(lua_Integer); return Kuint; + case 'T': *size = sizeof(size_t); return Kuint; + case 'f': *size = sizeof(float); return Kfloat; + case 'd': *size = sizeof(double); return Kfloat; + case 'n': *size = sizeof(lua_Number); return Kfloat; + case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; + case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; + case 's': *size = getnumlimit(h, fmt, sizeof(size_t)); return Kstring; + case 'c': + *size = getnum(fmt, -1); + if (*size == -1) + luaL_error(h->L, "missing size for format option 'c'"); + return Kchar; + case 'z': return Kzstr; + case 'x': *size = 1; return Kpadding; + case 'X': return Kpaddalign; + case ' ': break; + case '<': h->islittle = 1; break; + case '>': h->islittle = 0; break; + case '=': h->islittle = nativeendian.little; break; + case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; + default: luaL_error(h->L, "invalid format option '%c'", opt); + } + return Knop; +} + + +/* +** Read, classify, and fill other details about the next option. +** 'psize' is filled with option's size, 'notoalign' with its +** alignment requirements. +** Local variable 'size' gets the size to be aligned. (Kpadal option +** always gets its full alignment, other options are limited by +** the maximum alignment ('maxalign'). Kchar option needs no alignment +** despite its size. +*/ +static KOption getdetails (Header *h, size_t totalsize, + const char **fmt, int *psize, int *ntoalign) { + KOption opt = getoption(h, fmt, psize); + int align = *psize; /* usually, alignment follows size */ + if (opt == Kpaddalign) { /* 'X' gets alignment from following option */ + if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) + luaL_argerror(h->L, 1, "invalid next option for option 'X'"); + } + if (align <= 1 || opt == Kchar) /* need no alignment? */ + *ntoalign = 0; + else { + if (align > h->maxalign) /* enforce maximum alignment */ + align = h->maxalign; + if ((align & (align - 1)) != 0) /* is 'align' not a power of 2? */ + luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); + *ntoalign = (align - (int)(totalsize & (align - 1))) & (align - 1); + } + return opt; +} + + +/* +** Pack integer 'n' with 'size' bytes and 'islittle' endianness. +** The final 'if' handles the case when 'size' is larger than +** the size of a Lua integer, correcting the extra sign-extension +** bytes if necessary (by default they would be zeros). +*/ +static void packint (luaL_Buffer *b, lua_Unsigned n, + int islittle, int size, int neg) { + char *buff = luaL_prepbuffsize(b, size); + int i; + buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ + for (i = 1; i < size; i++) { + n >>= NB; + buff[islittle ? i : size - 1 - i] = (char)(n & MC); + } + if (neg && size > SZINT) { /* negative number need sign extension? */ + for (i = SZINT; i < size; i++) /* correct extra bytes */ + buff[islittle ? i : size - 1 - i] = (char)MC; + } + luaL_addsize(b, size); /* add result to buffer */ +} + + +/* +** Copy 'size' bytes from 'src' to 'dest', correcting endianness if +** given 'islittle' is different from native endianness. +*/ +static void copywithendian (volatile char *dest, volatile const char *src, + int size, int islittle) { + if (islittle == nativeendian.little) { + while (size-- != 0) + *(dest++) = *(src++); + } + else { + dest += size - 1; + while (size-- != 0) + *(dest--) = *(src++); + } +} + + +static int str_pack (lua_State *L) { + luaL_Buffer b; + Header h; + const char *fmt = luaL_checkstring(L, 1); /* format string */ + int arg = 1; /* current argument to pack */ + size_t totalsize = 0; /* accumulate total size of result */ + initheader(L, &h); + lua_pushnil(L); /* mark to separate arguments from string buffer */ + luaL_buffinit(L, &b); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); + totalsize += ntoalign + size; + while (ntoalign-- > 0) + luaL_addchar(&b, LUAL_PACKPADBYTE); /* fill alignment */ + arg++; + switch (opt) { + case Kint: { /* signed integers */ + lua_Integer n = luaL_checkinteger(L, arg); + if (size < SZINT) { /* need overflow check? */ + lua_Integer lim = (lua_Integer)1 << ((size * NB) - 1); + luaL_argcheck(L, -lim <= n && n < lim, arg, "integer overflow"); + } + packint(&b, (lua_Unsigned)n, h.islittle, size, (n < 0)); + break; + } + case Kuint: { /* unsigned integers */ + lua_Integer n = luaL_checkinteger(L, arg); + if (size < SZINT) /* need overflow check? */ + luaL_argcheck(L, (lua_Unsigned)n < ((lua_Unsigned)1 << (size * NB)), + arg, "unsigned overflow"); + packint(&b, (lua_Unsigned)n, h.islittle, size, 0); + break; + } + case Kfloat: { /* floating-point options */ + volatile Ftypes u; + char *buff = luaL_prepbuffsize(&b, size); + lua_Number n = luaL_checknumber(L, arg); /* get argument */ + if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ + else if (size == sizeof(u.d)) u.d = (double)n; + else u.n = n; + /* move 'u' to final result, correcting endianness if needed */ + copywithendian(buff, u.buff, size, h.islittle); + luaL_addsize(&b, size); + break; + } + case Kchar: { /* fixed-size string */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, len <= (size_t)size, arg, + "string longer than given size"); + luaL_addlstring(&b, s, len); /* add string */ + while (len++ < (size_t)size) /* pad extra space */ + luaL_addchar(&b, LUAL_PACKPADBYTE); + break; + } + case Kstring: { /* strings with length count */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, size >= (int)sizeof(size_t) || + len < ((size_t)1 << (size * NB)), + arg, "string length does not fit in given size"); + packint(&b, (lua_Unsigned)len, h.islittle, size, 0); /* pack length */ + luaL_addlstring(&b, s, len); + totalsize += len; + break; + } + case Kzstr: { /* zero-terminated string */ + size_t len; + const char *s = luaL_checklstring(L, arg, &len); + luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); + luaL_addlstring(&b, s, len); + luaL_addchar(&b, '\0'); /* add zero at the end */ + totalsize += len + 1; + break; + } + case Kpadding: luaL_addchar(&b, LUAL_PACKPADBYTE); /* FALLTHROUGH */ + case Kpaddalign: case Knop: + arg--; /* undo increment */ + break; + } + } + luaL_pushresult(&b); + return 1; +} + + +static int str_packsize (lua_State *L) { + Header h; + const char *fmt = luaL_checkstring(L, 1); /* format string */ + size_t totalsize = 0; /* accumulate total size of result */ + initheader(L, &h); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); + size += ntoalign; /* total space used by option */ + luaL_argcheck(L, totalsize <= MAXSIZE - size, 1, + "format result too large"); + totalsize += size; + switch (opt) { + case Kstring: /* strings with length count */ + case Kzstr: /* zero-terminated string */ + luaL_argerror(L, 1, "variable-length format"); + /* call never return, but to avoid warnings: *//* FALLTHROUGH */ + default: break; + } + } + lua_pushinteger(L, (lua_Integer)totalsize); + return 1; +} + + +/* +** Unpack an integer with 'size' bytes and 'islittle' endianness. +** If size is smaller than the size of a Lua integer and integer +** is signed, must do sign extension (propagating the sign to the +** higher bits); if size is larger than the size of a Lua integer, +** it must check the unread bytes to see whether they do not cause an +** overflow. +*/ +static lua_Integer unpackint (lua_State *L, const char *str, + int islittle, int size, int issigned) { + lua_Unsigned res = 0; + int i; + int limit = (size <= SZINT) ? size : SZINT; + for (i = limit - 1; i >= 0; i--) { + res <<= NB; + res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i]; + } + if (size < SZINT) { /* real size smaller than lua_Integer? */ + if (issigned) { /* needs sign extension? */ + lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1); + res = ((res ^ mask) - mask); /* do sign extension */ + } + } + else if (size > SZINT) { /* must check unread bytes */ + int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC; + for (i = limit; i < size; i++) { + if ((unsigned char)str[islittle ? i : size - 1 - i] != mask) + luaL_error(L, "%d-byte integer does not fit into Lua Integer", size); + } + } + return (lua_Integer)res; +} + + +static int str_unpack (lua_State *L) { + Header h; + const char *fmt = luaL_checkstring(L, 1); + size_t ld; + const char *data = luaL_checklstring(L, 2, &ld); + size_t pos = (size_t)posrelat(luaL_optinteger(L, 3, 1), ld) - 1; + int n = 0; /* number of results */ + luaL_argcheck(L, pos <= ld, 3, "initial position out of string"); + initheader(L, &h); + while (*fmt != '\0') { + int size, ntoalign; + KOption opt = getdetails(&h, pos, &fmt, &size, &ntoalign); + if ((size_t)ntoalign + size > ~pos || pos + ntoalign + size > ld) + luaL_argerror(L, 2, "data string too short"); + pos += ntoalign; /* skip alignment */ + /* stack space for item + next position */ + luaL_checkstack(L, 2, "too many results"); + n++; + switch (opt) { + case Kint: + case Kuint: { + lua_Integer res = unpackint(L, data + pos, h.islittle, size, + (opt == Kint)); + lua_pushinteger(L, res); + break; + } + case Kfloat: { + volatile Ftypes u; + lua_Number num; + copywithendian(u.buff, data + pos, size, h.islittle); + if (size == sizeof(u.f)) num = (lua_Number)u.f; + else if (size == sizeof(u.d)) num = (lua_Number)u.d; + else num = u.n; + lua_pushnumber(L, num); + break; + } + case Kchar: { + lua_pushlstring(L, data + pos, size); + break; + } + case Kstring: { + size_t len = (size_t)unpackint(L, data + pos, h.islittle, size, 0); + luaL_argcheck(L, pos + len + size <= ld, 2, "data string too short"); + lua_pushlstring(L, data + pos + size, len); + pos += len; /* skip string */ + break; + } + case Kzstr: { + size_t len = (int)strlen(data + pos); + lua_pushlstring(L, data + pos, len); + pos += len + 1; /* skip string plus final '\0' */ + break; + } + case Kpaddalign: case Kpadding: case Knop: + n--; /* undo increment */ + break; + } + pos += size; + } + lua_pushinteger(L, pos + 1); /* next position */ + return n + 1; +} + +/* }====================================================== */ + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {"pack", str_pack}, + {"packsize", str_packsize}, + {"unpack", str_unpack}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* table to be metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); /* copy table */ + lua_setmetatable(L, -2); /* set table as metatable for strings */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* get string library */ + lua_setfield(L, -2, "__index"); /* metatable.__index = string */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUAMOD_API int luaopen_string (lua_State *L) { + luaL_newlib(L, strlib); + createmetatable(L); + return 1; +} + diff --git a/deps/lua/src/ltable.c b/deps/lua/src/ltable.c new file mode 100644 index 0000000000..ea4fe7fcb3 --- /dev/null +++ b/deps/lua/src/ltable.c @@ -0,0 +1,688 @@ +/* +** $Id: ltable.c,v 2.118.1.4 2018/06/08 16:22:51 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#define ltable_c +#define LUA_CORE + +#include "lprefix.h" + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest 'n' such that +** more than half the slots between 1 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the 'original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lvm.h" + + +/* +** Maximum size of array part (MAXASIZE) is 2^MAXABITS. MAXABITS is +** the largest integer such that MAXASIZE fits in an unsigned int. +*/ +#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1) +#define MAXASIZE (1u << MAXABITS) + +/* +** Maximum size of hash part is 2^MAXHBITS. MAXHBITS is the largest +** integer such that 2^MAXHBITS fits in a signed int. (Note that the +** maximum number of elements in a table, 2^MAXABITS + 2^MAXHBITS, still +** fits comfortably in an unsigned int.) +*/ +#define MAXHBITS (MAXABITS - 1) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->hash) +#define hashboolean(t,p) hashpow2(t, p) +#define hashint(t,i) hashpow2(t, i) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, point2uint(p)) + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {NILCONSTANT}, /* value */ + {{NILCONSTANT, 0}} /* key */ +}; + + +/* +** Hash for floating-point numbers. +** The main computation should be just +** n = frexp(n, &i); return (n * INT_MAX) + i +** but there are some numerical subtleties. +** In a two-complement representation, INT_MAX does not has an exact +** representation as a float, but INT_MIN does; because the absolute +** value of 'frexp' is smaller than 1 (unless 'n' is inf/NaN), the +** absolute value of the product 'frexp * -INT_MIN' is smaller or equal +** to INT_MAX. Next, the use of 'unsigned int' avoids overflows when +** adding 'i'; the use of '~u' (instead of '-u') avoids problems with +** INT_MIN. +*/ +#if !defined(l_hashfloat) +static int l_hashfloat (lua_Number n) { + int i; + lua_Integer ni; + n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN); + if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */ + lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL)); + return 0; + } + else { /* normal case */ + unsigned int u = cast(unsigned int, i) + cast(unsigned int, ni); + return cast_int(u <= cast(unsigned int, INT_MAX) ? u : ~u); + } +} +#endif + + +/* +** returns the 'main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMINT: + return hashint(t, ivalue(key)); + case LUA_TNUMFLT: + return hashmod(t, l_hashfloat(fltvalue(key))); + case LUA_TSHRSTR: + return hashstr(t, tsvalue(key)); + case LUA_TLNGSTR: + return hashpow2(t, luaS_hashlongstr(tsvalue(key))); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + case LUA_TLCF: + return hashpointer(t, fvalue(key)); + default: + lua_assert(!ttisdeadkey(key)); + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for 'key' if 'key' is an appropriate key to live in +** the array part of the table, 0 otherwise. +*/ +static unsigned int arrayindex (const TValue *key) { + if (ttisinteger(key)) { + lua_Integer k = ivalue(key); + if (0 < k && (lua_Unsigned)k <= MAXASIZE) + return cast(unsigned int, k); /* 'key' is an appropriate array index */ + } + return 0; /* 'key' did not match some condition */ +} + + +/* +** returns the index of a 'key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signaled by 0. +*/ +static unsigned int findindex (lua_State *L, Table *t, StkId key) { + unsigned int i; + if (ttisnil(key)) return 0; /* first iteration */ + i = arrayindex(key); + if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */ + return i; /* yes; that's the index */ + else { + int nx; + Node *n = mainposition(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in 'next' */ + if (luaV_rawequalobj(gkey(n), key) || + (ttisdeadkey(gkey(n)) && iscollectable(key) && + deadvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return (i + 1) + t->sizearray; + } + nx = gnext(n); + if (nx == 0) + luaG_runerror(L, "invalid key to 'next'"); /* key not found */ + else n += nx; + } + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + unsigned int i = findindex(L, t, key); /* find original element */ + for (; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setivalue(key, i + 1); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, gkey(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + +/* +** Compute the optimal size for the array part of table 't'. 'nums' is a +** "count array" where 'nums[i]' is the number of integers in the table +** between 2^(i - 1) + 1 and 2^i. 'pna' enters with the total number of +** integer keys in the table and leaves with the number of keys that +** will go to the array part; return the optimal size. +*/ +static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { + int i; + unsigned int twotoi; /* 2^i (candidate for optimal size) */ + unsigned int a = 0; /* number of elements smaller than 2^i */ + unsigned int na = 0; /* number of elements to go to array part */ + unsigned int optimal = 0; /* optimal size for array part */ + /* loop while keys can fill more than half of total size */ + for (i = 0, twotoi = 1; + twotoi > 0 && *pna > twotoi / 2; + i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + optimal = twotoi; /* optimal size (till now) */ + na = a; /* all elements up to 'optimal' will go to array part */ + } + } + } + lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal); + *pna = na; + return optimal; +} + + +static int countint (const TValue *key, unsigned int *nums) { + unsigned int k = arrayindex(key); + if (k != 0) { /* is 'key' an appropriate array index? */ + nums[luaO_ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +/* +** Count keys in array part of table 't': Fill 'nums[i]' with +** number of keys that will go into corresponding slice and return +** total number of non-nil keys. +*/ +static unsigned int numusearray (const Table *t, unsigned int *nums) { + int lg; + unsigned int ttlg; /* 2^lg */ + unsigned int ause = 0; /* summation of 'nums' */ + unsigned int i = 1; /* count to traverse all array keys */ + /* traverse each slice */ + for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { + unsigned int lc = 0; /* counter */ + unsigned int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg - 1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* elements added to 'nums' (can go to array part) */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(gkey(n), nums); + totaluse++; + } + } + *pna += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, unsigned int size) { + unsigned int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; iarray[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, unsigned int size) { + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common 'dummynode' */ + t->lsizenode = 0; + t->lastfree = NULL; /* signal that it is using dummy node */ + } + else { + int i; + int lsize = luaO_ceillog2(size); + if (lsize > MAXHBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i = 0; i < (int)size; i++) { + Node *n = gnode(t, i); + gnext(n) = 0; + setnilvalue(wgkey(n)); + setnilvalue(gval(n)); + } + t->lsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ + } +} + + +typedef struct { + Table *t; + unsigned int nhsize; +} AuxsetnodeT; + + +static void auxsetnode (lua_State *L, void *ud) { + AuxsetnodeT *asn = cast(AuxsetnodeT *, ud); + setnodevector(L, asn->t, asn->nhsize); +} + + +void luaH_resize (lua_State *L, Table *t, unsigned int nasize, + unsigned int nhsize) { + unsigned int i; + int j; + AuxsetnodeT asn; + unsigned int oldasize = t->sizearray; + int oldhsize = allocsizenode(t); + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + asn.t = t; asn.nhsize = nhsize; + if (luaD_rawrunprotected(L, auxsetnode, &asn) != LUA_OK) { /* mem. error? */ + setarrayvector(L, t, oldasize); /* array back to its original size */ + luaD_throw(L, LUA_ERRMEM); /* rethrow memory error */ + } + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; iarray[i])) + luaH_setint(L, t, i + 1, &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (j = oldhsize - 1; j >= 0; j--) { + Node *old = nold + j; + if (!ttisnil(gval(old))) { + /* doesn't need barrier/invalidate cache, as entry was + already present in the table */ + setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); + } + } + if (oldhsize > 0) /* not the dummy node? */ + luaM_freearray(L, nold, cast(size_t, oldhsize)); /* free old hash */ +} + + +void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) { + int nsize = allocsizenode(t); + luaH_resize(L, t, nasize, nsize); +} + +/* +** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i +*/ +static void rehash (lua_State *L, Table *t, const TValue *ek) { + unsigned int asize; /* optimal size for array part */ + unsigned int na; /* number of keys in the array part */ + unsigned int nums[MAXABITS + 1]; + int i; + int totaluse; + for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ + na = numusearray(t, nums); /* count keys in array part */ + totaluse = na; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &na); /* count keys in hash part */ + /* count extra key */ + na += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + asize = computesizes(nums, &na); + /* resize the table to new computed sizes */ + luaH_resize(L, t, asize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L) { + GCObject *o = luaC_newobj(L, LUA_TTABLE, sizeof(Table)); + Table *t = gco2t(o); + t->metatable = NULL; + t->flags = cast_byte(~0); + t->array = NULL; + t->sizearray = 0; + setnodevector(L, t, 0); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (!isdummy(t)) + luaM_freearray(L, t->node, cast(size_t, sizenode(t))); + luaM_freearray(L, t->array, t->sizearray); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + if (!isdummy(t)) { + while (t->lastfree > t->node) { + t->lastfree--; + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp; + TValue aux; + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisfloat(key)) { + lua_Integer k; + if (luaV_tointeger(key, &k, 0)) { /* does index fit in an integer? */ + setivalue(&aux, k); + key = &aux; /* insert it as an integer */ + } + else if (luai_numisnan(fltvalue(key))) + luaG_runerror(L, "table index is NaN"); + } + mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || isdummy(t)) { /* main position is taken? */ + Node *othern; + Node *f = getfreepos(t); /* get a free place */ + if (f == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + /* whatever called 'newkey' takes care of TM cache */ + return luaH_set(L, t, key); /* insert key into grown table */ + } + lua_assert(!isdummy(t)); + othern = mainposition(t, gkey(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (othern + gnext(othern) != mp) /* find previous */ + othern += gnext(othern); + gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ + *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + if (gnext(mp) != 0) { + gnext(f) += cast_int(mp - f); /* correct 'next' */ + gnext(mp) = 0; /* now 'mp' is free */ + } + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + if (gnext(mp) != 0) + gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ + else lua_assert(gnext(f) == 0); + gnext(mp) = cast_int(f - mp); + mp = f; + } + } + setnodekey(L, &mp->i_key, key); + luaC_barrierback(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getint (Table *t, lua_Integer key) { + /* (1 <= key && key <= t->sizearray) */ + if (l_castS2U(key) - 1 < t->sizearray) + return &t->array[key - 1]; + else { + Node *n = hashint(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) break; + n += nx; + } + } + return luaO_nilobject; + } +} + + +/* +** search function for short strings +*/ +const TValue *luaH_getshortstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + lua_assert(key->tt == LUA_TSHRSTR); + for (;;) { /* check whether 'key' is somewhere in the chain */ + const TValue *k = gkey(n); + if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) + return luaO_nilobject; /* not found */ + n += nx; + } + } +} + + +/* +** "Generic" get version. (Not that generic: not valid for integers, +** which may be in array part, nor for floats with integral values.) +*/ +static const TValue *getgeneric (Table *t, const TValue *key) { + Node *n = mainposition(t, key); + for (;;) { /* check whether 'key' is somewhere in the chain */ + if (luaV_rawequalobj(gkey(n), key)) + return gval(n); /* that's it */ + else { + int nx = gnext(n); + if (nx == 0) + return luaO_nilobject; /* not found */ + n += nx; + } + } +} + + +const TValue *luaH_getstr (Table *t, TString *key) { + if (key->tt == LUA_TSHRSTR) + return luaH_getshortstr(t, key); + else { /* for long strings, use generic case */ + TValue ko; + setsvalue(cast(lua_State *, NULL), &ko, key); + return getgeneric(t, &ko); + } +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TSHRSTR: return luaH_getshortstr(t, tsvalue(key)); + case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); + case LUA_TNIL: return luaO_nilobject; + case LUA_TNUMFLT: { + lua_Integer k; + if (luaV_tointeger(key, &k, 0)) /* index is int? */ + return luaH_getint(t, k); /* use specialized version */ + /* else... */ + } /* FALLTHROUGH */ + default: + return getgeneric(t, key); + } +} + + +/* +** beware: when using this function you probably need to check a GC +** barrier and invalidate the TM cache. +*/ +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else return luaH_newkey(L, t, key); +} + + +void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { + const TValue *p = luaH_getint(t, key); + TValue *cell; + if (p != luaO_nilobject) + cell = cast(TValue *, p); + else { + TValue k; + setivalue(&k, key); + cell = luaH_newkey(L, t, &k); + } + setobj2t(L, cell, value); +} + + +static lua_Unsigned unbound_search (Table *t, lua_Unsigned j) { + lua_Unsigned i = j; /* i is zero or a present index */ + j++; + /* find 'i' and 'j' such that i is present and j is not */ + while (!ttisnil(luaH_getint(t, j))) { + i = j; + if (j > l_castS2U(LUA_MAXINTEGER) / 2) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getint(t, i))) i++; + return i - 1; + } + j *= 2; + } + /* now do a binary search between them */ + while (j - i > 1) { + lua_Unsigned m = (i+j)/2; + if (ttisnil(luaH_getint(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table 't'. A 'boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +lua_Unsigned luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (isdummy(t)) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (const Table *t) { return isdummy(t); } + +#endif diff --git a/deps/lua/src/ltable.h b/deps/lua/src/ltable.h new file mode 100644 index 0000000000..92db0ac7bf --- /dev/null +++ b/deps/lua/src/ltable.h @@ -0,0 +1,66 @@ +/* +** $Id: ltable.h,v 2.23.1.2 2018/05/24 19:39:05 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + + +/* 'const' to avoid wrong writings that can mess up field 'next' */ +#define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) + +/* +** writable version of 'gkey'; allows updates to individual fields, +** but not to the whole (which has incompatible type) +*/ +#define wgkey(n) (&(n)->i_key.nk) + +#define invalidateTMcache(t) ((t)->flags = 0) + + +/* true when 't' is using 'dummynode' as its hash part */ +#define isdummy(t) ((t)->lastfree == NULL) + + +/* allocated size for hash nodes */ +#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) + + +/* returns the key, given the value of a table entry */ +#define keyfromval(v) \ + (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) + + +LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); +LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, + TValue *value); +LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L); +LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, + unsigned int nhsize); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC lua_Unsigned luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (const Table *t); +#endif + + +#endif diff --git a/deps/lua/src/ltablib.c b/deps/lua/src/ltablib.c new file mode 100644 index 0000000000..c5349578ec --- /dev/null +++ b/deps/lua/src/ltablib.c @@ -0,0 +1,450 @@ +/* +** $Id: ltablib.c,v 1.93.1.1 2017/04/19 17:20:42 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + +#define ltablib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* +** Operations that an object must define to mimic a table +** (some functions only need some of them) +*/ +#define TAB_R 1 /* read */ +#define TAB_W 2 /* write */ +#define TAB_L 4 /* length */ +#define TAB_RW (TAB_R | TAB_W) /* read/write */ + + +#define aux_getn(L,n,w) (checktab(L, n, (w) | TAB_L), luaL_len(L, n)) + + +static int checkfield (lua_State *L, const char *key, int n) { + lua_pushstring(L, key); + return (lua_rawget(L, -n) != LUA_TNIL); +} + + +/* +** Check that 'arg' either is a table or can behave like one (that is, +** has a metatable with the required metamethods) +*/ +static void checktab (lua_State *L, int arg, int what) { + if (lua_type(L, arg) != LUA_TTABLE) { /* is it not a table? */ + int n = 1; /* number of elements to pop */ + if (lua_getmetatable(L, arg) && /* must have metatable */ + (!(what & TAB_R) || checkfield(L, "__index", ++n)) && + (!(what & TAB_W) || checkfield(L, "__newindex", ++n)) && + (!(what & TAB_L) || checkfield(L, "__len", ++n))) { + lua_pop(L, n); /* pop metatable and tested metamethods */ + } + else + luaL_checktype(L, arg, LUA_TTABLE); /* force an error */ + } +} + + +#if defined(LUA_COMPAT_MAXN) +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} +#endif + + +static int tinsert (lua_State *L) { + lua_Integer e = aux_getn(L, 1, TAB_RW) + 1; /* first empty element */ + lua_Integer pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + lua_Integer i; + pos = luaL_checkinteger(L, 2); /* 2nd argument is the position */ + luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds"); + for (i = e; i > pos; i--) { /* move up elements */ + lua_geti(L, 1, i - 1); + lua_seti(L, 1, i); /* t[i] = t[i - 1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to 'insert'"); + } + } + lua_seti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + lua_Integer size = aux_getn(L, 1, TAB_RW); + lua_Integer pos = luaL_optinteger(L, 2, size); + if (pos != size) /* validate 'pos' if given */ + luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); + lua_geti(L, 1, pos); /* result = t[pos] */ + for ( ; pos < size; pos++) { + lua_geti(L, 1, pos + 1); + lua_seti(L, 1, pos); /* t[pos] = t[pos + 1] */ + } + lua_pushnil(L); + lua_seti(L, 1, pos); /* t[pos] = nil */ + return 1; +} + + +/* +** Copy elements (1[f], ..., 1[e]) into (tt[t], tt[t+1], ...). Whenever +** possible, copy in increasing order, which is better for rehashing. +** "possible" means destination after original range, or smaller +** than origin, or copying to another table. +*/ +static int tmove (lua_State *L) { + lua_Integer f = luaL_checkinteger(L, 2); + lua_Integer e = luaL_checkinteger(L, 3); + lua_Integer t = luaL_checkinteger(L, 4); + int tt = !lua_isnoneornil(L, 5) ? 5 : 1; /* destination table */ + checktab(L, 1, TAB_R); + checktab(L, tt, TAB_W); + if (e >= f) { /* otherwise, nothing to move */ + lua_Integer n, i; + luaL_argcheck(L, f > 0 || e < LUA_MAXINTEGER + f, 3, + "too many elements to move"); + n = e - f + 1; /* number of elements to move */ + luaL_argcheck(L, t <= LUA_MAXINTEGER - n + 1, 4, + "destination wrap around"); + if (t > e || t <= f || (tt != 1 && !lua_compare(L, 1, tt, LUA_OPEQ))) { + for (i = 0; i < n; i++) { + lua_geti(L, 1, f + i); + lua_seti(L, tt, t + i); + } + } + else { + for (i = n - 1; i >= 0; i--) { + lua_geti(L, 1, f + i); + lua_seti(L, tt, t + i); + } + } + } + lua_pushvalue(L, tt); /* return destination table */ + return 1; +} + + +static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) { + lua_geti(L, 1, i); + if (!lua_isstring(L, -1)) + luaL_error(L, "invalid value (%s) at index %d in table for 'concat'", + luaL_typename(L, -1), i); + luaL_addvalue(b); +} + + +static int tconcat (lua_State *L) { + luaL_Buffer b; + lua_Integer last = aux_getn(L, 1, TAB_R); + size_t lsep; + const char *sep = luaL_optlstring(L, 2, "", &lsep); + lua_Integer i = luaL_optinteger(L, 3, 1); + last = luaL_optinteger(L, 4, last); + luaL_buffinit(L, &b); + for (; i < last; i++) { + addfield(L, &b, i); + luaL_addlstring(&b, sep, lsep); + } + if (i == last) /* add last value (if interval was not empty) */ + addfield(L, &b, i); + luaL_pushresult(&b); + return 1; +} + + +/* +** {====================================================== +** Pack/unpack +** ======================================================= +*/ + +static int pack (lua_State *L) { + int i; + int n = lua_gettop(L); /* number of elements to pack */ + lua_createtable(L, n, 1); /* create result table */ + lua_insert(L, 1); /* put it at index 1 */ + for (i = n; i >= 1; i--) /* assign elements */ + lua_seti(L, 1, i); + lua_pushinteger(L, n); + lua_setfield(L, 1, "n"); /* t.n = number of elements */ + return 1; /* return table */ +} + + +static int unpack (lua_State *L) { + lua_Unsigned n; + lua_Integer i = luaL_optinteger(L, 2, 1); + lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); + if (i > e) return 0; /* empty range */ + n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ + if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n))) + return luaL_error(L, "too many results to unpack"); + for (; i < e; i++) { /* push arg[i..e - 1] (to avoid overflows) */ + lua_geti(L, 1, i); + } + lua_geti(L, 1, e); /* push last element */ + return (int)n; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** Quicksort +** (based on 'Algorithms in MODULA-3', Robert Sedgewick; +** Addison-Wesley, 1993.) +** ======================================================= +*/ + + +/* type for array indices */ +typedef unsigned int IdxT; + + +/* +** Produce a "random" 'unsigned int' to randomize pivot choice. This +** macro is used only when 'sort' detects a big imbalance in the result +** of a partition. (If you don't want/need this "randomness", ~0 is a +** good choice.) +*/ +#if !defined(l_randomizePivot) /* { */ + +#include + +/* size of 'e' measured in number of 'unsigned int's */ +#define sof(e) (sizeof(e) / sizeof(unsigned int)) + +/* +** Use 'time' and 'clock' as sources of "randomness". Because we don't +** know the types 'clock_t' and 'time_t', we cannot cast them to +** anything without risking overflows. A safe way to use their values +** is to copy them to an array of a known type and use the array values. +*/ +static unsigned int l_randomizePivot (void) { + clock_t c = clock(); + time_t t = time(NULL); + unsigned int buff[sof(c) + sof(t)]; + unsigned int i, rnd = 0; + memcpy(buff, &c, sof(c) * sizeof(unsigned int)); + memcpy(buff + sof(c), &t, sof(t) * sizeof(unsigned int)); + for (i = 0; i < sof(buff); i++) + rnd += buff[i]; + return rnd; +} + +#endif /* } */ + + +/* arrays larger than 'RANLIMIT' may use randomized pivots */ +#define RANLIMIT 100u + + +static void set2 (lua_State *L, IdxT i, IdxT j) { + lua_seti(L, 1, i); + lua_seti(L, 1, j); +} + + +/* +** Return true iff value at stack index 'a' is less than the value at +** index 'b' (according to the order of the sort). +*/ +static int sort_comp (lua_State *L, int a, int b) { + if (lua_isnil(L, 2)) /* no function? */ + return lua_compare(L, a, b, LUA_OPLT); /* a < b */ + else { /* function */ + int res; + lua_pushvalue(L, 2); /* push function */ + lua_pushvalue(L, a-1); /* -1 to compensate function */ + lua_pushvalue(L, b-2); /* -2 to compensate function and 'a' */ + lua_call(L, 2, 1); /* call function */ + res = lua_toboolean(L, -1); /* get result */ + lua_pop(L, 1); /* pop result */ + return res; + } +} + + +/* +** Does the partition: Pivot P is at the top of the stack. +** precondition: a[lo] <= P == a[up-1] <= a[up], +** so it only needs to do the partition from lo + 1 to up - 2. +** Pos-condition: a[lo .. i - 1] <= a[i] == P <= a[i + 1 .. up] +** returns 'i'. +*/ +static IdxT partition (lua_State *L, IdxT lo, IdxT up) { + IdxT i = lo; /* will be incremented before first use */ + IdxT j = up - 1; /* will be decremented before first use */ + /* loop invariant: a[lo .. i] <= P <= a[j .. up] */ + for (;;) { + /* next loop: repeat ++i while a[i] < P */ + while (lua_geti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i == up - 1) /* a[i] < P but a[up - 1] == P ?? */ + luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* after the loop, a[i] >= P and a[lo .. i - 1] < P */ + /* next loop: repeat --j while P < a[j] */ + while (lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j < i) /* j < i but a[j] > P ?? */ + luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[j] */ + } + /* after the loop, a[j] <= P and a[j + 1 .. up] >= P */ + if (j < i) { /* no elements out of place? */ + /* a[lo .. i - 1] <= P <= a[j + 1 .. i .. up] */ + lua_pop(L, 1); /* pop a[j] */ + /* swap pivot (a[up - 1]) with a[i] to satisfy pos-condition */ + set2(L, up - 1, i); + return i; + } + /* otherwise, swap a[i] - a[j] to restore invariant and repeat */ + set2(L, i, j); + } +} + + +/* +** Choose an element in the middle (2nd-3th quarters) of [lo,up] +** "randomized" by 'rnd' +*/ +static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) { + IdxT r4 = (up - lo) / 4; /* range/4 */ + IdxT p = rnd % (r4 * 2) + (lo + r4); + lua_assert(lo + r4 <= p && p <= up - r4); + return p; +} + + +/* +** QuickSort algorithm (recursive function) +*/ +static void auxsort (lua_State *L, IdxT lo, IdxT up, + unsigned int rnd) { + while (lo < up) { /* loop for tail recursion */ + IdxT p; /* Pivot index */ + IdxT n; /* to be used later */ + /* sort elements 'lo', 'p', and 'up' */ + lua_geti(L, 1, lo); + lua_geti(L, 1, up); + if (sort_comp(L, -1, -2)) /* a[up] < a[lo]? */ + set2(L, lo, up); /* swap a[lo] - a[up] */ + else + lua_pop(L, 2); /* remove both values */ + if (up - lo == 1) /* only 2 elements? */ + return; /* already sorted */ + if (up - lo < RANLIMIT || rnd == 0) /* small interval or no randomize? */ + p = (lo + up)/2; /* middle element is a good pivot */ + else /* for larger intervals, it is worth a random pivot */ + p = choosePivot(lo, up, rnd); + lua_geti(L, 1, p); + lua_geti(L, 1, lo); + if (sort_comp(L, -2, -1)) /* a[p] < a[lo]? */ + set2(L, p, lo); /* swap a[p] - a[lo] */ + else { + lua_pop(L, 1); /* remove a[lo] */ + lua_geti(L, 1, up); + if (sort_comp(L, -1, -2)) /* a[up] < a[p]? */ + set2(L, p, up); /* swap a[up] - a[p] */ + else + lua_pop(L, 2); + } + if (up - lo == 2) /* only 3 elements? */ + return; /* already sorted */ + lua_geti(L, 1, p); /* get middle element (Pivot) */ + lua_pushvalue(L, -1); /* push Pivot */ + lua_geti(L, 1, up - 1); /* push a[up - 1] */ + set2(L, p, up - 1); /* swap Pivot (a[p]) with a[up - 1] */ + p = partition(L, lo, up); + /* a[lo .. p - 1] <= a[p] == P <= a[p + 1 .. up] */ + if (p - lo < up - p) { /* lower interval is smaller? */ + auxsort(L, lo, p - 1, rnd); /* call recursively for lower interval */ + n = p - lo; /* size of smaller interval */ + lo = p + 1; /* tail call for [p + 1 .. up] (upper interval) */ + } + else { + auxsort(L, p + 1, up, rnd); /* call recursively for upper interval */ + n = up - p; /* size of smaller interval */ + up = p - 1; /* tail call for [lo .. p - 1] (lower interval) */ + } + if ((up - lo) / 128 > n) /* partition too imbalanced? */ + rnd = l_randomizePivot(); /* try a new randomization */ + } /* tail call auxsort(L, lo, up, rnd) */ +} + + +static int sort (lua_State *L) { + lua_Integer n = aux_getn(L, 1, TAB_RW); + if (n > 1) { /* non-trivial interval? */ + luaL_argcheck(L, n < INT_MAX, 1, "array too big"); + if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */ + luaL_checktype(L, 2, LUA_TFUNCTION); /* must be a function */ + lua_settop(L, 2); /* make sure there are two arguments */ + auxsort(L, 1, (IdxT)n, 0); + } + return 0; +} + +/* }====================================================== */ + + +static const luaL_Reg tab_funcs[] = { + {"concat", tconcat}, +#if defined(LUA_COMPAT_MAXN) + {"maxn", maxn}, +#endif + {"insert", tinsert}, + {"pack", pack}, + {"unpack", unpack}, + {"remove", tremove}, + {"move", tmove}, + {"sort", sort}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_table (lua_State *L) { + luaL_newlib(L, tab_funcs); +#if defined(LUA_COMPAT_UNPACK) + /* _G.unpack = table.unpack */ + lua_getfield(L, -1, "unpack"); + lua_setglobal(L, "unpack"); +#endif + return 1; +} + diff --git a/deps/lua/src/ltm.c b/deps/lua/src/ltm.c new file mode 100644 index 0000000000..0e7c713214 --- /dev/null +++ b/deps/lua/src/ltm.c @@ -0,0 +1,165 @@ +/* +** $Id: ltm.c,v 2.38.1.1 2017/04/19 17:39:34 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#define ltm_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + +static const char udatatypename[] = "userdata"; + +LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = { + "no value", + "nil", "boolean", udatatypename, "number", + "string", "table", "function", udatatypename, "thread", + "proto" /* this last case is used for tests only */ +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__len", "__eq", + "__add", "__sub", "__mul", "__mod", "__pow", + "__div", "__idiv", + "__band", "__bor", "__bxor", "__shl", "__shr", + "__unm", "__bnot", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaC_fix(L, obj2gco(G(L)->tmname[i])); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getshortstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttnov(o)]; + } + return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + + +/* +** Return the name of the type of an object. For tables and userdata +** with metatable, use their '__name' metafield, if present. +*/ +const char *luaT_objtypename (lua_State *L, const TValue *o) { + Table *mt; + if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) || + (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) { + const TValue *name = luaH_getshortstr(mt, luaS_new(L, "__name")); + if (ttisstring(name)) /* is '__name' a string? */ + return getstr(tsvalue(name)); /* use it as type name */ + } + return ttypename(ttnov(o)); /* else use standard type name */ +} + + +void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, TValue *p3, int hasres) { + ptrdiff_t result = savestack(L, p3); + StkId func = L->top; + setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */ + setobj2s(L, func + 1, p1); /* 1st argument */ + setobj2s(L, func + 2, p2); /* 2nd argument */ + L->top += 3; + if (!hasres) /* no result? 'p3' is third argument */ + setobj2s(L, L->top++, p3); /* 3rd argument */ + /* metamethod may yield only when called from Lua code */ + if (isLua(L->ci)) + luaD_call(L, func, hasres); + else + luaD_callnoyield(L, func, hasres); + if (hasres) { /* if has result, move it to its place */ + p3 = restorestack(L, result); + setobjs2s(L, p3, --L->top); + } +} + + +int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + luaT_callTM(L, tm, p1, p2, res, 1); + return 1; +} + + +void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + if (!luaT_callbinTM(L, p1, p2, res, event)) { + switch (event) { + case TM_CONCAT: + luaG_concaterror(L, p1, p2); + /* call never returns, but to avoid warnings: *//* FALLTHROUGH */ + case TM_BAND: case TM_BOR: case TM_BXOR: + case TM_SHL: case TM_SHR: case TM_BNOT: { + lua_Number dummy; + if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) + luaG_tointerror(L, p1, p2); + else + luaG_opinterror(L, p1, p2, "perform bitwise operation on"); + } + /* calls never return, but to avoid warnings: *//* FALLTHROUGH */ + default: + luaG_opinterror(L, p1, p2, "perform arithmetic on"); + } + } +} + + +int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + if (!luaT_callbinTM(L, p1, p2, L->top, event)) + return -1; /* no metamethod */ + else + return !l_isfalse(L->top); +} + diff --git a/deps/lua/src/ltm.h b/deps/lua/src/ltm.h new file mode 100644 index 0000000000..8170688dae --- /dev/null +++ b/deps/lua/src/ltm.h @@ -0,0 +1,76 @@ +/* +** $Id: ltm.h,v 2.22.1.1 2017/04/19 17:20:42 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" and "ORDER OP" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_LEN, + TM_EQ, /* last tag method with fast access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_MOD, + TM_POW, + TM_DIV, + TM_IDIV, + TM_BAND, + TM_BOR, + TM_BXOR, + TM_SHL, + TM_SHR, + TM_UNM, + TM_BNOT, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +#define ttypename(x) luaT_typenames_[(x) + 1] + +LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; + + +LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o); + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, TValue *p3, int hasres); +LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event); +LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event); +LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, + const TValue *p2, TMS event); + + + +#endif diff --git a/deps/lua/src/lua.c b/deps/lua/src/lua.c new file mode 100644 index 0000000000..ca5b298523 --- /dev/null +++ b/deps/lua/src/lua.c @@ -0,0 +1,612 @@ +/* +** $Id: lua.c,v 1.230.1.1 2017/04/19 17:29:57 roberto Exp $ +** Lua stand-alone interpreter +** See Copyright Notice in lua.h +*/ + +#define lua_c + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#if !defined(LUA_PROMPT) +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " +#endif + +#if !defined(LUA_PROGNAME) +#define LUA_PROGNAME "lua" +#endif + +#if !defined(LUA_MAXINPUT) +#define LUA_MAXINPUT 512 +#endif + +#if !defined(LUA_INIT_VAR) +#define LUA_INIT_VAR "LUA_INIT" +#endif + +#define LUA_INITVARVERSION LUA_INIT_VAR LUA_VERSUFFIX + + +/* +** lua_stdin_is_tty detects whether the standard input is a 'tty' (that +** is, whether we're running lua interactively). +*/ +#if !defined(lua_stdin_is_tty) /* { */ + +#if defined(LUA_USE_POSIX) /* { */ + +#include +#define lua_stdin_is_tty() isatty(0) + +#elif defined(LUA_USE_WINDOWS) /* }{ */ + +#include +#include + +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) + +#else /* }{ */ + +/* ISO C definition */ +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ + +#endif /* } */ + +#endif /* } */ + + +/* +** lua_readline defines how to show a prompt and then read a line from +** the standard input. +** lua_saveline defines how to "save" a read line in a "history". +** lua_freeline defines how to free a line read by lua_readline. +*/ +#if !defined(lua_readline) /* { */ + +#if defined(LUA_USE_READLINE) /* { */ + +#include +#include +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,line) ((void)L, add_history(line)) +#define lua_freeline(L,b) ((void)L, free(b)) + +#else /* }{ */ + +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,line) { (void)L; (void)line; } +#define lua_freeline(L,b) { (void)L; (void)b; } + +#endif /* } */ + +#endif /* } */ + + + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; + + +/* +** Hook set by signal function to stop the interpreter. +*/ +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); /* reset hook */ + luaL_error(L, "interrupted!"); +} + + +/* +** Function to be called at a C signal. Because a C signal cannot +** just change a Lua state (as there is no proper synchronization), +** this function only sets a hook that, when called, will stop the +** interpreter. +*/ +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens, terminate process */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void print_usage (const char *badoption) { + lua_writestringerror("%s: ", progname); + if (badoption[1] == 'e' || badoption[1] == 'l') + lua_writestringerror("'%s' needs argument\n", badoption); + else + lua_writestringerror("unrecognized option '%s'\n", badoption); + lua_writestringerror( + "usage: %s [options] [script [args]]\n" + "Available options are:\n" + " -e stat execute string 'stat'\n" + " -i enter interactive mode after executing 'script'\n" + " -l name require library 'name' into global 'name'\n" + " -v show version information\n" + " -E ignore environment variables\n" + " -- stop handling options\n" + " - stop handling options and execute stdin\n" + , + progname); +} + + +/* +** Prints an error message, adding the program name in front of it +** (if present) +*/ +static void l_message (const char *pname, const char *msg) { + if (pname) lua_writestringerror("%s: ", pname); + lua_writestringerror("%s\n", msg); +} + + +/* +** Check whether 'status' is not OK and, if so, prints the error +** message on the top of the stack. It assumes that the error object +** is a string, as it was either generated by Lua or by 'msghandler'. +*/ +static int report (lua_State *L, int status) { + if (status != LUA_OK) { + const char *msg = lua_tostring(L, -1); + l_message(progname, msg); + lua_pop(L, 1); /* remove message */ + } + return status; +} + + +/* +** Message handler used to run all chunks +*/ +static int msghandler (lua_State *L) { + const char *msg = lua_tostring(L, 1); + if (msg == NULL) { /* is error object not a string? */ + if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ + lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ + return 1; /* that is the message */ + else + msg = lua_pushfstring(L, "(error object is a %s value)", + luaL_typename(L, 1)); + } + luaL_traceback(L, L, msg, 1); /* append a standard traceback */ + return 1; /* return the traceback */ +} + + +/* +** Interface to 'lua_pcall', which sets appropriate message function +** and C-signal handler. Used to run all chunks. +*/ +static int docall (lua_State *L, int narg, int nres) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, msghandler); /* push message handler */ + lua_insert(L, base); /* put it under function and args */ + globalL = L; /* to be available to 'laction' */ + signal(SIGINT, laction); /* set C-signal handler */ + status = lua_pcall(L, narg, nres, base); + signal(SIGINT, SIG_DFL); /* reset C-signal handler */ + lua_remove(L, base); /* remove message handler from the stack */ + return status; +} + + +static void print_version (void) { + lua_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT)); + lua_writeline(); +} + + +/* +** Create the 'arg' table, which stores all arguments from the +** command line ('argv'). It should be aligned so that, at index 0, +** it has 'argv[script]', which is the script name. The arguments +** to the script (everything after 'script') go to positive indices; +** other arguments (before the script name) go to negative indices. +** If there is no script name, assume interpreter's name as base. +*/ +static void createargtable (lua_State *L, char **argv, int argc, int script) { + int i, narg; + if (script == argc) script = 0; /* no script name? */ + narg = argc - (script + 1); /* number of positive indices */ + lua_createtable(L, narg, script + 1); + for (i = 0; i < argc; i++) { + lua_pushstring(L, argv[i]); + lua_rawseti(L, -2, i - script); + } + lua_setglobal(L, "arg"); +} + + +static int dochunk (lua_State *L, int status) { + if (status == LUA_OK) status = docall(L, 0, 0); + return report(L, status); +} + + +static int dofile (lua_State *L, const char *name) { + return dochunk(L, luaL_loadfile(L, name)); +} + + +static int dostring (lua_State *L, const char *s, const char *name) { + return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name)); +} + + +/* +** Calls 'require(name)' and stores the result in a global variable +** with the given name. +*/ +static int dolibrary (lua_State *L, const char *name) { + int status; + lua_getglobal(L, "require"); + lua_pushstring(L, name); + status = docall(L, 1, 1); /* call 'require(name)' */ + if (status == LUA_OK) + lua_setglobal(L, name); /* global[name] = require return */ + return report(L, status); +} + + +/* +** Returns the string to be used as a prompt by the interpreter. +*/ +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + return p; +} + +/* mark in error messages for incomplete statements */ +#define EOFMARK "" +#define marklen (sizeof(EOFMARK)/sizeof(char) - 1) + + +/* +** Check whether 'status' signals a syntax error and the error +** message at the top of the stack ends with the above mark for +** incomplete statements. +*/ +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +/* +** Prompt the user, read a line, and push it into the Lua stack. +*/ +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + int readstatus = lua_readline(L, b, prmt); + if (readstatus == 0) + return 0; /* no input (prompt will be popped by caller) */ + lua_pop(L, 1); /* remove prompt */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[--l] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ + lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ + else + lua_pushlstring(L, b, l); + lua_freeline(L, b); + return 1; +} + + +/* +** Try to compile line on the stack as 'return ;'; on return, stack +** has either compiled chunk or original line (if compilation failed). +*/ +static int addreturn (lua_State *L) { + const char *line = lua_tostring(L, -1); /* original line */ + const char *retline = lua_pushfstring(L, "return %s;", line); + int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin"); + if (status == LUA_OK) { + lua_remove(L, -2); /* remove modified line */ + if (line[0] != '\0') /* non empty? */ + lua_saveline(L, line); /* keep history */ + } + else + lua_pop(L, 2); /* pop result from 'luaL_loadbuffer' and modified line */ + return status; +} + + +/* +** Read multiple lines until a complete Lua statement +*/ +static int multiline (lua_State *L) { + for (;;) { /* repeat until gets a complete statement */ + size_t len; + const char *line = lua_tolstring(L, 1, &len); /* get what it has */ + int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ + if (!incomplete(L, status) || !pushline(L, 0)) { + lua_saveline(L, line); /* keep history */ + return status; /* cannot or should not try to add continuation line */ + } + lua_pushliteral(L, "\n"); /* add newline... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } +} + + +/* +** Read a line and try to load (compile) it first as an expression (by +** adding "return " in front of it) and second as a statement. Return +** the final status of load/call with the resulting function (if any) +** in the top of the stack. +*/ +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */ + status = multiline(L); /* try as command, maybe with continuation lines */ + lua_remove(L, 1); /* remove line from the stack */ + lua_assert(lua_gettop(L) == 1); + return status; +} + + +/* +** Prints (calling the Lua 'print' function) any values on the stack +*/ +static void l_print (lua_State *L) { + int n = lua_gettop(L); + if (n > 0) { /* any result to be printed? */ + luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, n, 0, 0) != LUA_OK) + l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", + lua_tostring(L, -1))); + } +} + + +/* +** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and +** print any results. +*/ +static void doREPL (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; /* no 'progname' on errors in interactive mode */ + while ((status = loadline(L)) != -1) { + if (status == LUA_OK) + status = docall(L, 0, LUA_MULTRET); + if (status == LUA_OK) l_print(L); + else report(L, status); + } + lua_settop(L, 0); /* clear stack */ + lua_writeline(); + progname = oldprogname; +} + + +/* +** Push on the stack the contents of table 'arg' from 1 to #arg +*/ +static int pushargs (lua_State *L) { + int i, n; + if (lua_getglobal(L, "arg") != LUA_TTABLE) + luaL_error(L, "'arg' is not a table"); + n = (int)luaL_len(L, -1); + luaL_checkstack(L, n + 3, "too many arguments to script"); + for (i = 1; i <= n; i++) + lua_rawgeti(L, -i, i); + lua_remove(L, -i); /* remove table from the stack */ + return n; +} + + +static int handle_script (lua_State *L, char **argv) { + int status; + const char *fname = argv[0]; + if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + if (status == LUA_OK) { + int n = pushargs(L); /* push arguments to script */ + status = docall(L, n, LUA_MULTRET); + } + return report(L, status); +} + + + +/* bits of various argument indicators in 'args' */ +#define has_error 1 /* bad option */ +#define has_i 2 /* -i */ +#define has_v 4 /* -v */ +#define has_e 8 /* -e */ +#define has_E 16 /* -E */ + +/* +** Traverses all arguments from 'argv', returning a mask with those +** needed before running any Lua code (or an error code if it finds +** any invalid argument). 'first' returns the first not-handled argument +** (either the script name or a bad argument in case of error). +*/ +static int collectargs (char **argv, int *first) { + int args = 0; + int i; + for (i = 1; argv[i] != NULL; i++) { + *first = i; + if (argv[i][0] != '-') /* not an option? */ + return args; /* stop handling options */ + switch (argv[i][1]) { /* else check option */ + case '-': /* '--' */ + if (argv[i][2] != '\0') /* extra characters after '--'? */ + return has_error; /* invalid option */ + *first = i + 1; + return args; + case '\0': /* '-' */ + return args; /* script "name" is '-' */ + case 'E': + if (argv[i][2] != '\0') /* extra characters after 1st? */ + return has_error; /* invalid option */ + args |= has_E; + break; + case 'i': + args |= has_i; /* (-i implies -v) *//* FALLTHROUGH */ + case 'v': + if (argv[i][2] != '\0') /* extra characters after 1st? */ + return has_error; /* invalid option */ + args |= has_v; + break; + case 'e': + args |= has_e; /* FALLTHROUGH */ + case 'l': /* both options need an argument */ + if (argv[i][2] == '\0') { /* no concatenated argument? */ + i++; /* try next 'argv' */ + if (argv[i] == NULL || argv[i][0] == '-') + return has_error; /* no next argument or it is another option */ + } + break; + default: /* invalid option */ + return has_error; + } + } + *first = i; /* no script name */ + return args; +} + + +/* +** Processes options 'e' and 'l', which involve running Lua code. +** Returns 0 if some code raises an error. +*/ +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + int option = argv[i][1]; + lua_assert(argv[i][0] == '-'); /* already checked */ + if (option == 'e' || option == 'l') { + int status; + const char *extra = argv[i] + 2; /* both options need an argument */ + if (*extra == '\0') extra = argv[++i]; + lua_assert(extra != NULL); + status = (option == 'e') + ? dostring(L, extra, "=(command line)") + : dolibrary(L, extra); + if (status != LUA_OK) return 0; + } + } + return 1; +} + + + +static int handle_luainit (lua_State *L) { + const char *name = "=" LUA_INITVARVERSION; + const char *init = getenv(name + 1); + if (init == NULL) { + name = "=" LUA_INIT_VAR; + init = getenv(name + 1); /* try alternative name */ + } + if (init == NULL) return LUA_OK; + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, name); +} + + +/* +** Main body of stand-alone interpreter (to be called in protected mode). +** Reads the options and handles them all. +*/ +static int pmain (lua_State *L) { + int argc = (int)lua_tointeger(L, 1); + char **argv = (char **)lua_touserdata(L, 2); + int script; + int args = collectargs(argv, &script); + luaL_checkversion(L); /* check that interpreter has correct version */ + if (argv[0] && argv[0][0]) progname = argv[0]; + if (args == has_error) { /* bad arg? */ + print_usage(argv[script]); /* 'script' has index of bad arg. */ + return 0; + } + if (args & has_v) /* option '-v'? */ + print_version(); + if (args & has_E) { /* option '-E'? */ + lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */ + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); + } + luaL_openlibs(L); /* open standard libraries */ + createargtable(L, argv, argc, script); /* create table 'arg' */ + if (!(args & has_E)) { /* no option '-E'? */ + if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ + return 0; /* error running LUA_INIT */ + } + if (!runargs(L, argv, script)) /* execute arguments -e and -l */ + return 0; /* something failed */ + if (script < argc && /* execute main script (if there is one) */ + handle_script(L, argv + script) != LUA_OK) + return 0; + if (args & has_i) /* -i option? */ + doREPL(L); /* do read-eval-print loop */ + else if (script == argc && !(args & (has_e | has_v))) { /* no arguments? */ + if (lua_stdin_is_tty()) { /* running in interactive mode? */ + print_version(); + doREPL(L); /* do read-eval-print loop */ + } + else dofile(L, NULL); /* executes stdin as a file */ + } + lua_pushboolean(L, 1); /* signal no errors */ + return 1; +} + + +int main (int argc, char **argv) { + int status, result; + lua_State *L = luaL_newstate(); /* create state */ + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); + return EXIT_FAILURE; + } + lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ + lua_pushinteger(L, argc); /* 1st argument */ + lua_pushlightuserdata(L, argv); /* 2nd argument */ + status = lua_pcall(L, 2, 1, 0); /* do the call */ + result = lua_toboolean(L, -1); /* get result */ + report(L, status); + lua_close(L); + return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE; +} + diff --git a/deps/lua/src/lua.h b/deps/lua/src/lua.h new file mode 100644 index 0000000000..c236e36095 --- /dev/null +++ b/deps/lua/src/lua.h @@ -0,0 +1,486 @@ +/* +** $Id: lua.h,v 1.332.1.2 2018/06/13 16:58:17 roberto Exp $ +** Lua - A Scripting Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION_MAJOR "5" +#define LUA_VERSION_MINOR "3" +#define LUA_VERSION_NUM 503 +#define LUA_VERSION_RELEASE "5" + +#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2018 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" + + +/* mark for precompiled code ('Lua') */ +#define LUA_SIGNATURE "\x1bLua" + +/* option for multiple returns in 'lua_pcall' and 'lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** Pseudo-indices +** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty +** space after that to help overflow detection) +*/ +#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) +#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) + + +/* thread status */ +#define LUA_OK 0 +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRGCMM 5 +#define LUA_ERRERR 6 + + +typedef struct lua_State lua_State; + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + +#define LUA_NUMTAGS 9 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* predefined values in the registry */ +#define LUA_RIDX_MAINTHREAD 1 +#define LUA_RIDX_GLOBALS 2 +#define LUA_RIDX_LAST LUA_RIDX_GLOBALS + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + +/* unsigned integer type */ +typedef LUA_UNSIGNED lua_Unsigned; + +/* type for continuation-function contexts */ +typedef LUA_KCONTEXT lua_KContext; + + +/* +** Type for C functions registered with Lua +*/ +typedef int (*lua_CFunction) (lua_State *L); + +/* +** Type for continuation functions +*/ +typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); + + +/* +** Type for functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); + + +/* +** Type for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* +** RCS ident string +*/ +extern const char lua_ident[]; + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +LUA_API const lua_Number *(lua_version) (lua_State *L); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_absindex) (lua_State *L, int idx); +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_rotate) (lua_State *L, int idx, int n); +LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); +LUA_API int (lua_checkstack) (lua_State *L, int n); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isinteger) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); +LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_rawlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** Comparison and arithmetic functions +*/ + +#define LUA_OPADD 0 /* ORDER TM, ORDER OP */ +#define LUA_OPSUB 1 +#define LUA_OPMUL 2 +#define LUA_OPMOD 3 +#define LUA_OPPOW 4 +#define LUA_OPDIV 5 +#define LUA_OPIDIV 6 +#define LUA_OPBAND 7 +#define LUA_OPBOR 8 +#define LUA_OPBXOR 9 +#define LUA_OPSHL 10 +#define LUA_OPSHR 11 +#define LUA_OPUNM 12 +#define LUA_OPBNOT 13 + +LUA_API void (lua_arith) (lua_State *L, int op); + +#define LUA_OPEQ 0 +#define LUA_OPLT 1 +#define LUA_OPLE 2 + +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); +LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API int (lua_getglobal) (lua_State *L, const char *name); +LUA_API int (lua_gettable) (lua_State *L, int idx); +LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n); +LUA_API int (lua_rawget) (lua_State *L, int idx); +LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); +LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); + +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API int (lua_getuservalue) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_setglobal) (lua_State *L, const char *name); +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_seti) (lua_State *L, int idx, lua_Integer n); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); +LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API void (lua_setuservalue) (lua_State *L, int idx); + + +/* +** 'load' and 'call' functions (load and run Lua code) +*/ +LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, + lua_KContext ctx, lua_KFunction k); +#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) + +LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, + lua_KContext ctx, lua_KFunction k); +#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) + +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname, const char *mode); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, + lua_KFunction k); +LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); +LUA_API int (lua_status) (lua_State *L); +LUA_API int (lua_isyieldable) (lua_State *L); + +#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) + + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 +#define LUA_GCISRUNNING 9 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); +LUA_API void (lua_len) (lua_State *L, int idx); + +LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** {============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE)) + +#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) +#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) lua_pushstring(L, "" s) + +#define lua_pushglobaltable(L) \ + ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + +#define lua_insert(L,idx) lua_rotate(L, (idx), 1) + +#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1)) + +#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1)) + +/* }============================================================== */ + + +/* +** {============================================================== +** compatibility macros for unsigned conversions +** =============================================================== +*/ +#if defined(LUA_COMPAT_APIINTCASTS) + +#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) +#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is)) +#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) + +#endif +/* }============================================================== */ + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILCALL 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debugger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); +LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n); +LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); + +LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); +LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, + int fidx2, int n2); + +LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook (lua_gethook) (lua_State *L); +LUA_API int (lua_gethookmask) (lua_State *L); +LUA_API int (lua_gethookcount) (lua_State *L); + + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ + const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + unsigned char nups; /* (u) number of upvalues */ + unsigned char nparams;/* (u) number of parameters */ + char isvararg; /* (u) */ + char istailcall; /* (t) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + struct CallInfo *i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2018 Lua.org, PUC-Rio. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/deps/lua/src/lua.hpp b/deps/lua/src/lua.hpp new file mode 100644 index 0000000000..ec417f5946 --- /dev/null +++ b/deps/lua/src/lua.hpp @@ -0,0 +1,9 @@ +// lua.hpp +// Lua header files for C++ +// <> not supplied automatically because Lua also compiles as C++ + +extern "C" { +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" +} diff --git a/deps/lua/src/luac.c b/deps/lua/src/luac.c new file mode 100644 index 0000000000..549ad39500 --- /dev/null +++ b/deps/lua/src/luac.c @@ -0,0 +1,450 @@ +/* +** $Id: luac.c,v 1.76 2018/06/19 01:32:02 lhf Exp $ +** Lua compiler (saves bytecodes to files; also lists bytecodes) +** See Copyright Notice in lua.h +*/ + +#define luac_c +#define LUA_CORE + +#include "lprefix.h" + +#include +#include +#include +#include +#include + +#include "lua.h" +#include "lauxlib.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +static void PrintFunction(const Proto* f, int full); +#define luaU_print PrintFunction + +#define PROGNAME "luac" /* default program name */ +#define OUTPUT PROGNAME ".out" /* default output file */ + +static int listing=0; /* list bytecodes? */ +static int dumping=1; /* dump bytecodes? */ +static int stripping=0; /* strip debug information? */ +static char Output[]={ OUTPUT }; /* default output file name */ +static const char* output=Output; /* actual output file name */ +static const char* progname=PROGNAME; /* actual program name */ + +static void fatal(const char* message) +{ + fprintf(stderr,"%s: %s\n",progname,message); + exit(EXIT_FAILURE); +} + +static void cannot(const char* what) +{ + fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); + exit(EXIT_FAILURE); +} + +static void usage(const char* message) +{ + if (*message=='-') + fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); + else + fprintf(stderr,"%s: %s\n",progname,message); + fprintf(stderr, + "usage: %s [options] [filenames]\n" + "Available options are:\n" + " -l list (use -l -l for full listing)\n" + " -o name output to file 'name' (default is \"%s\")\n" + " -p parse only\n" + " -s strip debug information\n" + " -v show version information\n" + " -- stop handling options\n" + " - stop handling options and process stdin\n" + ,progname,Output); + exit(EXIT_FAILURE); +} + +#define IS(s) (strcmp(argv[i],s)==0) + +static int doargs(int argc, char* argv[]) +{ + int i; + int version=0; + if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; + for (i=1; itop+(i)) + +static const Proto* combine(lua_State* L, int n) +{ + if (n==1) + return toproto(L,-1); + else + { + Proto* f; + int i=n; + if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1)); + f=toproto(L,-1); + for (i=0; ip[i]=toproto(L,i-n-1); + if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0; + } + f->sizelineinfo=0; + return f; + } +} + +static int writer(lua_State* L, const void* p, size_t size, void* u) +{ + UNUSED(L); + return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); +} + +static int pmain(lua_State* L) +{ + int argc=(int)lua_tointeger(L,1); + char** argv=(char**)lua_touserdata(L,2); + const Proto* f; + int i; + if (!lua_checkstack(L,argc)) fatal("too many input files"); + for (i=0; i1); + if (dumping) + { + FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); + if (D==NULL) cannot("open"); + lua_lock(L); + luaU_dump(L,f,writer,D,stripping); + lua_unlock(L); + if (ferror(D)) cannot("write"); + if (fclose(D)) cannot("close"); + } + return 0; +} + +int main(int argc, char* argv[]) +{ + lua_State* L; + int i=doargs(argc,argv); + argc-=i; argv+=i; + if (argc<=0) usage("no input files given"); + L=luaL_newstate(); + if (L==NULL) fatal("cannot create state: not enough memory"); + lua_pushcfunction(L,&pmain); + lua_pushinteger(L,argc); + lua_pushlightuserdata(L,argv); + if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1)); + lua_close(L); + return EXIT_SUCCESS; +} + +/* +** $Id: luac.c,v 1.76 2018/06/19 01:32:02 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include +#include + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" + +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=tsslen(ts); + printf("%c",'"'); + for (i=0; ik[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMFLT: + { + char buff[100]; + sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); + printf("%s",buff); + if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); + break; + } + case LUA_TNUMINT: + printf(LUA_INTEGER_FMT,ivalue(o)); + break; + case LUA_TSHRSTR: case LUA_TLNGSTR: + PrintString(tsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") +#define MYK(x) (-1-(x)) + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (MYK(INDEXK(b))) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (MYK(INDEXK(c))) : c); + break; + case iABx: + printf("%d",a); + if (getBMode(o)==OpArgK) printf(" %d",MYK(bx)); + if (getBMode(o)==OpArgU) printf(" %d",bx); + break; + case iAsBx: + printf("%d %d",a,sbx); + break; + case iAx: + printf("%d",MYK(ax)); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s",UPVALNAME(b)); + break; + case OP_GETTABUP: + printf("\t; %s",UPVALNAME(b)); + if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABUP: + printf("\t; %s",UPVALNAME(a)); + if (ISK(b)) { printf(" "); PrintConstant(f,INDEXK(b)); } + if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_MOD: + case OP_POW: + case OP_DIV: + case OP_IDIV: + case OP_BAND: + case OP_BOR: + case OP_BXOR: + case OP_SHL: + case OP_SHR: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + case OP_TFORLOOP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); else printf("\t; %d",c); + break; + case OP_EXTRAARG: + printf("\t; "); PrintConstant(f,ax); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) ((x==1)?"":"s") +#define S(x) (int)(x),SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=f->source ? getstr(f->source) : "=?"; + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->sizeupvalues)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintDebug(const Proto* f) +{ + int i,n; + n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } + n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + for (i=0; iupvalues[i].instack,f->upvalues[i].idx); + } +} + +static void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) PrintDebug(f); + for (i=0; ip[i],full); +} diff --git a/deps/lua/src/luaconf.h b/deps/lua/src/luaconf.h new file mode 100644 index 0000000000..9eeeea69e2 --- /dev/null +++ b/deps/lua/src/luaconf.h @@ -0,0 +1,790 @@ +/* +** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef luaconf_h +#define luaconf_h + +#include +#include + + +/* +** =================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +** {==================================================================== +** System Configuration: macros to adapt (if needed) Lua to some +** particular platform, for instance compiling it with 32-bit numbers or +** restricting it to C89. +** ===================================================================== +*/ + +/* +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You +** can also define LUA_32BITS in the make file, but changing here you +** ensure that all software connected to Lua will be compiled with the +** same configuration. +*/ +/* #define LUA_32BITS */ + + +/* +@@ LUA_USE_C89 controls the use of non-ISO-C89 features. +** Define it if you want Lua to avoid the use of a few C99 features +** or Windows-specific features on Windows. +*/ +/* #define LUA_USE_C89 */ + + +/* +** By default, Lua on Windows use (some) specific Windows features +*/ +#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) +#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ +#endif + + +#if defined(LUA_USE_WINDOWS) +#define LUA_DL_DLL /* enable support for DLL */ +#define LUA_USE_C89 /* broadly, Windows is C89 */ +#endif + + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ +#define LUA_USE_READLINE /* needs an extra library: -lreadline */ +#endif + + +/* +@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for +** C89 ('long' and 'double'); Windows always has '__int64', so it does +** not need to use this case. +*/ +#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) +#define LUA_C89_NUMBERS +#endif + + + +/* +@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. +*/ +/* avoid undefined shifts */ +#if ((INT_MAX >> 15) >> 15) >= 1 +#define LUAI_BITSINT 32 +#else +/* 'int' always must have at least 16 bits */ +#define LUAI_BITSINT 16 +#endif + + +/* +@@ LUA_INT_TYPE defines the type for Lua integers. +@@ LUA_FLOAT_TYPE defines the type for Lua floats. +** Lua should work fine with any mix of these options (if supported +** by your C compiler). The usual configurations are 64-bit integers +** and 'double' (the default), 32-bit integers and 'float' (for +** restricted platforms), and 'long'/'double' (for C compilers not +** compliant with C99, which may not have support for 'long long'). +*/ + +/* predefined options for LUA_INT_TYPE */ +#define LUA_INT_INT 1 +#define LUA_INT_LONG 2 +#define LUA_INT_LONGLONG 3 + +/* predefined options for LUA_FLOAT_TYPE */ +#define LUA_FLOAT_FLOAT 1 +#define LUA_FLOAT_DOUBLE 2 +#define LUA_FLOAT_LONGDOUBLE 3 + +#if defined(LUA_32BITS) /* { */ +/* +** 32-bit integers and 'float' +*/ +#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ +#define LUA_INT_TYPE LUA_INT_INT +#else /* otherwise use 'long' */ +#define LUA_INT_TYPE LUA_INT_LONG +#endif +#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT + +#elif defined(LUA_C89_NUMBERS) /* }{ */ +/* +** largest types available for C89 ('long' and 'double') +*/ +#define LUA_INT_TYPE LUA_INT_LONG +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE + +#endif /* } */ + + +/* +** default configuration for 64-bit Lua ('long long' and 'double') +*/ +#if !defined(LUA_INT_TYPE) +#define LUA_INT_TYPE LUA_INT_LONGLONG +#endif + +#if !defined(LUA_FLOAT_TYPE) +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE +#endif + +/* }================================================================== */ + + + + +/* +** {================================================================== +** Configuration for Paths. +** =================================================================== +*/ + +/* +** LUA_PATH_SEP is the character that separates templates in a path. +** LUA_PATH_MARK is the string that marks the substitution points in a +** template. +** LUA_EXEC_DIR in a Windows path is replaced by the executable's +** directory. +*/ +#define LUA_PATH_SEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXEC_DIR "!" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +** Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +** C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#if defined(_WIN32) /* { */ +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ + LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ + ".\\?.lua;" ".\\?\\init.lua" +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.dll;" \ + LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ + LUA_CDIR"loadall.dll;" ".\\?.dll" + +#else /* }{ */ + +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" +#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ + "./?.lua;" "./?/init.lua" +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" +#endif /* } */ + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Marks for exported symbols in the C code +** =================================================================== +*/ + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all auxiliary library functions. +@@ LUAMOD_API is a mark for all standard library opening functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) /* { */ + +#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +#define LUA_API __declspec(dllexport) +#else /* }{ */ +#define LUA_API __declspec(dllimport) +#endif /* } */ + +#else /* }{ */ + +#define LUA_API extern + +#endif /* } */ + + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API +#define LUAMOD_API LUALIB_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +** exported to outside modules. +@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables +** that are not to be exported to outside modules (LUAI_DDEF for +** definitions and LUAI_DDEC for declarations). +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. Not all elf targets support +** this attribute. Unfortunately, gcc does not offer a way to check +** whether the target offers that support, and those without support +** give a warning about it. To avoid these warnings, change to the +** default definition. +*/ +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) /* { */ +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#else /* }{ */ +#define LUAI_FUNC extern +#endif /* } */ + +#define LUAI_DDEC LUAI_FUNC +#define LUAI_DDEF /* empty */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Compatibility with previous versions +** =================================================================== +*/ + +/* +@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. +@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. +** You can define it to get all options, or change specific options +** to fit your specific needs. +*/ +#if defined(LUA_COMPAT_5_2) /* { */ + +/* +@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated +** functions in the mathematical library. +*/ +#define LUA_COMPAT_MATHLIB + +/* +@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. +*/ +#define LUA_COMPAT_BITLIB + +/* +@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. +*/ +#define LUA_COMPAT_IPAIRS + +/* +@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for +** manipulating other integer types (lua_pushunsigned, lua_tounsigned, +** luaL_checkint, luaL_checklong, etc.) +*/ +#define LUA_COMPAT_APIINTCASTS + +#endif /* } */ + + +#if defined(LUA_COMPAT_5_1) /* { */ + +/* Incompatibilities from 5.2 -> 5.3 */ +#define LUA_COMPAT_MATHLIB +#define LUA_COMPAT_APIINTCASTS + +/* +@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. +** You can replace it with 'table.unpack'. +*/ +#define LUA_COMPAT_UNPACK + +/* +@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. +** You can replace it with 'package.searchers'. +*/ +#define LUA_COMPAT_LOADERS + +/* +@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. +** You can call your C function directly (with light C functions). +*/ +#define lua_cpcall(L,f,u) \ + (lua_pushcfunction(L, (f)), \ + lua_pushlightuserdata(L,(u)), \ + lua_pcall(L,1,0,0)) + + +/* +@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. +** You can rewrite 'log10(x)' as 'log(x, 10)'. +*/ +#define LUA_COMPAT_LOG10 + +/* +@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base +** library. You can rewrite 'loadstring(s)' as 'load(s)'. +*/ +#define LUA_COMPAT_LOADSTRING + +/* +@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. +*/ +#define LUA_COMPAT_MAXN + +/* +@@ The following macros supply trivial compatibility for some +** changes in the API. The macros themselves document how to +** change your code to avoid using them. +*/ +#define lua_strlen(L,i) lua_rawlen(L, (i)) + +#define lua_objlen(L,i) lua_rawlen(L, (i)) + +#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) + +/* +@@ LUA_COMPAT_MODULE controls compatibility with previous +** module functions 'module' (Lua) and 'luaL_register' (C). +*/ +#define LUA_COMPAT_MODULE + +#endif /* } */ + + +/* +@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a +@@ a float mark ('.0'). +** This macro is not on by default even in compatibility mode, +** because this is not really an incompatibility. +*/ +/* #define LUA_COMPAT_FLOATSTRING */ + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Numbers. +** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* +** satisfy your needs. +** =================================================================== +*/ + +/* +@@ LUA_NUMBER is the floating-point type used by Lua. +@@ LUAI_UACNUMBER is the result of a 'default argument promotion' +@@ over a floating number. +@@ l_mathlim(x) corrects limit name 'x' to the proper float type +** by prefixing it with one of FLT/DBL/LDBL. +@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. +@@ LUA_NUMBER_FMT is the format for writing floats. +@@ lua_number2str converts a float to a string. +@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. +@@ l_floor takes the floor of a float. +@@ lua_str2number converts a decimal numeric string to a number. +*/ + + +/* The following definitions are good for most cases here */ + +#define l_floor(x) (l_mathop(floor)(x)) + +#define lua_number2str(s,sz,n) \ + l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) + +/* +@@ lua_numbertointeger converts a float number to an integer, or +** returns 0 if float is not within the range of a lua_Integer. +** (The range comparisons are tricky because of rounding. The tests +** here assume a two-complement representation, where MININTEGER always +** has an exact representation as a float; MAXINTEGER may not have one, +** and therefore its conversion to float may have an ill-defined value.) +*/ +#define lua_numbertointeger(n,p) \ + ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ + (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ + (*(p) = (LUA_INTEGER)(n), 1)) + + +/* now the variable definitions */ + +#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ + +#define LUA_NUMBER float + +#define l_mathlim(n) (FLT_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.7g" + +#define l_mathop(op) op##f + +#define lua_str2number(s,p) strtof((s), (p)) + + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ + +#define LUA_NUMBER long double + +#define l_mathlim(n) (LDBL_##n) + +#define LUAI_UACNUMBER long double + +#define LUA_NUMBER_FRMLEN "L" +#define LUA_NUMBER_FMT "%.19Lg" + +#define l_mathop(op) op##l + +#define lua_str2number(s,p) strtold((s), (p)) + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ + +#define LUA_NUMBER double + +#define l_mathlim(n) (DBL_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.14g" + +#define l_mathop(op) op + +#define lua_str2number(s,p) strtod((s), (p)) + +#else /* }{ */ + +#error "numeric float type not defined" + +#endif /* } */ + + + +/* +@@ LUA_INTEGER is the integer type used by Lua. +** +@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. +** +@@ LUAI_UACINT is the result of a 'default argument promotion' +@@ over a lUA_INTEGER. +@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. +@@ LUA_INTEGER_FMT is the format for writing integers. +@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. +@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. +@@ lua_integer2str converts an integer to a string. +*/ + + +/* The following definitions are good for most cases here */ + +#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" + +#define LUAI_UACINT LUA_INTEGER + +#define lua_integer2str(s,sz,n) \ + l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) + +/* +** use LUAI_UACINT here to avoid problems with promotions (which +** can turn a comparison between unsigneds into a signed comparison) +*/ +#define LUA_UNSIGNED unsigned LUAI_UACINT + + +/* now the variable definitions */ + +#if LUA_INT_TYPE == LUA_INT_INT /* { int */ + +#define LUA_INTEGER int +#define LUA_INTEGER_FRMLEN "" + +#define LUA_MAXINTEGER INT_MAX +#define LUA_MININTEGER INT_MIN + +#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ + +#define LUA_INTEGER long +#define LUA_INTEGER_FRMLEN "l" + +#define LUA_MAXINTEGER LONG_MAX +#define LUA_MININTEGER LONG_MIN + +#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ + +/* use presence of macro LLONG_MAX as proxy for C99 compliance */ +#if defined(LLONG_MAX) /* { */ +/* use ISO C99 stuff */ + +#define LUA_INTEGER long long +#define LUA_INTEGER_FRMLEN "ll" + +#define LUA_MAXINTEGER LLONG_MAX +#define LUA_MININTEGER LLONG_MIN + +#elif defined(LUA_USE_WINDOWS) /* }{ */ +/* in Windows, can use specific Windows types */ + +#define LUA_INTEGER __int64 +#define LUA_INTEGER_FRMLEN "I64" + +#define LUA_MAXINTEGER _I64_MAX +#define LUA_MININTEGER _I64_MIN + +#else /* }{ */ + +#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ + or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" + +#endif /* } */ + +#else /* }{ */ + +#error "numeric integer type not defined" + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Dependencies with C99 and other C details +** =================================================================== +*/ + +/* +@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. +** (All uses in Lua have only one format item.) +*/ +#if !defined(LUA_USE_C89) +#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) +#else +#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) +#endif + + +/* +@@ lua_strx2number converts an hexadecimal numeric string to a number. +** In C99, 'strtod' does that conversion. Otherwise, you can +** leave 'lua_strx2number' undefined and Lua will provide its own +** implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_strx2number(s,p) lua_str2number(s,p) +#endif + + +/* +@@ lua_pointer2str converts a pointer to a readable string in a +** non-specified way. +*/ +#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) + + +/* +@@ lua_number2strx converts a float to an hexadecimal numeric string. +** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. +** Otherwise, you can leave 'lua_number2strx' undefined and Lua will +** provide its own implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_number2strx(L,b,sz,f,n) \ + ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) +#endif + + +/* +** 'strtof' and 'opf' variants for math functions are not valid in +** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the +** availability of these variants. ('math.h' is already included in +** all files that use these macros.) +*/ +#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) +#undef l_mathop /* variants not available */ +#undef lua_str2number +#define l_mathop(op) (lua_Number)op /* no variant */ +#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) +#endif + + +/* +@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation +** functions. It must be a numerical type; Lua will use 'intptr_t' if +** available, otherwise it will use 'ptrdiff_t' (the nearest thing to +** 'intptr_t' in C89) +*/ +#define LUA_KCONTEXT ptrdiff_t + +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include +#if defined(INTPTR_MAX) /* even in C99 this type is optional */ +#undef LUA_KCONTEXT +#define LUA_KCONTEXT intptr_t +#endif +#endif + + +/* +@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). +** Change that if you do not want to use C locales. (Code using this +** macro must include header 'locale.h'.) +*/ +#if !defined(lua_getlocaledecpoint) +#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Language Variations +** ===================================================================== +*/ + +/* +@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some +** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from +** numbers to strings. Define LUA_NOCVTS2N to turn off automatic +** coercion from strings to numbers. +*/ +/* #define LUA_NOCVTN2S */ +/* #define LUA_NOCVTS2N */ + + +/* +@@ LUA_USE_APICHECK turns on several consistency checks on the C API. +** Define it as a help when debugging C code. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(l,e) assert(e) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Macros that affect the API and must be stable (that is, must be the +** same when you compile Lua and when you compile code that links to +** Lua). You probably do not want/need to change them. +** ===================================================================== +*/ + +/* +@@ LUAI_MAXSTACK limits the size of the Lua stack. +** CHANGE it if you need a different limit. This limit is arbitrary; +** its only purpose is to stop Lua from consuming unlimited stack +** space (and to reserve some numbers for pseudo-indices). +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_MAXSTACK 1000000 +#else +#define LUAI_MAXSTACK 15000 +#endif + + +/* +@@ LUA_EXTRASPACE defines the size of a raw memory area associated with +** a Lua state with very fast access. +** CHANGE it if you need a different size. +*/ +#define LUA_EXTRASPACE (sizeof(void *)) + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@@ of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +** CHANGE it if it uses too much C-stack space. (For long double, +** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a +** smaller buffer would force a memory allocation for each call to +** 'string.format'.) +*/ +#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE +#define LUAL_BUFFERSIZE 8192 +#else +#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) +#endif + +/* }================================================================== */ + + +/* +@@ LUA_QL describes how error messages quote program elements. +** Lua does not use these macros anymore; they are here for +** compatibility only. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + + + +#endif + diff --git a/deps/lua/src/lualib.h b/deps/lua/src/lualib.h new file mode 100644 index 0000000000..f5304aa0dd --- /dev/null +++ b/deps/lua/src/lualib.h @@ -0,0 +1,61 @@ +/* +** $Id: lualib.h,v 1.45.1.1 2017/04/19 17:20:42 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* version suffix for environment variable names */ +#define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR + + +LUAMOD_API int (luaopen_base) (lua_State *L); + +#define LUA_COLIBNAME "coroutine" +LUAMOD_API int (luaopen_coroutine) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUAMOD_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUAMOD_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUAMOD_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUAMOD_API int (luaopen_string) (lua_State *L); + +#define LUA_UTF8LIBNAME "utf8" +LUAMOD_API int (luaopen_utf8) (lua_State *L); + +#define LUA_BITLIBNAME "bit32" +LUAMOD_API int (luaopen_bit32) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUAMOD_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUAMOD_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUAMOD_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#if !defined(lua_assert) +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/deps/lua/src/lundump.c b/deps/lua/src/lundump.c new file mode 100644 index 0000000000..7a67d75aaa --- /dev/null +++ b/deps/lua/src/lundump.c @@ -0,0 +1,279 @@ +/* +** $Id: lundump.c,v 2.44.1.1 2017/04/19 17:20:42 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#define lundump_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + + +#if !defined(luai_verifycode) +#define luai_verifycode(L,b,f) /* empty */ +#endif + + +typedef struct { + lua_State *L; + ZIO *Z; + const char *name; +} LoadState; + + +static l_noret error(LoadState *S, const char *why) { + luaO_pushfstring(S->L, "%s: %s precompiled chunk", S->name, why); + luaD_throw(S->L, LUA_ERRSYNTAX); +} + + +/* +** All high-level loads go through LoadVector; you can change it to +** adapt to the endianness of the input +*/ +#define LoadVector(S,b,n) LoadBlock(S,b,(n)*sizeof((b)[0])) + +static void LoadBlock (LoadState *S, void *b, size_t size) { + if (luaZ_read(S->Z, b, size) != 0) + error(S, "truncated"); +} + + +#define LoadVar(S,x) LoadVector(S,&x,1) + + +static lu_byte LoadByte (LoadState *S) { + lu_byte x; + LoadVar(S, x); + return x; +} + + +static int LoadInt (LoadState *S) { + int x; + LoadVar(S, x); + return x; +} + + +static lua_Number LoadNumber (LoadState *S) { + lua_Number x; + LoadVar(S, x); + return x; +} + + +static lua_Integer LoadInteger (LoadState *S) { + lua_Integer x; + LoadVar(S, x); + return x; +} + + +static TString *LoadString (LoadState *S) { + size_t size = LoadByte(S); + if (size == 0xFF) + LoadVar(S, size); + if (size == 0) + return NULL; + else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ + char buff[LUAI_MAXSHORTLEN]; + LoadVector(S, buff, size); + return luaS_newlstr(S->L, buff, size); + } + else { /* long string */ + TString *ts = luaS_createlngstrobj(S->L, size); + LoadVector(S, getstr(ts), size); /* load directly in final place */ + return ts; + } +} + + +static void LoadCode (LoadState *S, Proto *f) { + int n = LoadInt(S); + f->code = luaM_newvector(S->L, n, Instruction); + f->sizecode = n; + LoadVector(S, f->code, n); +} + + +static void LoadFunction(LoadState *S, Proto *f, TString *psource); + + +static void LoadConstants (LoadState *S, Proto *f) { + int i; + int n = LoadInt(S); + f->k = luaM_newvector(S->L, n, TValue); + f->sizek = n; + for (i = 0; i < n; i++) + setnilvalue(&f->k[i]); + for (i = 0; i < n; i++) { + TValue *o = &f->k[i]; + int t = LoadByte(S); + switch (t) { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o, LoadByte(S)); + break; + case LUA_TNUMFLT: + setfltvalue(o, LoadNumber(S)); + break; + case LUA_TNUMINT: + setivalue(o, LoadInteger(S)); + break; + case LUA_TSHRSTR: + case LUA_TLNGSTR: + setsvalue2n(S->L, o, LoadString(S)); + break; + default: + lua_assert(0); + } + } +} + + +static void LoadProtos (LoadState *S, Proto *f) { + int i; + int n = LoadInt(S); + f->p = luaM_newvector(S->L, n, Proto *); + f->sizep = n; + for (i = 0; i < n; i++) + f->p[i] = NULL; + for (i = 0; i < n; i++) { + f->p[i] = luaF_newproto(S->L); + LoadFunction(S, f->p[i], f->source); + } +} + + +static void LoadUpvalues (LoadState *S, Proto *f) { + int i, n; + n = LoadInt(S); + f->upvalues = luaM_newvector(S->L, n, Upvaldesc); + f->sizeupvalues = n; + for (i = 0; i < n; i++) + f->upvalues[i].name = NULL; + for (i = 0; i < n; i++) { + f->upvalues[i].instack = LoadByte(S); + f->upvalues[i].idx = LoadByte(S); + } +} + + +static void LoadDebug (LoadState *S, Proto *f) { + int i, n; + n = LoadInt(S); + f->lineinfo = luaM_newvector(S->L, n, int); + f->sizelineinfo = n; + LoadVector(S, f->lineinfo, n); + n = LoadInt(S); + f->locvars = luaM_newvector(S->L, n, LocVar); + f->sizelocvars = n; + for (i = 0; i < n; i++) + f->locvars[i].varname = NULL; + for (i = 0; i < n; i++) { + f->locvars[i].varname = LoadString(S); + f->locvars[i].startpc = LoadInt(S); + f->locvars[i].endpc = LoadInt(S); + } + n = LoadInt(S); + for (i = 0; i < n; i++) + f->upvalues[i].name = LoadString(S); +} + + +static void LoadFunction (LoadState *S, Proto *f, TString *psource) { + f->source = LoadString(S); + if (f->source == NULL) /* no source in dump? */ + f->source = psource; /* reuse parent's source */ + f->linedefined = LoadInt(S); + f->lastlinedefined = LoadInt(S); + f->numparams = LoadByte(S); + f->is_vararg = LoadByte(S); + f->maxstacksize = LoadByte(S); + LoadCode(S, f); + LoadConstants(S, f); + LoadUpvalues(S, f); + LoadProtos(S, f); + LoadDebug(S, f); +} + + +static void checkliteral (LoadState *S, const char *s, const char *msg) { + char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ + size_t len = strlen(s); + LoadVector(S, buff, len); + if (memcmp(s, buff, len) != 0) + error(S, msg); +} + + +static void fchecksize (LoadState *S, size_t size, const char *tname) { + if (LoadByte(S) != size) + error(S, luaO_pushfstring(S->L, "%s size mismatch in", tname)); +} + + +#define checksize(S,t) fchecksize(S,sizeof(t),#t) + +static void checkHeader (LoadState *S) { + checkliteral(S, LUA_SIGNATURE + 1, "not a"); /* 1st char already checked */ + if (LoadByte(S) != LUAC_VERSION) + error(S, "version mismatch in"); + if (LoadByte(S) != LUAC_FORMAT) + error(S, "format mismatch in"); + checkliteral(S, LUAC_DATA, "corrupted"); + checksize(S, int); + checksize(S, size_t); + checksize(S, Instruction); + checksize(S, lua_Integer); + checksize(S, lua_Number); + if (LoadInteger(S) != LUAC_INT) + error(S, "endianness mismatch in"); + if (LoadNumber(S) != LUAC_NUM) + error(S, "float format mismatch in"); +} + + +/* +** load precompiled chunk +*/ +LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) { + LoadState S; + LClosure *cl; + if (*name == '@' || *name == '=') + S.name = name + 1; + else if (*name == LUA_SIGNATURE[0]) + S.name = "binary string"; + else + S.name = name; + S.L = L; + S.Z = Z; + checkHeader(&S); + cl = luaF_newLclosure(L, LoadByte(&S)); + setclLvalue(L, L->top, cl); + luaD_inctop(L); + cl->p = luaF_newproto(L); + LoadFunction(&S, cl->p, NULL); + lua_assert(cl->nupvalues == cl->p->sizeupvalues); + luai_verifycode(L, buff, cl->p); + return cl; +} + diff --git a/deps/lua/src/lundump.h b/deps/lua/src/lundump.h new file mode 100644 index 0000000000..ce492d689c --- /dev/null +++ b/deps/lua/src/lundump.h @@ -0,0 +1,32 @@ +/* +** $Id: lundump.h,v 1.45.1.1 2017/04/19 17:20:42 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* data to catch conversion errors */ +#define LUAC_DATA "\x19\x93\r\n\x1a\n" + +#define LUAC_INT 0x5678 +#define LUAC_NUM cast_num(370.5) + +#define MYINT(s) (s[0]-'0') +#define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) +#define LUAC_FORMAT 0 /* this is the official format */ + +/* load one chunk; from lundump.c */ +LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, + void* data, int strip); + +#endif diff --git a/deps/lua/src/lutf8lib.c b/deps/lua/src/lutf8lib.c new file mode 100644 index 0000000000..10bd238a71 --- /dev/null +++ b/deps/lua/src/lutf8lib.c @@ -0,0 +1,256 @@ +/* +** $Id: lutf8lib.c,v 1.16.1.1 2017/04/19 17:29:57 roberto Exp $ +** Standard library for UTF-8 manipulation +** See Copyright Notice in lua.h +*/ + +#define lutf8lib_c +#define LUA_LIB + +#include "lprefix.h" + + +#include +#include +#include +#include + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + +#define MAXUNICODE 0x10FFFF + +#define iscont(p) ((*(p) & 0xC0) == 0x80) + + +/* from strlib */ +/* translate a relative string position: negative means back from end */ +static lua_Integer u_posrelat (lua_Integer pos, size_t len) { + if (pos >= 0) return pos; + else if (0u - (size_t)pos > len) return 0; + else return (lua_Integer)len + pos + 1; +} + + +/* +** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. +*/ +static const char *utf8_decode (const char *o, int *val) { + static const unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; + const unsigned char *s = (const unsigned char *)o; + unsigned int c = s[0]; + unsigned int res = 0; /* final result */ + if (c < 0x80) /* ascii? */ + res = c; + else { + int count = 0; /* to count number of continuation bytes */ + while (c & 0x40) { /* still have continuation bytes? */ + int cc = s[++count]; /* read next byte */ + if ((cc & 0xC0) != 0x80) /* not a continuation byte? */ + return NULL; /* invalid byte sequence */ + res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ + c <<= 1; /* to test next bit */ + } + res |= ((c & 0x7F) << (count * 5)); /* add first byte */ + if (count > 3 || res > MAXUNICODE || res <= limits[count]) + return NULL; /* invalid byte sequence */ + s += count; /* skip continuation bytes read */ + } + if (val) *val = res; + return (const char *)s + 1; /* +1 to include first byte */ +} + + +/* +** utf8len(s [, i [, j]]) --> number of characters that start in the +** range [i,j], or nil + current position if 's' is not well formed in +** that interval +*/ +static int utflen (lua_State *L) { + int n = 0; + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); + lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); + luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, + "initial position out of string"); + luaL_argcheck(L, --posj < (lua_Integer)len, 3, + "final position out of string"); + while (posi <= posj) { + const char *s1 = utf8_decode(s + posi, NULL); + if (s1 == NULL) { /* conversion error? */ + lua_pushnil(L); /* return nil ... */ + lua_pushinteger(L, posi + 1); /* ... and current position */ + return 2; + } + posi = s1 - s; + n++; + } + lua_pushinteger(L, n); + return 1; +} + + +/* +** codepoint(s, [i, [j]]) -> returns codepoints for all characters +** that start in the range [i,j] +*/ +static int codepoint (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); + lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); + int n; + const char *se; + luaL_argcheck(L, posi >= 1, 2, "out of range"); + luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of range"); + if (posi > pose) return 0; /* empty interval; return no values */ + if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ + return luaL_error(L, "string slice too long"); + n = (int)(pose - posi) + 1; + luaL_checkstack(L, n, "string slice too long"); + n = 0; + se = s + pose; + for (s += posi - 1; s < se;) { + int code; + s = utf8_decode(s, &code); + if (s == NULL) + return luaL_error(L, "invalid UTF-8 code"); + lua_pushinteger(L, code); + n++; + } + return n; +} + + +static void pushutfchar (lua_State *L, int arg) { + lua_Integer code = luaL_checkinteger(L, arg); + luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); + lua_pushfstring(L, "%U", (long)code); +} + + +/* +** utfchar(n1, n2, ...) -> char(n1)..char(n2)... +*/ +static int utfchar (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + if (n == 1) /* optimize common case of single char */ + pushutfchar(L, 1); + else { + int i; + luaL_Buffer b; + luaL_buffinit(L, &b); + for (i = 1; i <= n; i++) { + pushutfchar(L, i); + luaL_addvalue(&b); + } + luaL_pushresult(&b); + } + return 1; +} + + +/* +** offset(s, n, [i]) -> index where n-th character counting from +** position 'i' starts; 0 means character at 'i'. +*/ +static int byteoffset (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer n = luaL_checkinteger(L, 2); + lua_Integer posi = (n >= 0) ? 1 : len + 1; + posi = u_posrelat(luaL_optinteger(L, 3, posi), len); + luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, + "position out of range"); + if (n == 0) { + /* find beginning of current byte sequence */ + while (posi > 0 && iscont(s + posi)) posi--; + } + else { + if (iscont(s + posi)) + return luaL_error(L, "initial position is a continuation byte"); + if (n < 0) { + while (n < 0 && posi > 0) { /* move back */ + do { /* find beginning of previous character */ + posi--; + } while (posi > 0 && iscont(s + posi)); + n++; + } + } + else { + n--; /* do not move for 1st character */ + while (n > 0 && posi < (lua_Integer)len) { + do { /* find beginning of next character */ + posi++; + } while (iscont(s + posi)); /* (cannot pass final '\0') */ + n--; + } + } + } + if (n == 0) /* did it find given character? */ + lua_pushinteger(L, posi + 1); + else /* no such character */ + lua_pushnil(L); + return 1; +} + + +static int iter_aux (lua_State *L) { + size_t len; + const char *s = luaL_checklstring(L, 1, &len); + lua_Integer n = lua_tointeger(L, 2) - 1; + if (n < 0) /* first iteration? */ + n = 0; /* start from here */ + else if (n < (lua_Integer)len) { + n++; /* skip current byte */ + while (iscont(s + n)) n++; /* and its continuations */ + } + if (n >= (lua_Integer)len) + return 0; /* no more codepoints */ + else { + int code; + const char *next = utf8_decode(s + n, &code); + if (next == NULL || iscont(next)) + return luaL_error(L, "invalid UTF-8 code"); + lua_pushinteger(L, n + 1); + lua_pushinteger(L, code); + return 2; + } +} + + +static int iter_codes (lua_State *L) { + luaL_checkstring(L, 1); + lua_pushcfunction(L, iter_aux); + lua_pushvalue(L, 1); + lua_pushinteger(L, 0); + return 3; +} + + +/* pattern to match a single UTF-8 character */ +#define UTF8PATT "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" + + +static const luaL_Reg funcs[] = { + {"offset", byteoffset}, + {"codepoint", codepoint}, + {"char", utfchar}, + {"len", utflen}, + {"codes", iter_codes}, + /* placeholders */ + {"charpattern", NULL}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_utf8 (lua_State *L) { + luaL_newlib(L, funcs); + lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT)/sizeof(char) - 1); + lua_setfield(L, -2, "charpattern"); + return 1; +} + diff --git a/deps/lua/src/lvm.c b/deps/lua/src/lvm.c new file mode 100644 index 0000000000..cc43d8714d --- /dev/null +++ b/deps/lua/src/lvm.c @@ -0,0 +1,1322 @@ +/* +** $Id: lvm.c,v 2.268.1.1 2017/04/19 17:39:34 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#define lvm_c +#define LUA_CORE + +#include "lprefix.h" + +#include +#include +#include +#include +#include +#include + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 2000 + + + +/* +** 'l_intfitsf' checks whether a given integer can be converted to a +** float without rounding. Used in comparisons. Left undefined if +** all integers fit in a float precisely. +*/ +#if !defined(l_intfitsf) + +/* number of bits in the mantissa of a float */ +#define NBM (l_mathlim(MANT_DIG)) + +/* +** Check whether some integers may not fit in a float, that is, whether +** (maxinteger >> NBM) > 0 (that implies (1 << NBM) <= maxinteger). +** (The shifts are done in parts to avoid shifting by more than the size +** of an integer. In a worst case, NBM == 113 for long double and +** sizeof(integer) == 32.) +*/ +#if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \ + >> (NBM - (3 * (NBM / 4)))) > 0 + +#define l_intfitsf(i) \ + (-((lua_Integer)1 << NBM) <= (i) && (i) <= ((lua_Integer)1 << NBM)) + +#endif + +#endif + + + +/* +** Try to convert a value to a float. The float case is already handled +** by the macro 'tonumber'. +*/ +int luaV_tonumber_ (const TValue *obj, lua_Number *n) { + TValue v; + if (ttisinteger(obj)) { + *n = cast_num(ivalue(obj)); + return 1; + } + else if (cvt2num(obj) && /* string convertible to number? */ + luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { + *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */ + return 1; + } + else + return 0; /* conversion failed */ +} + + +/* +** try to convert a value to an integer, rounding according to 'mode': +** mode == 0: accepts only integral values +** mode == 1: takes the floor of the number +** mode == 2: takes the ceil of the number +*/ +int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode) { + TValue v; + again: + if (ttisfloat(obj)) { + lua_Number n = fltvalue(obj); + lua_Number f = l_floor(n); + if (n != f) { /* not an integral value? */ + if (mode == 0) return 0; /* fails if mode demands integral value */ + else if (mode > 1) /* needs ceil? */ + f += 1; /* convert floor to ceil (remember: n != f) */ + } + return lua_numbertointeger(f, p); + } + else if (ttisinteger(obj)) { + *p = ivalue(obj); + return 1; + } + else if (cvt2num(obj) && + luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { + obj = &v; + goto again; /* convert result from 'luaO_str2num' to an integer */ + } + return 0; /* conversion failed */ +} + + +/* +** Try to convert a 'for' limit to an integer, preserving the +** semantics of the loop. +** (The following explanation assumes a non-negative step; it is valid +** for negative steps mutatis mutandis.) +** If the limit can be converted to an integer, rounding down, that is +** it. +** Otherwise, check whether the limit can be converted to a number. If +** the number is too large, it is OK to set the limit as LUA_MAXINTEGER, +** which means no limit. If the number is too negative, the loop +** should not run, because any initial integer value is larger than the +** limit. So, it sets the limit to LUA_MININTEGER. 'stopnow' corrects +** the extreme case when the initial value is LUA_MININTEGER, in which +** case the LUA_MININTEGER limit would still run the loop once. +*/ +static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step, + int *stopnow) { + *stopnow = 0; /* usually, let loops run */ + if (!luaV_tointeger(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */ + lua_Number n; /* try to convert to float */ + if (!tonumber(obj, &n)) /* cannot convert to float? */ + return 0; /* not a number */ + if (luai_numlt(0, n)) { /* if true, float is larger than max integer */ + *p = LUA_MAXINTEGER; + if (step < 0) *stopnow = 1; + } + else { /* float is smaller than min integer */ + *p = LUA_MININTEGER; + if (step >= 0) *stopnow = 1; + } + } + return 1; +} + + +/* +** Finish the table access 'val = t[key]'. +** if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to +** t[k] entry (which must be nil). +*/ +void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val, + const TValue *slot) { + int loop; /* counter to avoid infinite loops */ + const TValue *tm; /* metamethod */ + for (loop = 0; loop < MAXTAGLOOP; loop++) { + if (slot == NULL) { /* 't' is not a table? */ + lua_assert(!ttistable(t)); + tm = luaT_gettmbyobj(L, t, TM_INDEX); + if (ttisnil(tm)) + luaG_typeerror(L, t, "index"); /* no metamethod */ + /* else will try the metamethod */ + } + else { /* 't' is a table */ + lua_assert(ttisnil(slot)); + tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); /* table's metamethod */ + if (tm == NULL) { /* no metamethod? */ + setnilvalue(val); /* result is nil */ + return; + } + /* else will try the metamethod */ + } + if (ttisfunction(tm)) { /* is metamethod a function? */ + luaT_callTM(L, tm, t, key, val, 1); /* call it */ + return; + } + t = tm; /* else try to access 'tm[key]' */ + if (luaV_fastget(L,t,key,slot,luaH_get)) { /* fast track? */ + setobj2s(L, val, slot); /* done */ + return; + } + /* else repeat (tail call 'luaV_finishget') */ + } + luaG_runerror(L, "'__index' chain too long; possible loop"); +} + + +/* +** Finish a table assignment 't[key] = val'. +** If 'slot' is NULL, 't' is not a table. Otherwise, 'slot' points +** to the entry 't[key]', or to 'luaO_nilobject' if there is no such +** entry. (The value at 'slot' must be nil, otherwise 'luaV_fastset' +** would have done the job.) +*/ +void luaV_finishset (lua_State *L, const TValue *t, TValue *key, + StkId val, const TValue *slot) { + int loop; /* counter to avoid infinite loops */ + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; /* '__newindex' metamethod */ + if (slot != NULL) { /* is 't' a table? */ + Table *h = hvalue(t); /* save 't' table */ + lua_assert(ttisnil(slot)); /* old value must be nil */ + tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */ + if (tm == NULL) { /* no metamethod? */ + if (slot == luaO_nilobject) /* no previous entry? */ + slot = luaH_newkey(L, h, key); /* create one */ + /* no metamethod and (now) there is an entry with given key */ + setobj2t(L, cast(TValue *, slot), val); /* set its new value */ + invalidateTMcache(h); + luaC_barrierback(L, h, val); + return; + } + /* else will try the metamethod */ + } + else { /* not a table; check metamethod */ + if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + } + /* try the metamethod */ + if (ttisfunction(tm)) { + luaT_callTM(L, tm, t, key, val, 0); + return; + } + t = tm; /* else repeat assignment over 'tm' */ + if (luaV_fastset(L, t, key, slot, luaH_get, val)) + return; /* done */ + /* else loop */ + } + luaG_runerror(L, "'__newindex' chain too long; possible loop"); +} + + +/* +** Compare two strings 'ls' x 'rs', returning an integer smaller-equal- +** -larger than zero if 'ls' is smaller-equal-larger than 'rs'. +** The code is a little tricky because it allows '\0' in the strings +** and it uses 'strcoll' (to respect locales) for each segments +** of the strings. +*/ +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = tsslen(ls); + const char *r = getstr(rs); + size_t lr = tsslen(rs); + for (;;) { /* for each segment */ + int temp = strcoll(l, r); + if (temp != 0) /* not equal? */ + return temp; /* done */ + else { /* strings are equal up to a '\0' */ + size_t len = strlen(l); /* index of first '\0' in both strings */ + if (len == lr) /* 'rs' is finished? */ + return (len == ll) ? 0 : 1; /* check 'ls' */ + else if (len == ll) /* 'ls' is finished? */ + return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */ + /* both strings longer than 'len'; go on comparing after the '\0' */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +/* +** Check whether integer 'i' is less than float 'f'. If 'i' has an +** exact representation as a float ('l_intfitsf'), compare numbers as +** floats. Otherwise, if 'f' is outside the range for integers, result +** is trivial. Otherwise, compare them as integers. (When 'i' has no +** float representation, either 'f' is "far away" from 'i' or 'f' has +** no precision left for a fractional part; either way, how 'f' is +** truncated is irrelevant.) When 'f' is NaN, comparisons must result +** in false. +*/ +static int LTintfloat (lua_Integer i, lua_Number f) { +#if defined(l_intfitsf) + if (!l_intfitsf(i)) { + if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ + return 1; /* f >= maxint + 1 > i */ + else if (f > cast_num(LUA_MININTEGER)) /* minint < f <= maxint ? */ + return (i < cast(lua_Integer, f)); /* compare them as integers */ + else /* f <= minint <= i (or 'f' is NaN) --> not(i < f) */ + return 0; + } +#endif + return luai_numlt(cast_num(i), f); /* compare them as floats */ +} + + +/* +** Check whether integer 'i' is less than or equal to float 'f'. +** See comments on previous function. +*/ +static int LEintfloat (lua_Integer i, lua_Number f) { +#if defined(l_intfitsf) + if (!l_intfitsf(i)) { + if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ + return 1; /* f >= maxint + 1 > i */ + else if (f >= cast_num(LUA_MININTEGER)) /* minint <= f <= maxint ? */ + return (i <= cast(lua_Integer, f)); /* compare them as integers */ + else /* f < minint <= i (or 'f' is NaN) --> not(i <= f) */ + return 0; + } +#endif + return luai_numle(cast_num(i), f); /* compare them as floats */ +} + + +/* +** Return 'l < r', for numbers. +*/ +static int LTnum (const TValue *l, const TValue *r) { + if (ttisinteger(l)) { + lua_Integer li = ivalue(l); + if (ttisinteger(r)) + return li < ivalue(r); /* both are integers */ + else /* 'l' is int and 'r' is float */ + return LTintfloat(li, fltvalue(r)); /* l < r ? */ + } + else { + lua_Number lf = fltvalue(l); /* 'l' must be float */ + if (ttisfloat(r)) + return luai_numlt(lf, fltvalue(r)); /* both are float */ + else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ + return 0; /* NaN < i is always false */ + else /* without NaN, (l < r) <--> not(r <= l) */ + return !LEintfloat(ivalue(r), lf); /* not (r <= l) ? */ + } +} + + +/* +** Return 'l <= r', for numbers. +*/ +static int LEnum (const TValue *l, const TValue *r) { + if (ttisinteger(l)) { + lua_Integer li = ivalue(l); + if (ttisinteger(r)) + return li <= ivalue(r); /* both are integers */ + else /* 'l' is int and 'r' is float */ + return LEintfloat(li, fltvalue(r)); /* l <= r ? */ + } + else { + lua_Number lf = fltvalue(l); /* 'l' must be float */ + if (ttisfloat(r)) + return luai_numle(lf, fltvalue(r)); /* both are float */ + else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ + return 0; /* NaN <= i is always false */ + else /* without NaN, (l <= r) <--> not(r < l) */ + return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */ + } +} + + +/* +** Main operation less than; return 'l < r'. +*/ +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */ + return LTnum(l, r); + else if (ttisstring(l) && ttisstring(r)) /* both are strings? */ + return l_strcmp(tsvalue(l), tsvalue(r)) < 0; + else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) /* no metamethod? */ + luaG_ordererror(L, l, r); /* error */ + return res; +} + + +/* +** Main operation less than or equal to; return 'l <= r'. If it needs +** a metamethod and there is no '__le', try '__lt', based on +** l <= r iff !(r < l) (assuming a total order). If the metamethod +** yields during this substitution, the continuation has to know +** about it (to negate the result of r= 0) /* try 'le' */ + return res; + else { /* try 'lt': */ + L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ + res = luaT_callorderTM(L, r, l, TM_LT); + L->ci->callstatus ^= CIST_LEQ; /* clear mark */ + if (res < 0) + luaG_ordererror(L, l, r); + return !res; /* result is negated */ + } +} + + +/* +** Main operation for equality of Lua values; return 't1 == t2'. +** L == NULL means raw equality (no metamethods) +*/ +int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + if (ttype(t1) != ttype(t2)) { /* not the same variant? */ + if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER) + return 0; /* only numbers can be equal with different variants */ + else { /* two numbers with different variants */ + lua_Integer i1, i2; /* compare them as integers */ + return (tointeger(t1, &i1) && tointeger(t2, &i2) && i1 == i2); + } + } + /* values have same type and same variant */ + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); + case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TLCF: return fvalue(t1) == fvalue(t2); + case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); + case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2)); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + else if (L == NULL) return 0; + tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); + if (tm == NULL) + tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + else if (L == NULL) return 0; + tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); + if (tm == NULL) + tm = fasttm(L, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: + return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) /* no TM? */ + return 0; /* objects are different */ + luaT_callTM(L, tm, t1, t2, L->top, 1); /* call TM */ + return !l_isfalse(L->top); +} + + +/* macro used by 'luaV_concat' to ensure that element at 'o' is a string */ +#define tostring(L,o) \ + (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) + +#define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) + +/* copy strings in stack from top - n up to top - 1 to buffer */ +static void copy2buff (StkId top, int n, char *buff) { + size_t tl = 0; /* size already copied */ + do { + size_t l = vslen(top - n); /* length of string being copied */ + memcpy(buff + tl, svalue(top - n), l * sizeof(char)); + tl += l; + } while (--n > 0); +} + + +/* +** Main operation for concatenation: concat 'total' values in the stack, +** from 'L->top - total' up to 'L->top - 1'. +*/ +void luaV_concat (lua_State *L, int total) { + lua_assert(total >= 2); + do { + StkId top = L->top; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || cvt2str(top-2)) || !tostring(L, top-1)) + luaT_trybinTM(L, top-2, top-1, top-2, TM_CONCAT); + else if (isemptystr(top - 1)) /* second operand is empty? */ + cast_void(tostring(L, top - 2)); /* result is first operand */ + else if (isemptystr(top - 2)) { /* first operand is an empty string? */ + setobjs2s(L, top - 2, top - 1); /* result is second op. */ + } + else { + /* at least two non-empty string values; get as many as possible */ + size_t tl = vslen(top - 1); + TString *ts; + /* collect total length and number of strings */ + for (n = 1; n < total && tostring(L, top - n - 1); n++) { + size_t l = vslen(top - n - 1); + if (l >= (MAX_SIZE/sizeof(char)) - tl) + luaG_runerror(L, "string length overflow"); + tl += l; + } + if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */ + char buff[LUAI_MAXSHORTLEN]; + copy2buff(top, n, buff); /* copy strings to buffer */ + ts = luaS_newlstr(L, buff, tl); + } + else { /* long string; copy strings directly to final result */ + ts = luaS_createlngstrobj(L, tl); + copy2buff(top, n, getstr(ts)); + } + setsvalue2s(L, top - n, ts); /* create result */ + } + total -= n-1; /* got 'n' strings to create 1 new */ + L->top -= n-1; /* popped 'n' strings and pushed one */ + } while (total > 1); /* repeat until only 1 result left */ +} + + +/* +** Main operation 'ra' = #rb'. +*/ +void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { + const TValue *tm; + switch (ttype(rb)) { + case LUA_TTABLE: { + Table *h = hvalue(rb); + tm = fasttm(L, h->metatable, TM_LEN); + if (tm) break; /* metamethod? break switch to call it */ + setivalue(ra, luaH_getn(h)); /* else primitive len */ + return; + } + case LUA_TSHRSTR: { + setivalue(ra, tsvalue(rb)->shrlen); + return; + } + case LUA_TLNGSTR: { + setivalue(ra, tsvalue(rb)->u.lnglen); + return; + } + default: { /* try metamethod */ + tm = luaT_gettmbyobj(L, rb, TM_LEN); + if (ttisnil(tm)) /* no metamethod? */ + luaG_typeerror(L, rb, "get length of"); + break; + } + } + luaT_callTM(L, tm, rb, rb, ra, 1); +} + + +/* +** Integer division; return 'm // n', that is, floor(m/n). +** C division truncates its result (rounds towards zero). +** 'floor(q) == trunc(q)' when 'q >= 0' or when 'q' is integer, +** otherwise 'floor(q) == trunc(q) - 1'. +*/ +lua_Integer luaV_div (lua_State *L, lua_Integer m, lua_Integer n) { + if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ + if (n == 0) + luaG_runerror(L, "attempt to divide by zero"); + return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */ + } + else { + lua_Integer q = m / n; /* perform C division */ + if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */ + q -= 1; /* correct result for different rounding */ + return q; + } +} + + +/* +** Integer modulus; return 'm % n'. (Assume that C '%' with +** negative operands follows C99 behavior. See previous comment +** about luaV_div.) +*/ +lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) { + if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ + if (n == 0) + luaG_runerror(L, "attempt to perform 'n%%0'"); + return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */ + } + else { + lua_Integer r = m % n; + if (r != 0 && (m ^ n) < 0) /* 'm/n' would be non-integer negative? */ + r += n; /* correct result for different rounding */ + return r; + } +} + + +/* number of bits in an integer */ +#define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT) + +/* +** Shift left operation. (Shift right just negates 'y'.) +*/ +lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { + if (y < 0) { /* shift right? */ + if (y <= -NBITS) return 0; + else return intop(>>, x, -y); + } + else { /* shift left */ + if (y >= NBITS) return 0; + else return intop(<<, x, y); + } +} + + +/* +** check whether cached closure in prototype 'p' may be reused, that is, +** whether there is a cached closure with the same upvalues needed by +** new closure to be created. +*/ +static LClosure *getcached (Proto *p, UpVal **encup, StkId base) { + LClosure *c = p->cache; + if (c != NULL) { /* is there a cached closure? */ + int nup = p->sizeupvalues; + Upvaldesc *uv = p->upvalues; + int i; + for (i = 0; i < nup; i++) { /* check whether it has right upvalues */ + TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v; + if (c->upvals[i]->v != v) + return NULL; /* wrong upvalue; cannot reuse closure */ + } + } + return c; /* return cached closure (or NULL if no cached closure) */ +} + + +/* +** create a new Lua closure, push it in the stack, and initialize +** its upvalues. Note that the closure is not cached if prototype is +** already black (which means that 'cache' was already cleared by the +** GC). +*/ +static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, + StkId ra) { + int nup = p->sizeupvalues; + Upvaldesc *uv = p->upvalues; + int i; + LClosure *ncl = luaF_newLclosure(L, nup); + ncl->p = p; + setclLvalue(L, ra, ncl); /* anchor new closure in stack */ + for (i = 0; i < nup; i++) { /* fill in its upvalues */ + if (uv[i].instack) /* upvalue refers to local variable? */ + ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); + else /* get upvalue from enclosing function */ + ncl->upvals[i] = encup[uv[i].idx]; + ncl->upvals[i]->refcount++; + /* new closure is white, so we do not need a barrier here */ + } + if (!isblack(p)) /* cache will not break GC invariant? */ + p->cache = ncl; /* save it on cache for reuse */ +} + + +/* +** finish execution of an opcode interrupted by an yield +*/ +void luaV_finishOp (lua_State *L) { + CallInfo *ci = L->ci; + StkId base = ci->u.l.base; + Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ + OpCode op = GET_OPCODE(inst); + switch (op) { /* finish its execution */ + case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV: + case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: + case OP_MOD: case OP_POW: + case OP_UNM: case OP_BNOT: case OP_LEN: + case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { + setobjs2s(L, base + GETARG_A(inst), --L->top); + break; + } + case OP_LE: case OP_LT: case OP_EQ: { + int res = !l_isfalse(L->top - 1); + L->top--; + if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ + lua_assert(op == OP_LE); + ci->callstatus ^= CIST_LEQ; /* clear mark */ + res = !res; /* negate result */ + } + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); + if (res != GETARG_A(inst)) /* condition failed? */ + ci->u.l.savedpc++; /* skip jump instruction */ + break; + } + case OP_CONCAT: { + StkId top = L->top - 1; /* top when 'luaT_trybinTM' was called */ + int b = GETARG_B(inst); /* first element to concatenate */ + int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */ + setobj2s(L, top - 2, top); /* put TM result in proper position */ + if (total > 1) { /* are there elements to concat? */ + L->top = top - 1; /* top is one after last element (at top-2) */ + luaV_concat(L, total); /* concat them (may yield again) */ + } + /* move final result to final position */ + setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1); + L->top = ci->top; /* restore top */ + break; + } + case OP_TFORCALL: { + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP); + L->top = ci->top; /* correct top */ + break; + } + case OP_CALL: { + if (GETARG_C(inst) - 1 >= 0) /* nresults >= 0? */ + L->top = ci->top; /* adjust results */ + break; + } + case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE: + break; + default: lua_assert(0); + } +} + + + + +/* +** {================================================================== +** Function 'luaV_execute': main interpreter loop +** =================================================================== +*/ + + +/* +** some macros for common tasks in 'luaV_execute' +*/ + + +#define RA(i) (base+GETARG_A(i)) +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) + + +/* execute a jump instruction */ +#define dojump(ci,i,e) \ + { int a = GETARG_A(i); \ + if (a != 0) luaF_close(L, ci->u.l.base + a - 1); \ + ci->u.l.savedpc += GETARG_sBx(i) + e; } + +/* for test instructions, execute the jump instruction that follows it */ +#define donextjump(ci) { i = *ci->u.l.savedpc; dojump(ci, i, 1); } + + +#define Protect(x) { {x;}; base = ci->u.l.base; } + +#define checkGC(L,c) \ + { luaC_condGC(L, L->top = (c), /* limit of live values */ \ + Protect(L->top = ci->top)); /* restore top */ \ + luai_threadyield(L); } + + +/* fetch an instruction and prepare its execution */ +#define vmfetch() { \ + i = *(ci->u.l.savedpc++); \ + if (L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) \ + Protect(luaG_traceexec(L)); \ + ra = RA(i); /* WARNING: any stack reallocation invalidates 'ra' */ \ + lua_assert(base == ci->u.l.base); \ + lua_assert(base <= L->top && L->top < L->stack + L->stacksize); \ +} + +#define vmdispatch(o) switch(o) +#define vmcase(l) case l: +#define vmbreak break + + +/* +** copy of 'luaV_gettable', but protecting the call to potential +** metamethod (which can reallocate the stack) +*/ +#define gettableProtected(L,t,k,v) { const TValue *slot; \ + if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ + else Protect(luaV_finishget(L,t,k,v,slot)); } + + +/* same for 'luaV_settable' */ +#define settableProtected(L,t,k,v) { const TValue *slot; \ + if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ + Protect(luaV_finishset(L,t,k,v,slot)); } + + + +void luaV_execute (lua_State *L) { + CallInfo *ci = L->ci; + LClosure *cl; + TValue *k; + StkId base; + ci->callstatus |= CIST_FRESH; /* fresh invocation of 'luaV_execute" */ + newframe: /* reentry point when frame changes (call/return) */ + lua_assert(ci == L->ci); + cl = clLvalue(ci->func); /* local reference to function's closure */ + k = cl->p->k; /* local reference to function's constant table */ + base = ci->u.l.base; /* local copy of function's base */ + /* main loop of interpreter */ + for (;;) { + Instruction i; + StkId ra; + vmfetch(); + vmdispatch (GET_OPCODE(i)) { + vmcase(OP_MOVE) { + setobjs2s(L, ra, RB(i)); + vmbreak; + } + vmcase(OP_LOADK) { + TValue *rb = k + GETARG_Bx(i); + setobj2s(L, ra, rb); + vmbreak; + } + vmcase(OP_LOADKX) { + TValue *rb; + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); + rb = k + GETARG_Ax(*ci->u.l.savedpc++); + setobj2s(L, ra, rb); + vmbreak; + } + vmcase(OP_LOADBOOL) { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */ + vmbreak; + } + vmcase(OP_LOADNIL) { + int b = GETARG_B(i); + do { + setnilvalue(ra++); + } while (b--); + vmbreak; + } + vmcase(OP_GETUPVAL) { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + vmbreak; + } + vmcase(OP_GETTABUP) { + TValue *upval = cl->upvals[GETARG_B(i)]->v; + TValue *rc = RKC(i); + gettableProtected(L, upval, rc, ra); + vmbreak; + } + vmcase(OP_GETTABLE) { + StkId rb = RB(i); + TValue *rc = RKC(i); + gettableProtected(L, rb, rc, ra); + vmbreak; + } + vmcase(OP_SETTABUP) { + TValue *upval = cl->upvals[GETARG_A(i)]->v; + TValue *rb = RKB(i); + TValue *rc = RKC(i); + settableProtected(L, upval, rb, rc); + vmbreak; + } + vmcase(OP_SETUPVAL) { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_upvalbarrier(L, uv); + vmbreak; + } + vmcase(OP_SETTABLE) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + settableProtected(L, ra, rb, rc); + vmbreak; + } + vmcase(OP_NEWTABLE) { + int b = GETARG_B(i); + int c = GETARG_C(i); + Table *t = luaH_new(L); + sethvalue(L, ra, t); + if (b != 0 || c != 0) + luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); + checkGC(L, ra + 1); + vmbreak; + } + vmcase(OP_SELF) { + const TValue *aux; + StkId rb = RB(i); + TValue *rc = RKC(i); + TString *key = tsvalue(rc); /* key must be a string */ + setobjs2s(L, ra + 1, rb); + if (luaV_fastget(L, rb, key, aux, luaH_getstr)) { + setobj2s(L, ra, aux); + } + else Protect(luaV_finishget(L, rb, rc, ra, aux)); + vmbreak; + } + vmcase(OP_ADD) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, intop(+, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numadd(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } + vmbreak; + } + vmcase(OP_SUB) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, intop(-, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numsub(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } + vmbreak; + } + vmcase(OP_MUL) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, intop(*, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_nummul(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } + vmbreak; + } + vmcase(OP_DIV) { /* float division (always with floats) */ + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numdiv(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } + vmbreak; + } + vmcase(OP_BAND) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, intop(&, ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BAND)); } + vmbreak; + } + vmcase(OP_BOR) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, intop(|, ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BOR)); } + vmbreak; + } + vmcase(OP_BXOR) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, intop(^, ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BXOR)); } + vmbreak; + } + vmcase(OP_SHL) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, luaV_shiftl(ib, ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHL)); } + vmbreak; + } + vmcase(OP_SHR) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Integer ib; lua_Integer ic; + if (tointeger(rb, &ib) && tointeger(rc, &ic)) { + setivalue(ra, luaV_shiftl(ib, -ic)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHR)); } + vmbreak; + } + vmcase(OP_MOD) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, luaV_mod(L, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + lua_Number m; + luai_nummod(L, nb, nc, m); + setfltvalue(ra, m); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } + vmbreak; + } + vmcase(OP_IDIV) { /* floor division */ + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (ttisinteger(rb) && ttisinteger(rc)) { + lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); + setivalue(ra, luaV_div(L, ib, ic)); + } + else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numidiv(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); } + vmbreak; + } + vmcase(OP_POW) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + lua_Number nb; lua_Number nc; + if (tonumber(rb, &nb) && tonumber(rc, &nc)) { + setfltvalue(ra, luai_numpow(L, nb, nc)); + } + else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } + vmbreak; + } + vmcase(OP_UNM) { + TValue *rb = RB(i); + lua_Number nb; + if (ttisinteger(rb)) { + lua_Integer ib = ivalue(rb); + setivalue(ra, intop(-, 0, ib)); + } + else if (tonumber(rb, &nb)) { + setfltvalue(ra, luai_numunm(L, nb)); + } + else { + Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); + } + vmbreak; + } + vmcase(OP_BNOT) { + TValue *rb = RB(i); + lua_Integer ib; + if (tointeger(rb, &ib)) { + setivalue(ra, intop(^, ~l_castS2U(0), ib)); + } + else { + Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); + } + vmbreak; + } + vmcase(OP_NOT) { + TValue *rb = RB(i); + int res = l_isfalse(rb); /* next assignment may change this value */ + setbvalue(ra, res); + vmbreak; + } + vmcase(OP_LEN) { + Protect(luaV_objlen(L, ra, RB(i))); + vmbreak; + } + vmcase(OP_CONCAT) { + int b = GETARG_B(i); + int c = GETARG_C(i); + StkId rb; + L->top = base + c + 1; /* mark the end of concat operands */ + Protect(luaV_concat(L, c - b + 1)); + ra = RA(i); /* 'luaV_concat' may invoke TMs and move the stack */ + rb = base + b; + setobjs2s(L, ra, rb); + checkGC(L, (ra >= rb ? ra + 1 : rb)); + L->top = ci->top; /* restore top */ + vmbreak; + } + vmcase(OP_JMP) { + dojump(ci, i, 0); + vmbreak; + } + vmcase(OP_EQ) { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (luaV_equalobj(L, rb, rc) != GETARG_A(i)) + ci->u.l.savedpc++; + else + donextjump(ci); + ) + vmbreak; + } + vmcase(OP_LT) { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i)) + ci->u.l.savedpc++; + else + donextjump(ci); + ) + vmbreak; + } + vmcase(OP_LE) { + Protect( + if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) + ci->u.l.savedpc++; + else + donextjump(ci); + ) + vmbreak; + } + vmcase(OP_TEST) { + if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra)) + ci->u.l.savedpc++; + else + donextjump(ci); + vmbreak; + } + vmcase(OP_TESTSET) { + TValue *rb = RB(i); + if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb)) + ci->u.l.savedpc++; + else { + setobjs2s(L, ra, rb); + donextjump(ci); + } + vmbreak; + } + vmcase(OP_CALL) { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + if (luaD_precall(L, ra, nresults)) { /* C function? */ + if (nresults >= 0) + L->top = ci->top; /* adjust results */ + Protect((void)0); /* update 'base' */ + } + else { /* Lua function */ + ci = L->ci; + goto newframe; /* restart luaV_execute over new Lua function */ + } + vmbreak; + } + vmcase(OP_TAILCALL) { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + if (luaD_precall(L, ra, LUA_MULTRET)) { /* C function? */ + Protect((void)0); /* update 'base' */ + } + else { + /* tail call: put called frame (n) in place of caller one (o) */ + CallInfo *nci = L->ci; /* called frame */ + CallInfo *oci = nci->previous; /* caller frame */ + StkId nfunc = nci->func; /* called function */ + StkId ofunc = oci->func; /* caller function */ + /* last stack slot filled by 'precall' */ + StkId lim = nci->u.l.base + getproto(nfunc)->numparams; + int aux; + /* close all upvalues from previous call */ + if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base); + /* move new frame into old one */ + for (aux = 0; nfunc + aux < lim; aux++) + setobjs2s(L, ofunc + aux, nfunc + aux); + oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ + oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ + oci->u.l.savedpc = nci->u.l.savedpc; + oci->callstatus |= CIST_TAIL; /* function was tail called */ + ci = L->ci = oci; /* remove new frame */ + lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); + goto newframe; /* restart luaV_execute over new Lua function */ + } + vmbreak; + } + vmcase(OP_RETURN) { + int b = GETARG_B(i); + if (cl->p->sizep > 0) luaF_close(L, base); + b = luaD_poscall(L, ci, ra, (b != 0 ? b - 1 : cast_int(L->top - ra))); + if (ci->callstatus & CIST_FRESH) /* local 'ci' still from callee */ + return; /* external invocation: return */ + else { /* invocation via reentry: continue execution */ + ci = L->ci; + if (b) L->top = ci->top; + lua_assert(isLua(ci)); + lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL); + goto newframe; /* restart luaV_execute over new Lua function */ + } + } + vmcase(OP_FORLOOP) { + if (ttisinteger(ra)) { /* integer loop? */ + lua_Integer step = ivalue(ra + 2); + lua_Integer idx = intop(+, ivalue(ra), step); /* increment index */ + lua_Integer limit = ivalue(ra + 1); + if ((0 < step) ? (idx <= limit) : (limit <= idx)) { + ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ + chgivalue(ra, idx); /* update internal index... */ + setivalue(ra + 3, idx); /* ...and external index */ + } + } + else { /* floating loop */ + lua_Number step = fltvalue(ra + 2); + lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ + lua_Number limit = fltvalue(ra + 1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ + chgfltvalue(ra, idx); /* update internal index... */ + setfltvalue(ra + 3, idx); /* ...and external index */ + } + } + vmbreak; + } + vmcase(OP_FORPREP) { + TValue *init = ra; + TValue *plimit = ra + 1; + TValue *pstep = ra + 2; + lua_Integer ilimit; + int stopnow; + if (ttisinteger(init) && ttisinteger(pstep) && + forlimit(plimit, &ilimit, ivalue(pstep), &stopnow)) { + /* all values are integer */ + lua_Integer initv = (stopnow ? 0 : ivalue(init)); + setivalue(plimit, ilimit); + setivalue(init, intop(-, initv, ivalue(pstep))); + } + else { /* try making all values floats */ + lua_Number ninit; lua_Number nlimit; lua_Number nstep; + if (!tonumber(plimit, &nlimit)) + luaG_runerror(L, "'for' limit must be a number"); + setfltvalue(plimit, nlimit); + if (!tonumber(pstep, &nstep)) + luaG_runerror(L, "'for' step must be a number"); + setfltvalue(pstep, nstep); + if (!tonumber(init, &ninit)) + luaG_runerror(L, "'for' initial value must be a number"); + setfltvalue(init, luai_numsub(L, ninit, nstep)); + } + ci->u.l.savedpc += GETARG_sBx(i); + vmbreak; + } + vmcase(OP_TFORCALL) { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb + 3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = ci->top; + i = *(ci->u.l.savedpc++); /* go to next instruction */ + ra = RA(i); + lua_assert(GET_OPCODE(i) == OP_TFORLOOP); + goto l_tforloop; + } + vmcase(OP_TFORLOOP) { + l_tforloop: + if (!ttisnil(ra + 1)) { /* continue loop? */ + setobjs2s(L, ra, ra + 1); /* save control variable */ + ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ + } + vmbreak; + } + vmcase(OP_SETLIST) { + int n = GETARG_B(i); + int c = GETARG_C(i); + unsigned int last; + Table *h; + if (n == 0) n = cast_int(L->top - ra) - 1; + if (c == 0) { + lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); + c = GETARG_Ax(*ci->u.l.savedpc++); + } + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* preallocate it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + luaH_setint(L, h, last--, val); + luaC_barrierback(L, h, val); + } + L->top = ci->top; /* correct top (in case of previous open call) */ + vmbreak; + } + vmcase(OP_CLOSURE) { + Proto *p = cl->p->p[GETARG_Bx(i)]; + LClosure *ncl = getcached(p, cl->upvals, base); /* cached closure */ + if (ncl == NULL) /* no match? */ + pushclosure(L, p, cl->upvals, base, ra); /* create a new one */ + else + setclLvalue(L, ra, ncl); /* push cashed closure */ + checkGC(L, ra + 1); + vmbreak; + } + vmcase(OP_VARARG) { + int b = GETARG_B(i) - 1; /* required results */ + int j; + int n = cast_int(base - ci->func) - cl->p->numparams - 1; + if (n < 0) /* less arguments than parameters? */ + n = 0; /* no vararg arguments */ + if (b < 0) { /* B == 0? */ + b = n; /* get all var. arguments */ + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + L->top = ra + n; + } + for (j = 0; j < b && j < n; j++) + setobjs2s(L, ra + j, base - n + j); + for (; j < b; j++) /* complete required results with nil */ + setnilvalue(ra + j); + vmbreak; + } + vmcase(OP_EXTRAARG) { + lua_assert(0); + vmbreak; + } + } + } +} + +/* }================================================================== */ + diff --git a/deps/lua/src/lvm.h b/deps/lua/src/lvm.h new file mode 100644 index 0000000000..a8f954f04c --- /dev/null +++ b/deps/lua/src/lvm.h @@ -0,0 +1,113 @@ +/* +** $Id: lvm.h,v 2.41.1.1 2017/04/19 17:20:42 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#if !defined(LUA_NOCVTN2S) +#define cvt2str(o) ttisnumber(o) +#else +#define cvt2str(o) 0 /* no conversion from numbers to strings */ +#endif + + +#if !defined(LUA_NOCVTS2N) +#define cvt2num(o) ttisstring(o) +#else +#define cvt2num(o) 0 /* no conversion from strings to numbers */ +#endif + + +/* +** You can define LUA_FLOORN2I if you want to convert floats to integers +** by flooring them (instead of raising an error if they are not +** integral values) +*/ +#if !defined(LUA_FLOORN2I) +#define LUA_FLOORN2I 0 +#endif + + +#define tonumber(o,n) \ + (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) + +#define tointeger(o,i) \ + (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) + +#define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) + +#define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) + + +/* +** fast track for 'gettable': if 't' is a table and 't[k]' is not nil, +** return 1 with 'slot' pointing to 't[k]' (final result). Otherwise, +** return 0 (meaning it will have to check metamethod) with 'slot' +** pointing to a nil 't[k]' (if 't' is a table) or NULL (otherwise). +** 'f' is the raw get function to use. +*/ +#define luaV_fastget(L,t,k,slot,f) \ + (!ttistable(t) \ + ? (slot = NULL, 0) /* not a table; 'slot' is NULL and result is 0 */ \ + : (slot = f(hvalue(t), k), /* else, do raw access */ \ + !ttisnil(slot))) /* result not nil? */ + +/* +** standard implementation for 'gettable' +*/ +#define luaV_gettable(L,t,k,v) { const TValue *slot; \ + if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ + else luaV_finishget(L,t,k,v,slot); } + + +/* +** Fast track for set table. If 't' is a table and 't[k]' is not nil, +** call GC barrier, do a raw 't[k]=v', and return true; otherwise, +** return false with 'slot' equal to NULL (if 't' is not a table) or +** 'nil'. (This is needed by 'luaV_finishget'.) Note that, if the macro +** returns true, there is no need to 'invalidateTMcache', because the +** call is not creating a new entry. +*/ +#define luaV_fastset(L,t,k,slot,f,v) \ + (!ttistable(t) \ + ? (slot = NULL, 0) \ + : (slot = f(hvalue(t), k), \ + ttisnil(slot) ? 0 \ + : (luaC_barrierback(L, hvalue(t), v), \ + setobj2t(L, cast(TValue *,slot), v), \ + 1))) + + +#define luaV_settable(L,t,k,v) { const TValue *slot; \ + if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ + luaV_finishset(L,t,k,v,slot); } + + + +LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); +LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); +LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, + StkId val, const TValue *slot); +LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, + StkId val, const TValue *slot); +LUAI_FUNC void luaV_finishOp (lua_State *L); +LUAI_FUNC void luaV_execute (lua_State *L); +LUAI_FUNC void luaV_concat (lua_State *L, int total); +LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); +LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); +LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); +LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); + +#endif diff --git a/deps/lua/src/lzio.c b/deps/lua/src/lzio.c new file mode 100644 index 0000000000..6f79094410 --- /dev/null +++ b/deps/lua/src/lzio.c @@ -0,0 +1,68 @@ +/* +** $Id: lzio.c,v 1.37.1.1 2017/04/19 17:20:42 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + +#define lzio_c +#define LUA_CORE + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) + return EOZ; + z->n = size - 1; /* discount char being returned */ + z->p = buff; + return cast_uchar(*(z->p++)); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (z->n == 0) { /* no bytes in buffer? */ + if (luaZ_fill(z) == EOZ) /* try to read more */ + return n; /* no more input; return number of missing bytes */ + else { + z->n++; /* luaZ_fill consumed first byte; put it back */ + z->p--; + } + } + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + diff --git a/deps/lua/src/lzio.h b/deps/lua/src/lzio.h new file mode 100644 index 0000000000..d897870815 --- /dev/null +++ b/deps/lua/src/lzio.h @@ -0,0 +1,66 @@ +/* +** $Id: lzio.h,v 1.31.1.1 2017/04/19 17:20:42 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) + + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_buffremove(buff,i) ((buff)->n -= (i)) +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ + (buff)->buffsize, size), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; /* reader function */ + void *data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif From 4b2bc29775e0207aae4c13796c680e8a4548c626 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Tue, 28 Aug 2018 21:58:13 +0100 Subject: [PATCH 0004/1292] Updated rcheevos to 6.4.0 --- deps/rcheevos/CHANGELOG.md | 4 ++++ deps/rcheevos/README.md | 40 ++++++++++++++++++++++++++++++++ deps/rcheevos/_config.yml | 1 + deps/rcheevos/include/rcheevos.h | 38 ++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 deps/rcheevos/_config.yml diff --git a/deps/rcheevos/CHANGELOG.md b/deps/rcheevos/CHANGELOG.md index 98e803bd21..302c240306 100644 --- a/deps/rcheevos/CHANGELOG.md +++ b/deps/rcheevos/CHANGELOG.md @@ -1,3 +1,7 @@ +# v6.4.0 + +* Added an enumeration with the console identifiers used in RetroAchievements + # v6.3.1 * Pass the peek function and the user data to the Lua functions used in operands. diff --git a/deps/rcheevos/README.md b/deps/rcheevos/README.md index 5bf1303e58..d9da7487ba 100644 --- a/deps/rcheevos/README.md +++ b/deps/rcheevos/README.md @@ -57,6 +57,46 @@ enum { }; ``` +### Console identifiers + +This enumeration uniquely identifies each of the supported platforms in RetroAchievements. + +```c +enum { + RC_CONSOLE_MEGA_DRIVE = 1, + RC_CONSOLE_NINTENDO_64 = 2, + RC_CONSOLE_SUPER_NINTENDO = 3, + RC_CONSOLE_GAMEBOY = 4, + RC_CONSOLE_GAMEBOY_ADVANCE = 5, + RC_CONSOLE_GAMEBOY_COLOR = 6, + RC_CONSOLE_NINTENDO = 7, + RC_CONSOLE_PC_ENGINE = 8, + RC_CONSOLE_SEGA_CD = 9, + RC_CONSOLE_SEGA_32X = 10, + RC_CONSOLE_MASTER_SYSTEM = 11, + RC_CONSOLE_PLAYSTATION = 12, + RC_CONSOLE_ATARI_LYNX = 13, + RC_CONSOLE_NEOGEO_POCKET = 14, + RC_CONSOLE_GAME_GEAR = 15, + RC_CONSOLE_GAMECUBE = 16, + RC_CONSOLE_ATARI_JAGUAR = 17, + RC_CONSOLE_NINTENDO_DS = 18, + RC_CONSOLE_WII = 19, + RC_CONSOLE_WII_U = 20, + RC_CONSOLE_PLAYSTATION_2 = 21, + RC_CONSOLE_XBOX = 22, + RC_CONSOLE_SKYNET = 23, + RC_CONSOLE_XBOX_ONE = 24, + RC_CONSOLE_ATARI_2600 = 25, + RC_CONSOLE_MS_DOS = 26, + RC_CONSOLE_ARCADE = 27, + RC_CONSOLE_VIRTUAL_BOY = 28, + RC_CONSOLE_MSX = 29, + RC_CONSOLE_COMMODORE_64 = 30, + RC_CONSOLE_ZX81 = 31 +}; +``` + ### `rc_operand_t` An operand is the leaf node of RetroAchievements expressions, and can hold one of the following: diff --git a/deps/rcheevos/_config.yml b/deps/rcheevos/_config.yml new file mode 100644 index 0000000000..18854876c6 --- /dev/null +++ b/deps/rcheevos/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-midnight \ No newline at end of file diff --git a/deps/rcheevos/include/rcheevos.h b/deps/rcheevos/include/rcheevos.h index f9cfde39d2..58e831b68f 100644 --- a/deps/rcheevos/include/rcheevos.h +++ b/deps/rcheevos/include/rcheevos.h @@ -40,6 +40,44 @@ enum { RC_INVALID_LBOARD_FIELD = -17 }; +/*****************************************************************************\ +| Console identifiers | +\*****************************************************************************/ + +enum { + RC_CONSOLE_MEGA_DRIVE = 1, + RC_CONSOLE_NINTENDO_64 = 2, + RC_CONSOLE_SUPER_NINTENDO = 3, + RC_CONSOLE_GAMEBOY = 4, + RC_CONSOLE_GAMEBOY_ADVANCE = 5, + RC_CONSOLE_GAMEBOY_COLOR = 6, + RC_CONSOLE_NINTENDO = 7, + RC_CONSOLE_PC_ENGINE = 8, + RC_CONSOLE_SEGA_CD = 9, + RC_CONSOLE_SEGA_32X = 10, + RC_CONSOLE_MASTER_SYSTEM = 11, + RC_CONSOLE_PLAYSTATION = 12, + RC_CONSOLE_ATARI_LYNX = 13, + RC_CONSOLE_NEOGEO_POCKET = 14, + RC_CONSOLE_GAME_GEAR = 15, + RC_CONSOLE_GAMECUBE = 16, + RC_CONSOLE_ATARI_JAGUAR = 17, + RC_CONSOLE_NINTENDO_DS = 18, + RC_CONSOLE_WII = 19, + RC_CONSOLE_WII_U = 20, + RC_CONSOLE_PLAYSTATION_2 = 21, + RC_CONSOLE_XBOX = 22, + RC_CONSOLE_SKYNET = 23, + RC_CONSOLE_XBOX_ONE = 24, + RC_CONSOLE_ATARI_2600 = 25, + RC_CONSOLE_MS_DOS = 26, + RC_CONSOLE_ARCADE = 27, + RC_CONSOLE_VIRTUAL_BOY = 28, + RC_CONSOLE_MSX = 29, + RC_CONSOLE_COMMODORE_64 = 30, + RC_CONSOLE_ZX81 = 31 +}; + /*****************************************************************************\ | Callbacks | \*****************************************************************************/ From 3f72e1fd9655ab7504faef72a7342a11cd55ebb6 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Tue, 28 Aug 2018 22:20:38 +0100 Subject: [PATCH 0005/1292] Updated rcheevos to 6.5.0 --- deps/rcheevos/CHANGELOG.md | 4 +++ deps/rcheevos/README.md | 1 + deps/rcheevos/include/rjson.h | 9 +++++++ deps/rcheevos/src/rjson/schema.c | 43 ++++++++++++++++++++++++++++++ deps/rcheevos/src/rjson/schema.dej | 7 +++++ 5 files changed, 64 insertions(+) diff --git a/deps/rcheevos/CHANGELOG.md b/deps/rcheevos/CHANGELOG.md index 302c240306..0a1a1d002a 100644 --- a/deps/rcheevos/CHANGELOG.md +++ b/deps/rcheevos/CHANGELOG.md @@ -1,3 +1,7 @@ +# v6.5.0 + +* Added a schema for errors returned by the server + # v6.4.0 * Added an enumeration with the console identifiers used in RetroAchievements diff --git a/deps/rcheevos/README.md b/deps/rcheevos/README.md index d9da7487ba..4685e7a11f 100644 --- a/deps/rcheevos/README.md +++ b/deps/rcheevos/README.md @@ -502,6 +502,7 @@ enum { * `rc_json_login_t`: The login token for the user, given their user name and password. * `rc_json_patch_t`: The information about a game, given its identifier. It includes arrays with the achievements and leaderboards for the game. * `rc_json_unlocks_t`: The list of achievements already awarded for the player, given the game identifier. Used to avoid the emulator awarding achievements more than once. +* `rc_json_error_t`: Error messages returned by the server. For each schema there are two functions, for example: diff --git a/deps/rcheevos/include/rjson.h b/deps/rcheevos/include/rjson.h index e8d5aa04ca..f13f0ef3bd 100644 --- a/deps/rcheevos/include/rjson.h +++ b/deps/rcheevos/include/rjson.h @@ -115,6 +115,15 @@ rc_json_unlocks_t; int rc_json_get_unlocks_size(const char* json); const rc_json_unlocks_t* rc_json_parse_unlocks(void* buffer, const char* json); +typedef struct { + const char* error; + char success; +} +rc_json_error_t; + +int rc_json_get_error_size(const char* json); +const rc_json_error_t* rc_json_parse_error(void* buffer, const char* json); + #ifdef __cplusplus } #endif diff --git a/deps/rcheevos/src/rjson/schema.c b/deps/rcheevos/src/rjson/schema.c index f063568f60..afd2d64f65 100644 --- a/deps/rcheevos/src/rjson/schema.c +++ b/deps/rcheevos/src/rjson/schema.c @@ -551,6 +551,48 @@ const rc_json_unlocks_t* rc_json_parse_unlocks(void* buffer, const char* json) { return (const rc_json_unlocks_t*)rc_json_deserialize(buffer, 0x9b4e2684U, (const uint8_t*)json); } +static const rc_json_field_meta_t rc_json_field_meta_error[] = { + { + /* Metadata for field const char* error;. */ + /* name_hash */ 0x0d2011cfU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_error_t, error), + /* type */ RC_JSON_TYPE_STRING, + /* flags */ 0 + }, + { + /* Metadata for field char success;. */ + /* name_hash */ 0x110461deU, + /* type_hash */ 0x00000000U, + /* offset */ RC_JSON_OFFSETOF(rc_json_error_t, success), + /* type */ RC_JSON_TYPE_BOOL, + /* flags */ 0 + }, +}; + +static const rc_json_struct_meta_t rc_json_struct_meta_error = { + /* fields */ rc_json_field_meta_error, + /* name_hash */ 0x0d2011cfU, + /* size */ sizeof(rc_json_error_t), + /* alignment */ RC_JSON_ALIGNOF(rc_json_error_t), + /* num_fields */ 2 +}; + +int rc_json_get_error_size(const char* json) { + size_t size; + int res = rc_json_get_size(&size, 0x0d2011cfU, (const uint8_t*)json); + + if (res == RC_JSON_OK) { + res = (int)size; + } + + return res; +} + +const rc_json_error_t* rc_json_parse_error(void* buffer, const char* json) { + return (const rc_json_error_t*)rc_json_deserialize(buffer, 0x0d2011cfU, (const uint8_t*)json); +} + const rc_json_struct_meta_t* rc_json_resolve_struct(unsigned hash) { switch (hash) { @@ -561,6 +603,7 @@ const rc_json_struct_meta_t* rc_json_resolve_struct(unsigned hash) { case 0xadc4ac0fU: return &rc_json_struct_meta_patchdata; case 0x0dddd3d5U: return &rc_json_struct_meta_patch; case 0x9b4e2684U: return &rc_json_struct_meta_unlocks; + case 0x0d2011cfU: return &rc_json_struct_meta_error; default: return NULL; } } diff --git a/deps/rcheevos/src/rjson/schema.dej b/deps/rcheevos/src/rjson/schema.dej index a902d5e835..f11e6a55f8 100644 --- a/deps/rcheevos/src/rjson/schema.dej +++ b/deps/rcheevos/src/rjson/schema.dej @@ -73,3 +73,10 @@ struct unlocks/Unlocks { unsigned gameid/GameID; bool hardcore/HardcoreMode; }; + +//---------------------------------------------------------------------------- + +struct error/Error { + bool success/Success; + string error/Error; +}; From 7634b1bbb01d6704354f3efb6acd63fac0cdb9fb Mon Sep 17 00:00:00 2001 From: Gregor Richards Date: Sat, 1 Sep 2018 21:14:56 -0400 Subject: [PATCH 0006/1292] Fix netplay on Wii U getaddrinfo on Wii U doesn't support node==NULL. As I don't know of this bug on any other platform, I've made a Wii-U-specific workaround in getaddrinfo_retro. --- libretro-common/net/net_compat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libretro-common/net/net_compat.c b/libretro-common/net/net_compat.c index 86c1381221..ea45743596 100644 --- a/libretro-common/net/net_compat.c +++ b/libretro-common/net/net_compat.c @@ -183,6 +183,16 @@ int getaddrinfo_retro(const char *node, const char *service, #endif } +#if defined(WIIU) + if (node == NULL) { + /* Wii U's socket library chokes on NULL node */ + if (hints->ai_flags & AI_PASSIVE) + node = "0.0.0.0"; + else + node = "127.0.0.1"; + } +#endif + #ifdef HAVE_SOCKET_LEGACY info = (struct addrinfo*)calloc(1, sizeof(*info)); if (!info) From 613a3e84795ee92295a37b1f7b6f50ef9191e71f Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Sun, 2 Sep 2018 14:23:37 +0100 Subject: [PATCH 0007/1292] Integrated rcheevos --- Makefile.common | 53 +- cheevos/badges.h | 19 +- cheevos/cheevos.c | 3136 +++++++++++---------------------------------- cheevos/cheevos.h | 100 +- cheevos/cond.c | 189 --- cheevos/cond.h | 63 - cheevos/coro.h | 6 +- cheevos/fixup.c | 264 ++++ cheevos/fixup.h | 48 + cheevos/hash.c | 12 + cheevos/hash.h | 30 + cheevos/parser.c | 674 ++++++++++ cheevos/parser.h | 69 + cheevos/util.h | 53 + cheevos/var.c | 416 ------ cheevos/var.h | 78 -- command.c | 18 +- 17 files changed, 1991 insertions(+), 3237 deletions(-) delete mode 100644 cheevos/cond.c delete mode 100644 cheevos/cond.h create mode 100644 cheevos/fixup.c create mode 100644 cheevos/fixup.h create mode 100644 cheevos/hash.c create mode 100644 cheevos/hash.h create mode 100644 cheevos/parser.c create mode 100644 cheevos/parser.h create mode 100644 cheevos/util.h delete mode 100644 cheevos/var.c delete mode 100644 cheevos/var.h diff --git a/Makefile.common b/Makefile.common index 289328dac2..74d1a6c625 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1676,11 +1676,58 @@ ifeq ($(HAVE_NETWORKING), 1) # Retro Achievements ifeq ($(HAVE_CHEEVOS), 1) - DEFINES += -DHAVE_CHEEVOS + DEFINES += -DHAVE_CHEEVOS \ + -Ideps/rcheevos/include \ + -Ideps/lua/src OBJ += cheevos/cheevos.o \ - cheevos/var.o \ - cheevos/cond.o \ + cheevos/fixup.o \ + cheevos/parser.o \ cheevos/badges.o \ + cheevos/hash.o \ + deps/rcheevos/src/rcheevos/trigger.o \ + deps/rcheevos/src/rcheevos/condset.o \ + deps/rcheevos/src/rcheevos/condition.o \ + deps/rcheevos/src/rcheevos/operand.o \ + deps/rcheevos/src/rcheevos/term.o \ + deps/rcheevos/src/rcheevos/expression.o \ + deps/rcheevos/src/rcheevos/value.o \ + deps/rcheevos/src/rcheevos/lboard.o \ + deps/rcheevos/src/rcheevos/alloc.o \ + deps/rcheevos/src/rcheevos/format.o \ + deps/rcheevos/src/rurl/url.o \ + deps/lua/src/lapi.o \ + deps/lua/src/lcode.o \ + deps/lua/src/lctype.o \ + deps/lua/src/ldebug.o \ + deps/lua/src/ldo.o \ + deps/lua/src/ldump.o \ + deps/lua/src/lfunc.o \ + deps/lua/src/lgc.o \ + deps/lua/src/llex.o \ + deps/lua/src/lmem.o \ + deps/lua/src/lobject.o \ + deps/lua/src/lopcodes.o \ + deps/lua/src/lparser.o \ + deps/lua/src/lstate.o \ + deps/lua/src/lstring.o \ + deps/lua/src/ltable.o \ + deps/lua/src/ltm.o \ + deps/lua/src/lundump.o \ + deps/lua/src/lvm.o \ + deps/lua/src/lzio.o \ + deps/lua/src/lauxlib.o \ + deps/lua/src/lbaselib.o \ + deps/lua/src/lbitlib.o \ + deps/lua/src/lcorolib.o \ + deps/lua/src/ldblib.o \ + deps/lua/src/liolib.o \ + deps/lua/src/lmathlib.o \ + deps/lua/src/loslib.o \ + deps/lua/src/lstrlib.o \ + deps/lua/src/ltablib.o \ + deps/lua/src/lutf8lib.o \ + deps/lua/src/loadlib.o \ + deps/lua/src/linit.o \ $(LIBRETRO_COMM_DIR)/utils/md5.o endif diff --git a/cheevos/badges.h b/cheevos/badges.h index 05fe875a2a..f2bee1993a 100644 --- a/cheevos/badges.h +++ b/cheevos/badges.h @@ -1,5 +1,20 @@ -#ifndef __RARCH_BADGE_H -#define __RARCH_BADGE_H +/* RetroArch - A frontend for libretro. + * Copyright (C) 2015-2018 - Andre Leiradella + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __RARCH_CHEEVOS_BADGE_H +#define __RARCH_CHEEVOS_BADGE_H #include "../menu/menu_driver.h" diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index c542783d29..c892817a5d 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -44,8 +43,10 @@ #include "badges.h" #include "cheevos.h" -#include "var.h" -#include "cond.h" +#include "fixup.h" +#include "parser.h" +#include "hash.h" +#include "util.h" #include "../file_path_special.h" #include "../paths.h" @@ -60,7 +61,8 @@ #include "../network/net_http_special.h" #include "../tasks/tasks_internal.h" -#include "../verbosity.h" +#include +#include /* Define this macro to prevent cheevos from being deactivated. */ #undef CHEEVOS_DONT_DEACTIVATE @@ -89,164 +91,50 @@ /* Define this macro to log downloaded badge images. */ #undef CHEEVOS_LOG_BADGES -/* C89 wants only int values in enums. */ -#define CHEEVOS_JSON_KEY_GAMEID 0xb4960eecU -#define CHEEVOS_JSON_KEY_ACHIEVEMENTS 0x69749ae1U -#define CHEEVOS_JSON_KEY_ID 0x005973f2U -#define CHEEVOS_JSON_KEY_MEMADDR 0x1e76b53fU -#define CHEEVOS_JSON_KEY_TITLE 0x0e2a9a07U -#define CHEEVOS_JSON_KEY_DESCRIPTION 0xe61a1f69U -#define CHEEVOS_JSON_KEY_POINTS 0xca8fce22U -#define CHEEVOS_JSON_KEY_AUTHOR 0xa804edb8U -#define CHEEVOS_JSON_KEY_MODIFIED 0xdcea4fe6U -#define CHEEVOS_JSON_KEY_CREATED 0x3a84721dU -#define CHEEVOS_JSON_KEY_BADGENAME 0x887685d9U -#define CHEEVOS_JSON_KEY_CONSOLE_ID 0x071656e5U -#define CHEEVOS_JSON_KEY_TOKEN 0x0e2dbd26U -#define CHEEVOS_JSON_KEY_FLAGS 0x0d2e96b2U -#define CHEEVOS_JSON_KEY_LEADERBOARDS 0xf1247d2dU -#define CHEEVOS_JSON_KEY_MEM 0x0b8807e4U -#define CHEEVOS_JSON_KEY_FORMAT 0xb341208eU -#define CHEEVOS_JSON_KEY_SUCCESS 0x110461deU -#define CHEEVOS_JSON_KEY_ERROR 0x0d2011cfU +typedef struct +{ + rc_trigger_t* trigger; + const cheevos_racheevo_t* info; + int active; + int last; +} cheevos_cheevo_t; typedef struct { - cheevos_cond_t *conds; - unsigned count; -} cheevos_condset_t; - -typedef struct -{ - cheevos_condset_t *condsets; - unsigned count; -} cheevos_condition_t; - -typedef struct -{ - unsigned id; - const char *title; - const char *description; - const char *author; - const char *badge; - unsigned points; - unsigned dirty; - int active; - int last; - int modified; - - cheevos_condition_t condition; -} cheevo_t; - -typedef struct -{ - cheevo_t *cheevos; - unsigned count; -} cheevoset_t; - -typedef struct -{ - int is_element; - int mode; -} cheevos_deactivate_t; - -typedef struct -{ - unsigned key_hash; - int is_key; - const char *value; - size_t length; -} cheevos_getvalueud_t; - -typedef struct -{ - int in_cheevos; - int in_lboards; - uint32_t field_hash; - unsigned core_count; - unsigned unofficial_count; - unsigned lboard_count; -} cheevos_countud_t; - -typedef struct -{ - const char *string; - size_t length; -} cheevos_field_t; - -typedef struct -{ - int in_cheevos; - int in_lboards; - int is_console_id; - unsigned core_count; - unsigned unofficial_count; - unsigned lboard_count; - - cheevos_field_t *field; - cheevos_field_t id, memaddr, title, desc, points, author; - cheevos_field_t modified, created, badge, flags, format; -} cheevos_readud_t; - -typedef struct -{ - int label; - const char *name; - const uint32_t *ext_hashes; -} cheevos_finder_t; - -typedef struct -{ - cheevos_var_t var; - double multiplier; - bool compare_next; -} cheevos_term_t; - -typedef struct -{ - cheevos_term_t *terms; - unsigned count; - unsigned compare_count; -} cheevos_expr_t; - -typedef struct -{ - unsigned id; - unsigned format; - const char *title; - const char *description; - int active; - int last_value; - - cheevos_condition_t start; - cheevos_condition_t cancel; - cheevos_condition_t submit; - cheevos_expr_t value; -} cheevos_leaderboard_t; + rc_lboard_t* lboard; + const cheevos_ralboard_t* info; + bool active; + unsigned last_value; + int format; +} cheevos_lboard_t; typedef struct { retro_task_t* task; #ifdef HAVE_THREADS - slock_t* task_lock; + slock_t* task_lock; #endif - cheevos_console_t console_id; + int console_id; bool core_supports; - bool addrs_patched; - int add_buffer; - int add_hits; + + cheevos_rapatchdata_t patchdata; + cheevos_cheevo_t* core; + cheevos_cheevo_t* unofficial; + cheevos_lboard_t* lboards; - cheevoset_t core; - cheevoset_t unofficial; - cheevos_leaderboard_t *leaderboards; - unsigned lboard_count; + cheevos_fixups_t fixups; char token[32]; - - retro_ctx_memory_info_t meminfo[4]; } cheevos_locals_t; +typedef struct +{ + int label; + const char* name; + const uint32_t* ext_hashes; +} cheevos_finder_t; + typedef struct { uint8_t id[4]; /* NES^Z */ @@ -257,33 +145,7 @@ typedef struct uint8_t reserve[8]; } cheevos_nes_header_t; -static cheevos_locals_t cheevos_locals = -{ - /* task */ NULL, -#ifdef HAVE_THREADS - /* task_lock */ NULL, -#endif - - /* console_id */ CHEEVOS_CONSOLE_NONE, - /* core_supports */ true, - /* addrs_patched */ false, - /* add_buffer */ 0, - /* add_hits */ 0, - - /* core */ {NULL, 0}, - /* unofficial */ {NULL, 0}, - /* leaderboards */ NULL, - /* lboard_count */ 0, - - /* token */ {0}, - - { - /* meminfo[0] */ {NULL, 0, 0}, - /* meminfo[1] */ {NULL, 0, 0}, - /* meminfo[2] */ {NULL, 0, 0}, - /* meminfo[3] */ {NULL, 0, 0} - } -}; +static cheevos_locals_t cheevos_locals; bool cheevos_loaded = false; bool cheevos_hardcore_active = false; @@ -299,6 +161,8 @@ int cheats_were_enabled = 0; #define CHEEVOS_UNLOCK(l) #endif +#define CHEEVOS_MB(x) ((x) * 1024 * 1024) + /***************************************************************************** Supporting functions. *****************************************************************************/ @@ -312,14 +176,9 @@ void cheevos_log(const char *fmt, ...) #endif -static unsigned size_in_megabytes(unsigned val) -{ - return (val * 1024 * 1024); -} - -#ifdef CHEEVOS_LOG_URLS static void cheevos_log_url(const char* format, const char* url) { +#ifdef CHEEVOS_LOG_URLS #ifdef CHEEVOS_LOG_PASSWORD CHEEVOS_LOG(format, url); #else @@ -345,7 +204,7 @@ static void cheevos_log_url(const char* format, const char* url) do { *aux++ = *next++; - }while (next[-1] != 0); + } while (next[-1] != 0); } else *aux = 0; @@ -366,7 +225,7 @@ static void cheevos_log_url(const char* format, const char* url) do { *aux++ = *next++; - }while (next[-1] != 0); + } while (next[-1] != 0); } else *aux = 0; @@ -374,881 +233,167 @@ static void cheevos_log_url(const char* format, const char* url) CHEEVOS_LOG(format, copy); #endif -} +#else + (void)format; + (void)url; #endif - -static uint32_t cheevos_djb2(const char* str, size_t length) -{ - const unsigned char *aux = (const unsigned char*)str; - const unsigned char *end = aux + length; - uint32_t hash = 5381; - - while (aux < end) - hash = (hash << 5) + hash + *aux++; - - return hash; } -static int cheevos_getvalue__json_key(void *userdata, - const char *name, size_t length) +static const char* cheevos_rc_error(int ret) { - cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; - - if (ud) - ud->is_key = cheevos_djb2(name, length) == ud->key_hash; - return 0; -} - -static int cheevos_getvalue__json_string(void *userdata, - const char *string, size_t length) -{ - cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; - - if (ud && ud->is_key) + switch (ret) { - ud->value = string; - ud->length = length; - ud->is_key = 0; + case RC_OK: return "Ok"; + case RC_INVALID_LUA_OPERAND: return "Invalid Lua operand"; + case RC_INVALID_MEMORY_OPERAND: return "Invalid memory operand"; + case RC_INVALID_CONST_OPERAND: return "Invalid constant operand"; + case RC_INVALID_FP_OPERAND: return "Invalid floating-point operand"; + case RC_INVALID_CONDITION_TYPE: return "Invalid condition type"; + case RC_INVALID_OPERATOR: return "Invalid operator"; + case RC_INVALID_REQUIRED_HITS: return "Invalid required hits"; + case RC_DUPLICATED_START: return "Duplicated start condition"; + case RC_DUPLICATED_CANCEL: return "Duplicated cancel condition"; + case RC_DUPLICATED_SUBMIT: return "Duplicated submit condition"; + case RC_DUPLICATED_VALUE: return "Duplicated value expression"; + case RC_DUPLICATED_PROGRESS: return "Duplicated progress expression"; + case RC_MISSING_START: return "Missing start condition"; + case RC_MISSING_CANCEL: return "Missing cancel condition"; + case RC_MISSING_SUBMIT: return "Missing submit condition"; + case RC_MISSING_VALUE: return "Missing value expression"; + case RC_INVALID_LBOARD_FIELD: return "Invalid field in leaderboard"; + default: return "Unknown error"; + } +} + +static int cheevos_parse(const char* json) +{ + int res = 0; + int i = 0; + unsigned j = 0; + unsigned count = 0; + cheevos_cheevo_t* cheevo = NULL; + cheevos_lboard_t* lboard = NULL; + cheevos_racheevo_t* rac = NULL; + + cheevos_fixup_init(&cheevos_locals.fixups); + + res = cheevos_get_patchdata(json, &cheevos_locals.patchdata); + + if (res != 0) + { + RARCH_ERR(CHEEVOS_TAG "Error parsing cheevos"); + return -1; } - return 0; -} - -static int cheevos_getvalue__json_boolean(void *userdata, int istrue) -{ - cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; - - if (ud && ud->is_key) + if ( cheevos_locals.patchdata.core_count == 0 + && !cheevos_locals.patchdata.unofficial_count == 0 + && !cheevos_locals.patchdata.lboard_count == 0) { - if (istrue) + cheevos_locals.core = NULL; + cheevos_locals.unofficial = NULL; + cheevos_locals.lboards = NULL; + cheevos_free_patchdata(&cheevos_locals.patchdata); + return 0; + } + + /* Allocate memory. */ + cheevos_locals.core = (cheevos_cheevo_t*) + calloc(cheevos_locals.patchdata.core_count, sizeof(cheevos_cheevo_t)); + + cheevos_locals.unofficial = (cheevos_cheevo_t*) + calloc(cheevos_locals.patchdata.unofficial_count, sizeof(cheevos_cheevo_t)); + + cheevos_locals.lboards = (cheevos_lboard_t*) + calloc(cheevos_locals.patchdata.lboard_count, sizeof(cheevos_lboard_t)); + + if ( !cheevos_locals.core + || !cheevos_locals.unofficial + || !cheevos_locals.lboards) + { + CHEEVOS_ERR(CHEEVOS_TAG "Error allocating memory for cheevos"); + goto error; + } + + /* Initialize. */ + for (i = 0; i < 2; i++) + { + if (i == 0) { - ud->value = "true"; - ud->length = 4; + cheevo = cheevos_locals.core; + rac = cheevos_locals.patchdata.core; + count = cheevos_locals.patchdata.core_count; } else { - ud->value = "false"; - ud->length = 5; - } - ud->is_key = 0; - } - - return 0; -} - -static int cheevos_getvalue__json_null(void *userdata) -{ - cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; - - if (ud && ud->is_key ) - { - ud->value = "null"; - ud->length = 4; - ud->is_key = 0; - } - - return 0; -} - -static int cheevos_get_value(const char *json, unsigned key_hash, - char *value, size_t length) -{ - static const jsonsax_handlers_t handlers = - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - cheevos_getvalue__json_key, - NULL, - cheevos_getvalue__json_string, - cheevos_getvalue__json_string, /* number */ - cheevos_getvalue__json_boolean, - cheevos_getvalue__json_null - }; - - cheevos_getvalueud_t ud; - - ud.key_hash = key_hash; - ud.is_key = 0; - ud.value = NULL; - ud.length = 0; - *value = 0; - - if ((jsonsax_parse(json, &handlers, (void*)&ud) == JSONSAX_OK) - && ud.value && ud.length < length) - { - if (!string_is_empty(ud.value)) - strlcpy(value, ud.value, ud.length + 1); - return 0; - } - - return -1; -} - -/***************************************************************************** -Count number of achievements in a JSON file. -*****************************************************************************/ - -static int cheevos_count__json_end_array(void *userdata) -{ - cheevos_countud_t* ud = (cheevos_countud_t*)userdata; - - if (ud) - { - ud->in_cheevos = 0; - ud->in_lboards = 0; - } - - return 0; -} - -static int cheevos_count__json_key(void *userdata, - const char *name, size_t length) -{ - cheevos_countud_t* ud = (cheevos_countud_t*)userdata; - - if (ud) - { - ud->field_hash = cheevos_djb2(name, length); - if (ud->field_hash == CHEEVOS_JSON_KEY_ACHIEVEMENTS) - ud->in_cheevos = 1; - else if (ud->field_hash == CHEEVOS_JSON_KEY_LEADERBOARDS) - ud->in_lboards = 1; - } - - return 0; -} - -static int cheevos_count__json_number(void *userdata, - const char *number, size_t length) -{ - cheevos_countud_t* ud = (cheevos_countud_t*)userdata; - - if (ud) - { - if (ud->in_cheevos && ud->field_hash == CHEEVOS_JSON_KEY_FLAGS) - { - long flags = strtol(number, NULL, 10); - - if (flags == 3) - ud->core_count++; /* Core achievements */ - else if (flags == 5) - ud->unofficial_count++; /* Unofficial achievements */ - } - else if (ud->in_lboards && ud->field_hash == CHEEVOS_JSON_KEY_ID) - ud->lboard_count++; - } - - return 0; -} - -static int cheevos_count_cheevos(const char *json, - unsigned *core_count, unsigned *unofficial_count, - unsigned *lboard_count) -{ - static const jsonsax_handlers_t handlers = - { - NULL, - NULL, - NULL, - NULL, - NULL, - cheevos_count__json_end_array, - cheevos_count__json_key, - NULL, - NULL, - cheevos_count__json_number, - NULL, - NULL - }; - - int res; - cheevos_countud_t ud; - ud.in_cheevos = 0; - ud.in_lboards = 0; - ud.core_count = 0; - ud.unofficial_count = 0; - ud.lboard_count = 0; - - res = jsonsax_parse(json, &handlers, (void*)&ud); - - *core_count = ud.core_count; - *unofficial_count = ud.unofficial_count; - *lboard_count = ud.lboard_count; - - return res; -} - -/***************************************************************************** -Parse the MemAddr field. -*****************************************************************************/ - -static unsigned cheevos_count_cond_sets(const char *memaddr) -{ - cheevos_cond_t cond; - unsigned count = 0; - - for (;;) - { - count++; - - for (;;) - { - cheevos_cond_parse(&cond, &memaddr); - - if (*memaddr != '_') - break; - - memaddr++; + cheevo = cheevos_locals.unofficial; + rac = cheevos_locals.patchdata.unofficial; + count = cheevos_locals.patchdata.unofficial_count; } - if (*memaddr != 'S') - break; - - memaddr++; - } - - return count; -} - -static int cheevos_parse_condition( - cheevos_condition_t *condition, - const char* memaddr) -{ - if (!condition) - return 0; - - condition->count = cheevos_count_cond_sets(memaddr); - - if (condition->count) - { - unsigned set = 0; - const cheevos_condset_t* end = NULL; - cheevos_condset_t *conds = NULL; - cheevos_condset_t *condset = NULL; - cheevos_condset_t *condsets = (cheevos_condset_t*) - calloc(condition->count, sizeof(cheevos_condset_t)); - - (void)conds; - - if (!condsets) - return -1; - - condition->condsets = condsets; - end = condition->condsets + condition->count; - - for (condset = condition->condsets; condset < end; condset++, set++) + for (j = 0; j < count; j++, cheevo++, rac++) { - condset->count = - cheevos_cond_count_in_set(memaddr, set); - condset->conds = NULL; + cheevo->info = rac; + res = rc_trigger_size(cheevo->info->memaddr); - CHEEVOS_LOG("[CHEEVOS]: set %p (index=%u)\n", condset, set); - CHEEVOS_LOG("[CHEEVOS]: conds: %u\n", condset->count); - - if (condset->count) + if (res < 0) { - cheevos_cond_t *conds = (cheevos_cond_t*) - calloc(condset->count, sizeof(cheevos_cond_t)); - - if (!conds) - { - while (--condset >= condition->condsets) - { - if ((void*)condset->conds) - free((void*)condset->conds); - } - - return -1; - } - - condset->conds = conds; - cheevos_cond_parse_in_set(condset->conds, memaddr, set); - } - } - } - - return 0; -} - -static void cheevos_free_condition(cheevos_condition_t* condition) -{ - unsigned i; - - if (!condition) - return; - - if (condition->condsets) - { - for (i = 0; i < condition->count; i++) - { - if (condition->condsets[i].conds) - { - free(condition->condsets[i].conds); - condition->condsets[i].conds = NULL; - } - } - - if (condition->condsets) - { - free(condition->condsets); - condition->condsets = NULL; - } - } -} - -/***************************************************************************** -Parse the Mem field of leaderboards. -*****************************************************************************/ - -static int cheevos_parse_expression(cheevos_expr_t *expr, const char* mem) -{ - unsigned i; - const char *aux; - cheevos_term_t *terms = NULL; - char *end = NULL; - - if (!expr) - return -1; - - expr->count = 1; - expr->compare_count = 1; - - for (aux = mem;; aux++) - { - if (*aux == '"' || *aux == ':') - break; - expr->count += *aux == '_'; - } - - if (expr->count > 0) - terms = (cheevos_term_t*) - calloc(expr->count, sizeof(cheevos_term_t)); - - if (!terms) - return -1; - - expr->terms = terms; - - for (i = 0; i < expr->count; i++) - { - expr->terms[i].compare_next = false; - expr->terms[i].multiplier = 1; - } - - for (i = 0, aux = mem; i < expr->count;) - { - cheevos_var_parse(&expr->terms[i].var, &aux); - - if (*aux != '*') - { - /* expression has no multiplier */ - if (*aux == '_') - { - aux++; - i++; - } - else if (*aux == '$') - { - expr->terms[i].compare_next = true; - expr->compare_count++; - aux++; - i++; - } - - /* no multiplier at end of string */ - else if (*aux == '\0' || *aux == '"' || *aux == ',') - return 0; - - /* invalid character in expression */ - else - { - if (expr->terms) - { - free(expr->terms); - expr->terms = NULL; - } - return -1; - } - } - else - { - if (aux[1] == 'h' || aux[1] == 'H') - expr->terms[i].multiplier = (double)strtol(aux + 2, &end, 16); - else - expr->terms[i].multiplier = strtod(aux + 1, &end); - aux = end; - - if (*aux == '$') - { - aux++; - expr->terms[i].compare_next = true; - expr->compare_count++; - } - else - expr->terms[i].compare_next = false; - - aux++; - i++; - } - } - return 0; -} - -static int cheevos_parse_mem(cheevos_leaderboard_t *lb, const char* mem) -{ - lb->start.condsets = NULL; - lb->cancel.condsets = NULL; - lb->submit.condsets = NULL; - lb->value.terms = NULL; - - for (;;) - { - if (*mem == 'S' && mem[1] == 'T' && mem[2] == 'A' && mem[3] == ':') - { - if (cheevos_parse_condition(&lb->start, mem + 4)) + CHEEVOS_ERR(CHEEVOS_TAG "Error in cheevo memaddr %s: %s", + cheevo->info->memaddr, cheevos_rc_error(res)); goto error; - } - else if (*mem == 'C' && mem[1] == 'A' && mem[2] == 'N' && mem[3] == ':') - { - if (cheevos_parse_condition(&lb->cancel, mem + 4)) - goto error; - } - else if (*mem == 'S' && mem[1] == 'U' && mem[2] == 'B' && mem[3] == ':') - { - if (cheevos_parse_condition(&lb->submit, mem + 4)) - goto error; - } - else if (*mem == 'V' && mem[1] == 'A' && mem[2] == 'L' && mem[3] == ':') - { - if (cheevos_parse_expression(&lb->value, mem + 4)) - goto error; - } - - for (mem += 4;; mem++) - { - if (*mem == ':' && mem[1] == ':') - { - mem += 2; - break; } - else if (*mem == '"') - return 0; + + cheevo->trigger = (rc_trigger_t*)calloc(1, res); + + if (!cheevo->trigger) + { + CHEEVOS_ERR(CHEEVOS_TAG "Error allocating memory for cheevos"); + goto error; + } + + rc_parse_trigger(cheevo->trigger, cheevo->info->memaddr, NULL, 0); + cheevo->active = CHEEVOS_ACTIVE_SOFTCORE | CHEEVOS_ACTIVE_HARDCORE; + cheevo->last = 1; } } -error: - cheevos_free_condition(&lb->start); - cheevos_free_condition(&lb->cancel); - cheevos_free_condition(&lb->submit); - if (lb->value.terms) + lboard = cheevos_locals.lboards; + count = cheevos_locals.patchdata.lboard_count; + + for (j = 0; j < count; j++, lboard++) { - free((void*)lb->value.terms); - lb->value.terms = NULL; + lboard->info = cheevos_locals.patchdata.lboards + j; + res = rc_lboard_size(lboard->info->mem); + + if (res < 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "Error in leaderboard mem %s: %s", + lboard->info->mem, cheevos_rc_error(res)); + goto error; + } + + lboard->lboard = (rc_lboard_t*)calloc(1, res); + + if (!lboard->lboard) + { + CHEEVOS_ERR(CHEEVOS_TAG "Error allocating memory for cheevos"); + goto error; + } + + rc_parse_lboard(lboard->lboard, + lboard->info->mem, NULL, 0); + lboard->active = false; + lboard->last_value = 0; + lboard->format = rc_parse_format(lboard->info->format); } - return -1; -} - -/***************************************************************************** -Load achievements from a JSON string. -*****************************************************************************/ - -static INLINE const char *cheevos_dupstr(const cheevos_field_t *field) -{ - char *string = (char*)malloc(field->length + 1); - - if (!string) - return NULL; - - memcpy ((void*)string, (void*)field->string, field->length); - string[field->length] = 0; - - return string; -} - -static int cheevos_new_cheevo(cheevos_readud_t *ud) -{ - cheevo_t *cheevo = NULL; - long flags = strtol(ud->flags.string, NULL, 10); - - if (flags == 3) - cheevo = cheevos_locals.core.cheevos + ud->core_count++; - else if (flags == 5) - cheevo = cheevos_locals.unofficial.cheevos + ud->unofficial_count++; - else - return 0; - - cheevo->id = (unsigned)strtol(ud->id.string, NULL, 10); - cheevo->title = cheevos_dupstr(&ud->title); - cheevo->description = cheevos_dupstr(&ud->desc); - cheevo->author = cheevos_dupstr(&ud->author); - cheevo->badge = cheevos_dupstr(&ud->badge); - cheevo->points = (unsigned)strtol(ud->points.string, NULL, 10); - cheevo->dirty = 0; - cheevo->active = CHEEVOS_ACTIVE_SOFTCORE | CHEEVOS_ACTIVE_HARDCORE; - cheevo->last = 1; - cheevo->modified = 0; - - if ( !cheevo->title || - !cheevo->description || - !cheevo->author || - !cheevo->badge) - goto error; - - if (cheevos_parse_condition(&cheevo->condition, ud->memaddr.string)) - goto error; return 0; error: - if (cheevo->title) - { - free((void*)cheevo->title); - cheevo->title = NULL; - } - if (cheevo->description) - { - free((void*)cheevo->description); - cheevo->description = NULL; - } - if (cheevo->author) - { - free((void*)cheevo->author); - cheevo->author = NULL; - } - if (cheevo->badge) - { - free((void*)cheevo->badge); - cheevo->badge = NULL; - } - return -1; -} - -/***************************************************************************** -Helper functions for displaying leaderboard values. -*****************************************************************************/ - -static void cheevos_format_value(const unsigned value, const unsigned type, - char* formatted_value, size_t formatted_size) -{ - unsigned mins, secs, millis; - - switch(type) - { - case CHEEVOS_FORMAT_VALUE: - snprintf(formatted_value, formatted_size, "%u", value); - break; - - case CHEEVOS_FORMAT_SCORE: - snprintf(formatted_value, formatted_size, - "%06upts", value); - break; - - case CHEEVOS_FORMAT_FRAMES: - mins = value / 3600; - secs = (value % 3600) / 60; - millis = (int) (value % 60) * (10.00 / 6.00); - snprintf(formatted_value, formatted_size, - "%02u:%02u.%02u", mins, secs, millis); - break; - - case CHEEVOS_FORMAT_MILLIS: - mins = value / 6000; - secs = (value % 6000) / 100; - millis = (int) (value % 100); - snprintf(formatted_value, formatted_size, - "%02u:%02u.%02u", mins, secs, millis); - break; - - case CHEEVOS_FORMAT_SECS: - mins = value / 60; - secs = value % 60; - snprintf(formatted_value, formatted_size, - "%02u:%02u", mins, secs); - break; - - default: - snprintf(formatted_value, formatted_size, - "%u (?)", value); - } -} - -unsigned cheevos_parse_format(cheevos_field_t* format) -{ - /* Most likely */ - if (strncmp(format->string, "VALUE", format->length) == 0) - return CHEEVOS_FORMAT_VALUE; - else if (strncmp(format->string, "TIME", format->length) == 0) - return CHEEVOS_FORMAT_FRAMES; - else if (strncmp(format->string, "SCORE", format->length) == 0) - return CHEEVOS_FORMAT_SCORE; - - /* Less likely */ - else if (strncmp(format->string, "MILLISECS", format->length) == 0) - return CHEEVOS_FORMAT_MILLIS; - else if (strncmp(format->string, "TIMESECS", format->length) == 0) - return CHEEVOS_FORMAT_SECS; - - /* Rare (RPS only) */ - else if (strncmp(format->string, "POINTS", format->length) == 0) - return CHEEVOS_FORMAT_SCORE; - else if (strncmp(format->string, "FRAMES", format->length) == 0) - return CHEEVOS_FORMAT_FRAMES; - else - return CHEEVOS_FORMAT_OTHER; -} - -static int cheevos_new_lboard(cheevos_readud_t *ud) -{ - cheevos_leaderboard_t *lboard = NULL; - cheevos_leaderboard_t *ldb = cheevos_locals.leaderboards; - - if (!ldb || !ud) - return -1; - - lboard = ldb + ud->lboard_count++; - - lboard->id = (unsigned)strtol(ud->id.string, NULL, 10); - lboard->format = cheevos_parse_format(&ud->format); - lboard->title = cheevos_dupstr(&ud->title); - lboard->description = cheevos_dupstr(&ud->desc); - - if (!lboard->title || !lboard->description) - goto error; - - if (cheevos_parse_mem(lboard, ud->memaddr.string)) - goto error; - - return 0; - -error: - if ((void*)lboard->title) - free((void*)lboard->title); - if ((void*)lboard->description) - free((void*)lboard->description); - return -1; -} - -static int cheevos_read__json_key( void *userdata, - const char *name, size_t length) -{ - cheevos_readud_t *ud = (cheevos_readud_t*)userdata; - - if (ud) - { - int common = ud->in_cheevos || ud->in_lboards; - uint32_t hash = cheevos_djb2(name, length); - ud->field = NULL; - - switch (hash) - { - case CHEEVOS_JSON_KEY_ACHIEVEMENTS: - ud->in_cheevos = 1; - break; - case CHEEVOS_JSON_KEY_LEADERBOARDS: - ud->in_lboards = 1; - break; - case CHEEVOS_JSON_KEY_CONSOLE_ID: - ud->is_console_id = 1; - break; - case CHEEVOS_JSON_KEY_ID: - if (common) - ud->field = &ud->id; - break; - case CHEEVOS_JSON_KEY_MEMADDR: - if (ud->in_cheevos) - ud->field = &ud->memaddr; - break; - case CHEEVOS_JSON_KEY_MEM: - if (ud->in_lboards) - ud->field = &ud->memaddr; - break; - case CHEEVOS_JSON_KEY_TITLE: - if (common) - ud->field = &ud->title; - break; - case CHEEVOS_JSON_KEY_DESCRIPTION: - if (common) - ud->field = &ud->desc; - break; - case CHEEVOS_JSON_KEY_POINTS: - if (ud->in_cheevos) - ud->field = &ud->points; - break; - case CHEEVOS_JSON_KEY_AUTHOR: - if (ud->in_cheevos) - ud->field = &ud->author; - break; - case CHEEVOS_JSON_KEY_MODIFIED: - if (ud->in_cheevos) - ud->field = &ud->modified; - break; - case CHEEVOS_JSON_KEY_CREATED: - if (ud->in_cheevos) - ud->field = &ud->created; - break; - case CHEEVOS_JSON_KEY_BADGENAME: - if (ud->in_cheevos) - ud->field = &ud->badge; - break; - case CHEEVOS_JSON_KEY_FLAGS: - if (ud->in_cheevos) - ud->field = &ud->flags; - break; - case CHEEVOS_JSON_KEY_FORMAT: - if (ud->in_lboards) - ud->field = &ud->format; - break; - default: - break; - } - } - - return 0; -} - -static int cheevos_read__json_string(void *userdata, - const char *string, size_t length) -{ - cheevos_readud_t *ud = (cheevos_readud_t*)userdata; - - if (ud && ud->field) - { - ud->field->string = string; - ud->field->length = length; - } - - return 0; -} - -static int cheevos_read__json_number(void *userdata, - const char *number, size_t length) -{ - cheevos_readud_t *ud = (cheevos_readud_t*)userdata; - - if (ud) - { - if (ud->field) - { - ud->field->string = number; - ud->field->length = length; - } - else if (ud->is_console_id) - { - cheevos_locals.console_id = (cheevos_console_t) - strtol(number, NULL, 10); - ud->is_console_id = 0; - } - } - - return 0; -} - -static int cheevos_read__json_end_object(void *userdata) -{ - cheevos_readud_t *ud = (cheevos_readud_t*)userdata; - - if (ud) - { - if (ud->in_cheevos) - return cheevos_new_cheevo(ud); - if (ud->in_lboards) - return cheevos_new_lboard(ud); - } - - return 0; -} - -static int cheevos_read__json_end_array(void *userdata) -{ - cheevos_readud_t *ud = (cheevos_readud_t*)userdata; - - if (ud) - { - ud->in_cheevos = 0; - ud->in_lboards = 0; - } - - return 0; -} - -static int cheevos_parse(const char *json) -{ - static const jsonsax_handlers_t handlers = - { - NULL, - NULL, - NULL, - cheevos_read__json_end_object, - NULL, - cheevos_read__json_end_array, - cheevos_read__json_key, - NULL, - cheevos_read__json_string, - cheevos_read__json_number, - NULL, - NULL - }; - - cheevos_readud_t ud; - unsigned core_count, unofficial_count, lboard_count; - /* Count the number of achievements in the JSON file. */ - int res = cheevos_count_cheevos(json, &core_count, &unofficial_count, - &lboard_count); - - if (res != JSONSAX_OK) - return -1; - - /* Allocate the achievements. */ - - cheevos_locals.core.cheevos = (cheevo_t*) - calloc(core_count, sizeof(cheevo_t)); - cheevos_locals.core.count = core_count; - - cheevos_locals.unofficial.cheevos = (cheevo_t*) - calloc(unofficial_count, sizeof(cheevo_t)); - cheevos_locals.unofficial.count = unofficial_count; - - cheevos_locals.leaderboards = (cheevos_leaderboard_t*) - calloc(lboard_count, sizeof(cheevos_leaderboard_t)); - cheevos_locals.lboard_count = lboard_count; - - if ( !cheevos_locals.core.cheevos || - !cheevos_locals.unofficial.cheevos || - !cheevos_locals.leaderboards) - { - if ((void*)cheevos_locals.core.cheevos) - free((void*)cheevos_locals.core.cheevos); - if ((void*)cheevos_locals.unofficial.cheevos) - free((void*)cheevos_locals.unofficial.cheevos); - if ((void*)cheevos_locals.leaderboards) - free((void*)cheevos_locals.leaderboards); - cheevos_locals.core.count = cheevos_locals.unofficial.count = - cheevos_locals.lboard_count = 0; - - return -1; - } - - /* Load the achievements. */ - ud.in_cheevos = 0; - ud.in_lboards = 0; - ud.is_console_id = 0; - ud.field = NULL; - ud.core_count = 0; - ud.unofficial_count = 0; - ud.lboard_count = 0; - - if (jsonsax_parse(json, &handlers, (void*)&ud) != JSONSAX_OK) - goto error; - - return 0; - -error: - cheevos_unload(); - + CHEEVOS_FREE(cheevos_locals.core); + CHEEVOS_FREE(cheevos_locals.unofficial); + CHEEVOS_FREE(cheevos_locals.lboards); + cheevos_free_patchdata(&cheevos_locals.patchdata); + cheevos_fixup_destroy(&cheevos_locals.fixups); return -1; } @@ -1256,640 +401,261 @@ error: Test all the achievements (call once per frame). *****************************************************************************/ -static int cheevos_test_condition(cheevos_cond_t *cond) -{ - unsigned sval = 0; - unsigned tval = 0; - - if (!cond) - return 0; - - sval = cheevos_var_get_value(&cond->source) + - cheevos_locals.add_buffer; - tval = cheevos_var_get_value(&cond->target); - - switch (cond->op) - { - case CHEEVOS_COND_OP_EQUALS: - return (sval == tval); - case CHEEVOS_COND_OP_LESS_THAN: - return (sval < tval); - case CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL: - return (sval <= tval); - case CHEEVOS_COND_OP_GREATER_THAN: - return (sval > tval); - case CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL: - return (sval >= tval); - case CHEEVOS_COND_OP_NOT_EQUAL_TO: - return (sval != tval); - default: - break; - } - - return 1; -} - -static int cheevos_test_pause_cond_set(const cheevos_condset_t *condset, - int *dirty_conds, int *reset_conds, int process_pause) -{ - int cond_valid = 0; - int set_valid = 1; /* must start true so AND logic works */ - cheevos_cond_t *cond = NULL; - const cheevos_cond_t *end = condset->conds + condset->count; - - cheevos_locals.add_buffer = 0; - cheevos_locals.add_hits = 0; - - for (cond = condset->conds; cond < end; cond++) - { - if (cond->pause != process_pause) - continue; - - if (cond->type == CHEEVOS_COND_TYPE_ADD_SOURCE) - { - cheevos_locals.add_buffer += cheevos_var_get_value(&cond->source); - continue; - } - - if (cond->type == CHEEVOS_COND_TYPE_SUB_SOURCE) - { - cheevos_locals.add_buffer -= cheevos_var_get_value(&cond->source); - continue; - } - - if (cond->type == CHEEVOS_COND_TYPE_ADD_HITS) - { - if (cheevos_test_condition(cond)) - { - cond->curr_hits++; - *dirty_conds = 1; - } - - cheevos_locals.add_hits += cond->curr_hits; - continue; - } - - /* always evaluate the condition to ensure delta values get tracked correctly */ - cond_valid = cheevos_test_condition(cond); - - /* if the condition has a target hit count that has already been met, - * it's automatically true, even if not currently true. */ - if ( (cond->req_hits != 0) && - (cond->curr_hits + cheevos_locals.add_hits) >= cond->req_hits) - { - cond_valid = 1; - } - else if (cond_valid) - { - cond->curr_hits++; - *dirty_conds = 1; - - /* Process this logic, if this condition is true: */ - if (cond->req_hits == 0) - ; /* Not a hit-based requirement: ignore any additional logic! */ - else if ((cond->curr_hits + cheevos_locals.add_hits) < cond->req_hits) - cond_valid = 0; /* HitCount target has not yet been met, condition is not yet valid. */ - } - - cheevos_locals.add_buffer = 0; - cheevos_locals.add_hits = 0; - - if (cond->type == CHEEVOS_COND_TYPE_PAUSE_IF) - { - /* as soon as we find a PauseIf that evaluates to true, - * stop processing the rest of the group. */ - if (cond_valid) - return 1; - - /* if we make it to the end of the function, make sure we are - * indicating nothing matched. if we do find a later PauseIf match, - * it'll automatically return true via the previous condition. */ - set_valid = 0; - - if (cond->req_hits == 0) - { - /* PauseIf didn't evaluate true, and doesn't have a HitCount, - * reset the HitCount to indicate the condition didn't match. */ - if (cond->curr_hits != 0) - { - cond->curr_hits = 0; - *dirty_conds = 1; - } - } - else - { - /* PauseIf has a HitCount that hasn't been met, ignore it for now. */ - } - } - else if (cond->type == CHEEVOS_COND_TYPE_RESET_IF) - { - if (cond_valid) - { - *reset_conds = 1; /* Resets all hits found so far */ - set_valid = 0; /* Cannot be valid if we've hit a reset condition. */ - } - } - else /* Sequential or non-sequential? */ - set_valid &= cond_valid; - } - - return set_valid; -} - -static int cheevos_test_cond_set(const cheevos_condset_t *condset, - int *dirty_conds, int *reset_conds) -{ - int in_pause = 0; - int has_pause = 0; - cheevos_cond_t *cond = NULL; - - if (!condset) - return 1; /* important: empty group must evaluate true */ - - /* the ints below are used for Pause conditions and their dependent AddSource/AddHits. */ - - /* this loop needs to go backwards to check AddSource/AddHits */ - cond = condset->conds + condset->count - 1; - for (; cond >= condset->conds; cond--) - { - if (cond->type == CHEEVOS_COND_TYPE_PAUSE_IF) - { - has_pause = 1; - in_pause = 1; - cond->pause = 1; - } - else if (cond->type == CHEEVOS_COND_TYPE_ADD_SOURCE || - cond->type == CHEEVOS_COND_TYPE_SUB_SOURCE || - cond->type == CHEEVOS_COND_TYPE_ADD_HITS) - { - cond->pause = in_pause; - } - else - { - in_pause = 0; - cond->pause = 0; - } - } - - if (has_pause) - { /* one or more Pause conditions exists, if any of them are true, - * stop processing this group. */ - if (cheevos_test_pause_cond_set(condset, dirty_conds, reset_conds, 1)) - return 0; - } - - /* process the non-Pause conditions to see if the group is true */ - return cheevos_test_pause_cond_set(condset, dirty_conds, reset_conds, 0); -} - -static int cheevos_reset_cond_set(cheevos_condset_t *condset, int deltas) -{ - int dirty = 0; - const cheevos_cond_t *end = NULL; - - if (!condset) - return 0; - - end = condset->conds + condset->count; - - if (deltas) - { - cheevos_cond_t *cond = NULL; - for (cond = condset->conds; cond < end; cond++) - { - dirty |= cond->curr_hits != 0; - - cond->curr_hits = 0; - - cond->source.previous = cond->source.value; - cond->target.previous = cond->target.value; - } - } - else - { - cheevos_cond_t *cond = NULL; - for (cond = condset->conds; cond < end; cond++) - { - dirty |= cond->curr_hits != 0; - cond->curr_hits = 0; - } - } - - return dirty; -} - -static int cheevos_test_cheevo(cheevo_t *cheevo) -{ - int dirty_conds = 0; - int reset_conds = 0; - int ret_val = 0; - int ret_val_sub_cond = 0; - cheevos_condset_t *condset = NULL; - cheevos_condset_t *end = NULL; - - if (!cheevo) - return 0; - - ret_val_sub_cond = cheevo->condition.count == 1; - condset = cheevo->condition.condsets; - - if (!condset) - return 0; - - end = condset + cheevo->condition.count; - - if (condset < end) - { - ret_val = cheevos_test_cond_set(condset, &dirty_conds, &reset_conds); - condset++; - } - - while (condset < end) - { - ret_val_sub_cond |= cheevos_test_cond_set( - condset, &dirty_conds, &reset_conds); - condset++; - } - - if (dirty_conds) - cheevo->dirty |= CHEEVOS_DIRTY_CONDITIONS; - - if (reset_conds) - { - int dirty = 0; - - for (condset = cheevo->condition.condsets; condset < end; condset++) - dirty |= cheevos_reset_cond_set(condset, 0); - - if (dirty) - cheevo->dirty |= CHEEVOS_DIRTY_CONDITIONS; - } - - return (ret_val && ret_val_sub_cond); -} - -static void cheevos_url_encode(const char *str, char *encoded, size_t len) -{ - if (!str) - return; - - while (*str) - { - if ( isalnum((unsigned char)*str) || *str == '-' - || *str == '_' || *str == '.' - || *str == '~') - { - if (len >= 2) - { - *encoded++ = *str++; - len--; - } - else - break; - } - else - { - if (len >= 4) - { - snprintf(encoded, len, "%%%02x", (uint8_t)*str); - encoded += 3; - str++; - len -= 3; - } - else - break; - } - } - - *encoded = 0; -} - -static void cheevos_make_unlock_url(const cheevo_t *cheevo, - char* url, size_t url_size) +static void cheevos_award_task_softcore(void* task_data, void* user_data, + const char* error) { settings_t *settings = config_get_ptr(); + const cheevos_cheevo_t* cheevo = (const cheevos_cheevo_t*)user_data; + char buffer[256]; + int ret; + buffer[0] = 0; - if (!settings) + if (error == NULL) + { + CHEEVOS_LOG(CHEEVOS_TAG "Awarded achievement %u\n", cheevo->info->id); return; + } - snprintf( - url, url_size, - "http://retroachievements.org/dorequest.php?r=awardachievement&u=%s&t=%s&a=%u&h=%d", - settings->arrays.cheevos_username, - cheevos_locals.token, - cheevo->id, - settings->bools.cheevos_hardcore_mode_enable && !cheevos_hardcore_paused ? 1 : 0 - ); + if (*error) + CHEEVOS_ERR(CHEEVOS_TAG "Error awarding achievement %u: %s\n", cheevo->info->id, error); - url[url_size - 1] = 0; + /* Try again. */ + ret = rc_url_award_cheevo(buffer, sizeof(buffer), settings->arrays.cheevos_username, cheevos_locals.token, cheevo->info->id, 0); -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to award the cheevo: %s\n", url); -#endif + if (ret != 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "Buffer to small to create URL"); + return; + } + + cheevos_log_url(CHEEVOS_TAG "rc_url_award_cheevo: %s\n", buffer); + task_push_http_transfer(buffer, true, NULL, cheevos_award_task_softcore, user_data); } -static void cheevos_unlocked(void *task_data, void *user_data, - const char *error) -{ - cheevo_t *cheevo = (cheevo_t *)user_data; - - if (!error) - { - CHEEVOS_LOG("[CHEEVOS]: awarded achievement %u.\n", cheevo->id); - } - else - { - char url[256]; - url[0] = '\0'; - - CHEEVOS_ERR("[CHEEVOS]: error awarding achievement %u, retrying...\n", cheevo->id); - - cheevos_make_unlock_url(cheevo, url, sizeof(url)); - task_push_http_transfer(url, true, NULL, cheevos_unlocked, cheevo); - } -} - -static void cheevos_test_cheevo_set(const cheevoset_t *set) +static void cheevos_award_task_hardcore(void* task_data, void* user_data, + const char* error) { settings_t *settings = config_get_ptr(); - int mode = CHEEVOS_ACTIVE_SOFTCORE; - cheevo_t *cheevo = NULL; - const cheevo_t *end = NULL; + const cheevos_cheevo_t* cheevo = (const cheevos_cheevo_t*)user_data; + char buffer[256]; + int ret; + buffer[0] = 0; - if (!set) + if (error == NULL) + { + CHEEVOS_LOG(CHEEVOS_TAG "Awarded achievement %u\n", cheevo->info->id); return; + } - end = set->cheevos + set->count; + if (*error) + CHEEVOS_ERR(CHEEVOS_TAG "Error awarding achievement %u: %s\n", cheevo->info->id, error); + + /* Try again. */ + ret = rc_url_award_cheevo(buffer, sizeof(buffer), settings->arrays.cheevos_username, cheevos_locals.token, cheevo->info->id, 1); + + if (ret != 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "Buffer to small to create URL\n"); + return; + } + + cheevos_log_url(CHEEVOS_TAG "rc_url_award_cheevo: %s\n", buffer); + task_push_http_transfer(buffer, true, NULL, cheevos_award_task_hardcore, user_data); +} + +static void cheevos_award(cheevos_cheevo_t* cheevo, int mode) +{ + settings_t *settings = config_get_ptr(); + int ret; + char buffer[256]; + buffer[0] = 0; + + CHEEVOS_LOG(CHEEVOS_TAG "awarding cheevo %u: %s (%s)\n", + cheevo->info->id, cheevo->info->title, cheevo->info->description); + + /* Deactivates the cheevo. */ + cheevo->active &= ~mode; + + if (mode == CHEEVOS_ACTIVE_HARDCORE) + cheevo->active &= ~CHEEVOS_ACTIVE_SOFTCORE; + + /* Show the OSD message. */ + snprintf(buffer, sizeof(buffer), "Achievement Unlocked: %s", cheevo->info->title); + runloop_msg_queue_push(buffer, 0, 2 * 60, false); + runloop_msg_queue_push(cheevo->info->description, 0, 3 * 60, false); + + /* Start the award task. */ + if ((mode & CHEEVOS_ACTIVE_HARDCORE) != 0) + cheevos_award_task_hardcore(NULL, cheevo, ""); + else + cheevos_award_task_softcore(NULL, cheevo, ""); + + /* Take a screenshot of the achievement. */ + if (settings && settings->bools.cheevos_auto_screenshot) + { + snprintf(buffer, sizeof(buffer), "%s/%s-cheevo-%u", + settings->paths.directory_screenshot, + path_basename(path_get(RARCH_PATH_BASENAME)), + cheevo->info->id); + + if (take_screenshot(buffer, true, + video_driver_cached_frame_has_valid_framebuffer())) + CHEEVOS_LOG(CHEEVOS_TAG "Took a screenshot for cheevo %u\n", cheevo->info->id); + else + CHEEVOS_LOG(CHEEVOS_TAG "Failed to take screenshot for cheevo %u\n", cheevo->info->id); + } +} + +static unsigned cheevos_peek(unsigned address, unsigned num_bytes, void* ud) +{ + const uint8_t* data = cheevos_fixup_find(&cheevos_locals.fixups, address, cheevos_locals.console_id); + unsigned value = 0; + + switch (num_bytes) + { + case 4: value |= data[2] << 16 | data[3] << 24; + case 2: value |= data[1] << 8; + case 1: value |= data[0]; + } + + return value; +} + +static void cheevos_test_cheevo_set(bool official) +{ + settings_t *settings = config_get_ptr(); + int mode = CHEEVOS_ACTIVE_SOFTCORE; + cheevos_cheevo_t* cheevo; + int i, count, valid; if (settings && settings->bools.cheevos_hardcore_mode_enable && !cheevos_hardcore_paused) mode = CHEEVOS_ACTIVE_HARDCORE; - for (cheevo = set->cheevos; cheevo < end; cheevo++) + if (official) { + cheevo = cheevos_locals.core; + count = cheevos_locals.patchdata.core_count; + } + else + { + cheevo = cheevos_locals.unofficial; + count = cheevos_locals.patchdata.unofficial_count; + } + + for (i = 0; i < count; i++, cheevo++) + { + /* Check if the achievement is active for the current mode. */ + if ((cheevo->active & mode) == 0) + continue; + if (cheevo->active & mode) { - int valid = cheevos_test_cheevo(cheevo); + int valid = rc_test_trigger(cheevo->trigger, cheevos_peek, NULL, NULL); if (cheevo->last) - { - cheevos_condset_t* condset = cheevo->condition.condsets; - const cheevos_condset_t* end = cheevo->condition.condsets - + cheevo->condition.count; - - for (; condset < end; condset++) - cheevos_reset_cond_set(condset, 0); - } + rc_reset_trigger(cheevo->trigger); else if (valid) - { - char msg[256]; - char url[256]; - msg[0] = url[0] = '\0'; - - cheevo->active &= ~mode; - - if (mode == CHEEVOS_ACTIVE_HARDCORE) - cheevo->active &= ~CHEEVOS_ACTIVE_SOFTCORE; - - CHEEVOS_LOG("[CHEEVOS]: awarding cheevo %u: %s (%s).\n", - cheevo->id, cheevo->title, cheevo->description); - - snprintf(msg, sizeof(msg), "Achievement Unlocked: %s", - cheevo->title); - msg[sizeof(msg) - 1] = 0; - runloop_msg_queue_push(msg, 0, 2 * 60, false); - runloop_msg_queue_push(cheevo->description, 0, 3 * 60, false); - - cheevos_make_unlock_url(cheevo, url, sizeof(url)); - task_push_http_transfer(url, true, NULL, - cheevos_unlocked, cheevo); - - if (settings && settings->bools.cheevos_auto_screenshot) - { - char shotname[256]; - - snprintf(shotname, sizeof(shotname), "%s/%s-cheevo-%u", - settings->paths.directory_screenshot, - path_basename(path_get(RARCH_PATH_BASENAME)), - cheevo->id); - shotname[sizeof(shotname) - 1] = '\0'; - - if (take_screenshot(shotname, true, - video_driver_cached_frame_has_valid_framebuffer())) - CHEEVOS_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->id); - else - CHEEVOS_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->id); - } - } + cheevos_award(cheevo, mode); cheevo->last = valid; } } } -static int cheevos_test_lboard_condition(const cheevos_condition_t* condition) -{ - int dirty_conds = 0; - int reset_conds = 0; - int ret_val = 0; - int ret_val_sub_cond = 0; - cheevos_condset_t *condset = NULL; - const cheevos_condset_t *end = NULL; - - if (!condition) - return 0; - - ret_val_sub_cond = condition->count == 1; - condset = condition->condsets; - end = condset + condition->count; - - if (condset < end) - { - ret_val = cheevos_test_cond_set( - condset, &dirty_conds, &reset_conds); - condset++; - } - - while (condset < end) - { - ret_val_sub_cond |= cheevos_test_cond_set( - condset, &dirty_conds, &reset_conds); - condset++; - } - - if (reset_conds) - { - for (condset = condition->condsets; condset < end; condset++) - cheevos_reset_cond_set(condset, 0); - } - - return (ret_val && ret_val_sub_cond); -} - -static int cheevos_expr_value(cheevos_expr_t* expr) -{ - unsigned i; - int values[16]; - /* Separate possible values with '$' operator, submit the largest */ - unsigned current_value = 0; - cheevos_term_t* term = NULL; - - if (!expr) - return 0; - - term = expr->terms; - - if (!term) - return 0; - - if (expr->compare_count >= ARRAY_SIZE(values)) - { - CHEEVOS_ERR("[CHEEVOS]: too many values in the leaderboard expression: %u\n", expr->compare_count); - return 0; - } - - memset(values, 0, sizeof values); - - for (i = expr->count; i != 0; i--, term++) - { - if (current_value >= ARRAY_SIZE(values)) - { - CHEEVOS_ERR("[CHEEVOS]: too many values in the leaderboard expression: %u\n", current_value); - return 0; - } - - values[current_value] += - cheevos_var_get_value(&term->var) * term->multiplier; - - if (term->compare_next) - current_value++; - } - - if (expr->compare_count > 1) - { - unsigned j; - int maximum = values[0]; - - for (j = 1; j < expr->compare_count; j++) - maximum = values[j] > maximum ? values[j] : maximum; - - return maximum; - } - else - return values[0]; -} - -static void cheevos_make_lboard_url(const cheevos_leaderboard_t *lboard, - char* url, size_t url_size) +static void cheevos_lboard_submit_task(void* task_data, void* user_data, + const char* error) { + settings_t *settings = config_get_ptr(); + const cheevos_lboard_t* lboard = (const cheevos_lboard_t*)user_data; MD5_CTX ctx; uint8_t hash[16]; char signature[64]; - settings_t *settings = config_get_ptr(); + char buffer[256]; + int ret; - hash[0] = '\0'; + if (!error) + { + CHEEVOS_LOG(CHEEVOS_TAG "Submitted leaderboard %u\n", lboard->info->id); + return; + } - snprintf(signature, sizeof(signature), "%u%s%u", lboard->id, + CHEEVOS_ERR(CHEEVOS_TAG "Error submitting leaderboard %u: %s\n", lboard->info->id, error); + + /* Try again. */ + + /* Evaluate the signature. */ + snprintf(signature, sizeof(signature), "%u%s%u", lboard->info->id, settings->arrays.cheevos_username, - lboard->id); + lboard->info->id); MD5_Init(&ctx); MD5_Update(&ctx, (void*)signature, strlen(signature)); MD5_Final(hash, &ctx); - snprintf( - url, url_size, - "http://retroachievements.org/dorequest.php?r=submitlbentry&u=%s&t=%s&i=%u&s=%d" - "&v=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - settings->arrays.cheevos_username, - cheevos_locals.token, - lboard->id, - lboard->last_value, - hash[ 0], hash[ 1], hash[ 2], hash[ 3], - hash[ 4], hash[ 5], hash[ 6], hash[ 7], - hash[ 8], hash[ 9], hash[10], hash[11], - hash[12], hash[13], hash[14], hash[15] - ); + /* Start the request. */ + ret = rc_url_submit_lboard(buffer, sizeof(buffer), settings->arrays.cheevos_username, cheevos_locals.token, lboard->info->id, lboard->last_value, hash); - url[url_size - 1] = 0; - -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to submit the leaderboard: %s\n", url); -#endif -} - -static void cheevos_lboard_submit(void *task_data, void *user_data, - const char *error) -{ - cheevos_leaderboard_t *lboard = (cheevos_leaderboard_t *)user_data; - - if (!lboard) - return; - - if (!error) + if (ret != 0) { - CHEEVOS_ERR("[CHEEVOS]: error submitting leaderboard %u\n", lboard->id); + CHEEVOS_ERR(CHEEVOS_TAG "Buffer to small to create URL\n"); return; } - CHEEVOS_LOG("[CHEEVOS]: submitted leaderboard %u.\n", lboard->id); + cheevos_log_url(CHEEVOS_TAG "rc_url_submit_lboard: %s\n", buffer); + task_push_http_transfer(buffer, true, NULL, cheevos_lboard_submit_task, user_data); +} + +static void cheevos_lboard_submit(cheevos_lboard_t* lboard) +{ + char buffer[256]; + char value[16]; + + /* Deactivate the leaderboard. */ + lboard->active = 0; + + /* Failsafe for improper leaderboards. */ + if (lboard->last_value == 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "Leaderboard %s tried to submit 0\n", lboard->info->title); + runloop_msg_queue_push("Leaderboard attempt cancelled!", 0, 2 * 60, false); + return; + } + + /* Show the OSD message. */ + rc_format_value(value, sizeof(value), lboard->last_value, lboard->format); + + snprintf(buffer, sizeof(buffer), "Submitted %s for %s", + value, lboard->info->title); + runloop_msg_queue_push(buffer, 0, 2 * 60, false); + + /* Start the submit task. */ + cheevos_lboard_submit_task(NULL, lboard, "no error, first try"); } static void cheevos_test_leaderboards(void) { - unsigned i; - cheevos_leaderboard_t* lboard = cheevos_locals.leaderboards; + cheevos_lboard_t* lboard = cheevos_locals.lboards; + int i; + unsigned value; - if (!lboard) - return; - - for (i = cheevos_locals.lboard_count; i != 0; i--, lboard++) + for (i = 0; i < cheevos_locals.patchdata.lboard_count; i++, lboard++) { if (lboard->active) { - int value = cheevos_expr_value(&lboard->value); + value = rc_evaluate_value(&lboard->lboard->value, cheevos_peek, NULL, NULL); if (value != lboard->last_value) { - CHEEVOS_LOG("[CHEEVOS]: value lboard %s %u\n", - lboard->title, value); + CHEEVOS_LOG(CHEEVOS_TAG "Value lboard %s %u\n", lboard->info->title, value); lboard->last_value = value; } - if (cheevos_test_lboard_condition(&lboard->submit)) + if (rc_test_trigger(&lboard->lboard->submit, cheevos_peek, NULL, NULL)) + cheevos_lboard_submit(lboard); + + if (rc_test_trigger(&lboard->lboard->cancel, cheevos_peek, NULL, NULL)) { - lboard->active = 0; - - /* failsafe for improper LBs */ - if (value == 0) - { - CHEEVOS_LOG("[CHEEVOS]: error: lboard %s tried to submit 0\n", - lboard->title); - runloop_msg_queue_push("Leaderboard attempt cancelled!", - 0, 2 * 60, false); - } - else - { - char url[256]; - char msg[256]; - char formatted_value[16]; - - cheevos_make_lboard_url(lboard, url, sizeof(url)); - task_push_http_transfer(url, true, NULL, - cheevos_lboard_submit, lboard); - CHEEVOS_LOG("[CHEEVOS]: submit lboard %s\n", lboard->title); - - cheevos_format_value(value, lboard->format, - formatted_value, sizeof(formatted_value)); - snprintf(msg, sizeof(msg), "Submitted %s for %s", - formatted_value, lboard->title); - msg[sizeof(msg) - 1] = 0; - runloop_msg_queue_push(msg, 0, 2 * 60, false); - } - } - - if (cheevos_test_lboard_condition(&lboard->cancel)) - { - CHEEVOS_LOG("[CHEEVOS]: cancel lboard %s\n", lboard->title); + CHEEVOS_LOG(CHEEVOS_TAG "Cancel leaderboard %s\n", lboard->info->title); lboard->active = 0; runloop_msg_queue_push("Leaderboard attempt cancelled!", 0, 2 * 60, false); @@ -1897,191 +663,54 @@ static void cheevos_test_leaderboards(void) } else { - if (cheevos_test_lboard_condition(&lboard->start)) + if (rc_test_trigger(&lboard->lboard->start, cheevos_peek, NULL, NULL)) { - char msg[256]; + char buffer[256]; - CHEEVOS_LOG("[CHEEVOS]: start lboard %s\n", lboard->title); + CHEEVOS_LOG(CHEEVOS_TAG "Leaderboard started: %s\n", lboard->info->title); lboard->active = 1; - lboard->last_value = -1; + lboard->last_value = 0; - snprintf(msg, sizeof(msg), - "Leaderboard Active: %s", lboard->title); - msg[sizeof(msg) - 1] = 0; - runloop_msg_queue_push(msg, 0, 2 * 60, false); - runloop_msg_queue_push(lboard->description, 0, 3*60, false); + snprintf(buffer, sizeof(buffer), + "Leaderboard Active: %s", lboard->info->title); + runloop_msg_queue_push(buffer, 0, 2 * 60, false); + runloop_msg_queue_push(lboard->info->description, 0, 3 * 60, false); } } } } -/***************************************************************************** -Free the loaded achievements. -*****************************************************************************/ - -static void cheevos_free_condset(const cheevos_condset_t *set) -{ - if (set && set->conds) - free((void*)set->conds); -} - -static void cheevos_free_cheevo(const cheevo_t *cheevo) -{ - if (!cheevo) - return; - - if (cheevo->title) - free((void*)cheevo->title); - if (cheevo->description) - free((void*)cheevo->description); - if (cheevo->author) - free((void*)cheevo->author); - if (cheevo->badge) - free((void*)cheevo->badge); - cheevos_free_condset(cheevo->condition.condsets); -} - -static void cheevos_free_cheevo_set(const cheevoset_t *set) -{ - const cheevo_t *cheevo = NULL; - const cheevo_t *end = NULL; - - if (!set) - return; - - cheevo = set->cheevos; - end = cheevo + set->count; - - while (cheevo < end) - cheevos_free_cheevo(cheevo++); - - if (set->cheevos) - free((void*)set->cheevos); -} - -#ifndef CHEEVOS_DONT_DEACTIVATE -static int cheevos_deactivate__json_index(void *userdata, unsigned int index) -{ - cheevos_deactivate_t *ud = (cheevos_deactivate_t*)userdata; - - if (ud) - ud->is_element = 1; - - return 0; -} - -static int cheevos_deactivate__json_number(void *userdata, - const char *number, size_t length) -{ - long id; - int found; - cheevo_t* cheevo = NULL; - const cheevo_t* end = NULL; - cheevos_deactivate_t *ud = (cheevos_deactivate_t*)userdata; - - if (ud && ud->is_element) - { - ud->is_element = 0; - id = strtol(number, NULL, 10); - found = 0; - cheevo = cheevos_locals.core.cheevos; - end = cheevo + cheevos_locals.core.count; - - for (; cheevo < end; cheevo++) - { - if (cheevo->id == (unsigned)id) - { - cheevo->active &= ~ud->mode; - found = 1; - break; - } - } - - if (!found) - { - cheevo = cheevos_locals.unofficial.cheevos; - end = cheevo + cheevos_locals.unofficial.count; - - for (; cheevo < end; cheevo++) - { - if (cheevo->id == (unsigned)id) - { - cheevo->active &= ~ud->mode; - found = 1; - break; - } - } - } - - if (found) - CHEEVOS_LOG("[CHEEVOS]: deactivated unlocked cheevo %u (%s).\n", - cheevo->id, cheevo->title); - else - CHEEVOS_ERR("[CHEEVOS]: unknown cheevo to deactivate: %u.\n", id); - } - - return 0; -} - -static int cheevos_deactivate_unlocks(const char* json, unsigned mode) -{ - static const jsonsax_handlers_t handlers = - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - cheevos_deactivate__json_index, - NULL, - cheevos_deactivate__json_number, - NULL, - NULL - }; - - cheevos_deactivate_t ud; - - ud.is_element = 0; - ud.mode = mode; - return jsonsax_parse(json, &handlers, (void*)&ud) != JSONSAX_OK; -} -#endif - void cheevos_reset_game(void) { - cheevo_t *end = NULL; - cheevo_t *cheevo = cheevos_locals.core.cheevos; + cheevos_cheevo_t* cheevo = NULL; + int i, count; - if (!cheevo) - return; + cheevo = cheevos_locals.core; - end = cheevo + cheevos_locals.core.count; - - for (; cheevo < end; cheevo++) - cheevo->last = 1; - - cheevo = cheevos_locals.unofficial.cheevos; - end = cheevo + cheevos_locals.unofficial.count; - - for (; cheevo < end; cheevo++) + for (i = 0, count = cheevos_locals.patchdata.core_count; i < count; i++, cheevo++) + { cheevo->last = 1; + } + + cheevo = cheevos_locals.unofficial; + + for (i = 0, count = cheevos_locals.patchdata.unofficial_count; i < count; i++, cheevo++) + { + cheevo->last = 1; + } } -void cheevos_populate_menu(void *data) +void cheevos_populate_menu(void* data) { #ifdef HAVE_MENU - unsigned i = 0; - unsigned items_found = 0; - settings_t *settings = config_get_ptr(); - menu_displaylist_info_t *info = (menu_displaylist_info_t*)data; - cheevo_t *end = NULL; - cheevo_t *cheevo = cheevos_locals.core.cheevos; - end = cheevo + cheevos_locals.core.count; + int i = 0; + int count = 0; + settings_t* settings = config_get_ptr(); + menu_displaylist_info_t* info = (menu_displaylist_info_t*)data; + cheevos_cheevo_t* cheevo = NULL; - if(settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable - && cheevos_loaded) + if ( settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable + && cheevos_loaded) { if (!cheevos_hardcore_paused) menu_entries_append_enum(info->list, @@ -2097,81 +726,87 @@ void cheevos_populate_menu(void *data) MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS, 0, 0); } - if (cheevo) + cheevo = cheevos_locals.core; + + for (i = 0, count = cheevos_locals.patchdata.core_count; i < count; i++, cheevo++) { - for (i = 0; cheevo < end; i++, cheevo++) + if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) + { + menu_entries_append_enum(info->list, cheevo->info->title, + cheevo->info->description, + MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + + set_badge_info(&badges_ctx, i, cheevo->info->badge, + (cheevo->active & CHEEVOS_ACTIVE_HARDCORE)); + } + else if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) + { + menu_entries_append_enum(info->list, cheevo->info->title, + cheevo->info->description, + MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + + set_badge_info(&badges_ctx, i, cheevo->info->badge, + (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); + } + else + { + menu_entries_append_enum(info->list, cheevo->info->title, + cheevo->info->description, + MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + + set_badge_info(&badges_ctx, i, cheevo->info->badge, + (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); + } + } + + if (settings->bools.cheevos_test_unofficial) + { + cheevo = cheevos_locals.unofficial; + + for (i = 0, count = cheevos_locals.patchdata.unofficial_count; i < count; i++, cheevo++) { if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, + menu_entries_append_enum(info->list, cheevo->info->title, + cheevo->info->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - set_badge_info(&badges_ctx, i, cheevo->badge, + + set_badge_info(&badges_ctx, i, cheevo->info->badge, (cheevo->active & CHEEVOS_ACTIVE_HARDCORE)); } else if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, + menu_entries_append_enum(info->list, cheevo->info->title, + cheevo->info->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - set_badge_info(&badges_ctx, i, cheevo->badge, + + set_badge_info(&badges_ctx, i, cheevo->info->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); } else { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, + menu_entries_append_enum(info->list, cheevo->info->title, + cheevo->info->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - set_badge_info(&badges_ctx, i, cheevo->badge, + + set_badge_info(&badges_ctx, i, cheevo->info->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); } - items_found++; } } - cheevo = cheevos_locals.unofficial.cheevos; + count = cheevos_locals.patchdata.core_count; - if (cheevo && settings->bools.cheevos_test_unofficial) - { - end = cheevo + cheevos_locals.unofficial.count; + if (settings->bools.cheevos_test_unofficial) + count += cheevos_locals.patchdata.unofficial_count; - for (i = items_found; cheevo < end; i++, cheevo++) - { - if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) - { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, - MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - set_badge_info(&badges_ctx, i, cheevo->badge, - (cheevo->active & CHEEVOS_ACTIVE_HARDCORE)); - } - else if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) - { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, - MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - set_badge_info(&badges_ctx, i, cheevo->badge, - (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); - } - else - { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, - MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - set_badge_info(&badges_ctx, i, cheevo->badge, - (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); - } - items_found++; - } - } - - if (items_found == 0) + if (count == 0) { menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY), @@ -2182,34 +817,39 @@ void cheevos_populate_menu(void *data) #endif } -bool cheevos_get_description(cheevos_ctx_desc_t *desc) +bool cheevos_get_description(cheevos_ctx_desc_t* desc) { + unsigned idx; + const cheevos_cheevo_t* cheevo; + if (!desc) return false; + *desc->s = 0; + if (cheevos_loaded) { - cheevo_t *cheevos = cheevos_locals.core.cheevos; + idx = desc->idx; - if (!cheevos) - return false; - - if (desc->idx >= cheevos_locals.core.count) + if (idx < cheevos_locals.patchdata.core_count) + cheevo = cheevos_locals.core + idx; + else { - cheevos = cheevos_locals.unofficial.cheevos; - desc->idx -= cheevos_locals.core.count; + idx -= cheevos_locals.patchdata.core_count; + + if (idx < cheevos_locals.patchdata.unofficial_count) + cheevo = cheevos_locals.unofficial + idx; + else + return true; } - if (!string_is_empty(cheevos[desc->idx].description)) - strlcpy(desc->s, cheevos[desc->idx].description, desc->len); + strlcpy(desc->s, cheevo->info->description, desc->len); } - else - *desc->s = 0; return true; } -bool cheevos_apply_cheats(bool *data_bool) +bool cheevos_apply_cheats(bool* data_bool) { cheats_are_enabled = *data_bool; cheats_were_enabled |= cheats_are_enabled; @@ -2219,14 +859,16 @@ bool cheevos_apply_cheats(bool *data_bool) bool cheevos_unload(void) { - bool running; + bool running = false; + unsigned i = 0, count = 0; + CHEEVOS_LOCK(cheevos_locals.task_lock); running = cheevos_locals.task != NULL; CHEEVOS_UNLOCK(cheevos_locals.task_lock); if (running) { - CHEEVOS_LOG("[CHEEVOS]: Asked the load thread to terminate\n"); + CHEEVOS_LOG(CHEEVOS_TAG "Asked the load thread to terminate\n"); task_queue_cancel_task(cheevos_locals.task); #ifdef HAVE_THREADS @@ -2242,17 +884,34 @@ bool cheevos_unload(void) if (cheevos_loaded) { - cheevos_free_cheevo_set(&cheevos_locals.core); - cheevos_free_cheevo_set(&cheevos_locals.unofficial); + for (i = 0, count = cheevos_locals.patchdata.core_count; i < count; i++) + { + CHEEVOS_FREE(cheevos_locals.core[i].trigger); + } + + for (i = 0, count = cheevos_locals.patchdata.unofficial_count; i < count; i++) + { + CHEEVOS_FREE(cheevos_locals.unofficial[i].trigger); + } + + for (i = 0, count = cheevos_locals.patchdata.lboard_count; i < count; i++) + { + CHEEVOS_FREE(cheevos_locals.lboards[i].lboard); + } + + CHEEVOS_FREE(cheevos_locals.core); + CHEEVOS_FREE(cheevos_locals.unofficial); + CHEEVOS_FREE(cheevos_locals.lboards); + cheevos_free_patchdata(&cheevos_locals.patchdata); + cheevos_fixup_destroy(&cheevos_locals.fixups); } - cheevos_locals.core.cheevos = NULL; - cheevos_locals.unofficial.cheevos = NULL; - cheevos_locals.core.count = 0; - cheevos_locals.unofficial.count = 0; + cheevos_locals.core = NULL; + cheevos_locals.unofficial = NULL; + cheevos_locals.lboards = NULL; - cheevos_loaded = false; - cheevos_hardcore_paused = false; + cheevos_loaded = false; + cheevos_hardcore_paused = false; return true; } @@ -2289,187 +948,16 @@ bool cheevos_toggle_hardcore_mode(void) return true; } -static void cheevos_patch_addresses(cheevoset_t* set) -{ - unsigned i; - cheevo_t* cheevo = NULL; - - if (!set) - return; - - cheevo = set->cheevos; - - if (!cheevo) - return; - - for (i = set->count; i != 0; i--, cheevo++) - { - unsigned j; - cheevos_condset_t* condset = cheevo->condition.condsets; - - for (j = cheevo->condition.count; j != 0; j--, condset++) - { - unsigned k; - cheevos_cond_t* cond = condset->conds; - - for (k = condset->count; k != 0; k--, cond++) - { - switch (cond->source.type) - { - case CHEEVOS_VAR_TYPE_ADDRESS: - case CHEEVOS_VAR_TYPE_DELTA_MEM: - cheevos_var_patch_addr(&cond->source, - cheevos_locals.console_id); -#ifdef CHEEVOS_DUMP_ADDRS - CHEEVOS_LOG("[CHEEVOS]: s-var %03d:%08X\n", - cond->source.bank_id + 1, cond->source.value); -#endif - break; - - default: - break; - } - - switch (cond->target.type) - { - case CHEEVOS_VAR_TYPE_ADDRESS: - case CHEEVOS_VAR_TYPE_DELTA_MEM: - cheevos_var_patch_addr(&cond->target, - cheevos_locals.console_id); -#ifdef CHEEVOS_DUMP_ADDRS - CHEEVOS_LOG("[CHEEVOS]: t-var %03d:%08X\n", - cond->target.bank_id + 1, cond->target.value); -#endif - break; - - default: - break; - } - } - } - } -} - -static void cheevos_patch_lb_conditions(cheevos_condition_t* condition) -{ - unsigned i; - cheevos_condset_t* condset = NULL; - - if (!condition) - return; - - condset = condition->condsets; - - for (i = condition->count; i != 0; i--, condset++) - { - unsigned j; - cheevos_cond_t* cond = condset->conds; - - for (j = condset->count; j != 0; j--, cond++) - { - switch (cond->source.type) - { - case CHEEVOS_VAR_TYPE_ADDRESS: - case CHEEVOS_VAR_TYPE_DELTA_MEM: - cheevos_var_patch_addr(&cond->source, - cheevos_locals.console_id); -#ifdef CHEEVOS_DUMP_ADDRS - CHEEVOS_LOG("[CHEEVOS]: s-var %03d:%08X\n", - cond->source.bank_id + 1, cond->source.value); -#endif - break; - default: - break; - } - switch (cond->target.type) - { - case CHEEVOS_VAR_TYPE_ADDRESS: - case CHEEVOS_VAR_TYPE_DELTA_MEM: - cheevos_var_patch_addr(&cond->target, - cheevos_locals.console_id); -#ifdef CHEEVOS_DUMP_ADDRS - CHEEVOS_LOG("[CHEEVOS]: t-var %03d:%08X\n", - cond->target.bank_id + 1, cond->target.value); -#endif - break; - default: - break; - } - } - } -} - -static void cheevos_patch_lb_expressions(cheevos_expr_t* expression) -{ - unsigned i; - cheevos_term_t* term = NULL; - - if (!expression) - return; - - term = expression->terms; - - for (i = expression->count; i != 0; i--, term++) - { - switch (term->var.type) - { - case CHEEVOS_VAR_TYPE_ADDRESS: - case CHEEVOS_VAR_TYPE_DELTA_MEM: - cheevos_var_patch_addr(&term->var, cheevos_locals.console_id); -#ifdef CHEEVOS_DUMP_ADDRS - CHEEVOS_LOG("[CHEEVOS]: s-var %03d:%08X\n", - term->var.bank_id + 1, term->var.value); -#endif - break; - default: - break; - } - } -} - -static void cheevos_patch_lbs(cheevos_leaderboard_t *leaderboard) -{ - unsigned i; - - for (i = 0; i < cheevos_locals.lboard_count; i++) - { - cheevos_condition_t *start = &leaderboard[i].start; - cheevos_condition_t *cancel = &leaderboard[i].cancel; - cheevos_condition_t *submit = &leaderboard[i].submit; - cheevos_expr_t *value = &leaderboard[i].value; - - cheevos_patch_lb_conditions(start); - cheevos_patch_lb_conditions(cancel); - cheevos_patch_lb_conditions(submit); - cheevos_patch_lb_expressions(value); - } -} - void cheevos_test(void) { settings_t *settings = config_get_ptr(); - if (!cheevos_locals.addrs_patched) - { - cheevos_patch_addresses(&cheevos_locals.core); - cheevos_patch_addresses(&cheevos_locals.unofficial); - cheevos_patch_lbs(cheevos_locals.leaderboards); + cheevos_test_cheevo_set(true); - cheevos_locals.addrs_patched = true; - } - - cheevos_test_cheevo_set(&cheevos_locals.core); - - if (settings) - { - if (settings->bools.cheevos_test_unofficial) - cheevos_test_cheevo_set(&cheevos_locals.unofficial); - - if (settings->bools.cheevos_hardcore_mode_enable && - settings->bools.cheevos_leaderboards_enable && - !cheevos_hardcore_paused) - cheevos_test_leaderboards(); - } + if (settings->bools.cheevos_test_unofficial) + cheevos_test_cheevo_set(false); + + cheevos_test_leaderboards(); } bool cheevos_set_cheats(void) @@ -2488,11 +976,44 @@ bool cheevos_get_support_cheevos(void) return cheevos_locals.core_supports; } -cheevos_console_t cheevos_get_console(void) +int cheevos_get_console(void) { return cheevos_locals.console_id; } +static void cheevos_unlock_cb(unsigned id, void* userdata) +{ + cheevos_cheevo_t* cheevo = NULL; + int i = 0; + unsigned j = 0, count = 0; + + for (i = 0; i < 2; i++) + { + if (i == 0) + { + cheevo = cheevos_locals.core; + count = cheevos_locals.patchdata.core_count; + } + else + { + cheevo = cheevos_locals.unofficial; + count = cheevos_locals.patchdata.unofficial_count; + } + + for (j = 0; j < count; j++, cheevo++) + { + if (cheevo->info->id == id) + { +#ifndef CHEEVOS_DONT_DEACTIVATE + cheevo->active &= ~*(unsigned*)userdata; +#endif + CHEEVOS_LOG(CHEEVOS_TAG "cheevo %u deactivated: %s\n", id, cheevo->info->title); + return; + } + } + } +} + #include "coro.h" /* Uncomment the following two lines to debug cheevos_iterate, this will @@ -2507,8 +1028,8 @@ cheevos_console_t cheevos_get_console(void) * * https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html */ -/*#undef CORO_YIELD -#define CORO_YIELD()*/ +#undef CORO_YIELD +#define CORO_YIELD() typedef struct { @@ -2537,11 +1058,11 @@ typedef struct const char *path; const char *ext; intfstream_t *stream; - cheevo_t *cheevo; + cheevos_cheevo_t *cheevo; settings_t *settings; struct http_connection_t *conn; struct http_t *http; - const cheevo_t *cheevo_end; + const cheevos_cheevo_t *cheevo_end; /* co-routine required fields */ CORO_FIELDS @@ -2568,7 +1089,7 @@ enum DELAY = -16 }; -static int cheevos_iterate(coro_t *coro) +static int cheevos_iterate(coro_t* coro) { ssize_t num_read = 0; size_t to_read = 4096; @@ -2621,36 +1142,7 @@ static int cheevos_iterate(coro_t *coro) CORO_ENTER(); - - - cheevos_locals.addrs_patched = false; - - coro->settings = config_get_ptr(); - - cheevos_locals.meminfo[0].id = RETRO_MEMORY_SYSTEM_RAM; - core_get_memory(&cheevos_locals.meminfo[0]); - - cheevos_locals.meminfo[1].id = RETRO_MEMORY_SAVE_RAM; - core_get_memory(&cheevos_locals.meminfo[1]); - - cheevos_locals.meminfo[2].id = RETRO_MEMORY_VIDEO_RAM; - core_get_memory(&cheevos_locals.meminfo[2]); - - cheevos_locals.meminfo[3].id = RETRO_MEMORY_RTC; - core_get_memory(&cheevos_locals.meminfo[3]); - - CHEEVOS_LOG("[CHEEVOS]: system RAM: %p %u\n", - cheevos_locals.meminfo[0].data, - cheevos_locals.meminfo[0].size); - CHEEVOS_LOG("[CHEEVOS]: save RAM: %p %u\n", - cheevos_locals.meminfo[1].data, - cheevos_locals.meminfo[1].size); - CHEEVOS_LOG("[CHEEVOS]: video RAM: %p %u\n", - cheevos_locals.meminfo[2].data, - cheevos_locals.meminfo[2].size); - CHEEVOS_LOG("[CHEEVOS]: RTC: %p %u\n", - cheevos_locals.meminfo[3].data, - cheevos_locals.meminfo[3].size); + coro->settings = config_get_ptr(); /* Bail out if cheevos are disabled. * But set the above anyways, @@ -2675,15 +1167,15 @@ static int cheevos_iterate(coro_t *coro) coro->count = intfstream_get_size(coro->stream); /* size limit */ - if (coro->count > size_in_megabytes(64)) - coro->count = size_in_megabytes(64); + if (coro->count > CHEEVOS_MB(64)) + coro->count = CHEEVOS_MB(64); coro->data = malloc(coro->count); if (!coro->data) { intfstream_close(coro->stream); - free(coro->stream); + CHEEVOS_FREE(coro->stream); CORO_STOP(); } @@ -2711,7 +1203,7 @@ static int cheevos_iterate(coro_t *coro) } intfstream_close(coro->stream); - free(coro->stream); + CHEEVOS_FREE(coro->stream); } /* Use the supported extensions as a hint @@ -2731,14 +1223,12 @@ static int cheevos_iterate(coro_t *coro) if (end) { - hash = cheevos_djb2( - coro->ext, end - coro->ext); + hash = cheevos_djb2(coro->ext, end - coro->ext); coro->ext = end + 1; } else { - hash = cheevos_djb2( - coro->ext, strlen(coro->ext)); + hash = cheevos_djb2(coro->ext, strlen(coro->ext)); coro->ext = NULL; } @@ -2746,7 +1236,7 @@ static int cheevos_iterate(coro_t *coro) { if (finders[coro->i].ext_hashes[coro->j] == hash) { - CHEEVOS_LOG("[CHEEVOS]: testing %s.\n", + CHEEVOS_LOG(CHEEVOS_TAG "testing %s\n", finders[coro->i].name); /* @@ -2771,7 +1261,7 @@ static int cheevos_iterate(coro_t *coro) if (finders[coro->i].ext_hashes) continue; - CHEEVOS_LOG("[CHEEVOS]: testing %s.\n", + CHEEVOS_LOG(CHEEVOS_TAG "testing %s\n", finders[coro->i].name); /* @@ -2784,7 +1274,7 @@ static int cheevos_iterate(coro_t *coro) goto found; } - CHEEVOS_LOG("[CHEEVOS]: this game doesn't feature achievements.\n"); + CHEEVOS_LOG(CHEEVOS_TAG "this game doesn't feature achievements\n"); CORO_STOP(); found: @@ -2810,7 +1300,7 @@ found: if (!coro->json) { runloop_msg_queue_push("Error loading achievements.", 0, 5 * 60, false); - CHEEVOS_ERR("[CHEEVOS]: error loading achievements.\n"); + CHEEVOS_ERR(CHEEVOS_TAG "error loading achievements\n"); CORO_STOP(); } #endif @@ -2824,32 +1314,20 @@ found: #endif if (cheevos_parse(coro->json)) { - if ((void*)coro->json) - free((void*)coro->json); + CHEEVOS_FREE(coro->json); CORO_STOP(); } - if ((void*)coro->json) - free((void*)coro->json); + CHEEVOS_FREE(coro->json); - if ( cheevos_locals.core.count == 0 - && cheevos_locals.unofficial.count == 0 - && cheevos_locals.lboard_count == 0) + if ( cheevos_locals.patchdata.core_count == 0 + && cheevos_locals.patchdata.unofficial_count == 0 + && cheevos_locals.patchdata.lboard_count == 0) { runloop_msg_queue_push( "This game has no achievements.", 0, 5 * 60, false); - cheevos_free_cheevo_set(&cheevos_locals.core); - cheevos_free_cheevo_set(&cheevos_locals.unofficial); - - cheevos_locals.core.cheevos = NULL; - cheevos_locals.unofficial.cheevos = NULL; - cheevos_locals.core.count = 0; - cheevos_locals.unofficial.count = 0; - - cheevos_loaded = false; - cheevos_hardcore_paused = false; CORO_STOP(); } @@ -2867,13 +1345,13 @@ found: */ CORO_GOSUB(PLAYING); - if (coro->settings->bools.cheevos_verbose_enable && cheevos_locals.core.count > 0) + if (coro->settings->bools.cheevos_verbose_enable && cheevos_locals.patchdata.core_count > 0) { char msg[256]; - int mode = CHEEVOS_ACTIVE_SOFTCORE; - const cheevo_t* cheevo = cheevos_locals.core.cheevos; - const cheevo_t* end = cheevo + cheevos_locals.core.count; - int number_of_unlocked = cheevos_locals.core.count; + int mode = CHEEVOS_ACTIVE_SOFTCORE; + const cheevos_cheevo_t* cheevo = cheevos_locals.core; + const cheevos_cheevo_t* end = cheevo + cheevos_locals.patchdata.core_count; + int number_of_unlocked = cheevos_locals.patchdata.core_count; if (coro->settings->bools.cheevos_hardcore_mode_enable && !cheevos_hardcore_paused) mode = CHEEVOS_ACTIVE_HARDCORE; @@ -2884,7 +1362,7 @@ found: snprintf(msg, sizeof(msg), "You have %d of %d achievements unlocked.", - number_of_unlocked, cheevos_locals.core.count); + number_of_unlocked, cheevos_locals.patchdata.core_count); msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, 0, 6 * 60, false); } @@ -2913,14 +1391,14 @@ found: CORO_RET(); } - if (coro->count < size_in_megabytes(8)) + if (coro->count < CHEEVOS_MB(8)) { /* * Inputs: CHEEVOS_VAR_MD5, CHEEVOS_VAR_OFFSET, CHEEVOS_VAR_COUNT * Outputs: CHEEVOS_VAR_MD5 */ coro->offset = 0; - coro->count = size_in_megabytes(8) - coro->count; + coro->count = CHEEVOS_MB(8) - coro->count; CORO_GOSUB(FILL_MD5); } @@ -2947,10 +1425,10 @@ found: CORO_RET(); } - if (coro->count < size_in_megabytes(6)) + if (coro->count < CHEEVOS_MB(6)) { coro->offset = 0; - coro->count = size_in_megabytes(6) - coro->count; + coro->count = CHEEVOS_MB(6) - coro->count; CORO_GOSUB(FILL_MD5); } @@ -3098,8 +1576,8 @@ found: coro->count = coro->len - coro->offset; /* size limit */ - if (coro->count > size_in_megabytes(64)) - coro->count = size_in_megabytes(64); + if (coro->count > CHEEVOS_MB(64)) + coro->count = CHEEVOS_MB(64); MD5_Update(&coro->md5, (void*)((uint8_t*)coro->data + coro->offset), @@ -3139,49 +1617,24 @@ found: CORO_SUB(GET_GAMEID) { - char gameid[16]; + int size = rc_url_get_gameid(coro->url, sizeof(coro->url), coro->hash); - CHEEVOS_LOG( - "[CHEEVOS]: getting game id for hash %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", - coro->hash[ 0], coro->hash[ 1], coro->hash[ 2], coro->hash[ 3], - coro->hash[ 4], coro->hash[ 5], coro->hash[ 6], coro->hash[ 7], - coro->hash[ 8], coro->hash[ 9], coro->hash[10], coro->hash[11], - coro->hash[12], coro->hash[13], coro->hash[14], coro->hash[15] - ); - - snprintf( - coro->url, sizeof(coro->url), - "http://retroachievements.org/dorequest.php?r=gameid&m=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - coro->hash[ 0], coro->hash[ 1], coro->hash[ 2], coro->hash[ 3], - coro->hash[ 4], coro->hash[ 5], coro->hash[ 6], coro->hash[ 7], - coro->hash[ 8], coro->hash[ 9], coro->hash[10], coro->hash[11], - coro->hash[12], coro->hash[13], coro->hash[14], coro->hash[15] - ); - - coro->url[sizeof(coro->url) - 1] = 0; - -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to get the game's id: %s\n", coro->url); -#endif + if (size < 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "buffer too small to create URL\n"); + CORO_RET(); + } + cheevos_log_url(CHEEVOS_TAG "rc_url_get_gameid: %s\n", coro->url); CORO_GOSUB(HTTP_GET); if (!coro->json) CORO_RET(); - if (cheevos_get_value(coro->json, - CHEEVOS_JSON_KEY_GAMEID, gameid, sizeof(gameid))) - { - if ((void*)coro->json) - free((void*)coro->json); - CHEEVOS_ERR("[CHEEVOS]: error getting game_id.\n"); - CORO_RET(); - } + coro->gameid = chevos_get_gameid(coro->json); - if ((void*)coro->json) - free((void*)coro->json); - CHEEVOS_LOG("[CHEEVOS]: got game id %s.\n", gameid); - coro->gameid = (unsigned)strtol(gameid, NULL, 10); + CHEEVOS_FREE(coro->json); + CHEEVOS_LOG(CHEEVOS_TAG "got game id %u\n", coro->gameid); CORO_RET(); } @@ -3191,31 +1644,31 @@ found: * Outputs CHEEVOS_VAR_JSON *************************************************************************/ CORO_SUB(GET_CHEEVOS) + { + int ret; CORO_GOSUB(LOGIN); - snprintf(coro->url, sizeof(coro->url), - "http://retroachievements.org/dorequest.php?r=patch&g=%u&u=%s&t=%s", - coro->gameid, - coro->settings->arrays.cheevos_username, - cheevos_locals.token); + ret = rc_url_get_patch(coro->url, sizeof(coro->url), coro->settings->arrays.cheevos_username, cheevos_locals.token, coro->gameid); - coro->url[sizeof(coro->url) - 1] = 0; - -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to get the list of cheevos: %s\n", coro->url); -#endif + if (ret < 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "buffer too small to create URL\n"); + CORO_STOP(); + } + cheevos_log_url(CHEEVOS_TAG "rc_url_get_patch: %s\n", coro->url); CORO_GOSUB(HTTP_GET); if (!coro->json) { - CHEEVOS_ERR("[CHEEVOS]: error getting achievements for game id %u.\n", coro->gameid); + CHEEVOS_ERR(CHEEVOS_TAG "error getting achievements for game id %u\n", coro->gameid); CORO_STOP(); } - CHEEVOS_LOG("[CHEEVOS]: got achievements for game id %u.\n", coro->gameid); + CHEEVOS_LOG(CHEEVOS_TAG "got achievements for game id %u\n", coro->gameid); CORO_RET(); + } /************************************************************************** * Info Gets the achievements from Retro Achievements @@ -3233,58 +1686,69 @@ found: CORO_RET(); } - coro->cheevo = cheevos_locals.core.cheevos; - coro->cheevo_end = cheevos_locals.core.cheevos + cheevos_locals.core.count; - - for (; coro->cheevo < coro->cheevo_end; coro->cheevo++) + for (coro->i = 0; coro->i < 2; coro->i++) { - for (coro->j = 0 ; coro->j < 2; coro->j++) + if (coro->i == 0) { - coro->badge_fullpath[0] = '\0'; - fill_pathname_application_special( - coro->badge_fullpath, - sizeof(coro->badge_fullpath), - APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES); + coro->cheevo = cheevos_locals.core; + coro->cheevo_end = coro->cheevo + cheevos_locals.patchdata.core_count; + } + else + { + coro->cheevo = cheevos_locals.unofficial; + coro->cheevo_end = coro->cheevo + cheevos_locals.patchdata.unofficial_count; + } - if (!path_is_directory(coro->badge_fullpath)) - path_mkdir(coro->badge_fullpath); - CORO_YIELD(); - if (coro->j == 0) - snprintf(coro->badge_name, - sizeof(coro->badge_name), - "%s.png", coro->cheevo->badge); - else - snprintf(coro->badge_name, - sizeof(coro->badge_name), - "%s_lock.png", coro->cheevo->badge); - - fill_pathname_join( - coro->badge_fullpath, - coro->badge_fullpath, - coro->badge_name, - sizeof(coro->badge_fullpath)); - - if (!badge_exists(coro->badge_fullpath)) + for (; coro->cheevo < coro->cheevo_end; coro->cheevo++) + { + for (coro->j = 0 ; coro->j < 2; coro->j++) { -#ifdef CHEEVOS_LOG_BADGES - CHEEVOS_LOG( - "[CHEEVOS]: downloading badge %s\n", - coro->badge_fullpath); -#endif - snprintf(coro->url, - sizeof(coro->url), - "http://i.retroachievements.org/Badge/%s", - coro->badge_name); + coro->badge_fullpath[0] = '\0'; + fill_pathname_application_special( + coro->badge_fullpath, + sizeof(coro->badge_fullpath), + APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES); - CORO_GOSUB(HTTP_GET); + if (!path_is_directory(coro->badge_fullpath)) + path_mkdir(coro->badge_fullpath); + CORO_YIELD(); + if (coro->j == 0) + snprintf(coro->badge_name, + sizeof(coro->badge_name), + "%s.png", coro->cheevo->info->badge); + else + snprintf(coro->badge_name, + sizeof(coro->badge_name), + "%s_lock.png", coro->cheevo->info->badge); - if (coro->json) + fill_pathname_join( + coro->badge_fullpath, + coro->badge_fullpath, + coro->badge_name, + sizeof(coro->badge_fullpath)); + + if (!badge_exists(coro->badge_fullpath)) { - if (!filestream_write_file(coro->badge_fullpath, - coro->json, coro->k)) - CHEEVOS_ERR("[CHEEVOS]: error writing badge %s\n", coro->badge_fullpath); - else - free(coro->json); +#ifdef CHEEVOS_LOG_BADGES + CHEEVOS_LOG( + CHEEVOS_TAG "downloading badge %s\n", + coro->badge_fullpath); +#endif + snprintf(coro->url, + sizeof(coro->url), + "http://i.retroachievements.org/Badge/%s", + coro->badge_name); + + CORO_GOSUB(HTTP_GET); + + if (coro->json) + { + if (!filestream_write_file(coro->badge_fullpath, + coro->json, coro->k)) + CHEEVOS_ERR(CHEEVOS_TAG "error writing badge %s\n", coro->badge_fullpath); + else + CHEEVOS_FREE(coro->json); + } } } } @@ -3296,125 +1760,89 @@ found: * Info Logs in the user at Retro Achievements *************************************************************************/ CORO_SUB(LOGIN) + { + const char* username = coro->settings->arrays.cheevos_username; + const char* password = coro->settings->arrays.cheevos_password; + const char* token = coro->settings->arrays.cheevos_token; + int ret; + char tok[256]; if (cheevos_locals.token[0]) CORO_RET(); + if (string_is_empty(username)) { - char urle_user[64]; - char urle_login[64]; - const char *username = coro ? coro->settings->arrays.cheevos_username : NULL; - const char *login = NULL; - bool via_token = false; - - if (coro) - { - if (string_is_empty(coro->settings->arrays.cheevos_password)) - { - via_token = true; - login = coro->settings->arrays.cheevos_token; - } - else - login = coro->settings->arrays.cheevos_password; - } - else - login = NULL; - - if (string_is_empty(username) || string_is_empty(login)) - { - runloop_msg_queue_push( - "Missing RetroAchievements account information.", - 0, 5 * 60, false); - runloop_msg_queue_push( - "Please fill in your account information in Settings.", - 0, 5 * 60, false); - CHEEVOS_ERR("[CHEEVOS]: login info not informed.\n"); - CORO_STOP(); - } - - cheevos_url_encode(username, urle_user, sizeof(urle_user)); - cheevos_url_encode(login, urle_login, sizeof(urle_login)); - - snprintf( - coro->url, sizeof(coro->url), - "http://retroachievements.org/dorequest.php?r=login&u=%s&%c=%s", - urle_user, via_token ? 't' : 'p', urle_login - ); - - coro->url[sizeof(coro->url) - 1] = 0; + runloop_msg_queue_push( + "Missing RetroAchievements account information.", + 0, 5 * 60, false); + runloop_msg_queue_push( + "Please fill in your account information in Settings.", + 0, 5 * 60, false); + CHEEVOS_ERR(CHEEVOS_TAG "login info not informed\n"); + CORO_STOP(); } -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to login: %s\n", - coro->url); -#endif + if (string_is_empty(token)) + ret = rc_url_login_with_password(coro->url, sizeof(coro->url), + username, password); + else + ret = rc_url_login_with_token(coro->url, sizeof(coro->url), + username, token); + if (ret < 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "buffer too small to create URL\n"); + CORO_STOP(); + } + + cheevos_log_url(CHEEVOS_TAG "rc_url_login_with_password: %s\n", coro->url); CORO_GOSUB(HTTP_GET); - if (coro->json) + if (!coro->json) { - char error_response[64]; - char error_message[256]; - - cheevos_get_value( - coro->json, - CHEEVOS_JSON_KEY_ERROR, - error_response, - sizeof(error_response) - ); - - /* No error, continue with login */ - if (string_is_empty(error_response)) - { - int res = cheevos_get_value( - coro->json, - CHEEVOS_JSON_KEY_TOKEN, - cheevos_locals.token, - sizeof(cheevos_locals.token)); - - if ((void*)coro->json) - free((void*)coro->json); - - if (!res) - { - if (coro->settings->bools.cheevos_verbose_enable) - { - char msg[256]; - snprintf(msg, sizeof(msg), - "RetroAchievements: Logged in as \"%s\".", - coro->settings->arrays.cheevos_username); - msg[sizeof(msg) - 1] = 0; - runloop_msg_queue_push(msg, 0, 3 * 60, false); - } - - /* Save token to config and clear pass on success */ - *coro->settings->arrays.cheevos_password = '\0'; - strncpy( - coro->settings->arrays.cheevos_token, - cheevos_locals.token, sizeof(cheevos_locals.token) - ); - CORO_RET(); - } - } - - if ((void*)coro->json) - free((void*)coro->json); - - /* Site returned error, display it */ - snprintf(error_message, sizeof(error_message), - "RetroAchievements: %s", - error_response); - error_message[sizeof(error_message) - 1] = 0; - runloop_msg_queue_push(error_message, 0, 5 * 60, false); - *coro->settings->arrays.cheevos_token = '\0'; + runloop_msg_queue_push("RetroAchievements: Error contacting server.", 0, 5 * 60, false); + CHEEVOS_ERR(CHEEVOS_TAG "error getting user token\n"); CORO_STOP(); } - runloop_msg_queue_push("RetroAchievements: Error contacting server.", 0, 5 * 60, false); - CHEEVOS_ERR("[CHEEVOS]: error getting user token.\n"); + ret = cheevos_get_token(coro->json, tok, sizeof(tok)); - CORO_STOP(); + if (ret != 0) + { + char msg[256]; + snprintf(msg, sizeof(msg), + "RetroAchievements: %s", + tok); + runloop_msg_queue_push(msg, 0, 5 * 60, false); + *coro->settings->arrays.cheevos_token = 0; + + CHEEVOS_FREE(coro->json); + CORO_STOP(); + } + + CHEEVOS_FREE(coro->json); + + if (coro->settings->bools.cheevos_verbose_enable) + { + char msg[256]; + snprintf(msg, sizeof(msg), + "RetroAchievements: Logged in as \"%s\".", + coro->settings->arrays.cheevos_username); + msg[sizeof(msg) - 1] = 0; + runloop_msg_queue_push(msg, 0, 3 * 60, false); + } + + strlcpy(cheevos_locals.token, tok, + sizeof(cheevos_locals.token)); + + /* Save token to config and clear pass on success */ + strlcpy(coro->settings->arrays.cheevos_token, tok, + sizeof(coro->settings->arrays.cheevos_token)); + + *coro->settings->arrays.cheevos_password = 0; + CORO_RET(); + } /************************************************************************** * Info Pauses execution for five seconds @@ -3444,7 +1872,7 @@ found: for (coro->k = 0; coro->k < 5; coro->k++) { if (coro->k != 0) - CHEEVOS_LOG("[CHEEVOS]: Retrying HTTP request: %u of 5\n", coro->k + 1); + CHEEVOS_LOG(CHEEVOS_TAG "Retrying HTTP request: %u of 5\n", coro->k + 1); coro->json = NULL; coro->conn = net_http_connection_new( @@ -3491,7 +1919,7 @@ found: if (coro->json) { memcpy((void*)coro->json, (void*)data, length); - free(data); + CHEEVOS_FREE(data); coro->json[length] = 0; } @@ -3506,78 +1934,45 @@ found: net_http_connection_free(coro->conn); } - CHEEVOS_LOG("[CHEEVOS]: Couldn't connect to server after 5 tries\n"); + CHEEVOS_LOG(CHEEVOS_TAG "Couldn't connect to server after 5 tries\n"); CORO_RET(); /************************************************************************** * Info Deactivates the achievements already awarded - * Inputs CHEEVOS_VAR_GAMEID - * Outputs - *************************************************************************/ + * Inputs CHEEVOS_VAR_GAMEID + * Outputs + *************************************************************************/ CORO_SUB(DEACTIVATE) -#ifndef CHEEVOS_DONT_DEACTIVATE CORO_GOSUB(LOGIN); - - /* Deactivate achievements in softcore mode. */ - snprintf( - coro->url, sizeof(coro->url), - "http://retroachievements.org/dorequest.php?r=unlocks&u=%s&t=%s&g=%u&h=0", - coro->settings->arrays.cheevos_username, - cheevos_locals.token, coro->gameid - ); - - coro->url[sizeof(coro->url) - 1] = 0; - -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to get the list of unlocked cheevos in softcore: %s\n", coro->url); -#endif - - CORO_GOSUB(HTTP_GET); - - if (coro->json) { - if (!cheevos_deactivate_unlocks(coro->json, CHEEVOS_ACTIVE_SOFTCORE)) - CHEEVOS_LOG("[CHEEVOS]: deactivated unlocked achievements in softcore mode.\n"); - else - CHEEVOS_ERR("[CHEEVOS]: error deactivating unlocked achievements in softcore mode.\n"); + int i, ret; + unsigned mode; - if ((void*)coro->json) - free((void*)coro->json); + for (i = 0; i < 2; i++) + { + ret = rc_url_get_unlock_list(coro->url, sizeof(coro->url), coro->settings->arrays.cheevos_username, cheevos_locals.token, coro->gameid, i); + + if (ret < 0) + { + CHEEVOS_ERR(CHEEVOS_TAG "buffer too small to create URL\n"); + CORO_STOP(); + } + + cheevos_log_url(CHEEVOS_TAG "rc_url_get_unlock_list: %s\n", coro->url); + CORO_GOSUB(HTTP_GET); + + if (coro->json) + { + mode = i == 0 ? CHEEVOS_ACTIVE_SOFTCORE : CHEEVOS_ACTIVE_HARDCORE; + cheevos_deactivate_unlocks(coro->json, cheevos_unlock_cb, &mode); + CHEEVOS_FREE(coro->json); + } + else + CHEEVOS_ERR(CHEEVOS_TAG "error retrieving list of unlocked achievements in softcore mode\n"); + } } - else - CHEEVOS_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in softcore mode.\n"); - /* Deactivate achievements in hardcore mode. */ - snprintf( - coro->url, sizeof(coro->url), - "http://retroachievements.org/dorequest.php?r=unlocks&u=%s&t=%s&g=%u&h=1", - coro->settings->arrays.cheevos_username, - cheevos_locals.token, coro->gameid - ); - - coro->url[sizeof(coro->url) - 1] = 0; - -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to get the list of unlocked cheevos in hardcore: %s\n", coro->url); -#endif - - CORO_GOSUB(HTTP_GET); - - if (coro->json) - { - if (!cheevos_deactivate_unlocks(coro->json, CHEEVOS_ACTIVE_HARDCORE)) - CHEEVOS_LOG("[CHEEVOS]: deactivated unlocked achievements in hardcore mode.\n"); - else - CHEEVOS_ERR("[CHEEVOS]: error deactivating unlocked achievements in hardcore mode.\n"); - - if ((void*)coro->json) - free((void*)coro->json); - } - else - CHEEVOS_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in hardcore mode.\n"); - -#endif CORO_RET(); /************************************************************************** @@ -3595,23 +1990,19 @@ found: ); coro->url[sizeof(coro->url) - 1] = 0; - -#ifdef CHEEVOS_LOG_URLS - cheevos_log_url("[CHEEVOS]: url to post the 'playing' activity: %s\n", coro->url); -#endif + cheevos_log_url(CHEEVOS_TAG "url to post the 'playing' activity: %s\n", coro->url); CORO_GOSUB(HTTP_GET); if (coro->json) { - CHEEVOS_LOG("[CHEEVOS]: posted playing activity.\n"); - if ((void*)coro->json) - free((void*)coro->json); + CHEEVOS_LOG(CHEEVOS_TAG "posted playing activity\n"); + CHEEVOS_FREE(coro->json); } else - CHEEVOS_ERR("[CHEEVOS]: error posting playing activity.\n"); + CHEEVOS_ERR(CHEEVOS_TAG "error posting playing activity\n"); - CHEEVOS_LOG("[CHEEVOS]: posted playing activity.\n"); + CHEEVOS_LOG(CHEEVOS_TAG "posted playing activity\n"); CORO_RET(); CORO_LEAVE(); @@ -3634,20 +2025,16 @@ static void cheevos_task_handler(retro_task_t *task) if (task_get_cancelled(task)) { - CHEEVOS_LOG("[CHEEVOS]: Load task cancelled\n"); + CHEEVOS_LOG(CHEEVOS_TAG "Load task cancelled\n"); } else { - CHEEVOS_LOG("[CHEEVOS]: Load task finished\n"); + CHEEVOS_LOG(CHEEVOS_TAG "Load task finished\n"); } - if (coro->data) - free(coro->data); - - if ((void*)coro->path) - free((void*)coro->path); - - free((void*)coro); + CHEEVOS_FREE(coro->data); + CHEEVOS_FREE(coro->path); + CHEEVOS_FREE(coro); } } @@ -3672,8 +2059,7 @@ bool cheevos_load(const void *data) if (!task) { - if ((void*)coro) - free((void*)coro); + CHEEVOS_FREE(coro); return false; } @@ -3686,17 +2072,15 @@ bool cheevos_load(const void *data) coro->len = info->size; /* size limit */ - if (coro->len > size_in_megabytes(64)) - coro->len = size_in_megabytes(64); + if (coro->len > CHEEVOS_MB(64)) + coro->len = CHEEVOS_MB(64); coro->data = malloc(coro->len); if (!coro->data) { - if ((void*)task) - free((void*)task); - if ((void*)coro) - free((void*)coro); + CHEEVOS_FREE(task); + CHEEVOS_FREE(coro); return false; } diff --git a/cheevos/cheevos.h b/cheevos/cheevos.h index 45c799dfe3..cfca893388 100644 --- a/cheevos/cheevos.h +++ b/cheevos/cheevos.h @@ -13,45 +13,20 @@ * If not, see . */ -#ifndef __RARCH_CHEEVOS_H -#define __RARCH_CHEEVOS_H +#ifndef __RARCH_CHEEVOS_CHEEVOS_H +#define __RARCH_CHEEVOS_CHEEVOS_H #include #include #include +#include "../verbosity.h" + #include RETRO_BEGIN_DECLS -/***************************************************************************** -Setup - mainly for debugging -*****************************************************************************/ - -/* Define this macro to get extra-verbose log for cheevos. */ -#undef CHEEVOS_VERBOSE - -/***************************************************************************** -End of setup -*****************************************************************************/ - -#define CHEEVOS_TAG "[CHEEVOS]: " - -#ifdef CHEEVOS_VERBOSE - -#define CHEEVOS_LOG RARCH_LOG -#define CHEEVOS_ERR RARCH_ERR - -#else - -void cheevos_log(const char *fmt, ...); - -#define CHEEVOS_LOG cheevos_log -#define CHEEVOS_ERR cheevos_log - -#endif - typedef struct cheevos_ctx_desc { unsigned idx; @@ -59,75 +34,12 @@ typedef struct cheevos_ctx_desc size_t len; } cheevos_ctx_desc_t; -typedef enum -{ - CHEEVOS_CONSOLE_NONE = 0, - /* Don't change those, the values match the console IDs - * at retroachievements.org. */ - CHEEVOS_CONSOLE_MEGA_DRIVE = 1, - CHEEVOS_CONSOLE_NINTENDO_64 = 2, - CHEEVOS_CONSOLE_SUPER_NINTENDO = 3, - CHEEVOS_CONSOLE_GAMEBOY = 4, - CHEEVOS_CONSOLE_GAMEBOY_ADVANCE = 5, - CHEEVOS_CONSOLE_GAMEBOY_COLOR = 6, - CHEEVOS_CONSOLE_NINTENDO = 7, - CHEEVOS_CONSOLE_PC_ENGINE = 8, - CHEEVOS_CONSOLE_SEGA_CD = 9, - CHEEVOS_CONSOLE_SEGA_32X = 10, - CHEEVOS_CONSOLE_MASTER_SYSTEM = 11, - CHEEVOS_CONSOLE_PLAYSTATION = 12, - CHEEVOS_CONSOLE_ATARI_LYNX = 13, - CHEEVOS_CONSOLE_NEOGEO_POCKET = 14, - CHEEVOS_CONSOLE_GAME_GEAR = 15, - CHEEVOS_CONSOLE_GAMECUBE = 16, - CHEEVOS_CONSOLE_ATARI_JAGUAR = 17, - CHEEVOS_CONSOLE_NINTENDO_DS = 18, - CHEEVOS_CONSOLE_WII = 19, - CHEEVOS_CONSOLE_WII_U = 20, - CHEEVOS_CONSOLE_PLAYSTATION_2 = 21, - CHEEVOS_CONSOLE_XBOX = 22, - CHEEVOS_CONSOLE_SKYNET = 23, - CHEEVOS_CONSOLE_XBOX_ONE = 24, - CHEEVOS_CONSOLE_ATARI_2600 = 25, - CHEEVOS_CONSOLE_MS_DOS = 26, - CHEEVOS_CONSOLE_ARCADE = 27, - CHEEVOS_CONSOLE_VIRTUAL_BOY = 28, - CHEEVOS_CONSOLE_MSX = 29, - CHEEVOS_CONSOLE_COMMODORE_64 = 30, - CHEEVOS_CONSOLE_ZX81 = 31 -} cheevos_console_t; - -enum -{ - CHEEVOS_DIRTY_TITLE = 1 << 0, - CHEEVOS_DIRTY_DESC = 1 << 1, - CHEEVOS_DIRTY_POINTS = 1 << 2, - CHEEVOS_DIRTY_AUTHOR = 1 << 3, - CHEEVOS_DIRTY_ID = 1 << 4, - CHEEVOS_DIRTY_BADGE = 1 << 5, - CHEEVOS_DIRTY_CONDITIONS = 1 << 6, - CHEEVOS_DIRTY_VOTES = 1 << 7, - CHEEVOS_DIRTY_DESCRIPTION = 1 << 8, - - CHEEVOS_DIRTY_ALL = (1 << 9) - 1 -}; - enum { CHEEVOS_ACTIVE_SOFTCORE = 1 << 0, CHEEVOS_ACTIVE_HARDCORE = 1 << 1 }; -enum -{ - CHEEVOS_FORMAT_FRAMES = 0, - CHEEVOS_FORMAT_SECS, - CHEEVOS_FORMAT_MILLIS, - CHEEVOS_FORMAT_SCORE, - CHEEVOS_FORMAT_VALUE, - CHEEVOS_FORMAT_OTHER -}; - bool cheevos_load(const void *data); void cheevos_reset_game(void); @@ -150,7 +62,7 @@ void cheevos_set_support_cheevos(bool state); bool cheevos_get_support_cheevos(void); -cheevos_console_t cheevos_get_console(void); +int cheevos_get_console(void); extern bool cheevos_loaded; extern bool cheevos_hardcore_active; @@ -160,4 +72,4 @@ extern int cheats_were_enabled; RETRO_END_DECLS -#endif /* __RARCH_CHEEVOS_H */ +#endif /* __RARCH_CHEEVOS_CHEEVOS_H */ diff --git a/cheevos/cond.c b/cheevos/cond.c deleted file mode 100644 index 9f665900c9..0000000000 --- a/cheevos/cond.c +++ /dev/null @@ -1,189 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2017 - Andre Leiradella - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include "cond.h" -#include "var.h" - -#include "../retroarch.h" -#include "../verbosity.h" - -/***************************************************************************** -Parsing -*****************************************************************************/ - -static cheevos_cond_op_t cheevos_cond_parse_operator(const char** memaddr) -{ - const char *str = *memaddr; - cheevos_cond_op_t op; - - if (*str == '=' && str[1] == '=') - { - op = CHEEVOS_COND_OP_EQUALS; - str += 2; - } - else if (*str == '=') - { - op = CHEEVOS_COND_OP_EQUALS; - str++; - } - else if (*str == '!' && str[1] == '=') - { - op = CHEEVOS_COND_OP_NOT_EQUAL_TO; - str += 2; - } - else if (*str == '<' && str[1] == '=') - { - op = CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL; - str += 2; - } - else if (*str == '<') - { - op = CHEEVOS_COND_OP_LESS_THAN; - str++; - } - else if (*str == '>' && str[1] == '=') - { - op = CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL; - str += 2; - } - else if (*str == '>') - { - op = CHEEVOS_COND_OP_GREATER_THAN; - str++; - } - else - { - CHEEVOS_ERR(CHEEVOS_TAG "unknown operator %c\n.", *str); - op = CHEEVOS_COND_OP_EQUALS; - } - - *memaddr = str; - return op; -} - -void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr) -{ - const char* str = *memaddr; - cond->type = CHEEVOS_COND_TYPE_STANDARD; - - if (*str != 0 && str[1] == ':') - { - int skip = 2; - - switch (*str) - { - case 'R': - cond->type = CHEEVOS_COND_TYPE_RESET_IF; - break; - case 'P': - cond->type = CHEEVOS_COND_TYPE_PAUSE_IF; - break; - case 'A': - cond->type = CHEEVOS_COND_TYPE_ADD_SOURCE; - break; - case 'B': - cond->type = CHEEVOS_COND_TYPE_SUB_SOURCE; - break; - case 'C': - cond->type = CHEEVOS_COND_TYPE_ADD_HITS; - break; - default: - skip = 0; - break; - } - - str += skip; - } - - cheevos_var_parse(&cond->source, &str); - cond->op = cheevos_cond_parse_operator(&str); - cheevos_var_parse(&cond->target, &str); - cond->curr_hits = 0; - - if (*str == '(' || *str == '.') - { - char* end; - cond->req_hits = (unsigned)strtol(str + 1, &end, 10); - str = end + (*end == ')' || *end == '.'); - } - else - cond->req_hits = 0; - - *memaddr = str; -} - -unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which) -{ - cheevos_cond_t dummy; - unsigned index = 0; - unsigned count = 0; - - for (;;) - { - for (;;) - { - cheevos_cond_parse(&dummy, &memaddr); - - if (index == which) - count++; - - if (*memaddr != '_') - break; - - memaddr++; - } - - index++; - - if (*memaddr != 'S') - break; - - memaddr++; - } - - return count; -} - -void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which) -{ - cheevos_cond_t dummy; - unsigned index = 0; - - for (;;) - { - for (;;) - { - if (index == which) - { - cheevos_cond_parse(cond, &memaddr); - cond++; - } - else - cheevos_cond_parse(&dummy, &memaddr); - - if (*memaddr != '_') - break; - - memaddr++; - } - - index++; - - if (*memaddr != 'S') - break; - - memaddr++; - } -} diff --git a/cheevos/cond.h b/cheevos/cond.h deleted file mode 100644 index ee7cb668a1..0000000000 --- a/cheevos/cond.h +++ /dev/null @@ -1,63 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2017 - Andre Leiradella - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __RARCH_CHEEVOS_COND_H -#define __RARCH_CHEEVOS_COND_H - -#include "var.h" - -#include - -RETRO_BEGIN_DECLS - -typedef enum -{ - CHEEVOS_COND_TYPE_STANDARD, - CHEEVOS_COND_TYPE_PAUSE_IF, - CHEEVOS_COND_TYPE_RESET_IF, - CHEEVOS_COND_TYPE_ADD_SOURCE, - CHEEVOS_COND_TYPE_SUB_SOURCE, - CHEEVOS_COND_TYPE_ADD_HITS -} cheevos_cond_type_t; - -typedef enum -{ - CHEEVOS_COND_OP_EQUALS, - CHEEVOS_COND_OP_LESS_THAN, - CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL, - CHEEVOS_COND_OP_GREATER_THAN, - CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL, - CHEEVOS_COND_OP_NOT_EQUAL_TO -} cheevos_cond_op_t; - -typedef struct -{ - cheevos_cond_type_t type; - unsigned req_hits; - unsigned curr_hits; - char pause; - - cheevos_var_t source; - cheevos_cond_op_t op; - cheevos_var_t target; -} cheevos_cond_t; - -void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr); -unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which); -void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which); - -RETRO_END_DECLS - -#endif /* __RARCH_CHEEVOS_COND_H */ diff --git a/cheevos/coro.h b/cheevos/coro.h index e30616b5f2..a9eb7a4c8b 100644 --- a/cheevos/coro.h +++ b/cheevos/coro.h @@ -1,5 +1,5 @@ -#ifndef CORO_H -#define CORO_H +#ifndef __RARCH_CHEEVOS_CORO_H +#define __RARCH_CHEEVOS_CORO_H /* Released under the CC0: https://creativecommons.org/publicdomain/zero/1.0/ @@ -72,4 +72,4 @@ Released under the CC0: https://creativecommons.org/publicdomain/zero/1.0/ int step, sp; \ int stack[ 8 ]; -#endif /* CORO_H */ +#endif /* __RARCH_CHEEVOS_CORO_H */ diff --git a/cheevos/fixup.c b/cheevos/fixup.c new file mode 100644 index 0000000000..ea1109adbc --- /dev/null +++ b/cheevos/fixup.c @@ -0,0 +1,264 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2015-2018 - Andre Leiradella + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "fixup.h" +#include "cheevos.h" +#include "util.h" + +#include "../retroarch.h" +#include "../core.h" + +#include + +static int cheevos_cmpaddr(const void* e1, const void* e2) +{ + const cheevos_fixup_t* f1 = (const cheevos_fixup_t*)e1; + const cheevos_fixup_t* f2 = (const cheevos_fixup_t*)e2; + + if (f1->address < f2->address) + { + return -1; + } + else if (f1->address > f2->address) + { + return 1; + } + else + { + return 0; + } +} + +static size_t cheevos_var_reduce(size_t addr, size_t mask) +{ + while (mask) + { + size_t tmp = (mask - 1) & ~mask; + addr = (addr & tmp) | ((addr >> 1) & ~tmp); + mask = (mask & (mask - 1)) >> 1; + } + + return addr; +} + +static size_t cheevos_var_highest_bit(size_t n) +{ + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + + return n ^ (n >> 1); +} + +void cheevos_fixup_init(cheevos_fixups_t* fixups) +{ + fixups->elements = NULL; + fixups->capacity = fixups->count = 0; + fixups->dirty = false; +} + +void cheevos_fixup_destroy(cheevos_fixups_t* fixups) +{ + CHEEVOS_FREE(fixups->elements); + cheevos_fixup_init(fixups); +} + +const uint8_t* cheevos_fixup_find(cheevos_fixups_t* fixups, unsigned address, int console) +{ + cheevos_fixup_t key; + cheevos_fixup_t* found; + const uint8_t* location; + + if (fixups->dirty) + { + qsort(fixups->elements, fixups->count, sizeof(cheevos_fixup_t), cheevos_cmpaddr); + fixups->dirty = false; + } + + key.address = address; + found = (cheevos_fixup_t*)bsearch(&key, fixups->elements, fixups->count, sizeof(cheevos_fixup_t), cheevos_cmpaddr); + + if (found != NULL) + { + return found->location; + } + + if (fixups->count == fixups->capacity) + { + unsigned new_capacity = fixups->capacity == 0 ? 16 : fixups->capacity * 2; + cheevos_fixup_t* new_elements = (cheevos_fixup_t*) + realloc(fixups->elements, new_capacity * sizeof(cheevos_fixup_t)); + + if (new_elements == NULL) + { + return NULL; + } + + fixups->elements = new_elements; + fixups->capacity = new_capacity; + } + + fixups->elements[fixups->count].address = address; + fixups->elements[fixups->count++].location = location = + cheevos_patch_address(address, console); + fixups->dirty = true; + + return location; +} + +const uint8_t* cheevos_patch_address(unsigned address, int console) +{ + rarch_system_info_t* system = runloop_get_system_info(); + const void* pointer = NULL; + + if (console == RC_CONSOLE_NINTENDO) + { + if (address >= 0x0800 && address < 0x2000) + { + /* Address in the mirrorred RAM, adjust to real RAM. */ + CHEEVOS_LOG(CHEEVOS_TAG "NES memory address in mirrorred RAM %X, adjusted to %X\n", address, address & 0x07ff); + address &= 0x07ff; + } + } + else if (console == RC_CONSOLE_GAMEBOY_COLOR) + { + if (address >= 0xe000 && address <= 0xfdff) + { + /* Address in the echo RAM, adjust to real RAM. */ + CHEEVOS_LOG(CHEEVOS_TAG "GBC memory address in echo RAM %X, adjusted to %X\n", address, address - 0x2000); + address -= 0x2000; + } + } + + if (system->mmaps.num_descriptors != 0) + { + /* We have memory descriptors, use it. */ + const rarch_memory_descriptor_t* desc = NULL; + const rarch_memory_descriptor_t* end = NULL; + + /* Patch the address to correctly map it to the mmaps. */ + if (console == RC_CONSOLE_GAMEBOY_ADVANCE) + { + if (address < 0x8000) + { + /* Internal RAM. */ + CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", address, address + 0x3000000); + address += 0x3000000; + } + else + { + /* Work RAM. */ + CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", address, address + 0x2000000 - 0x8000); + address += 0x2000000 - 0x8000; + } + } + else if (console == RC_CONSOLE_PC_ENGINE) + { + /* RAM. */ + CHEEVOS_LOG(CHEEVOS_TAG "PCE memory address %X adjusted to %X\n", address, address + 0x1f0000); + address += 0x1f0000; + } + else if (console == RC_CONSOLE_SUPER_NINTENDO) + { + if (address < 0x020000) + { + /* Work RAM. */ + CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", address, address + 0x7e0000); + address += 0x7e0000; + } + else + { + /* Save RAM. */ + CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", address, address + 0x006000 - 0x020000); + address += 0x006000 - 0x020000; + } + } + + desc = system->mmaps.descriptors; + end = desc + system->mmaps.num_descriptors; + + for (; desc < end; desc++) + { + if (((desc->core.start ^ address) & desc->core.select) == 0) + { + unsigned addr = address; + pointer = desc->core.ptr; + + address = (unsigned)cheevos_var_reduce( + (addr - desc->core.start) & desc->disconnect_mask, + desc->core.disconnect); + + if (address >= desc->core.len) + address -= cheevos_var_highest_bit(address); + + address += desc->core.offset; + + CHEEVOS_LOG(CHEEVOS_TAG "address %X set to descriptor %d at offset %X\n", addr, (int)((desc - system->mmaps.descriptors) + 1), address); + break; + } + } + } + else + { + unsigned i; + + for (i = 0; i < 4; i++) + { + retro_ctx_memory_info_t meminfo; + + switch (i) + { + case 0: + meminfo.id = RETRO_MEMORY_SYSTEM_RAM; + break; + case 1: + meminfo.id = RETRO_MEMORY_SAVE_RAM; + break; + case 2: + meminfo.id = RETRO_MEMORY_VIDEO_RAM; + break; + case 3: + meminfo.id = RETRO_MEMORY_RTC; + break; + } + + core_get_memory(&meminfo); + + if (address < meminfo.size) + { + pointer = meminfo.data; + break; + } + + /** + * HACK Subtract the correct amount of bytes to reach the save RAM as + * it's size is not always set correctly in the core. + */ + if (i == 0 && console == RC_CONSOLE_NINTENDO) + address -= 0x6000; + else + address -= meminfo.size; + } + } + + if (pointer == NULL) + { + return NULL; + } + + return (const uint8_t*)pointer + address; +} diff --git a/cheevos/fixup.h b/cheevos/fixup.h new file mode 100644 index 0000000000..41893a0ba8 --- /dev/null +++ b/cheevos/fixup.h @@ -0,0 +1,48 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2015-2018 - Andre Leiradella + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __RARCH_CHEEVOS_FIXUP_H +#define __RARCH_CHEEVOS_FIXUP_H + +#include +#include + +#include + +RETRO_BEGIN_DECLS + +typedef struct +{ + unsigned address; + const uint8_t* location; +} cheevos_fixup_t; + +typedef struct +{ + cheevos_fixup_t* elements; + unsigned capacity, count; + bool dirty; +} cheevos_fixups_t; + +void cheevos_fixup_init(cheevos_fixups_t* fixups); +void cheevos_fixup_destroy(cheevos_fixups_t* fixups); + +const uint8_t* cheevos_fixup_find(cheevos_fixups_t* fixups, unsigned address, int console); + +const uint8_t* cheevos_patch_address(unsigned address, int console); + +RETRO_END_DECLS + +#endif diff --git a/cheevos/hash.c b/cheevos/hash.c new file mode 100644 index 0000000000..7b84bbbc62 --- /dev/null +++ b/cheevos/hash.c @@ -0,0 +1,12 @@ +#include "hash.h" + +uint32_t cheevos_djb2(const char* str, size_t length) +{ + const unsigned char* aux = (const unsigned char*)str; + uint32_t hash = 5381; + + while (length--) + hash = ( hash << 5 ) + hash + *aux++; + + return hash; +} diff --git a/cheevos/hash.h b/cheevos/hash.h new file mode 100644 index 0000000000..ec6e802947 --- /dev/null +++ b/cheevos/hash.h @@ -0,0 +1,30 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2015-2018 - Andre Leiradella + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __RARCH_CHEEVOS_HASH_H +#define __RARCH_CHEEVOS_HASH_H + +#include +#include + +#include + +RETRO_BEGIN_DECLS + +uint32_t cheevos_djb2(const char* str, size_t length); + +RETRO_END_DECLS + +#endif diff --git a/cheevos/parser.c b/cheevos/parser.c new file mode 100644 index 0000000000..cca2e2281a --- /dev/null +++ b/cheevos/parser.c @@ -0,0 +1,674 @@ +#include "parser.h" + +#include "hash.h" +#include "util.h" + +#include +#include +#include + +/* C89 wants only int values in enums. */ +#define CHEEVOS_JSON_KEY_GAMEID 0xb4960eecU +#define CHEEVOS_JSON_KEY_ACHIEVEMENTS 0x69749ae1U +#define CHEEVOS_JSON_KEY_ID 0x005973f2U +#define CHEEVOS_JSON_KEY_MEMADDR 0x1e76b53fU +#define CHEEVOS_JSON_KEY_TITLE 0x0e2a9a07U +#define CHEEVOS_JSON_KEY_DESCRIPTION 0xe61a1f69U +#define CHEEVOS_JSON_KEY_POINTS 0xca8fce22U +#define CHEEVOS_JSON_KEY_AUTHOR 0xa804edb8U +#define CHEEVOS_JSON_KEY_MODIFIED 0xdcea4fe6U +#define CHEEVOS_JSON_KEY_CREATED 0x3a84721dU +#define CHEEVOS_JSON_KEY_BADGENAME 0x887685d9U +#define CHEEVOS_JSON_KEY_CONSOLE_ID 0x071656e5U +#define CHEEVOS_JSON_KEY_TOKEN 0x0e2dbd26U +#define CHEEVOS_JSON_KEY_FLAGS 0x0d2e96b2U +#define CHEEVOS_JSON_KEY_LEADERBOARDS 0xf1247d2dU +#define CHEEVOS_JSON_KEY_MEM 0x0b8807e4U +#define CHEEVOS_JSON_KEY_FORMAT 0xb341208eU +#define CHEEVOS_JSON_KEY_SUCCESS 0x110461deU +#define CHEEVOS_JSON_KEY_ERROR 0x0d2011cfU + +/***************************************************************************** +Gets a value in a JSON +*****************************************************************************/ + +typedef struct +{ + unsigned key_hash; + int is_key; + const char* value; + size_t length; +} cheevos_getvalueud_t; + +static int cheevos_getvalue_key(void* userdata, + const char* name, size_t length) +{ + cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; + + ud->is_key = cheevos_djb2(name, length) == ud->key_hash; + return 0; +} + +static int cheevos_getvalue_string(void* userdata, + const char* string, size_t length) +{ + cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; + + if (ud->is_key) + { + ud->value = string; + ud->length = length; + ud->is_key = 0; + } + + return 0; +} + +static int cheevos_getvalue_boolean(void* userdata, int istrue) +{ + cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; + + if (ud->is_key) + { + if (istrue) + { + ud->value = "true"; + ud->length = 4; + } + else + { + ud->value = "false"; + ud->length = 5; + } + + ud->is_key = 0; + } + + return 0; +} + +static int cheevos_getvalue_null(void* userdata) +{ + cheevos_getvalueud_t* ud = (cheevos_getvalueud_t*)userdata; + + if (ud->is_key ) + { + ud->value = "null"; + ud->length = 4; + ud->is_key = 0; + } + + return 0; +} + +static int cheevos_get_value(const char* json, unsigned key_hash, + char* value, size_t length) +{ + static const jsonsax_handlers_t handlers = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + cheevos_getvalue_key, + NULL, + cheevos_getvalue_string, + cheevos_getvalue_string, /* number */ + cheevos_getvalue_boolean, + cheevos_getvalue_null + }; + + cheevos_getvalueud_t ud; + + ud.key_hash = key_hash; + ud.is_key = 0; + ud.value = NULL; + ud.length = 0; + *value = 0; + + if ((jsonsax_parse(json, &handlers, (void*)&ud) == JSONSAX_OK) + && ud.value && ud.length < length) + { + strlcpy(value, ud.value, ud.length + 1); + return 0; + } + + return -1; +} + +/***************************************************************************** +Returns the token of the error message +*****************************************************************************/ + +int cheevos_get_token(const char* json, char* token, size_t length) +{ + cheevos_get_value(json, CHEEVOS_JSON_KEY_ERROR, token, length); + + if (!string_is_empty(token)) + return -1; + + return cheevos_get_value(json, CHEEVOS_JSON_KEY_TOKEN, token, length); +} + +/***************************************************************************** +Count number of achievements in a JSON file +*****************************************************************************/ + +typedef struct +{ + int in_cheevos; + int in_lboards; + uint32_t field_hash; + unsigned core_count; + unsigned unofficial_count; + unsigned lboard_count; +} cheevos_countud_t; + +static int cheevos_count_end_array(void* userdata) +{ + cheevos_countud_t* ud = (cheevos_countud_t*)userdata; + + ud->in_cheevos = 0; + ud->in_lboards = 0; + return 0; +} + +static int cheevos_count_key(void* userdata, + const char* name, size_t length) +{ + cheevos_countud_t* ud = (cheevos_countud_t*)userdata; + + ud->field_hash = cheevos_djb2(name, length); + + if (ud->field_hash == CHEEVOS_JSON_KEY_ACHIEVEMENTS) + ud->in_cheevos = 1; + else if (ud->field_hash == CHEEVOS_JSON_KEY_LEADERBOARDS) + ud->in_lboards = 1; + + return 0; +} + +static int cheevos_count_number(void* userdata, + const char* number, size_t length) +{ + cheevos_countud_t* ud = (cheevos_countud_t*)userdata; + + if (ud->in_cheevos && ud->field_hash == CHEEVOS_JSON_KEY_FLAGS) + { + long flags = strtol(number, NULL, 10); + + if (flags == 3) + ud->core_count++; /* Core achievements */ + else if (flags == 5) + ud->unofficial_count++; /* Unofficial achievements */ + } + else if (ud->in_lboards && ud->field_hash == CHEEVOS_JSON_KEY_ID) + ud->lboard_count++; + + return 0; +} + +static int cheevos_count_cheevos(const char* json, + unsigned* core_count, unsigned* unofficial_count, + unsigned* lboard_count) +{ + static const jsonsax_handlers_t handlers = + { + NULL, + NULL, + NULL, + NULL, + NULL, + cheevos_count_end_array, + cheevos_count_key, + NULL, + NULL, + cheevos_count_number, + NULL, + NULL + }; + + int res; + cheevos_countud_t ud; + ud.in_cheevos = 0; + ud.in_lboards = 0; + ud.core_count = 0; + ud.unofficial_count = 0; + ud.lboard_count = 0; + + res = jsonsax_parse(json, &handlers, (void*)&ud); + + *core_count = ud.core_count; + *unofficial_count = ud.unofficial_count; + *lboard_count = ud.lboard_count; + + return res; +} + +/***************************************************************************** +Parses the cheevos in the JSON +*****************************************************************************/ + +typedef struct +{ + const char* string; + size_t length; +} cheevos_field_t; + +typedef struct +{ + int in_cheevos; + int in_lboards; + int is_console_id; + unsigned core_count; + unsigned unofficial_count; + unsigned lboard_count; + + cheevos_field_t* field; + cheevos_field_t id, memaddr, title, desc, points, author; + cheevos_field_t modified, created, badge, flags, format; + + cheevos_rapatchdata_t* patchdata; +} cheevos_readud_t; + +static const char* cheevos_dupstr(const cheevos_field_t* field) +{ + char* string = (char*)malloc(field->length + 1); + + if (!string) + return NULL; + + memcpy((void*)string, (void*)field->string, field->length); + string[field->length] = 0; + return string; +} + +static int cheevos_new_cheevo(cheevos_readud_t* ud) +{ + cheevos_racheevo_t* cheevo = NULL; + unsigned flags = (unsigned)strtol(ud->flags.string, NULL, 10); + + if (flags == 3) + cheevo = ud->patchdata->core + ud->core_count++; + else if (flags == 5) + cheevo = ud->patchdata->unofficial + ud->unofficial_count++; + else + return 0; + + cheevo->title = cheevos_dupstr(&ud->title); + cheevo->description = cheevos_dupstr(&ud->desc); + cheevo->badge = cheevos_dupstr(&ud->badge); + cheevo->memaddr = cheevos_dupstr(&ud->memaddr); + cheevo->points = (unsigned)strtol(ud->points.string, NULL, 10); + cheevo->id = (unsigned)strtol(ud->id.string, NULL, 10); + + if ( !cheevo->title + || !cheevo->description + || !cheevo->badge + || !cheevo->memaddr) + { + CHEEVOS_FREE(cheevo->title); + CHEEVOS_FREE(cheevo->description); + CHEEVOS_FREE(cheevo->badge); + CHEEVOS_FREE(cheevo->memaddr); + return -1; + } + + return 0; +} + +static int cheevos_new_lboard(cheevos_readud_t* ud) +{ + cheevos_ralboard_t* lboard = ud->patchdata->lboards + ud->lboard_count++; + + lboard->title = cheevos_dupstr(&ud->title); + lboard->description = cheevos_dupstr(&ud->desc); + lboard->format = cheevos_dupstr(&ud->format); + lboard->mem = cheevos_dupstr(&ud->memaddr); + lboard->id = (unsigned)strtol(ud->id.string, NULL, 10); + + if ( !lboard->title + || !lboard->description + || !lboard->format + || !lboard->mem) + { + CHEEVOS_FREE(lboard->title); + CHEEVOS_FREE(lboard->description); + CHEEVOS_FREE(lboard->format); + CHEEVOS_FREE(lboard->mem); + return -1; + } + + return 0; +} + +static int cheevos_read_end_object(void* userdata) +{ + cheevos_readud_t* ud = (cheevos_readud_t*)userdata; + + if (ud->in_cheevos) + return cheevos_new_cheevo(ud); + + if (ud->in_lboards) + return cheevos_new_lboard(ud); + + return 0; +} + +static int cheevos_read_end_array(void* userdata) +{ + cheevos_readud_t* ud = (cheevos_readud_t*)userdata; + + ud->in_cheevos = 0; + ud->in_lboards = 0; + return 0; +} + +static int cheevos_read_key(void* userdata, + const char* name, size_t length) +{ + cheevos_readud_t* ud = (cheevos_readud_t*)userdata; + + int common = ud->in_cheevos || ud->in_lboards; + uint32_t hash = cheevos_djb2(name, length); + ud->field = NULL; + + switch (hash) + { + case CHEEVOS_JSON_KEY_ACHIEVEMENTS: + ud->in_cheevos = 1; + break; + case CHEEVOS_JSON_KEY_LEADERBOARDS: + ud->in_lboards = 1; + break; + case CHEEVOS_JSON_KEY_CONSOLE_ID: + ud->is_console_id = 1; + break; + case CHEEVOS_JSON_KEY_ID: + if (common) + ud->field = &ud->id; + break; + case CHEEVOS_JSON_KEY_MEMADDR: + if (ud->in_cheevos) + ud->field = &ud->memaddr; + break; + case CHEEVOS_JSON_KEY_MEM: + if (ud->in_lboards) + ud->field = &ud->memaddr; + break; + case CHEEVOS_JSON_KEY_TITLE: + if (common) + ud->field = &ud->title; + break; + case CHEEVOS_JSON_KEY_DESCRIPTION: + if (common) + ud->field = &ud->desc; + break; + case CHEEVOS_JSON_KEY_POINTS: + if (ud->in_cheevos) + ud->field = &ud->points; + break; + case CHEEVOS_JSON_KEY_AUTHOR: + if (ud->in_cheevos) + ud->field = &ud->author; + break; + case CHEEVOS_JSON_KEY_MODIFIED: + if (ud->in_cheevos) + ud->field = &ud->modified; + break; + case CHEEVOS_JSON_KEY_CREATED: + if (ud->in_cheevos) + ud->field = &ud->created; + break; + case CHEEVOS_JSON_KEY_BADGENAME: + if (ud->in_cheevos) + ud->field = &ud->badge; + break; + case CHEEVOS_JSON_KEY_FLAGS: + if (ud->in_cheevos) + ud->field = &ud->flags; + break; + case CHEEVOS_JSON_KEY_FORMAT: + if (ud->in_lboards) + ud->field = &ud->format; + break; + default: + break; + } + + return 0; +} + +static int cheevos_read_string(void* userdata, + const char* string, size_t length) +{ + cheevos_readud_t* ud = (cheevos_readud_t*)userdata; + + if (ud->field) + { + ud->field->string = string; + ud->field->length = length; + } + + return 0; +} + +static int cheevos_read_number(void* userdata, + const char* number, size_t length) +{ + cheevos_readud_t* ud = (cheevos_readud_t*)userdata; + + if (ud->field) + { + ud->field->string = number; + ud->field->length = length; + } + else if (ud->is_console_id) + { + ud->patchdata->console_id = strtol(number, NULL, 10); + ud->is_console_id = 0; + } + + return 0; +} + +int cheevos_get_patchdata(const char* json, cheevos_rapatchdata_t* patchdata) +{ + static const jsonsax_handlers_t handlers = + { + NULL, + NULL, + NULL, + cheevos_read_end_object, + NULL, + cheevos_read_end_array, + cheevos_read_key, + NULL, + cheevos_read_string, + cheevos_read_number, + NULL, + NULL + }; + + cheevos_readud_t ud; + int res; + + /* Count the number of achievements in the JSON file. */ + res = cheevos_count_cheevos(json, &patchdata->core_count, + &patchdata->unofficial_count, &patchdata->lboard_count); + + if (res != JSONSAX_OK) + return -1; + + /* Allocate the achievements. */ + + patchdata->core = (cheevos_racheevo_t*) + calloc(patchdata->core_count, sizeof(cheevos_racheevo_t)); + + patchdata->unofficial = (cheevos_racheevo_t*) + calloc(patchdata->unofficial_count, sizeof(cheevos_racheevo_t)); + + patchdata->lboards = (cheevos_ralboard_t*) + calloc(patchdata->lboard_count, sizeof(cheevos_ralboard_t)); + + if (!patchdata->core || + !patchdata->unofficial || + !patchdata->lboards) + { + CHEEVOS_FREE(patchdata->core); + CHEEVOS_FREE(patchdata->unofficial); + CHEEVOS_FREE(patchdata->lboards); + + return -1; + } + + /* Load the achievements. */ + ud.in_cheevos = 0; + ud.in_lboards = 0; + ud.is_console_id = 0; + ud.field = NULL; + ud.core_count = 0; + ud.unofficial_count = 0; + ud.lboard_count = 0; + ud.patchdata = patchdata; + + if (jsonsax_parse(json, &handlers, (void*)&ud) != JSONSAX_OK) + { + cheevos_free_patchdata(patchdata); + return -1; + } + + return 0; +} + +/***************************************************************************** +Frees the patchdata +*****************************************************************************/ + +void cheevos_free_patchdata(cheevos_rapatchdata_t* patchdata) +{ + unsigned i = 0, count = 0; + const cheevos_racheevo_t* cheevo = NULL; + const cheevos_ralboard_t* lboard = NULL; + + cheevo = patchdata->core; + + for (i = 0, count = patchdata->core_count; i < count; i++, cheevo++) + { + CHEEVOS_FREE(cheevo->title); + CHEEVOS_FREE(cheevo->description); + CHEEVOS_FREE(cheevo->badge); + CHEEVOS_FREE(cheevo->memaddr); + } + + cheevo = patchdata->unofficial; + + for (i = 0, count = patchdata->unofficial_count; i < count; i++, cheevo++) + { + CHEEVOS_FREE(cheevo->title); + CHEEVOS_FREE(cheevo->description); + CHEEVOS_FREE(cheevo->badge); + CHEEVOS_FREE(cheevo->memaddr); + } + + lboard = patchdata->lboards; + + for (i = 0, count = patchdata->lboard_count; i < count; i++, lboard++) + { + CHEEVOS_FREE(lboard->title); + CHEEVOS_FREE(lboard->description); + CHEEVOS_FREE(lboard->format); + CHEEVOS_FREE(lboard->mem); + } + + CHEEVOS_FREE(patchdata->core); + CHEEVOS_FREE(patchdata->unofficial); + CHEEVOS_FREE(patchdata->lboards); + + patchdata->console_id = 0; + patchdata->core = NULL; + patchdata->unofficial = NULL; + patchdata->lboards = NULL; + patchdata->core_count = 0; + patchdata->unofficial_count = 0; + patchdata->lboard_count = 0; +} + +/***************************************************************************** +Deactivates unlocked cheevos +*****************************************************************************/ + +typedef struct +{ + int is_element; + cheevos_unlock_cb_t unlock_cb; + void* userdata; +} cheevos_deactivate_t; + +static int cheevos_deactivate_index(void* userdata, unsigned int index) +{ + cheevos_deactivate_t* ud = (cheevos_deactivate_t*)userdata; + + ud->is_element = 1; + return 0; +} + +static int cheevos_deactivate_number(void* userdata, + const char* number, size_t length) +{ + cheevos_deactivate_t* ud = (cheevos_deactivate_t*)userdata; + unsigned id = 0; + + if (ud->is_element) + { + ud->is_element = 0; + id = (unsigned)strtol(number, NULL, 10); + + ud->unlock_cb(id, ud->userdata); + } + + return 0; +} + +void cheevos_deactivate_unlocks(const char* json, cheevos_unlock_cb_t unlock_cb, void* userdata) +{ + static const jsonsax_handlers_t handlers = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + cheevos_deactivate_index, + NULL, + cheevos_deactivate_number, + NULL, + NULL + }; + + cheevos_deactivate_t ud; + + ud.is_element = 0; + ud.unlock_cb = unlock_cb; + ud.userdata = userdata; + + jsonsax_parse(json, &handlers, (void*)&ud); +} + +/***************************************************************************** +Returns the game ID +*****************************************************************************/ + +unsigned chevos_get_gameid(const char* json) +{ + char gameid[32]; + + if (cheevos_get_value(json, CHEEVOS_JSON_KEY_GAMEID, gameid, sizeof(gameid)) != 0) + return 0; + + return (unsigned)strtol(gameid, NULL, 10); +} diff --git a/cheevos/parser.h b/cheevos/parser.h new file mode 100644 index 0000000000..5b10de6236 --- /dev/null +++ b/cheevos/parser.h @@ -0,0 +1,69 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2015-2018 - Andre Leiradella + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __RARCH_CHEEVOS_PARSER_H +#define __RARCH_CHEEVOS_PARSER_H + +#include +#include +#include + +#include + +RETRO_BEGIN_DECLS + +typedef struct { + const char* title; + const char* description; + const char* badge; + const char* memaddr; + unsigned points; + unsigned id; +} cheevos_racheevo_t; + +typedef struct { + const char* title; + const char* description; + const char* format; + const char* mem; + unsigned id; +} cheevos_ralboard_t; + +typedef struct { + unsigned console_id; + + cheevos_racheevo_t* core; + cheevos_racheevo_t* unofficial; + cheevos_ralboard_t* lboards; + + unsigned core_count; + unsigned unofficial_count; + unsigned lboard_count; +} cheevos_rapatchdata_t; + +typedef void (*cheevos_unlock_cb_t)(unsigned id, void* userdata); + +int cheevos_get_token(const char* json, char* token, size_t length); + +int cheevos_get_patchdata(const char* json, cheevos_rapatchdata_t* patchdata); +void cheevos_free_patchdata(cheevos_rapatchdata_t* patchdata); + +void cheevos_deactivate_unlocks(const char* json, cheevos_unlock_cb_t unlock_cb, void* userdata); + +unsigned chevos_get_gameid(const char* json); + +RETRO_END_DECLS + +#endif diff --git a/cheevos/util.h b/cheevos/util.h new file mode 100644 index 0000000000..4e389cf404 --- /dev/null +++ b/cheevos/util.h @@ -0,0 +1,53 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2015-2016 - Andre Leiradella + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __RARCH_CHEEVOS_UTIL_H +#define __RARCH_CHEEVOS_UTIL_H + +#include + +RETRO_BEGIN_DECLS + +/***************************************************************************** +Setup - mainly for debugging +*****************************************************************************/ + +/* Define this macro to get extra-verbose log for cheevos. */ +#undef CHEEVOS_VERBOSE + +/***************************************************************************** +End of setup +*****************************************************************************/ + +#define CHEEVOS_TAG "[CHEEVOS]: " +#define CHEEVOS_FREE(p) do { void* q = (void*)p; if (q != NULL) free(q); } while (0) + +#ifdef CHEEVOS_VERBOSE + +#define CHEEVOS_LOG RARCH_LOG +#define CHEEVOS_ERR RARCH_ERR + +#else + +#define CHEEVOS_LOG cheevos_log +#define CHEEVOS_ERR RARCH_ERR + +void cheevos_log(const char *fmt, ...); + +#endif + +RETRO_END_DECLS + +#endif /* __RARCH_CHEEVOS_UTIL_H */ diff --git a/cheevos/var.c b/cheevos/var.c deleted file mode 100644 index 5f13c2b8b6..0000000000 --- a/cheevos/var.c +++ /dev/null @@ -1,416 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2017 - Andre Leiradella - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include -#include - -#include - -#include "var.h" - -#include "../retroarch.h" -#include "../core.h" -#include "../verbosity.h" - -/***************************************************************************** -Parsing -*****************************************************************************/ - -static cheevos_var_size_t cheevos_var_parse_prefix(const char** memaddr) -{ - /* Careful not to use ABCDEF here, this denotes part of an actual variable! */ - const char* str = *memaddr; - cheevos_var_size_t size; - - switch (toupper((unsigned char)*str++)) - { - case 'M': - size = CHEEVOS_VAR_SIZE_BIT_0; - break; - case 'N': - size = CHEEVOS_VAR_SIZE_BIT_1; - break; - case 'O': - size = CHEEVOS_VAR_SIZE_BIT_2; - break; - case 'P': - size = CHEEVOS_VAR_SIZE_BIT_3; - break; - case 'Q': - size = CHEEVOS_VAR_SIZE_BIT_4; - break; - case 'R': - size = CHEEVOS_VAR_SIZE_BIT_5; - break; - case 'S': - size = CHEEVOS_VAR_SIZE_BIT_6; - break; - case 'T': - size = CHEEVOS_VAR_SIZE_BIT_7; - break; - case 'L': - size = CHEEVOS_VAR_SIZE_NIBBLE_LOWER; - break; - case 'U': - size = CHEEVOS_VAR_SIZE_NIBBLE_UPPER; - break; - case 'H': - size = CHEEVOS_VAR_SIZE_EIGHT_BITS; - break; - case 'X': - size = CHEEVOS_VAR_SIZE_THIRTYTWO_BITS; - break; - default: - str--; - /* fall through */ - case ' ': - size = CHEEVOS_VAR_SIZE_SIXTEEN_BITS; - break; - } - - *memaddr = str; - return size; -} - -static size_t cheevos_var_reduce(size_t addr, size_t mask) -{ - while (mask) - { - size_t tmp = (mask - 1) & ~mask; - addr = (addr & tmp) | ((addr >> 1) & ~tmp); - mask = (mask & (mask - 1)) >> 1; - } - - return addr; -} - -static size_t cheevos_var_highest_bit(size_t n) -{ - n |= n >> 1; - n |= n >> 2; - n |= n >> 4; - n |= n >> 8; - n |= n >> 16; - - return n ^ (n >> 1); -} - -void cheevos_var_parse(cheevos_var_t* var, const char** memaddr) -{ - char *end = NULL; - const char *str = *memaddr; - unsigned base = 16; - - var->is_bcd = false; - - if (toupper((unsigned char)*str) == 'D' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X') - { - /* d0x + 4 hex digits */ - str += 3; - var->type = CHEEVOS_VAR_TYPE_DELTA_MEM; - } - else if (toupper((unsigned char)*str) == 'B' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X') - { - /* b0x (binary-coded decimal) */ - str += 3; - var->is_bcd = true; - var->type = CHEEVOS_VAR_TYPE_ADDRESS; - } - else if (*str == '0' && toupper((unsigned char)str[1]) == 'X') - { - /* 0x + 4 hex digits */ - str += 2; - var->type = CHEEVOS_VAR_TYPE_ADDRESS; - } - else - { - var->type = CHEEVOS_VAR_TYPE_VALUE_COMP; - - if (toupper((unsigned char)*str) == 'H') - str++; - else - { - if (toupper((unsigned char)*str) == 'V') - str++; - - base = 10; - } - } - - if (var->type != CHEEVOS_VAR_TYPE_VALUE_COMP) - { - var->size = cheevos_var_parse_prefix(&str); - } - - var->value = (unsigned)strtol(str, &end, base); - *memaddr = end; -} - -void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console) -{ - rarch_system_info_t *system = runloop_get_system_info(); - - var->bank_id = -1; - - if (console == CHEEVOS_CONSOLE_NINTENDO) - { - if (var->value >= 0x0800 && var->value < 0x2000) - { - CHEEVOS_LOG(CHEEVOS_TAG "NES memory address in mirrorred RAM %X, adjusted to %X\n", var->value, var->value & 0x07ff); - var->value &= 0x07ff; - } - } - else if (console == CHEEVOS_CONSOLE_GAMEBOY_COLOR) - { - if (var->value >= 0xe000 && var->value <= 0xfdff) - { - CHEEVOS_LOG(CHEEVOS_TAG "GBC memory address in echo RAM %X, adjusted to %X\n", var->value, var->value - 0x2000); - var->value -= 0x2000; - } - } - - if (system->mmaps.num_descriptors != 0) - { - const rarch_memory_descriptor_t *desc = NULL; - const rarch_memory_descriptor_t *end = NULL; - - /* Patch the address to correctly map it to the mmaps */ - if (console == CHEEVOS_CONSOLE_GAMEBOY_ADVANCE) - { - if (var->value < 0x8000) /* Internal RAM */ - { - CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x3000000); - var->value += 0x3000000; - } - else /* Work RAM */ - { - CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x2000000 - 0x8000); - var->value += 0x2000000 - 0x8000; - } - } - else if (console == CHEEVOS_CONSOLE_PC_ENGINE) - { - CHEEVOS_LOG(CHEEVOS_TAG "PCE memory address %X adjusted to %X\n", var->value, var->value + 0x1f0000); - var->value += 0x1f0000; - } - else if (console == CHEEVOS_CONSOLE_SUPER_NINTENDO) - { - if (var->value < 0x020000) /* Work RAM */ - { - CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x7e0000); - var->value += 0x7e0000; - } - else /* Save RAM */ - { - CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x006000 - 0x020000); - var->value += 0x006000 - 0x020000; - } - } - - desc = system->mmaps.descriptors; - end = desc + system->mmaps.num_descriptors; - - for (; desc < end; desc++) - { - if (((desc->core.start ^ var->value) & desc->core.select) == 0) - { - unsigned addr = var->value; - var->bank_id = (int)(desc - system->mmaps.descriptors); - var->value = (unsigned)cheevos_var_reduce( - (addr - desc->core.start) & desc->disconnect_mask, - desc->core.disconnect); - - if (var->value >= desc->core.len) - var->value -= cheevos_var_highest_bit(var->value); - - var->value += desc->core.offset; - - CHEEVOS_LOG(CHEEVOS_TAG "address %X set to descriptor %d at offset %X\n", addr, var->bank_id + 1, var->value); - break; - } - } - } - else - { - unsigned i; - - for (i = 0; i < 4; i++) - { - retro_ctx_memory_info_t meminfo; - - switch (i) - { - case 0: - meminfo.id = RETRO_MEMORY_SYSTEM_RAM; - break; - case 1: - meminfo.id = RETRO_MEMORY_SAVE_RAM; - break; - case 2: - meminfo.id = RETRO_MEMORY_VIDEO_RAM; - break; - case 3: - meminfo.id = RETRO_MEMORY_RTC; - break; - } - - core_get_memory(&meminfo); - - if (var->value < meminfo.size) - { - var->bank_id = i; - break; - } - - /* HACK subtract the correct amount of bytes to reach the save RAM */ - if (i == 0 && console == CHEEVOS_CONSOLE_NINTENDO) - var->value -= 0x6000; - else - var->value -= meminfo.size; - } - } -} - -/***************************************************************************** -Testing -*****************************************************************************/ - -uint8_t* cheevos_var_get_memory(const cheevos_var_t* var) -{ - uint8_t* memory = NULL; - - if (var->bank_id >= 0) - { - rarch_system_info_t* system = runloop_get_system_info(); - - if (system->mmaps.num_descriptors != 0) - memory = (uint8_t*)system->mmaps.descriptors[var->bank_id].core.ptr; - else - { - retro_ctx_memory_info_t meminfo = {NULL, 0, 0}; - - switch (var->bank_id) - { - case 0: - meminfo.id = RETRO_MEMORY_SYSTEM_RAM; - break; - case 1: - meminfo.id = RETRO_MEMORY_SAVE_RAM; - break; - case 2: - meminfo.id = RETRO_MEMORY_VIDEO_RAM; - break; - case 3: - meminfo.id = RETRO_MEMORY_RTC; - break; - default: - CHEEVOS_ERR(CHEEVOS_TAG "invalid bank id: %s\n", var->bank_id); - break; - } - - core_get_memory(&meminfo); - memory = (uint8_t*)meminfo.data; - } - - if (memory) - memory += var->value; - } - - return memory; -} - -unsigned cheevos_var_get_value(cheevos_var_t* var) -{ - const uint8_t* memory = NULL; - unsigned value = 0; - - switch (var->type) - { - case CHEEVOS_VAR_TYPE_VALUE_COMP: - value = var->value; - break; - - case CHEEVOS_VAR_TYPE_ADDRESS: - case CHEEVOS_VAR_TYPE_DELTA_MEM: - memory = cheevos_var_get_memory(var); - - if (memory) - { - value = memory[0]; - - switch (var->size) - { - case CHEEVOS_VAR_SIZE_BIT_0: - value &= 1; - break; - case CHEEVOS_VAR_SIZE_BIT_1: - value = (value >> 1) & 1; - break; - case CHEEVOS_VAR_SIZE_BIT_2: - value = (value >> 2) & 1; - break; - case CHEEVOS_VAR_SIZE_BIT_3: - value = (value >> 3) & 1; - break; - case CHEEVOS_VAR_SIZE_BIT_4: - value = (value >> 4) & 1; - break; - case CHEEVOS_VAR_SIZE_BIT_5: - value = (value >> 5) & 1; - break; - case CHEEVOS_VAR_SIZE_BIT_6: - value = (value >> 6) & 1; - break; - case CHEEVOS_VAR_SIZE_BIT_7: - value = (value >> 7) & 1; - break; - case CHEEVOS_VAR_SIZE_NIBBLE_LOWER: - value &= 0x0f; - break; - case CHEEVOS_VAR_SIZE_NIBBLE_UPPER: - value = (value >> 4) & 0x0f; - break; - case CHEEVOS_VAR_SIZE_EIGHT_BITS: - break; - case CHEEVOS_VAR_SIZE_SIXTEEN_BITS: - value |= memory[1] << 8; - break; - case CHEEVOS_VAR_SIZE_THIRTYTWO_BITS: - value |= memory[1] << 8; - value |= memory[2] << 16; - value |= memory[3] << 24; - break; - } - } - - if (var->type == CHEEVOS_VAR_TYPE_DELTA_MEM) - { - unsigned previous = var->previous; - var->previous = value; - value = previous; - } - - break; - - case CHEEVOS_VAR_TYPE_DYNAMIC_VAR: - /* We shouldn't get here... */ - break; - } - - if(var->is_bcd) - return (((value >> 4) & 0xf) * 10) + (value & 0xf); - else - return value; -} diff --git a/cheevos/var.h b/cheevos/var.h deleted file mode 100644 index 336b65d4ed..0000000000 --- a/cheevos/var.h +++ /dev/null @@ -1,78 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2017 - Andre Leiradella - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __RARCH_CHEEVOS_VAR_H -#define __RARCH_CHEEVOS_VAR_H - -#include - -#include "cheevos.h" - -#include - -RETRO_BEGIN_DECLS - -typedef enum -{ - CHEEVOS_VAR_SIZE_BIT_0 = 0, - CHEEVOS_VAR_SIZE_BIT_1, - CHEEVOS_VAR_SIZE_BIT_2, - CHEEVOS_VAR_SIZE_BIT_3, - CHEEVOS_VAR_SIZE_BIT_4, - CHEEVOS_VAR_SIZE_BIT_5, - CHEEVOS_VAR_SIZE_BIT_6, - CHEEVOS_VAR_SIZE_BIT_7, - CHEEVOS_VAR_SIZE_NIBBLE_LOWER, - CHEEVOS_VAR_SIZE_NIBBLE_UPPER, - /* Byte, */ - CHEEVOS_VAR_SIZE_EIGHT_BITS, /* =Byte, */ - CHEEVOS_VAR_SIZE_SIXTEEN_BITS, - CHEEVOS_VAR_SIZE_THIRTYTWO_BITS -} cheevos_var_size_t; - -typedef enum -{ - /* compare to the value of a live address in RAM */ - CHEEVOS_VAR_TYPE_ADDRESS = 0, - - /* a number. assume 32 bit */ - CHEEVOS_VAR_TYPE_VALUE_COMP, - - /* the value last known at this address. */ - CHEEVOS_VAR_TYPE_DELTA_MEM, - - /* a custom user-set variable */ - CHEEVOS_VAR_TYPE_DYNAMIC_VAR -} cheevos_var_type_t; - -typedef struct -{ - cheevos_var_size_t size; - cheevos_var_type_t type; - int bank_id; - bool is_bcd; - unsigned value; - unsigned previous; -} cheevos_var_t; - -void cheevos_var_parse(cheevos_var_t* var, const char** memaddr); -void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console); - -uint8_t* cheevos_var_get_memory(const cheevos_var_t* var); -unsigned cheevos_var_get_value(cheevos_var_t* var); - -RETRO_END_DECLS - -#endif /* __RARCH_CHEEVOS_VAR_H */ diff --git a/command.c b/command.c index 46a3e51a9c..d551f502ae 100644 --- a/command.c +++ b/command.c @@ -41,7 +41,7 @@ #ifdef HAVE_CHEEVOS #include "cheevos/cheevos.h" -#include "cheevos/var.h" +#include "cheevos/fixup.h" #endif #ifdef HAVE_DISCORD @@ -262,14 +262,13 @@ static bool command_version(const char* arg) #define SMY_CMD_STR "READ_CORE_RAM" static bool command_read_ram(const char *arg) { - cheevos_var_t var; unsigned i; char *reply = NULL; const uint8_t * data = NULL; char *reply_at = NULL; unsigned int nbytes = 0; unsigned int alloc_size = 0; - int addr = -1; + unsigned int addr = -1; if (sscanf(arg, "%x %d", &addr, &nbytes) != 2) return true; @@ -278,9 +277,7 @@ static bool command_read_ram(const char *arg) reply[0] = '\0'; reply_at = reply + sprintf(reply, SMY_CMD_STR " %x", addr); - var.value = addr; - cheevos_var_patch_addr(&var, cheevos_get_console()); - data = cheevos_var_get_memory(&var); + data = cheevos_patch_address(addr, cheevos_get_console()); if (data) { @@ -302,14 +299,9 @@ static bool command_read_ram(const char *arg) static bool command_write_ram(const char *arg) { - cheevos_var_t var; unsigned nbytes = 0; - uint8_t *data = NULL; - - var.value = strtoul(arg, (char**)&arg, 16); - cheevos_var_patch_addr(&var, cheevos_get_console()); - - data = cheevos_var_get_memory(&var); + unsigned int addr = strtoul(arg, (char**)&arg, 16); + uint8_t *data = (uint8_t *)cheevos_patch_address(addr, cheevos_get_console()); if (data) { From 720ecaff174c4900af059bc0541fd94fe14db237 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Sun, 2 Sep 2018 14:32:08 +0100 Subject: [PATCH 0008/1292] Updated rcheevos to 7.0.0 --- deps/rcheevos/CHANGELOG.md | 4 + deps/rcheevos/README.md | 48 -- deps/rcheevos/include/rjson.h | 131 ----- deps/rcheevos/src/rjson/dejson.c | 750 ----------------------------- deps/rcheevos/src/rjson/dejson.h | 71 --- deps/rcheevos/src/rjson/schema.c | 609 ----------------------- deps/rcheevos/src/rjson/schema.dej | 82 ---- deps/rcheevos/test/Makefile | 2 - deps/rcheevos/test/test.c | 80 --- 9 files changed, 4 insertions(+), 1773 deletions(-) delete mode 100644 deps/rcheevos/include/rjson.h delete mode 100644 deps/rcheevos/src/rjson/dejson.c delete mode 100644 deps/rcheevos/src/rjson/dejson.h delete mode 100644 deps/rcheevos/src/rjson/schema.c delete mode 100644 deps/rcheevos/src/rjson/schema.dej diff --git a/deps/rcheevos/CHANGELOG.md b/deps/rcheevos/CHANGELOG.md index 0a1a1d002a..c65c4945eb 100644 --- a/deps/rcheevos/CHANGELOG.md +++ b/deps/rcheevos/CHANGELOG.md @@ -1,3 +1,7 @@ +# v7.0.0 + +* Removed **rjson** + # v6.5.0 * Added a schema for errors returned by the server diff --git a/deps/rcheevos/README.md b/deps/rcheevos/README.md index 4685e7a11f..3453251e28 100644 --- a/deps/rcheevos/README.md +++ b/deps/rcheevos/README.md @@ -465,54 +465,6 @@ void rc_format_value(char* buffer, int size, unsigned value, int format); `buffer` receives `value` formatted according to `format`. No more than `size` characters will be written to `buffer`. 32 characters are enough to hold any valid value with any format. -# **rjson** - -**rjson** provides parsing of RetroAchievements JSON files, and provides the results in strongly typed C structures instead of returning a generic dictionary and forcing the caller to check for values and extracting them. - -Similarly to **rcheevos**, **rjson** does *not* allocate any memory. The caller must use the functions that compute the size needed to parse a given JSON, allocate the necessary memory, and call another function that does the parsing. - -## API - -### Return values - -The functions that compute the memory needed for a given JSON return a positive value, which is the number of bytes needed. Errors are negative values taken from the following enumeration: - -```c -enum { - RC_JSON_OK = 0, - RC_JSON_OBJECT_EXPECTED = -1, - RC_JSON_UNKOWN_RECORD = -2, - RC_JSON_EOF_EXPECTED = -3, - RC_JSON_MISSING_KEY = -4, - RC_JSON_UNTERMINATED_KEY = -5, - RC_JSON_MISSING_VALUE = -6, - RC_JSON_UNTERMINATED_OBJECT = -7, - RC_JSON_INVALID_VALUE = -8, - RC_JSON_UNTERMINATED_STRING = -9, - RC_JSON_UNTERMINATED_ARRAY = -10, - RC_JSON_INVALID_ESCAPE = -11 -}; -``` - -### Supported schemas - -**rjson** supports the following JSON schemas. Please see `rjson.h` for the definition of the C structures: - -* `rc_json_gameid_t`: The game identifier returned by the server, given its hash. -* `rc_json_login_t`: The login token for the user, given their user name and password. -* `rc_json_patch_t`: The information about a game, given its identifier. It includes arrays with the achievements and leaderboards for the game. -* `rc_json_unlocks_t`: The list of achievements already awarded for the player, given the game identifier. Used to avoid the emulator awarding achievements more than once. -* `rc_json_error_t`: Error messages returned by the server. - -For each schema there are two functions, for example: - -```c -int rc_json_get_patch_size(const char* json); -const rc_json_patch_t* rc_json_parse_patch(void* buffer, const char* json); -``` - -`rc_json_get_patch_size` returns the number of bytes needed to parse the given JSON as a `rc_json_patch_t`. `rc_json_parse_patch` parses the given JSON into the given `buffer`, returning a pointer that is used to access the decoded information. - # **rurl** **rurl** builds URLs to access many RetroAchievements web services. Its purpose it to just to free the developer from having to URL-encode parameters and build correct URL that are valid for the server. diff --git a/deps/rcheevos/include/rjson.h b/deps/rcheevos/include/rjson.h deleted file mode 100644 index f13f0ef3bd..0000000000 --- a/deps/rcheevos/include/rjson.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef RJSON_H -#define RJSON_H - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - RC_JSON_OK = 0, - RC_JSON_OBJECT_EXPECTED = -1, - RC_JSON_UNKOWN_RECORD = -2, - RC_JSON_EOF_EXPECTED = -3, - RC_JSON_MISSING_KEY = -4, - RC_JSON_UNTERMINATED_KEY = -5, - RC_JSON_MISSING_VALUE = -6, - RC_JSON_UNTERMINATED_OBJECT = -7, - RC_JSON_INVALID_VALUE = -8, - RC_JSON_UNTERMINATED_STRING = -9, - RC_JSON_UNTERMINATED_ARRAY = -10, - RC_JSON_INVALID_ESCAPE = -11 -}; - -typedef struct { - unsigned int gameid; - char success; -} -rc_json_gameid_t; - -int rc_json_get_gameid_size(const char* json); -const rc_json_gameid_t* rc_json_parse_gameid(void* buffer, const char* json); - -typedef struct { - const char* token; - const char* user; - unsigned int score; - unsigned int messages; - char success; -} -rc_json_login_t; - -int rc_json_get_login_size(const char* json); -const rc_json_login_t* rc_json_parse_login(void* buffer, const char* json); - -typedef struct { - unsigned long long created; - unsigned long long modified; - const char* author; - const char* badge; - const char* description; - const char* memaddr; - const char* title; - unsigned int flags; - unsigned int points; - unsigned int id; -} -rc_json_cheevo_t; - -int rc_json_get_cheevo_size(const char* json); -const rc_json_cheevo_t* rc_json_parse_cheevo(void* buffer, const char* json); - -typedef struct { - const char* description; - const char* title; - const char* format; - const char* mem; - unsigned int id; -} -rc_json_lboard_t; - -int rc_json_get_lboard_size(const char* json); -const rc_json_lboard_t* rc_json_parse_lboard(void* buffer, const char* json); - -typedef struct { - const rc_json_lboard_t* lboards; int lboards_count; - const char* genre; - const char* developer; - const char* publisher; - const char* released; - const char** presence; - const char* console; - const rc_json_cheevo_t* cheevos; int cheevos_count; - const char* image_boxart; - const char* image_title; - const char* image_icon; - const char* title; - const char* image_ingame; - unsigned int consoleid; - unsigned int id; - unsigned int flags; - unsigned int topicid; - char is_final; -} -rc_json_patchdata_t; - -int rc_json_get_patchdata_size(const char* json); -const rc_json_patchdata_t* rc_json_parse_patchdata(void* buffer, const char* json); - -typedef struct { - rc_json_patchdata_t patchdata; - char success; -} -rc_json_patch_t; - -int rc_json_get_patch_size(const char* json); -const rc_json_patch_t* rc_json_parse_patch(void* buffer, const char* json); - -typedef struct { - const unsigned int* ids; int ids_count; - unsigned int gameid; - char success; - char hardcore; -} -rc_json_unlocks_t; - -int rc_json_get_unlocks_size(const char* json); -const rc_json_unlocks_t* rc_json_parse_unlocks(void* buffer, const char* json); - -typedef struct { - const char* error; - char success; -} -rc_json_error_t; - -int rc_json_get_error_size(const char* json); -const rc_json_error_t* rc_json_parse_error(void* buffer, const char* json); - -#ifdef __cplusplus -} -#endif - -#endif /* RJSON_H */ diff --git a/deps/rcheevos/src/rjson/dejson.c b/deps/rcheevos/src/rjson/dejson.c deleted file mode 100644 index e1b628f264..0000000000 --- a/deps/rcheevos/src/rjson/dejson.c +++ /dev/null @@ -1,750 +0,0 @@ -#include "rjson.h" -#include "dejson.h" - -#include -#include -#include -#include -#include -#include -#include - -typedef struct { - const uint8_t* json; - uintptr_t buffer; - int counting; - jmp_buf rollback; -} -rc_json_state_t; - -static void* rc_json_alloc(rc_json_state_t* state, size_t size, size_t alignment) { - state->buffer = (state->buffer + alignment - 1) & ~(alignment - 1); - void* ptr = (void*)state->buffer; - state->buffer += size; - return ptr; -} - -static void rc_json_skip_spaces(rc_json_state_t* state) { - if (isspace(*state->json)) { - do { - state->json++; - } - while (isspace(*state->json)); - } -} - -static size_t rc_json_skip_string(rc_json_state_t*); -static void rc_json_skip_value(rc_json_state_t*); - -static void rc_json_skip_object(rc_json_state_t* state) { - state->json++; - rc_json_skip_spaces(state); - - while (*state->json != '}') { - rc_json_skip_string(state); - rc_json_skip_spaces(state); - - if (*state->json != ':') { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - state->json++; - rc_json_skip_spaces(state); - rc_json_skip_value(state); - rc_json_skip_spaces(state); - - if (*state->json != ',') { - break; - } - - state->json++; - rc_json_skip_spaces(state); - } - - if (*state->json != '}') { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - state->json++; -} - -static size_t rc_json_skip_array(rc_json_state_t* state) { - size_t count = 0; - state->json++; - rc_json_skip_spaces(state); - - while (*state->json != ']') { - rc_json_skip_value(state); - rc_json_skip_spaces(state); - - count++; - - if (*state->json != ',') { - break; - } - - state->json++; - rc_json_skip_spaces(state); - } - - if (*state->json != ']') { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - state->json++; - return count; -} - -static void rc_json_skip_number(rc_json_state_t* state) { - errno = 0; - - char* end; - double result = strtod((const char*)state->json, &end); - - if ((result == 0.0 && end == (const char*)state->json) || errno == ERANGE) { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - state->json = (uint8_t*)end; -} - -static void rc_json_skip_boolean(rc_json_state_t* state) { - const uint8_t* json = state->json; - - if (json[0] == 't' && json[1] == 'r' && json[2] == 'u' && json[3] == 'e' && !isalpha(json[4])) { - state->json += 4; - } - else if (json[0] == 'f' && json[1] == 'a' && json[2] == 'l' && json[3] == 's' && json[4] == 'e' && !isalpha(json[5])) { - state->json += 5; - } - else { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } -} - -static size_t rc_json_skip_string(rc_json_state_t* state) { - const uint8_t* aux = state->json + 1; - size_t length = 0; - - if (*aux !='"') { - do { - length++; - - if (*aux++ == '\\') { - char digits[5]; - uint32_t utf32; - - switch (*aux++) { - case '"': - case '\\': - case '/': - case 'b': - case 'f': - case 'n': - case 'r': - case 't': - break; - - case 'u': - if (!isxdigit(aux[0] || !isxdigit(aux[1]) || !isxdigit(aux[2]) || !isxdigit(aux[3]))) { - longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); - } - - digits[0] = aux[0]; - digits[1] = aux[1]; - digits[2] = aux[2]; - digits[3] = aux[3]; - digits[4] = 0; - aux += 4; - - utf32 = strtoul(digits, NULL, 16); - - if (utf32 < 0x80U) { - length += 0; - } - else if (utf32 < 0x800U) { - length += 1; - } - else if (utf32 < 0x10000U) { - length += 2; - } - else if (utf32 < 0x200000U) { - length += 3; - } - else { - longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); - } - - break; - - default: - longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); - } - } - } - while (*aux != '"'); - } - - state->json = aux + 1; - return length + 1; -} - -static void rc_json_skip_null(rc_json_state_t* state) { - const uint8_t* json = state->json; - - if (json[0] == 'n' && json[1] == 'u' && json[2] == 'l' && json[3] == 'l' && !isalpha(json[4])) { - state->json += 4; - } - else { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } -} - -static void rc_json_skip_value(rc_json_state_t* state) { - switch (*state->json) { - case '{': - rc_json_skip_object(state); - break; - - case '[': - rc_json_skip_array(state); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '-': - rc_json_skip_number(state); - break; - - case 't': - case 'f': - rc_json_skip_boolean(state); - break; - - case '"': - rc_json_skip_string(state); - break; - - case 'n': - rc_json_skip_null(state); - break; - - default: - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - rc_json_skip_spaces(state); -} - -static int64_t rc_json_get_int64(rc_json_state_t* state, int64_t min, int64_t max) { - errno = 0; - - char* end; - long long result = strtoll((const char*)state->json, &end, 10); - - if ((result == 0 && end == (const char*)state->json) || errno == ERANGE || result < min || result > max) { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - state->json = (uint8_t*)end; - return result; -} - -static uint64_t rc_json_get_uint64(rc_json_state_t* state, uint64_t max) { - errno = 0; - - char* end; - unsigned long long result = strtoull((char*)state->json, &end, 10); - - if ((result == 0 && end == (const char*)state->json) || errno == ERANGE || result > max) { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - state->json = (uint8_t*)end; - return result; -} - -static double rc_json_get_double(rc_json_state_t* state, double min, double max) { - errno = 0; - - char* end; - double result = strtod((const char*)state->json, &end); - - if ((result == 0.0 && end == (const char*)state->json) || errno == ERANGE || result < min || result > max) { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - state->json = (uint8_t*)end; - return result; -} - -static void rc_json_parse_char(rc_json_state_t* state, void* data) { - *(char*)data = rc_json_get_int64(state, CHAR_MIN, CHAR_MAX); -} - -static void rc_json_parse_uchar(rc_json_state_t* state, void* data) { - *(unsigned char*)data = rc_json_get_uint64(state, UCHAR_MAX); -} - -static void rc_json_parse_short(rc_json_state_t* state, void* data) { - *(short*)data = rc_json_get_int64(state, SHRT_MIN, SHRT_MAX); -} - -static void rc_json_parse_ushort(rc_json_state_t* state, void* data) { - *(unsigned short*)data = rc_json_get_uint64(state, USHRT_MAX); -} - -static void rc_json_parse_int(rc_json_state_t* state, void* data) { - *(int*)data = rc_json_get_int64(state, INT_MIN, INT_MAX); -} - -static void rc_json_parse_uint(rc_json_state_t* state, void* data) { - *(unsigned int*)data = rc_json_get_uint64(state, UINT_MAX); -} - -static void rc_json_parse_long(rc_json_state_t* state, void* data) { - *(long*)data = rc_json_get_int64(state, LONG_MIN, LONG_MAX); -} - -static void rc_json_parse_ulong(rc_json_state_t* state, void* data) { - *(unsigned long*)data = rc_json_get_uint64(state, ULONG_MAX); -} - -static void rc_json_parse_longlong(rc_json_state_t* state, void* data) { - *(unsigned long*)data = rc_json_get_int64(state, LLONG_MIN, LLONG_MAX); -} - -static void rc_json_parse_ulonglong(rc_json_state_t* state, void* data) { - *(unsigned long*)data = rc_json_get_uint64(state, ULLONG_MAX); -} - -static void rc_json_parse_int8(rc_json_state_t* state, void* data) { - *(int8_t*)data = rc_json_get_int64(state, INT8_MIN, INT8_MAX); -} - -static void rc_json_parse_int16(rc_json_state_t* state, void* data) { - *(int16_t*)data = rc_json_get_int64(state, INT16_MIN, INT16_MAX); -} - -static void rc_json_parse_int32(rc_json_state_t* state, void* data) { - *(int32_t*)data = rc_json_get_int64(state, INT32_MIN, INT32_MAX); -} - -static void rc_json_parse_int64(rc_json_state_t* state, void* data) { - *(int64_t*)data = rc_json_get_int64(state, INT64_MIN, INT64_MAX); -} - -static void rc_json_parse_uint8(rc_json_state_t* state, void* data) { - *(uint8_t*)data = rc_json_get_uint64(state, UINT8_MAX); -} - -static void rc_json_parse_uint16(rc_json_state_t* state, void* data) { - *(uint16_t*)data = rc_json_get_uint64(state, UINT16_MAX); -} - -static void rc_json_parse_uint32(rc_json_state_t* state, void* data) { - *(uint32_t*)data = rc_json_get_uint64(state, UINT32_MAX); -} - -static void rc_json_parse_uint64(rc_json_state_t* state, void* data) { - *(uint64_t*)data = rc_json_get_uint64(state, UINT64_MAX); -} - -static void rc_json_parse_float(rc_json_state_t* state, void* data) { - *(float*)data = rc_json_get_double(state, FLT_MIN, FLT_MAX); -} - -static void rc_json_parse_double(rc_json_state_t* state, void* data) { - *(double*)data = rc_json_get_double(state, DBL_MIN, DBL_MAX); -} - -static void rc_json_parse_boolean(rc_json_state_t* state, void* data) { - const uint8_t* json = state->json; - - if (json[0] == 't' && json[1] == 'r' && json[2] == 'u' && json[3] == 'e' && !isalpha(json[4])) { - *(char*)data = 1; - state->json += 4; - } - else if (json[0] == 'f' && json[1] == 'a' && json[2] == 'l' && json[3] == 's' && json[4] == 'e' && !isalpha(json[5])) { - *(char*)data = 0; - state->json += 5; - } - else { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } -} - -static void rc_json_parse_string(rc_json_state_t* state, void* data) { - const uint8_t* aux = state->json; - size_t length = rc_json_skip_string(state); - uint8_t* str = (uint8_t*)rc_json_alloc(state, length + 1, RC_JSON_ALIGNOF(char)); - - if (state->counting) { - return; - } - - if (*aux++ != '"') { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - *(char**)data = (char*)str; - - if (*aux !='"') { - do { - if (*aux == '\\') { - char digits[5]; - uint32_t utf32; - - aux++; - - switch (*aux++) { - case '"': *str++ = '"'; break; - case '\\': *str++ = '\\'; break; - case '/': *str++ = '/'; break; - case 'b': *str++ = '\b'; break; - case 'f': *str++ = '\f'; break; - case 'n': *str++ = '\n'; break; - case 'r': *str++ = '\r'; break; - case 't': *str++ = '\t'; break; - - case 'u': - digits[0] = aux[0]; - digits[1] = aux[1]; - digits[2] = aux[2]; - digits[3] = aux[3]; - digits[4] = 0; - aux += 4; - - utf32 = strtoul(digits, NULL, 16); - - if (utf32 < 0x80) { - *str++ = utf32; - } - else if (utf32 < 0x800) { - str[0] = 0xc0 | (utf32 >> 6); - str[1] = 0x80 | (utf32 & 0x3f); - str += 2; - } - else if (utf32 < 0x10000) { - str[0] = 0xe0 | (utf32 >> 12); - str[1] = 0x80 | ((utf32 >> 6) & 0x3f); - str[2] = 0x80 | (utf32 & 0x3f); - str += 3; - } - else { - str[0] = 0xf0 | (utf32 >> 18); - str[1] = 0x80 | ((utf32 >> 12) & 0x3f); - str[2] = 0x80 | ((utf32 >> 6) & 0x3f); - str[3] = 0x80 | (utf32 & 0x3f); - str += 4; - } - - break; - - default: - longjmp(state->rollback, RC_JSON_INVALID_ESCAPE); - } - } - else { - *str++ = *aux++; - } - } - while (*aux != '"'); - } - - *str = 0; -} - -typedef void (*rc_json_parser_t)(rc_json_state_t*, void*); - -static const rc_json_parser_t rc_json_parsers[] = { - rc_json_parse_char, rc_json_parse_uchar, rc_json_parse_short, rc_json_parse_ushort, - rc_json_parse_int, rc_json_parse_uint, rc_json_parse_long, rc_json_parse_ulong, - rc_json_parse_longlong, rc_json_parse_ulonglong, - rc_json_parse_int8, rc_json_parse_int16, rc_json_parse_int32, rc_json_parse_int64, - rc_json_parse_uint8, rc_json_parse_uint16, rc_json_parse_uint32, rc_json_parse_uint64, - rc_json_parse_float, rc_json_parse_double, rc_json_parse_boolean, rc_json_parse_string -}; - -static void rc_json_parse_value(rc_json_state_t*, void*, const rc_json_field_meta_t*); -static void rc_json_parse_object(rc_json_state_t*, void*, const rc_json_struct_meta_t*); - -static void rc_json_parse_array(rc_json_state_t* state, void* value, size_t element_size, size_t element_alignment, const rc_json_field_meta_t* field) { - if (*state->json != '[') { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - const uint8_t* save = state->json; - size_t count = rc_json_skip_array(state); - state->json = save + 1; - - uint8_t* elements = (uint8_t*)rc_json_alloc(state, element_size * count, element_alignment); - - if (!state->counting) { - struct { - void* elements; - int count; - } - *array = value; - - array->elements = elements; - array->count = count; - } - - rc_json_skip_spaces(state); - - rc_json_field_meta_t field_scalar = *field; - field_scalar.flags &= ~RC_JSON_FLAG_ARRAY; - - while (*state->json != ']') { - rc_json_parse_value(state, (void*)elements, &field_scalar); - rc_json_skip_spaces(state); - - elements += element_size; - - if (*state->json != ',') { - break; - } - - state->json++; - rc_json_skip_spaces(state); - } - - if (*state->json != ']') { - longjmp(state->rollback, RC_JSON_UNTERMINATED_ARRAY); - } - - state->json++; -} - -const rc_json_struct_meta_t* rc_json_resolve_struct(uint32_t hash); - -static void rc_json_parse_value(rc_json_state_t* state, void* value, const rc_json_field_meta_t* field) { -#define RC_JSON_TYPE_INFO(t) sizeof(t), RC_JSON_ALIGNOF(t) - - static const size_t rc_json_type_info[] = { - RC_JSON_TYPE_INFO(char), RC_JSON_TYPE_INFO(unsigned char), RC_JSON_TYPE_INFO(short), RC_JSON_TYPE_INFO(unsigned short), - RC_JSON_TYPE_INFO(int), RC_JSON_TYPE_INFO(unsigned int), RC_JSON_TYPE_INFO(long), RC_JSON_TYPE_INFO(unsigned long), - RC_JSON_TYPE_INFO(long long), RC_JSON_TYPE_INFO(unsigned long long), - RC_JSON_TYPE_INFO(int8_t), RC_JSON_TYPE_INFO(int16_t), RC_JSON_TYPE_INFO(int32_t), RC_JSON_TYPE_INFO(int64_t), - RC_JSON_TYPE_INFO(uint8_t), RC_JSON_TYPE_INFO(uint16_t), RC_JSON_TYPE_INFO(uint32_t), RC_JSON_TYPE_INFO(uint64_t), - RC_JSON_TYPE_INFO(float), RC_JSON_TYPE_INFO(double), RC_JSON_TYPE_INFO(char), RC_JSON_TYPE_INFO(const char*) - }; - - const rc_json_struct_meta_t* meta = NULL; - - if ((field->flags & (RC_JSON_FLAG_ARRAY | RC_JSON_FLAG_POINTER)) == 0) { - if (field->type != RC_JSON_TYPE_RECORD) { - char dummy[64]; - - if (state->counting) { - value = (void*)dummy; - } - - rc_json_parsers[field->type](state, value); - } - else { - meta = rc_json_resolve_struct(field->type_hash); - - if (meta == NULL) { - longjmp(state->rollback, RC_JSON_UNKOWN_RECORD); - } - - rc_json_parse_object(state, value, meta); - } - - return; - } - - size_t size, alignment; - - if (field->type != RC_JSON_TYPE_RECORD) { - unsigned ndx = field->type * 2; - size = rc_json_type_info[ndx]; - alignment = rc_json_type_info[ndx + 1]; - } - else { /* field->type == RC_JSON_TYPE_RECORD */ - meta = rc_json_resolve_struct(field->type_hash); - - if (meta == NULL) { - longjmp(state->rollback, RC_JSON_UNKOWN_RECORD); - } - - size = meta->size; - alignment = meta->alignment; - } - - if ((field->flags & RC_JSON_FLAG_ARRAY) != 0) { - rc_json_parse_array(state, value, size, alignment, field); - return; - } - - const uint8_t* json = state->json; - - if (json[0] == 'n' && json[1] == 'u' && json[2] == 'l' && json[3] == 'l' && !isalpha(json[4])) { - if (!state->counting) { - *(void**)value = NULL; - } - - state->json += 4; - return; - } - - void* pointer = rc_json_alloc(state, size, alignment); - - if (!state->counting) { - *(void**)value = pointer; - } - - value = pointer; - - if (field->type != RC_JSON_TYPE_RECORD) { - rc_json_parsers[field->type](state, value); - } - else { - rc_json_parse_object(state, value, meta); - } -} - -static void rc_json_parse_object(rc_json_state_t* state, void* record, const rc_json_struct_meta_t* meta) { - if (*state->json != '{') { - longjmp(state->rollback, RC_JSON_INVALID_VALUE); - } - - if (!state->counting) { - memset((void*)record, 0, meta->size); - } - - state->json++; - rc_json_skip_spaces(state); - - while (*state->json != '}') { - if (*state->json != '"') { - longjmp(state->rollback, RC_JSON_MISSING_KEY); - } - - const char* key = (const char*)++state->json; - const char* quote = key; - - for (;;) { - quote = strchr(quote, '"'); - - if (!quote) { - longjmp(state->rollback, RC_JSON_UNTERMINATED_KEY); - } - - if (quote[-1] != '\\') { - break; - } - } - - state->json = (const uint8_t*)quote + 1; - uint32_t hash = rc_json_hash((const uint8_t*)key, quote - key); - - unsigned i; - const rc_json_field_meta_t* field; - - for (i = 0, field = meta->fields; i < meta->num_fields; i++, field++) { - if (field->name_hash == hash) { - break; - } - } - - rc_json_skip_spaces(state); - - if (*state->json != ':') { - longjmp(state->rollback, RC_JSON_MISSING_VALUE); - } - - state->json++; - rc_json_skip_spaces(state); - - if (i != meta->num_fields) { - rc_json_parse_value(state, (void*)((uint8_t*)record + field->offset), field); - } - else { - rc_json_skip_value(state); - } - - rc_json_skip_spaces(state); - - if (*state->json != ',') { - break; - } - - state->json++; - rc_json_skip_spaces(state); - } - - if (*state->json != '}') { - longjmp(state->rollback, RC_JSON_UNTERMINATED_OBJECT); - } - - state->json++; -} - -static int rc_json_execute(void* buffer, uint32_t hash, const uint8_t* json, int counting) { - const rc_json_struct_meta_t* meta = rc_json_resolve_struct(hash); - - if (!meta) { - return RC_JSON_UNKOWN_RECORD; - } - - rc_json_state_t state; - int res; - - if ((res = setjmp(state.rollback)) != 0) { - return res; - } - - state.json = json; - state.buffer = counting ? 0 : (uintptr_t)*(void**)buffer; - state.counting = counting; - - if (!counting) { - *(void**)buffer = rc_json_alloc(&state, meta->size, meta->alignment); - } - - rc_json_skip_spaces(&state); - rc_json_parse_object(&state, *(void**)buffer, meta); - rc_json_skip_spaces(&state); - - if (counting) { - *(size_t*)buffer = state.buffer; - } - - return *state.json == 0 ? RC_JSON_OK : RC_JSON_EOF_EXPECTED; -} - -void* rc_json_deserialize(void* buffer, uint32_t hash, const uint8_t* json) { - void** record = &buffer; - int res = rc_json_execute(record, hash, json, 0); - return res == RC_JSON_OK ? *record : NULL; -} - -int rc_json_get_size(size_t* size, uint32_t hash, const uint8_t* json) { - return rc_json_execute((void*)size, hash, json, 1); -} - -uint32_t rc_json_hash(const uint8_t* str, size_t length) { - typedef char unsigned_must_have_32_bits_minimum[sizeof(unsigned) >= 4 ? 1 : -1]; - - uint32_t hash = 5381; - - if (length != 0) { - do { - hash = hash * 33 + *str++; - } - while (--length != 0); - } - - return hash & 0xffffffffU; -} diff --git a/deps/rcheevos/src/rjson/dejson.h b/deps/rcheevos/src/rjson/dejson.h deleted file mode 100644 index 406c29eac1..0000000000 --- a/deps/rcheevos/src/rjson/dejson.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef DEJSON_H -#define DEJSON_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define RC_JSON_OFFSETOF(s, f) ((size_t)(&((s*)0)->f)) -#define RC_JSON_ALIGNOF(t) RC_JSON_OFFSETOF(struct{char c; t d;}, d) - -enum { - RC_JSON_TYPE_CHAR, - RC_JSON_TYPE_UCHAR, - RC_JSON_TYPE_SHORT, - RC_JSON_TYPE_USHORT, - RC_JSON_TYPE_INT, - RC_JSON_TYPE_UINT, - RC_JSON_TYPE_LONG, - RC_JSON_TYPE_LONGLONG, - RC_JSON_TYPE_ULONG, - RC_JSON_TYPE_ULONGLONG, - RC_JSON_TYPE_INT8, - RC_JSON_TYPE_INT16, - RC_JSON_TYPE_INT32, - RC_JSON_TYPE_INT64, - RC_JSON_TYPE_UINT8, - RC_JSON_TYPE_UINT16, - RC_JSON_TYPE_UINT32, - RC_JSON_TYPE_UINT64, - RC_JSON_TYPE_FLOAT, - RC_JSON_TYPE_DOUBLE, - RC_JSON_TYPE_BOOL, - RC_JSON_TYPE_STRING, - RC_JSON_TYPE_RECORD -}; - -enum { - RC_JSON_FLAG_ARRAY = 1 << 0, - RC_JSON_FLAG_POINTER = 1 << 1 -}; - -typedef struct { - uint32_t name_hash; - uint32_t type_hash; - uint16_t offset; - uint8_t type; - uint8_t flags; -} -rc_json_field_meta_t; - -typedef struct { - const rc_json_field_meta_t* fields; - uint32_t name_hash; - uint32_t size; - uint16_t alignment; - uint16_t num_fields; -} -rc_json_struct_meta_t; - -void* rc_json_deserialize(void* buffer, uint32_t hash, const uint8_t* json); -int rc_json_get_size(size_t* size, uint32_t hash, const uint8_t* json); -uint32_t rc_json_hash(const uint8_t* str, size_t length); - -#ifdef __cplusplus -} -#endif - -#endif /* DEJSON_H */ diff --git a/deps/rcheevos/src/rjson/schema.c b/deps/rcheevos/src/rjson/schema.c deleted file mode 100644 index afd2d64f65..0000000000 --- a/deps/rcheevos/src/rjson/schema.c +++ /dev/null @@ -1,609 +0,0 @@ -#include "rjson.h" -#include "dejson.h" - -static const rc_json_field_meta_t rc_json_field_meta_gameid[] = { - { - /* Metadata for field unsigned int gameid;. */ - /* name_hash */ 0xb4960eecU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_gameid_t, gameid), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field char success;. */ - /* name_hash */ 0x110461deU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_gameid_t, success), - /* type */ RC_JSON_TYPE_BOOL, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_gameid = { - /* fields */ rc_json_field_meta_gameid, - /* name_hash */ 0xb4960eecU, - /* size */ sizeof(rc_json_gameid_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_gameid_t), - /* num_fields */ 2 -}; - -int rc_json_get_gameid_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0xb4960eecU, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_gameid_t* rc_json_parse_gameid(void* buffer, const char* json) { - return (const rc_json_gameid_t*)rc_json_deserialize(buffer, 0xb4960eecU, (const uint8_t*)json); -} - -static const rc_json_field_meta_t rc_json_field_meta_login[] = { - { - /* Metadata for field const char* token;. */ - /* name_hash */ 0x0e2dbd26U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, token), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* user;. */ - /* name_hash */ 0x7c8da264U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, user), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int score;. */ - /* name_hash */ 0x0e1522c1U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, score), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int messages;. */ - /* name_hash */ 0xfed3807dU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, messages), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field char success;. */ - /* name_hash */ 0x110461deU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_login_t, success), - /* type */ RC_JSON_TYPE_BOOL, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_login = { - /* fields */ rc_json_field_meta_login, - /* name_hash */ 0x0d9ce89eU, - /* size */ sizeof(rc_json_login_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_login_t), - /* num_fields */ 5 -}; - -int rc_json_get_login_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0x0d9ce89eU, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_login_t* rc_json_parse_login(void* buffer, const char* json) { - return (const rc_json_login_t*)rc_json_deserialize(buffer, 0x0d9ce89eU, (const uint8_t*)json); -} - -static const rc_json_field_meta_t rc_json_field_meta_cheevo[] = { - { - /* Metadata for field unsigned long long created;. */ - /* name_hash */ 0x3a84721dU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, created), - /* type */ RC_JSON_TYPE_ULONGLONG, - /* flags */ 0 - }, - { - /* Metadata for field unsigned long long modified;. */ - /* name_hash */ 0xdcea4fe6U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, modified), - /* type */ RC_JSON_TYPE_ULONGLONG, - /* flags */ 0 - }, - { - /* Metadata for field const char* author;. */ - /* name_hash */ 0xa804edb8U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, author), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* badge;. */ - /* name_hash */ 0x887685d9U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, badge), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* description;. */ - /* name_hash */ 0xe61a1f69U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, description), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* memaddr;. */ - /* name_hash */ 0x1e76b53fU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, memaddr), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* title;. */ - /* name_hash */ 0x0e2a9a07U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, title), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int flags;. */ - /* name_hash */ 0x0d2e96b2U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, flags), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int points;. */ - /* name_hash */ 0xca8fce22U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, points), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int id;. */ - /* name_hash */ 0x005973f2U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_cheevo_t, id), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_cheevo = { - /* fields */ rc_json_field_meta_cheevo, - /* name_hash */ 0x0af404aeU, - /* size */ sizeof(rc_json_cheevo_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_cheevo_t), - /* num_fields */ 10 -}; - -int rc_json_get_cheevo_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0x0af404aeU, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_cheevo_t* rc_json_parse_cheevo(void* buffer, const char* json) { - return (const rc_json_cheevo_t*)rc_json_deserialize(buffer, 0x0af404aeU, (const uint8_t*)json); -} - -static const rc_json_field_meta_t rc_json_field_meta_lboard[] = { - { - /* Metadata for field const char* description;. */ - /* name_hash */ 0xe61a1f69U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, description), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* title;. */ - /* name_hash */ 0x0e2a9a07U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, title), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* format;. */ - /* name_hash */ 0xb341208eU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, format), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* mem;. */ - /* name_hash */ 0x0b8807e4U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, mem), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int id;. */ - /* name_hash */ 0x005973f2U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_lboard_t, id), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_lboard = { - /* fields */ rc_json_field_meta_lboard, - /* name_hash */ 0xf7cacd7aU, - /* size */ sizeof(rc_json_lboard_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_lboard_t), - /* num_fields */ 5 -}; - -int rc_json_get_lboard_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0xf7cacd7aU, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_lboard_t* rc_json_parse_lboard(void* buffer, const char* json) { - return (const rc_json_lboard_t*)rc_json_deserialize(buffer, 0xf7cacd7aU, (const uint8_t*)json); -} - -static const rc_json_field_meta_t rc_json_field_meta_patchdata[] = { - { - /* Metadata for field const rc_json_lboard_t* lboards; int lboards_count;. */ - /* name_hash */ 0xf1247d2dU, - /* type_hash */ 0xf7cacd7aU, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, lboards), - /* type */ RC_JSON_TYPE_RECORD, - /* flags */ RC_JSON_FLAG_ARRAY - }, - { - /* Metadata for field const char* genre;. */ - /* name_hash */ 0x0d3d1136U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, genre), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* developer;. */ - /* name_hash */ 0x87f5b28bU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, developer), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* publisher;. */ - /* name_hash */ 0xce7b6ff3U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, publisher), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* released;. */ - /* name_hash */ 0x8acb686aU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, released), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char** presence;. */ - /* name_hash */ 0xf18dd230U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, presence), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ RC_JSON_FLAG_POINTER - }, - { - /* Metadata for field const char* console;. */ - /* name_hash */ 0x260aebd9U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, console), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const rc_json_cheevo_t* cheevos; int cheevos_count;. */ - /* name_hash */ 0x69749ae1U, - /* type_hash */ 0x0af404aeU, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, cheevos), - /* type */ RC_JSON_TYPE_RECORD, - /* flags */ RC_JSON_FLAG_ARRAY - }, - { - /* Metadata for field const char* image_boxart;. */ - /* name_hash */ 0xddc6bd18U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_boxart), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* image_title;. */ - /* name_hash */ 0x65121b6aU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_title), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* image_icon;. */ - /* name_hash */ 0xe4022c11U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_icon), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* title;. */ - /* name_hash */ 0x0e2a9a07U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, title), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field const char* image_ingame;. */ - /* name_hash */ 0xedfff5f9U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, image_ingame), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int consoleid;. */ - /* name_hash */ 0x071656e5U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, consoleid), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int id;. */ - /* name_hash */ 0x005973f2U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, id), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int flags;. */ - /* name_hash */ 0x0d2e96b2U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, flags), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field unsigned int topicid;. */ - /* name_hash */ 0x7d2b565aU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, topicid), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field char is_final;. */ - /* name_hash */ 0x088a58abU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patchdata_t, is_final), - /* type */ RC_JSON_TYPE_BOOL, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_patchdata = { - /* fields */ rc_json_field_meta_patchdata, - /* name_hash */ 0xadc4ac0fU, - /* size */ sizeof(rc_json_patchdata_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_patchdata_t), - /* num_fields */ 18 -}; - -int rc_json_get_patchdata_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0xadc4ac0fU, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_patchdata_t* rc_json_parse_patchdata(void* buffer, const char* json) { - return (const rc_json_patchdata_t*)rc_json_deserialize(buffer, 0xadc4ac0fU, (const uint8_t*)json); -} - -static const rc_json_field_meta_t rc_json_field_meta_patch[] = { - { - /* Metadata for field rc_json_patchdata_t patchdata;. */ - /* name_hash */ 0xadc4ac0fU, - /* type_hash */ 0xadc4ac0fU, - /* offset */ RC_JSON_OFFSETOF(rc_json_patch_t, patchdata), - /* type */ RC_JSON_TYPE_RECORD, - /* flags */ 0 - }, - { - /* Metadata for field char success;. */ - /* name_hash */ 0x110461deU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_patch_t, success), - /* type */ RC_JSON_TYPE_BOOL, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_patch = { - /* fields */ rc_json_field_meta_patch, - /* name_hash */ 0x0dddd3d5U, - /* size */ sizeof(rc_json_patch_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_patch_t), - /* num_fields */ 2 -}; - -int rc_json_get_patch_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0x0dddd3d5U, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_patch_t* rc_json_parse_patch(void* buffer, const char* json) { - return (const rc_json_patch_t*)rc_json_deserialize(buffer, 0x0dddd3d5U, (const uint8_t*)json); -} - -static const rc_json_field_meta_t rc_json_field_meta_unlocks[] = { - { - /* Metadata for field const unsigned int* ids; int ids_count;. */ - /* name_hash */ 0xc5e91303U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, ids), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ RC_JSON_FLAG_ARRAY - }, - { - /* Metadata for field unsigned int gameid;. */ - /* name_hash */ 0xb4960eecU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, gameid), - /* type */ RC_JSON_TYPE_UINT, - /* flags */ 0 - }, - { - /* Metadata for field char success;. */ - /* name_hash */ 0x110461deU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, success), - /* type */ RC_JSON_TYPE_BOOL, - /* flags */ 0 - }, - { - /* Metadata for field char hardcore;. */ - /* name_hash */ 0xc1b80672U, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_unlocks_t, hardcore), - /* type */ RC_JSON_TYPE_BOOL, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_unlocks = { - /* fields */ rc_json_field_meta_unlocks, - /* name_hash */ 0x9b4e2684U, - /* size */ sizeof(rc_json_unlocks_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_unlocks_t), - /* num_fields */ 4 -}; - -int rc_json_get_unlocks_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0x9b4e2684U, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_unlocks_t* rc_json_parse_unlocks(void* buffer, const char* json) { - return (const rc_json_unlocks_t*)rc_json_deserialize(buffer, 0x9b4e2684U, (const uint8_t*)json); -} - -static const rc_json_field_meta_t rc_json_field_meta_error[] = { - { - /* Metadata for field const char* error;. */ - /* name_hash */ 0x0d2011cfU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_error_t, error), - /* type */ RC_JSON_TYPE_STRING, - /* flags */ 0 - }, - { - /* Metadata for field char success;. */ - /* name_hash */ 0x110461deU, - /* type_hash */ 0x00000000U, - /* offset */ RC_JSON_OFFSETOF(rc_json_error_t, success), - /* type */ RC_JSON_TYPE_BOOL, - /* flags */ 0 - }, -}; - -static const rc_json_struct_meta_t rc_json_struct_meta_error = { - /* fields */ rc_json_field_meta_error, - /* name_hash */ 0x0d2011cfU, - /* size */ sizeof(rc_json_error_t), - /* alignment */ RC_JSON_ALIGNOF(rc_json_error_t), - /* num_fields */ 2 -}; - -int rc_json_get_error_size(const char* json) { - size_t size; - int res = rc_json_get_size(&size, 0x0d2011cfU, (const uint8_t*)json); - - if (res == RC_JSON_OK) { - res = (int)size; - } - - return res; -} - -const rc_json_error_t* rc_json_parse_error(void* buffer, const char* json) { - return (const rc_json_error_t*)rc_json_deserialize(buffer, 0x0d2011cfU, (const uint8_t*)json); -} - -const rc_json_struct_meta_t* rc_json_resolve_struct(unsigned hash) { - - switch (hash) { - case 0xb4960eecU: return &rc_json_struct_meta_gameid; - case 0x0d9ce89eU: return &rc_json_struct_meta_login; - case 0x0af404aeU: return &rc_json_struct_meta_cheevo; - case 0xf7cacd7aU: return &rc_json_struct_meta_lboard; - case 0xadc4ac0fU: return &rc_json_struct_meta_patchdata; - case 0x0dddd3d5U: return &rc_json_struct_meta_patch; - case 0x9b4e2684U: return &rc_json_struct_meta_unlocks; - case 0x0d2011cfU: return &rc_json_struct_meta_error; - default: return NULL; - } -} diff --git a/deps/rcheevos/src/rjson/schema.dej b/deps/rcheevos/src/rjson/schema.dej deleted file mode 100644 index f11e6a55f8..0000000000 --- a/deps/rcheevos/src/rjson/schema.dej +++ /dev/null @@ -1,82 +0,0 @@ -//---------------------------------------------------------------------------- - -struct gameid/GameID { - bool success/Success; - unsigned gameid/GameID; -}; - -//---------------------------------------------------------------------------- - -struct login/Login { - bool success/Success; - string user/User; - string token/Token; - unsigned score/Score; - unsigned messages/Messages; -}; - -//---------------------------------------------------------------------------- - -struct cheevo/Achievement { - unsigned id/ID; - string memaddr/MemAddr; - string title/Title; - string description/Description; - unsigned points/Points; - string author/Author; - string badge/BadgeName; - unsigned flags/Flags; - - unsigned long long modified/Modified; - unsigned long long created/Created; -}; - -struct lboard/Leaderboard { - unsigned id/ID; - string mem/Mem; - string format/Format; - string title/Title; - string description/Description; -}; - -struct patchdata/PatchData { - unsigned id/ID; - string title/Title; - unsigned consoleid/ConsoleID; - unsigned topicid/ForumTopicID; - unsigned flags/Flags; - string image_icon/ImageIcon; - string image_title/ImageTitle; - string image_ingame/ImageIngame; - string image_boxart/ImageBoxArt; - string publisher/Publisher; - string developer/Developer; - string genre/Genre; - string released/Released; - bool is_final/IsFinal; - string console/ConsoleName; - string* presence/RichPresencePatch; - cheevo cheevos/Achievements[]; - lboard lboards/Leaderboards[]; -}; - -struct patch/Patch { - bool success/Success; - patchdata patchdata/PatchData; -}; - -//---------------------------------------------------------------------------- - -struct unlocks/Unlocks { - bool success/Success; - unsigned ids/UserUnlocks[]; - unsigned gameid/GameID; - bool hardcore/HardcoreMode; -}; - -//---------------------------------------------------------------------------- - -struct error/Error { - bool success/Success; - string error/Error; -}; diff --git a/deps/rcheevos/test/Makefile b/deps/rcheevos/test/Makefile index 32562be5e4..d8dafce6ec 100644 --- a/deps/rcheevos/test/Makefile +++ b/deps/rcheevos/test/Makefile @@ -1,12 +1,10 @@ RC_SRC=../src/rcheevos -RC_JSON_SRC=../src/rjson RC_URL_SRC=../src/rurl LUA_SRC=lua/src OBJ=$(RC_SRC)/trigger.o $(RC_SRC)/condset.o $(RC_SRC)/condition.o $(RC_SRC)/operand.o \ $(RC_SRC)/term.o $(RC_SRC)/expression.o $(RC_SRC)/value.o $(RC_SRC)/lboard.o \ $(RC_SRC)/alloc.o $(RC_SRC)/format.o \ - $(RC_JSON_SRC)/dejson.o $(RC_JSON_SRC)/schema.o \ $(RC_URL_SRC)/url.o \ $(LUA_SRC)/lapi.o $(LUA_SRC)/lcode.o $(LUA_SRC)/lctype.o $(LUA_SRC)/ldebug.o \ $(LUA_SRC)/ldo.o $(LUA_SRC)/ldump.o $(LUA_SRC)/lfunc.o $(LUA_SRC)/lgc.o $(LUA_SRC)/llex.o \ diff --git a/deps/rcheevos/test/test.c b/deps/rcheevos/test/test.c index c155937e85..e9bc770d84 100644 --- a/deps/rcheevos/test/test.c +++ b/deps/rcheevos/test/test.c @@ -1,5 +1,4 @@ #include "internal.h" -#include "rjson.h" #include "rurl.h" #include "smw_snes.h" @@ -2091,84 +2090,6 @@ static void test_lua(void) { } } -static void test_json(void) { - { - /*------------------------------------------------------------------------ - TestJson - ------------------------------------------------------------------------*/ - - char json[65536]; - char buffer[65536]; - int res; - const rc_json_patch_t* patch; - - memcpy(json, smw_snes_json, smw_snes_json_len); - json[smw_snes_json_len] = 0; - - res = rc_json_get_patch_size(json); - assert(res >= 0); - patch = rc_json_parse_patch(buffer, json); - - assert(patch->success); - assert(patch->patchdata.id == 228); - assert(!strcmp(patch->patchdata.title, "Super Mario World")); - assert(patch->patchdata.consoleid == 3); - assert(patch->patchdata.topicid == 135); - assert(patch->patchdata.flags == 0); - assert(!strcmp(patch->patchdata.image_icon, "/Images/006972.png")); - assert(!strcmp(patch->patchdata.image_title, "/Images/000021.png")); - assert(!strcmp(patch->patchdata.image_ingame, "/Images/000022.png")); - assert(!strcmp(patch->patchdata.image_boxart, "/Images/000138.png")); - assert(!strcmp(patch->patchdata.publisher, "Nintendo")); - assert(!strcmp(patch->patchdata.developer, "Nintendo EAD")); - assert(!strcmp(patch->patchdata.genre, "Platforming")); - assert(!strcmp(patch->patchdata.released, "JP 1990 , NA 1991 Europe 1992")); - assert(patch->patchdata.is_final == 0); - assert(!strcmp(patch->patchdata.console, "SNES")); - assert(patch->patchdata.presence != NULL); - assert(!strcmp(*patch->patchdata.presence, "Lookup:LevelName\r\n0x0=Title Screen\r\n0x14=Yellow Switch Palace\r\n0x28=Yoshi's House\r\n0x29=Yoshi's Island 1\r\n0x2a=Yoshi's Island 2\r\n0x27=Yoshi's Island 3\r\n0x26=Yoshi's Island 4\r\n0x25=#1 Iggy's Castle\r\n0x15=Donut Plains 1\r\n0x9=Donut Plains 2\r\n0x8=Green Switch Palace\r\n0x4=Donut Ghost House\r\n0x3=Top Secret Area\r\n0x5=Donut Plains 3\r\n0x6=Donut Plains 4\r\n0x7=#2 Morton's Castle\r\n0xa=Donut Secret 1\r\n0x13=Donut Secret House\r\n0x2f=Donut Secret 2\r\n0x3e=Vanilla Dome 1\r\n0x3c=Vanilla Dome 2\r\n0x3f=Red Switch Palace\r\n0x2b=Vanilla Ghost House\r\n0x2e=Vanilla Dome 3\r\n0x3d=Vanilla Dome 4\r\n0x40=#3 Lemmy's Castle\r\n0x2d=Vanilla Secret 1\r\n0x1=Vanilla Secret 2\r\n0x2=Vanilla Secret 3\r\n0xb=Vanilla Fortress\r\n0xc=Butter Bridge 1\r\n0xd=Butter Bridge 2\r\n0xe=#4 Ludwig's Castle\r\n0xf=Cheese Bridge Area\r\n0x10=Cookie Mountain\r\n0x11=Soda Lake\r\n0x41=Forest Ghost House\r\n0x42=Forest of Illusion 1\r\n0x43=Forest of Illusion 4\r\n0x44=Forest of Illusion 2\r\n0x45=Blue Switch Palace\r\n0x46=Forest Secret Area\r\n0x47=Forest of Illusion 3\r\n0x1f=Forest Fortress\r\n0x20=#5 Roy's Castle\r\n0x21=Choco-Ghost House\r\n0x22=Chocolate Island 1\r\n0x23=Chocolate Island 3\r\n0x24=Chocolate Island 2\r\n0x1b=Chocolate Fortress\r\n0x1d=Chocolate Island 4\r\n0x1c=Chocolate Island 5\r\n0x1a=#6 Wendy's Castle\r\n0x18=Sunken Ghost Ship\r\n0x3b=Chocolate Secret\r\n0x3a=Valley of Bowser 1\r\n0x39=Valley of Bowser 2\r\n0x38=Valley Ghost House\r\n0x37=Valley of Bowser 3\r\n0x33=Valley of Bowser 4\r\n0x34=#7 Larry's Castle\r\n0x35=Valley Fortress\r\n0x31=Front Door\r\n0x32=Back Door\r\n0x58=Star World 1\r\n0x54=Star World 2\r\n0x56=Star World 3\r\n0x59=Star World 4\r\n0x5a=Star World 5\r\n0x4e=Gnarly\r\n0x4f=Tubular\r\n0x50=Way Cool\r\n0x51=Awesome\r\n0x4c=Groovy\r\n0x4b=Mondo\r\n0x4a=Outrageous\r\n0x49=Funky\r\n\r\nFormat:Lives\r\nFormatType=VALUE\r\n\r\nDisplay:\r\n@LevelName(0xh0013bf), @Lives(0xh0dbe_v+1) lives")); - assert(patch->patchdata.cheevos_count == 53); - assert(patch->patchdata.lboards_count == 0); - - assert(patch->patchdata.cheevos[0].id == 4874); - assert(!strcmp(patch->patchdata.cheevos[0].memaddr, "0xH000019=2")); - assert(!strcmp(patch->patchdata.cheevos[0].title, "I Believe I Can Fly")); - assert(!strcmp(patch->patchdata.cheevos[0].description, "Collect a feather")); - assert(patch->patchdata.cheevos[0].points == 2); - assert(!strcmp(patch->patchdata.cheevos[0].author, "UNHchabo")); - assert(patch->patchdata.cheevos[0].modified == 1452548368ULL); - assert(patch->patchdata.cheevos[0].created == 1391908064ULL); - assert(!strcmp(patch->patchdata.cheevos[0].badge, "05506")); - assert(patch->patchdata.cheevos[0].flags == 3); - - assert(patch->patchdata.cheevos[52].id == 29667); - assert(!strcmp(patch->patchdata.cheevos[52].memaddr, "0xR001ff5=1_0xH0013bf=58")); - assert(!strcmp(patch->patchdata.cheevos[52].title, "Under A Koopa Moon")); - assert(!strcmp(patch->patchdata.cheevos[52].description, "Collect the 3-Up Moon in the Valley of Bowser")); - assert(patch->patchdata.cheevos[52].points == 2); - assert(!strcmp(patch->patchdata.cheevos[52].author, "Dexterspet")); - assert(patch->patchdata.cheevos[52].modified == 1445783716ULL); - assert(patch->patchdata.cheevos[52].created == 1445754036ULL); - assert(!strcmp(patch->patchdata.cheevos[52].badge, "30351")); - assert(patch->patchdata.cheevos[52].flags == 3); - - memcpy(json, galaga_nes_json, galaga_nes_json_len); - json[galaga_nes_json_len] = 0; - - res = rc_json_get_patch_size(json); - assert(res >= 0); - patch = rc_json_parse_patch(buffer, json); - - assert(patch->patchdata.lboards_count == 1); - - assert(patch->patchdata.lboards[0].id == 310); - assert(!strcmp(patch->patchdata.lboards[0].mem, "STA:0xh0482=1::CAN:0xh0470=0_0xh0471=0::SUB:0xh0485=0_d0xh007a=0_0xh007a=1::VAL:0xh00e5*10_0xh00e4*100_0xh00e3*1000_0xh00e2*10000_0xh00e1*100000_0xh00e0*1000000")); - assert(!strcmp(patch->patchdata.lboards[0].format, "SCORE")); - assert(!strcmp(patch->patchdata.lboards[0].title, "Hi-Score")); - assert(!strcmp(patch->patchdata.lboards[0].description, "Get the highest score possible.")); - } -} - int main(void) { test_operand(); test_condition(); @@ -2177,7 +2098,6 @@ int main(void) { test_value(); test_lboard(); test_lua(); - test_json(); return 0; } From 84124fc70c3f3d967b1d26a0b20fdf4a5afff999 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Sun, 2 Sep 2018 14:34:47 +0100 Subject: [PATCH 0009/1292] Removed duplicated Lua files --- deps/rcheevos/test/lua/Makefile | 114 - deps/rcheevos/test/lua/README | 6 - deps/rcheevos/test/lua/doc/contents.html | 619 - deps/rcheevos/test/lua/doc/index.css | 21 - deps/rcheevos/test/lua/doc/logo.gif | Bin 9893 -> 0 bytes deps/rcheevos/test/lua/doc/lua.1 | 112 - deps/rcheevos/test/lua/doc/lua.css | 164 - deps/rcheevos/test/lua/doc/luac.1 | 118 - deps/rcheevos/test/lua/doc/manual.css | 21 - deps/rcheevos/test/lua/doc/manual.html | 10985 ---------------- .../test/lua/doc/osi-certified-72x60.png | Bin 3774 -> 0 bytes deps/rcheevos/test/lua/doc/readme.html | 365 - deps/rcheevos/test/lua/src/Makefile | 197 - deps/rcheevos/test/lua/src/lapi.c | 1298 -- deps/rcheevos/test/lua/src/lapi.h | 24 - deps/rcheevos/test/lua/src/lauxlib.c | 1043 -- deps/rcheevos/test/lua/src/lauxlib.h | 264 - deps/rcheevos/test/lua/src/lbaselib.c | 498 - deps/rcheevos/test/lua/src/lbitlib.c | 233 - deps/rcheevos/test/lua/src/lcode.c | 1203 -- deps/rcheevos/test/lua/src/lcode.h | 88 - deps/rcheevos/test/lua/src/lcorolib.c | 168 - deps/rcheevos/test/lua/src/lctype.c | 55 - deps/rcheevos/test/lua/src/lctype.h | 95 - deps/rcheevos/test/lua/src/ldblib.c | 456 - deps/rcheevos/test/lua/src/ldebug.c | 698 - deps/rcheevos/test/lua/src/ldebug.h | 39 - deps/rcheevos/test/lua/src/ldo.c | 802 -- deps/rcheevos/test/lua/src/ldo.h | 58 - deps/rcheevos/test/lua/src/ldump.c | 215 - deps/rcheevos/test/lua/src/lfunc.c | 151 - deps/rcheevos/test/lua/src/lfunc.h | 61 - deps/rcheevos/test/lua/src/lgc.c | 1178 -- deps/rcheevos/test/lua/src/lgc.h | 147 - deps/rcheevos/test/lua/src/linit.c | 68 - deps/rcheevos/test/lua/src/liolib.c | 771 -- deps/rcheevos/test/lua/src/llex.c | 565 - deps/rcheevos/test/lua/src/llex.h | 85 - deps/rcheevos/test/lua/src/llimits.h | 323 - deps/rcheevos/test/lua/src/lmathlib.c | 410 - deps/rcheevos/test/lua/src/lmem.c | 100 - deps/rcheevos/test/lua/src/lmem.h | 69 - deps/rcheevos/test/lua/src/loadlib.c | 790 -- deps/rcheevos/test/lua/src/lobject.c | 521 - deps/rcheevos/test/lua/src/lobject.h | 549 - deps/rcheevos/test/lua/src/lopcodes.c | 124 - deps/rcheevos/test/lua/src/lopcodes.h | 297 - deps/rcheevos/test/lua/src/loslib.c | 407 - deps/rcheevos/test/lua/src/lparser.c | 1650 --- deps/rcheevos/test/lua/src/lparser.h | 133 - deps/rcheevos/test/lua/src/lprefix.h | 45 - deps/rcheevos/test/lua/src/lstate.c | 347 - deps/rcheevos/test/lua/src/lstate.h | 235 - deps/rcheevos/test/lua/src/lstring.c | 248 - deps/rcheevos/test/lua/src/lstring.h | 49 - deps/rcheevos/test/lua/src/lstrlib.c | 1584 --- deps/rcheevos/test/lua/src/ltable.c | 669 - deps/rcheevos/test/lua/src/ltable.h | 66 - deps/rcheevos/test/lua/src/ltablib.c | 450 - deps/rcheevos/test/lua/src/ltm.c | 165 - deps/rcheevos/test/lua/src/ltm.h | 76 - deps/rcheevos/test/lua/src/lua.c | 612 - deps/rcheevos/test/lua/src/lua.h | 486 - deps/rcheevos/test/lua/src/lua.hpp | 9 - deps/rcheevos/test/lua/src/luac.c | 449 - deps/rcheevos/test/lua/src/luaconf.h | 783 -- deps/rcheevos/test/lua/src/lualib.h | 61 - deps/rcheevos/test/lua/src/lundump.c | 279 - deps/rcheevos/test/lua/src/lundump.h | 32 - deps/rcheevos/test/lua/src/lutf8lib.c | 256 - deps/rcheevos/test/lua/src/lvm.c | 1322 -- deps/rcheevos/test/lua/src/lvm.h | 113 - deps/rcheevos/test/lua/src/lzio.c | 68 - deps/rcheevos/test/lua/src/lzio.h | 66 - 74 files changed, 36828 deletions(-) delete mode 100644 deps/rcheevos/test/lua/Makefile delete mode 100644 deps/rcheevos/test/lua/README delete mode 100644 deps/rcheevos/test/lua/doc/contents.html delete mode 100644 deps/rcheevos/test/lua/doc/index.css delete mode 100644 deps/rcheevos/test/lua/doc/logo.gif delete mode 100644 deps/rcheevos/test/lua/doc/lua.1 delete mode 100644 deps/rcheevos/test/lua/doc/lua.css delete mode 100644 deps/rcheevos/test/lua/doc/luac.1 delete mode 100644 deps/rcheevos/test/lua/doc/manual.css delete mode 100644 deps/rcheevos/test/lua/doc/manual.html delete mode 100644 deps/rcheevos/test/lua/doc/osi-certified-72x60.png delete mode 100644 deps/rcheevos/test/lua/doc/readme.html delete mode 100644 deps/rcheevos/test/lua/src/Makefile delete mode 100644 deps/rcheevos/test/lua/src/lapi.c delete mode 100644 deps/rcheevos/test/lua/src/lapi.h delete mode 100644 deps/rcheevos/test/lua/src/lauxlib.c delete mode 100644 deps/rcheevos/test/lua/src/lauxlib.h delete mode 100644 deps/rcheevos/test/lua/src/lbaselib.c delete mode 100644 deps/rcheevos/test/lua/src/lbitlib.c delete mode 100644 deps/rcheevos/test/lua/src/lcode.c delete mode 100644 deps/rcheevos/test/lua/src/lcode.h delete mode 100644 deps/rcheevos/test/lua/src/lcorolib.c delete mode 100644 deps/rcheevos/test/lua/src/lctype.c delete mode 100644 deps/rcheevos/test/lua/src/lctype.h delete mode 100644 deps/rcheevos/test/lua/src/ldblib.c delete mode 100644 deps/rcheevos/test/lua/src/ldebug.c delete mode 100644 deps/rcheevos/test/lua/src/ldebug.h delete mode 100644 deps/rcheevos/test/lua/src/ldo.c delete mode 100644 deps/rcheevos/test/lua/src/ldo.h delete mode 100644 deps/rcheevos/test/lua/src/ldump.c delete mode 100644 deps/rcheevos/test/lua/src/lfunc.c delete mode 100644 deps/rcheevos/test/lua/src/lfunc.h delete mode 100644 deps/rcheevos/test/lua/src/lgc.c delete mode 100644 deps/rcheevos/test/lua/src/lgc.h delete mode 100644 deps/rcheevos/test/lua/src/linit.c delete mode 100644 deps/rcheevos/test/lua/src/liolib.c delete mode 100644 deps/rcheevos/test/lua/src/llex.c delete mode 100644 deps/rcheevos/test/lua/src/llex.h delete mode 100644 deps/rcheevos/test/lua/src/llimits.h delete mode 100644 deps/rcheevos/test/lua/src/lmathlib.c delete mode 100644 deps/rcheevos/test/lua/src/lmem.c delete mode 100644 deps/rcheevos/test/lua/src/lmem.h delete mode 100644 deps/rcheevos/test/lua/src/loadlib.c delete mode 100644 deps/rcheevos/test/lua/src/lobject.c delete mode 100644 deps/rcheevos/test/lua/src/lobject.h delete mode 100644 deps/rcheevos/test/lua/src/lopcodes.c delete mode 100644 deps/rcheevos/test/lua/src/lopcodes.h delete mode 100644 deps/rcheevos/test/lua/src/loslib.c delete mode 100644 deps/rcheevos/test/lua/src/lparser.c delete mode 100644 deps/rcheevos/test/lua/src/lparser.h delete mode 100644 deps/rcheevos/test/lua/src/lprefix.h delete mode 100644 deps/rcheevos/test/lua/src/lstate.c delete mode 100644 deps/rcheevos/test/lua/src/lstate.h delete mode 100644 deps/rcheevos/test/lua/src/lstring.c delete mode 100644 deps/rcheevos/test/lua/src/lstring.h delete mode 100644 deps/rcheevos/test/lua/src/lstrlib.c delete mode 100644 deps/rcheevos/test/lua/src/ltable.c delete mode 100644 deps/rcheevos/test/lua/src/ltable.h delete mode 100644 deps/rcheevos/test/lua/src/ltablib.c delete mode 100644 deps/rcheevos/test/lua/src/ltm.c delete mode 100644 deps/rcheevos/test/lua/src/ltm.h delete mode 100644 deps/rcheevos/test/lua/src/lua.c delete mode 100644 deps/rcheevos/test/lua/src/lua.h delete mode 100644 deps/rcheevos/test/lua/src/lua.hpp delete mode 100644 deps/rcheevos/test/lua/src/luac.c delete mode 100644 deps/rcheevos/test/lua/src/luaconf.h delete mode 100644 deps/rcheevos/test/lua/src/lualib.h delete mode 100644 deps/rcheevos/test/lua/src/lundump.c delete mode 100644 deps/rcheevos/test/lua/src/lundump.h delete mode 100644 deps/rcheevos/test/lua/src/lutf8lib.c delete mode 100644 deps/rcheevos/test/lua/src/lvm.c delete mode 100644 deps/rcheevos/test/lua/src/lvm.h delete mode 100644 deps/rcheevos/test/lua/src/lzio.c delete mode 100644 deps/rcheevos/test/lua/src/lzio.h diff --git a/deps/rcheevos/test/lua/Makefile b/deps/rcheevos/test/lua/Makefile deleted file mode 100644 index 119110d2f0..0000000000 --- a/deps/rcheevos/test/lua/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -# Makefile for installing Lua -# See doc/readme.html for installation and customization instructions. - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -# Where to install. The installation starts in the src and doc directories, -# so take care if INSTALL_TOP is not an absolute path. See the local target. -# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with -# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. -INSTALL_TOP= /usr/local -INSTALL_BIN= $(INSTALL_TOP)/bin -INSTALL_INC= $(INSTALL_TOP)/include -INSTALL_LIB= $(INSTALL_TOP)/lib -INSTALL_MAN= $(INSTALL_TOP)/man/man1 -INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V -INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V - -# How to install. If your install program does not support "-p", then -# you may have to run ranlib on the installed liblua.a. -INSTALL= install -p -INSTALL_EXEC= $(INSTALL) -m 0755 -INSTALL_DATA= $(INSTALL) -m 0644 -# -# If you don't have "install" you can use "cp" instead. -# INSTALL= cp -p -# INSTALL_EXEC= $(INSTALL) -# INSTALL_DATA= $(INSTALL) - -# Other utilities. -MKDIR= mkdir -p -RM= rm -f - -# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= - -# Convenience platforms targets. -PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - -# What to install. -TO_BIN= lua luac -TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp -TO_LIB= liblua.a -TO_MAN= lua.1 luac.1 - -# Lua version and release. -V= 5.3 -R= $V.4 - -# Targets start here. -all: $(PLAT) - -$(PLATS) clean: - cd src && $(MAKE) $@ - -test: dummy - src/lua -v - -install: dummy - cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) - cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) - cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) - cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) - -uninstall: - cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) - cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC) - cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB) - cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN) - -local: - $(MAKE) install INSTALL_TOP=../install - -none: - @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" - @echo " $(PLATS)" - @echo "See doc/readme.html for complete instructions." - -# make may get confused with test/ and install/ -dummy: - -# echo config parameters -echo: - @cd src && $(MAKE) -s echo - @echo "PLAT= $(PLAT)" - @echo "V= $V" - @echo "R= $R" - @echo "TO_BIN= $(TO_BIN)" - @echo "TO_INC= $(TO_INC)" - @echo "TO_LIB= $(TO_LIB)" - @echo "TO_MAN= $(TO_MAN)" - @echo "INSTALL_TOP= $(INSTALL_TOP)" - @echo "INSTALL_BIN= $(INSTALL_BIN)" - @echo "INSTALL_INC= $(INSTALL_INC)" - @echo "INSTALL_LIB= $(INSTALL_LIB)" - @echo "INSTALL_MAN= $(INSTALL_MAN)" - @echo "INSTALL_LMOD= $(INSTALL_LMOD)" - @echo "INSTALL_CMOD= $(INSTALL_CMOD)" - @echo "INSTALL_EXEC= $(INSTALL_EXEC)" - @echo "INSTALL_DATA= $(INSTALL_DATA)" - -# echo pkg-config data -pc: - @echo "version=$R" - @echo "prefix=$(INSTALL_TOP)" - @echo "libdir=$(INSTALL_LIB)" - @echo "includedir=$(INSTALL_INC)" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho - -# (end of Makefile) diff --git a/deps/rcheevos/test/lua/README b/deps/rcheevos/test/lua/README deleted file mode 100644 index 0b31908a06..0000000000 --- a/deps/rcheevos/test/lua/README +++ /dev/null @@ -1,6 +0,0 @@ - -This is Lua 5.3.4, released on 12 Jan 2017. - -For installation instructions, license details, and -further information about Lua, see doc/readme.html. - diff --git a/deps/rcheevos/test/lua/doc/contents.html b/deps/rcheevos/test/lua/doc/contents.html deleted file mode 100644 index 445556f964..0000000000 --- a/deps/rcheevos/test/lua/doc/contents.html +++ /dev/null @@ -1,619 +0,0 @@ - - - -Lua 5.3 Reference Manual - contents - - - - - - - -

-Lua -Lua 5.3 Reference Manual -

- -

-The reference manual is the official definition of the Lua language. -
-For a complete introduction to Lua programming, see the book -Programming in Lua. - -

- -

- -Copyright © 2015–2017 Lua.org, PUC-Rio. -Freely available under the terms of the -Lua license. - - -

Contents

- - -

Index

- - - - - - - - - - - - - - diff --git a/deps/rcheevos/test/lua/doc/index.css b/deps/rcheevos/test/lua/doc/index.css deleted file mode 100644 index c961835731..0000000000 --- a/deps/rcheevos/test/lua/doc/index.css +++ /dev/null @@ -1,21 +0,0 @@ -ul { - list-style-type: none ; -} - -ul.contents { - padding: 0 ; -} - -table { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; -} - -td { - vertical-align: top ; - padding: 0 ; - text-align: left ; - line-height: 1.25 ; - width: 15% ; -} diff --git a/deps/rcheevos/test/lua/doc/logo.gif b/deps/rcheevos/test/lua/doc/logo.gif deleted file mode 100644 index 5c77eacc3b8f397fb2e87d2aaecd89128e53a117..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9893 zcmZ`JAZZ!6FBhF{g-pRY z?mq`C!p1xV^4?ZTR7k~j;V9G1HDS87U+{!}P$o&rgc4zX0NDT~riS`~QEcMXc4?@W z^+STR)$~fm_`ABgqdI|BbFIpHF{r}hP+etgD8-NQs7W75NaJI?Ql(hqjVakK+HRty zUXfx9(Bq-+-?*K3uw9ID@9?*;-eo#?myt-t^)SGPba%#*OB5Fu=j7)HeEWuc=*-K) z!oqjj0S)u!&5gi;Bahobc>^^a9XUOHT z2|mFhODfM>_&5x-TrvTHjN4n=t}cJHz|Oj&#(Ac#A<;QYj?%w(I{6NHetKEy88L^C$rQ3l)#a6 zoT#z!d-$MNnQ|f0h4|+;?CDm7g1UnqCpv3AVbZ0g!y5D)ht6oJG9OD4(C|vg-ir+_ zH4QGgnPSh+=ffel34{g3QbJKkb?GxJXlu)W&M4!QB^7H4b450C&zK>m4Sy@4- z6QwcXU;C4g#1AgjGlY}HQLNi?RV^MlIy=8Y#lo5nG5DcI$LoBU)7F-?yK5#MO(ZKV z4S#la_H=)P#gQKG^HdgSn#J9BwwdVYIM>{c*8F@wEO$d}R+sxjn>$#7D0Sp=?`**6 zSgb455aPSEq?K#BY9czOB~w zbadnT{PaZ|6MyUb3JQ8>r#+FkD@XhNG?}o-!{}_4A*5_Nyi-4?sw$?YhV}1AdjC?B zgUxkSi}=^CG*t3gMjJh01>e6T@3$!ESeZ^i-|I!u zS;Y;*lPMP-5pj1|J68PThiJLljogBy_@_?@umOG-J7a9_muB|%_5%Y0xG`uvyho24 zIB%XLJt0uPbhhSAqhnKw*C!-wew~ll#zHvKqtx}hu;K?rot-)2DP`g3vIG)P#bW#V z#78r@yHnXrnbSui-|;3*m#OEgl|Ar3-?ZbLj*ECy&1Z-(e4BAv822YtIM?~_>A{XCM0gm<2F`yi=~k^Qpkaj;z9R!JMds*m*#io0jdc7= z_32qZaeQ{RyoLtu;NW0GM#|0W?QI53?3wlUfYmFzOS9J|wG7ON3R+r2E3FBfX*p?^~m1 z6V|U~sT|y#!d_|FC~juNn3R-(U?c)K1cYB-XL+RJsusn5sJ+RfCJjfoveJPB2E8VY ze>-6GiZ=08p%V7#QAzD2(fGeZ=h&GUh!qrTD!o3Hx0HW92SHt(m5Rzw1vQg>ESIRL zceqjS=8oh<74zz*;XjH7mM-Q|N>rkd^6&&UHrgsF*A*1*Ny>erU}PL7XDcg0?d{O* z1OHq$wC4kBW@%Z_)RY<-8R=VoJu1hW%$PbbR=GYYPsi<1pLKq2BJ*9&lH*Mr1@h?- zk$H2rr%((U;g63+%JFe|?|D5i*-R){z1;cs_IMilux#weYs=fwFeyZelpm6zO3TXT zYfVu=SRoN`fR)c~#H3%xLrrVG){XLs%W+C*j!X)3XXS=o9L4Y7Y4c4Nn3e6iqIP!B$P!~=+%bVCorwZbea_d%{9_@+x)gMD z!A=L1w$D$>lAk8s9b;tVXJZqwMyRqA-fVf9jLHaCqMT)d%(`(nU#mfn-S)W6#P; z=3~G1aSyeny@xz{sqe(QAtQ%m7HZiLcGoU!#=I^tB;>)$tUp@4#&}2onV7?oPE35i zlo$@3HMJv8Y>)4(2i;^?lJIo!@e!ZH+B3jmXa9^CL-NPx#NG&|6hO2b&vPRZ#5%&5>oeqS2brR1*C$NtWqMvwVDOx5Y@S#^ z&_6%4yRdnC(v!H)L}^Ka+LW}D-Cm1w)+quD5+xy*Ed+psxoShNndF8Bm$M#>koguj z6f7);EM(I_VR11rgmli6^)M>r$(5Du>ykxlf{`JnO5?K)MC~1O8|-vR+p3I8AN~*= zT@6_!CDC>&*w)uvnR50H4tI|iW17v5G!4tni~8OiB$0i{-skaNkDJ7=p?>-!QAtuK zGH&qwyZv(MezW5r9PF&?$r6pDH(b=RG{xXlS@d8_Q?g~x9Zwmx@oP1+_x>s#?yX&A zJ<$i~41SNKh86dSYQui}G5(udqd)BUytgYi|Dx4(X$bQst#fSOqxZjt63ThVELa(< z=wI@Opzy_vOv)kuWxt8eUN7D5>|Apl8>nubM5%c9f7!7;r$k%CGhCKXT2 z-k!qzYR%Czzyy-azx++9a_n;OQf4Lr3KX3NpT!_=3b$18MH`>vz-i^}tMTVUZ z>>6?`x}LOt@qT{D&)`uV`Y3Z+ZZooW)2=6EW~SdY0o?^b4jI6ZC)@y&ZP@Uz`5D7Z zl7dqFba9n&vrI2DRB5j@vG&K0)N-wxvoW8ny|(k~ASD{ZgPGTs%RJA)pGADun)w|a z9dCPO-ENNA_?|AQmW!TZVZ#avB>&ydPA~a9V`hh<#3X&+zS}w3vd~Kp=B*6_p}bcV zUE^_+>f5sHi>P1s`6V5{K_R*fd;9HOnbE7L83#ush~4-^y8hd8)pE5F z;(t~CR|ixR&)!V>9E-Q}W7qM?>PHTG9O>l`kbNR(){jzBZ*ds4KT^iK9nC2MFeUHP z9338RB2IKBlpAx=O+0EmU0UsJqgAF_Yqf}8Q@d%~4+9$z#-MfW^efyWWMSd6uGf_+ zqjn?n8k;pT-XZ&lpw~#O~n_8?Twhc9ed6YFyb#LI=KCJ zvxB&XLT&i`?-Sp}FiYifPlEId6de`PfSdd$>PIn)jd(&d4rO4 z)`gJ$(5q|9mZSEj+U-Jyj68(nd8|~`FqMr8&xOZFD(-ejPhfMcleKc;TX^`F^Q}P@ zH8mx*zim<8h~pUTMM@?2#=mgs!BWd|-=d!OJHi|z39ur+V?Et3D{3|8<={wSG3*04*38Uo_r^=G9s|a2cvz-V z?>h*Y_J3Cw*8EqJ+E0vUf*#IF9rqE@D5hP3xQMXi$A5?SFx~#$VJzA8YVz(7Q})(U6RbGxnUHX$I?6)oBrzO(9Gijguu~Q)mrI3TvYr5V zlecf*E;%n+iHt!C3&ov}`Pd8MvETwj-e6#3A9{!ob!->gJ&Dyi?9fPmit;{cNQQD} zRloJu`6cIqVp~w*ZEHNPfMO=t?uJUuz+PjK>|*NYH$DV0sZDM5xKUD4+E5i?XUAS~ z&ENey8k;>nVL)7Oe!#gxo%g+OLzzHbZ^Q#Hr?fQO-~Uyl_=%{Dwe=v}>VpS~e)Zfd zq6(`zp2q6M3EN{ptaCKVO!w*q^{zTx5U{s93}a&p(^r#9_g$4P^C zhOAD1#@AZmX9yCK(qOMLy4SZxI3t?z`q%(R0dXh+nA(Xct8Ixl9UWcRw{PM_lWt44 zii-UG-&9%8)deq&#<(253+VH6aJtz4m08Z|cR8Fh9?iD7Y$R^gm6wr0OlHzMRz(`> zc#of!mL@4Fxf?IyQ+0dVt(2A~UOH1LC^|9d2W<@XX~FiNC;9vL0sMRjA2{kA)_ivs zeWeS@SXj{VCnOyl*v3ad<_MUZ(*T3SXZzS^K0w(^57NRwPnw6=RAub}_Hv4CRcFz|73xTIY87ZN%Eu-R<#d?Y0Mk9Z}Bv zYr7mCuc_(%=s#ii#emwHHkH8m#t`<|2Vzt7Ll=jtqy z)$u#R!;`EfUY`u5UOo|I+42}XT)zUCA%0A-^7`I=ZfR-o#M>pI(&x#FQO~-wA&6X` z)yeVAwEKme93k?X@U%31d;)%TT8MV@)M27H{Ks-Nz!g>w@Q)m&r)ECy?&D|eyj2WD z5o~z@y`E18lT9aWgGMI%u|qa35ieo1_7QK4-^D*)V(2O9s-SjK2ozF~_xSI1JUn=b zy>CfBmtzObTZ)&fd8j^&zW*o2Cny~%la4)hePrQ&alp>0b+@msxA}OtZYdw5sBHN6 ztY2{B#7A&&qxUPlZbskj8B0%J@YVO!y3g-G)<+CB0VRNfvmr2^%A)G?(XzvKx_J8c@z3|&{Jf#Q6hf-12#XCn z7r*I(05aTlBn=FvRV={-z0+e8P%4{pPQ2F+ylIcnR!zi{>dI$k4-)qKT;6A1muF^S zK@RG@;X6RE3#zLPC5zl$yRohr!qFKRGMCf%c85Adviqy5tKWrm?BiqK zJlr6{$2}y}emwh4R~Zu<+v)!rAvhG56B@nNgK8~TG-+s&BVCBA0)MH6Qz1MY zE!g%GI++q<31}P~DeNho66M2rTY);Fw)_xu*nZscis(d#~c9jyj zlO_C&>f}=Bs;a6})6=1f$k$?UuQo zZj|=1ToL2BBQGZkFdJ#5n4sGI_w=9=6GwLu$gdFr zh@3YGgbkL}(_R~PjdJ9F=gAn_f;2xJN7|XcD)GfrMW1)WQ8+fEHZ(*N2vyEHta{ym zJ9?aozqKTFj7fv5GVqnYQ;U7M9$e-XJy*c9ovSeEAX* z_qjGGA8%scLJA^GI>}8 z0u=`bV!4{EnHef=;?l|Mk|G&AF^v?P#5t_BW^7QU-Bp)8{tk;~`REdzZuECUqksL% z({@#k_d|!*Zz7-EdY61|W+q6R@mAYKgEF4Y!6Z-K>LVxg*3OQyfuyN0BkoWHzR ze@`Hb)#sM}c1JEkE<$Ag03DiREQpYh&<73>=auitEdPKE5Zio;M8>8#N3>mg$0#?fpooPYP3zvz$nr7G*V7M zL14Z_bdBXaYg~N14k9WJj)Z~&Du{QYWN+27M0$-FY3mA?660V3@hEr#80d}w6uBc2 z&xqbW5PdYDPRl#h-K81fsXxHpZz5AyS!#Y)UzBun<3>V4@)GI(`I&(y^V|Nuxg|$> ze-xu$mXxC-bvJjTp)D$GT`3va6usUGXWYHK56@_&k5|l4vR1Rs&x#osT?6V=nbSGf zNgVWviClW^l>IX%D-Hsnz=(>8T~WS@?M&=}0=Gz!$qFHiCcqgvoX^J_MPyEqLP0_T zb4;*2p#vi+Gj-|xXMBA0c)93JEa7Bg!0Ez*S5~L7_vr6)zKF6xBOtNG78De$aK-4l zeXw5Q`YxaS?ekGnkbI$1mB|Q9bQHQsm_-1i4t)GUm|kp&@+NF2q~fM^;guaSW5drtx9X1l{5mNq(_-&+XiTn`hG7xNubGh-OWvXylx2D+uyhNHEuTL`TXFZQESqr z@1Eb*h7^$7wv@4yyalP)=k5 ztp@8qNET4Yfq*ppnVftWU#Mi{zggx?1(g1hR?AF7gL#a<0p2DqkruOp>mR#??h!I0 zR-@x!50K!O9L8=}OuaAjnD3C{Cg-mEz^5}70Z{c=dST~_(OVbQUEHQ(>p!wd^mKqDerqMHD0f3E%r6}(tKvECnk z>(}yvt*>g`NS`kR``z|Sx)B}Knx6mB7#X>$cNmgf9t?h|w!Pd{EG=yrimJ8SROySp zxuRb~X=L@Xny;x`ErtJobBCTDE_E2|(CyLn{pxKWFOZv&h2JqMsGF|GO01kDe+PLy zCZ(8^n>%hm63f2HmqH2?iyi3eCughAUJ3jj;WSJ(drz_eRlI$h2K7!_=*#0RE{Ao- z{*C5-|KIZRazbu<7{D8Zh5h?Y13)cK=N#LbkXY?s#|?c8LrbUScHD&FT@po=jF7=Q zJI5p{jk#{)GgMSu>}TW67Q*eI6dHvD9)d)Qv9+aheE8Q%){c!2T~2dz&_sUSJl^?GmyDOdBCvz1``m^V5AmdwV#F{P!Yxje4v0fRqp zR0c8$iZ^pI5Eo^>9~8zQBpiJV?j}{#S(bKkib!XHvlbwrhY>}irA;d-W^Q^~(ea4e zl0Mr=%l4D*`m}qM3wX^%3z*^8)%&}$Pbt3P> zOI`DB@Oua*(rNKvFMnQaQ+!Zge6uu-jy?DDE9}LNN5%DPX8foO0k5=z0*XJA%Lm9y ztbj*;>5IhMb>xX|4e|g(z<0lEnM5zuuOs!7$(B5nUNdeqKYH|f!C65=1I!#H6_sfR z=11rir@n9RK8cG5s}JUTpuT(eJ6@i#@aGiQ8q^L#V}Pi6={Kru?FEmZD@?f}3`I;l z;N&?eL*5j)-;QP$&9%6V!Icvenn?mi!1w&9^B-mEvpr8HKt003u*hp~LzSO_-gw)I z^7mfb?O_#4x-f(IQQz9d;Oi<$@=)a`&r@G0chPW81!^O{>$xM(O#*HriRwpQA=EX3 z)q(Zueoq!$w_u^GFC6J^H_I;EZhw9?J3(@DrR%MAF1?v>rYjb&#x|B z5wUP^;**nilr?XOC|@QARsjTzb= zPGt)L{w+KLLbZnHC*_LSkkb&sA8R{;dV%7T@fN$QuPe${#(dgB1s@H9#(J0-7`DM} zDJUqIO-BjG&iP#b#ERz|OqZ(89XU4yh4PD;6~_@jyE2xP#6BLHKCs}*EZwjFB`Yc6 z0b|q!M&DE5=u=!zZv>7aH731o3vN^&n@_hdwLfe?ON)8E<$S*%bh7($vo%BGkKhQL zqKmEgPhOFT`v?)e!oXPs(1~bKHy8;T@`2sy6zKR1nfzs$S`zr7AgVnd7He-uT};rh z*gcgFZigXx)L&RrLn9+EOZVsMY`H{Vbge06VuxE>%?2;e0%_=3A)8MB4?w@Z8_rB8 zWPUxSzs?4&-QpUHB5(^FJ`A7AS5mo6Q4Msp|kLZhOt3Y&C` zRp8q$3q{o`2t|wv(n@LB7#R4k-Uic=H^OCSRqXJtrjERL4#q>QE$|z-aHeBf+eZzn zebx;(4rkY}-rUeC>gvF8IvJmt>HD2Xm&$D5ze)ksDA%0K$X@GlgXerA&<#W>E<(ne zlk_pfilr|2pbP*qG}^t<4`$`b_;n7{O>q@5X=rIT0#F1DMDS_WA zWNXXpvh0++8j2!fi*)&6r%G^q{%gO!S#C~FFa{MZ4gHU9eX~BJ{SI>{5~-Ec>eoUu zndqE>Qz{H#Q$Y$hTi6TFm5sXO9vRXn4JRusEHtb8oR`lZ4c~Um3oDF*D)~KzLLEj< zM~46lYXldOAt9MlS=IP^Nl8Fbk{l1u(gSyJAaz)z3I-OI@Rz*c1WX1H^%PVVz|8~O zE^@R+ec87V^{X{*Z#Sdy04dRvD_;?gqaZ{^OCOonX{;6mwFubrnDFzm1Vz;0KkMq; z603#?5Z&5tl9I4TGkN>LmWx!d{JFWgiExTe-vE`N*l06rN#-yV{Z zmKLUr_Y!)v29ArE*lXIvaO0sQ7J!kX5AWK(%xOSp%2Bb-kMMdf%cP8$K%%Yg{&iI8 zLy9H`I|JUt4jRd1@?e$Ew3|<@L!{zB=>UmiV`Ib9W?UW@TQ$46xfxv3ZnX6Sw`T)& z4^$^fkmWiOrT+y}hvP=Q><17rFdzl&!Q-TLwkU?z=Zl6U#8$PM8sw&nF~Opm8uUcz z-aN4gpf)$ni(KFXa2}Cp8usb85tYDcFb-k3J!vSsEeNWgkcO046OYr z{Pf~Ng@%Tv^V4T5C@KmmDxv|ZYGi5}pO(g>pKv_VRTT@F1+IT{xw)>AlK+Gm1vfWP z`h6yCF!&dfr3;12j?%k&zf_MeEc`B3%zxZqV8_JG%74{BrW8l<;yDQkL3MU^ib_bt z$HaUzH>XWaO@%@${PAKDC@6e%a$={Uq4C1a*_lGBI1(#S$y1B5Vy~sbIHg zXlS_TBd{4CAO8qA92mL7LrYe+$|)KmDcpLkj;L`AxUa0Kwp@fju)Rw4ESvsaq4Nva z^FaB+AS7H$$Mjh53i3+nShux3oMWM-qqF151Vs4H#DtK&J!_eIpscPg0R-yyDh@@= zCfjvk8=@y5_kgd#`0twjR-;WEPGdhXX>VISeU@4^LTa0+cn3CNy>}GTa5OS-H0Ck1 zHwGsND>DlR0}Cqy^9L0cW*$~{9#(D!W>y|%X0efPKmV(Nm5tF?6Sx1};6n@t9B2TM M5|b0H5Z3qqKj-ldMF0Q* diff --git a/deps/rcheevos/test/lua/doc/lua.1 b/deps/rcheevos/test/lua/doc/lua.1 deleted file mode 100644 index d728d0b80c..0000000000 --- a/deps/rcheevos/test/lua/doc/lua.1 +++ /dev/null @@ -1,112 +0,0 @@ -.\" $Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp $ -.TH LUA 1 "$Date: 2016/10/17 15:43:50 $" -.SH NAME -lua \- Lua interpreter -.SH SYNOPSIS -.B lua -[ -.I options -] -[ -.I script -[ -.I args -] -] -.SH DESCRIPTION -.B lua -is the standalone Lua interpreter. -It loads and executes Lua programs, -either in textual source form or -in precompiled binary form. -(Precompiled binaries are output by -.BR luac , -the Lua compiler.) -.B lua -can be used as a batch interpreter and also interactively. -.LP -The given -.I options -are handled in order and then -the Lua program in file -.I script -is loaded and executed. -The given -.I args -are available to -.I script -as strings in a global table named -.BR arg . -If no options or arguments are given, -then -.B "\-v \-i" -is assumed when the standard input is a terminal; -otherwise, -.B "\-" -is assumed. -.LP -In interactive mode, -.B lua -prompts the user, -reads lines from the standard input, -and executes them as they are read. -If the line contains an expression or list of expressions, -then the line is evaluated and the results are printed. -If a line does not contain a complete statement, -then a secondary prompt is displayed and -lines are read until a complete statement is formed or -a syntax error is found. -.LP -At the very start, -before even handling the command line, -.B lua -checks the contents of the environment variables -.B LUA_INIT_5_3 -or -.BR LUA_INIT , -in that order. -If the contents is of the form -.RI '@ filename ', -then -.I filename -is executed. -Otherwise, the string is assumed to be a Lua statement and is executed. -.SH OPTIONS -.TP -.BI \-e " stat" -execute statement -.IR stat . -.TP -.B \-i -enter interactive mode after executing -.IR script . -.TP -.BI \-l " name" -execute the equivalent of -.IB name =require(' name ') -before executing -.IR script . -.TP -.B \-v -show version information. -.TP -.B \-E -ignore environment variables. -.TP -.B \-\- -stop handling options. -.TP -.B \- -stop handling options and execute the standard input as a file. -.SH "SEE ALSO" -.BR luac (1) -.br -The documentation at lua.org, -especially section 7 of the reference manual. -.SH DIAGNOSTICS -Error messages should be self explanatory. -.SH AUTHORS -R. Ierusalimschy, -L. H. de Figueiredo, -W. Celes -.\" EOF diff --git a/deps/rcheevos/test/lua/doc/lua.css b/deps/rcheevos/test/lua/doc/lua.css deleted file mode 100644 index 5bedf7eb89..0000000000 --- a/deps/rcheevos/test/lua/doc/lua.css +++ /dev/null @@ -1,164 +0,0 @@ -html { - background-color: #F8F8F8 ; -} - -body { - background-color: #FFFFFF ; - color: #000000 ; - font-family: Helvetica, Arial, sans-serif ; - text-align: justify ; - line-height: 1.25 ; - margin: 16px auto ; - padding: 32px ; - border: solid #a0a0a0 1px ; - border-radius: 20px ; - max-width: 70em ; - width: 90% ; -} - -h1, h2, h3, h4 { - color: #000080 ; - font-family: Verdana, Geneva, sans-serif ; - font-weight: normal ; - font-style: normal ; - text-align: left ; -} - -h1 { - font-size: 28pt ; -} - -h1 img { - vertical-align: text-bottom ; -} - -h2:before { - content: "\2756" ; - padding-right: 0.5em ; -} - -a { - text-decoration: none ; -} - -a:link { - color: #000080 ; -} - -a:link:hover, a:visited:hover { - background-color: #D0D0FF ; - color: #000080 ; - border-radius: 4px ; -} - -a:link:active, a:visited:active { - color: #FF0000 ; -} - -div.menubar { - padding-bottom: 0.5em ; -} - -p.menubar { - margin-left: 2.5em ; -} - -.menubar a:hover { - margin: -3px -3px -3px -3px ; - padding: 3px 3px 3px 3px ; - border-radius: 4px ; -} - -:target { - background-color: #F0F0F0 ; - margin: -8px ; - padding: 8px ; - border-radius: 8px ; - outline: none ; -} - -hr { - display: none ; -} - -table hr { - background-color: #a0a0a0 ; - color: #a0a0a0 ; - border: 0 ; - height: 1px ; - display: block ; -} - -.footer { - color: gray ; - font-size: x-small ; - text-transform: lowercase ; -} - -input[type=text] { - border: solid #a0a0a0 2px ; - border-radius: 2em ; - background-image: url('images/search.png') ; - background-repeat: no-repeat ; - background-position: 4px center ; - padding-left: 20px ; - height: 2em ; -} - -pre.session { - background-color: #F8F8F8 ; - padding: 1em ; - border-radius: 8px ; -} - -td.gutter { - width: 4% ; -} - -table.columns { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; -} - -table.columns td { - vertical-align: top ; - padding: 0 ; - padding-bottom: 1em ; - text-align: justify ; - line-height: 1.25 ; -} - -p.logos a:link:hover, p.logos a:visited:hover { - background-color: inherit ; -} - -table.book { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; -} - -table.book td { - padding: 0 ; - vertical-align: top ; -} - -table.book td.cover { - padding-right: 1em ; -} - -table.book img { - border: solid #000080 1px ; -} - -table.book span { - font-size: small ; - text-align: left ; - display: block ; - margin-top: 0.25em ; -} - -img { - background-color: white ; -} diff --git a/deps/rcheevos/test/lua/doc/luac.1 b/deps/rcheevos/test/lua/doc/luac.1 deleted file mode 100644 index 33a4ed00ac..0000000000 --- a/deps/rcheevos/test/lua/doc/luac.1 +++ /dev/null @@ -1,118 +0,0 @@ -.\" $Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp $ -.TH LUAC 1 "$Date: 2011/11/16 13:53:40 $" -.SH NAME -luac \- Lua compiler -.SH SYNOPSIS -.B luac -[ -.I options -] [ -.I filenames -] -.SH DESCRIPTION -.B luac -is the Lua compiler. -It translates programs written in the Lua programming language -into binary files containing precompiled chunks -that can be later loaded and executed. -.LP -The main advantages of precompiling chunks are: -faster loading, -protecting source code from accidental user changes, -and -off-line syntax checking. -Precompiling does not imply faster execution -because in Lua chunks are always compiled into bytecodes before being executed. -.B luac -simply allows those bytecodes to be saved in a file for later execution. -Precompiled chunks are not necessarily smaller than the corresponding source. -The main goal in precompiling is faster loading. -.LP -In the command line, -you can mix -text files containing Lua source and -binary files containing precompiled chunks. -.B luac -produces a single output file containing the combined bytecodes -for all files given. -Executing the combined file is equivalent to executing the given files. -By default, -the output file is named -.BR luac.out , -but you can change this with the -.B \-o -option. -.LP -Precompiled chunks are -.I not -portable across different architectures. -Moreover, -the internal format of precompiled chunks -is likely to change when a new version of Lua is released. -Make sure you save the source files of all Lua programs that you precompile. -.LP -.SH OPTIONS -.TP -.B \-l -produce a listing of the compiled bytecode for Lua's virtual machine. -Listing bytecodes is useful to learn about Lua's virtual machine. -If no files are given, then -.B luac -loads -.B luac.out -and lists its contents. -Use -.B \-l \-l -for a full listing. -.TP -.BI \-o " file" -output to -.IR file , -instead of the default -.BR luac.out . -(You can use -.B "'\-'" -for standard output, -but not on platforms that open standard output in text mode.) -The output file may be one of the given files because -all files are loaded before the output file is written. -Be careful not to overwrite precious files. -.TP -.B \-p -load files but do not generate any output file. -Used mainly for syntax checking and for testing precompiled chunks: -corrupted files will probably generate errors when loaded. -If no files are given, then -.B luac -loads -.B luac.out -and tests its contents. -No messages are displayed if the file loads without errors. -.TP -.B \-s -strip debug information before writing the output file. -This saves some space in very large chunks, -but if errors occur when running a stripped chunk, -then the error messages may not contain the full information they usually do. -In particular, -line numbers and names of local variables are lost. -.TP -.B \-v -show version information. -.TP -.B \-\- -stop handling options. -.TP -.B \- -stop handling options and process standard input. -.SH "SEE ALSO" -.BR lua (1) -.br -The documentation at lua.org. -.SH DIAGNOSTICS -Error messages should be self explanatory. -.SH AUTHORS -R. Ierusalimschy, -L. H. de Figueiredo, -W. Celes -.\" EOF diff --git a/deps/rcheevos/test/lua/doc/manual.css b/deps/rcheevos/test/lua/doc/manual.css deleted file mode 100644 index aa0e677dd5..0000000000 --- a/deps/rcheevos/test/lua/doc/manual.css +++ /dev/null @@ -1,21 +0,0 @@ -h3 code { - font-family: inherit ; - font-size: inherit ; -} - -pre, code { - font-size: 12pt ; -} - -span.apii { - color: gray ; - float: right ; - font-family: inherit ; - font-style: normal ; - font-size: small ; -} - -h2:before { - content: "" ; - padding-right: 0em ; -} diff --git a/deps/rcheevos/test/lua/doc/manual.html b/deps/rcheevos/test/lua/doc/manual.html deleted file mode 100644 index 3126b5d6af..0000000000 --- a/deps/rcheevos/test/lua/doc/manual.html +++ /dev/null @@ -1,10985 +0,0 @@ - - - -Lua 5.3 Reference Manual - - - - - - - -

-Lua -Lua 5.3 Reference Manual -

- -

-by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes - -

- -Copyright © 2015–2017 Lua.org, PUC-Rio. -Freely available under the terms of the -Lua license. - - -

- - -

- - - - - - -

1 – Introduction

- -

-Lua is a powerful, efficient, lightweight, embeddable scripting language. -It supports procedural programming, -object-oriented programming, functional programming, -data-driven programming, and data description. - - -

-Lua combines simple procedural syntax with powerful data description -constructs based on associative arrays and extensible semantics. -Lua is dynamically typed, -runs by interpreting bytecode with a register-based -virtual machine, -and has automatic memory management with -incremental garbage collection, -making it ideal for configuration, scripting, -and rapid prototyping. - - -

-Lua is implemented as a library, written in clean C, -the common subset of Standard C and C++. -The Lua distribution includes a host program called lua, -which uses the Lua library to offer a complete, -standalone Lua interpreter, -for interactive or batch use. -Lua is intended to be used both as a powerful, lightweight, -embeddable scripting language for any program that needs one, -and as a powerful but lightweight and efficient stand-alone language. - - -

-As an extension language, Lua has no notion of a "main" program: -it works embedded in a host client, -called the embedding program or simply the host. -(Frequently, this host is the stand-alone lua program.) -The host program can invoke functions to execute a piece of Lua code, -can write and read Lua variables, -and can register C functions to be called by Lua code. -Through the use of C functions, Lua can be augmented to cope with -a wide range of different domains, -thus creating customized programming languages sharing a syntactical framework. - - -

-Lua is free software, -and is provided as usual with no guarantees, -as stated in its license. -The implementation described in this manual is available -at Lua's official web site, www.lua.org. - - -

-Like any other reference manual, -this document is dry in places. -For a discussion of the decisions behind the design of Lua, -see the technical papers available at Lua's web site. -For a detailed introduction to programming in Lua, -see Roberto's book, Programming in Lua. - - - -

2 – Basic Concepts

- -

-This section describes the basic concepts of the language. - - - -

2.1 – Values and Types

- -

-Lua is a dynamically typed language. -This means that -variables do not have types; only values do. -There are no type definitions in the language. -All values carry their own type. - - -

-All values in Lua are first-class values. -This means that all values can be stored in variables, -passed as arguments to other functions, and returned as results. - - -

-There are eight basic types in Lua: -nil, boolean, number, -string, function, userdata, -thread, and table. -The type nil has one single value, nil, -whose main property is to be different from any other value; -it usually represents the absence of a useful value. -The type boolean has two values, false and true. -Both nil and false make a condition false; -any other value makes it true. -The type number represents both -integer numbers and real (floating-point) numbers. -The type string represents immutable sequences of bytes. - -Lua is 8-bit clean: -strings can contain any 8-bit value, -including embedded zeros ('\0'). -Lua is also encoding-agnostic; -it makes no assumptions about the contents of a string. - - -

-The type number uses two internal representations, -or two subtypes, -one called integer and the other called float. -Lua has explicit rules about when each representation is used, -but it also converts between them automatically as needed (see §3.4.3). -Therefore, -the programmer may choose to mostly ignore the difference -between integers and floats -or to assume complete control over the representation of each number. -Standard Lua uses 64-bit integers and double-precision (64-bit) floats, -but you can also compile Lua so that it -uses 32-bit integers and/or single-precision (32-bit) floats. -The option with 32 bits for both integers and floats -is particularly attractive -for small machines and embedded systems. -(See macro LUA_32BITS in file luaconf.h.) - - -

-Lua can call (and manipulate) functions written in Lua and -functions written in C (see §3.4.10). -Both are represented by the type function. - - -

-The type userdata is provided to allow arbitrary C data to -be stored in Lua variables. -A userdata value represents a block of raw memory. -There are two kinds of userdata: -full userdata, -which is an object with a block of memory managed by Lua, -and light userdata, -which is simply a C pointer value. -Userdata has no predefined operations in Lua, -except assignment and identity test. -By using metatables, -the programmer can define operations for full userdata values -(see §2.4). -Userdata values cannot be created or modified in Lua, -only through the C API. -This guarantees the integrity of data owned by the host program. - - -

-The type thread represents independent threads of execution -and it is used to implement coroutines (see §2.6). -Lua threads are not related to operating-system threads. -Lua supports coroutines on all systems, -even those that do not support threads natively. - - -

-The type table implements associative arrays, -that is, arrays that can be indexed not only with numbers, -but with any Lua value except nil and NaN. -(Not a Number is a special value used to represent -undefined or unrepresentable numerical results, such as 0/0.) -Tables can be heterogeneous; -that is, they can contain values of all types (except nil). -Any key with value nil is not considered part of the table. -Conversely, any key that is not part of a table has -an associated value nil. - - -

-Tables are the sole data-structuring mechanism in Lua; -they can be used to represent ordinary arrays, lists, -symbol tables, sets, records, graphs, trees, etc. -To represent records, Lua uses the field name as an index. -The language supports this representation by -providing a.name as syntactic sugar for a["name"]. -There are several convenient ways to create tables in Lua -(see §3.4.9). - - -

-Like indices, -the values of table fields can be of any type. -In particular, -because functions are first-class values, -table fields can contain functions. -Thus tables can also carry methods (see §3.4.11). - - -

-The indexing of tables follows -the definition of raw equality in the language. -The expressions a[i] and a[j] -denote the same table element -if and only if i and j are raw equal -(that is, equal without metamethods). -In particular, floats with integral values -are equal to their respective integers -(e.g., 1.0 == 1). -To avoid ambiguities, -any float with integral value used as a key -is converted to its respective integer. -For instance, if you write a[2.0] = true, -the actual key inserted into the table will be the -integer 2. -(On the other hand, -2 and "2" are different Lua values and therefore -denote different table entries.) - - -

-Tables, functions, threads, and (full) userdata values are objects: -variables do not actually contain these values, -only references to them. -Assignment, parameter passing, and function returns -always manipulate references to such values; -these operations do not imply any kind of copy. - - -

-The library function type returns a string describing the type -of a given value (see §6.1). - - - - - -

2.2 – Environments and the Global Environment

- -

-As will be discussed in §3.2 and §3.3.3, -any reference to a free name -(that is, a name not bound to any declaration) var -is syntactically translated to _ENV.var. -Moreover, every chunk is compiled in the scope of -an external local variable named _ENV (see §3.3.2), -so _ENV itself is never a free name in a chunk. - - -

-Despite the existence of this external _ENV variable and -the translation of free names, -_ENV is a completely regular name. -In particular, -you can define new variables and parameters with that name. -Each reference to a free name uses the _ENV that is -visible at that point in the program, -following the usual visibility rules of Lua (see §3.5). - - -

-Any table used as the value of _ENV is called an environment. - - -

-Lua keeps a distinguished environment called the global environment. -This value is kept at a special index in the C registry (see §4.5). -In Lua, the global variable _G is initialized with this same value. -(_G is never used internally.) - - -

-When Lua loads a chunk, -the default value for its _ENV upvalue -is the global environment (see load). -Therefore, by default, -free names in Lua code refer to entries in the global environment -(and, therefore, they are also called global variables). -Moreover, all standard libraries are loaded in the global environment -and some functions there operate on that environment. -You can use load (or loadfile) -to load a chunk with a different environment. -(In C, you have to load the chunk and then change the value -of its first upvalue.) - - - - - -

2.3 – Error Handling

- -

-Because Lua is an embedded extension language, -all Lua actions start from C code in the host program -calling a function from the Lua library. -(When you use Lua standalone, -the lua application is the host program.) -Whenever an error occurs during -the compilation or execution of a Lua chunk, -control returns to the host, -which can take appropriate measures -(such as printing an error message). - - -

-Lua code can explicitly generate an error by calling the -error function. -If you need to catch errors in Lua, -you can use pcall or xpcall -to call a given function in protected mode. - - -

-Whenever there is an error, -an error object (also called an error message) -is propagated with information about the error. -Lua itself only generates errors whose error object is a string, -but programs may generate errors with -any value as the error object. -It is up to the Lua program or its host to handle such error objects. - - -

-When you use xpcall or lua_pcall, -you may give a message handler -to be called in case of errors. -This function is called with the original error object -and returns a new error object. -It is called before the error unwinds the stack, -so that it can gather more information about the error, -for instance by inspecting the stack and creating a stack traceback. -This message handler is still protected by the protected call; -so, an error inside the message handler -will call the message handler again. -If this loop goes on for too long, -Lua breaks it and returns an appropriate message. -(The message handler is called only for regular runtime errors. -It is not called for memory-allocation errors -nor for errors while running finalizers.) - - - - - -

2.4 – Metatables and Metamethods

- -

-Every value in Lua can have a metatable. -This metatable is an ordinary Lua table -that defines the behavior of the original value -under certain special operations. -You can change several aspects of the behavior -of operations over a value by setting specific fields in its metatable. -For instance, when a non-numeric value is the operand of an addition, -Lua checks for a function in the field "__add" of the value's metatable. -If it finds one, -Lua calls this function to perform the addition. - - -

-The key for each event in a metatable is a string -with the event name prefixed by two underscores; -the corresponding values are called metamethods. -In the previous example, the key is "__add" -and the metamethod is the function that performs the addition. - - -

-You can query the metatable of any value -using the getmetatable function. -Lua queries metamethods in metatables using a raw access (see rawget). -So, to retrieve the metamethod for event ev in object o, -Lua does the equivalent to the following code: - -

-     rawget(getmetatable(o) or {}, "__ev")
-
- -

-You can replace the metatable of tables -using the setmetatable function. -You cannot change the metatable of other types from Lua code -(except by using the debug library (§6.10)); -you should use the C API for that. - - -

-Tables and full userdata have individual metatables -(although multiple tables and userdata can share their metatables). -Values of all other types share one single metatable per type; -that is, there is one single metatable for all numbers, -one for all strings, etc. -By default, a value has no metatable, -but the string library sets a metatable for the string type (see §6.4). - - -

-A metatable controls how an object behaves in -arithmetic operations, bitwise operations, -order comparisons, concatenation, length operation, calls, and indexing. -A metatable also can define a function to be called -when a userdata or a table is garbage collected (§2.5). - - -

-For the unary operators (negation, length, and bitwise NOT), -the metamethod is computed and called with a dummy second operand, -equal to the first one. -This extra operand is only to simplify Lua's internals -(by making these operators behave like a binary operation) -and may be removed in future versions. -(For most uses this extra operand is irrelevant.) - - -

-A detailed list of events controlled by metatables is given next. -Each operation is identified by its corresponding key. - - - -

    - -
  • __add: -the addition (+) operation. -If any operand for an addition is not a number -(nor a string coercible to a number), -Lua will try to call a metamethod. -First, Lua will check the first operand (even if it is valid). -If that operand does not define a metamethod for __add, -then Lua will check the second operand. -If Lua can find a metamethod, -it calls the metamethod with the two operands as arguments, -and the result of the call -(adjusted to one value) -is the result of the operation. -Otherwise, -it raises an error. -
  • - -
  • __sub: -the subtraction (-) operation. -Behavior similar to the addition operation. -
  • - -
  • __mul: -the multiplication (*) operation. -Behavior similar to the addition operation. -
  • - -
  • __div: -the division (/) operation. -Behavior similar to the addition operation. -
  • - -
  • __mod: -the modulo (%) operation. -Behavior similar to the addition operation. -
  • - -
  • __pow: -the exponentiation (^) operation. -Behavior similar to the addition operation. -
  • - -
  • __unm: -the negation (unary -) operation. -Behavior similar to the addition operation. -
  • - -
  • __idiv: -the floor division (//) operation. -Behavior similar to the addition operation. -
  • - -
  • __band: -the bitwise AND (&) operation. -Behavior similar to the addition operation, -except that Lua will try a metamethod -if any operand is neither an integer -nor a value coercible to an integer (see §3.4.3). -
  • - -
  • __bor: -the bitwise OR (|) operation. -Behavior similar to the bitwise AND operation. -
  • - -
  • __bxor: -the bitwise exclusive OR (binary ~) operation. -Behavior similar to the bitwise AND operation. -
  • - -
  • __bnot: -the bitwise NOT (unary ~) operation. -Behavior similar to the bitwise AND operation. -
  • - -
  • __shl: -the bitwise left shift (<<) operation. -Behavior similar to the bitwise AND operation. -
  • - -
  • __shr: -the bitwise right shift (>>) operation. -Behavior similar to the bitwise AND operation. -
  • - -
  • __concat: -the concatenation (..) operation. -Behavior similar to the addition operation, -except that Lua will try a metamethod -if any operand is neither a string nor a number -(which is always coercible to a string). -
  • - -
  • __len: -the length (#) operation. -If the object is not a string, -Lua will try its metamethod. -If there is a metamethod, -Lua calls it with the object as argument, -and the result of the call -(always adjusted to one value) -is the result of the operation. -If there is no metamethod but the object is a table, -then Lua uses the table length operation (see §3.4.7). -Otherwise, Lua raises an error. -
  • - -
  • __eq: -the equal (==) operation. -Behavior similar to the addition operation, -except that Lua will try a metamethod only when the values -being compared are either both tables or both full userdata -and they are not primitively equal. -The result of the call is always converted to a boolean. -
  • - -
  • __lt: -the less than (<) operation. -Behavior similar to the addition operation, -except that Lua will try a metamethod only when the values -being compared are neither both numbers nor both strings. -The result of the call is always converted to a boolean. -
  • - -
  • __le: -the less equal (<=) operation. -Unlike other operations, -the less-equal operation can use two different events. -First, Lua looks for the __le metamethod in both operands, -like in the less than operation. -If it cannot find such a metamethod, -then it will try the __lt metamethod, -assuming that a <= b is equivalent to not (b < a). -As with the other comparison operators, -the result is always a boolean. -(This use of the __lt event can be removed in future versions; -it is also slower than a real __le metamethod.) -
  • - -
  • __index: -The indexing access table[key]. -This event happens when table is not a table or -when key is not present in table. -The metamethod is looked up in table. - - -

    -Despite the name, -the metamethod for this event can be either a function or a table. -If it is a function, -it is called with table and key as arguments, -and the result of the call -(adjusted to one value) -is the result of the operation. -If it is a table, -the final result is the result of indexing this table with key. -(This indexing is regular, not raw, -and therefore can trigger another metamethod.) -

  • - -
  • __newindex: -The indexing assignment table[key] = value. -Like the index event, -this event happens when table is not a table or -when key is not present in table. -The metamethod is looked up in table. - - -

    -Like with indexing, -the metamethod for this event can be either a function or a table. -If it is a function, -it is called with table, key, and value as arguments. -If it is a table, -Lua does an indexing assignment to this table with the same key and value. -(This assignment is regular, not raw, -and therefore can trigger another metamethod.) - - -

    -Whenever there is a __newindex metamethod, -Lua does not perform the primitive assignment. -(If necessary, -the metamethod itself can call rawset -to do the assignment.) -

  • - -
  • __call: -The call operation func(args). -This event happens when Lua tries to call a non-function value -(that is, func is not a function). -The metamethod is looked up in func. -If present, -the metamethod is called with func as its first argument, -followed by the arguments of the original call (args). -All results of the call -are the result of the operation. -(This is the only metamethod that allows multiple results.) -
  • - -
- -

-It is a good practice to add all needed metamethods to a table -before setting it as a metatable of some object. -In particular, the __gc metamethod works only when this order -is followed (see §2.5.1). - - -

-Because metatables are regular tables, -they can contain arbitrary fields, -not only the event names defined above. -Some functions in the standard library -(e.g., tostring) -use other fields in metatables for their own purposes. - - - - - -

2.5 – Garbage Collection

- -

-Lua performs automatic memory management. -This means that -you do not have to worry about allocating memory for new objects -or freeing it when the objects are no longer needed. -Lua manages memory automatically by running -a garbage collector to collect all dead objects -(that is, objects that are no longer accessible from Lua). -All memory used by Lua is subject to automatic management: -strings, tables, userdata, functions, threads, internal structures, etc. - - -

-Lua implements an incremental mark-and-sweep collector. -It uses two numbers to control its garbage-collection cycles: -the garbage-collector pause and -the garbage-collector step multiplier. -Both use percentage points as units -(e.g., a value of 100 means an internal value of 1). - - -

-The garbage-collector pause -controls how long the collector waits before starting a new cycle. -Larger values make the collector less aggressive. -Values smaller than 100 mean the collector will not wait to -start a new cycle. -A value of 200 means that the collector waits for the total memory in use -to double before starting a new cycle. - - -

-The garbage-collector step multiplier -controls the relative speed of the collector relative to -memory allocation. -Larger values make the collector more aggressive but also increase -the size of each incremental step. -You should not use values smaller than 100, -because they make the collector too slow and -can result in the collector never finishing a cycle. -The default is 200, -which means that the collector runs at "twice" -the speed of memory allocation. - - -

-If you set the step multiplier to a very large number -(larger than 10% of the maximum number of -bytes that the program may use), -the collector behaves like a stop-the-world collector. -If you then set the pause to 200, -the collector behaves as in old Lua versions, -doing a complete collection every time Lua doubles its -memory usage. - - -

-You can change these numbers by calling lua_gc in C -or collectgarbage in Lua. -You can also use these functions to control -the collector directly (e.g., stop and restart it). - - - -

2.5.1 – Garbage-Collection Metamethods

- -

-You can set garbage-collector metamethods for tables -and, using the C API, -for full userdata (see §2.4). -These metamethods are also called finalizers. -Finalizers allow you to coordinate Lua's garbage collection -with external resource management -(such as closing files, network or database connections, -or freeing your own memory). - - -

-For an object (table or userdata) to be finalized when collected, -you must mark it for finalization. - -You mark an object for finalization when you set its metatable -and the metatable has a field indexed by the string "__gc". -Note that if you set a metatable without a __gc field -and later create that field in the metatable, -the object will not be marked for finalization. - - -

-When a marked object becomes garbage, -it is not collected immediately by the garbage collector. -Instead, Lua puts it in a list. -After the collection, -Lua goes through that list. -For each object in the list, -it checks the object's __gc metamethod: -If it is a function, -Lua calls it with the object as its single argument; -if the metamethod is not a function, -Lua simply ignores it. - - -

-At the end of each garbage-collection cycle, -the finalizers for objects are called in -the reverse order that the objects were marked for finalization, -among those collected in that cycle; -that is, the first finalizer to be called is the one associated -with the object marked last in the program. -The execution of each finalizer may occur at any point during -the execution of the regular code. - - -

-Because the object being collected must still be used by the finalizer, -that object (and other objects accessible only through it) -must be resurrected by Lua. -Usually, this resurrection is transient, -and the object memory is freed in the next garbage-collection cycle. -However, if the finalizer stores the object in some global place -(e.g., a global variable), -then the resurrection is permanent. -Moreover, if the finalizer marks a finalizing object for finalization again, -its finalizer will be called again in the next cycle where the -object is unreachable. -In any case, -the object memory is freed only in a GC cycle where -the object is unreachable and not marked for finalization. - - -

-When you close a state (see lua_close), -Lua calls the finalizers of all objects marked for finalization, -following the reverse order that they were marked. -If any finalizer marks objects for collection during that phase, -these marks have no effect. - - - - - -

2.5.2 – Weak Tables

- -

-A weak table is a table whose elements are -weak references. -A weak reference is ignored by the garbage collector. -In other words, -if the only references to an object are weak references, -then the garbage collector will collect that object. - - -

-A weak table can have weak keys, weak values, or both. -A table with weak values allows the collection of its values, -but prevents the collection of its keys. -A table with both weak keys and weak values allows the collection of -both keys and values. -In any case, if either the key or the value is collected, -the whole pair is removed from the table. -The weakness of a table is controlled by the -__mode field of its metatable. -If the __mode field is a string containing the character 'k', -the keys in the table are weak. -If __mode contains 'v', -the values in the table are weak. - - -

-A table with weak keys and strong values -is also called an ephemeron table. -In an ephemeron table, -a value is considered reachable only if its key is reachable. -In particular, -if the only reference to a key comes through its value, -the pair is removed. - - -

-Any change in the weakness of a table may take effect only -at the next collect cycle. -In particular, if you change the weakness to a stronger mode, -Lua may still collect some items from that table -before the change takes effect. - - -

-Only objects that have an explicit construction -are removed from weak tables. -Values, such as numbers and light C functions, -are not subject to garbage collection, -and therefore are not removed from weak tables -(unless their associated values are collected). -Although strings are subject to garbage collection, -they do not have an explicit construction, -and therefore are not removed from weak tables. - - -

-Resurrected objects -(that is, objects being finalized -and objects accessible only through objects being finalized) -have a special behavior in weak tables. -They are removed from weak values before running their finalizers, -but are removed from weak keys only in the next collection -after running their finalizers, when such objects are actually freed. -This behavior allows the finalizer to access properties -associated with the object through weak tables. - - -

-If a weak table is among the resurrected objects in a collection cycle, -it may not be properly cleared until the next cycle. - - - - - - - -

2.6 – Coroutines

- -

-Lua supports coroutines, -also called collaborative multithreading. -A coroutine in Lua represents an independent thread of execution. -Unlike threads in multithread systems, however, -a coroutine only suspends its execution by explicitly calling -a yield function. - - -

-You create a coroutine by calling coroutine.create. -Its sole argument is a function -that is the main function of the coroutine. -The create function only creates a new coroutine and -returns a handle to it (an object of type thread); -it does not start the coroutine. - - -

-You execute a coroutine by calling coroutine.resume. -When you first call coroutine.resume, -passing as its first argument -a thread returned by coroutine.create, -the coroutine starts its execution by -calling its main function. -Extra arguments passed to coroutine.resume are passed -as arguments to that function. -After the coroutine starts running, -it runs until it terminates or yields. - - -

-A coroutine can terminate its execution in two ways: -normally, when its main function returns -(explicitly or implicitly, after the last instruction); -and abnormally, if there is an unprotected error. -In case of normal termination, -coroutine.resume returns true, -plus any values returned by the coroutine main function. -In case of errors, coroutine.resume returns false -plus an error object. - - -

-A coroutine yields by calling coroutine.yield. -When a coroutine yields, -the corresponding coroutine.resume returns immediately, -even if the yield happens inside nested function calls -(that is, not in the main function, -but in a function directly or indirectly called by the main function). -In the case of a yield, coroutine.resume also returns true, -plus any values passed to coroutine.yield. -The next time you resume the same coroutine, -it continues its execution from the point where it yielded, -with the call to coroutine.yield returning any extra -arguments passed to coroutine.resume. - - -

-Like coroutine.create, -the coroutine.wrap function also creates a coroutine, -but instead of returning the coroutine itself, -it returns a function that, when called, resumes the coroutine. -Any arguments passed to this function -go as extra arguments to coroutine.resume. -coroutine.wrap returns all the values returned by coroutine.resume, -except the first one (the boolean error code). -Unlike coroutine.resume, -coroutine.wrap does not catch errors; -any error is propagated to the caller. - - -

-As an example of how coroutines work, -consider the following code: - -

-     function foo (a)
-       print("foo", a)
-       return coroutine.yield(2*a)
-     end
-     
-     co = coroutine.create(function (a,b)
-           print("co-body", a, b)
-           local r = foo(a+1)
-           print("co-body", r)
-           local r, s = coroutine.yield(a+b, a-b)
-           print("co-body", r, s)
-           return b, "end"
-     end)
-     
-     print("main", coroutine.resume(co, 1, 10))
-     print("main", coroutine.resume(co, "r"))
-     print("main", coroutine.resume(co, "x", "y"))
-     print("main", coroutine.resume(co, "x", "y"))
-

-When you run it, it produces the following output: - -

-     co-body 1       10
-     foo     2
-     main    true    4
-     co-body r
-     main    true    11      -9
-     co-body x       y
-     main    true    10      end
-     main    false   cannot resume dead coroutine
-
- -

-You can also create and manipulate coroutines through the C API: -see functions lua_newthread, lua_resume, -and lua_yield. - - - - - -

3 – The Language

- -

-This section describes the lexis, the syntax, and the semantics of Lua. -In other words, -this section describes -which tokens are valid, -how they can be combined, -and what their combinations mean. - - -

-Language constructs will be explained using the usual extended BNF notation, -in which -{a} means 0 or more a's, and -[a] means an optional a. -Non-terminals are shown like non-terminal, -keywords are shown like kword, -and other terminal symbols are shown like ‘=’. -The complete syntax of Lua can be found in §9 -at the end of this manual. - - - -

3.1 – Lexical Conventions

- -

-Lua is a free-form language. -It ignores spaces (including new lines) and comments -between lexical elements (tokens), -except as delimiters between names and keywords. - - -

-Names -(also called identifiers) -in Lua can be any string of letters, -digits, and underscores, -not beginning with a digit and -not being a reserved word. -Identifiers are used to name variables, table fields, and labels. - - -

-The following keywords are reserved -and cannot be used as names: - - -

-     and       break     do        else      elseif    end
-     false     for       function  goto      if        in
-     local     nil       not       or        repeat    return
-     then      true      until     while
-
- -

-Lua is a case-sensitive language: -and is a reserved word, but And and AND -are two different, valid names. -As a convention, -programs should avoid creating -names that start with an underscore followed by -one or more uppercase letters (such as _VERSION). - - -

-The following strings denote other tokens: - -

-     +     -     *     /     %     ^     #
-     &     ~     |     <<    >>    //
-     ==    ~=    <=    >=    <     >     =
-     (     )     {     }     [     ]     ::
-     ;     :     ,     .     ..    ...
-
- -

-A short literal string -can be delimited by matching single or double quotes, -and can contain the following C-like escape sequences: -'\a' (bell), -'\b' (backspace), -'\f' (form feed), -'\n' (newline), -'\r' (carriage return), -'\t' (horizontal tab), -'\v' (vertical tab), -'\\' (backslash), -'\"' (quotation mark [double quote]), -and '\'' (apostrophe [single quote]). -A backslash followed by a line break -results in a newline in the string. -The escape sequence '\z' skips the following span -of white-space characters, -including line breaks; -it is particularly useful to break and indent a long literal string -into multiple lines without adding the newlines and spaces -into the string contents. -A short literal string cannot contain unescaped line breaks -nor escapes not forming a valid escape sequence. - - -

-We can specify any byte in a short literal string by its numeric value -(including embedded zeros). -This can be done -with the escape sequence \xXX, -where XX is a sequence of exactly two hexadecimal digits, -or with the escape sequence \ddd, -where ddd is a sequence of up to three decimal digits. -(Note that if a decimal escape sequence is to be followed by a digit, -it must be expressed using exactly three digits.) - - -

-The UTF-8 encoding of a Unicode character -can be inserted in a literal string with -the escape sequence \u{XXX} -(note the mandatory enclosing brackets), -where XXX is a sequence of one or more hexadecimal digits -representing the character code point. - - -

-Literal strings can also be defined using a long format -enclosed by long brackets. -We define an opening long bracket of level n as an opening -square bracket followed by n equal signs followed by another -opening square bracket. -So, an opening long bracket of level 0 is written as [[, -an opening long bracket of level 1 is written as [=[, -and so on. -A closing long bracket is defined similarly; -for instance, -a closing long bracket of level 4 is written as ]====]. -A long literal starts with an opening long bracket of any level and -ends at the first closing long bracket of the same level. -It can contain any text except a closing bracket of the same level. -Literals in this bracketed form can run for several lines, -do not interpret any escape sequences, -and ignore long brackets of any other level. -Any kind of end-of-line sequence -(carriage return, newline, carriage return followed by newline, -or newline followed by carriage return) -is converted to a simple newline. - - -

-For convenience, -when the opening long bracket is immediately followed by a newline, -the newline is not included in the string. -As an example, in a system using ASCII -(in which 'a' is coded as 97, -newline is coded as 10, and '1' is coded as 49), -the five literal strings below denote the same string: - -

-     a = 'alo\n123"'
-     a = "alo\n123\""
-     a = '\97lo\10\04923"'
-     a = [[alo
-     123"]]
-     a = [==[
-     alo
-     123"]==]
-
- -

-Any byte in a literal string not -explicitly affected by the previous rules represents itself. -However, Lua opens files for parsing in text mode, -and the system file functions may have problems with -some control characters. -So, it is safer to represent -non-text data as a quoted literal with -explicit escape sequences for the non-text characters. - - -

-A numeric constant (or numeral) -can be written with an optional fractional part -and an optional decimal exponent, -marked by a letter 'e' or 'E'. -Lua also accepts hexadecimal constants, -which start with 0x or 0X. -Hexadecimal constants also accept an optional fractional part -plus an optional binary exponent, -marked by a letter 'p' or 'P'. -A numeric constant with a radix point or an exponent -denotes a float; -otherwise, -if its value fits in an integer, -it denotes an integer. -Examples of valid integer constants are - -

-     3   345   0xff   0xBEBADA
-

-Examples of valid float constants are - -

-     3.0     3.1416     314.16e-2     0.31416E1     34e1
-     0x0.1E  0xA23p-4   0X1.921FB54442D18P+1
-
- -

-A comment starts with a double hyphen (--) -anywhere outside a string. -If the text immediately after -- is not an opening long bracket, -the comment is a short comment, -which runs until the end of the line. -Otherwise, it is a long comment, -which runs until the corresponding closing long bracket. -Long comments are frequently used to disable code temporarily. - - - - - -

3.2 – Variables

- -

-Variables are places that store values. -There are three kinds of variables in Lua: -global variables, local variables, and table fields. - - -

-A single name can denote a global variable or a local variable -(or a function's formal parameter, -which is a particular kind of local variable): - -

-	var ::= Name
-

-Name denotes identifiers, as defined in §3.1. - - -

-Any variable name is assumed to be global unless explicitly declared -as a local (see §3.3.7). -Local variables are lexically scoped: -local variables can be freely accessed by functions -defined inside their scope (see §3.5). - - -

-Before the first assignment to a variable, its value is nil. - - -

-Square brackets are used to index a table: - -

-	var ::= prefixexp ‘[’ exp ‘]’
-

-The meaning of accesses to table fields can be changed via metatables. -An access to an indexed variable t[i] is equivalent to -a call gettable_event(t,i). -(See §2.4 for a complete description of the -gettable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) - - -

-The syntax var.Name is just syntactic sugar for -var["Name"]: - -

-	var ::= prefixexp ‘.’ Name
-
- -

-An access to a global variable x -is equivalent to _ENV.x. -Due to the way that chunks are compiled, -_ENV is never a global name (see §2.2). - - - - - -

3.3 – Statements

- -

-Lua supports an almost conventional set of statements, -similar to those in Pascal or C. -This set includes -assignments, control structures, function calls, -and variable declarations. - - - -

3.3.1 – Blocks

- -

-A block is a list of statements, -which are executed sequentially: - -

-	block ::= {stat}
-

-Lua has empty statements -that allow you to separate statements with semicolons, -start a block with a semicolon -or write two semicolons in sequence: - -

-	stat ::= ‘;’
-
- -

-Function calls and assignments -can start with an open parenthesis. -This possibility leads to an ambiguity in Lua's grammar. -Consider the following fragment: - -

-     a = b + c
-     (print or io.write)('done')
-

-The grammar could see it in two ways: - -

-     a = b + c(print or io.write)('done')
-     
-     a = b + c; (print or io.write)('done')
-

-The current parser always sees such constructions -in the first way, -interpreting the open parenthesis -as the start of the arguments to a call. -To avoid this ambiguity, -it is a good practice to always precede with a semicolon -statements that start with a parenthesis: - -

-     ;(print or io.write)('done')
-
- -

-A block can be explicitly delimited to produce a single statement: - -

-	stat ::= do block end
-

-Explicit blocks are useful -to control the scope of variable declarations. -Explicit blocks are also sometimes used to -add a return statement in the middle -of another block (see §3.3.4). - - - - - -

3.3.2 – Chunks

- -

-The unit of compilation of Lua is called a chunk. -Syntactically, -a chunk is simply a block: - -

-	chunk ::= block
-
- -

-Lua handles a chunk as the body of an anonymous function -with a variable number of arguments -(see §3.4.11). -As such, chunks can define local variables, -receive arguments, and return values. -Moreover, such anonymous function is compiled as in the -scope of an external local variable called _ENV (see §2.2). -The resulting function always has _ENV as its only upvalue, -even if it does not use that variable. - - -

-A chunk can be stored in a file or in a string inside the host program. -To execute a chunk, -Lua first loads it, -precompiling the chunk's code into instructions for a virtual machine, -and then Lua executes the compiled code -with an interpreter for the virtual machine. - - -

-Chunks can also be precompiled into binary form; -see program luac and function string.dump for details. -Programs in source and compiled forms are interchangeable; -Lua automatically detects the file type and acts accordingly (see load). - - - - - -

3.3.3 – Assignment

- -

-Lua allows multiple assignments. -Therefore, the syntax for assignment -defines a list of variables on the left side -and a list of expressions on the right side. -The elements in both lists are separated by commas: - -

-	stat ::= varlist ‘=’ explist
-	varlist ::= var {‘,’ var}
-	explist ::= exp {‘,’ exp}
-

-Expressions are discussed in §3.4. - - -

-Before the assignment, -the list of values is adjusted to the length of -the list of variables. -If there are more values than needed, -the excess values are thrown away. -If there are fewer values than needed, -the list is extended with as many nil's as needed. -If the list of expressions ends with a function call, -then all values returned by that call enter the list of values, -before the adjustment -(except when the call is enclosed in parentheses; see §3.4). - - -

-The assignment statement first evaluates all its expressions -and only then the assignments are performed. -Thus the code - -

-     i = 3
-     i, a[i] = i+1, 20
-

-sets a[3] to 20, without affecting a[4] -because the i in a[i] is evaluated (to 3) -before it is assigned 4. -Similarly, the line - -

-     x, y = y, x
-

-exchanges the values of x and y, -and - -

-     x, y, z = y, z, x
-

-cyclically permutes the values of x, y, and z. - - -

-The meaning of assignments to global variables -and table fields can be changed via metatables. -An assignment to an indexed variable t[i] = val is equivalent to -settable_event(t,i,val). -(See §2.4 for a complete description of the -settable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) - - -

-An assignment to a global name x = val -is equivalent to the assignment -_ENV.x = val (see §2.2). - - - - - -

3.3.4 – Control Structures

-The control structures -if, while, and repeat have the usual meaning and -familiar syntax: - - - - -

-	stat ::= while exp do block end
-	stat ::= repeat block until exp
-	stat ::= if exp then block {elseif exp then block} [else block] end
-

-Lua also has a for statement, in two flavors (see §3.3.5). - - -

-The condition expression of a -control structure can return any value. -Both false and nil are considered false. -All values different from nil and false are considered true -(in particular, the number 0 and the empty string are also true). - - -

-In the repeatuntil loop, -the inner block does not end at the until keyword, -but only after the condition. -So, the condition can refer to local variables -declared inside the loop block. - - -

-The goto statement transfers the program control to a label. -For syntactical reasons, -labels in Lua are considered statements too: - - - -

-	stat ::= goto Name
-	stat ::= label
-	label ::= ‘::’ Name ‘::’
-
- -

-A label is visible in the entire block where it is defined, -except -inside nested blocks where a label with the same name is defined and -inside nested functions. -A goto may jump to any visible label as long as it does not -enter into the scope of a local variable. - - -

-Labels and empty statements are called void statements, -as they perform no actions. - - -

-The break statement terminates the execution of a -while, repeat, or for loop, -skipping to the next statement after the loop: - - -

-	stat ::= break
-

-A break ends the innermost enclosing loop. - - -

-The return statement is used to return values -from a function or a chunk -(which is an anonymous function). - -Functions can return more than one value, -so the syntax for the return statement is - -

-	stat ::= return [explist] [‘;’]
-
- -

-The return statement can only be written -as the last statement of a block. -If it is really necessary to return in the middle of a block, -then an explicit inner block can be used, -as in the idiom do return end, -because now return is the last statement in its (inner) block. - - - - - -

3.3.5 – For Statement

- -

- -The for statement has two forms: -one numerical and one generic. - - -

-The numerical for loop repeats a block of code while a -control variable runs through an arithmetic progression. -It has the following syntax: - -

-	stat ::= for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end
-

-The block is repeated for name starting at the value of -the first exp, until it passes the second exp by steps of the -third exp. -More precisely, a for statement like - -

-     for v = e1, e2, e3 do block end
-

-is equivalent to the code: - -

-     do
-       local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
-       if not (var and limit and step) then error() end
-       var = var - step
-       while true do
-         var = var + step
-         if (step >= 0 and var > limit) or (step < 0 and var < limit) then
-           break
-         end
-         local v = var
-         block
-       end
-     end
-
- -

-Note the following: - -

    - -
  • -All three control expressions are evaluated only once, -before the loop starts. -They must all result in numbers. -
  • - -
  • -var, limit, and step are invisible variables. -The names shown here are for explanatory purposes only. -
  • - -
  • -If the third expression (the step) is absent, -then a step of 1 is used. -
  • - -
  • -You can use break and goto to exit a for loop. -
  • - -
  • -The loop variable v is local to the loop body. -If you need its value after the loop, -assign it to another variable before exiting the loop. -
  • - -
- -

-The generic for statement works over functions, -called iterators. -On each iteration, the iterator function is called to produce a new value, -stopping when this new value is nil. -The generic for loop has the following syntax: - -

-	stat ::= for namelist in explist do block end
-	namelist ::= Name {‘,’ Name}
-

-A for statement like - -

-     for var_1, ···, var_n in explist do block end
-

-is equivalent to the code: - -

-     do
-       local f, s, var = explist
-       while true do
-         local var_1, ···, var_n = f(s, var)
-         if var_1 == nil then break end
-         var = var_1
-         block
-       end
-     end
-

-Note the following: - -

    - -
  • -explist is evaluated only once. -Its results are an iterator function, -a state, -and an initial value for the first iterator variable. -
  • - -
  • -f, s, and var are invisible variables. -The names are here for explanatory purposes only. -
  • - -
  • -You can use break to exit a for loop. -
  • - -
  • -The loop variables var_i are local to the loop; -you cannot use their values after the for ends. -If you need these values, -then assign them to other variables before breaking or exiting the loop. -
  • - -
- - - - -

3.3.6 – Function Calls as Statements

-To allow possible side-effects, -function calls can be executed as statements: - -

-	stat ::= functioncall
-

-In this case, all returned values are thrown away. -Function calls are explained in §3.4.10. - - - - - -

3.3.7 – Local Declarations

-Local variables can be declared anywhere inside a block. -The declaration can include an initial assignment: - -

-	stat ::= local namelist [‘=’ explist]
-

-If present, an initial assignment has the same semantics -of a multiple assignment (see §3.3.3). -Otherwise, all variables are initialized with nil. - - -

-A chunk is also a block (see §3.3.2), -and so local variables can be declared in a chunk outside any explicit block. - - -

-The visibility rules for local variables are explained in §3.5. - - - - - - - -

3.4 – Expressions

- -

-The basic expressions in Lua are the following: - -

-	exp ::= prefixexp
-	exp ::= nil | false | true
-	exp ::= Numeral
-	exp ::= LiteralString
-	exp ::= functiondef
-	exp ::= tableconstructor
-	exp ::= ‘...’
-	exp ::= exp binop exp
-	exp ::= unop exp
-	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
-
- -

-Numerals and literal strings are explained in §3.1; -variables are explained in §3.2; -function definitions are explained in §3.4.11; -function calls are explained in §3.4.10; -table constructors are explained in §3.4.9. -Vararg expressions, -denoted by three dots ('...'), can only be used when -directly inside a vararg function; -they are explained in §3.4.11. - - -

-Binary operators comprise arithmetic operators (see §3.4.1), -bitwise operators (see §3.4.2), -relational operators (see §3.4.4), logical operators (see §3.4.5), -and the concatenation operator (see §3.4.6). -Unary operators comprise the unary minus (see §3.4.1), -the unary bitwise NOT (see §3.4.2), -the unary logical not (see §3.4.5), -and the unary length operator (see §3.4.7). - - -

-Both function calls and vararg expressions can result in multiple values. -If a function call is used as a statement (see §3.3.6), -then its return list is adjusted to zero elements, -thus discarding all returned values. -If an expression is used as the last (or the only) element -of a list of expressions, -then no adjustment is made -(unless the expression is enclosed in parentheses). -In all other contexts, -Lua adjusts the result list to one element, -either discarding all values except the first one -or adding a single nil if there are no values. - - -

-Here are some examples: - -

-     f()                -- adjusted to 0 results
-     g(f(), x)          -- f() is adjusted to 1 result
-     g(x, f())          -- g gets x plus all results from f()
-     a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
-     a,b = ...          -- a gets the first vararg parameter, b gets
-                        -- the second (both a and b can get nil if there
-                        -- is no corresponding vararg parameter)
-     
-     a,b,c = x, f()     -- f() is adjusted to 2 results
-     a,b,c = f()        -- f() is adjusted to 3 results
-     return f()         -- returns all results from f()
-     return ...         -- returns all received vararg parameters
-     return x,y,f()     -- returns x, y, and all results from f()
-     {f()}              -- creates a list with all results from f()
-     {...}              -- creates a list with all vararg parameters
-     {f(), nil}         -- f() is adjusted to 1 result
-
- -

-Any expression enclosed in parentheses always results in only one value. -Thus, -(f(x,y,z)) is always a single value, -even if f returns several values. -(The value of (f(x,y,z)) is the first value returned by f -or nil if f does not return any values.) - - - -

3.4.1 – Arithmetic Operators

-Lua supports the following arithmetic operators: - -

    -
  • +: addition
  • -
  • -: subtraction
  • -
  • *: multiplication
  • -
  • /: float division
  • -
  • //: floor division
  • -
  • %: modulo
  • -
  • ^: exponentiation
  • -
  • -: unary minus
  • -
- -

-With the exception of exponentiation and float division, -the arithmetic operators work as follows: -If both operands are integers, -the operation is performed over integers and the result is an integer. -Otherwise, if both operands are numbers -or strings that can be converted to -numbers (see §3.4.3), -then they are converted to floats, -the operation is performed following the usual rules -for floating-point arithmetic -(usually the IEEE 754 standard), -and the result is a float. - - -

-Exponentiation and float division (/) -always convert their operands to floats -and the result is always a float. -Exponentiation uses the ISO C function pow, -so that it works for non-integer exponents too. - - -

-Floor division (//) is a division -that rounds the quotient towards minus infinity, -that is, the floor of the division of its operands. - - -

-Modulo is defined as the remainder of a division -that rounds the quotient towards minus infinity (floor division). - - -

-In case of overflows in integer arithmetic, -all operations wrap around, -according to the usual rules of two-complement arithmetic. -(In other words, -they return the unique representable integer -that is equal modulo 264 to the mathematical result.) - - - -

3.4.2 – Bitwise Operators

-Lua supports the following bitwise operators: - -

    -
  • &: bitwise AND
  • -
  • |: bitwise OR
  • -
  • ~: bitwise exclusive OR
  • -
  • >>: right shift
  • -
  • <<: left shift
  • -
  • ~: unary bitwise NOT
  • -
- -

-All bitwise operations convert its operands to integers -(see §3.4.3), -operate on all bits of those integers, -and result in an integer. - - -

-Both right and left shifts fill the vacant bits with zeros. -Negative displacements shift to the other direction; -displacements with absolute values equal to or higher than -the number of bits in an integer -result in zero (as all bits are shifted out). - - - - - -

3.4.3 – Coercions and Conversions

-Lua provides some automatic conversions between some -types and representations at run time. -Bitwise operators always convert float operands to integers. -Exponentiation and float division -always convert integer operands to floats. -All other arithmetic operations applied to mixed numbers -(integers and floats) convert the integer operand to a float; -this is called the usual rule. -The C API also converts both integers to floats and -floats to integers, as needed. -Moreover, string concatenation accepts numbers as arguments, -besides strings. - - -

-Lua also converts strings to numbers, -whenever a number is expected. - - -

-In a conversion from integer to float, -if the integer value has an exact representation as a float, -that is the result. -Otherwise, -the conversion gets the nearest higher or -the nearest lower representable value. -This kind of conversion never fails. - - -

-The conversion from float to integer -checks whether the float has an exact representation as an integer -(that is, the float has an integral value and -it is in the range of integer representation). -If it does, that representation is the result. -Otherwise, the conversion fails. - - -

-The conversion from strings to numbers goes as follows: -First, the string is converted to an integer or a float, -following its syntax and the rules of the Lua lexer. -(The string may have also leading and trailing spaces and a sign.) -Then, the resulting number (float or integer) -is converted to the type (float or integer) required by the context -(e.g., the operation that forced the conversion). - - -

-All conversions from strings to numbers -accept both a dot and the current locale mark -as the radix character. -(The Lua lexer, however, accepts only a dot.) - - -

-The conversion from numbers to strings uses a -non-specified human-readable format. -For complete control over how numbers are converted to strings, -use the format function from the string library -(see string.format). - - - - - -

3.4.4 – Relational Operators

-Lua supports the following relational operators: - -

    -
  • ==: equality
  • -
  • ~=: inequality
  • -
  • <: less than
  • -
  • >: greater than
  • -
  • <=: less or equal
  • -
  • >=: greater or equal
  • -

-These operators always result in false or true. - - -

-Equality (==) first compares the type of its operands. -If the types are different, then the result is false. -Otherwise, the values of the operands are compared. -Strings are compared in the obvious way. -Numbers are equal if they denote the same mathematical value. - - -

-Tables, userdata, and threads -are compared by reference: -two objects are considered equal only if they are the same object. -Every time you create a new object -(a table, userdata, or thread), -this new object is different from any previously existing object. -Closures with the same reference are always equal. -Closures with any detectable difference -(different behavior, different definition) are always different. - - -

-You can change the way that Lua compares tables and userdata -by using the "eq" metamethod (see §2.4). - - -

-Equality comparisons do not convert strings to numbers -or vice versa. -Thus, "0"==0 evaluates to false, -and t[0] and t["0"] denote different -entries in a table. - - -

-The operator ~= is exactly the negation of equality (==). - - -

-The order operators work as follows. -If both arguments are numbers, -then they are compared according to their mathematical values -(regardless of their subtypes). -Otherwise, if both arguments are strings, -then their values are compared according to the current locale. -Otherwise, Lua tries to call the "lt" or the "le" -metamethod (see §2.4). -A comparison a > b is translated to b < a -and a >= b is translated to b <= a. - - -

-Following the IEEE 754 standard, -NaN is considered neither smaller than, -nor equal to, nor greater than any value (including itself). - - - - - -

3.4.5 – Logical Operators

-The logical operators in Lua are -and, or, and not. -Like the control structures (see §3.3.4), -all logical operators consider both false and nil as false -and anything else as true. - - -

-The negation operator not always returns false or true. -The conjunction operator and returns its first argument -if this value is false or nil; -otherwise, and returns its second argument. -The disjunction operator or returns its first argument -if this value is different from nil and false; -otherwise, or returns its second argument. -Both and and or use short-circuit evaluation; -that is, -the second operand is evaluated only if necessary. -Here are some examples: - -

-     10 or 20            --> 10
-     10 or error()       --> 10
-     nil or "a"          --> "a"
-     nil and 10          --> nil
-     false and error()   --> false
-     false and nil       --> false
-     false or nil        --> nil
-     10 and 20           --> 20
-

-(In this manual, ---> indicates the result of the preceding expression.) - - - - - -

3.4.6 – Concatenation

-The string concatenation operator in Lua is -denoted by two dots ('..'). -If both operands are strings or numbers, then they are converted to -strings according to the rules described in §3.4.3. -Otherwise, the __concat metamethod is called (see §2.4). - - - - - -

3.4.7 – The Length Operator

- -

-The length operator is denoted by the unary prefix operator #. - - -

-The length of a string is its number of bytes -(that is, the usual meaning of string length when each -character is one byte). - - -

-The length operator applied on a table -returns a border in that table. -A border in a table t is any natural number -that satisfies the following condition: - -

-     (border == 0 or t[border] ~= nil) and t[border + 1] == nil
-

-In words, -a border is any (natural) index in a table -where a non-nil value is followed by a nil value -(or zero, when index 1 is nil). - - -

-A table with exactly one border is called a sequence. -For instance, the table {10, 20, 30, 40, 50} is a sequence, -as it has only one border (5). -The table {10, 20, 30, nil, 50} has two borders (3 and 5), -and therefore it is not a sequence. -The table {nil, 20, 30, nil, nil, 60, nil} -has three borders (0, 3, and 6), -so it is not a sequence, too. -The table {} is a sequence with border 0. -Note that non-natural keys do not interfere -with whether a table is a sequence. - - -

-When t is a sequence, -#t returns its only border, -which corresponds to the intuitive notion of the length of the sequence. -When t is not a sequence, -#t can return any of its borders. -(The exact one depends on details of -the internal representation of the table, -which in turn can depend on how the table was populated and -the memory addresses of its non-numeric keys.) - - -

-The computation of the length of a table -has a guaranteed worst time of O(log n), -where n is the largest natural key in the table. - - -

-A program can modify the behavior of the length operator for -any value but strings through the __len metamethod (see §2.4). - - - - - -

3.4.8 – Precedence

-Operator precedence in Lua follows the table below, -from lower to higher priority: - -

-     or
-     and
-     <     >     <=    >=    ~=    ==
-     |
-     ~
-     &
-     <<    >>
-     ..
-     +     -
-     *     /     //    %
-     unary operators (not   #     -     ~)
-     ^
-

-As usual, -you can use parentheses to change the precedences of an expression. -The concatenation ('..') and exponentiation ('^') -operators are right associative. -All other binary operators are left associative. - - - - - -

3.4.9 – Table Constructors

-Table constructors are expressions that create tables. -Every time a constructor is evaluated, a new table is created. -A constructor can be used to create an empty table -or to create a table and initialize some of its fields. -The general syntax for constructors is - -

-	tableconstructor ::= ‘{’ [fieldlist] ‘}’
-	fieldlist ::= field {fieldsep field} [fieldsep]
-	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
-	fieldsep ::= ‘,’ | ‘;’
-
- -

-Each field of the form [exp1] = exp2 adds to the new table an entry -with key exp1 and value exp2. -A field of the form name = exp is equivalent to -["name"] = exp. -Finally, fields of the form exp are equivalent to -[i] = exp, where i are consecutive integers -starting with 1. -Fields in the other formats do not affect this counting. -For example, - -

-     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
-

-is equivalent to - -

-     do
-       local t = {}
-       t[f(1)] = g
-       t[1] = "x"         -- 1st exp
-       t[2] = "y"         -- 2nd exp
-       t.x = 1            -- t["x"] = 1
-       t[3] = f(x)        -- 3rd exp
-       t[30] = 23
-       t[4] = 45          -- 4th exp
-       a = t
-     end
-
- -

-The order of the assignments in a constructor is undefined. -(This order would be relevant only when there are repeated keys.) - - -

-If the last field in the list has the form exp -and the expression is a function call or a vararg expression, -then all values returned by this expression enter the list consecutively -(see §3.4.10). - - -

-The field list can have an optional trailing separator, -as a convenience for machine-generated code. - - - - - -

3.4.10 – Function Calls

-A function call in Lua has the following syntax: - -

-	functioncall ::= prefixexp args
-

-In a function call, -first prefixexp and args are evaluated. -If the value of prefixexp has type function, -then this function is called -with the given arguments. -Otherwise, the prefixexp "call" metamethod is called, -having as first parameter the value of prefixexp, -followed by the original call arguments -(see §2.4). - - -

-The form - -

-	functioncall ::= prefixexp ‘:’ Name args
-

-can be used to call "methods". -A call v:name(args) -is syntactic sugar for v.name(v,args), -except that v is evaluated only once. - - -

-Arguments have the following syntax: - -

-	args ::= ‘(’ [explist] ‘)’
-	args ::= tableconstructor
-	args ::= LiteralString
-

-All argument expressions are evaluated before the call. -A call of the form f{fields} is -syntactic sugar for f({fields}); -that is, the argument list is a single new table. -A call of the form f'string' -(or f"string" or f[[string]]) -is syntactic sugar for f('string'); -that is, the argument list is a single literal string. - - -

-A call of the form return functioncall is called -a tail call. -Lua implements proper tail calls -(or proper tail recursion): -in a tail call, -the called function reuses the stack entry of the calling function. -Therefore, there is no limit on the number of nested tail calls that -a program can execute. -However, a tail call erases any debug information about the -calling function. -Note that a tail call only happens with a particular syntax, -where the return has one single function call as argument; -this syntax makes the calling function return exactly -the returns of the called function. -So, none of the following examples are tail calls: - -

-     return (f(x))        -- results adjusted to 1
-     return 2 * f(x)
-     return x, f(x)       -- additional results
-     f(x); return         -- results discarded
-     return x or f(x)     -- results adjusted to 1
-
- - - - -

3.4.11 – Function Definitions

- -

-The syntax for function definition is - -

-	functiondef ::= function funcbody
-	funcbody ::= ‘(’ [parlist] ‘)’ block end
-
- -

-The following syntactic sugar simplifies function definitions: - -

-	stat ::= function funcname funcbody
-	stat ::= local function Name funcbody
-	funcname ::= Name {‘.’ Name} [‘:’ Name]
-

-The statement - -

-     function f () body end
-

-translates to - -

-     f = function () body end
-

-The statement - -

-     function t.a.b.c.f () body end
-

-translates to - -

-     t.a.b.c.f = function () body end
-

-The statement - -

-     local function f () body end
-

-translates to - -

-     local f; f = function () body end
-

-not to - -

-     local f = function () body end
-

-(This only makes a difference when the body of the function -contains references to f.) - - -

-A function definition is an executable expression, -whose value has type function. -When Lua precompiles a chunk, -all its function bodies are precompiled too. -Then, whenever Lua executes the function definition, -the function is instantiated (or closed). -This function instance (or closure) -is the final value of the expression. - - -

-Parameters act as local variables that are -initialized with the argument values: - -

-	parlist ::= namelist [‘,’ ‘...’] | ‘...’
-

-When a function is called, -the list of arguments is adjusted to -the length of the list of parameters, -unless the function is a vararg function, -which is indicated by three dots ('...') -at the end of its parameter list. -A vararg function does not adjust its argument list; -instead, it collects all extra arguments and supplies them -to the function through a vararg expression, -which is also written as three dots. -The value of this expression is a list of all actual extra arguments, -similar to a function with multiple results. -If a vararg expression is used inside another expression -or in the middle of a list of expressions, -then its return list is adjusted to one element. -If the expression is used as the last element of a list of expressions, -then no adjustment is made -(unless that last expression is enclosed in parentheses). - - -

-As an example, consider the following definitions: - -

-     function f(a, b) end
-     function g(a, b, ...) end
-     function r() return 1,2,3 end
-

-Then, we have the following mapping from arguments to parameters and -to the vararg expression: - -

-     CALL            PARAMETERS
-     
-     f(3)             a=3, b=nil
-     f(3, 4)          a=3, b=4
-     f(3, 4, 5)       a=3, b=4
-     f(r(), 10)       a=1, b=10
-     f(r())           a=1, b=2
-     
-     g(3)             a=3, b=nil, ... -->  (nothing)
-     g(3, 4)          a=3, b=4,   ... -->  (nothing)
-     g(3, 4, 5, 8)    a=3, b=4,   ... -->  5  8
-     g(5, r())        a=5, b=1,   ... -->  2  3
-
- -

-Results are returned using the return statement (see §3.3.4). -If control reaches the end of a function -without encountering a return statement, -then the function returns with no results. - - -

- -There is a system-dependent limit on the number of values -that a function may return. -This limit is guaranteed to be larger than 1000. - - -

-The colon syntax -is used for defining methods, -that is, functions that have an implicit extra parameter self. -Thus, the statement - -

-     function t.a.b.c:f (params) body end
-

-is syntactic sugar for - -

-     t.a.b.c.f = function (self, params) body end
-
- - - - - - -

3.5 – Visibility Rules

- -

- -Lua is a lexically scoped language. -The scope of a local variable begins at the first statement after -its declaration and lasts until the last non-void statement -of the innermost block that includes the declaration. -Consider the following example: - -

-     x = 10                -- global variable
-     do                    -- new block
-       local x = x         -- new 'x', with value 10
-       print(x)            --> 10
-       x = x+1
-       do                  -- another block
-         local x = x+1     -- another 'x'
-         print(x)          --> 12
-       end
-       print(x)            --> 11
-     end
-     print(x)              --> 10  (the global one)
-
- -

-Notice that, in a declaration like local x = x, -the new x being declared is not in scope yet, -and so the second x refers to the outside variable. - - -

-Because of the lexical scoping rules, -local variables can be freely accessed by functions -defined inside their scope. -A local variable used by an inner function is called -an upvalue, or external local variable, -inside the inner function. - - -

-Notice that each execution of a local statement -defines new local variables. -Consider the following example: - -

-     a = {}
-     local x = 20
-     for i=1,10 do
-       local y = 0
-       a[i] = function () y=y+1; return x+y end
-     end
-

-The loop creates ten closures -(that is, ten instances of the anonymous function). -Each of these closures uses a different y variable, -while all of them share the same x. - - - - - -

4 – The Application Program Interface

- -

- -This section describes the C API for Lua, that is, -the set of C functions available to the host program to communicate -with Lua. -All API functions and related types and constants -are declared in the header file lua.h. - - -

-Even when we use the term "function", -any facility in the API may be provided as a macro instead. -Except where stated otherwise, -all such macros use each of their arguments exactly once -(except for the first argument, which is always a Lua state), -and so do not generate any hidden side-effects. - - -

-As in most C libraries, -the Lua API functions do not check their arguments for validity or consistency. -However, you can change this behavior by compiling Lua -with the macro LUA_USE_APICHECK defined. - - -

-The Lua library is fully reentrant: -it has no global variables. -It keeps all information it needs in a dynamic structure, -called the Lua state. - - -

-Each Lua state has one or more threads, -which correspond to independent, cooperative lines of execution. -The type lua_State (despite its name) refers to a thread. -(Indirectly, through the thread, it also refers to the -Lua state associated to the thread.) - - -

-A pointer to a thread must be passed as the first argument to -every function in the library, except to lua_newstate, -which creates a Lua state from scratch and returns a pointer -to the main thread in the new state. - - - -

4.1 – The Stack

- -

-Lua uses a virtual stack to pass values to and from C. -Each element in this stack represents a Lua value -(nil, number, string, etc.). -Functions in the API can access this stack through the -Lua state parameter that they receive. - - -

-Whenever Lua calls C, the called function gets a new stack, -which is independent of previous stacks and of stacks of -C functions that are still active. -This stack initially contains any arguments to the C function -and it is where the C function can store temporary -Lua values and must push its results -to be returned to the caller (see lua_CFunction). - - -

-For convenience, -most query operations in the API do not follow a strict stack discipline. -Instead, they can refer to any element in the stack -by using an index: -A positive index represents an absolute stack position -(starting at 1); -a negative index represents an offset relative to the top of the stack. -More specifically, if the stack has n elements, -then index 1 represents the first element -(that is, the element that was pushed onto the stack first) -and -index n represents the last element; -index -1 also represents the last element -(that is, the element at the top) -and index -n represents the first element. - - - - - -

4.2 – Stack Size

- -

-When you interact with the Lua API, -you are responsible for ensuring consistency. -In particular, -you are responsible for controlling stack overflow. -You can use the function lua_checkstack -to ensure that the stack has enough space for pushing new elements. - - -

-Whenever Lua calls C, -it ensures that the stack has space for -at least LUA_MINSTACK extra slots. -LUA_MINSTACK is defined as 20, -so that usually you do not have to worry about stack space -unless your code has loops pushing elements onto the stack. - - -

-When you call a Lua function -without a fixed number of results (see lua_call), -Lua ensures that the stack has enough space for all results, -but it does not ensure any extra space. -So, before pushing anything in the stack after such a call -you should use lua_checkstack. - - - - - -

4.3 – Valid and Acceptable Indices

- -

-Any function in the API that receives stack indices -works only with valid indices or acceptable indices. - - -

-A valid index is an index that refers to a -position that stores a modifiable Lua value. -It comprises stack indices between 1 and the stack top -(1 ≤ abs(index) ≤ top) - -plus pseudo-indices, -which represent some positions that are accessible to C code -but that are not in the stack. -Pseudo-indices are used to access the registry (see §4.5) -and the upvalues of a C function (see §4.4). - - -

-Functions that do not need a specific mutable position, -but only a value (e.g., query functions), -can be called with acceptable indices. -An acceptable index can be any valid index, -but it also can be any positive index after the stack top -within the space allocated for the stack, -that is, indices up to the stack size. -(Note that 0 is never an acceptable index.) -Except when noted otherwise, -functions in the API work with acceptable indices. - - -

-Acceptable indices serve to avoid extra tests -against the stack top when querying the stack. -For instance, a C function can query its third argument -without the need to first check whether there is a third argument, -that is, without the need to check whether 3 is a valid index. - - -

-For functions that can be called with acceptable indices, -any non-valid index is treated as if it -contains a value of a virtual type LUA_TNONE, -which behaves like a nil value. - - - - - -

4.4 – C Closures

- -

-When a C function is created, -it is possible to associate some values with it, -thus creating a C closure -(see lua_pushcclosure); -these values are called upvalues and are -accessible to the function whenever it is called. - - -

-Whenever a C function is called, -its upvalues are located at specific pseudo-indices. -These pseudo-indices are produced by the macro -lua_upvalueindex. -The first upvalue associated with a function is at index -lua_upvalueindex(1), and so on. -Any access to lua_upvalueindex(n), -where n is greater than the number of upvalues of the -current function -(but not greater than 256, -which is one plus the maximum number of upvalues in a closure), -produces an acceptable but invalid index. - - - - - -

4.5 – Registry

- -

-Lua provides a registry, -a predefined table that can be used by any C code to -store whatever Lua values it needs to store. -The registry table is always located at pseudo-index -LUA_REGISTRYINDEX. -Any C library can store data into this table, -but it must take care to choose keys -that are different from those used -by other libraries, to avoid collisions. -Typically, you should use as key a string containing your library name, -or a light userdata with the address of a C object in your code, -or any Lua object created by your code. -As with variable names, -string keys starting with an underscore followed by -uppercase letters are reserved for Lua. - - -

-The integer keys in the registry are used -by the reference mechanism (see luaL_ref) -and by some predefined values. -Therefore, integer keys must not be used for other purposes. - - -

-When you create a new Lua state, -its registry comes with some predefined values. -These predefined values are indexed with integer keys -defined as constants in lua.h. -The following constants are defined: - -

    -
  • LUA_RIDX_MAINTHREAD: At this index the registry has -the main thread of the state. -(The main thread is the one created together with the state.) -
  • - -
  • LUA_RIDX_GLOBALS: At this index the registry has -the global environment. -
  • -
- - - - -

4.6 – Error Handling in C

- -

-Internally, Lua uses the C longjmp facility to handle errors. -(Lua will use exceptions if you compile it as C++; -search for LUAI_THROW in the source code for details.) -When Lua faces any error -(such as a memory allocation error or a type error) -it raises an error; -that is, it does a long jump. -A protected environment uses setjmp -to set a recovery point; -any error jumps to the most recent active recovery point. - - -

-Inside a C function you can raise an error by calling lua_error. - - -

-Most functions in the API can raise an error, -for instance due to a memory allocation error. -The documentation for each function indicates whether -it can raise errors. - - -

-If an error happens outside any protected environment, -Lua calls a panic function (see lua_atpanic) -and then calls abort, -thus exiting the host application. -Your panic function can avoid this exit by -never returning -(e.g., doing a long jump to your own recovery point outside Lua). - - -

-The panic function, -as its name implies, -is a mechanism of last resort. -Programs should avoid it. -As a general rule, -when a C function is called by Lua with a Lua state, -it can do whatever it wants on that Lua state, -as it should be already protected. -However, -when C code operates on other Lua states -(e.g., a Lua parameter to the function, -a Lua state stored in the registry, or -the result of lua_newthread), -it should use them only in API calls that cannot raise errors. - - -

-The panic function runs as if it were a message handler (see §2.3); -in particular, the error object is at the top of the stack. -However, there is no guarantee about stack space. -To push anything on the stack, -the panic function must first check the available space (see §4.2). - - - - - -

4.7 – Handling Yields in C

- -

-Internally, Lua uses the C longjmp facility to yield a coroutine. -Therefore, if a C function foo calls an API function -and this API function yields -(directly or indirectly by calling another function that yields), -Lua cannot return to foo any more, -because the longjmp removes its frame from the C stack. - - -

-To avoid this kind of problem, -Lua raises an error whenever it tries to yield across an API call, -except for three functions: -lua_yieldk, lua_callk, and lua_pcallk. -All those functions receive a continuation function -(as a parameter named k) to continue execution after a yield. - - -

-We need to set some terminology to explain continuations. -We have a C function called from Lua which we will call -the original function. -This original function then calls one of those three functions in the C API, -which we will call the callee function, -that then yields the current thread. -(This can happen when the callee function is lua_yieldk, -or when the callee function is either lua_callk or lua_pcallk -and the function called by them yields.) - - -

-Suppose the running thread yields while executing the callee function. -After the thread resumes, -it eventually will finish running the callee function. -However, -the callee function cannot return to the original function, -because its frame in the C stack was destroyed by the yield. -Instead, Lua calls a continuation function, -which was given as an argument to the callee function. -As the name implies, -the continuation function should continue the task -of the original function. - - -

-As an illustration, consider the following function: - -

-     int original_function (lua_State *L) {
-       ...     /* code 1 */
-       status = lua_pcall(L, n, m, h);  /* calls Lua */
-       ...     /* code 2 */
-     }
-

-Now we want to allow -the Lua code being run by lua_pcall to yield. -First, we can rewrite our function like here: - -

-     int k (lua_State *L, int status, lua_KContext ctx) {
-       ...  /* code 2 */
-     }
-     
-     int original_function (lua_State *L) {
-       ...     /* code 1 */
-       return k(L, lua_pcall(L, n, m, h), ctx);
-     }
-

-In the above code, -the new function k is a -continuation function (with type lua_KFunction), -which should do all the work that the original function -was doing after calling lua_pcall. -Now, we must inform Lua that it must call k if the Lua code -being executed by lua_pcall gets interrupted in some way -(errors or yielding), -so we rewrite the code as here, -replacing lua_pcall by lua_pcallk: - -

-     int original_function (lua_State *L) {
-       ...     /* code 1 */
-       return k(L, lua_pcallk(L, n, m, h, ctx2, k), ctx1);
-     }
-

-Note the external, explicit call to the continuation: -Lua will call the continuation only if needed, that is, -in case of errors or resuming after a yield. -If the called function returns normally without ever yielding, -lua_pcallk (and lua_callk) will also return normally. -(Of course, instead of calling the continuation in that case, -you can do the equivalent work directly inside the original function.) - - -

-Besides the Lua state, -the continuation function has two other parameters: -the final status of the call plus the context value (ctx) that -was passed originally to lua_pcallk. -(Lua does not use this context value; -it only passes this value from the original function to the -continuation function.) -For lua_pcallk, -the status is the same value that would be returned by lua_pcallk, -except that it is LUA_YIELD when being executed after a yield -(instead of LUA_OK). -For lua_yieldk and lua_callk, -the status is always LUA_YIELD when Lua calls the continuation. -(For these two functions, -Lua will not call the continuation in case of errors, -because they do not handle errors.) -Similarly, when using lua_callk, -you should call the continuation function -with LUA_OK as the status. -(For lua_yieldk, there is not much point in calling -directly the continuation function, -because lua_yieldk usually does not return.) - - -

-Lua treats the continuation function as if it were the original function. -The continuation function receives the same Lua stack -from the original function, -in the same state it would be if the callee function had returned. -(For instance, -after a lua_callk the function and its arguments are -removed from the stack and replaced by the results from the call.) -It also has the same upvalues. -Whatever it returns is handled by Lua as if it were the return -of the original function. - - - - - -

4.8 – Functions and Types

- -

-Here we list all functions and types from the C API in -alphabetical order. -Each function has an indicator like this: -[-o, +p, x] - - -

-The first field, o, -is how many elements the function pops from the stack. -The second field, p, -is how many elements the function pushes onto the stack. -(Any function always pushes its results after popping its arguments.) -A field in the form x|y means the function can push (or pop) -x or y elements, -depending on the situation; -an interrogation mark '?' means that -we cannot know how many elements the function pops/pushes -by looking only at its arguments -(e.g., they may depend on what is on the stack). -The third field, x, -tells whether the function may raise errors: -'-' means the function never raises any error; -'m' means the function may raise out-of-memory errors -and errors running a __gc metamethod; -'e' means the function may raise any errors -(it can run arbitrary Lua code, -either directly or through metamethods); -'v' means the function may raise an error on purpose. - - - -


lua_absindex

-[-0, +0, –] -

int lua_absindex (lua_State *L, int idx);
- -

-Converts the acceptable index idx -into an equivalent absolute index -(that is, one that does not depend on the stack top). - - - - - -


lua_Alloc

-
typedef void * (*lua_Alloc) (void *ud,
-                             void *ptr,
-                             size_t osize,
-                             size_t nsize);
- -

-The type of the memory-allocation function used by Lua states. -The allocator function must provide a -functionality similar to realloc, -but not exactly the same. -Its arguments are -ud, an opaque pointer passed to lua_newstate; -ptr, a pointer to the block being allocated/reallocated/freed; -osize, the original size of the block or some code about what -is being allocated; -and nsize, the new size of the block. - - -

-When ptr is not NULL, -osize is the size of the block pointed by ptr, -that is, the size given when it was allocated or reallocated. - - -

-When ptr is NULL, -osize encodes the kind of object that Lua is allocating. -osize is any of -LUA_TSTRING, LUA_TTABLE, LUA_TFUNCTION, -LUA_TUSERDATA, or LUA_TTHREAD when (and only when) -Lua is creating a new object of that type. -When osize is some other value, -Lua is allocating memory for something else. - - -

-Lua assumes the following behavior from the allocator function: - - -

-When nsize is zero, -the allocator must behave like free -and return NULL. - - -

-When nsize is not zero, -the allocator must behave like realloc. -The allocator returns NULL -if and only if it cannot fulfill the request. -Lua assumes that the allocator never fails when -osize >= nsize. - - -

-Here is a simple implementation for the allocator function. -It is used in the auxiliary library by luaL_newstate. - -

-     static void *l_alloc (void *ud, void *ptr, size_t osize,
-                                                size_t nsize) {
-       (void)ud;  (void)osize;  /* not used */
-       if (nsize == 0) {
-         free(ptr);
-         return NULL;
-       }
-       else
-         return realloc(ptr, nsize);
-     }
-

-Note that Standard C ensures -that free(NULL) has no effect and that -realloc(NULL,size) is equivalent to malloc(size). -This code assumes that realloc does not fail when shrinking a block. -(Although Standard C does not ensure this behavior, -it seems to be a safe assumption.) - - - - - -


lua_arith

-[-(2|1), +1, e] -

void lua_arith (lua_State *L, int op);
- -

-Performs an arithmetic or bitwise operation over the two values -(or one, in the case of negations) -at the top of the stack, -with the value at the top being the second operand, -pops these values, and pushes the result of the operation. -The function follows the semantics of the corresponding Lua operator -(that is, it may call metamethods). - - -

-The value of op must be one of the following constants: - -

- - - - -

lua_atpanic

-[-0, +0, –] -

lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
- -

-Sets a new panic function and returns the old one (see §4.6). - - - - - -


lua_call

-[-(nargs+1), +nresults, e] -

void lua_call (lua_State *L, int nargs, int nresults);
- -

-Calls a function. - - -

-To call a function you must use the following protocol: -first, the function to be called is pushed onto the stack; -then, the arguments to the function are pushed -in direct order; -that is, the first argument is pushed first. -Finally you call lua_call; -nargs is the number of arguments that you pushed onto the stack. -All arguments and the function value are popped from the stack -when the function is called. -The function results are pushed onto the stack when the function returns. -The number of results is adjusted to nresults, -unless nresults is LUA_MULTRET. -In this case, all results from the function are pushed; -Lua takes care that the returned values fit into the stack space, -but it does not ensure any extra space in the stack. -The function results are pushed onto the stack in direct order -(the first result is pushed first), -so that after the call the last result is on the top of the stack. - - -

-Any error inside the called function is propagated upwards -(with a longjmp). - - -

-The following example shows how the host program can do the -equivalent to this Lua code: - -

-     a = f("how", t.x, 14)
-

-Here it is in C: - -

-     lua_getglobal(L, "f");                  /* function to be called */
-     lua_pushliteral(L, "how");                       /* 1st argument */
-     lua_getglobal(L, "t");                    /* table to be indexed */
-     lua_getfield(L, -1, "x");        /* push result of t.x (2nd arg) */
-     lua_remove(L, -2);                  /* remove 't' from the stack */
-     lua_pushinteger(L, 14);                          /* 3rd argument */
-     lua_call(L, 3, 1);     /* call 'f' with 3 arguments and 1 result */
-     lua_setglobal(L, "a");                         /* set global 'a' */
-

-Note that the code above is balanced: -at its end, the stack is back to its original configuration. -This is considered good programming practice. - - - - - -


lua_callk

-[-(nargs + 1), +nresults, e] -

void lua_callk (lua_State *L,
-                int nargs,
-                int nresults,
-                lua_KContext ctx,
-                lua_KFunction k);
- -

-This function behaves exactly like lua_call, -but allows the called function to yield (see §4.7). - - - - - -


lua_CFunction

-
typedef int (*lua_CFunction) (lua_State *L);
- -

-Type for C functions. - - -

-In order to communicate properly with Lua, -a C function must use the following protocol, -which defines the way parameters and results are passed: -a C function receives its arguments from Lua in its stack -in direct order (the first argument is pushed first). -So, when the function starts, -lua_gettop(L) returns the number of arguments received by the function. -The first argument (if any) is at index 1 -and its last argument is at index lua_gettop(L). -To return values to Lua, a C function just pushes them onto the stack, -in direct order (the first result is pushed first), -and returns the number of results. -Any other value in the stack below the results will be properly -discarded by Lua. -Like a Lua function, a C function called by Lua can also return -many results. - - -

-As an example, the following function receives a variable number -of numeric arguments and returns their average and their sum: - -

-     static int foo (lua_State *L) {
-       int n = lua_gettop(L);    /* number of arguments */
-       lua_Number sum = 0.0;
-       int i;
-       for (i = 1; i <= n; i++) {
-         if (!lua_isnumber(L, i)) {
-           lua_pushliteral(L, "incorrect argument");
-           lua_error(L);
-         }
-         sum += lua_tonumber(L, i);
-       }
-       lua_pushnumber(L, sum/n);        /* first result */
-       lua_pushnumber(L, sum);         /* second result */
-       return 2;                   /* number of results */
-     }
-
- - - - -

lua_checkstack

-[-0, +0, –] -

int lua_checkstack (lua_State *L, int n);
- -

-Ensures that the stack has space for at least n extra slots -(that is, that you can safely push up to n values into it). -It returns false if it cannot fulfill the request, -either because it would cause the stack -to be larger than a fixed maximum size -(typically at least several thousand elements) or -because it cannot allocate memory for the extra space. -This function never shrinks the stack; -if the stack already has space for the extra slots, -it is left unchanged. - - - - - -


lua_close

-[-0, +0, –] -

void lua_close (lua_State *L);
- -

-Destroys all objects in the given Lua state -(calling the corresponding garbage-collection metamethods, if any) -and frees all dynamic memory used by this state. -On several platforms, you may not need to call this function, -because all resources are naturally released when the host program ends. -On the other hand, long-running programs that create multiple states, -such as daemons or web servers, -will probably need to close states as soon as they are not needed. - - - - - -


lua_compare

-[-0, +0, e] -

int lua_compare (lua_State *L, int index1, int index2, int op);
- -

-Compares two Lua values. -Returns 1 if the value at index index1 satisfies op -when compared with the value at index index2, -following the semantics of the corresponding Lua operator -(that is, it may call metamethods). -Otherwise returns 0. -Also returns 0 if any of the indices is not valid. - - -

-The value of op must be one of the following constants: - -

    - -
  • LUA_OPEQ: compares for equality (==)
  • -
  • LUA_OPLT: compares for less than (<)
  • -
  • LUA_OPLE: compares for less or equal (<=)
  • - -
- - - - -

lua_concat

-[-n, +1, e] -

void lua_concat (lua_State *L, int n);
- -

-Concatenates the n values at the top of the stack, -pops them, and leaves the result at the top. -If n is 1, the result is the single value on the stack -(that is, the function does nothing); -if n is 0, the result is the empty string. -Concatenation is performed following the usual semantics of Lua -(see §3.4.6). - - - - - -


lua_copy

-[-0, +0, –] -

void lua_copy (lua_State *L, int fromidx, int toidx);
- -

-Copies the element at index fromidx -into the valid index toidx, -replacing the value at that position. -Values at other positions are not affected. - - - - - -


lua_createtable

-[-0, +1, m] -

void lua_createtable (lua_State *L, int narr, int nrec);
- -

-Creates a new empty table and pushes it onto the stack. -Parameter narr is a hint for how many elements the table -will have as a sequence; -parameter nrec is a hint for how many other elements -the table will have. -Lua may use these hints to preallocate memory for the new table. -This preallocation is useful for performance when you know in advance -how many elements the table will have. -Otherwise you can use the function lua_newtable. - - - - - -


lua_dump

-[-0, +0, –] -

int lua_dump (lua_State *L,
-                        lua_Writer writer,
-                        void *data,
-                        int strip);
- -

-Dumps a function as a binary chunk. -Receives a Lua function on the top of the stack -and produces a binary chunk that, -if loaded again, -results in a function equivalent to the one dumped. -As it produces parts of the chunk, -lua_dump calls function writer (see lua_Writer) -with the given data -to write them. - - -

-If strip is true, -the binary representation may not include all debug information -about the function, -to save space. - - -

-The value returned is the error code returned by the last -call to the writer; -0 means no errors. - - -

-This function does not pop the Lua function from the stack. - - - - - -


lua_error

-[-1, +0, v] -

int lua_error (lua_State *L);
- -

-Generates a Lua error, -using the value at the top of the stack as the error object. -This function does a long jump, -and therefore never returns -(see luaL_error). - - - - - -


lua_gc

-[-0, +0, m] -

int lua_gc (lua_State *L, int what, int data);
- -

-Controls the garbage collector. - - -

-This function performs several tasks, -according to the value of the parameter what: - -

    - -
  • LUA_GCSTOP: -stops the garbage collector. -
  • - -
  • LUA_GCRESTART: -restarts the garbage collector. -
  • - -
  • LUA_GCCOLLECT: -performs a full garbage-collection cycle. -
  • - -
  • LUA_GCCOUNT: -returns the current amount of memory (in Kbytes) in use by Lua. -
  • - -
  • LUA_GCCOUNTB: -returns the remainder of dividing the current amount of bytes of -memory in use by Lua by 1024. -
  • - -
  • LUA_GCSTEP: -performs an incremental step of garbage collection. -
  • - -
  • LUA_GCSETPAUSE: -sets data as the new value -for the pause of the collector (see §2.5) -and returns the previous value of the pause. -
  • - -
  • LUA_GCSETSTEPMUL: -sets data as the new value for the step multiplier of -the collector (see §2.5) -and returns the previous value of the step multiplier. -
  • - -
  • LUA_GCISRUNNING: -returns a boolean that tells whether the collector is running -(i.e., not stopped). -
  • - -
- -

-For more details about these options, -see collectgarbage. - - - - - -


lua_getallocf

-[-0, +0, –] -

lua_Alloc lua_getallocf (lua_State *L, void **ud);
- -

-Returns the memory-allocation function of a given state. -If ud is not NULL, Lua stores in *ud the -opaque pointer given when the memory-allocator function was set. - - - - - -


lua_getfield

-[-0, +1, e] -

int lua_getfield (lua_State *L, int index, const char *k);
- -

-Pushes onto the stack the value t[k], -where t is the value at the given index. -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.4). - - -

-Returns the type of the pushed value. - - - - - -


lua_getextraspace

-[-0, +0, –] -

void *lua_getextraspace (lua_State *L);
- -

-Returns a pointer to a raw memory area associated with the -given Lua state. -The application can use this area for any purpose; -Lua does not use it for anything. - - -

-Each new thread has this area initialized with a copy -of the area of the main thread. - - -

-By default, this area has the size of a pointer to void, -but you can recompile Lua with a different size for this area. -(See LUA_EXTRASPACE in luaconf.h.) - - - - - -


lua_getglobal

-[-0, +1, e] -

int lua_getglobal (lua_State *L, const char *name);
- -

-Pushes onto the stack the value of the global name. -Returns the type of that value. - - - - - -


lua_geti

-[-0, +1, e] -

int lua_geti (lua_State *L, int index, lua_Integer i);
- -

-Pushes onto the stack the value t[i], -where t is the value at the given index. -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.4). - - -

-Returns the type of the pushed value. - - - - - -


lua_getmetatable

-[-0, +(0|1), –] -

int lua_getmetatable (lua_State *L, int index);
- -

-If the value at the given index has a metatable, -the function pushes that metatable onto the stack and returns 1. -Otherwise, -the function returns 0 and pushes nothing on the stack. - - - - - -


lua_gettable

-[-1, +1, e] -

int lua_gettable (lua_State *L, int index);
- -

-Pushes onto the stack the value t[k], -where t is the value at the given index -and k is the value at the top of the stack. - - -

-This function pops the key from the stack, -pushing the resulting value in its place. -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.4). - - -

-Returns the type of the pushed value. - - - - - -


lua_gettop

-[-0, +0, –] -

int lua_gettop (lua_State *L);
- -

-Returns the index of the top element in the stack. -Because indices start at 1, -this result is equal to the number of elements in the stack; -in particular, 0 means an empty stack. - - - - - -


lua_getuservalue

-[-0, +1, –] -

int lua_getuservalue (lua_State *L, int index);
- -

-Pushes onto the stack the Lua value associated with the full userdata -at the given index. - - -

-Returns the type of the pushed value. - - - - - -


lua_insert

-[-1, +1, –] -

void lua_insert (lua_State *L, int index);
- -

-Moves the top element into the given valid index, -shifting up the elements above this index to open space. -This function cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_Integer

-
typedef ... lua_Integer;
- -

-The type of integers in Lua. - - -

-By default this type is long long, -(usually a 64-bit two-complement integer), -but that can be changed to long or int -(usually a 32-bit two-complement integer). -(See LUA_INT_TYPE in luaconf.h.) - - -

-Lua also defines the constants -LUA_MININTEGER and LUA_MAXINTEGER, -with the minimum and the maximum values that fit in this type. - - - - - -


lua_isboolean

-[-0, +0, –] -

int lua_isboolean (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a boolean, -and 0 otherwise. - - - - - -


lua_iscfunction

-[-0, +0, –] -

int lua_iscfunction (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a C function, -and 0 otherwise. - - - - - -


lua_isfunction

-[-0, +0, –] -

int lua_isfunction (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a function -(either C or Lua), and 0 otherwise. - - - - - -


lua_isinteger

-[-0, +0, –] -

int lua_isinteger (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is an integer -(that is, the value is a number and is represented as an integer), -and 0 otherwise. - - - - - -


lua_islightuserdata

-[-0, +0, –] -

int lua_islightuserdata (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a light userdata, -and 0 otherwise. - - - - - -


lua_isnil

-[-0, +0, –] -

int lua_isnil (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is nil, -and 0 otherwise. - - - - - -


lua_isnone

-[-0, +0, –] -

int lua_isnone (lua_State *L, int index);
- -

-Returns 1 if the given index is not valid, -and 0 otherwise. - - - - - -


lua_isnoneornil

-[-0, +0, –] -

int lua_isnoneornil (lua_State *L, int index);
- -

-Returns 1 if the given index is not valid -or if the value at this index is nil, -and 0 otherwise. - - - - - -


lua_isnumber

-[-0, +0, –] -

int lua_isnumber (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a number -or a string convertible to a number, -and 0 otherwise. - - - - - -


lua_isstring

-[-0, +0, –] -

int lua_isstring (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a string -or a number (which is always convertible to a string), -and 0 otherwise. - - - - - -


lua_istable

-[-0, +0, –] -

int lua_istable (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a table, -and 0 otherwise. - - - - - -


lua_isthread

-[-0, +0, –] -

int lua_isthread (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a thread, -and 0 otherwise. - - - - - -


lua_isuserdata

-[-0, +0, –] -

int lua_isuserdata (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a userdata -(either full or light), and 0 otherwise. - - - - - -


lua_isyieldable

-[-0, +0, –] -

int lua_isyieldable (lua_State *L);
- -

-Returns 1 if the given coroutine can yield, -and 0 otherwise. - - - - - -


lua_KContext

-
typedef ... lua_KContext;
- -

-The type for continuation-function contexts. -It must be a numeric type. -This type is defined as intptr_t -when intptr_t is available, -so that it can store pointers too. -Otherwise, it is defined as ptrdiff_t. - - - - - -


lua_KFunction

-
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
- -

-Type for continuation functions (see §4.7). - - - - - -


lua_len

-[-0, +1, e] -

void lua_len (lua_State *L, int index);
- -

-Returns the length of the value at the given index. -It is equivalent to the '#' operator in Lua (see §3.4.7) and -may trigger a metamethod for the "length" event (see §2.4). -The result is pushed on the stack. - - - - - -


lua_load

-[-0, +1, –] -

int lua_load (lua_State *L,
-              lua_Reader reader,
-              void *data,
-              const char *chunkname,
-              const char *mode);
- -

-Loads a Lua chunk without running it. -If there are no errors, -lua_load pushes the compiled chunk as a Lua -function on top of the stack. -Otherwise, it pushes an error message. - - -

-The return values of lua_load are: - -

    - -
  • LUA_OK: no errors;
  • - -
  • LUA_ERRSYNTAX: -syntax error during precompilation;
  • - -
  • LUA_ERRMEM: -memory allocation (out-of-memory) error;
  • - -
  • LUA_ERRGCMM: -error while running a __gc metamethod. -(This error has no relation with the chunk being loaded. -It is generated by the garbage collector.) -
  • - -
- -

-The lua_load function uses a user-supplied reader function -to read the chunk (see lua_Reader). -The data argument is an opaque value passed to the reader function. - - -

-The chunkname argument gives a name to the chunk, -which is used for error messages and in debug information (see §4.9). - - -

-lua_load automatically detects whether the chunk is text or binary -and loads it accordingly (see program luac). -The string mode works as in function load, -with the addition that -a NULL value is equivalent to the string "bt". - - -

-lua_load uses the stack internally, -so the reader function must always leave the stack -unmodified when returning. - - -

-If the resulting function has upvalues, -its first upvalue is set to the value of the global environment -stored at index LUA_RIDX_GLOBALS in the registry (see §4.5). -When loading main chunks, -this upvalue will be the _ENV variable (see §2.2). -Other upvalues are initialized with nil. - - - - - -


lua_newstate

-[-0, +0, –] -

lua_State *lua_newstate (lua_Alloc f, void *ud);
- -

-Creates a new thread running in a new, independent state. -Returns NULL if it cannot create the thread or the state -(due to lack of memory). -The argument f is the allocator function; -Lua does all memory allocation for this state -through this function (see lua_Alloc). -The second argument, ud, is an opaque pointer that Lua -passes to the allocator in every call. - - - - - -


lua_newtable

-[-0, +1, m] -

void lua_newtable (lua_State *L);
- -

-Creates a new empty table and pushes it onto the stack. -It is equivalent to lua_createtable(L, 0, 0). - - - - - -


lua_newthread

-[-0, +1, m] -

lua_State *lua_newthread (lua_State *L);
- -

-Creates a new thread, pushes it on the stack, -and returns a pointer to a lua_State that represents this new thread. -The new thread returned by this function shares with the original thread -its global environment, -but has an independent execution stack. - - -

-There is no explicit function to close or to destroy a thread. -Threads are subject to garbage collection, -like any Lua object. - - - - - -


lua_newuserdata

-[-0, +1, m] -

void *lua_newuserdata (lua_State *L, size_t size);
- -

-This function allocates a new block of memory with the given size, -pushes onto the stack a new full userdata with the block address, -and returns this address. -The host program can freely use this memory. - - - - - -


lua_next

-[-1, +(2|0), e] -

int lua_next (lua_State *L, int index);
- -

-Pops a key from the stack, -and pushes a key–value pair from the table at the given index -(the "next" pair after the given key). -If there are no more elements in the table, -then lua_next returns 0 (and pushes nothing). - - -

-A typical traversal looks like this: - -

-     /* table is in the stack at index 't' */
-     lua_pushnil(L);  /* first key */
-     while (lua_next(L, t) != 0) {
-       /* uses 'key' (at index -2) and 'value' (at index -1) */
-       printf("%s - %s\n",
-              lua_typename(L, lua_type(L, -2)),
-              lua_typename(L, lua_type(L, -1)));
-       /* removes 'value'; keeps 'key' for next iteration */
-       lua_pop(L, 1);
-     }
-
- -

-While traversing a table, -do not call lua_tolstring directly on a key, -unless you know that the key is actually a string. -Recall that lua_tolstring may change -the value at the given index; -this confuses the next call to lua_next. - - -

-See function next for the caveats of modifying -the table during its traversal. - - - - - -


lua_Number

-
typedef ... lua_Number;
- -

-The type of floats in Lua. - - -

-By default this type is double, -but that can be changed to a single float or a long double. -(See LUA_FLOAT_TYPE in luaconf.h.) - - - - - -


lua_numbertointeger

-
int lua_numbertointeger (lua_Number n, lua_Integer *p);
- -

-Converts a Lua float to a Lua integer. -This macro assumes that n has an integral value. -If that value is within the range of Lua integers, -it is converted to an integer and assigned to *p. -The macro results in a boolean indicating whether the -conversion was successful. -(Note that this range test can be tricky to do -correctly without this macro, -due to roundings.) - - -

-This macro may evaluate its arguments more than once. - - - - - -


lua_pcall

-[-(nargs + 1), +(nresults|1), –] -

int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);
- -

-Calls a function in protected mode. - - -

-Both nargs and nresults have the same meaning as -in lua_call. -If there are no errors during the call, -lua_pcall behaves exactly like lua_call. -However, if there is any error, -lua_pcall catches it, -pushes a single value on the stack (the error object), -and returns an error code. -Like lua_call, -lua_pcall always removes the function -and its arguments from the stack. - - -

-If msgh is 0, -then the error object returned on the stack -is exactly the original error object. -Otherwise, msgh is the stack index of a -message handler. -(This index cannot be a pseudo-index.) -In case of runtime errors, -this function will be called with the error object -and its return value will be the object -returned on the stack by lua_pcall. - - -

-Typically, the message handler is used to add more debug -information to the error object, such as a stack traceback. -Such information cannot be gathered after the return of lua_pcall, -since by then the stack has unwound. - - -

-The lua_pcall function returns one of the following constants -(defined in lua.h): - -

    - -
  • LUA_OK (0): -success.
  • - -
  • LUA_ERRRUN: -a runtime error. -
  • - -
  • LUA_ERRMEM: -memory allocation error. -For such errors, Lua does not call the message handler. -
  • - -
  • LUA_ERRERR: -error while running the message handler. -
  • - -
  • LUA_ERRGCMM: -error while running a __gc metamethod. -For such errors, Lua does not call the message handler -(as this kind of error typically has no relation -with the function being called). -
  • - -
- - - - -

lua_pcallk

-[-(nargs + 1), +(nresults|1), –] -

int lua_pcallk (lua_State *L,
-                int nargs,
-                int nresults,
-                int msgh,
-                lua_KContext ctx,
-                lua_KFunction k);
- -

-This function behaves exactly like lua_pcall, -but allows the called function to yield (see §4.7). - - - - - -


lua_pop

-[-n, +0, –] -

void lua_pop (lua_State *L, int n);
- -

-Pops n elements from the stack. - - - - - -


lua_pushboolean

-[-0, +1, –] -

void lua_pushboolean (lua_State *L, int b);
- -

-Pushes a boolean value with value b onto the stack. - - - - - -


lua_pushcclosure

-[-n, +1, m] -

void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
- -

-Pushes a new C closure onto the stack. - - -

-When a C function is created, -it is possible to associate some values with it, -thus creating a C closure (see §4.4); -these values are then accessible to the function whenever it is called. -To associate values with a C function, -first these values must be pushed onto the stack -(when there are multiple values, the first value is pushed first). -Then lua_pushcclosure -is called to create and push the C function onto the stack, -with the argument n telling how many values will be -associated with the function. -lua_pushcclosure also pops these values from the stack. - - -

-The maximum value for n is 255. - - -

-When n is zero, -this function creates a light C function, -which is just a pointer to the C function. -In that case, it never raises a memory error. - - - - - -


lua_pushcfunction

-[-0, +1, –] -

void lua_pushcfunction (lua_State *L, lua_CFunction f);
- -

-Pushes a C function onto the stack. -This function receives a pointer to a C function -and pushes onto the stack a Lua value of type function that, -when called, invokes the corresponding C function. - - -

-Any function to be callable by Lua must -follow the correct protocol to receive its parameters -and return its results (see lua_CFunction). - - - - - -


lua_pushfstring

-[-0, +1, e] -

const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
- -

-Pushes onto the stack a formatted string -and returns a pointer to this string. -It is similar to the ISO C function sprintf, -but has some important differences: - -

    - -
  • -You do not have to allocate space for the result: -the result is a Lua string and Lua takes care of memory allocation -(and deallocation, through garbage collection). -
  • - -
  • -The conversion specifiers are quite restricted. -There are no flags, widths, or precisions. -The conversion specifiers can only be -'%%' (inserts the character '%'), -'%s' (inserts a zero-terminated string, with no size restrictions), -'%f' (inserts a lua_Number), -'%I' (inserts a lua_Integer), -'%p' (inserts a pointer as a hexadecimal numeral), -'%d' (inserts an int), -'%c' (inserts an int as a one-byte character), and -'%U' (inserts a long int as a UTF-8 byte sequence). -
  • - -
- -

-Unlike other push functions, -this function checks for the stack space it needs, -including the slot for its result. - - - - - -


lua_pushglobaltable

-[-0, +1, –] -

void lua_pushglobaltable (lua_State *L);
- -

-Pushes the global environment onto the stack. - - - - - -


lua_pushinteger

-[-0, +1, –] -

void lua_pushinteger (lua_State *L, lua_Integer n);
- -

-Pushes an integer with value n onto the stack. - - - - - -


lua_pushlightuserdata

-[-0, +1, –] -

void lua_pushlightuserdata (lua_State *L, void *p);
- -

-Pushes a light userdata onto the stack. - - -

-Userdata represent C values in Lua. -A light userdata represents a pointer, a void*. -It is a value (like a number): -you do not create it, it has no individual metatable, -and it is not collected (as it was never created). -A light userdata is equal to "any" -light userdata with the same C address. - - - - - -


lua_pushliteral

-[-0, +1, m] -

const char *lua_pushliteral (lua_State *L, const char *s);
- -

-This macro is equivalent to lua_pushstring, -but should be used only when s is a literal string. - - - - - -


lua_pushlstring

-[-0, +1, m] -

const char *lua_pushlstring (lua_State *L, const char *s, size_t len);
- -

-Pushes the string pointed to by s with size len -onto the stack. -Lua makes (or reuses) an internal copy of the given string, -so the memory at s can be freed or reused immediately after -the function returns. -The string can contain any binary data, -including embedded zeros. - - -

-Returns a pointer to the internal copy of the string. - - - - - -


lua_pushnil

-[-0, +1, –] -

void lua_pushnil (lua_State *L);
- -

-Pushes a nil value onto the stack. - - - - - -


lua_pushnumber

-[-0, +1, –] -

void lua_pushnumber (lua_State *L, lua_Number n);
- -

-Pushes a float with value n onto the stack. - - - - - -


lua_pushstring

-[-0, +1, m] -

const char *lua_pushstring (lua_State *L, const char *s);
- -

-Pushes the zero-terminated string pointed to by s -onto the stack. -Lua makes (or reuses) an internal copy of the given string, -so the memory at s can be freed or reused immediately after -the function returns. - - -

-Returns a pointer to the internal copy of the string. - - -

-If s is NULL, pushes nil and returns NULL. - - - - - -


lua_pushthread

-[-0, +1, –] -

int lua_pushthread (lua_State *L);
- -

-Pushes the thread represented by L onto the stack. -Returns 1 if this thread is the main thread of its state. - - - - - -


lua_pushvalue

-[-0, +1, –] -

void lua_pushvalue (lua_State *L, int index);
- -

-Pushes a copy of the element at the given index -onto the stack. - - - - - -


lua_pushvfstring

-[-0, +1, m] -

const char *lua_pushvfstring (lua_State *L,
-                              const char *fmt,
-                              va_list argp);
- -

-Equivalent to lua_pushfstring, except that it receives a va_list -instead of a variable number of arguments. - - - - - -


lua_rawequal

-[-0, +0, –] -

int lua_rawequal (lua_State *L, int index1, int index2);
- -

-Returns 1 if the two values in indices index1 and -index2 are primitively equal -(that is, without calling the __eq metamethod). -Otherwise returns 0. -Also returns 0 if any of the indices are not valid. - - - - - -


lua_rawget

-[-1, +1, –] -

int lua_rawget (lua_State *L, int index);
- -

-Similar to lua_gettable, but does a raw access -(i.e., without metamethods). - - - - - -


lua_rawgeti

-[-0, +1, –] -

int lua_rawgeti (lua_State *L, int index, lua_Integer n);
- -

-Pushes onto the stack the value t[n], -where t is the table at the given index. -The access is raw, -that is, it does not invoke the __index metamethod. - - -

-Returns the type of the pushed value. - - - - - -


lua_rawgetp

-[-0, +1, –] -

int lua_rawgetp (lua_State *L, int index, const void *p);
- -

-Pushes onto the stack the value t[k], -where t is the table at the given index and -k is the pointer p represented as a light userdata. -The access is raw; -that is, it does not invoke the __index metamethod. - - -

-Returns the type of the pushed value. - - - - - -


lua_rawlen

-[-0, +0, –] -

size_t lua_rawlen (lua_State *L, int index);
- -

-Returns the raw "length" of the value at the given index: -for strings, this is the string length; -for tables, this is the result of the length operator ('#') -with no metamethods; -for userdata, this is the size of the block of memory allocated -for the userdata; -for other values, it is 0. - - - - - -


lua_rawset

-[-2, +0, m] -

void lua_rawset (lua_State *L, int index);
- -

-Similar to lua_settable, but does a raw assignment -(i.e., without metamethods). - - - - - -


lua_rawseti

-[-1, +0, m] -

void lua_rawseti (lua_State *L, int index, lua_Integer i);
- -

-Does the equivalent of t[i] = v, -where t is the table at the given index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -The assignment is raw, -that is, it does not invoke the __newindex metamethod. - - - - - -


lua_rawsetp

-[-1, +0, m] -

void lua_rawsetp (lua_State *L, int index, const void *p);
- -

-Does the equivalent of t[p] = v, -where t is the table at the given index, -p is encoded as a light userdata, -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -The assignment is raw, -that is, it does not invoke __newindex metamethod. - - - - - -


lua_Reader

-
typedef const char * (*lua_Reader) (lua_State *L,
-                                    void *data,
-                                    size_t *size);
- -

-The reader function used by lua_load. -Every time it needs another piece of the chunk, -lua_load calls the reader, -passing along its data parameter. -The reader must return a pointer to a block of memory -with a new piece of the chunk -and set size to the block size. -The block must exist until the reader function is called again. -To signal the end of the chunk, -the reader must return NULL or set size to zero. -The reader function may return pieces of any size greater than zero. - - - - - -


lua_register

-[-0, +0, e] -

void lua_register (lua_State *L, const char *name, lua_CFunction f);
- -

-Sets the C function f as the new value of global name. -It is defined as a macro: - -

-     #define lua_register(L,n,f) \
-            (lua_pushcfunction(L, f), lua_setglobal(L, n))
-
- - - - -

lua_remove

-[-1, +0, –] -

void lua_remove (lua_State *L, int index);
- -

-Removes the element at the given valid index, -shifting down the elements above this index to fill the gap. -This function cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_replace

-[-1, +0, –] -

void lua_replace (lua_State *L, int index);
- -

-Moves the top element into the given valid index -without shifting any element -(therefore replacing the value at that given index), -and then pops the top element. - - - - - -


lua_resume

-[-?, +?, –] -

int lua_resume (lua_State *L, lua_State *from, int nargs);
- -

-Starts and resumes a coroutine in the given thread L. - - -

-To start a coroutine, -you push onto the thread stack the main function plus any arguments; -then you call lua_resume, -with nargs being the number of arguments. -This call returns when the coroutine suspends or finishes its execution. -When it returns, the stack contains all values passed to lua_yield, -or all values returned by the body function. -lua_resume returns -LUA_YIELD if the coroutine yields, -LUA_OK if the coroutine finishes its execution -without errors, -or an error code in case of errors (see lua_pcall). - - -

-In case of errors, -the stack is not unwound, -so you can use the debug API over it. -The error object is on the top of the stack. - - -

-To resume a coroutine, -you remove any results from the last lua_yield, -put on its stack only the values to -be passed as results from yield, -and then call lua_resume. - - -

-The parameter from represents the coroutine that is resuming L. -If there is no such coroutine, -this parameter can be NULL. - - - - - -


lua_rotate

-[-0, +0, –] -

void lua_rotate (lua_State *L, int idx, int n);
- -

-Rotates the stack elements between the valid index idx -and the top of the stack. -The elements are rotated n positions in the direction of the top, -for a positive n, -or -n positions in the direction of the bottom, -for a negative n. -The absolute value of n must not be greater than the size -of the slice being rotated. -This function cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_setallocf

-[-0, +0, –] -

void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
- -

-Changes the allocator function of a given state to f -with user data ud. - - - - - -


lua_setfield

-[-1, +0, e] -

void lua_setfield (lua_State *L, int index, const char *k);
- -

-Does the equivalent to t[k] = v, -where t is the value at the given index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.4). - - - - - -


lua_setglobal

-[-1, +0, e] -

void lua_setglobal (lua_State *L, const char *name);
- -

-Pops a value from the stack and -sets it as the new value of global name. - - - - - -


lua_seti

-[-1, +0, e] -

void lua_seti (lua_State *L, int index, lua_Integer n);
- -

-Does the equivalent to t[n] = v, -where t is the value at the given index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.4). - - - - - -


lua_setmetatable

-[-1, +0, –] -

void lua_setmetatable (lua_State *L, int index);
- -

-Pops a table from the stack and -sets it as the new metatable for the value at the given index. - - - - - -


lua_settable

-[-2, +0, e] -

void lua_settable (lua_State *L, int index);
- -

-Does the equivalent to t[k] = v, -where t is the value at the given index, -v is the value at the top of the stack, -and k is the value just below the top. - - -

-This function pops both the key and the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.4). - - - - - -


lua_settop

-[-?, +?, –] -

void lua_settop (lua_State *L, int index);
- -

-Accepts any index, or 0, -and sets the stack top to this index. -If the new top is larger than the old one, -then the new elements are filled with nil. -If index is 0, then all stack elements are removed. - - - - - -


lua_setuservalue

-[-1, +0, –] -

void lua_setuservalue (lua_State *L, int index);
- -

-Pops a value from the stack and sets it as -the new value associated to the full userdata at the given index. - - - - - -


lua_State

-
typedef struct lua_State lua_State;
- -

-An opaque structure that points to a thread and indirectly -(through the thread) to the whole state of a Lua interpreter. -The Lua library is fully reentrant: -it has no global variables. -All information about a state is accessible through this structure. - - -

-A pointer to this structure must be passed as the first argument to -every function in the library, except to lua_newstate, -which creates a Lua state from scratch. - - - - - -


lua_status

-[-0, +0, –] -

int lua_status (lua_State *L);
- -

-Returns the status of the thread L. - - -

-The status can be 0 (LUA_OK) for a normal thread, -an error code if the thread finished the execution -of a lua_resume with an error, -or LUA_YIELD if the thread is suspended. - - -

-You can only call functions in threads with status LUA_OK. -You can resume threads with status LUA_OK -(to start a new coroutine) or LUA_YIELD -(to resume a coroutine). - - - - - -


lua_stringtonumber

-[-0, +1, –] -

size_t lua_stringtonumber (lua_State *L, const char *s);
- -

-Converts the zero-terminated string s to a number, -pushes that number into the stack, -and returns the total size of the string, -that is, its length plus one. -The conversion can result in an integer or a float, -according to the lexical conventions of Lua (see §3.1). -The string may have leading and trailing spaces and a sign. -If the string is not a valid numeral, -returns 0 and pushes nothing. -(Note that the result can be used as a boolean, -true if the conversion succeeds.) - - - - - -


lua_toboolean

-[-0, +0, –] -

int lua_toboolean (lua_State *L, int index);
- -

-Converts the Lua value at the given index to a C boolean -value (0 or 1). -Like all tests in Lua, -lua_toboolean returns true for any Lua value -different from false and nil; -otherwise it returns false. -(If you want to accept only actual boolean values, -use lua_isboolean to test the value's type.) - - - - - -


lua_tocfunction

-[-0, +0, –] -

lua_CFunction lua_tocfunction (lua_State *L, int index);
- -

-Converts a value at the given index to a C function. -That value must be a C function; -otherwise, returns NULL. - - - - - -


lua_tointeger

-[-0, +0, –] -

lua_Integer lua_tointeger (lua_State *L, int index);
- -

-Equivalent to lua_tointegerx with isnum equal to NULL. - - - - - -


lua_tointegerx

-[-0, +0, –] -

lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);
- -

-Converts the Lua value at the given index -to the signed integral type lua_Integer. -The Lua value must be an integer, -or a number or string convertible to an integer (see §3.4.3); -otherwise, lua_tointegerx returns 0. - - -

-If isnum is not NULL, -its referent is assigned a boolean value that -indicates whether the operation succeeded. - - - - - -


lua_tolstring

-[-0, +0, m] -

const char *lua_tolstring (lua_State *L, int index, size_t *len);
- -

-Converts the Lua value at the given index to a C string. -If len is not NULL, -it sets *len with the string length. -The Lua value must be a string or a number; -otherwise, the function returns NULL. -If the value is a number, -then lua_tolstring also -changes the actual value in the stack to a string. -(This change confuses lua_next -when lua_tolstring is applied to keys during a table traversal.) - - -

-lua_tolstring returns a pointer -to a string inside the Lua state. -This string always has a zero ('\0') -after its last character (as in C), -but can contain other zeros in its body. - - -

-Because Lua has garbage collection, -there is no guarantee that the pointer returned by lua_tolstring -will be valid after the corresponding Lua value is removed from the stack. - - - - - -


lua_tonumber

-[-0, +0, –] -

lua_Number lua_tonumber (lua_State *L, int index);
- -

-Equivalent to lua_tonumberx with isnum equal to NULL. - - - - - -


lua_tonumberx

-[-0, +0, –] -

lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);
- -

-Converts the Lua value at the given index -to the C type lua_Number (see lua_Number). -The Lua value must be a number or a string convertible to a number -(see §3.4.3); -otherwise, lua_tonumberx returns 0. - - -

-If isnum is not NULL, -its referent is assigned a boolean value that -indicates whether the operation succeeded. - - - - - -


lua_topointer

-[-0, +0, –] -

const void *lua_topointer (lua_State *L, int index);
- -

-Converts the value at the given index to a generic -C pointer (void*). -The value can be a userdata, a table, a thread, or a function; -otherwise, lua_topointer returns NULL. -Different objects will give different pointers. -There is no way to convert the pointer back to its original value. - - -

-Typically this function is used only for hashing and debug information. - - - - - -


lua_tostring

-[-0, +0, m] -

const char *lua_tostring (lua_State *L, int index);
- -

-Equivalent to lua_tolstring with len equal to NULL. - - - - - -


lua_tothread

-[-0, +0, –] -

lua_State *lua_tothread (lua_State *L, int index);
- -

-Converts the value at the given index to a Lua thread -(represented as lua_State*). -This value must be a thread; -otherwise, the function returns NULL. - - - - - -


lua_touserdata

-[-0, +0, –] -

void *lua_touserdata (lua_State *L, int index);
- -

-If the value at the given index is a full userdata, -returns its block address. -If the value is a light userdata, -returns its pointer. -Otherwise, returns NULL. - - - - - -


lua_type

-[-0, +0, –] -

int lua_type (lua_State *L, int index);
- -

-Returns the type of the value in the given valid index, -or LUA_TNONE for a non-valid (but acceptable) index. -The types returned by lua_type are coded by the following constants -defined in lua.h: -LUA_TNIL (0), -LUA_TNUMBER, -LUA_TBOOLEAN, -LUA_TSTRING, -LUA_TTABLE, -LUA_TFUNCTION, -LUA_TUSERDATA, -LUA_TTHREAD, -and -LUA_TLIGHTUSERDATA. - - - - - -


lua_typename

-[-0, +0, –] -

const char *lua_typename (lua_State *L, int tp);
- -

-Returns the name of the type encoded by the value tp, -which must be one the values returned by lua_type. - - - - - -


lua_Unsigned

-
typedef ... lua_Unsigned;
- -

-The unsigned version of lua_Integer. - - - - - -


lua_upvalueindex

-[-0, +0, –] -

int lua_upvalueindex (int i);
- -

-Returns the pseudo-index that represents the i-th upvalue of -the running function (see §4.4). - - - - - -


lua_version

-[-0, +0, –] -

const lua_Number *lua_version (lua_State *L);
- -

-Returns the address of the version number -(a C static variable) -stored in the Lua core. -When called with a valid lua_State, -returns the address of the version used to create that state. -When called with NULL, -returns the address of the version running the call. - - - - - -


lua_Writer

-
typedef int (*lua_Writer) (lua_State *L,
-                           const void* p,
-                           size_t sz,
-                           void* ud);
- -

-The type of the writer function used by lua_dump. -Every time it produces another piece of chunk, -lua_dump calls the writer, -passing along the buffer to be written (p), -its size (sz), -and the data parameter supplied to lua_dump. - - -

-The writer returns an error code: -0 means no errors; -any other value means an error and stops lua_dump from -calling the writer again. - - - - - -


lua_xmove

-[-?, +?, –] -

void lua_xmove (lua_State *from, lua_State *to, int n);
- -

-Exchange values between different threads of the same state. - - -

-This function pops n values from the stack from, -and pushes them onto the stack to. - - - - - -


lua_yield

-[-?, +?, e] -

int lua_yield (lua_State *L, int nresults);
- -

-This function is equivalent to lua_yieldk, -but it has no continuation (see §4.7). -Therefore, when the thread resumes, -it continues the function that called -the function calling lua_yield. - - - - - -


lua_yieldk

-[-?, +?, e] -

int lua_yieldk (lua_State *L,
-                int nresults,
-                lua_KContext ctx,
-                lua_KFunction k);
- -

-Yields a coroutine (thread). - - -

-When a C function calls lua_yieldk, -the running coroutine suspends its execution, -and the call to lua_resume that started this coroutine returns. -The parameter nresults is the number of values from the stack -that will be passed as results to lua_resume. - - -

-When the coroutine is resumed again, -Lua calls the given continuation function k to continue -the execution of the C function that yielded (see §4.7). -This continuation function receives the same stack -from the previous function, -with the n results removed and -replaced by the arguments passed to lua_resume. -Moreover, -the continuation function receives the value ctx -that was passed to lua_yieldk. - - -

-Usually, this function does not return; -when the coroutine eventually resumes, -it continues executing the continuation function. -However, there is one special case, -which is when this function is called -from inside a line or a count hook (see §4.9). -In that case, lua_yieldk should be called with no continuation -(probably in the form of lua_yield) and no results, -and the hook should return immediately after the call. -Lua will yield and, -when the coroutine resumes again, -it will continue the normal execution -of the (Lua) function that triggered the hook. - - -

-This function can raise an error if it is called from a thread -with a pending C call with no continuation function, -or it is called from a thread that is not running inside a resume -(e.g., the main thread). - - - - - - - -

4.9 – The Debug Interface

- -

-Lua has no built-in debugging facilities. -Instead, it offers a special interface -by means of functions and hooks. -This interface allows the construction of different -kinds of debuggers, profilers, and other tools -that need "inside information" from the interpreter. - - - -


lua_Debug

-
typedef struct lua_Debug {
-  int event;
-  const char *name;           /* (n) */
-  const char *namewhat;       /* (n) */
-  const char *what;           /* (S) */
-  const char *source;         /* (S) */
-  int currentline;            /* (l) */
-  int linedefined;            /* (S) */
-  int lastlinedefined;        /* (S) */
-  unsigned char nups;         /* (u) number of upvalues */
-  unsigned char nparams;      /* (u) number of parameters */
-  char isvararg;              /* (u) */
-  char istailcall;            /* (t) */
-  char short_src[LUA_IDSIZE]; /* (S) */
-  /* private part */
-  other fields
-} lua_Debug;
- -

-A structure used to carry different pieces of -information about a function or an activation record. -lua_getstack fills only the private part -of this structure, for later use. -To fill the other fields of lua_Debug with useful information, -call lua_getinfo. - - -

-The fields of lua_Debug have the following meaning: - -

    - -
  • source: -the name of the chunk that created the function. -If source starts with a '@', -it means that the function was defined in a file where -the file name follows the '@'. -If source starts with a '=', -the remainder of its contents describe the source in a user-dependent manner. -Otherwise, -the function was defined in a string where -source is that string. -
  • - -
  • short_src: -a "printable" version of source, to be used in error messages. -
  • - -
  • linedefined: -the line number where the definition of the function starts. -
  • - -
  • lastlinedefined: -the line number where the definition of the function ends. -
  • - -
  • what: -the string "Lua" if the function is a Lua function, -"C" if it is a C function, -"main" if it is the main part of a chunk. -
  • - -
  • currentline: -the current line where the given function is executing. -When no line information is available, -currentline is set to -1. -
  • - -
  • name: -a reasonable name for the given function. -Because functions in Lua are first-class values, -they do not have a fixed name: -some functions can be the value of multiple global variables, -while others can be stored only in a table field. -The lua_getinfo function checks how the function was -called to find a suitable name. -If it cannot find a name, -then name is set to NULL. -
  • - -
  • namewhat: -explains the name field. -The value of namewhat can be -"global", "local", "method", -"field", "upvalue", or "" (the empty string), -according to how the function was called. -(Lua uses the empty string when no other option seems to apply.) -
  • - -
  • istailcall: -true if this function invocation was called by a tail call. -In this case, the caller of this level is not in the stack. -
  • - -
  • nups: -the number of upvalues of the function. -
  • - -
  • nparams: -the number of fixed parameters of the function -(always 0 for C functions). -
  • - -
  • isvararg: -true if the function is a vararg function -(always true for C functions). -
  • - -
- - - - -

lua_gethook

-[-0, +0, –] -

lua_Hook lua_gethook (lua_State *L);
- -

-Returns the current hook function. - - - - - -


lua_gethookcount

-[-0, +0, –] -

int lua_gethookcount (lua_State *L);
- -

-Returns the current hook count. - - - - - -


lua_gethookmask

-[-0, +0, –] -

int lua_gethookmask (lua_State *L);
- -

-Returns the current hook mask. - - - - - -


lua_getinfo

-[-(0|1), +(0|1|2), e] -

int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
- -

-Gets information about a specific function or function invocation. - - -

-To get information about a function invocation, -the parameter ar must be a valid activation record that was -filled by a previous call to lua_getstack or -given as argument to a hook (see lua_Hook). - - -

-To get information about a function you push it onto the stack -and start the what string with the character '>'. -(In that case, -lua_getinfo pops the function from the top of the stack.) -For instance, to know in which line a function f was defined, -you can write the following code: - -

-     lua_Debug ar;
-     lua_getglobal(L, "f");  /* get global 'f' */
-     lua_getinfo(L, ">S", &ar);
-     printf("%d\n", ar.linedefined);
-
- -

-Each character in the string what -selects some fields of the structure ar to be filled or -a value to be pushed on the stack: - -

    - -
  • 'n': fills in the field name and namewhat; -
  • - -
  • 'S': -fills in the fields source, short_src, -linedefined, lastlinedefined, and what; -
  • - -
  • 'l': fills in the field currentline; -
  • - -
  • 't': fills in the field istailcall; -
  • - -
  • 'u': fills in the fields -nups, nparams, and isvararg; -
  • - -
  • 'f': -pushes onto the stack the function that is -running at the given level; -
  • - -
  • 'L': -pushes onto the stack a table whose indices are the -numbers of the lines that are valid on the function. -(A valid line is a line with some associated code, -that is, a line where you can put a break point. -Non-valid lines include empty lines and comments.) - - -

    -If this option is given together with option 'f', -its table is pushed after the function. -

  • - -
- -

-This function returns 0 on error -(for instance, an invalid option in what). - - - - - -


lua_getlocal

-[-0, +(0|1), –] -

const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
- -

-Gets information about a local variable of -a given activation record or a given function. - - -

-In the first case, -the parameter ar must be a valid activation record that was -filled by a previous call to lua_getstack or -given as argument to a hook (see lua_Hook). -The index n selects which local variable to inspect; -see debug.getlocal for details about variable indices -and names. - - -

-lua_getlocal pushes the variable's value onto the stack -and returns its name. - - -

-In the second case, ar must be NULL and the function -to be inspected must be at the top of the stack. -In this case, only parameters of Lua functions are visible -(as there is no information about what variables are active) -and no values are pushed onto the stack. - - -

-Returns NULL (and pushes nothing) -when the index is greater than -the number of active local variables. - - - - - -


lua_getstack

-[-0, +0, –] -

int lua_getstack (lua_State *L, int level, lua_Debug *ar);
- -

-Gets information about the interpreter runtime stack. - - -

-This function fills parts of a lua_Debug structure with -an identification of the activation record -of the function executing at a given level. -Level 0 is the current running function, -whereas level n+1 is the function that has called level n -(except for tail calls, which do not count on the stack). -When there are no errors, lua_getstack returns 1; -when called with a level greater than the stack depth, -it returns 0. - - - - - -


lua_getupvalue

-[-0, +(0|1), –] -

const char *lua_getupvalue (lua_State *L, int funcindex, int n);
- -

-Gets information about the n-th upvalue -of the closure at index funcindex. -It pushes the upvalue's value onto the stack -and returns its name. -Returns NULL (and pushes nothing) -when the index n is greater than the number of upvalues. - - -

-For C functions, this function uses the empty string "" -as a name for all upvalues. -(For Lua functions, -upvalues are the external local variables that the function uses, -and that are consequently included in its closure.) - - -

-Upvalues have no particular order, -as they are active through the whole function. -They are numbered in an arbitrary order. - - - - - -


lua_Hook

-
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
- -

-Type for debugging hook functions. - - -

-Whenever a hook is called, its ar argument has its field -event set to the specific event that triggered the hook. -Lua identifies these events with the following constants: -LUA_HOOKCALL, LUA_HOOKRET, -LUA_HOOKTAILCALL, LUA_HOOKLINE, -and LUA_HOOKCOUNT. -Moreover, for line events, the field currentline is also set. -To get the value of any other field in ar, -the hook must call lua_getinfo. - - -

-For call events, event can be LUA_HOOKCALL, -the normal value, or LUA_HOOKTAILCALL, for a tail call; -in this case, there will be no corresponding return event. - - -

-While Lua is running a hook, it disables other calls to hooks. -Therefore, if a hook calls back Lua to execute a function or a chunk, -this execution occurs without any calls to hooks. - - -

-Hook functions cannot have continuations, -that is, they cannot call lua_yieldk, -lua_pcallk, or lua_callk with a non-null k. - - -

-Hook functions can yield under the following conditions: -Only count and line events can yield; -to yield, a hook function must finish its execution -calling lua_yield with nresults equal to zero -(that is, with no values). - - - - - -


lua_sethook

-[-0, +0, –] -

void lua_sethook (lua_State *L, lua_Hook f, int mask, int count);
- -

-Sets the debugging hook function. - - -

-Argument f is the hook function. -mask specifies on which events the hook will be called: -it is formed by a bitwise OR of the constants -LUA_MASKCALL, -LUA_MASKRET, -LUA_MASKLINE, -and LUA_MASKCOUNT. -The count argument is only meaningful when the mask -includes LUA_MASKCOUNT. -For each event, the hook is called as explained below: - -

    - -
  • The call hook: is called when the interpreter calls a function. -The hook is called just after Lua enters the new function, -before the function gets its arguments. -
  • - -
  • The return hook: is called when the interpreter returns from a function. -The hook is called just before Lua leaves the function. -There is no standard way to access the values -to be returned by the function. -
  • - -
  • The line hook: is called when the interpreter is about to -start the execution of a new line of code, -or when it jumps back in the code (even to the same line). -(This event only happens while Lua is executing a Lua function.) -
  • - -
  • The count hook: is called after the interpreter executes every -count instructions. -(This event only happens while Lua is executing a Lua function.) -
  • - -
- -

-A hook is disabled by setting mask to zero. - - - - - -


lua_setlocal

-[-(0|1), +0, –] -

const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
- -

-Sets the value of a local variable of a given activation record. -It assigns the value at the top of the stack -to the variable and returns its name. -It also pops the value from the stack. - - -

-Returns NULL (and pops nothing) -when the index is greater than -the number of active local variables. - - -

-Parameters ar and n are as in function lua_getlocal. - - - - - -


lua_setupvalue

-[-(0|1), +0, –] -

const char *lua_setupvalue (lua_State *L, int funcindex, int n);
- -

-Sets the value of a closure's upvalue. -It assigns the value at the top of the stack -to the upvalue and returns its name. -It also pops the value from the stack. - - -

-Returns NULL (and pops nothing) -when the index n is greater than the number of upvalues. - - -

-Parameters funcindex and n are as in function lua_getupvalue. - - - - - -


lua_upvalueid

-[-0, +0, –] -

void *lua_upvalueid (lua_State *L, int funcindex, int n);
- -

-Returns a unique identifier for the upvalue numbered n -from the closure at index funcindex. - - -

-These unique identifiers allow a program to check whether different -closures share upvalues. -Lua closures that share an upvalue -(that is, that access a same external local variable) -will return identical ids for those upvalue indices. - - -

-Parameters funcindex and n are as in function lua_getupvalue, -but n cannot be greater than the number of upvalues. - - - - - -


lua_upvaluejoin

-[-0, +0, –] -

void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
-                                    int funcindex2, int n2);
- -

-Make the n1-th upvalue of the Lua closure at index funcindex1 -refer to the n2-th upvalue of the Lua closure at index funcindex2. - - - - - - - -

5 – The Auxiliary Library

- -

- -The auxiliary library provides several convenient functions -to interface C with Lua. -While the basic API provides the primitive functions for all -interactions between C and Lua, -the auxiliary library provides higher-level functions for some -common tasks. - - -

-All functions and types from the auxiliary library -are defined in header file lauxlib.h and -have a prefix luaL_. - - -

-All functions in the auxiliary library are built on -top of the basic API, -and so they provide nothing that cannot be done with that API. -Nevertheless, the use of the auxiliary library ensures -more consistency to your code. - - -

-Several functions in the auxiliary library use internally some -extra stack slots. -When a function in the auxiliary library uses less than five slots, -it does not check the stack size; -it simply assumes that there are enough slots. - - -

-Several functions in the auxiliary library are used to -check C function arguments. -Because the error message is formatted for arguments -(e.g., "bad argument #1"), -you should not use these functions for other stack values. - - -

-Functions called luaL_check* -always raise an error if the check is not satisfied. - - - -

5.1 – Functions and Types

- -

-Here we list all functions and types from the auxiliary library -in alphabetical order. - - - -


luaL_addchar

-[-?, +?, m] -

void luaL_addchar (luaL_Buffer *B, char c);
- -

-Adds the byte c to the buffer B -(see luaL_Buffer). - - - - - -


luaL_addlstring

-[-?, +?, m] -

void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
- -

-Adds the string pointed to by s with length l to -the buffer B -(see luaL_Buffer). -The string can contain embedded zeros. - - - - - -


luaL_addsize

-[-?, +?, –] -

void luaL_addsize (luaL_Buffer *B, size_t n);
- -

-Adds to the buffer B (see luaL_Buffer) -a string of length n previously copied to the -buffer area (see luaL_prepbuffer). - - - - - -


luaL_addstring

-[-?, +?, m] -

void luaL_addstring (luaL_Buffer *B, const char *s);
- -

-Adds the zero-terminated string pointed to by s -to the buffer B -(see luaL_Buffer). - - - - - -


luaL_addvalue

-[-1, +?, m] -

void luaL_addvalue (luaL_Buffer *B);
- -

-Adds the value at the top of the stack -to the buffer B -(see luaL_Buffer). -Pops the value. - - -

-This is the only function on string buffers that can (and must) -be called with an extra element on the stack, -which is the value to be added to the buffer. - - - - - -


luaL_argcheck

-[-0, +0, v] -

void luaL_argcheck (lua_State *L,
-                    int cond,
-                    int arg,
-                    const char *extramsg);
- -

-Checks whether cond is true. -If it is not, raises an error with a standard message (see luaL_argerror). - - - - - -


luaL_argerror

-[-0, +0, v] -

int luaL_argerror (lua_State *L, int arg, const char *extramsg);
- -

-Raises an error reporting a problem with argument arg -of the C function that called it, -using a standard message -that includes extramsg as a comment: - -

-     bad argument #arg to 'funcname' (extramsg)
-

-This function never returns. - - - - - -


luaL_Buffer

-
typedef struct luaL_Buffer luaL_Buffer;
- -

-Type for a string buffer. - - -

-A string buffer allows C code to build Lua strings piecemeal. -Its pattern of use is as follows: - -

    - -
  • First declare a variable b of type luaL_Buffer.
  • - -
  • Then initialize it with a call luaL_buffinit(L, &b).
  • - -
  • -Then add string pieces to the buffer calling any of -the luaL_add* functions. -
  • - -
  • -Finish by calling luaL_pushresult(&b). -This call leaves the final string on the top of the stack. -
  • - -
- -

-If you know beforehand the total size of the resulting string, -you can use the buffer like this: - -

    - -
  • First declare a variable b of type luaL_Buffer.
  • - -
  • Then initialize it and preallocate a space of -size sz with a call luaL_buffinitsize(L, &b, sz).
  • - -
  • Then copy the string into that space.
  • - -
  • -Finish by calling luaL_pushresultsize(&b, sz), -where sz is the total size of the resulting string -copied into that space. -
  • - -
- -

-During its normal operation, -a string buffer uses a variable number of stack slots. -So, while using a buffer, you cannot assume that you know where -the top of the stack is. -You can use the stack between successive calls to buffer operations -as long as that use is balanced; -that is, -when you call a buffer operation, -the stack is at the same level -it was immediately after the previous buffer operation. -(The only exception to this rule is luaL_addvalue.) -After calling luaL_pushresult the stack is back to its -level when the buffer was initialized, -plus the final string on its top. - - - - - -


luaL_buffinit

-[-0, +0, –] -

void luaL_buffinit (lua_State *L, luaL_Buffer *B);
- -

-Initializes a buffer B. -This function does not allocate any space; -the buffer must be declared as a variable -(see luaL_Buffer). - - - - - -


luaL_buffinitsize

-[-?, +?, m] -

char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);
- -

-Equivalent to the sequence -luaL_buffinit, luaL_prepbuffsize. - - - - - -


luaL_callmeta

-[-0, +(0|1), e] -

int luaL_callmeta (lua_State *L, int obj, const char *e);
- -

-Calls a metamethod. - - -

-If the object at index obj has a metatable and this -metatable has a field e, -this function calls this field passing the object as its only argument. -In this case this function returns true and pushes onto the -stack the value returned by the call. -If there is no metatable or no metamethod, -this function returns false (without pushing any value on the stack). - - - - - -


luaL_checkany

-[-0, +0, v] -

void luaL_checkany (lua_State *L, int arg);
- -

-Checks whether the function has an argument -of any type (including nil) at position arg. - - - - - -


luaL_checkinteger

-[-0, +0, v] -

lua_Integer luaL_checkinteger (lua_State *L, int arg);
- -

-Checks whether the function argument arg is an integer -(or can be converted to an integer) -and returns this integer cast to a lua_Integer. - - - - - -


luaL_checklstring

-[-0, +0, v] -

const char *luaL_checklstring (lua_State *L, int arg, size_t *l);
- -

-Checks whether the function argument arg is a string -and returns this string; -if l is not NULL fills *l -with the string's length. - - -

-This function uses lua_tolstring to get its result, -so all conversions and caveats of that function apply here. - - - - - -


luaL_checknumber

-[-0, +0, v] -

lua_Number luaL_checknumber (lua_State *L, int arg);
- -

-Checks whether the function argument arg is a number -and returns this number. - - - - - -


luaL_checkoption

-[-0, +0, v] -

int luaL_checkoption (lua_State *L,
-                      int arg,
-                      const char *def,
-                      const char *const lst[]);
- -

-Checks whether the function argument arg is a string and -searches for this string in the array lst -(which must be NULL-terminated). -Returns the index in the array where the string was found. -Raises an error if the argument is not a string or -if the string cannot be found. - - -

-If def is not NULL, -the function uses def as a default value when -there is no argument arg or when this argument is nil. - - -

-This is a useful function for mapping strings to C enums. -(The usual convention in Lua libraries is -to use strings instead of numbers to select options.) - - - - - -


luaL_checkstack

-[-0, +0, v] -

void luaL_checkstack (lua_State *L, int sz, const char *msg);
- -

-Grows the stack size to top + sz elements, -raising an error if the stack cannot grow to that size. -msg is an additional text to go into the error message -(or NULL for no additional text). - - - - - -


luaL_checkstring

-[-0, +0, v] -

const char *luaL_checkstring (lua_State *L, int arg);
- -

-Checks whether the function argument arg is a string -and returns this string. - - -

-This function uses lua_tolstring to get its result, -so all conversions and caveats of that function apply here. - - - - - -


luaL_checktype

-[-0, +0, v] -

void luaL_checktype (lua_State *L, int arg, int t);
- -

-Checks whether the function argument arg has type t. -See lua_type for the encoding of types for t. - - - - - -


luaL_checkudata

-[-0, +0, v] -

void *luaL_checkudata (lua_State *L, int arg, const char *tname);
- -

-Checks whether the function argument arg is a userdata -of the type tname (see luaL_newmetatable) and -returns the userdata address (see lua_touserdata). - - - - - -


luaL_checkversion

-[-0, +0, v] -

void luaL_checkversion (lua_State *L);
- -

-Checks whether the core running the call, -the core that created the Lua state, -and the code making the call are all using the same version of Lua. -Also checks whether the core running the call -and the core that created the Lua state -are using the same address space. - - - - - -


luaL_dofile

-[-0, +?, e] -

int luaL_dofile (lua_State *L, const char *filename);
- -

-Loads and runs the given file. -It is defined as the following macro: - -

-     (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
-

-It returns false if there are no errors -or true in case of errors. - - - - - -


luaL_dostring

-[-0, +?, –] -

int luaL_dostring (lua_State *L, const char *str);
- -

-Loads and runs the given string. -It is defined as the following macro: - -

-     (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
-

-It returns false if there are no errors -or true in case of errors. - - - - - -


luaL_error

-[-0, +0, v] -

int luaL_error (lua_State *L, const char *fmt, ...);
- -

-Raises an error. -The error message format is given by fmt -plus any extra arguments, -following the same rules of lua_pushfstring. -It also adds at the beginning of the message the file name and -the line number where the error occurred, -if this information is available. - - -

-This function never returns, -but it is an idiom to use it in C functions -as return luaL_error(args). - - - - - -


luaL_execresult

-[-0, +3, m] -

int luaL_execresult (lua_State *L, int stat);
- -

-This function produces the return values for -process-related functions in the standard library -(os.execute and io.close). - - - - - -


luaL_fileresult

-[-0, +(1|3), m] -

int luaL_fileresult (lua_State *L, int stat, const char *fname);
- -

-This function produces the return values for -file-related functions in the standard library -(io.open, os.rename, file:seek, etc.). - - - - - -


luaL_getmetafield

-[-0, +(0|1), m] -

int luaL_getmetafield (lua_State *L, int obj, const char *e);
- -

-Pushes onto the stack the field e from the metatable -of the object at index obj and returns the type of pushed value. -If the object does not have a metatable, -or if the metatable does not have this field, -pushes nothing and returns LUA_TNIL. - - - - - -


luaL_getmetatable

-[-0, +1, m] -

int luaL_getmetatable (lua_State *L, const char *tname);
- -

-Pushes onto the stack the metatable associated with name tname -in the registry (see luaL_newmetatable) -(nil if there is no metatable associated with that name). -Returns the type of the pushed value. - - - - - -


luaL_getsubtable

-[-0, +1, e] -

int luaL_getsubtable (lua_State *L, int idx, const char *fname);
- -

-Ensures that the value t[fname], -where t is the value at index idx, -is a table, -and pushes that table onto the stack. -Returns true if it finds a previous table there -and false if it creates a new table. - - - - - -


luaL_gsub

-[-0, +1, m] -

const char *luaL_gsub (lua_State *L,
-                       const char *s,
-                       const char *p,
-                       const char *r);
- -

-Creates a copy of string s by replacing -any occurrence of the string p -with the string r. -Pushes the resulting string on the stack and returns it. - - - - - -


luaL_len

-[-0, +0, e] -

lua_Integer luaL_len (lua_State *L, int index);
- -

-Returns the "length" of the value at the given index -as a number; -it is equivalent to the '#' operator in Lua (see §3.4.7). -Raises an error if the result of the operation is not an integer. -(This case only can happen through metamethods.) - - - - - -


luaL_loadbuffer

-[-0, +1, –] -

int luaL_loadbuffer (lua_State *L,
-                     const char *buff,
-                     size_t sz,
-                     const char *name);
- -

-Equivalent to luaL_loadbufferx with mode equal to NULL. - - - - - -


luaL_loadbufferx

-[-0, +1, –] -

int luaL_loadbufferx (lua_State *L,
-                      const char *buff,
-                      size_t sz,
-                      const char *name,
-                      const char *mode);
- -

-Loads a buffer as a Lua chunk. -This function uses lua_load to load the chunk in the -buffer pointed to by buff with size sz. - - -

-This function returns the same results as lua_load. -name is the chunk name, -used for debug information and error messages. -The string mode works as in function lua_load. - - - - - -


luaL_loadfile

-[-0, +1, m] -

int luaL_loadfile (lua_State *L, const char *filename);
- -

-Equivalent to luaL_loadfilex with mode equal to NULL. - - - - - -


luaL_loadfilex

-[-0, +1, m] -

int luaL_loadfilex (lua_State *L, const char *filename,
-                                            const char *mode);
- -

-Loads a file as a Lua chunk. -This function uses lua_load to load the chunk in the file -named filename. -If filename is NULL, -then it loads from the standard input. -The first line in the file is ignored if it starts with a #. - - -

-The string mode works as in function lua_load. - - -

-This function returns the same results as lua_load, -but it has an extra error code LUA_ERRFILE -for file-related errors -(e.g., it cannot open or read the file). - - -

-As lua_load, this function only loads the chunk; -it does not run it. - - - - - -


luaL_loadstring

-[-0, +1, –] -

int luaL_loadstring (lua_State *L, const char *s);
- -

-Loads a string as a Lua chunk. -This function uses lua_load to load the chunk in -the zero-terminated string s. - - -

-This function returns the same results as lua_load. - - -

-Also as lua_load, this function only loads the chunk; -it does not run it. - - - - - -


luaL_newlib

-[-0, +1, m] -

void luaL_newlib (lua_State *L, const luaL_Reg l[]);
- -

-Creates a new table and registers there -the functions in list l. - - -

-It is implemented as the following macro: - -

-     (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
-

-The array l must be the actual array, -not a pointer to it. - - - - - -


luaL_newlibtable

-[-0, +1, m] -

void luaL_newlibtable (lua_State *L, const luaL_Reg l[]);
- -

-Creates a new table with a size optimized -to store all entries in the array l -(but does not actually store them). -It is intended to be used in conjunction with luaL_setfuncs -(see luaL_newlib). - - -

-It is implemented as a macro. -The array l must be the actual array, -not a pointer to it. - - - - - -


luaL_newmetatable

-[-0, +1, m] -

int luaL_newmetatable (lua_State *L, const char *tname);
- -

-If the registry already has the key tname, -returns 0. -Otherwise, -creates a new table to be used as a metatable for userdata, -adds to this new table the pair __name = tname, -adds to the registry the pair [tname] = new table, -and returns 1. -(The entry __name is used by some error-reporting functions.) - - -

-In both cases pushes onto the stack the final value associated -with tname in the registry. - - - - - -


luaL_newstate

-[-0, +0, –] -

lua_State *luaL_newstate (void);
- -

-Creates a new Lua state. -It calls lua_newstate with an -allocator based on the standard C realloc function -and then sets a panic function (see §4.6) that prints -an error message to the standard error output in case of fatal -errors. - - -

-Returns the new state, -or NULL if there is a memory allocation error. - - - - - -


luaL_openlibs

-[-0, +0, e] -

void luaL_openlibs (lua_State *L);
- -

-Opens all standard Lua libraries into the given state. - - - - - -


luaL_opt

-[-0, +0, e] -

T luaL_opt (L, func, arg, dflt);
- -

-This macro is defined as follows: - -

-     (lua_isnoneornil(L,(arg)) ? (dflt) : func(L,(arg)))
-

-In words, if the argument arg is nil or absent, -the macro results in the default dflt. -Otherwise, it results in the result of calling func -with the state L and the argument index arg as -parameters. -Note that it evaluates the expression dflt only if needed. - - - - - -


luaL_optinteger

-[-0, +0, v] -

lua_Integer luaL_optinteger (lua_State *L,
-                             int arg,
-                             lua_Integer d);
- -

-If the function argument arg is an integer -(or convertible to an integer), -returns this integer. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optlstring

-[-0, +0, v] -

const char *luaL_optlstring (lua_State *L,
-                             int arg,
-                             const char *d,
-                             size_t *l);
- -

-If the function argument arg is a string, -returns this string. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - -

-If l is not NULL, -fills the position *l with the result's length. -If the result is NULL -(only possible when returning d and d == NULL), -its length is considered zero. - - -

-This function uses lua_tolstring to get its result, -so all conversions and caveats of that function apply here. - - - - - -


luaL_optnumber

-[-0, +0, v] -

lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number d);
- -

-If the function argument arg is a number, -returns this number. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optstring

-[-0, +0, v] -

const char *luaL_optstring (lua_State *L,
-                            int arg,
-                            const char *d);
- -

-If the function argument arg is a string, -returns this string. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_prepbuffer

-[-?, +?, m] -

char *luaL_prepbuffer (luaL_Buffer *B);
- -

-Equivalent to luaL_prepbuffsize -with the predefined size LUAL_BUFFERSIZE. - - - - - -


luaL_prepbuffsize

-[-?, +?, m] -

char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);
- -

-Returns an address to a space of size sz -where you can copy a string to be added to buffer B -(see luaL_Buffer). -After copying the string into this space you must call -luaL_addsize with the size of the string to actually add -it to the buffer. - - - - - -


luaL_pushresult

-[-?, +1, m] -

void luaL_pushresult (luaL_Buffer *B);
- -

-Finishes the use of buffer B leaving the final string on -the top of the stack. - - - - - -


luaL_pushresultsize

-[-?, +1, m] -

void luaL_pushresultsize (luaL_Buffer *B, size_t sz);
- -

-Equivalent to the sequence luaL_addsize, luaL_pushresult. - - - - - -


luaL_ref

-[-1, +0, m] -

int luaL_ref (lua_State *L, int t);
- -

-Creates and returns a reference, -in the table at index t, -for the object at the top of the stack (and pops the object). - - -

-A reference is a unique integer key. -As long as you do not manually add integer keys into table t, -luaL_ref ensures the uniqueness of the key it returns. -You can retrieve an object referred by reference r -by calling lua_rawgeti(L, t, r). -Function luaL_unref frees a reference and its associated object. - - -

-If the object at the top of the stack is nil, -luaL_ref returns the constant LUA_REFNIL. -The constant LUA_NOREF is guaranteed to be different -from any reference returned by luaL_ref. - - - - - -


luaL_Reg

-
typedef struct luaL_Reg {
-  const char *name;
-  lua_CFunction func;
-} luaL_Reg;
- -

-Type for arrays of functions to be registered by -luaL_setfuncs. -name is the function name and func is a pointer to -the function. -Any array of luaL_Reg must end with a sentinel entry -in which both name and func are NULL. - - - - - -


luaL_requiref

-[-0, +1, e] -

void luaL_requiref (lua_State *L, const char *modname,
-                    lua_CFunction openf, int glb);
- -

-If modname is not already present in package.loaded, -calls function openf with string modname as an argument -and sets the call result in package.loaded[modname], -as if that function has been called through require. - - -

-If glb is true, -also stores the module into global modname. - - -

-Leaves a copy of the module on the stack. - - - - - -


luaL_setfuncs

-[-nup, +0, m] -

void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
- -

-Registers all functions in the array l -(see luaL_Reg) into the table on the top of the stack -(below optional upvalues, see next). - - -

-When nup is not zero, -all functions are created sharing nup upvalues, -which must be previously pushed on the stack -on top of the library table. -These values are popped from the stack after the registration. - - - - - -


luaL_setmetatable

-[-0, +0, –] -

void luaL_setmetatable (lua_State *L, const char *tname);
- -

-Sets the metatable of the object at the top of the stack -as the metatable associated with name tname -in the registry (see luaL_newmetatable). - - - - - -


luaL_Stream

-
typedef struct luaL_Stream {
-  FILE *f;
-  lua_CFunction closef;
-} luaL_Stream;
- -

-The standard representation for file handles, -which is used by the standard I/O library. - - -

-A file handle is implemented as a full userdata, -with a metatable called LUA_FILEHANDLE -(where LUA_FILEHANDLE is a macro with the actual metatable's name). -The metatable is created by the I/O library -(see luaL_newmetatable). - - -

-This userdata must start with the structure luaL_Stream; -it can contain other data after this initial structure. -Field f points to the corresponding C stream -(or it can be NULL to indicate an incompletely created handle). -Field closef points to a Lua function -that will be called to close the stream -when the handle is closed or collected; -this function receives the file handle as its sole argument and -must return either true (in case of success) -or nil plus an error message (in case of error). -Once Lua calls this field, -it changes the field value to NULL -to signal that the handle is closed. - - - - - -


luaL_testudata

-[-0, +0, m] -

void *luaL_testudata (lua_State *L, int arg, const char *tname);
- -

-This function works like luaL_checkudata, -except that, when the test fails, -it returns NULL instead of raising an error. - - - - - -


luaL_tolstring

-[-0, +1, e] -

const char *luaL_tolstring (lua_State *L, int idx, size_t *len);
- -

-Converts any Lua value at the given index to a C string -in a reasonable format. -The resulting string is pushed onto the stack and also -returned by the function. -If len is not NULL, -the function also sets *len with the string length. - - -

-If the value has a metatable with a __tostring field, -then luaL_tolstring calls the corresponding metamethod -with the value as argument, -and uses the result of the call as its result. - - - - - -


luaL_traceback

-[-0, +1, m] -

void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
-                     int level);
- -

-Creates and pushes a traceback of the stack L1. -If msg is not NULL it is appended -at the beginning of the traceback. -The level parameter tells at which level -to start the traceback. - - - - - -


luaL_typename

-[-0, +0, –] -

const char *luaL_typename (lua_State *L, int index);
- -

-Returns the name of the type of the value at the given index. - - - - - -


luaL_unref

-[-0, +0, –] -

void luaL_unref (lua_State *L, int t, int ref);
- -

-Releases reference ref from the table at index t -(see luaL_ref). -The entry is removed from the table, -so that the referred object can be collected. -The reference ref is also freed to be used again. - - -

-If ref is LUA_NOREF or LUA_REFNIL, -luaL_unref does nothing. - - - - - -


luaL_where

-[-0, +1, m] -

void luaL_where (lua_State *L, int lvl);
- -

-Pushes onto the stack a string identifying the current position -of the control at level lvl in the call stack. -Typically this string has the following format: - -

-     chunkname:currentline:
-

-Level 0 is the running function, -level 1 is the function that called the running function, -etc. - - -

-This function is used to build a prefix for error messages. - - - - - - - -

6 – Standard Libraries

- -

-The standard Lua libraries provide useful functions -that are implemented directly through the C API. -Some of these functions provide essential services to the language -(e.g., type and getmetatable); -others provide access to "outside" services (e.g., I/O); -and others could be implemented in Lua itself, -but are quite useful or have critical performance requirements that -deserve an implementation in C (e.g., table.sort). - - -

-All libraries are implemented through the official C API -and are provided as separate C modules. -Currently, Lua has the following standard libraries: - -

    - -
  • basic library (§6.1);
  • - -
  • coroutine library (§6.2);
  • - -
  • package library (§6.3);
  • - -
  • string manipulation (§6.4);
  • - -
  • basic UTF-8 support (§6.5);
  • - -
  • table manipulation (§6.6);
  • - -
  • mathematical functions (§6.7) (sin, log, etc.);
  • - -
  • input and output (§6.8);
  • - -
  • operating system facilities (§6.9);
  • - -
  • debug facilities (§6.10).
  • - -

-Except for the basic and the package libraries, -each library provides all its functions as fields of a global table -or as methods of its objects. - - -

-To have access to these libraries, -the C host program should call the luaL_openlibs function, -which opens all standard libraries. -Alternatively, -the host program can open them individually by using -luaL_requiref to call -luaopen_base (for the basic library), -luaopen_package (for the package library), -luaopen_coroutine (for the coroutine library), -luaopen_string (for the string library), -luaopen_utf8 (for the UTF8 library), -luaopen_table (for the table library), -luaopen_math (for the mathematical library), -luaopen_io (for the I/O library), -luaopen_os (for the operating system library), -and luaopen_debug (for the debug library). -These functions are declared in lualib.h. - - - -

6.1 – Basic Functions

- -

-The basic library provides core functions to Lua. -If you do not include this library in your application, -you should check carefully whether you need to provide -implementations for some of its facilities. - - -

-


assert (v [, message])

- - -

-Calls error if -the value of its argument v is false (i.e., nil or false); -otherwise, returns all its arguments. -In case of error, -message is the error object; -when absent, it defaults to "assertion failed!" - - - - -

-


collectgarbage ([opt [, arg]])

- - -

-This function is a generic interface to the garbage collector. -It performs different functions according to its first argument, opt: - -

    - -
  • "collect": -performs a full garbage-collection cycle. -This is the default option. -
  • - -
  • "stop": -stops automatic execution of the garbage collector. -The collector will run only when explicitly invoked, -until a call to restart it. -
  • - -
  • "restart": -restarts automatic execution of the garbage collector. -
  • - -
  • "count": -returns the total memory in use by Lua in Kbytes. -The value has a fractional part, -so that it multiplied by 1024 -gives the exact number of bytes in use by Lua -(except for overflows). -
  • - -
  • "step": -performs a garbage-collection step. -The step "size" is controlled by arg. -With a zero value, -the collector will perform one basic (indivisible) step. -For non-zero values, -the collector will perform as if that amount of memory -(in KBytes) had been allocated by Lua. -Returns true if the step finished a collection cycle. -
  • - -
  • "setpause": -sets arg as the new value for the pause of -the collector (see §2.5). -Returns the previous value for pause. -
  • - -
  • "setstepmul": -sets arg as the new value for the step multiplier of -the collector (see §2.5). -Returns the previous value for step. -
  • - -
  • "isrunning": -returns a boolean that tells whether the collector is running -(i.e., not stopped). -
  • - -
- - - -

-


dofile ([filename])

-Opens the named file and executes its contents as a Lua chunk. -When called without arguments, -dofile executes the contents of the standard input (stdin). -Returns all values returned by the chunk. -In case of errors, dofile propagates the error -to its caller (that is, dofile does not run in protected mode). - - - - -

-


error (message [, level])

-Terminates the last protected function called -and returns message as the error object. -Function error never returns. - - -

-Usually, error adds some information about the error position -at the beginning of the message, if the message is a string. -The level argument specifies how to get the error position. -With level 1 (the default), the error position is where the -error function was called. -Level 2 points the error to where the function -that called error was called; and so on. -Passing a level 0 avoids the addition of error position information -to the message. - - - - -

-


_G

-A global variable (not a function) that -holds the global environment (see §2.2). -Lua itself does not use this variable; -changing its value does not affect any environment, -nor vice versa. - - - - -

-


getmetatable (object)

- - -

-If object does not have a metatable, returns nil. -Otherwise, -if the object's metatable has a __metatable field, -returns the associated value. -Otherwise, returns the metatable of the given object. - - - - -

-


ipairs (t)

- - -

-Returns three values (an iterator function, the table t, and 0) -so that the construction - -

-     for i,v in ipairs(t) do body end
-

-will iterate over the key–value pairs -(1,t[1]), (2,t[2]), ..., -up to the first nil value. - - - - -

-


load (chunk [, chunkname [, mode [, env]]])

- - -

-Loads a chunk. - - -

-If chunk is a string, the chunk is this string. -If chunk is a function, -load calls it repeatedly to get the chunk pieces. -Each call to chunk must return a string that concatenates -with previous results. -A return of an empty string, nil, or no value signals the end of the chunk. - - -

-If there are no syntactic errors, -returns the compiled chunk as a function; -otherwise, returns nil plus the error message. - - -

-If the resulting function has upvalues, -the first upvalue is set to the value of env, -if that parameter is given, -or to the value of the global environment. -Other upvalues are initialized with nil. -(When you load a main chunk, -the resulting function will always have exactly one upvalue, -the _ENV variable (see §2.2). -However, -when you load a binary chunk created from a function (see string.dump), -the resulting function can have an arbitrary number of upvalues.) -All upvalues are fresh, that is, -they are not shared with any other function. - - -

-chunkname is used as the name of the chunk for error messages -and debug information (see §4.9). -When absent, -it defaults to chunk, if chunk is a string, -or to "=(load)" otherwise. - - -

-The string mode controls whether the chunk can be text or binary -(that is, a precompiled chunk). -It may be the string "b" (only binary chunks), -"t" (only text chunks), -or "bt" (both binary and text). -The default is "bt". - - -

-Lua does not check the consistency of binary chunks. -Maliciously crafted binary chunks can crash -the interpreter. - - - - -

-


loadfile ([filename [, mode [, env]]])

- - -

-Similar to load, -but gets the chunk from file filename -or from the standard input, -if no file name is given. - - - - -

-


next (table [, index])

- - -

-Allows a program to traverse all fields of a table. -Its first argument is a table and its second argument -is an index in this table. -next returns the next index of the table -and its associated value. -When called with nil as its second argument, -next returns an initial index -and its associated value. -When called with the last index, -or with nil in an empty table, -next returns nil. -If the second argument is absent, then it is interpreted as nil. -In particular, -you can use next(t) to check whether a table is empty. - - -

-The order in which the indices are enumerated is not specified, -even for numeric indices. -(To traverse a table in numerical order, -use a numerical for.) - - -

-The behavior of next is undefined if, -during the traversal, -you assign any value to a non-existent field in the table. -You may however modify existing fields. -In particular, you may clear existing fields. - - - - -

-


pairs (t)

- - -

-If t has a metamethod __pairs, -calls it with t as argument and returns the first three -results from the call. - - -

-Otherwise, -returns three values: the next function, the table t, and nil, -so that the construction - -

-     for k,v in pairs(t) do body end
-

-will iterate over all key–value pairs of table t. - - -

-See function next for the caveats of modifying -the table during its traversal. - - - - -

-


pcall (f [, arg1, ···])

- - -

-Calls function f with -the given arguments in protected mode. -This means that any error inside f is not propagated; -instead, pcall catches the error -and returns a status code. -Its first result is the status code (a boolean), -which is true if the call succeeds without errors. -In such case, pcall also returns all results from the call, -after this first result. -In case of any error, pcall returns false plus the error message. - - - - -

-


print (···)

-Receives any number of arguments -and prints their values to stdout, -using the tostring function to convert each argument to a string. -print is not intended for formatted output, -but only as a quick way to show a value, -for instance for debugging. -For complete control over the output, -use string.format and io.write. - - - - -

-


rawequal (v1, v2)

-Checks whether v1 is equal to v2, -without invoking the __eq metamethod. -Returns a boolean. - - - - -

-


rawget (table, index)

-Gets the real value of table[index], -without invoking the __index metamethod. -table must be a table; -index may be any value. - - - - -

-


rawlen (v)

-Returns the length of the object v, -which must be a table or a string, -without invoking the __len metamethod. -Returns an integer. - - - - -

-


rawset (table, index, value)

-Sets the real value of table[index] to value, -without invoking the __newindex metamethod. -table must be a table, -index any value different from nil and NaN, -and value any Lua value. - - -

-This function returns table. - - - - -

-


select (index, ···)

- - -

-If index is a number, -returns all arguments after argument number index; -a negative number indexes from the end (-1 is the last argument). -Otherwise, index must be the string "#", -and select returns the total number of extra arguments it received. - - - - -

-


setmetatable (table, metatable)

- - -

-Sets the metatable for the given table. -(To change the metatable of other types from Lua code, -you must use the debug library (§6.10).) -If metatable is nil, -removes the metatable of the given table. -If the original metatable has a __metatable field, -raises an error. - - -

-This function returns table. - - - - -

-


tonumber (e [, base])

- - -

-When called with no base, -tonumber tries to convert its argument to a number. -If the argument is already a number or -a string convertible to a number, -then tonumber returns this number; -otherwise, it returns nil. - - -

-The conversion of strings can result in integers or floats, -according to the lexical conventions of Lua (see §3.1). -(The string may have leading and trailing spaces and a sign.) - - -

-When called with base, -then e must be a string to be interpreted as -an integer numeral in that base. -The base may be any integer between 2 and 36, inclusive. -In bases above 10, the letter 'A' (in either upper or lower case) -represents 10, 'B' represents 11, and so forth, -with 'Z' representing 35. -If the string e is not a valid numeral in the given base, -the function returns nil. - - - - -

-


tostring (v)

-Receives a value of any type and -converts it to a string in a human-readable format. -(For complete control of how numbers are converted, -use string.format.) - - -

-If the metatable of v has a __tostring field, -then tostring calls the corresponding value -with v as argument, -and uses the result of the call as its result. - - - - -

-


type (v)

-Returns the type of its only argument, coded as a string. -The possible results of this function are -"nil" (a string, not the value nil), -"number", -"string", -"boolean", -"table", -"function", -"thread", -and "userdata". - - - - -

-


_VERSION

- - -

-A global variable (not a function) that -holds a string containing the running Lua version. -The current value of this variable is "Lua 5.3". - - - - -

-


xpcall (f, msgh [, arg1, ···])

- - -

-This function is similar to pcall, -except that it sets a new message handler msgh. - - - - - - - -

6.2 – Coroutine Manipulation

- -

-This library comprises the operations to manipulate coroutines, -which come inside the table coroutine. -See §2.6 for a general description of coroutines. - - -

-


coroutine.create (f)

- - -

-Creates a new coroutine, with body f. -f must be a function. -Returns this new coroutine, -an object with type "thread". - - - - -

-


coroutine.isyieldable ()

- - -

-Returns true when the running coroutine can yield. - - -

-A running coroutine is yieldable if it is not the main thread and -it is not inside a non-yieldable C function. - - - - -

-


coroutine.resume (co [, val1, ···])

- - -

-Starts or continues the execution of coroutine co. -The first time you resume a coroutine, -it starts running its body. -The values val1, ... are passed -as the arguments to the body function. -If the coroutine has yielded, -resume restarts it; -the values val1, ... are passed -as the results from the yield. - - -

-If the coroutine runs without any errors, -resume returns true plus any values passed to yield -(when the coroutine yields) or any values returned by the body function -(when the coroutine terminates). -If there is any error, -resume returns false plus the error message. - - - - -

-


coroutine.running ()

- - -

-Returns the running coroutine plus a boolean, -true when the running coroutine is the main one. - - - - -

-


coroutine.status (co)

- - -

-Returns the status of coroutine co, as a string: -"running", -if the coroutine is running (that is, it called status); -"suspended", if the coroutine is suspended in a call to yield, -or if it has not started running yet; -"normal" if the coroutine is active but not running -(that is, it has resumed another coroutine); -and "dead" if the coroutine has finished its body function, -or if it has stopped with an error. - - - - -

-


coroutine.wrap (f)

- - -

-Creates a new coroutine, with body f. -f must be a function. -Returns a function that resumes the coroutine each time it is called. -Any arguments passed to the function behave as the -extra arguments to resume. -Returns the same values returned by resume, -except the first boolean. -In case of error, propagates the error. - - - - -

-


coroutine.yield (···)

- - -

-Suspends the execution of the calling coroutine. -Any arguments to yield are passed as extra results to resume. - - - - - - - -

6.3 – Modules

- -

-The package library provides basic -facilities for loading modules in Lua. -It exports one function directly in the global environment: -require. -Everything else is exported in a table package. - - -

-


require (modname)

- - -

-Loads the given module. -The function starts by looking into the package.loaded table -to determine whether modname is already loaded. -If it is, then require returns the value stored -at package.loaded[modname]. -Otherwise, it tries to find a loader for the module. - - -

-To find a loader, -require is guided by the package.searchers sequence. -By changing this sequence, -we can change how require looks for a module. -The following explanation is based on the default configuration -for package.searchers. - - -

-First require queries package.preload[modname]. -If it has a value, -this value (which must be a function) is the loader. -Otherwise require searches for a Lua loader using the -path stored in package.path. -If that also fails, it searches for a C loader using the -path stored in package.cpath. -If that also fails, -it tries an all-in-one loader (see package.searchers). - - -

-Once a loader is found, -require calls the loader with two arguments: -modname and an extra value dependent on how it got the loader. -(If the loader came from a file, -this extra value is the file name.) -If the loader returns any non-nil value, -require assigns the returned value to package.loaded[modname]. -If the loader does not return a non-nil value and -has not assigned any value to package.loaded[modname], -then require assigns true to this entry. -In any case, require returns the -final value of package.loaded[modname]. - - -

-If there is any error loading or running the module, -or if it cannot find any loader for the module, -then require raises an error. - - - - -

-


package.config

- - -

-A string describing some compile-time configurations for packages. -This string is a sequence of lines: - -

    - -
  • The first line is the directory separator string. -Default is '\' for Windows and '/' for all other systems.
  • - -
  • The second line is the character that separates templates in a path. -Default is ';'.
  • - -
  • The third line is the string that marks the -substitution points in a template. -Default is '?'.
  • - -
  • The fourth line is a string that, in a path in Windows, -is replaced by the executable's directory. -Default is '!'.
  • - -
  • The fifth line is a mark to ignore all text after it -when building the luaopen_ function name. -Default is '-'.
  • - -
- - - -

-


package.cpath

- - -

-The path used by require to search for a C loader. - - -

-Lua initializes the C path package.cpath in the same way -it initializes the Lua path package.path, -using the environment variable LUA_CPATH_5_3, -or the environment variable LUA_CPATH, -or a default path defined in luaconf.h. - - - - -

-


package.loaded

- - -

-A table used by require to control which -modules are already loaded. -When you require a module modname and -package.loaded[modname] is not false, -require simply returns the value stored there. - - -

-This variable is only a reference to the real table; -assignments to this variable do not change the -table used by require. - - - - -

-


package.loadlib (libname, funcname)

- - -

-Dynamically links the host program with the C library libname. - - -

-If funcname is "*", -then it only links with the library, -making the symbols exported by the library -available to other dynamically linked libraries. -Otherwise, -it looks for a function funcname inside the library -and returns this function as a C function. -So, funcname must follow the lua_CFunction prototype -(see lua_CFunction). - - -

-This is a low-level function. -It completely bypasses the package and module system. -Unlike require, -it does not perform any path searching and -does not automatically adds extensions. -libname must be the complete file name of the C library, -including if necessary a path and an extension. -funcname must be the exact name exported by the C library -(which may depend on the C compiler and linker used). - - -

-This function is not supported by Standard C. -As such, it is only available on some platforms -(Windows, Linux, Mac OS X, Solaris, BSD, -plus other Unix systems that support the dlfcn standard). - - - - -

-


package.path

- - -

-The path used by require to search for a Lua loader. - - -

-At start-up, Lua initializes this variable with -the value of the environment variable LUA_PATH_5_3 or -the environment variable LUA_PATH or -with a default path defined in luaconf.h, -if those environment variables are not defined. -Any ";;" in the value of the environment variable -is replaced by the default path. - - - - -

-


package.preload

- - -

-A table to store loaders for specific modules -(see require). - - -

-This variable is only a reference to the real table; -assignments to this variable do not change the -table used by require. - - - - -

-


package.searchers

- - -

-A table used by require to control how to load modules. - - -

-Each entry in this table is a searcher function. -When looking for a module, -require calls each of these searchers in ascending order, -with the module name (the argument given to require) as its -sole parameter. -The function can return another function (the module loader) -plus an extra value that will be passed to that loader, -or a string explaining why it did not find that module -(or nil if it has nothing to say). - - -

-Lua initializes this table with four searcher functions. - - -

-The first searcher simply looks for a loader in the -package.preload table. - - -

-The second searcher looks for a loader as a Lua library, -using the path stored at package.path. -The search is done as described in function package.searchpath. - - -

-The third searcher looks for a loader as a C library, -using the path given by the variable package.cpath. -Again, -the search is done as described in function package.searchpath. -For instance, -if the C path is the string - -

-     "./?.so;./?.dll;/usr/local/?/init.so"
-

-the searcher for module foo -will try to open the files ./foo.so, ./foo.dll, -and /usr/local/foo/init.so, in that order. -Once it finds a C library, -this searcher first uses a dynamic link facility to link the -application with the library. -Then it tries to find a C function inside the library to -be used as the loader. -The name of this C function is the string "luaopen_" -concatenated with a copy of the module name where each dot -is replaced by an underscore. -Moreover, if the module name has a hyphen, -its suffix after (and including) the first hyphen is removed. -For instance, if the module name is a.b.c-v2.1, -the function name will be luaopen_a_b_c. - - -

-The fourth searcher tries an all-in-one loader. -It searches the C path for a library for -the root name of the given module. -For instance, when requiring a.b.c, -it will search for a C library for a. -If found, it looks into it for an open function for -the submodule; -in our example, that would be luaopen_a_b_c. -With this facility, a package can pack several C submodules -into one single library, -with each submodule keeping its original open function. - - -

-All searchers except the first one (preload) return as the extra value -the file name where the module was found, -as returned by package.searchpath. -The first searcher returns no extra value. - - - - -

-


package.searchpath (name, path [, sep [, rep]])

- - -

-Searches for the given name in the given path. - - -

-A path is a string containing a sequence of -templates separated by semicolons. -For each template, -the function replaces each interrogation mark (if any) -in the template with a copy of name -wherein all occurrences of sep -(a dot, by default) -were replaced by rep -(the system's directory separator, by default), -and then tries to open the resulting file name. - - -

-For instance, if the path is the string - -

-     "./?.lua;./?.lc;/usr/local/?/init.lua"
-

-the search for the name foo.a -will try to open the files -./foo/a.lua, ./foo/a.lc, and -/usr/local/foo/a/init.lua, in that order. - - -

-Returns the resulting name of the first file that it can -open in read mode (after closing the file), -or nil plus an error message if none succeeds. -(This error message lists all file names it tried to open.) - - - - - - - -

6.4 – String Manipulation

- -

-This library provides generic functions for string manipulation, -such as finding and extracting substrings, and pattern matching. -When indexing a string in Lua, the first character is at position 1 -(not at 0, as in C). -Indices are allowed to be negative and are interpreted as indexing backwards, -from the end of the string. -Thus, the last character is at position -1, and so on. - - -

-The string library provides all its functions inside the table -string. -It also sets a metatable for strings -where the __index field points to the string table. -Therefore, you can use the string functions in object-oriented style. -For instance, string.byte(s,i) -can be written as s:byte(i). - - -

-The string library assumes one-byte character encodings. - - -

-


string.byte (s [, i [, j]])

-Returns the internal numeric codes of the characters s[i], -s[i+1], ..., s[j]. -The default value for i is 1; -the default value for j is i. -These indices are corrected -following the same rules of function string.sub. - - -

-Numeric codes are not necessarily portable across platforms. - - - - -

-


string.char (···)

-Receives zero or more integers. -Returns a string with length equal to the number of arguments, -in which each character has the internal numeric code equal -to its corresponding argument. - - -

-Numeric codes are not necessarily portable across platforms. - - - - -

-


string.dump (function [, strip])

- - -

-Returns a string containing a binary representation -(a binary chunk) -of the given function, -so that a later load on this string returns -a copy of the function (but with new upvalues). -If strip is a true value, -the binary representation may not include all debug information -about the function, -to save space. - - -

-Functions with upvalues have only their number of upvalues saved. -When (re)loaded, -those upvalues receive fresh instances containing nil. -(You can use the debug library to serialize -and reload the upvalues of a function -in a way adequate to your needs.) - - - - -

-


string.find (s, pattern [, init [, plain]])

- - -

-Looks for the first match of -pattern (see §6.4.1) in the string s. -If it finds a match, then find returns the indices of s -where this occurrence starts and ends; -otherwise, it returns nil. -A third, optional numeric argument init specifies -where to start the search; -its default value is 1 and can be negative. -A value of true as a fourth, optional argument plain -turns off the pattern matching facilities, -so the function does a plain "find substring" operation, -with no characters in pattern being considered magic. -Note that if plain is given, then init must be given as well. - - -

-If the pattern has captures, -then in a successful match -the captured values are also returned, -after the two indices. - - - - -

-


string.format (formatstring, ···)

- - -

-Returns a formatted version of its variable number of arguments -following the description given in its first argument (which must be a string). -The format string follows the same rules as the ISO C function sprintf. -The only differences are that the options/modifiers -*, h, L, l, n, -and p are not supported -and that there is an extra option, q. - - -

-The q option formats a string between double quotes, -using escape sequences when necessary to ensure that -it can safely be read back by the Lua interpreter. -For instance, the call - -

-     string.format('%q', 'a string with "quotes" and \n new line')
-

-may produce the string: - -

-     "a string with \"quotes\" and \
-      new line"
-
- -

-Options -A, a, E, e, f, -G, and g all expect a number as argument. -Options c, d, -i, o, u, X, and x -expect an integer. -When Lua is compiled with a C89 compiler, -options A and a (hexadecimal floats) -do not support any modifier (flags, width, length). - - -

-Option s expects a string; -if its argument is not a string, -it is converted to one following the same rules of tostring. -If the option has any modifier (flags, width, length), -the string argument should not contain embedded zeros. - - - - -

-


string.gmatch (s, pattern)

-Returns an iterator function that, -each time it is called, -returns the next captures from pattern (see §6.4.1) -over the string s. -If pattern specifies no captures, -then the whole match is produced in each call. - - -

-As an example, the following loop -will iterate over all the words from string s, -printing one per line: - -

-     s = "hello world from Lua"
-     for w in string.gmatch(s, "%a+") do
-       print(w)
-     end
-

-The next example collects all pairs key=value from the -given string into a table: - -

-     t = {}
-     s = "from=world, to=Lua"
-     for k, v in string.gmatch(s, "(%w+)=(%w+)") do
-       t[k] = v
-     end
-
- -

-For this function, a caret '^' at the start of a pattern does not -work as an anchor, as this would prevent the iteration. - - - - -

-


string.gsub (s, pattern, repl [, n])

-Returns a copy of s -in which all (or the first n, if given) -occurrences of the pattern (see §6.4.1) have been -replaced by a replacement string specified by repl, -which can be a string, a table, or a function. -gsub also returns, as its second value, -the total number of matches that occurred. -The name gsub comes from Global SUBstitution. - - -

-If repl is a string, then its value is used for replacement. -The character % works as an escape character: -any sequence in repl of the form %d, -with d between 1 and 9, -stands for the value of the d-th captured substring. -The sequence %0 stands for the whole match. -The sequence %% stands for a single %. - - -

-If repl is a table, then the table is queried for every match, -using the first capture as the key. - - -

-If repl is a function, then this function is called every time a -match occurs, with all captured substrings passed as arguments, -in order. - - -

-In any case, -if the pattern specifies no captures, -then it behaves as if the whole pattern was inside a capture. - - -

-If the value returned by the table query or by the function call -is a string or a number, -then it is used as the replacement string; -otherwise, if it is false or nil, -then there is no replacement -(that is, the original match is kept in the string). - - -

-Here are some examples: - -

-     x = string.gsub("hello world", "(%w+)", "%1 %1")
-     --> x="hello hello world world"
-     
-     x = string.gsub("hello world", "%w+", "%0 %0", 1)
-     --> x="hello hello world"
-     
-     x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
-     --> x="world hello Lua from"
-     
-     x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
-     --> x="home = /home/roberto, user = roberto"
-     
-     x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
-           return load(s)()
-         end)
-     --> x="4+5 = 9"
-     
-     local t = {name="lua", version="5.3"}
-     x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
-     --> x="lua-5.3.tar.gz"
-
- - - -

-


string.len (s)

-Receives a string and returns its length. -The empty string "" has length 0. -Embedded zeros are counted, -so "a\000bc\000" has length 5. - - - - -

-


string.lower (s)

-Receives a string and returns a copy of this string with all -uppercase letters changed to lowercase. -All other characters are left unchanged. -The definition of what an uppercase letter is depends on the current locale. - - - - -

-


string.match (s, pattern [, init])

-Looks for the first match of -pattern (see §6.4.1) in the string s. -If it finds one, then match returns -the captures from the pattern; -otherwise it returns nil. -If pattern specifies no captures, -then the whole match is returned. -A third, optional numeric argument init specifies -where to start the search; -its default value is 1 and can be negative. - - - - -

-


string.pack (fmt, v1, v2, ···)

- - -

-Returns a binary string containing the values v1, v2, etc. -packed (that is, serialized in binary form) -according to the format string fmt (see §6.4.2). - - - - -

-


string.packsize (fmt)

- - -

-Returns the size of a string resulting from string.pack -with the given format. -The format string cannot have the variable-length options -'s' or 'z' (see §6.4.2). - - - - -

-


string.rep (s, n [, sep])

-Returns a string that is the concatenation of n copies of -the string s separated by the string sep. -The default value for sep is the empty string -(that is, no separator). -Returns the empty string if n is not positive. - - -

-(Note that it is very easy to exhaust the memory of your machine -with a single call to this function.) - - - - -

-


string.reverse (s)

-Returns a string that is the string s reversed. - - - - -

-


string.sub (s, i [, j])

-Returns the substring of s that -starts at i and continues until j; -i and j can be negative. -If j is absent, then it is assumed to be equal to -1 -(which is the same as the string length). -In particular, -the call string.sub(s,1,j) returns a prefix of s -with length j, -and string.sub(s, -i) (for a positive i) -returns a suffix of s -with length i. - - -

-If, after the translation of negative indices, -i is less than 1, -it is corrected to 1. -If j is greater than the string length, -it is corrected to that length. -If, after these corrections, -i is greater than j, -the function returns the empty string. - - - - -

-


string.unpack (fmt, s [, pos])

- - -

-Returns the values packed in string s (see string.pack) -according to the format string fmt (see §6.4.2). -An optional pos marks where -to start reading in s (default is 1). -After the read values, -this function also returns the index of the first unread byte in s. - - - - -

-


string.upper (s)

-Receives a string and returns a copy of this string with all -lowercase letters changed to uppercase. -All other characters are left unchanged. -The definition of what a lowercase letter is depends on the current locale. - - - - - -

6.4.1 – Patterns

- -

-Patterns in Lua are described by regular strings, -which are interpreted as patterns by the pattern-matching functions -string.find, -string.gmatch, -string.gsub, -and string.match. -This section describes the syntax and the meaning -(that is, what they match) of these strings. - - - -

Character Class:

-A character class is used to represent a set of characters. -The following combinations are allowed in describing a character class: - -

    - -
  • x: -(where x is not one of the magic characters -^$()%.[]*+-?) -represents the character x itself. -
  • - -
  • .: (a dot) represents all characters.
  • - -
  • %a: represents all letters.
  • - -
  • %c: represents all control characters.
  • - -
  • %d: represents all digits.
  • - -
  • %g: represents all printable characters except space.
  • - -
  • %l: represents all lowercase letters.
  • - -
  • %p: represents all punctuation characters.
  • - -
  • %s: represents all space characters.
  • - -
  • %u: represents all uppercase letters.
  • - -
  • %w: represents all alphanumeric characters.
  • - -
  • %x: represents all hexadecimal digits.
  • - -
  • %x: (where x is any non-alphanumeric character) -represents the character x. -This is the standard way to escape the magic characters. -Any non-alphanumeric character -(including all punctuation characters, even the non-magical) -can be preceded by a '%' -when used to represent itself in a pattern. -
  • - -
  • [set]: -represents the class which is the union of all -characters in set. -A range of characters can be specified by -separating the end characters of the range, -in ascending order, with a '-'. -All classes %x described above can also be used as -components in set. -All other characters in set represent themselves. -For example, [%w_] (or [_%w]) -represents all alphanumeric characters plus the underscore, -[0-7] represents the octal digits, -and [0-7%l%-] represents the octal digits plus -the lowercase letters plus the '-' character. - - -

    -You can put a closing square bracket in a set -by positioning it as the first character in the set. -You can put an hyphen in a set -by positioning it as the first or the last character in the set. -(You can also use an escape for both cases.) - - -

    -The interaction between ranges and classes is not defined. -Therefore, patterns like [%a-z] or [a-%%] -have no meaning. -

  • - -
  • [^set]: -represents the complement of set, -where set is interpreted as above. -
  • - -

-For all classes represented by single letters (%a, %c, etc.), -the corresponding uppercase letter represents the complement of the class. -For instance, %S represents all non-space characters. - - -

-The definitions of letter, space, and other character groups -depend on the current locale. -In particular, the class [a-z] may not be equivalent to %l. - - - - - -

Pattern Item:

-A pattern item can be - -

    - -
  • -a single character class, -which matches any single character in the class; -
  • - -
  • -a single character class followed by '*', -which matches zero or more repetitions of characters in the class. -These repetition items will always match the longest possible sequence; -
  • - -
  • -a single character class followed by '+', -which matches one or more repetitions of characters in the class. -These repetition items will always match the longest possible sequence; -
  • - -
  • -a single character class followed by '-', -which also matches zero or more repetitions of characters in the class. -Unlike '*', -these repetition items will always match the shortest possible sequence; -
  • - -
  • -a single character class followed by '?', -which matches zero or one occurrence of a character in the class. -It always matches one occurrence if possible; -
  • - -
  • -%n, for n between 1 and 9; -such item matches a substring equal to the n-th captured string -(see below); -
  • - -
  • -%bxy, where x and y are two distinct characters; -such item matches strings that start with x, end with y, -and where the x and y are balanced. -This means that, if one reads the string from left to right, -counting +1 for an x and -1 for a y, -the ending y is the first y where the count reaches 0. -For instance, the item %b() matches expressions with -balanced parentheses. -
  • - -
  • -%f[set], a frontier pattern; -such item matches an empty string at any position such that -the next character belongs to set -and the previous character does not belong to set. -The set set is interpreted as previously described. -The beginning and the end of the subject are handled as if -they were the character '\0'. -
  • - -
- - - - -

Pattern:

-A pattern is a sequence of pattern items. -A caret '^' at the beginning of a pattern anchors the match at the -beginning of the subject string. -A '$' at the end of a pattern anchors the match at the -end of the subject string. -At other positions, -'^' and '$' have no special meaning and represent themselves. - - - - - -

Captures:

-A pattern can contain sub-patterns enclosed in parentheses; -they describe captures. -When a match succeeds, the substrings of the subject string -that match captures are stored (captured) for future use. -Captures are numbered according to their left parentheses. -For instance, in the pattern "(a*(.)%w(%s*))", -the part of the string matching "a*(.)%w(%s*)" is -stored as the first capture (and therefore has number 1); -the character matching "." is captured with number 2, -and the part matching "%s*" has number 3. - - -

-As a special case, the empty capture () captures -the current string position (a number). -For instance, if we apply the pattern "()aa()" on the -string "flaaap", there will be two captures: 3 and 5. - - - - - - - -

6.4.2 – Format Strings for Pack and Unpack

- -

-The first argument to string.pack, -string.packsize, and string.unpack -is a format string, -which describes the layout of the structure being created or read. - - -

-A format string is a sequence of conversion options. -The conversion options are as follows: - -

    -
  • <: sets little endian
  • -
  • >: sets big endian
  • -
  • =: sets native endian
  • -
  • ![n]: sets maximum alignment to n -(default is native alignment)
  • -
  • b: a signed byte (char)
  • -
  • B: an unsigned byte (char)
  • -
  • h: a signed short (native size)
  • -
  • H: an unsigned short (native size)
  • -
  • l: a signed long (native size)
  • -
  • L: an unsigned long (native size)
  • -
  • j: a lua_Integer
  • -
  • J: a lua_Unsigned
  • -
  • T: a size_t (native size)
  • -
  • i[n]: a signed int with n bytes -(default is native size)
  • -
  • I[n]: an unsigned int with n bytes -(default is native size)
  • -
  • f: a float (native size)
  • -
  • d: a double (native size)
  • -
  • n: a lua_Number
  • -
  • cn: a fixed-sized string with n bytes
  • -
  • z: a zero-terminated string
  • -
  • s[n]: a string preceded by its length -coded as an unsigned integer with n bytes -(default is a size_t)
  • -
  • x: one byte of padding
  • -
  • Xop: an empty item that aligns -according to option op -(which is otherwise ignored)
  • -
  • ' ': (empty space) ignored
  • -

-(A "[n]" means an optional integral numeral.) -Except for padding, spaces, and configurations -(options "xX <=>!"), -each option corresponds to an argument (in string.pack) -or a result (in string.unpack). - - -

-For options "!n", "sn", "in", and "In", -n can be any integer between 1 and 16. -All integral options check overflows; -string.pack checks whether the given value fits in the given size; -string.unpack checks whether the read value fits in a Lua integer. - - -

-Any format string starts as if prefixed by "!1=", -that is, -with maximum alignment of 1 (no alignment) -and native endianness. - - -

-Alignment works as follows: -For each option, -the format gets extra padding until the data starts -at an offset that is a multiple of the minimum between the -option size and the maximum alignment; -this minimum must be a power of 2. -Options "c" and "z" are not aligned; -option "s" follows the alignment of its starting integer. - - -

-All padding is filled with zeros by string.pack -(and ignored by string.unpack). - - - - - - - -

6.5 – UTF-8 Support

- -

-This library provides basic support for UTF-8 encoding. -It provides all its functions inside the table utf8. -This library does not provide any support for Unicode other -than the handling of the encoding. -Any operation that needs the meaning of a character, -such as character classification, is outside its scope. - - -

-Unless stated otherwise, -all functions that expect a byte position as a parameter -assume that the given position is either the start of a byte sequence -or one plus the length of the subject string. -As in the string library, -negative indices count from the end of the string. - - -

-


utf8.char (···)

-Receives zero or more integers, -converts each one to its corresponding UTF-8 byte sequence -and returns a string with the concatenation of all these sequences. - - - - -

-


utf8.charpattern

-The pattern (a string, not a function) "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" -(see §6.4.1), -which matches exactly one UTF-8 byte sequence, -assuming that the subject is a valid UTF-8 string. - - - - -

-


utf8.codes (s)

- - -

-Returns values so that the construction - -

-     for p, c in utf8.codes(s) do body end
-

-will iterate over all characters in string s, -with p being the position (in bytes) and c the code point -of each character. -It raises an error if it meets any invalid byte sequence. - - - - -

-


utf8.codepoint (s [, i [, j]])

-Returns the codepoints (as integers) from all characters in s -that start between byte position i and j (both included). -The default for i is 1 and for j is i. -It raises an error if it meets any invalid byte sequence. - - - - -

-


utf8.len (s [, i [, j]])

-Returns the number of UTF-8 characters in string s -that start between positions i and j (both inclusive). -The default for i is 1 and for j is -1. -If it finds any invalid byte sequence, -returns a false value plus the position of the first invalid byte. - - - - -

-


utf8.offset (s, n [, i])

-Returns the position (in bytes) where the encoding of the -n-th character of s -(counting from position i) starts. -A negative n gets characters before position i. -The default for i is 1 when n is non-negative -and #s + 1 otherwise, -so that utf8.offset(s, -n) gets the offset of the -n-th character from the end of the string. -If the specified character is neither in the subject -nor right after its end, -the function returns nil. - - -

-As a special case, -when n is 0 the function returns the start of the encoding -of the character that contains the i-th byte of s. - - -

-This function assumes that s is a valid UTF-8 string. - - - - - - - -

6.6 – Table Manipulation

- -

-This library provides generic functions for table manipulation. -It provides all its functions inside the table table. - - -

-Remember that, whenever an operation needs the length of a table, -all caveats about the length operator apply (see §3.4.7). -All functions ignore non-numeric keys -in the tables given as arguments. - - -

-


table.concat (list [, sep [, i [, j]]])

- - -

-Given a list where all elements are strings or numbers, -returns the string list[i]..sep..list[i+1] ··· sep..list[j]. -The default value for sep is the empty string, -the default for i is 1, -and the default for j is #list. -If i is greater than j, returns the empty string. - - - - -

-


table.insert (list, [pos,] value)

- - -

-Inserts element value at position pos in list, -shifting up the elements -list[pos], list[pos+1], ···, list[#list]. -The default value for pos is #list+1, -so that a call table.insert(t,x) inserts x at the end -of list t. - - - - -

-


table.move (a1, f, e, t [,a2])

- - -

-Moves elements from table a1 to table a2, -performing the equivalent to the following -multiple assignment: -a2[t],··· = a1[f],···,a1[e]. -The default for a2 is a1. -The destination range can overlap with the source range. -The number of elements to be moved must fit in a Lua integer. - - -

-Returns the destination table a2. - - - - -

-


table.pack (···)

- - -

-Returns a new table with all parameters stored into keys 1, 2, etc. -and with a field "n" with the total number of parameters. -Note that the resulting table may not be a sequence. - - - - -

-


table.remove (list [, pos])

- - -

-Removes from list the element at position pos, -returning the value of the removed element. -When pos is an integer between 1 and #list, -it shifts down the elements -list[pos+1], list[pos+2], ···, list[#list] -and erases element list[#list]; -The index pos can also be 0 when #list is 0, -or #list + 1; -in those cases, the function erases the element list[pos]. - - -

-The default value for pos is #list, -so that a call table.remove(l) removes the last element -of list l. - - - - -

-


table.sort (list [, comp])

- - -

-Sorts list elements in a given order, in-place, -from list[1] to list[#list]. -If comp is given, -then it must be a function that receives two list elements -and returns true when the first element must come -before the second in the final order -(so that, after the sort, -i < j implies not comp(list[j],list[i])). -If comp is not given, -then the standard Lua operator < is used instead. - - -

-Note that the comp function must define -a strict partial order over the elements in the list; -that is, it must be asymmetric and transitive. -Otherwise, no valid sort may be possible. - - -

-The sort algorithm is not stable: -elements considered equal by the given order -may have their relative positions changed by the sort. - - - - -

-


table.unpack (list [, i [, j]])

- - -

-Returns the elements from the given list. -This function is equivalent to - -

-     return list[i], list[i+1], ···, list[j]
-

-By default, i is 1 and j is #list. - - - - - - - -

6.7 – Mathematical Functions

- -

-This library provides basic mathematical functions. -It provides all its functions and constants inside the table math. -Functions with the annotation "integer/float" give -integer results for integer arguments -and float results for float (or mixed) arguments. -Rounding functions -(math.ceil, math.floor, and math.modf) -return an integer when the result fits in the range of an integer, -or a float otherwise. - - -

-


math.abs (x)

- - -

-Returns the absolute value of x. (integer/float) - - - - -

-


math.acos (x)

- - -

-Returns the arc cosine of x (in radians). - - - - -

-


math.asin (x)

- - -

-Returns the arc sine of x (in radians). - - - - -

-


math.atan (y [, x])

- - -

- -Returns the arc tangent of y/x (in radians), -but uses the signs of both parameters to find the -quadrant of the result. -(It also handles correctly the case of x being zero.) - - -

-The default value for x is 1, -so that the call math.atan(y) -returns the arc tangent of y. - - - - -

-


math.ceil (x)

- - -

-Returns the smallest integral value larger than or equal to x. - - - - -

-


math.cos (x)

- - -

-Returns the cosine of x (assumed to be in radians). - - - - -

-


math.deg (x)

- - -

-Converts the angle x from radians to degrees. - - - - -

-


math.exp (x)

- - -

-Returns the value ex -(where e is the base of natural logarithms). - - - - -

-


math.floor (x)

- - -

-Returns the largest integral value smaller than or equal to x. - - - - -

-


math.fmod (x, y)

- - -

-Returns the remainder of the division of x by y -that rounds the quotient towards zero. (integer/float) - - - - -

-


math.huge

- - -

-The float value HUGE_VAL, -a value larger than any other numeric value. - - - - -

-


math.log (x [, base])

- - -

-Returns the logarithm of x in the given base. -The default for base is e -(so that the function returns the natural logarithm of x). - - - - -

-


math.max (x, ···)

- - -

-Returns the argument with the maximum value, -according to the Lua operator <. (integer/float) - - - - -

-


math.maxinteger

-An integer with the maximum value for an integer. - - - - -

-


math.min (x, ···)

- - -

-Returns the argument with the minimum value, -according to the Lua operator <. (integer/float) - - - - -

-


math.mininteger

-An integer with the minimum value for an integer. - - - - -

-


math.modf (x)

- - -

-Returns the integral part of x and the fractional part of x. -Its second result is always a float. - - - - -

-


math.pi

- - -

-The value of π. - - - - -

-


math.rad (x)

- - -

-Converts the angle x from degrees to radians. - - - - -

-


math.random ([m [, n]])

- - -

-When called without arguments, -returns a pseudo-random float with uniform distribution -in the range [0,1). -When called with two integers m and n, -math.random returns a pseudo-random integer -with uniform distribution in the range [m, n]. -(The value n-m cannot be negative and must fit in a Lua integer.) -The call math.random(n) is equivalent to math.random(1,n). - - -

-This function is an interface to the underling -pseudo-random generator function provided by C. - - - - -

-


math.randomseed (x)

- - -

-Sets x as the "seed" -for the pseudo-random generator: -equal seeds produce equal sequences of numbers. - - - - -

-


math.sin (x)

- - -

-Returns the sine of x (assumed to be in radians). - - - - -

-


math.sqrt (x)

- - -

-Returns the square root of x. -(You can also use the expression x^0.5 to compute this value.) - - - - -

-


math.tan (x)

- - -

-Returns the tangent of x (assumed to be in radians). - - - - -

-


math.tointeger (x)

- - -

-If the value x is convertible to an integer, -returns that integer. -Otherwise, returns nil. - - - - -

-


math.type (x)

- - -

-Returns "integer" if x is an integer, -"float" if it is a float, -or nil if x is not a number. - - - - -

-


math.ult (m, n)

- - -

-Returns a boolean, -true if and only if integer m is below integer n when -they are compared as unsigned integers. - - - - - - - -

6.8 – Input and Output Facilities

- -

-The I/O library provides two different styles for file manipulation. -The first one uses implicit file handles; -that is, there are operations to set a default input file and a -default output file, -and all input/output operations are over these default files. -The second style uses explicit file handles. - - -

-When using implicit file handles, -all operations are supplied by table io. -When using explicit file handles, -the operation io.open returns a file handle -and then all operations are supplied as methods of the file handle. - - -

-The table io also provides -three predefined file handles with their usual meanings from C: -io.stdin, io.stdout, and io.stderr. -The I/O library never closes these files. - - -

-Unless otherwise stated, -all I/O functions return nil on failure -(plus an error message as a second result and -a system-dependent error code as a third result) -and some value different from nil on success. -On non-POSIX systems, -the computation of the error message and error code -in case of errors -may be not thread safe, -because they rely on the global C variable errno. - - -

-


io.close ([file])

- - -

-Equivalent to file:close(). -Without a file, closes the default output file. - - - - -

-


io.flush ()

- - -

-Equivalent to io.output():flush(). - - - - -

-


io.input ([file])

- - -

-When called with a file name, it opens the named file (in text mode), -and sets its handle as the default input file. -When called with a file handle, -it simply sets this file handle as the default input file. -When called without parameters, -it returns the current default input file. - - -

-In case of errors this function raises the error, -instead of returning an error code. - - - - -

-


io.lines ([filename, ···])

- - -

-Opens the given file name in read mode -and returns an iterator function that -works like file:lines(···) over the opened file. -When the iterator function detects the end of file, -it returns no values (to finish the loop) and automatically closes the file. - - -

-The call io.lines() (with no file name) is equivalent -to io.input():lines("*l"); -that is, it iterates over the lines of the default input file. -In this case it does not close the file when the loop ends. - - -

-In case of errors this function raises the error, -instead of returning an error code. - - - - -

-


io.open (filename [, mode])

- - -

-This function opens a file, -in the mode specified in the string mode. -In case of success, -it returns a new file handle. - - -

-The mode string can be any of the following: - -

    -
  • "r": read mode (the default);
  • -
  • "w": write mode;
  • -
  • "a": append mode;
  • -
  • "r+": update mode, all previous data is preserved;
  • -
  • "w+": update mode, all previous data is erased;
  • -
  • "a+": append update mode, previous data is preserved, - writing is only allowed at the end of file.
  • -

-The mode string can also have a 'b' at the end, -which is needed in some systems to open the file in binary mode. - - - - -

-


io.output ([file])

- - -

-Similar to io.input, but operates over the default output file. - - - - -

-


io.popen (prog [, mode])

- - -

-This function is system dependent and is not available -on all platforms. - - -

-Starts program prog in a separated process and returns -a file handle that you can use to read data from this program -(if mode is "r", the default) -or to write data to this program -(if mode is "w"). - - - - -

-


io.read (···)

- - -

-Equivalent to io.input():read(···). - - - - -

-


io.tmpfile ()

- - -

-In case of success, -returns a handle for a temporary file. -This file is opened in update mode -and it is automatically removed when the program ends. - - - - -

-


io.type (obj)

- - -

-Checks whether obj is a valid file handle. -Returns the string "file" if obj is an open file handle, -"closed file" if obj is a closed file handle, -or nil if obj is not a file handle. - - - - -

-


io.write (···)

- - -

-Equivalent to io.output():write(···). - - - - -

-


file:close ()

- - -

-Closes file. -Note that files are automatically closed when -their handles are garbage collected, -but that takes an unpredictable amount of time to happen. - - -

-When closing a file handle created with io.popen, -file:close returns the same values -returned by os.execute. - - - - -

-


file:flush ()

- - -

-Saves any written data to file. - - - - -

-


file:lines (···)

- - -

-Returns an iterator function that, -each time it is called, -reads the file according to the given formats. -When no format is given, -uses "l" as a default. -As an example, the construction - -

-     for c in file:lines(1) do body end
-

-will iterate over all characters of the file, -starting at the current position. -Unlike io.lines, this function does not close the file -when the loop ends. - - -

-In case of errors this function raises the error, -instead of returning an error code. - - - - -

-


file:read (···)

- - -

-Reads the file file, -according to the given formats, which specify what to read. -For each format, -the function returns a string or a number with the characters read, -or nil if it cannot read data with the specified format. -(In this latter case, -the function does not read subsequent formats.) -When called without formats, -it uses a default format that reads the next line -(see below). - - -

-The available formats are - -

    - -
  • "n": -reads a numeral and returns it as a float or an integer, -following the lexical conventions of Lua. -(The numeral may have leading spaces and a sign.) -This format always reads the longest input sequence that -is a valid prefix for a numeral; -if that prefix does not form a valid numeral -(e.g., an empty string, "0x", or "3.4e-"), -it is discarded and the function returns nil. -
  • - -
  • "a": -reads the whole file, starting at the current position. -On end of file, it returns the empty string. -
  • - -
  • "l": -reads the next line skipping the end of line, -returning nil on end of file. -This is the default format. -
  • - -
  • "L": -reads the next line keeping the end-of-line character (if present), -returning nil on end of file. -
  • - -
  • number: -reads a string with up to this number of bytes, -returning nil on end of file. -If number is zero, -it reads nothing and returns an empty string, -or nil on end of file. -
  • - -

-The formats "l" and "L" should be used only for text files. - - - - -

-


file:seek ([whence [, offset]])

- - -

-Sets and gets the file position, -measured from the beginning of the file, -to the position given by offset plus a base -specified by the string whence, as follows: - -

    -
  • "set": base is position 0 (beginning of the file);
  • -
  • "cur": base is current position;
  • -
  • "end": base is end of file;
  • -

-In case of success, seek returns the final file position, -measured in bytes from the beginning of the file. -If seek fails, it returns nil, -plus a string describing the error. - - -

-The default value for whence is "cur", -and for offset is 0. -Therefore, the call file:seek() returns the current -file position, without changing it; -the call file:seek("set") sets the position to the -beginning of the file (and returns 0); -and the call file:seek("end") sets the position to the -end of the file, and returns its size. - - - - -

-


file:setvbuf (mode [, size])

- - -

-Sets the buffering mode for an output file. -There are three available modes: - -

    - -
  • "no": -no buffering; the result of any output operation appears immediately. -
  • - -
  • "full": -full buffering; output operation is performed only -when the buffer is full or when -you explicitly flush the file (see io.flush). -
  • - -
  • "line": -line buffering; output is buffered until a newline is output -or there is any input from some special files -(such as a terminal device). -
  • - -

-For the last two cases, size -specifies the size of the buffer, in bytes. -The default is an appropriate size. - - - - -

-


file:write (···)

- - -

-Writes the value of each of its arguments to file. -The arguments must be strings or numbers. - - -

-In case of success, this function returns file. -Otherwise it returns nil plus a string describing the error. - - - - - - - -

6.9 – Operating System Facilities

- -

-This library is implemented through table os. - - -

-


os.clock ()

- - -

-Returns an approximation of the amount in seconds of CPU time -used by the program. - - - - -

-


os.date ([format [, time]])

- - -

-Returns a string or a table containing date and time, -formatted according to the given string format. - - -

-If the time argument is present, -this is the time to be formatted -(see the os.time function for a description of this value). -Otherwise, date formats the current time. - - -

-If format starts with '!', -then the date is formatted in Coordinated Universal Time. -After this optional character, -if format is the string "*t", -then date returns a table with the following fields: -year, month (1–12), day (1–31), -hour (0–23), min (0–59), sec (0–61), -wday (weekday, 1–7, Sunday is 1), -yday (day of the year, 1–366), -and isdst (daylight saving flag, a boolean). -This last field may be absent -if the information is not available. - - -

-If format is not "*t", -then date returns the date as a string, -formatted according to the same rules as the ISO C function strftime. - - -

-When called without arguments, -date returns a reasonable date and time representation that depends on -the host system and on the current locale. -(More specifically, os.date() is equivalent to os.date("%c").) - - -

-On non-POSIX systems, -this function may be not thread safe -because of its reliance on C function gmtime and C function localtime. - - - - -

-


os.difftime (t2, t1)

- - -

-Returns the difference, in seconds, -from time t1 to time t2 -(where the times are values returned by os.time). -In POSIX, Windows, and some other systems, -this value is exactly t2-t1. - - - - -

-


os.execute ([command])

- - -

-This function is equivalent to the ISO C function system. -It passes command to be executed by an operating system shell. -Its first result is true -if the command terminated successfully, -or nil otherwise. -After this first result -the function returns a string plus a number, -as follows: - -

    - -
  • "exit": -the command terminated normally; -the following number is the exit status of the command. -
  • - -
  • "signal": -the command was terminated by a signal; -the following number is the signal that terminated the command. -
  • - -
- -

-When called without a command, -os.execute returns a boolean that is true if a shell is available. - - - - -

-


os.exit ([code [, close]])

- - -

-Calls the ISO C function exit to terminate the host program. -If code is true, -the returned status is EXIT_SUCCESS; -if code is false, -the returned status is EXIT_FAILURE; -if code is a number, -the returned status is this number. -The default value for code is true. - - -

-If the optional second argument close is true, -closes the Lua state before exiting. - - - - -

-


os.getenv (varname)

- - -

-Returns the value of the process environment variable varname, -or nil if the variable is not defined. - - - - -

-


os.remove (filename)

- - -

-Deletes the file (or empty directory, on POSIX systems) -with the given name. -If this function fails, it returns nil, -plus a string describing the error and the error code. -Otherwise, it returns true. - - - - -

-


os.rename (oldname, newname)

- - -

-Renames the file or directory named oldname to newname. -If this function fails, it returns nil, -plus a string describing the error and the error code. -Otherwise, it returns true. - - - - -

-


os.setlocale (locale [, category])

- - -

-Sets the current locale of the program. -locale is a system-dependent string specifying a locale; -category is an optional string describing which category to change: -"all", "collate", "ctype", -"monetary", "numeric", or "time"; -the default category is "all". -The function returns the name of the new locale, -or nil if the request cannot be honored. - - -

-If locale is the empty string, -the current locale is set to an implementation-defined native locale. -If locale is the string "C", -the current locale is set to the standard C locale. - - -

-When called with nil as the first argument, -this function only returns the name of the current locale -for the given category. - - -

-This function may be not thread safe -because of its reliance on C function setlocale. - - - - -

-


os.time ([table])

- - -

-Returns the current time when called without arguments, -or a time representing the local date and time specified by the given table. -This table must have fields year, month, and day, -and may have fields -hour (default is 12), -min (default is 0), -sec (default is 0), -and isdst (default is nil). -Other fields are ignored. -For a description of these fields, see the os.date function. - - -

-The values in these fields do not need to be inside their valid ranges. -For instance, if sec is -10, -it means -10 seconds from the time specified by the other fields; -if hour is 1000, -it means +1000 hours from the time specified by the other fields. - - -

-The returned value is a number, whose meaning depends on your system. -In POSIX, Windows, and some other systems, -this number counts the number -of seconds since some given start time (the "epoch"). -In other systems, the meaning is not specified, -and the number returned by time can be used only as an argument to -os.date and os.difftime. - - - - -

-


os.tmpname ()

- - -

-Returns a string with a file name that can -be used for a temporary file. -The file must be explicitly opened before its use -and explicitly removed when no longer needed. - - -

-On POSIX systems, -this function also creates a file with that name, -to avoid security risks. -(Someone else might create the file with wrong permissions -in the time between getting the name and creating the file.) -You still have to open the file to use it -and to remove it (even if you do not use it). - - -

-When possible, -you may prefer to use io.tmpfile, -which automatically removes the file when the program ends. - - - - - - - -

6.10 – The Debug Library

- -

-This library provides -the functionality of the debug interface (§4.9) to Lua programs. -You should exert care when using this library. -Several of its functions -violate basic assumptions about Lua code -(e.g., that variables local to a function -cannot be accessed from outside; -that userdata metatables cannot be changed by Lua code; -that Lua programs do not crash) -and therefore can compromise otherwise secure code. -Moreover, some functions in this library may be slow. - - -

-All functions in this library are provided -inside the debug table. -All functions that operate over a thread -have an optional first argument which is the -thread to operate over. -The default is always the current thread. - - -

-


debug.debug ()

- - -

-Enters an interactive mode with the user, -running each string that the user enters. -Using simple commands and other debug facilities, -the user can inspect global and local variables, -change their values, evaluate expressions, and so on. -A line containing only the word cont finishes this function, -so that the caller continues its execution. - - -

-Note that commands for debug.debug are not lexically nested -within any function and so have no direct access to local variables. - - - - -

-


debug.gethook ([thread])

- - -

-Returns the current hook settings of the thread, as three values: -the current hook function, the current hook mask, -and the current hook count -(as set by the debug.sethook function). - - - - -

-


debug.getinfo ([thread,] f [, what])

- - -

-Returns a table with information about a function. -You can give the function directly -or you can give a number as the value of f, -which means the function running at level f of the call stack -of the given thread: -level 0 is the current function (getinfo itself); -level 1 is the function that called getinfo -(except for tail calls, which do not count on the stack); -and so on. -If f is a number larger than the number of active functions, -then getinfo returns nil. - - -

-The returned table can contain all the fields returned by lua_getinfo, -with the string what describing which fields to fill in. -The default for what is to get all information available, -except the table of valid lines. -If present, -the option 'f' -adds a field named func with the function itself. -If present, -the option 'L' -adds a field named activelines with the table of -valid lines. - - -

-For instance, the expression debug.getinfo(1,"n").name returns -a name for the current function, -if a reasonable name can be found, -and the expression debug.getinfo(print) -returns a table with all available information -about the print function. - - - - -

-


debug.getlocal ([thread,] f, local)

- - -

-This function returns the name and the value of the local variable -with index local of the function at level f of the stack. -This function accesses not only explicit local variables, -but also parameters, temporaries, etc. - - -

-The first parameter or local variable has index 1, and so on, -following the order that they are declared in the code, -counting only the variables that are active -in the current scope of the function. -Negative indices refer to vararg parameters; --1 is the first vararg parameter. -The function returns nil if there is no variable with the given index, -and raises an error when called with a level out of range. -(You can call debug.getinfo to check whether the level is valid.) - - -

-Variable names starting with '(' (open parenthesis) -represent variables with no known names -(internal variables such as loop control variables, -and variables from chunks saved without debug information). - - -

-The parameter f may also be a function. -In that case, getlocal returns only the name of function parameters. - - - - -

-


debug.getmetatable (value)

- - -

-Returns the metatable of the given value -or nil if it does not have a metatable. - - - - -

-


debug.getregistry ()

- - -

-Returns the registry table (see §4.5). - - - - -

-


debug.getupvalue (f, up)

- - -

-This function returns the name and the value of the upvalue -with index up of the function f. -The function returns nil if there is no upvalue with the given index. - - -

-Variable names starting with '(' (open parenthesis) -represent variables with no known names -(variables from chunks saved without debug information). - - - - -

-


debug.getuservalue (u)

- - -

-Returns the Lua value associated to u. -If u is not a full userdata, -returns nil. - - - - -

-


debug.sethook ([thread,] hook, mask [, count])

- - -

-Sets the given function as a hook. -The string mask and the number count describe -when the hook will be called. -The string mask may have any combination of the following characters, -with the given meaning: - -

    -
  • 'c': the hook is called every time Lua calls a function;
  • -
  • 'r': the hook is called every time Lua returns from a function;
  • -
  • 'l': the hook is called every time Lua enters a new line of code.
  • -

-Moreover, -with a count different from zero, -the hook is called also after every count instructions. - - -

-When called without arguments, -debug.sethook turns off the hook. - - -

-When the hook is called, its first parameter is a string -describing the event that has triggered its call: -"call" (or "tail call"), -"return", -"line", and "count". -For line events, -the hook also gets the new line number as its second parameter. -Inside a hook, -you can call getinfo with level 2 to get more information about -the running function -(level 0 is the getinfo function, -and level 1 is the hook function). - - - - -

-


debug.setlocal ([thread,] level, local, value)

- - -

-This function assigns the value value to the local variable -with index local of the function at level level of the stack. -The function returns nil if there is no local -variable with the given index, -and raises an error when called with a level out of range. -(You can call getinfo to check whether the level is valid.) -Otherwise, it returns the name of the local variable. - - -

-See debug.getlocal for more information about -variable indices and names. - - - - -

-


debug.setmetatable (value, table)

- - -

-Sets the metatable for the given value to the given table -(which can be nil). -Returns value. - - - - -

-


debug.setupvalue (f, up, value)

- - -

-This function assigns the value value to the upvalue -with index up of the function f. -The function returns nil if there is no upvalue -with the given index. -Otherwise, it returns the name of the upvalue. - - - - -

-


debug.setuservalue (udata, value)

- - -

-Sets the given value as -the Lua value associated to the given udata. -udata must be a full userdata. - - -

-Returns udata. - - - - -

-


debug.traceback ([thread,] [message [, level]])

- - -

-If message is present but is neither a string nor nil, -this function returns message without further processing. -Otherwise, -it returns a string with a traceback of the call stack. -The optional message string is appended -at the beginning of the traceback. -An optional level number tells at which level -to start the traceback -(default is 1, the function calling traceback). - - - - -

-


debug.upvalueid (f, n)

- - -

-Returns a unique identifier (as a light userdata) -for the upvalue numbered n -from the given function. - - -

-These unique identifiers allow a program to check whether different -closures share upvalues. -Lua closures that share an upvalue -(that is, that access a same external local variable) -will return identical ids for those upvalue indices. - - - - -

-


debug.upvaluejoin (f1, n1, f2, n2)

- - -

-Make the n1-th upvalue of the Lua closure f1 -refer to the n2-th upvalue of the Lua closure f2. - - - - - - - -

7 – Lua Standalone

- -

-Although Lua has been designed as an extension language, -to be embedded in a host C program, -it is also frequently used as a standalone language. -An interpreter for Lua as a standalone language, -called simply lua, -is provided with the standard distribution. -The standalone interpreter includes -all standard libraries, including the debug library. -Its usage is: - -

-     lua [options] [script [args]]
-

-The options are: - -

    -
  • -e stat: executes string stat;
  • -
  • -l mod: "requires" mod;
  • -
  • -i: enters interactive mode after running script;
  • -
  • -v: prints version information;
  • -
  • -E: ignores environment variables;
  • -
  • --: stops handling options;
  • -
  • -: executes stdin as a file and stops handling options.
  • -

-After handling its options, lua runs the given script. -When called without arguments, -lua behaves as lua -v -i -when the standard input (stdin) is a terminal, -and as lua - otherwise. - - -

-When called without option -E, -the interpreter checks for an environment variable LUA_INIT_5_3 -(or LUA_INIT if the versioned name is not defined) -before running any argument. -If the variable content has the format @filename, -then lua executes the file. -Otherwise, lua executes the string itself. - - -

-When called with option -E, -besides ignoring LUA_INIT, -Lua also ignores -the values of LUA_PATH and LUA_CPATH, -setting the values of -package.path and package.cpath -with the default paths defined in luaconf.h. - - -

-All options are handled in order, except -i and -E. -For instance, an invocation like - -

-     $ lua -e'a=1' -e 'print(a)' script.lua
-

-will first set a to 1, then print the value of a, -and finally run the file script.lua with no arguments. -(Here $ is the shell prompt. Your prompt may be different.) - - -

-Before running any code, -lua collects all command-line arguments -in a global table called arg. -The script name goes to index 0, -the first argument after the script name goes to index 1, -and so on. -Any arguments before the script name -(that is, the interpreter name plus its options) -go to negative indices. -For instance, in the call - -

-     $ lua -la b.lua t1 t2
-

-the table is like this: - -

-     arg = { [-2] = "lua", [-1] = "-la",
-             [0] = "b.lua",
-             [1] = "t1", [2] = "t2" }
-

-If there is no script in the call, -the interpreter name goes to index 0, -followed by the other arguments. -For instance, the call - -

-     $ lua -e "print(arg[1])"
-

-will print "-e". -If there is a script, -the script is called with parameters -arg[1], ···, arg[#arg]. -(Like all chunks in Lua, -the script is compiled as a vararg function.) - - -

-In interactive mode, -Lua repeatedly prompts and waits for a line. -After reading a line, -Lua first try to interpret the line as an expression. -If it succeeds, it prints its value. -Otherwise, it interprets the line as a statement. -If you write an incomplete statement, -the interpreter waits for its completion -by issuing a different prompt. - - -

-If the global variable _PROMPT contains a string, -then its value is used as the prompt. -Similarly, if the global variable _PROMPT2 contains a string, -its value is used as the secondary prompt -(issued during incomplete statements). - - -

-In case of unprotected errors in the script, -the interpreter reports the error to the standard error stream. -If the error object is not a string but -has a metamethod __tostring, -the interpreter calls this metamethod to produce the final message. -Otherwise, the interpreter converts the error object to a string -and adds a stack traceback to it. - - -

-When finishing normally, -the interpreter closes its main Lua state -(see lua_close). -The script can avoid this step by -calling os.exit to terminate. - - -

-To allow the use of Lua as a -script interpreter in Unix systems, -the standalone interpreter skips -the first line of a chunk if it starts with #. -Therefore, Lua scripts can be made into executable programs -by using chmod +x and the #! form, -as in - -

-     #!/usr/local/bin/lua
-

-(Of course, -the location of the Lua interpreter may be different in your machine. -If lua is in your PATH, -then - -

-     #!/usr/bin/env lua
-

-is a more portable solution.) - - - -

8 – Incompatibilities with the Previous Version

- -

-Here we list the incompatibilities that you may find when moving a program -from Lua 5.2 to Lua 5.3. -You can avoid some incompatibilities by compiling Lua with -appropriate options (see file luaconf.h). -However, -all these compatibility options will be removed in the future. - - -

-Lua versions can always change the C API in ways that -do not imply source-code changes in a program, -such as the numeric values for constants -or the implementation of functions as macros. -Therefore, -you should not assume that binaries are compatible between -different Lua versions. -Always recompile clients of the Lua API when -using a new version. - - -

-Similarly, Lua versions can always change the internal representation -of precompiled chunks; -precompiled chunks are not compatible between different Lua versions. - - -

-The standard paths in the official distribution may -change between versions. - - - -

8.1 – Changes in the Language

-
    - -
  • -The main difference between Lua 5.2 and Lua 5.3 is the -introduction of an integer subtype for numbers. -Although this change should not affect "normal" computations, -some computations -(mainly those that involve some kind of overflow) -can give different results. - - -

    -You can fix these differences by forcing a number to be a float -(in Lua 5.2 all numbers were float), -in particular writing constants with an ending .0 -or using x = x + 0.0 to convert a variable. -(This recommendation is only for a quick fix -for an occasional incompatibility; -it is not a general guideline for good programming. -For good programming, -use floats where you need floats -and integers where you need integers.) -

  • - -
  • -The conversion of a float to a string now adds a .0 suffix -to the result if it looks like an integer. -(For instance, the float 2.0 will be printed as 2.0, -not as 2.) -You should always use an explicit format -when you need a specific format for numbers. - - -

    -(Formally this is not an incompatibility, -because Lua does not specify how numbers are formatted as strings, -but some programs assumed a specific format.) -

  • - -
  • -The generational mode for the garbage collector was removed. -(It was an experimental feature in Lua 5.2.) -
  • - -
- - - - -

8.2 – Changes in the Libraries

-
    - -
  • -The bit32 library has been deprecated. -It is easy to require a compatible external library or, -better yet, to replace its functions with appropriate bitwise operations. -(Keep in mind that bit32 operates on 32-bit integers, -while the bitwise operators in Lua 5.3 operate on Lua integers, -which by default have 64 bits.) -
  • - -
  • -The Table library now respects metamethods -for setting and getting elements. -
  • - -
  • -The ipairs iterator now respects metamethods and -its __ipairs metamethod has been deprecated. -
  • - -
  • -Option names in io.read do not have a starting '*' anymore. -For compatibility, Lua will continue to accept (and ignore) this character. -
  • - -
  • -The following functions were deprecated in the mathematical library: -atan2, cosh, sinh, tanh, pow, -frexp, and ldexp. -You can replace math.pow(x,y) with x^y; -you can replace math.atan2 with math.atan, -which now accepts one or two parameters; -you can replace math.ldexp(x,exp) with x * 2.0^exp. -For the other operations, -you can either use an external library or -implement them in Lua. -
  • - -
  • -The searcher for C loaders used by require -changed the way it handles versioned names. -Now, the version should come after the module name -(as is usual in most other tools). -For compatibility, that searcher still tries the old format -if it cannot find an open function according to the new style. -(Lua 5.2 already worked that way, -but it did not document the change.) -
  • - -
  • -The call collectgarbage("count") now returns only one result. -(You can compute that second result from the fractional part -of the first result.) -
  • - -
- - - - -

8.3 – Changes in the API

- - -
    - -
  • -Continuation functions now receive as parameters what they needed -to get through lua_getctx, -so lua_getctx has been removed. -Adapt your code accordingly. -
  • - -
  • -Function lua_dump has an extra parameter, strip. -Use 0 as the value of this parameter to get the old behavior. -
  • - -
  • -Functions to inject/project unsigned integers -(lua_pushunsigned, lua_tounsigned, lua_tounsignedx, -luaL_checkunsigned, luaL_optunsigned) -were deprecated. -Use their signed equivalents with a type cast. -
  • - -
  • -Macros to project non-default integer types -(luaL_checkint, luaL_optint, luaL_checklong, luaL_optlong) -were deprecated. -Use their equivalent over lua_Integer with a type cast -(or, when possible, use lua_Integer in your code). -
  • - -
- - - - -

9 – The Complete Syntax of Lua

- -

-Here is the complete syntax of Lua in extended BNF. -As usual in extended BNF, -{A} means 0 or more As, -and [A] means an optional A. -(For operator precedences, see §3.4.8; -for a description of the terminals -Name, Numeral, -and LiteralString, see §3.1.) - - - - -

-
-	chunk ::= block
-
-	block ::= {stat} [retstat]
-
-	stat ::=  ‘;’ | 
-		 varlist ‘=’ explist | 
-		 functioncall | 
-		 label | 
-		 break | 
-		 goto Name | 
-		 do block end | 
-		 while exp do block end | 
-		 repeat block until exp | 
-		 if exp then block {elseif exp then block} [else block] end | 
-		 for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 
-		 for namelist in explist do block end | 
-		 function funcname funcbody | 
-		 local function Name funcbody | 
-		 local namelist [‘=’ explist] 
-
-	retstat ::= return [explist] [‘;’]
-
-	label ::= ‘::’ Name ‘::’
-
-	funcname ::= Name {‘.’ Name} [‘:’ Name]
-
-	varlist ::= var {‘,’ var}
-
-	var ::=  Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name 
-
-	namelist ::= Name {‘,’ Name}
-
-	explist ::= exp {‘,’ exp}
-
-	exp ::=  nil | false | true | Numeral | LiteralString | ‘...’ | functiondef | 
-		 prefixexp | tableconstructor | exp binop exp | unop exp 
-
-	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
-
-	functioncall ::=  prefixexp args | prefixexp ‘:’ Name args 
-
-	args ::=  ‘(’ [explist] ‘)’ | tableconstructor | LiteralString 
-
-	functiondef ::= function funcbody
-
-	funcbody ::= ‘(’ [parlist] ‘)’ block end
-
-	parlist ::= namelist [‘,’ ‘...’] | ‘...’
-
-	tableconstructor ::= ‘{’ [fieldlist] ‘}’
-
-	fieldlist ::= field {fieldsep field} [fieldsep]
-
-	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
-
-	fieldsep ::= ‘,’ | ‘;’
-
-	binop ::=  ‘+’ | ‘-’ | ‘*’ | ‘/’ | ‘//’ | ‘^’ | ‘%’ | 
-		 ‘&’ | ‘~’ | ‘|’ | ‘>>’ | ‘<<’ | ‘..’ | 
-		 ‘<’ | ‘<=’ | ‘>’ | ‘>=’ | ‘==’ | ‘~=’ | 
-		 and | or
-
-	unop ::= ‘-’ | not | ‘#’ | ‘~’
-
-
- -

- - - - - - - -

- - - - diff --git a/deps/rcheevos/test/lua/doc/osi-certified-72x60.png b/deps/rcheevos/test/lua/doc/osi-certified-72x60.png deleted file mode 100644 index 07df5f6ee7a7a8b2108025dcd815f73f145a83af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3774 zcmV;v4ngsWP)$kl5 zqcT7g&?zu8?ezWYz4zUB-|zR9d+&Qy2xAN{qY(ew0A7^*gV^7jytKqPFV3{hZfovn zs%x!l>(m&Gdb8C+5XeR7>h0kj=o=X3A39;2KLYfEMt>p1YMW~dt`rpAC{lN~P>5pq zH1L4nAdCT17}*hN=LnEsvMl=5Ij^QArAa&_V~zoht-Ei~)E~(Ivhe0#jik{t$isEK znCH$TxCB8EKmcF>3@pRaHpbR%Gqm*dsZA4H{j(NjZFp^iNFW+RBx6R*X19J*`0XG5 z^Y>cR=^Hi9#ovYGlbFSr#Q*^PgCGC^gb*SC5TcBfzQLe-r2m!Quik&_g9XzTj0qSR zD`FkG_RYWDa^+#UUxL&t+!K+&(ion@Fd`5l5p7{Qsva9vegC|4^NzJUMvn)^gqWsF zvu^j=%FfCVg^cgbXDRl1DE$lsfe;BjjmFmRHER~E-MeWoNsyyNHCpG%Y}igd_(Md;&9La8_B075NDRX9gTD zIHY`}9E~aGi9Kk1@P~rmPna=*=gz~UTdTpsQmjX)J23%v9NliQS)8`xJh6Qz_nE~e z&tP|!dcJdo;JMNa3>afSx$lko8>fp-I}OiCVz(dOF1u6e8$IrsSP?=5mp~lkaFqm? zAUMxRq%ecIu3WE)Uf=%p8g z+RSY?G=VO%wAfdICj?Uzb+5jr{8m|)i#{M}JjaDIoXf#1=DYLwX;1EW&sijPvm6EkBGuOx6r~lKv`g`yH?)|&PRUr$5Ibw2HBM7C74XvE@gaPjN+@;j$J)AgYhnT-U5m+wj|Wz8K630AfO8PUoGD^^Mcq zY9C<~%wUm^u%ox5P21)KNN0$(v^OI$A~?iwsS_fRu1+`EH|CRdpA4zsk8Z#|?x@^vVEAL+2JxH%&^{JUU%B=?EU7`Ar*Q|JvqPofcBt765(*f5JI$>=3{<%K)4ei zogo$)5XP}_X$y^pIYyWTt}EAnhTq}u4sAdBvC(WC{I#x4^>$vCvQ0UDs^18sAQG9o zEaP0qjrSSv1W0FyO%9&y$@em~n@8}}EXBG6x%ew49J_q%l@As_XnNpi|MTTPr~ca_ zW%uon6dBKL*pvzYFvf<~p6K8hK9BDNNN0$7xp^hWC3n^7FoQ?P(=m(6!Pj&S2f1fqH=`(w)KcPl5aEi2}~4hF*f*g}vaS-=c7v>N8c z{yNM*%+azq=@prWtgpi~^3?^AsJqS(>=pb=6PrGH#=O{Hcho$_F#MtsK$$3e2fZvg zy}!-V%`+uFMOW87LIgu3vKuMgqwY0}*Sd;aokQp(F#-{}Ss(Iy1iekY1ZQX?1WEL? z7=zq`lH-#Hw=bHRio3yPun%`c5rI1Hb|wTSWTs|12Mg#QkkwTmy zAYul0H*_b(BnkP#!R_&p@d54uz0JKthGv3C^fdKS%~alookE`QX@%#MQN2=SFWrOha7Ij7ImStNaWsy~? zsylUeT02_-z-G4s0L!v=+Wx|cxr$tmY&$a1by8z#6HBp!*9{@mU9XQ0h@L%V_R}4g z&s#2{MCOj4`5ux-SUautC5@{U895o-biKMWWoQ09{|jx8wz}@_(ep%Yk4{90C#s6-sa}fU5{}m>#>VtE_b#5bn8O+3k{&6GoEkB;yGie;A_5Uy zqPN*tU()pE+_&~``5XX({el-xT_}%`%fsc>_0@m5{+FhXru>rpyLESe31R>cK^FFrCm+#WL$-D{Z3*9>Lg{wi}xEYn_`@Hy`-d z1N}kIY%@Eu&Bpe|Rr6N;%Yk>6&RI$lgpIO26BYT%C!dU-o4bqqQpGY?p6lPru6Hzc z@WuSDI^BYaDH*>R)~)$V1J0Edn4r(9vo>E<2XjOJr2*G124;t^U+p{iUnZN5oapCpCk(F}}<#3ZZli!Nk z^UWT;Q9qm-i`i$kJS}5P%puBJ<&krTO;*#$Y7d$o96EbQ{aF1XFpTj}wf}eI|IOba z%w}_CWu?JjkV>U-ad9L$@Mu$CU;pUQBZgt5QmI@n=W@9K(A(SF-rnxzy|_!5ekKqCQTad`sa|&&Q6jfy}iAEst?|mH*emIjg9SB zRVWlHl?r3bvh2qnf6V6(+>4TulB%kzFveeh{k1?K*t&J=m>dk9P8SjqQdn4sF;*&- z(b3VFnVH$y*$Rb%rs zefJ#z#KpyZ_0?C$jvY%)O?7a?7#}%u1OT>d*)keF*REZ=c=4j6tkr5MilS*cB_$;< zFArmEv)Oby-7}4>TD9uE_ulKT4s6Bp@^Y0*rBEo&o;?cy8#Zi^%jH+DTv4f1SFc_L zfc5LwXJ=;vKt@K!?%liR&!6Almmq$2R@G|tg$oyGnpP+jQBhF<(9qCOR8%AuiBtJCSc zyu1LQw6wIQre^Zw$^E0N)#}R1%J}$rkw`Qc#z0A{)dIkjDN`I(PfyS2=x9f~R4N64 zPe1*1=gytQ#l=RWao4V0bLY-=?Bpl*dQDA@LZMJ9l{Gar$;rvzfB$`Tb#+==T0=ua zSy@?1N{UXWyL9Q&#*G`Zv$GE#JXljxBauj2T3VD!rO9N<%F3#*uP-Sn(P%W=w{Jgx z{(NC!VNOmC0OaN6ZQHg@tJQw^;fGtdZUulVSFX&NGv~~iGoO9-nNq0~2n78w23E{L zmth7T3|W>10ISuSm6cUgRCMXmr5!tV0D!x@`?6)rcI?<8lgZ#IIehqVOiYYpi@x#3 z8xau^+1c4ER;th&( zVHk--A`l3|!os9dsYatANm8TH96x@%qM{-&FmUtc&2qVX-MV%A_U(J~%{TY#*<&ym zX3Ur|c$No?u%e>k#EBDaZEY7XUVLH`0zh|n zw_~XRz;RH!y1MS)zn_X$Km70mNs@ZKo~G$z$BuD09F}FpVzEY}F&d2ug#rLPJUpgPpKh}a^y$-i zJl@%}XHT6vRaaNHckf=MQYn>6Fk&*D<+ja0B z5C{a#&CQN-V`HPyXe3EeAP~gH#>U3RayT5ZSd1}tbaaSNDAZ^)j%n&QHMoE=7KubA zlWEeVNpiV7Dk=&gzM|0Dz(>0HA5Q-_F}_znz(xxqbU~E|+`a#EH|V zPjA|^DJLg~rs?+f_6rv-T)upnAP7fChoq;cFJHcV=gyt)zWXjs(+gZ<%kMDTlOd1+TFW%&z(D`)oKF*0@Bmd zLqkIy?RvewprGK+ojWv5%Ve?@D^>&r1p$CcrMhuv}x1&joiO~|IC>)G) - - -Lua 5.3 readme - - - - - - - -

-Lua -Welcome to Lua 5.3 -

- - - -

About Lua

-

-Lua is a powerful, fast, lightweight, embeddable scripting language -developed by a -team -at -PUC-Rio, -the Pontifical Catholic University of Rio de Janeiro in Brazil. -Lua is -free software -used in many products and projects around the world. - -

-Lua's -official web site -provides complete information -about Lua, -including -an -executive summary -and -updated -documentation, -especially the -reference manual, -which may differ slightly from the -local copy -distributed in this package. - -

Installing Lua

-

-Lua is distributed in -source -form. -You need to build it before using it. -Building Lua should be straightforward -because -Lua is implemented in pure ANSI C and compiles unmodified in all known -platforms that have an ANSI C compiler. -Lua also compiles unmodified as C++. -The instructions given below for building Lua are for Unix-like platforms. -See also -instructions for other systems -and -customization options. - -

-If you don't have the time or the inclination to compile Lua yourself, -get a binary from -LuaBinaries. -Try also -LuaDist, -a multi-platform distribution of Lua that includes batteries. - -

Building Lua

-

-In most Unix-like platforms, simply do "make" with a suitable target. -Here are the details. - -

    -
  1. -Open a terminal window and move to -the top-level directory, which is named lua-5.3.x. -The Makefile there controls both the build process and the installation process. -

    -

  2. - Do "make" and see if your platform is listed. - The platforms currently supported are: -

    -

    - aix bsd c89 freebsd generic linux macosx mingw posix solaris -

    -

    - If your platform is listed, just do "make xxx", where xxx - is your platform name. -

    - If your platform is not listed, try the closest one or posix, generic, - c89, in this order. -

    -

  3. -The compilation takes only a few moments -and produces three files in the src directory: -lua (the interpreter), -luac (the compiler), -and liblua.a (the library). -

    -

  4. - To check that Lua has been built correctly, do "make test" - after building Lua. This will run the interpreter and print its version. -
-

-If you're running Linux and get compilation errors, -make sure you have installed the readline development package -(which is probably named libreadline-dev or readline-devel). -If you get link errors after that, -then try "make linux MYLIBS=-ltermcap". - -

Installing Lua

-

- Once you have built Lua, you may want to install it in an official - place in your system. In this case, do "make install". The official - place and the way to install files are defined in the Makefile. You'll - probably need the right permissions to install files. - -

- To build and install Lua in one step, do "make xxx install", - where xxx is your platform name. - -

- To install Lua locally, do "make local". - This will create a directory install with subdirectories - bin, include, lib, man, share, - and install Lua as listed below. - - To install Lua locally, but in some other directory, do - "make install INSTALL_TOP=xxx", where xxx is your chosen directory. - The installation starts in the src and doc directories, - so take care if INSTALL_TOP is not an absolute path. - -

-
- bin: -
- lua luac -
- include: -
- lua.h luaconf.h lualib.h lauxlib.h lua.hpp -
- lib: -
- liblua.a -
- man/man1: -
- lua.1 luac.1 -
- -

- These are the only directories you need for development. - If you only want to run Lua programs, - you only need the files in bin and man. - The files in include and lib are needed for - embedding Lua in C or C++ programs. - -

Customization

-

- Three kinds of things can be customized by editing a file: -

    -
  • Where and how to install Lua — edit Makefile. -
  • How to build Lua — edit src/Makefile. -
  • Lua features — edit src/luaconf.h. -
- -

- You don't actually need to edit the Makefiles because you may set the - relevant variables in the command line when invoking make. - Nevertheless, it's probably best to edit and save the Makefiles to - record the changes you've made. - -

- On the other hand, if you need to customize some Lua features, you'll need - to edit src/luaconf.h before building and installing Lua. - The edited file will be the one installed, and - it will be used by any Lua clients that you build, to ensure consistency. - Further customization is available to experts by editing the Lua sources. - -

Building Lua on other systems

-

- If you're not using the usual Unix tools, then the instructions for - building Lua depend on the compiler you use. You'll need to create - projects (or whatever your compiler uses) for building the library, - the interpreter, and the compiler, as follows: - -

-
-library: -
-lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c -lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c -ltm.c lundump.c lvm.c lzio.c -lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c -lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c -
-interpreter: -
- library, lua.c -
-compiler: -
- library, luac.c -
- -

- To use Lua as a library in your own programs you'll need to know how to - create and use libraries with your compiler. Moreover, to dynamically load - C libraries for Lua you'll need to know how to create dynamic libraries - and you'll need to make sure that the Lua API functions are accessible to - those dynamic libraries — but don't link the Lua library - into each dynamic library. For Unix, we recommend that the Lua library - be linked statically into the host program and its symbols exported for - dynamic linking; src/Makefile does this for the Lua interpreter. - For Windows, we recommend that the Lua library be a DLL. - In all cases, the compiler luac should be linked statically. - -

- As mentioned above, you may edit src/luaconf.h to customize - some features before building Lua. - -

Changes since Lua 5.2

-

-Here are the main changes introduced in Lua 5.3. -The -reference manual -lists the -incompatibilities that had to be introduced. - -

Main changes

-
    -
  • integers (64-bit by default) -
  • official support for 32-bit numbers -
  • bitwise operators -
  • basic utf-8 support -
  • functions for packing and unpacking values - -
- -Here are the other changes introduced in Lua 5.3: -

Language

-
    -
  • userdata can have any Lua value as uservalue -
  • floor division -
  • more flexible rules for some metamethods -
- -

Libraries

-
    -
  • ipairs and the table library respect metamethods -
  • strip option in string.dump -
  • table library respects metamethods -
  • new function table.move -
  • new function string.pack -
  • new function string.unpack -
  • new function string.packsize -
- -

C API

-
    -
  • simpler API for continuation functions in C -
  • lua_gettable and similar functions return type of resulted value -
  • strip option in lua_dump -
  • new function: lua_geti -
  • new function: lua_seti -
  • new function: lua_isyieldable -
  • new function: lua_numbertointeger -
  • new function: lua_rotate -
  • new function: lua_stringtonumber -
- -

Lua standalone interpreter

-
    -
  • can be used as calculator; no need to prefix with '=' -
  • arg table available to all code -
- -

License

-

- -[osi certified] - -Lua is free software distributed under the terms of the -MIT license -reproduced below; -it may be used for any purpose, including commercial purposes, -at absolutely no cost without having to ask us. - -The only requirement is that if you do use Lua, -then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. - -For details, see -this. - -

-Copyright © 1994–2017 Lua.org, PUC-Rio. - -

-Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -

-The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -

-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -

-

- -

- - - - diff --git a/deps/rcheevos/test/lua/src/Makefile b/deps/rcheevos/test/lua/src/Makefile deleted file mode 100644 index d71c75c873..0000000000 --- a/deps/rcheevos/test/lua/src/Makefile +++ /dev/null @@ -1,197 +0,0 @@ -# Makefile for building Lua -# See ../doc/readme.html for installation and customization instructions. - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -CC= gcc -std=gnu99 -CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) -LIBS= -lm $(SYSLIBS) $(MYLIBS) - -AR= ar rcu -RANLIB= ranlib -RM= rm -f - -SYSCFLAGS= -SYSLDFLAGS= -SYSLIBS= - -MYCFLAGS= -MYLDFLAGS= -MYLIBS= -MYOBJS= - -# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= - -PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - -LUA_A= liblua.a -CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ - lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ - ltm.o lundump.o lvm.o lzio.o -LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \ - lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o -BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) - -LUA_T= lua -LUA_O= lua.o - -LUAC_T= luac -LUAC_O= luac.o - -ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -ALL_A= $(LUA_A) - -# Targets start here. -default: $(PLAT) - -all: $(ALL_T) - -o: $(ALL_O) - -a: $(ALL_A) - -$(LUA_A): $(BASE_O) - $(AR) $@ $(BASE_O) - $(RANLIB) $@ - -$(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - -$(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - -clean: - $(RM) $(ALL_T) $(ALL_O) - -depend: - @$(CC) $(CFLAGS) -MM l*.c - -echo: - @echo "PLAT= $(PLAT)" - @echo "CC= $(CC)" - @echo "CFLAGS= $(CFLAGS)" - @echo "LDFLAGS= $(SYSLDFLAGS)" - @echo "LIBS= $(LIBS)" - @echo "AR= $(AR)" - @echo "RANLIB= $(RANLIB)" - @echo "RM= $(RM)" - -# Convenience targets for popular platforms -ALL= all - -none: - @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" - @echo " $(PLATS)" - -aix: - $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" - -bsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" - -c89: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" - @echo '' - @echo '*** C89 does not guarantee 64-bit integers for Lua.' - @echo '' - - -freebsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" - -generic: $(ALL) - -linux: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" - -macosx: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc - -mingw: - $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ - "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe - $(MAKE) "LUAC_T=luac.exe" luac.exe - -posix: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" - -solaris: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) default o a clean depend echo none - -# DO NOT DELETE - -lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \ - ltable.h lundump.h lvm.h -lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h -lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ - llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ - ldo.h lgc.h lstring.h ltable.h lvm.h -lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h -ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \ - ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h -ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \ - lparser.h lstring.h ltable.h lundump.h lvm.h -ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ - ltm.h lzio.h lmem.h lundump.h -lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \ - lgc.h lstate.h ltm.h lzio.h lmem.h -lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h -linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h -liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \ - lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \ - lstring.h ltable.h -lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h -loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \ - ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \ - lvm.h -lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h -loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ - llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ - ldo.h lfunc.h lstring.h lgc.h ltable.h -lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \ - lstring.h ltable.h -lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ - lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h -lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h -ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h ltable.h lvm.h -lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h lobject.h llimits.h \ - lstate.h ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h -lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ - lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ - lundump.h -lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ - ltable.h lvm.h -lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ - lobject.h ltm.h lzio.h - -# (end of Makefile) diff --git a/deps/rcheevos/test/lua/src/lapi.c b/deps/rcheevos/test/lua/src/lapi.c deleted file mode 100644 index 0097d070b2..0000000000 --- a/deps/rcheevos/test/lua/src/lapi.c +++ /dev/null @@ -1,1298 +0,0 @@ -/* -** $Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp $ -** Lua API -** See Copyright Notice in lua.h -*/ - -#define lapi_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" - - - -const char lua_ident[] = - "$LuaVersion: " LUA_COPYRIGHT " $" - "$LuaAuthors: " LUA_AUTHORS " $"; - - -/* value at a non-valid index */ -#define NONVALIDVALUE cast(TValue *, luaO_nilobject) - -/* corresponding test */ -#define isvalid(o) ((o) != luaO_nilobject) - -/* test for pseudo index */ -#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX) - -/* test for upvalue */ -#define isupvalue(i) ((i) < LUA_REGISTRYINDEX) - -/* test for valid but not pseudo index */ -#define isstackindex(i, o) (isvalid(o) && !ispseudo(i)) - -#define api_checkvalidindex(l,o) api_check(l, isvalid(o), "invalid index") - -#define api_checkstackindex(l, i, o) \ - api_check(l, isstackindex(i, o), "index not in the stack") - - -static TValue *index2addr (lua_State *L, int idx) { - CallInfo *ci = L->ci; - if (idx > 0) { - TValue *o = ci->func + idx; - api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index"); - if (o >= L->top) return NONVALIDVALUE; - else return o; - } - else if (!ispseudo(idx)) { /* negative index */ - api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); - return L->top + idx; - } - else if (idx == LUA_REGISTRYINDEX) - return &G(L)->l_registry; - else { /* upvalues */ - idx = LUA_REGISTRYINDEX - idx; - api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); - if (ttislcf(ci->func)) /* light C function? */ - return NONVALIDVALUE; /* it has no upvalues */ - else { - CClosure *func = clCvalue(ci->func); - return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE; - } - } -} - - -/* -** to be called by 'lua_checkstack' in protected mode, to grow stack -** capturing memory errors -*/ -static void growstack (lua_State *L, void *ud) { - int size = *(int *)ud; - luaD_growstack(L, size); -} - - -LUA_API int lua_checkstack (lua_State *L, int n) { - int res; - CallInfo *ci = L->ci; - lua_lock(L); - api_check(L, n >= 0, "negative 'n'"); - if (L->stack_last - L->top > n) /* stack large enough? */ - res = 1; /* yes; check is OK */ - else { /* no; need to grow stack */ - int inuse = cast_int(L->top - L->stack) + EXTRC_STACK; - if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */ - res = 0; /* no */ - else /* try to grow stack */ - res = (luaD_rawrunprotected(L, &growstack, &n) == LUA_OK); - } - if (res && ci->top < L->top + n) - ci->top = L->top + n; /* adjust frame top */ - lua_unlock(L); - return res; -} - - -LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { - int i; - if (from == to) return; - lua_lock(to); - api_checknelems(from, n); - api_check(from, G(from) == G(to), "moving among independent states"); - api_check(from, to->ci->top - to->top >= n, "stack overflow"); - from->top -= n; - for (i = 0; i < n; i++) { - setobj2s(to, to->top, from->top + i); - to->top++; /* stack already checked by previous 'api_check' */ - } - lua_unlock(to); -} - - -LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { - lua_CFunction old; - lua_lock(L); - old = G(L)->panic; - G(L)->panic = panicf; - lua_unlock(L); - return old; -} - - -LUA_API const lua_Number *lua_version (lua_State *L) { - static const lua_Number version = LUA_VERSION_NUM; - if (L == NULL) return &version; - else return G(L)->version; -} - - - -/* -** basic stack manipulation -*/ - - -/* -** convert an acceptable stack index into an absolute index -*/ -LUA_API int lua_absindex (lua_State *L, int idx) { - return (idx > 0 || ispseudo(idx)) - ? idx - : cast_int(L->top - L->ci->func) + idx; -} - - -LUA_API int lua_gettop (lua_State *L) { - return cast_int(L->top - (L->ci->func + 1)); -} - - -LUA_API void lua_settop (lua_State *L, int idx) { - StkId func = L->ci->func; - lua_lock(L); - if (idx >= 0) { - api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); - while (L->top < (func + 1) + idx) - setnilvalue(L->top++); - L->top = (func + 1) + idx; - } - else { - api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); - L->top += idx+1; /* 'subtract' index (index is negative) */ - } - lua_unlock(L); -} - - -/* -** Reverse the stack segment from 'from' to 'to' -** (auxiliary to 'lua_rotate') -*/ -static void reverse (lua_State *L, StkId from, StkId to) { - for (; from < to; from++, to--) { - TValue temp; - setobj(L, &temp, from); - setobjs2s(L, from, to); - setobj2s(L, to, &temp); - } -} - - -/* -** Let x = AB, where A is a prefix of length 'n'. Then, -** rotate x n == BA. But BA == (A^r . B^r)^r. -*/ -LUA_API void lua_rotate (lua_State *L, int idx, int n) { - StkId p, t, m; - lua_lock(L); - t = L->top - 1; /* end of stack segment being rotated */ - p = index2addr(L, idx); /* start of segment */ - api_checkstackindex(L, idx, p); - api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); - m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ - reverse(L, p, m); /* reverse the prefix with length 'n' */ - reverse(L, m + 1, t); /* reverse the suffix */ - reverse(L, p, t); /* reverse the entire segment */ - lua_unlock(L); -} - - -LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { - TValue *fr, *to; - lua_lock(L); - fr = index2addr(L, fromidx); - to = index2addr(L, toidx); - api_checkvalidindex(L, to); - setobj(L, to, fr); - if (isupvalue(toidx)) /* function upvalue? */ - luaC_barrier(L, clCvalue(L->ci->func), fr); - /* LUA_REGISTRYINDEX does not need gc barrier - (collector revisits it before finishing collection) */ - lua_unlock(L); -} - - -LUA_API void lua_pushvalue (lua_State *L, int idx) { - lua_lock(L); - setobj2s(L, L->top, index2addr(L, idx)); - api_incr_top(L); - lua_unlock(L); -} - - - -/* -** access functions (stack -> C) -*/ - - -LUA_API int lua_type (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (isvalid(o) ? ttnov(o) : LUA_TNONE); -} - - -LUA_API const char *lua_typename (lua_State *L, int t) { - UNUSED(L); - api_check(L, LUA_TNONE <= t && t < LUA_NUMTAGS, "invalid tag"); - return ttypename(t); -} - - -LUA_API int lua_iscfunction (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (ttislcf(o) || (ttisCclosure(o))); -} - - -LUA_API int lua_isinteger (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return ttisinteger(o); -} - - -LUA_API int lua_isnumber (lua_State *L, int idx) { - lua_Number n; - const TValue *o = index2addr(L, idx); - return tonumber(o, &n); -} - - -LUA_API int lua_isstring (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return (ttisstring(o) || cvt2str(o)); -} - - -LUA_API int lua_isuserdata (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return (ttisfulluserdata(o) || ttislightuserdata(o)); -} - - -LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { - StkId o1 = index2addr(L, index1); - StkId o2 = index2addr(L, index2); - return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0; -} - - -LUA_API void lua_arith (lua_State *L, int op) { - lua_lock(L); - if (op != LUA_OPUNM && op != LUA_OPBNOT) - api_checknelems(L, 2); /* all other operations expect two operands */ - else { /* for unary operations, add fake 2nd operand */ - api_checknelems(L, 1); - setobjs2s(L, L->top, L->top - 1); - api_incr_top(L); - } - /* first operand at top - 2, second at top - 1; result go to top - 2 */ - luaO_arith(L, op, L->top - 2, L->top - 1, L->top - 2); - L->top--; /* remove second operand */ - lua_unlock(L); -} - - -LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { - StkId o1, o2; - int i = 0; - lua_lock(L); /* may call tag method */ - o1 = index2addr(L, index1); - o2 = index2addr(L, index2); - if (isvalid(o1) && isvalid(o2)) { - switch (op) { - case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; - case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; - case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; - default: api_check(L, 0, "invalid option"); - } - } - lua_unlock(L); - return i; -} - - -LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { - size_t sz = luaO_str2num(s, L->top); - if (sz != 0) - api_incr_top(L); - return sz; -} - - -LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum) { - lua_Number n; - const TValue *o = index2addr(L, idx); - int isnum = tonumber(o, &n); - if (!isnum) - n = 0; /* call to 'tonumber' may change 'n' even if it fails */ - if (pisnum) *pisnum = isnum; - return n; -} - - -LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum) { - lua_Integer res; - const TValue *o = index2addr(L, idx); - int isnum = tointeger(o, &res); - if (!isnum) - res = 0; /* call to 'tointeger' may change 'n' even if it fails */ - if (pisnum) *pisnum = isnum; - return res; -} - - -LUA_API int lua_toboolean (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return !l_isfalse(o); -} - - -LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { - StkId o = index2addr(L, idx); - if (!ttisstring(o)) { - if (!cvt2str(o)) { /* not convertible? */ - if (len != NULL) *len = 0; - return NULL; - } - lua_lock(L); /* 'luaO_tostring' may create a new string */ - luaO_tostring(L, o); - luaC_checkGC(L); - o = index2addr(L, idx); /* previous call may reallocate the stack */ - lua_unlock(L); - } - if (len != NULL) - *len = vslen(o); - return svalue(o); -} - - -LUA_API size_t lua_rawlen (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttype(o)) { - case LUA_TSHRSTR: return tsvalue(o)->shrlen; - case LUA_TLNGSTR: return tsvalue(o)->u.lnglen; - case LUA_TUSERDATA: return uvalue(o)->len; - case LUA_TTABLE: return luaH_getn(hvalue(o)); - default: return 0; - } -} - - -LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - if (ttislcf(o)) return fvalue(o); - else if (ttisCclosure(o)) - return clCvalue(o)->f; - else return NULL; /* not a C function */ -} - - -LUA_API void *lua_touserdata (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttnov(o)) { - case LUA_TUSERDATA: return getudatamem(uvalue(o)); - case LUA_TLIGHTUSERDATA: return pvalue(o); - default: return NULL; - } -} - - -LUA_API lua_State *lua_tothread (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (!ttisthread(o)) ? NULL : thvalue(o); -} - - -LUA_API const void *lua_topointer (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttype(o)) { - case LUA_TTABLE: return hvalue(o); - case LUA_TLCL: return clLvalue(o); - case LUA_TCCL: return clCvalue(o); - case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); - case LUA_TTHREAD: return thvalue(o); - case LUA_TUSERDATA: return getudatamem(uvalue(o)); - case LUA_TLIGHTUSERDATA: return pvalue(o); - default: return NULL; - } -} - - - -/* -** push functions (C -> stack) -*/ - - -LUA_API void lua_pushnil (lua_State *L) { - lua_lock(L); - setnilvalue(L->top); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { - lua_lock(L); - setfltvalue(L->top, n); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { - lua_lock(L); - setivalue(L->top, n); - api_incr_top(L); - lua_unlock(L); -} - - -/* -** Pushes on the stack a string with given length. Avoid using 's' when -** 'len' == 0 (as 's' can be NULL in that case), due to later use of -** 'memcmp' and 'memcpy'. -*/ -LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { - TString *ts; - lua_lock(L); - ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); - setsvalue2s(L, L->top, ts); - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); - return getstr(ts); -} - - -LUA_API const char *lua_pushstring (lua_State *L, const char *s) { - lua_lock(L); - if (s == NULL) - setnilvalue(L->top); - else { - TString *ts; - ts = luaS_new(L, s); - setsvalue2s(L, L->top, ts); - s = getstr(ts); /* internal copy's address */ - } - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); - return s; -} - - -LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, - va_list argp) { - const char *ret; - lua_lock(L); - ret = luaO_pushvfstring(L, fmt, argp); - luaC_checkGC(L); - lua_unlock(L); - return ret; -} - - -LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { - const char *ret; - va_list argp; - lua_lock(L); - va_start(argp, fmt); - ret = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - luaC_checkGC(L); - lua_unlock(L); - return ret; -} - - -LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { - lua_lock(L); - if (n == 0) { - setfvalue(L->top, fn); - } - else { - CClosure *cl; - api_checknelems(L, n); - api_check(L, n <= MAXUPVAL, "upvalue index too large"); - cl = luaF_newCclosure(L, n); - cl->f = fn; - L->top -= n; - while (n--) { - setobj2n(L, &cl->upvalue[n], L->top + n); - /* does not need barrier because closure is white */ - } - setclCvalue(L, L->top, cl); - } - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); -} - - -LUA_API void lua_pushboolean (lua_State *L, int b) { - lua_lock(L); - setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { - lua_lock(L); - setpvalue(L->top, p); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API int lua_pushthread (lua_State *L) { - lua_lock(L); - setthvalue(L, L->top, L); - api_incr_top(L); - lua_unlock(L); - return (G(L)->mainthread == L); -} - - - -/* -** get functions (Lua -> stack) -*/ - - -static int auxgetstr (lua_State *L, const TValue *t, const char *k) { - const TValue *slot; - TString *str = luaS_new(L, k); - if (luaV_fastget(L, t, str, slot, luaH_getstr)) { - setobj2s(L, L->top, slot); - api_incr_top(L); - } - else { - setsvalue2s(L, L->top, str); - api_incr_top(L); - luaV_finishget(L, t, L->top - 1, L->top - 1, slot); - } - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_getglobal (lua_State *L, const char *name) { - Table *reg = hvalue(&G(L)->l_registry); - lua_lock(L); - return auxgetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); -} - - -LUA_API int lua_gettable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - luaV_gettable(L, t, L->top - 1, L->top - 1); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_getfield (lua_State *L, int idx, const char *k) { - lua_lock(L); - return auxgetstr(L, index2addr(L, idx), k); -} - - -LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { - StkId t; - const TValue *slot; - lua_lock(L); - t = index2addr(L, idx); - if (luaV_fastget(L, t, n, slot, luaH_getint)) { - setobj2s(L, L->top, slot); - api_incr_top(L); - } - else { - setivalue(L->top, n); - api_incr_top(L); - luaV_finishget(L, t, L->top - 1, L->top - 1, slot); - } - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawget (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setobj2s(L, L->top, luaH_getint(hvalue(t), n)); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { - StkId t; - TValue k; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setpvalue(&k, cast(void *, p)); - setobj2s(L, L->top, luaH_get(hvalue(t), &k)); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { - Table *t; - lua_lock(L); - t = luaH_new(L); - sethvalue(L, L->top, t); - api_incr_top(L); - if (narray > 0 || nrec > 0) - luaH_resize(L, t, narray, nrec); - luaC_checkGC(L); - lua_unlock(L); -} - - -LUA_API int lua_getmetatable (lua_State *L, int objindex) { - const TValue *obj; - Table *mt; - int res = 0; - lua_lock(L); - obj = index2addr(L, objindex); - switch (ttnov(obj)) { - case LUA_TTABLE: - mt = hvalue(obj)->metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(obj)->metatable; - break; - default: - mt = G(L)->mt[ttnov(obj)]; - break; - } - if (mt != NULL) { - sethvalue(L, L->top, mt); - api_incr_top(L); - res = 1; - } - lua_unlock(L); - return res; -} - - -LUA_API int lua_getuservalue (lua_State *L, int idx) { - StkId o; - lua_lock(L); - o = index2addr(L, idx); - api_check(L, ttisfulluserdata(o), "full userdata expected"); - getuservalue(L, uvalue(o), L->top); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -/* -** set functions (stack -> Lua) -*/ - -/* -** t[k] = value at the top of the stack (where 'k' is a string) -*/ -static void auxsetstr (lua_State *L, const TValue *t, const char *k) { - const TValue *slot; - TString *str = luaS_new(L, k); - api_checknelems(L, 1); - if (luaV_fastset(L, t, str, slot, luaH_getstr, L->top - 1)) - L->top--; /* pop value */ - else { - setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */ - api_incr_top(L); - luaV_finishset(L, t, L->top - 1, L->top - 2, slot); - L->top -= 2; /* pop value and key */ - } - lua_unlock(L); /* lock done by caller */ -} - - -LUA_API void lua_setglobal (lua_State *L, const char *name) { - Table *reg = hvalue(&G(L)->l_registry); - lua_lock(L); /* unlock done in 'auxsetstr' */ - auxsetstr(L, luaH_getint(reg, LUA_RIDX_GLOBALS), name); -} - - -LUA_API void lua_settable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - api_checknelems(L, 2); - t = index2addr(L, idx); - luaV_settable(L, t, L->top - 2, L->top - 1); - L->top -= 2; /* pop index and value */ - lua_unlock(L); -} - - -LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { - lua_lock(L); /* unlock done in 'auxsetstr' */ - auxsetstr(L, index2addr(L, idx), k); -} - - -LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { - StkId t; - const TValue *slot; - lua_lock(L); - api_checknelems(L, 1); - t = index2addr(L, idx); - if (luaV_fastset(L, t, n, slot, luaH_getint, L->top - 1)) - L->top--; /* pop value */ - else { - setivalue(L->top, n); - api_incr_top(L); - luaV_finishset(L, t, L->top - 1, L->top - 2, slot); - L->top -= 2; /* pop value and key */ - } - lua_unlock(L); -} - - -LUA_API void lua_rawset (lua_State *L, int idx) { - StkId o; - TValue *slot; - lua_lock(L); - api_checknelems(L, 2); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - slot = luaH_set(L, hvalue(o), L->top - 2); - setobj2t(L, slot, L->top - 1); - invalidateTMcache(hvalue(o)); - luaC_barrierback(L, hvalue(o), L->top-1); - L->top -= 2; - lua_unlock(L); -} - - -LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) { - StkId o; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - luaH_setint(L, hvalue(o), n, L->top - 1); - luaC_barrierback(L, hvalue(o), L->top-1); - L->top--; - lua_unlock(L); -} - - -LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { - StkId o; - TValue k, *slot; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - setpvalue(&k, cast(void *, p)); - slot = luaH_set(L, hvalue(o), &k); - setobj2t(L, slot, L->top - 1); - luaC_barrierback(L, hvalue(o), L->top - 1); - L->top--; - lua_unlock(L); -} - - -LUA_API int lua_setmetatable (lua_State *L, int objindex) { - TValue *obj; - Table *mt; - lua_lock(L); - api_checknelems(L, 1); - obj = index2addr(L, objindex); - if (ttisnil(L->top - 1)) - mt = NULL; - else { - api_check(L, ttistable(L->top - 1), "table expected"); - mt = hvalue(L->top - 1); - } - switch (ttnov(obj)) { - case LUA_TTABLE: { - hvalue(obj)->metatable = mt; - if (mt) { - luaC_objbarrier(L, gcvalue(obj), mt); - luaC_checkfinalizer(L, gcvalue(obj), mt); - } - break; - } - case LUA_TUSERDATA: { - uvalue(obj)->metatable = mt; - if (mt) { - luaC_objbarrier(L, uvalue(obj), mt); - luaC_checkfinalizer(L, gcvalue(obj), mt); - } - break; - } - default: { - G(L)->mt[ttnov(obj)] = mt; - break; - } - } - L->top--; - lua_unlock(L); - return 1; -} - - -LUA_API void lua_setuservalue (lua_State *L, int idx) { - StkId o; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttisfulluserdata(o), "full userdata expected"); - setuservalue(L, uvalue(o), L->top - 1); - luaC_barrier(L, gcvalue(o), L->top - 1); - L->top--; - lua_unlock(L); -} - - -/* -** 'load' and 'call' functions (run Lua code) -*/ - - -#define checkresults(L,na,nr) \ - api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ - "results from function overflow current stack size") - - -LUA_API void lua_callk (lua_State *L, int nargs, int nresults, - lua_KContext ctx, lua_KFunction k) { - StkId func; - lua_lock(L); - api_check(L, k == NULL || !isLua(L->ci), - "cannot use continuations inside hooks"); - api_checknelems(L, nargs+1); - api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); - checkresults(L, nargs, nresults); - func = L->top - (nargs+1); - if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ - L->ci->u.c.k = k; /* save continuation */ - L->ci->u.c.ctx = ctx; /* save context */ - luaD_call(L, func, nresults); /* do the call */ - } - else /* no continuation or no yieldable */ - luaD_callnoyield(L, func, nresults); /* just do the call */ - adjustresults(L, nresults); - lua_unlock(L); -} - - - -/* -** Execute a protected call. -*/ -struct CallS { /* data to 'f_call' */ - StkId func; - int nresults; -}; - - -static void f_call (lua_State *L, void *ud) { - struct CallS *c = cast(struct CallS *, ud); - luaD_callnoyield(L, c->func, c->nresults); -} - - - -LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, - lua_KContext ctx, lua_KFunction k) { - struct CallS c; - int status; - ptrdiff_t func; - lua_lock(L); - api_check(L, k == NULL || !isLua(L->ci), - "cannot use continuations inside hooks"); - api_checknelems(L, nargs+1); - api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); - checkresults(L, nargs, nresults); - if (errfunc == 0) - func = 0; - else { - StkId o = index2addr(L, errfunc); - api_checkstackindex(L, errfunc, o); - func = savestack(L, o); - } - c.func = L->top - (nargs+1); /* function to be called */ - if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */ - c.nresults = nresults; /* do a 'conventional' protected call */ - status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); - } - else { /* prepare continuation (call is already protected by 'resume') */ - CallInfo *ci = L->ci; - ci->u.c.k = k; /* save continuation */ - ci->u.c.ctx = ctx; /* save context */ - /* save information for error recovery */ - ci->extra = savestack(L, c.func); - ci->u.c.old_errfunc = L->errfunc; - L->errfunc = func; - setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */ - ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ - luaD_call(L, c.func, nresults); /* do the call */ - ci->callstatus &= ~CIST_YPCALL; - L->errfunc = ci->u.c.old_errfunc; - status = LUA_OK; /* if it is here, there were no errors */ - } - adjustresults(L, nresults); - lua_unlock(L); - return status; -} - - -LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, - const char *chunkname, const char *mode) { - ZIO z; - int status; - lua_lock(L); - if (!chunkname) chunkname = "?"; - luaZ_init(L, &z, reader, data); - status = luaD_protectedparser(L, &z, chunkname, mode); - if (status == LUA_OK) { /* no errors? */ - LClosure *f = clLvalue(L->top - 1); /* get newly created function */ - if (f->nupvalues >= 1) { /* does it have an upvalue? */ - /* get global table from registry */ - Table *reg = hvalue(&G(L)->l_registry); - const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS); - /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ - setobj(L, f->upvals[0]->v, gt); - luaC_upvalbarrier(L, f->upvals[0]); - } - } - lua_unlock(L); - return status; -} - - -LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { - int status; - TValue *o; - lua_lock(L); - api_checknelems(L, 1); - o = L->top - 1; - if (isLfunction(o)) - status = luaU_dump(L, getproto(o), writer, data, strip); - else - status = 1; - lua_unlock(L); - return status; -} - - -LUA_API int lua_status (lua_State *L) { - return L->status; -} - - -/* -** Garbage-collection function -*/ - -LUA_API int lua_gc (lua_State *L, int what, int data) { - int res = 0; - global_State *g; - lua_lock(L); - g = G(L); - switch (what) { - case LUA_GCSTOP: { - g->gcrunning = 0; - break; - } - case LUA_GCRESTART: { - luaE_setdebt(g, 0); - g->gcrunning = 1; - break; - } - case LUA_GCCOLLECT: { - luaC_fullgc(L, 0); - break; - } - case LUA_GCCOUNT: { - /* GC values are expressed in Kbytes: #bytes/2^10 */ - res = cast_int(gettotalbytes(g) >> 10); - break; - } - case LUA_GCCOUNTB: { - res = cast_int(gettotalbytes(g) & 0x3ff); - break; - } - case LUA_GCSTEP: { - l_mem debt = 1; /* =1 to signal that it did an actual step */ - lu_byte oldrunning = g->gcrunning; - g->gcrunning = 1; /* allow GC to run */ - if (data == 0) { - luaE_setdebt(g, -GCSTEPSIZE); /* to do a "small" step */ - luaC_step(L); - } - else { /* add 'data' to total debt */ - debt = cast(l_mem, data) * 1024 + g->GCdebt; - luaE_setdebt(g, debt); - luaC_checkGC(L); - } - g->gcrunning = oldrunning; /* restore previous state */ - if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ - res = 1; /* signal it */ - break; - } - case LUA_GCSETPAUSE: { - res = g->gcpause; - g->gcpause = data; - break; - } - case LUA_GCSETSTEPMUL: { - res = g->gcstepmul; - if (data < 40) data = 40; /* avoid ridiculous low values (and 0) */ - g->gcstepmul = data; - break; - } - case LUA_GCISRUNNING: { - res = g->gcrunning; - break; - } - default: res = -1; /* invalid option */ - } - lua_unlock(L); - return res; -} - - - -/* -** miscellaneous functions -*/ - - -LUA_API int lua_error (lua_State *L) { - lua_lock(L); - api_checknelems(L, 1); - luaG_errormsg(L); - /* code unreachable; will unlock when control actually leaves the kernel */ - return 0; /* to avoid warnings */ -} - - -LUA_API int lua_next (lua_State *L, int idx) { - StkId t; - int more; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - more = luaH_next(L, hvalue(t), L->top - 1); - if (more) { - api_incr_top(L); - } - else /* no more elements */ - L->top -= 1; /* remove key */ - lua_unlock(L); - return more; -} - - -LUA_API void lua_concat (lua_State *L, int n) { - lua_lock(L); - api_checknelems(L, n); - if (n >= 2) { - luaV_concat(L, n); - } - else if (n == 0) { /* push empty string */ - setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); - api_incr_top(L); - } - /* else n == 1; nothing to do */ - luaC_checkGC(L); - lua_unlock(L); -} - - -LUA_API void lua_len (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - luaV_objlen(L, L->top, t); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { - lua_Alloc f; - lua_lock(L); - if (ud) *ud = G(L)->ud; - f = G(L)->frealloc; - lua_unlock(L); - return f; -} - - -LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { - lua_lock(L); - G(L)->ud = ud; - G(L)->frealloc = f; - lua_unlock(L); -} - - -LUA_API void *lua_newuserdata (lua_State *L, size_t size) { - Udata *u; - lua_lock(L); - u = luaS_newudata(L, size); - setuvalue(L, L->top, u); - api_incr_top(L); - luaC_checkGC(L); - lua_unlock(L); - return getudatamem(u); -} - - - -static const char *aux_upvalue (StkId fi, int n, TValue **val, - CClosure **owner, UpVal **uv) { - switch (ttype(fi)) { - case LUA_TCCL: { /* C closure */ - CClosure *f = clCvalue(fi); - if (!(1 <= n && n <= f->nupvalues)) return NULL; - *val = &f->upvalue[n-1]; - if (owner) *owner = f; - return ""; - } - case LUA_TLCL: { /* Lua closure */ - LClosure *f = clLvalue(fi); - TString *name; - Proto *p = f->p; - if (!(1 <= n && n <= p->sizeupvalues)) return NULL; - *val = f->upvals[n-1]->v; - if (uv) *uv = f->upvals[n - 1]; - name = p->upvalues[n-1].name; - return (name == NULL) ? "(*no name)" : getstr(name); - } - default: return NULL; /* not a closure */ - } -} - - -LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val = NULL; /* to avoid warnings */ - lua_lock(L); - name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL, NULL); - if (name) { - setobj2s(L, L->top, val); - api_incr_top(L); - } - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val = NULL; /* to avoid warnings */ - CClosure *owner = NULL; - UpVal *uv = NULL; - StkId fi; - lua_lock(L); - fi = index2addr(L, funcindex); - api_checknelems(L, 1); - name = aux_upvalue(fi, n, &val, &owner, &uv); - if (name) { - L->top--; - setobj(L, val, L->top); - if (owner) { luaC_barrier(L, owner, L->top); } - else if (uv) { luaC_upvalbarrier(L, uv); } - } - lua_unlock(L); - return name; -} - - -static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { - LClosure *f; - StkId fi = index2addr(L, fidx); - api_check(L, ttisLclosure(fi), "Lua function expected"); - f = clLvalue(fi); - api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); - if (pf) *pf = f; - return &f->upvals[n - 1]; /* get its upvalue pointer */ -} - - -LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { - StkId fi = index2addr(L, fidx); - switch (ttype(fi)) { - case LUA_TLCL: { /* lua closure */ - return *getupvalref(L, fidx, n, NULL); - } - case LUA_TCCL: { /* C closure */ - CClosure *f = clCvalue(fi); - api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); - return &f->upvalue[n - 1]; - } - default: { - api_check(L, 0, "closure expected"); - return NULL; - } - } -} - - -LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, - int fidx2, int n2) { - LClosure *f1; - UpVal **up1 = getupvalref(L, fidx1, n1, &f1); - UpVal **up2 = getupvalref(L, fidx2, n2, NULL); - luaC_upvdeccount(L, *up1); - *up1 = *up2; - (*up1)->refcount++; - if (upisopen(*up1)) (*up1)->u.open.touched = 1; - luaC_upvalbarrier(L, *up1); -} - - diff --git a/deps/rcheevos/test/lua/src/lapi.h b/deps/rcheevos/test/lua/src/lapi.h deleted file mode 100644 index 6d36dee3fb..0000000000 --- a/deps/rcheevos/test/lua/src/lapi.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $ -** Auxiliary functions from Lua API -** See Copyright Notice in lua.h -*/ - -#ifndef lapi_h -#define lapi_h - - -#include "llimits.h" -#include "lstate.h" - -#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ - "stack overflow");} - -#define adjustresults(L,nres) \ - { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } - -#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ - "not enough elements in the stack") - - -#endif diff --git a/deps/rcheevos/test/lua/src/lauxlib.c b/deps/rcheevos/test/lua/src/lauxlib.c deleted file mode 100644 index f7a383663e..0000000000 --- a/deps/rcheevos/test/lua/src/lauxlib.c +++ /dev/null @@ -1,1043 +0,0 @@ -/* -** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp $ -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - -#define lauxlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include - - -/* -** This file uses only the official API of Lua. -** Any function declared here could be written as an application function. -*/ - -#include "lua.h" - -#include "lauxlib.h" - - -/* -** {====================================================== -** Traceback -** ======================================================= -*/ - - -#define LEVELS1 10 /* size of the first part of the stack */ -#define LEVELS2 11 /* size of the second part of the stack */ - - - -/* -** search for 'objidx' in table at index -1. -** return 1 + string at top if find a good name. -*/ -static int findfield (lua_State *L, int objidx, int level) { - if (level == 0 || !lua_istable(L, -1)) - return 0; /* not found */ - lua_pushnil(L); /* start 'next' loop */ - while (lua_next(L, -2)) { /* for each pair in table */ - if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ - if (lua_rawequal(L, objidx, -1)) { /* found object? */ - lua_pop(L, 1); /* remove value (but keep name) */ - return 1; - } - else if (findfield(L, objidx, level - 1)) { /* try recursively */ - lua_remove(L, -2); /* remove table (but keep name) */ - lua_pushliteral(L, "."); - lua_insert(L, -2); /* place '.' between the two names */ - lua_concat(L, 3); - return 1; - } - } - lua_pop(L, 1); /* remove value */ - } - return 0; /* not found */ -} - - -/* -** Search for a name for a function in all loaded modules -*/ -static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { - int top = lua_gettop(L); - lua_getinfo(L, "f", ar); /* push function */ - lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); - if (findfield(L, top + 1, 2)) { - const char *name = lua_tostring(L, -1); - if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ - lua_pushstring(L, name + 3); /* push name without prefix */ - lua_remove(L, -2); /* remove original name */ - } - lua_copy(L, -1, top + 1); /* move name to proper place */ - lua_pop(L, 2); /* remove pushed values */ - return 1; - } - else { - lua_settop(L, top); /* remove function and global table */ - return 0; - } -} - - -static void pushfuncname (lua_State *L, lua_Debug *ar) { - if (pushglobalfuncname(L, ar)) { /* try first a global name */ - lua_pushfstring(L, "function '%s'", lua_tostring(L, -1)); - lua_remove(L, -2); /* remove name */ - } - else if (*ar->namewhat != '\0') /* is there a name from code? */ - lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */ - else if (*ar->what == 'm') /* main? */ - lua_pushliteral(L, "main chunk"); - else if (*ar->what != 'C') /* for Lua functions, use */ - lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); - else /* nothing left... */ - lua_pushliteral(L, "?"); -} - - -static int lastlevel (lua_State *L) { - lua_Debug ar; - int li = 1, le = 1; - /* find an upper bound */ - while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } - /* do a binary search */ - while (li < le) { - int m = (li + le)/2; - if (lua_getstack(L, m, &ar)) li = m + 1; - else le = m; - } - return le - 1; -} - - -LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, - const char *msg, int level) { - lua_Debug ar; - int top = lua_gettop(L); - int last = lastlevel(L1); - int n1 = (last - level > LEVELS1 + LEVELS2) ? LEVELS1 : -1; - if (msg) - lua_pushfstring(L, "%s\n", msg); - luaL_checkstack(L, 10, NULL); - lua_pushliteral(L, "stack traceback:"); - while (lua_getstack(L1, level++, &ar)) { - if (n1-- == 0) { /* too many levels? */ - lua_pushliteral(L, "\n\t..."); /* add a '...' */ - level = last - LEVELS2 + 1; /* and skip to last ones */ - } - else { - lua_getinfo(L1, "Slnt", &ar); - lua_pushfstring(L, "\n\t%s:", ar.short_src); - if (ar.currentline > 0) - lua_pushfstring(L, "%d:", ar.currentline); - lua_pushliteral(L, " in "); - pushfuncname(L, &ar); - if (ar.istailcall) - lua_pushliteral(L, "\n\t(...tail calls...)"); - lua_concat(L, lua_gettop(L) - top); - } - } - lua_concat(L, lua_gettop(L) - top); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Error-report functions -** ======================================================= -*/ - -LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { - lua_Debug ar; - if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ - return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); - lua_getinfo(L, "n", &ar); - if (strcmp(ar.namewhat, "method") == 0) { - arg--; /* do not count 'self' */ - if (arg == 0) /* error is in the self argument itself? */ - return luaL_error(L, "calling '%s' on bad self (%s)", - ar.name, extramsg); - } - if (ar.name == NULL) - ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; - return luaL_error(L, "bad argument #%d to '%s' (%s)", - arg, ar.name, extramsg); -} - - -static int typeerror (lua_State *L, int arg, const char *tname) { - const char *msg; - const char *typearg; /* name for the type of the actual argument */ - if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING) - typearg = lua_tostring(L, -1); /* use the given type name */ - else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) - typearg = "light userdata"; /* special name for messages */ - else - typearg = luaL_typename(L, arg); /* standard name */ - msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); - return luaL_argerror(L, arg, msg); -} - - -static void tag_error (lua_State *L, int arg, int tag) { - typeerror(L, arg, lua_typename(L, tag)); -} - - -/* -** The use of 'lua_pushfstring' ensures this function does not -** need reserved stack space when called. -*/ -LUALIB_API void luaL_where (lua_State *L, int level) { - lua_Debug ar; - if (lua_getstack(L, level, &ar)) { /* check function at level */ - lua_getinfo(L, "Sl", &ar); /* get info about it */ - if (ar.currentline > 0) { /* is there info? */ - lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); - return; - } - } - lua_pushfstring(L, ""); /* else, no information available... */ -} - - -/* -** Again, the use of 'lua_pushvfstring' ensures this function does -** not need reserved stack space when called. (At worst, it generates -** an error with "stack overflow" instead of the given message.) -*/ -LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { - va_list argp; - va_start(argp, fmt); - luaL_where(L, 1); - lua_pushvfstring(L, fmt, argp); - va_end(argp); - lua_concat(L, 2); - return lua_error(L); -} - - -LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { - int en = errno; /* calls to Lua API may change this value */ - if (stat) { - lua_pushboolean(L, 1); - return 1; - } - else { - lua_pushnil(L); - if (fname) - lua_pushfstring(L, "%s: %s", fname, strerror(en)); - else - lua_pushstring(L, strerror(en)); - lua_pushinteger(L, en); - return 3; - } -} - - -#if !defined(l_inspectstat) /* { */ - -#if defined(LUA_USE_POSIX) - -#include - -/* -** use appropriate macros to interpret 'pclose' return status -*/ -#define l_inspectstat(stat,what) \ - if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \ - else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; } - -#else - -#define l_inspectstat(stat,what) /* no op */ - -#endif - -#endif /* } */ - - -LUALIB_API int luaL_execresult (lua_State *L, int stat) { - const char *what = "exit"; /* type of termination */ - if (stat == -1) /* error? */ - return luaL_fileresult(L, 0, NULL); - else { - l_inspectstat(stat, what); /* interpret result */ - if (*what == 'e' && stat == 0) /* successful termination? */ - lua_pushboolean(L, 1); - else - lua_pushnil(L); - lua_pushstring(L, what); - lua_pushinteger(L, stat); - return 3; /* return true/nil,what,code */ - } -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Userdata's metatable manipulation -** ======================================================= -*/ - -LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { - if (luaL_getmetatable(L, tname) != LUA_TNIL) /* name already in use? */ - return 0; /* leave previous value on top, but return 0 */ - lua_pop(L, 1); - lua_createtable(L, 0, 2); /* create metatable */ - lua_pushstring(L, tname); - lua_setfield(L, -2, "__name"); /* metatable.__name = tname */ - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ - return 1; -} - - -LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { - luaL_getmetatable(L, tname); - lua_setmetatable(L, -2); -} - - -LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { - void *p = lua_touserdata(L, ud); - if (p != NULL) { /* value is a userdata? */ - if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ - luaL_getmetatable(L, tname); /* get correct metatable */ - if (!lua_rawequal(L, -1, -2)) /* not the same? */ - p = NULL; /* value is a userdata with wrong metatable */ - lua_pop(L, 2); /* remove both metatables */ - return p; - } - } - return NULL; /* value is not a userdata with a metatable */ -} - - -LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { - void *p = luaL_testudata(L, ud, tname); - if (p == NULL) typeerror(L, ud, tname); - return p; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Argument check functions -** ======================================================= -*/ - -LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, - const char *const lst[]) { - const char *name = (def) ? luaL_optstring(L, arg, def) : - luaL_checkstring(L, arg); - int i; - for (i=0; lst[i]; i++) - if (strcmp(lst[i], name) == 0) - return i; - return luaL_argerror(L, arg, - lua_pushfstring(L, "invalid option '%s'", name)); -} - - -/* -** Ensures the stack has at least 'space' extra slots, raising an error -** if it cannot fulfill the request. (The error handling needs a few -** extra slots to format the error message. In case of an error without -** this extra space, Lua will generate the same 'stack overflow' error, -** but without 'msg'.) -*/ -LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { - if (!lua_checkstack(L, space)) { - if (msg) - luaL_error(L, "stack overflow (%s)", msg); - else - luaL_error(L, "stack overflow"); - } -} - - -LUALIB_API void luaL_checktype (lua_State *L, int arg, int t) { - if (lua_type(L, arg) != t) - tag_error(L, arg, t); -} - - -LUALIB_API void luaL_checkany (lua_State *L, int arg) { - if (lua_type(L, arg) == LUA_TNONE) - luaL_argerror(L, arg, "value expected"); -} - - -LUALIB_API const char *luaL_checklstring (lua_State *L, int arg, size_t *len) { - const char *s = lua_tolstring(L, arg, len); - if (!s) tag_error(L, arg, LUA_TSTRING); - return s; -} - - -LUALIB_API const char *luaL_optlstring (lua_State *L, int arg, - const char *def, size_t *len) { - if (lua_isnoneornil(L, arg)) { - if (len) - *len = (def ? strlen(def) : 0); - return def; - } - else return luaL_checklstring(L, arg, len); -} - - -LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg) { - int isnum; - lua_Number d = lua_tonumberx(L, arg, &isnum); - if (!isnum) - tag_error(L, arg, LUA_TNUMBER); - return d; -} - - -LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def) { - return luaL_opt(L, luaL_checknumber, arg, def); -} - - -static void interror (lua_State *L, int arg) { - if (lua_isnumber(L, arg)) - luaL_argerror(L, arg, "number has no integer representation"); - else - tag_error(L, arg, LUA_TNUMBER); -} - - -LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg) { - int isnum; - lua_Integer d = lua_tointegerx(L, arg, &isnum); - if (!isnum) { - interror(L, arg); - } - return d; -} - - -LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg, - lua_Integer def) { - return luaL_opt(L, luaL_checkinteger, arg, def); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - -/* userdata to box arbitrary data */ -typedef struct UBox { - void *box; - size_t bsize; -} UBox; - - -static void *resizebox (lua_State *L, int idx, size_t newsize) { - void *ud; - lua_Alloc allocf = lua_getallocf(L, &ud); - UBox *box = (UBox *)lua_touserdata(L, idx); - void *temp = allocf(ud, box->box, box->bsize, newsize); - if (temp == NULL && newsize > 0) { /* allocation error? */ - resizebox(L, idx, 0); /* free buffer */ - luaL_error(L, "not enough memory for buffer allocation"); - } - box->box = temp; - box->bsize = newsize; - return temp; -} - - -static int boxgc (lua_State *L) { - resizebox(L, 1, 0); - return 0; -} - - -static void *newbox (lua_State *L, size_t newsize) { - UBox *box = (UBox *)lua_newuserdata(L, sizeof(UBox)); - box->box = NULL; - box->bsize = 0; - if (luaL_newmetatable(L, "LUABOX")) { /* creating metatable? */ - lua_pushcfunction(L, boxgc); - lua_setfield(L, -2, "__gc"); /* metatable.__gc = boxgc */ - } - lua_setmetatable(L, -2); - return resizebox(L, -1, newsize); -} - - -/* -** check whether buffer is using a userdata on the stack as a temporary -** buffer -*/ -#define buffonstack(B) ((B)->b != (B)->initb) - - -/* -** returns a pointer to a free area with at least 'sz' bytes -*/ -LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) { - lua_State *L = B->L; - if (B->size - B->n < sz) { /* not enough space? */ - char *newbuff; - size_t newsize = B->size * 2; /* double buffer size */ - if (newsize - B->n < sz) /* not big enough? */ - newsize = B->n + sz; - if (newsize < B->n || newsize - B->n < sz) - luaL_error(L, "buffer too large"); - /* create larger buffer */ - if (buffonstack(B)) - newbuff = (char *)resizebox(L, -1, newsize); - else { /* no buffer yet */ - newbuff = (char *)newbox(L, newsize); - memcpy(newbuff, B->b, B->n * sizeof(char)); /* copy original content */ - } - B->b = newbuff; - B->size = newsize; - } - return &B->b[B->n]; -} - - -LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { - if (l > 0) { /* avoid 'memcpy' when 's' can be NULL */ - char *b = luaL_prepbuffsize(B, l); - memcpy(b, s, l * sizeof(char)); - luaL_addsize(B, l); - } -} - - -LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { - luaL_addlstring(B, s, strlen(s)); -} - - -LUALIB_API void luaL_pushresult (luaL_Buffer *B) { - lua_State *L = B->L; - lua_pushlstring(L, B->b, B->n); - if (buffonstack(B)) { - resizebox(L, -2, 0); /* delete old buffer */ - lua_remove(L, -2); /* remove its header from the stack */ - } -} - - -LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) { - luaL_addsize(B, sz); - luaL_pushresult(B); -} - - -LUALIB_API void luaL_addvalue (luaL_Buffer *B) { - lua_State *L = B->L; - size_t l; - const char *s = lua_tolstring(L, -1, &l); - if (buffonstack(B)) - lua_insert(L, -2); /* put value below buffer */ - luaL_addlstring(B, s, l); - lua_remove(L, (buffonstack(B)) ? -2 : -1); /* remove value */ -} - - -LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { - B->L = L; - B->b = B->initb; - B->n = 0; - B->size = LUAL_BUFFERSIZE; -} - - -LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) { - luaL_buffinit(L, B); - return luaL_prepbuffsize(B, sz); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Reference system -** ======================================================= -*/ - -/* index of free-list header */ -#define freelist 0 - - -LUALIB_API int luaL_ref (lua_State *L, int t) { - int ref; - if (lua_isnil(L, -1)) { - lua_pop(L, 1); /* remove from stack */ - return LUA_REFNIL; /* 'nil' has a unique fixed reference */ - } - t = lua_absindex(L, t); - lua_rawgeti(L, t, freelist); /* get first free element */ - ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */ - lua_pop(L, 1); /* remove it from stack */ - if (ref != 0) { /* any free element? */ - lua_rawgeti(L, t, ref); /* remove it from list */ - lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */ - } - else /* no free elements */ - ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ - lua_rawseti(L, t, ref); - return ref; -} - - -LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { - if (ref >= 0) { - t = lua_absindex(L, t); - lua_rawgeti(L, t, freelist); - lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */ - lua_pushinteger(L, ref); - lua_rawseti(L, t, freelist); /* t[freelist] = ref */ - } -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Load functions -** ======================================================= -*/ - -typedef struct LoadF { - int n; /* number of pre-read characters */ - FILE *f; /* file being read */ - char buff[BUFSIZ]; /* area for reading file */ -} LoadF; - - -static const char *getF (lua_State *L, void *ud, size_t *size) { - LoadF *lf = (LoadF *)ud; - (void)L; /* not used */ - if (lf->n > 0) { /* are there pre-read characters to be read? */ - *size = lf->n; /* return them (chars already in buffer) */ - lf->n = 0; /* no more pre-read characters */ - } - else { /* read a block from file */ - /* 'fread' can return > 0 *and* set the EOF flag. If next call to - 'getF' called 'fread', it might still wait for user input. - The next check avoids this problem. */ - if (feof(lf->f)) return NULL; - *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ - } - return lf->buff; -} - - -static int errfile (lua_State *L, const char *what, int fnameindex) { - const char *serr = strerror(errno); - const char *filename = lua_tostring(L, fnameindex) + 1; - lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); - lua_remove(L, fnameindex); - return LUA_ERRFILE; -} - - -static int skipBOM (LoadF *lf) { - const char *p = "\xEF\xBB\xBF"; /* UTF-8 BOM mark */ - int c; - lf->n = 0; - do { - c = getc(lf->f); - if (c == EOF || c != *(const unsigned char *)p++) return c; - lf->buff[lf->n++] = c; /* to be read by the parser */ - } while (*p != '\0'); - lf->n = 0; /* prefix matched; discard it */ - return getc(lf->f); /* return next character */ -} - - -/* -** reads the first character of file 'f' and skips an optional BOM mark -** in its beginning plus its first line if it starts with '#'. Returns -** true if it skipped the first line. In any case, '*cp' has the -** first "valid" character of the file (after the optional BOM and -** a first-line comment). -*/ -static int skipcomment (LoadF *lf, int *cp) { - int c = *cp = skipBOM(lf); - if (c == '#') { /* first line is a comment (Unix exec. file)? */ - do { /* skip first line */ - c = getc(lf->f); - } while (c != EOF && c != '\n'); - *cp = getc(lf->f); /* skip end-of-line, if present */ - return 1; /* there was a comment */ - } - else return 0; /* no comment */ -} - - -LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, - const char *mode) { - LoadF lf; - int status, readstatus; - int c; - int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ - if (filename == NULL) { - lua_pushliteral(L, "=stdin"); - lf.f = stdin; - } - else { - lua_pushfstring(L, "@%s", filename); - lf.f = fopen(filename, "r"); - if (lf.f == NULL) return errfile(L, "open", fnameindex); - } - if (skipcomment(&lf, &c)) /* read initial portion */ - lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */ - if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ - lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ - if (lf.f == NULL) return errfile(L, "reopen", fnameindex); - skipcomment(&lf, &c); /* re-read initial portion */ - } - if (c != EOF) - lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ - status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); - readstatus = ferror(lf.f); - if (filename) fclose(lf.f); /* close file (even in case of errors) */ - if (readstatus) { - lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ - return errfile(L, "read", fnameindex); - } - lua_remove(L, fnameindex); - return status; -} - - -typedef struct LoadS { - const char *s; - size_t size; -} LoadS; - - -static const char *getS (lua_State *L, void *ud, size_t *size) { - LoadS *ls = (LoadS *)ud; - (void)L; /* not used */ - if (ls->size == 0) return NULL; - *size = ls->size; - ls->size = 0; - return ls->s; -} - - -LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, - const char *name, const char *mode) { - LoadS ls; - ls.s = buff; - ls.size = size; - return lua_load(L, getS, &ls, name, mode); -} - - -LUALIB_API int luaL_loadstring (lua_State *L, const char *s) { - return luaL_loadbuffer(L, s, strlen(s), s); -} - -/* }====================================================== */ - - - -LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { - if (!lua_getmetatable(L, obj)) /* no metatable? */ - return LUA_TNIL; - else { - int tt; - lua_pushstring(L, event); - tt = lua_rawget(L, -2); - if (tt == LUA_TNIL) /* is metafield nil? */ - lua_pop(L, 2); /* remove metatable and metafield */ - else - lua_remove(L, -2); /* remove only metatable */ - return tt; /* return metafield type */ - } -} - - -LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { - obj = lua_absindex(L, obj); - if (luaL_getmetafield(L, obj, event) == LUA_TNIL) /* no metafield? */ - return 0; - lua_pushvalue(L, obj); - lua_call(L, 1, 1); - return 1; -} - - -LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { - lua_Integer l; - int isnum; - lua_len(L, idx); - l = lua_tointegerx(L, -1, &isnum); - if (!isnum) - luaL_error(L, "object length is not an integer"); - lua_pop(L, 1); /* remove object */ - return l; -} - - -LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { - if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */ - if (!lua_isstring(L, -1)) - luaL_error(L, "'__tostring' must return a string"); - } - else { - switch (lua_type(L, idx)) { - case LUA_TNUMBER: { - if (lua_isinteger(L, idx)) - lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx)); - else - lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx)); - break; - } - case LUA_TSTRING: - lua_pushvalue(L, idx); - break; - case LUA_TBOOLEAN: - lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); - break; - case LUA_TNIL: - lua_pushliteral(L, "nil"); - break; - default: { - int tt = luaL_getmetafield(L, idx, "__name"); /* try name */ - const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) : - luaL_typename(L, idx); - lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx)); - if (tt != LUA_TNIL) - lua_remove(L, -2); /* remove '__name' */ - break; - } - } - } - return lua_tolstring(L, -1, len); -} - - -/* -** {====================================================== -** Compatibility with 5.1 module functions -** ======================================================= -*/ -#if defined(LUA_COMPAT_MODULE) - -static const char *luaL_findtable (lua_State *L, int idx, - const char *fname, int szhint) { - const char *e; - if (idx) lua_pushvalue(L, idx); - do { - e = strchr(fname, '.'); - if (e == NULL) e = fname + strlen(fname); - lua_pushlstring(L, fname, e - fname); - if (lua_rawget(L, -2) == LUA_TNIL) { /* no such field? */ - lua_pop(L, 1); /* remove this nil */ - lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ - lua_pushlstring(L, fname, e - fname); - lua_pushvalue(L, -2); - lua_settable(L, -4); /* set new table into field */ - } - else if (!lua_istable(L, -1)) { /* field has a non-table value? */ - lua_pop(L, 2); /* remove table and value */ - return fname; /* return problematic part of the name */ - } - lua_remove(L, -2); /* remove previous table */ - fname = e + 1; - } while (*e == '.'); - return NULL; -} - - -/* -** Count number of elements in a luaL_Reg list. -*/ -static int libsize (const luaL_Reg *l) { - int size = 0; - for (; l && l->name; l++) size++; - return size; -} - - -/* -** Find or create a module table with a given name. The function -** first looks at the LOADED table and, if that fails, try a -** global variable with that name. In any case, leaves on the stack -** the module table. -*/ -LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, - int sizehint) { - luaL_findtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE, 1); - if (lua_getfield(L, -1, modname) != LUA_TTABLE) { /* no LOADED[modname]? */ - lua_pop(L, 1); /* remove previous result */ - /* try global variable (and create one if it does not exist) */ - lua_pushglobaltable(L); - if (luaL_findtable(L, 0, modname, sizehint) != NULL) - luaL_error(L, "name conflict for module '%s'", modname); - lua_pushvalue(L, -1); - lua_setfield(L, -3, modname); /* LOADED[modname] = new table */ - } - lua_remove(L, -2); /* remove LOADED table */ -} - - -LUALIB_API void luaL_openlib (lua_State *L, const char *libname, - const luaL_Reg *l, int nup) { - luaL_checkversion(L); - if (libname) { - luaL_pushmodule(L, libname, libsize(l)); /* get/create library table */ - lua_insert(L, -(nup + 1)); /* move library table to below upvalues */ - } - if (l) - luaL_setfuncs(L, l, nup); - else - lua_pop(L, nup); /* remove upvalues */ -} - -#endif -/* }====================================================== */ - -/* -** set functions from list 'l' into table at top - 'nup'; each -** function gets the 'nup' elements at the top as upvalues. -** Returns with only the table at the stack. -*/ -LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { - luaL_checkstack(L, nup, "too many upvalues"); - for (; l->name != NULL; l++) { /* fill the table with given functions */ - int i; - for (i = 0; i < nup; i++) /* copy upvalues to the top */ - lua_pushvalue(L, -nup); - lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ - lua_setfield(L, -(nup + 2), l->name); - } - lua_pop(L, nup); /* remove upvalues */ -} - - -/* -** ensure that stack[idx][fname] has a table and push that table -** into the stack -*/ -LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { - if (lua_getfield(L, idx, fname) == LUA_TTABLE) - return 1; /* table already there */ - else { - lua_pop(L, 1); /* remove previous result */ - idx = lua_absindex(L, idx); - lua_newtable(L); - lua_pushvalue(L, -1); /* copy to be left at top */ - lua_setfield(L, idx, fname); /* assign new table to field */ - return 0; /* false, because did not find table there */ - } -} - - -/* -** Stripped-down 'require': After checking "loaded" table, calls 'openf' -** to open a module, registers the result in 'package.loaded' table and, -** if 'glb' is true, also registers the result in the global table. -** Leaves resulting module on the top. -*/ -LUALIB_API void luaL_requiref (lua_State *L, const char *modname, - lua_CFunction openf, int glb) { - luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); - lua_getfield(L, -1, modname); /* LOADED[modname] */ - if (!lua_toboolean(L, -1)) { /* package not already loaded? */ - lua_pop(L, 1); /* remove field */ - lua_pushcfunction(L, openf); - lua_pushstring(L, modname); /* argument to open function */ - lua_call(L, 1, 1); /* call 'openf' to open module */ - lua_pushvalue(L, -1); /* make copy of module (call result) */ - lua_setfield(L, -3, modname); /* LOADED[modname] = module */ - } - lua_remove(L, -2); /* remove LOADED table */ - if (glb) { - lua_pushvalue(L, -1); /* copy of module */ - lua_setglobal(L, modname); /* _G[modname] = module */ - } -} - - -LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, - const char *r) { - const char *wild; - size_t l = strlen(p); - luaL_Buffer b; - luaL_buffinit(L, &b); - while ((wild = strstr(s, p)) != NULL) { - luaL_addlstring(&b, s, wild - s); /* push prefix */ - luaL_addstring(&b, r); /* push replacement in place of pattern */ - s = wild + l; /* continue after 'p' */ - } - luaL_addstring(&b, s); /* push last suffix */ - luaL_pushresult(&b); - return lua_tostring(L, -1); -} - - -static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { - (void)ud; (void)osize; /* not used */ - if (nsize == 0) { - free(ptr); - return NULL; - } - else - return realloc(ptr, nsize); -} - - -static int panic (lua_State *L) { - lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", - lua_tostring(L, -1)); - return 0; /* return to Lua to abort */ -} - - -LUALIB_API lua_State *luaL_newstate (void) { - lua_State *L = lua_newstate(l_alloc, NULL); - if (L) lua_atpanic(L, &panic); - return L; -} - - -LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { - const lua_Number *v = lua_version(L); - if (sz != LUAL_NUMSIZES) /* check numeric types */ - luaL_error(L, "core and library have incompatible numeric types"); - if (v != lua_version(NULL)) - luaL_error(L, "multiple Lua VMs detected"); - else if (*v != ver) - luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", - (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v); -} - diff --git a/deps/rcheevos/test/lua/src/lauxlib.h b/deps/rcheevos/test/lua/src/lauxlib.h deleted file mode 100644 index 9a2e66aa06..0000000000 --- a/deps/rcheevos/test/lua/src/lauxlib.h +++ /dev/null @@ -1,264 +0,0 @@ -/* -** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $ -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lauxlib_h -#define lauxlib_h - - -#include -#include - -#include "lua.h" - - - -/* extra error code for 'luaL_loadfilex' */ -#define LUA_ERRFILE (LUA_ERRERR+1) - - -/* key, in the registry, for table of loaded modules */ -#define LUA_LOADED_TABLE "_LOADED" - - -/* key, in the registry, for table of preloaded loaders */ -#define LUA_PRELOAD_TABLE "_PRELOAD" - - -typedef struct luaL_Reg { - const char *name; - lua_CFunction func; -} luaL_Reg; - - -#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number)) - -LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz); -#define luaL_checkversion(L) \ - luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES) - -LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); -LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); -LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); -LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg); -LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg, - size_t *l); -LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg, - const char *def, size_t *l); -LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg); -LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def); - -LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg); -LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg, - lua_Integer def); - -LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); -LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t); -LUALIB_API void (luaL_checkany) (lua_State *L, int arg); - -LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); -LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); -LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); -LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); - -LUALIB_API void (luaL_where) (lua_State *L, int lvl); -LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); - -LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, - const char *const lst[]); - -LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); -LUALIB_API int (luaL_execresult) (lua_State *L, int stat); - -/* predefined references */ -#define LUA_NOREF (-2) -#define LUA_REFNIL (-1) - -LUALIB_API int (luaL_ref) (lua_State *L, int t); -LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); - -LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, - const char *mode); - -#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) - -LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, - const char *name, const char *mode); -LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); - -LUALIB_API lua_State *(luaL_newstate) (void); - -LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); - -LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, - const char *r); - -LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); - -LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); - -LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, - const char *msg, int level); - -LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, - lua_CFunction openf, int glb); - -/* -** =============================================================== -** some useful macros -** =============================================================== -*/ - - -#define luaL_newlibtable(L,l) \ - lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) - -#define luaL_newlib(L,l) \ - (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) - -#define luaL_argcheck(L, cond,arg,extramsg) \ - ((void)((cond) || luaL_argerror(L, (arg), (extramsg)))) -#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) -#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) - -#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) - -#define luaL_dofile(L, fn) \ - (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) - -#define luaL_dostring(L, s) \ - (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) - -#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) - -#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) - -#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) - - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - -typedef struct luaL_Buffer { - char *b; /* buffer address */ - size_t size; /* buffer size */ - size_t n; /* number of characters in buffer */ - lua_State *L; - char initb[LUAL_BUFFERSIZE]; /* initial buffer */ -} luaL_Buffer; - - -#define luaL_addchar(B,c) \ - ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ - ((B)->b[(B)->n++] = (c))) - -#define luaL_addsize(B,s) ((B)->n += (s)) - -LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); -LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); -LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); -LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); -LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); -LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); -LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); -LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); - -#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) - -/* }====================================================== */ - - - -/* -** {====================================================== -** File handles for IO library -** ======================================================= -*/ - -/* -** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and -** initial structure 'luaL_Stream' (it may contain other fields -** after that initial structure). -*/ - -#define LUA_FILEHANDLE "FILE*" - - -typedef struct luaL_Stream { - FILE *f; /* stream (NULL for incompletely created streams) */ - lua_CFunction closef; /* to close stream (NULL for closed streams) */ -} luaL_Stream; - -/* }====================================================== */ - - - -/* compatibility with old module system */ -#if defined(LUA_COMPAT_MODULE) - -LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, - int sizehint); -LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, - const luaL_Reg *l, int nup); - -#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) - -#endif - - -/* -** {================================================================== -** "Abstraction Layer" for basic report of messages and errors -** =================================================================== -*/ - -/* print a string */ -#if !defined(lua_writestring) -#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) -#endif - -/* print a newline and flush the output */ -#if !defined(lua_writeline) -#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) -#endif - -/* print an error message */ -#if !defined(lua_writestringerror) -#define lua_writestringerror(s,p) \ - (fprintf(stderr, (s), (p)), fflush(stderr)) -#endif - -/* }================================================================== */ - - -/* -** {============================================================ -** Compatibility with deprecated conversions -** ============================================================= -*/ -#if defined(LUA_COMPAT_APIINTCASTS) - -#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) -#define luaL_optunsigned(L,a,d) \ - ((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d))) - -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) - -#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) -#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) - -#endif -/* }============================================================ */ - - - -#endif - - diff --git a/deps/rcheevos/test/lua/src/lbaselib.c b/deps/rcheevos/test/lua/src/lbaselib.c deleted file mode 100644 index 08523e6e75..0000000000 --- a/deps/rcheevos/test/lua/src/lbaselib.c +++ /dev/null @@ -1,498 +0,0 @@ -/* -** $Id: lbaselib.c,v 1.314 2016/09/05 19:06:34 roberto Exp $ -** Basic library -** See Copyright Notice in lua.h -*/ - -#define lbaselib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -static int luaB_print (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int i; - lua_getglobal(L, "tostring"); - for (i=1; i<=n; i++) { - const char *s; - size_t l; - lua_pushvalue(L, -1); /* function to be called */ - lua_pushvalue(L, i); /* value to print */ - lua_call(L, 1, 1); - s = lua_tolstring(L, -1, &l); /* get result */ - if (s == NULL) - return luaL_error(L, "'tostring' must return a string to 'print'"); - if (i>1) lua_writestring("\t", 1); - lua_writestring(s, l); - lua_pop(L, 1); /* pop result */ - } - lua_writeline(); - return 0; -} - - -#define SPACECHARS " \f\n\r\t\v" - -static const char *b_str2int (const char *s, int base, lua_Integer *pn) { - lua_Unsigned n = 0; - int neg = 0; - s += strspn(s, SPACECHARS); /* skip initial spaces */ - if (*s == '-') { s++; neg = 1; } /* handle signal */ - else if (*s == '+') s++; - if (!isalnum((unsigned char)*s)) /* no digit? */ - return NULL; - do { - int digit = (isdigit((unsigned char)*s)) ? *s - '0' - : (toupper((unsigned char)*s) - 'A') + 10; - if (digit >= base) return NULL; /* invalid numeral */ - n = n * base + digit; - s++; - } while (isalnum((unsigned char)*s)); - s += strspn(s, SPACECHARS); /* skip trailing spaces */ - *pn = (lua_Integer)((neg) ? (0u - n) : n); - return s; -} - - -static int luaB_tonumber (lua_State *L) { - if (lua_isnoneornil(L, 2)) { /* standard conversion? */ - luaL_checkany(L, 1); - if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ - lua_settop(L, 1); /* yes; return it */ - return 1; - } - else { - size_t l; - const char *s = lua_tolstring(L, 1, &l); - if (s != NULL && lua_stringtonumber(L, s) == l + 1) - return 1; /* successful conversion to number */ - /* else not a number */ - } - } - else { - size_t l; - const char *s; - lua_Integer n = 0; /* to avoid warnings */ - lua_Integer base = luaL_checkinteger(L, 2); - luaL_checktype(L, 1, LUA_TSTRING); /* no numbers as strings */ - s = lua_tolstring(L, 1, &l); - luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); - if (b_str2int(s, (int)base, &n) == s + l) { - lua_pushinteger(L, n); - return 1; - } /* else not a number */ - } /* else not a number */ - lua_pushnil(L); /* not a number */ - return 1; -} - - -static int luaB_error (lua_State *L) { - int level = (int)luaL_optinteger(L, 2, 1); - lua_settop(L, 1); - if (lua_type(L, 1) == LUA_TSTRING && level > 0) { - luaL_where(L, level); /* add extra information */ - lua_pushvalue(L, 1); - lua_concat(L, 2); - } - return lua_error(L); -} - - -static int luaB_getmetatable (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_getmetatable(L, 1)) { - lua_pushnil(L); - return 1; /* no metatable */ - } - luaL_getmetafield(L, 1, "__metatable"); - return 1; /* returns either __metatable field (if present) or metatable */ -} - - -static int luaB_setmetatable (lua_State *L) { - int t = lua_type(L, 2); - luaL_checktype(L, 1, LUA_TTABLE); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); - if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL) - return luaL_error(L, "cannot change a protected metatable"); - lua_settop(L, 2); - lua_setmetatable(L, 1); - return 1; -} - - -static int luaB_rawequal (lua_State *L) { - luaL_checkany(L, 1); - luaL_checkany(L, 2); - lua_pushboolean(L, lua_rawequal(L, 1, 2)); - return 1; -} - - -static int luaB_rawlen (lua_State *L) { - int t = lua_type(L, 1); - luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1, - "table or string expected"); - lua_pushinteger(L, lua_rawlen(L, 1)); - return 1; -} - - -static int luaB_rawget (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - lua_settop(L, 2); - lua_rawget(L, 1); - return 1; -} - -static int luaB_rawset (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - luaL_checkany(L, 3); - lua_settop(L, 3); - lua_rawset(L, 1); - return 1; -} - - -static int luaB_collectgarbage (lua_State *L) { - static const char *const opts[] = {"stop", "restart", "collect", - "count", "step", "setpause", "setstepmul", - "isrunning", NULL}; - static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, - LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, - LUA_GCISRUNNING}; - int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; - int ex = (int)luaL_optinteger(L, 2, 0); - int res = lua_gc(L, o, ex); - switch (o) { - case LUA_GCCOUNT: { - int b = lua_gc(L, LUA_GCCOUNTB, 0); - lua_pushnumber(L, (lua_Number)res + ((lua_Number)b/1024)); - return 1; - } - case LUA_GCSTEP: case LUA_GCISRUNNING: { - lua_pushboolean(L, res); - return 1; - } - default: { - lua_pushinteger(L, res); - return 1; - } - } -} - - -static int luaB_type (lua_State *L) { - int t = lua_type(L, 1); - luaL_argcheck(L, t != LUA_TNONE, 1, "value expected"); - lua_pushstring(L, lua_typename(L, t)); - return 1; -} - - -static int pairsmeta (lua_State *L, const char *method, int iszero, - lua_CFunction iter) { - luaL_checkany(L, 1); - if (luaL_getmetafield(L, 1, method) == LUA_TNIL) { /* no metamethod? */ - lua_pushcfunction(L, iter); /* will return generator, */ - lua_pushvalue(L, 1); /* state, */ - if (iszero) lua_pushinteger(L, 0); /* and initial value */ - else lua_pushnil(L); - } - else { - lua_pushvalue(L, 1); /* argument 'self' to metamethod */ - lua_call(L, 1, 3); /* get 3 values from metamethod */ - } - return 3; -} - - -static int luaB_next (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - lua_settop(L, 2); /* create a 2nd argument if there isn't one */ - if (lua_next(L, 1)) - return 2; - else { - lua_pushnil(L); - return 1; - } -} - - -static int luaB_pairs (lua_State *L) { - return pairsmeta(L, "__pairs", 0, luaB_next); -} - - -/* -** Traversal function for 'ipairs' -*/ -static int ipairsaux (lua_State *L) { - lua_Integer i = luaL_checkinteger(L, 2) + 1; - lua_pushinteger(L, i); - return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; -} - - -/* -** 'ipairs' function. Returns 'ipairsaux', given "table", 0. -** (The given "table" may not be a table.) -*/ -static int luaB_ipairs (lua_State *L) { -#if defined(LUA_COMPAT_IPAIRS) - return pairsmeta(L, "__ipairs", 1, ipairsaux); -#else - luaL_checkany(L, 1); - lua_pushcfunction(L, ipairsaux); /* iteration function */ - lua_pushvalue(L, 1); /* state */ - lua_pushinteger(L, 0); /* initial value */ - return 3; -#endif -} - - -static int load_aux (lua_State *L, int status, int envidx) { - if (status == LUA_OK) { - if (envidx != 0) { /* 'env' parameter? */ - lua_pushvalue(L, envidx); /* environment for loaded function */ - if (!lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */ - lua_pop(L, 1); /* remove 'env' if not used by previous call */ - } - return 1; - } - else { /* error (message is on top of the stack) */ - lua_pushnil(L); - lua_insert(L, -2); /* put before error message */ - return 2; /* return nil plus error message */ - } -} - - -static int luaB_loadfile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - const char *mode = luaL_optstring(L, 2, NULL); - int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ - int status = luaL_loadfilex(L, fname, mode); - return load_aux(L, status, env); -} - - -/* -** {====================================================== -** Generic Read function -** ======================================================= -*/ - - -/* -** reserved slot, above all arguments, to hold a copy of the returned -** string to avoid it being collected while parsed. 'load' has four -** optional arguments (chunk, source name, mode, and environment). -*/ -#define RESERVEDSLOT 5 - - -/* -** Reader for generic 'load' function: 'lua_load' uses the -** stack for internal stuff, so the reader cannot change the -** stack top. Instead, it keeps its resulting string in a -** reserved slot inside the stack. -*/ -static const char *generic_reader (lua_State *L, void *ud, size_t *size) { - (void)(ud); /* not used */ - luaL_checkstack(L, 2, "too many nested functions"); - lua_pushvalue(L, 1); /* get function */ - lua_call(L, 0, 1); /* call it */ - if (lua_isnil(L, -1)) { - lua_pop(L, 1); /* pop result */ - *size = 0; - return NULL; - } - else if (!lua_isstring(L, -1)) - luaL_error(L, "reader function must return a string"); - lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ - return lua_tolstring(L, RESERVEDSLOT, size); -} - - -static int luaB_load (lua_State *L) { - int status; - size_t l; - const char *s = lua_tolstring(L, 1, &l); - const char *mode = luaL_optstring(L, 3, "bt"); - int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ - if (s != NULL) { /* loading a string? */ - const char *chunkname = luaL_optstring(L, 2, s); - status = luaL_loadbufferx(L, s, l, chunkname, mode); - } - else { /* loading from a reader function */ - const char *chunkname = luaL_optstring(L, 2, "=(load)"); - luaL_checktype(L, 1, LUA_TFUNCTION); - lua_settop(L, RESERVEDSLOT); /* create reserved slot */ - status = lua_load(L, generic_reader, NULL, chunkname, mode); - } - return load_aux(L, status, env); -} - -/* }====================================================== */ - - -static int dofilecont (lua_State *L, int d1, lua_KContext d2) { - (void)d1; (void)d2; /* only to match 'lua_Kfunction' prototype */ - return lua_gettop(L) - 1; -} - - -static int luaB_dofile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - lua_settop(L, 1); - if (luaL_loadfile(L, fname) != LUA_OK) - return lua_error(L); - lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); - return dofilecont(L, 0, 0); -} - - -static int luaB_assert (lua_State *L) { - if (lua_toboolean(L, 1)) /* condition is true? */ - return lua_gettop(L); /* return all arguments */ - else { /* error */ - luaL_checkany(L, 1); /* there must be a condition */ - lua_remove(L, 1); /* remove it */ - lua_pushliteral(L, "assertion failed!"); /* default message */ - lua_settop(L, 1); /* leave only message (default if no other one) */ - return luaB_error(L); /* call 'error' */ - } -} - - -static int luaB_select (lua_State *L) { - int n = lua_gettop(L); - if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { - lua_pushinteger(L, n-1); - return 1; - } - else { - lua_Integer i = luaL_checkinteger(L, 1); - if (i < 0) i = n + i; - else if (i > n) i = n; - luaL_argcheck(L, 1 <= i, 1, "index out of range"); - return n - (int)i; - } -} - - -/* -** Continuation function for 'pcall' and 'xpcall'. Both functions -** already pushed a 'true' before doing the call, so in case of success -** 'finishpcall' only has to return everything in the stack minus -** 'extra' values (where 'extra' is exactly the number of items to be -** ignored). -*/ -static int finishpcall (lua_State *L, int status, lua_KContext extra) { - if (status != LUA_OK && status != LUA_YIELD) { /* error? */ - lua_pushboolean(L, 0); /* first result (false) */ - lua_pushvalue(L, -2); /* error message */ - return 2; /* return false, msg */ - } - else - return lua_gettop(L) - (int)extra; /* return all results */ -} - - -static int luaB_pcall (lua_State *L) { - int status; - luaL_checkany(L, 1); - lua_pushboolean(L, 1); /* first result if no errors */ - lua_insert(L, 1); /* put it in place */ - status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, finishpcall); - return finishpcall(L, status, 0); -} - - -/* -** Do a protected call with error handling. After 'lua_rotate', the -** stack will have ; so, the function passes -** 2 to 'finishpcall' to skip the 2 first values when returning results. -*/ -static int luaB_xpcall (lua_State *L) { - int status; - int n = lua_gettop(L); - luaL_checktype(L, 2, LUA_TFUNCTION); /* check error function */ - lua_pushboolean(L, 1); /* first result */ - lua_pushvalue(L, 1); /* function */ - lua_rotate(L, 3, 2); /* move them below function's arguments */ - status = lua_pcallk(L, n - 2, LUA_MULTRET, 2, 2, finishpcall); - return finishpcall(L, status, 2); -} - - -static int luaB_tostring (lua_State *L) { - luaL_checkany(L, 1); - luaL_tolstring(L, 1, NULL); - return 1; -} - - -static const luaL_Reg base_funcs[] = { - {"assert", luaB_assert}, - {"collectgarbage", luaB_collectgarbage}, - {"dofile", luaB_dofile}, - {"error", luaB_error}, - {"getmetatable", luaB_getmetatable}, - {"ipairs", luaB_ipairs}, - {"loadfile", luaB_loadfile}, - {"load", luaB_load}, -#if defined(LUA_COMPAT_LOADSTRING) - {"loadstring", luaB_load}, -#endif - {"next", luaB_next}, - {"pairs", luaB_pairs}, - {"pcall", luaB_pcall}, - {"print", luaB_print}, - {"rawequal", luaB_rawequal}, - {"rawlen", luaB_rawlen}, - {"rawget", luaB_rawget}, - {"rawset", luaB_rawset}, - {"select", luaB_select}, - {"setmetatable", luaB_setmetatable}, - {"tonumber", luaB_tonumber}, - {"tostring", luaB_tostring}, - {"type", luaB_type}, - {"xpcall", luaB_xpcall}, - /* placeholders */ - {"_G", NULL}, - {"_VERSION", NULL}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_base (lua_State *L) { - /* open lib into global table */ - lua_pushglobaltable(L); - luaL_setfuncs(L, base_funcs, 0); - /* set global _G */ - lua_pushvalue(L, -1); - lua_setfield(L, -2, "_G"); - /* set global _VERSION */ - lua_pushliteral(L, LUA_VERSION); - lua_setfield(L, -2, "_VERSION"); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/lbitlib.c b/deps/rcheevos/test/lua/src/lbitlib.c deleted file mode 100644 index 1cb1d5b932..0000000000 --- a/deps/rcheevos/test/lua/src/lbitlib.c +++ /dev/null @@ -1,233 +0,0 @@ -/* -** $Id: lbitlib.c,v 1.30 2015/11/11 19:08:09 roberto Exp $ -** Standard library for bitwise operations -** See Copyright Notice in lua.h -*/ - -#define lbitlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#if defined(LUA_COMPAT_BITLIB) /* { */ - - -#define pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) -#define checkunsigned(L,i) ((lua_Unsigned)luaL_checkinteger(L,i)) - - -/* number of bits to consider in a number */ -#if !defined(LUA_NBITS) -#define LUA_NBITS 32 -#endif - - -/* -** a lua_Unsigned with its first LUA_NBITS bits equal to 1. (Shift must -** be made in two parts to avoid problems when LUA_NBITS is equal to the -** number of bits in a lua_Unsigned.) -*/ -#define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1)) - - -/* macro to trim extra bits */ -#define trim(x) ((x) & ALLONES) - - -/* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */ -#define mask(n) (~((ALLONES << 1) << ((n) - 1))) - - - -static lua_Unsigned andaux (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = ~(lua_Unsigned)0; - for (i = 1; i <= n; i++) - r &= checkunsigned(L, i); - return trim(r); -} - - -static int b_and (lua_State *L) { - lua_Unsigned r = andaux(L); - pushunsigned(L, r); - return 1; -} - - -static int b_test (lua_State *L) { - lua_Unsigned r = andaux(L); - lua_pushboolean(L, r != 0); - return 1; -} - - -static int b_or (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = 0; - for (i = 1; i <= n; i++) - r |= checkunsigned(L, i); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_xor (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = 0; - for (i = 1; i <= n; i++) - r ^= checkunsigned(L, i); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_not (lua_State *L) { - lua_Unsigned r = ~checkunsigned(L, 1); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) { - if (i < 0) { /* shift right? */ - i = -i; - r = trim(r); - if (i >= LUA_NBITS) r = 0; - else r >>= i; - } - else { /* shift left */ - if (i >= LUA_NBITS) r = 0; - else r <<= i; - r = trim(r); - } - pushunsigned(L, r); - return 1; -} - - -static int b_lshift (lua_State *L) { - return b_shift(L, checkunsigned(L, 1), luaL_checkinteger(L, 2)); -} - - -static int b_rshift (lua_State *L) { - return b_shift(L, checkunsigned(L, 1), -luaL_checkinteger(L, 2)); -} - - -static int b_arshift (lua_State *L) { - lua_Unsigned r = checkunsigned(L, 1); - lua_Integer i = luaL_checkinteger(L, 2); - if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1)))) - return b_shift(L, r, -i); - else { /* arithmetic shift for 'negative' number */ - if (i >= LUA_NBITS) r = ALLONES; - else - r = trim((r >> i) | ~(trim(~(lua_Unsigned)0) >> i)); /* add signal bit */ - pushunsigned(L, r); - return 1; - } -} - - -static int b_rot (lua_State *L, lua_Integer d) { - lua_Unsigned r = checkunsigned(L, 1); - int i = d & (LUA_NBITS - 1); /* i = d % NBITS */ - r = trim(r); - if (i != 0) /* avoid undefined shift of LUA_NBITS when i == 0 */ - r = (r << i) | (r >> (LUA_NBITS - i)); - pushunsigned(L, trim(r)); - return 1; -} - - -static int b_lrot (lua_State *L) { - return b_rot(L, luaL_checkinteger(L, 2)); -} - - -static int b_rrot (lua_State *L) { - return b_rot(L, -luaL_checkinteger(L, 2)); -} - - -/* -** get field and width arguments for field-manipulation functions, -** checking whether they are valid. -** ('luaL_error' called without 'return' to avoid later warnings about -** 'width' being used uninitialized.) -*/ -static int fieldargs (lua_State *L, int farg, int *width) { - lua_Integer f = luaL_checkinteger(L, farg); - lua_Integer w = luaL_optinteger(L, farg + 1, 1); - luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); - luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); - if (f + w > LUA_NBITS) - luaL_error(L, "trying to access non-existent bits"); - *width = (int)w; - return (int)f; -} - - -static int b_extract (lua_State *L) { - int w; - lua_Unsigned r = trim(checkunsigned(L, 1)); - int f = fieldargs(L, 2, &w); - r = (r >> f) & mask(w); - pushunsigned(L, r); - return 1; -} - - -static int b_replace (lua_State *L) { - int w; - lua_Unsigned r = trim(checkunsigned(L, 1)); - lua_Unsigned v = trim(checkunsigned(L, 2)); - int f = fieldargs(L, 3, &w); - lua_Unsigned m = mask(w); - r = (r & ~(m << f)) | ((v & m) << f); - pushunsigned(L, r); - return 1; -} - - -static const luaL_Reg bitlib[] = { - {"arshift", b_arshift}, - {"band", b_and}, - {"bnot", b_not}, - {"bor", b_or}, - {"bxor", b_xor}, - {"btest", b_test}, - {"extract", b_extract}, - {"lrotate", b_lrot}, - {"lshift", b_lshift}, - {"replace", b_replace}, - {"rrotate", b_rrot}, - {"rshift", b_rshift}, - {NULL, NULL} -}; - - - -LUAMOD_API int luaopen_bit32 (lua_State *L) { - luaL_newlib(L, bitlib); - return 1; -} - - -#else /* }{ */ - - -LUAMOD_API int luaopen_bit32 (lua_State *L) { - return luaL_error(L, "library 'bit32' has been deprecated"); -} - -#endif /* } */ diff --git a/deps/rcheevos/test/lua/src/lcode.c b/deps/rcheevos/test/lua/src/lcode.c deleted file mode 100644 index 0bb414262e..0000000000 --- a/deps/rcheevos/test/lua/src/lcode.c +++ /dev/null @@ -1,1203 +0,0 @@ -/* -** $Id: lcode.c,v 2.112 2016/12/22 13:08:50 roberto Exp $ -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - -#define lcode_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstring.h" -#include "ltable.h" -#include "lvm.h" - - -/* Maximum number of registers in a Lua function (must fit in 8 bits) */ -#define MAXREGS 255 - - -#define hasjumps(e) ((e)->t != (e)->f) - - -/* -** If expression is a numeric constant, fills 'v' with its value -** and returns 1. Otherwise, returns 0. -*/ -static int tonumeral(const expdesc *e, TValue *v) { - if (hasjumps(e)) - return 0; /* not a numeral */ - switch (e->k) { - case VKINT: - if (v) setivalue(v, e->u.ival); - return 1; - case VKFLT: - if (v) setfltvalue(v, e->u.nval); - return 1; - default: return 0; - } -} - - -/* -** Create a OP_LOADNIL instruction, but try to optimize: if the previous -** instruction is also OP_LOADNIL and ranges are compatible, adjust -** range of previous instruction instead of emitting a new one. (For -** instance, 'local a; local b' will generate a single opcode.) -*/ -void luaK_nil (FuncState *fs, int from, int n) { - Instruction *previous; - int l = from + n - 1; /* last register to set nil */ - if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ - previous = &fs->f->code[fs->pc-1]; - if (GET_OPCODE(*previous) == OP_LOADNIL) { /* previous is LOADNIL? */ - int pfrom = GETARG_A(*previous); /* get previous range */ - int pl = pfrom + GETARG_B(*previous); - if ((pfrom <= from && from <= pl + 1) || - (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */ - if (pfrom < from) from = pfrom; /* from = min(from, pfrom) */ - if (pl > l) l = pl; /* l = max(l, pl) */ - SETARG_A(*previous, from); - SETARG_B(*previous, l - from); - return; - } - } /* else go through */ - } - luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */ -} - - -/* -** Gets the destination address of a jump instruction. Used to traverse -** a list of jumps. -*/ -static int getjump (FuncState *fs, int pc) { - int offset = GETARG_sBx(fs->f->code[pc]); - if (offset == NO_JUMP) /* point to itself represents end of list */ - return NO_JUMP; /* end of list */ - else - return (pc+1)+offset; /* turn offset into absolute position */ -} - - -/* -** Fix jump instruction at position 'pc' to jump to 'dest'. -** (Jump addresses are relative in Lua) -*/ -static void fixjump (FuncState *fs, int pc, int dest) { - Instruction *jmp = &fs->f->code[pc]; - int offset = dest - (pc + 1); - lua_assert(dest != NO_JUMP); - if (abs(offset) > MAXARG_sBx) - luaX_syntaxerror(fs->ls, "control structure too long"); - SETARG_sBx(*jmp, offset); -} - - -/* -** Concatenate jump-list 'l2' into jump-list 'l1' -*/ -void luaK_concat (FuncState *fs, int *l1, int l2) { - if (l2 == NO_JUMP) return; /* nothing to concatenate? */ - else if (*l1 == NO_JUMP) /* no original list? */ - *l1 = l2; /* 'l1' points to 'l2' */ - else { - int list = *l1; - int next; - while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ - list = next; - fixjump(fs, list, l2); /* last element links to 'l2' */ - } -} - - -/* -** Create a jump instruction and return its position, so its destination -** can be fixed later (with 'fixjump'). If there are jumps to -** this position (kept in 'jpc'), link them all together so that -** 'patchlistaux' will fix all them directly to the final destination. -*/ -int luaK_jump (FuncState *fs) { - int jpc = fs->jpc; /* save list of jumps to here */ - int j; - fs->jpc = NO_JUMP; /* no more jumps to here */ - j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); - luaK_concat(fs, &j, jpc); /* keep them on hold */ - return j; -} - - -/* -** Code a 'return' instruction -*/ -void luaK_ret (FuncState *fs, int first, int nret) { - luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); -} - - -/* -** Code a "conditional jump", that is, a test or comparison opcode -** followed by a jump. Return jump position. -*/ -static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { - luaK_codeABC(fs, op, A, B, C); - return luaK_jump(fs); -} - - -/* -** returns current 'pc' and marks it as a jump target (to avoid wrong -** optimizations with consecutive instructions not in the same basic block). -*/ -int luaK_getlabel (FuncState *fs) { - fs->lasttarget = fs->pc; - return fs->pc; -} - - -/* -** Returns the position of the instruction "controlling" a given -** jump (that is, its condition), or the jump itself if it is -** unconditional. -*/ -static Instruction *getjumpcontrol (FuncState *fs, int pc) { - Instruction *pi = &fs->f->code[pc]; - if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) - return pi-1; - else - return pi; -} - - -/* -** Patch destination register for a TESTSET instruction. -** If instruction in position 'node' is not a TESTSET, return 0 ("fails"). -** Otherwise, if 'reg' is not 'NO_REG', set it as the destination -** register. Otherwise, change instruction to a simple 'TEST' (produces -** no register value) -*/ -static int patchtestreg (FuncState *fs, int node, int reg) { - Instruction *i = getjumpcontrol(fs, node); - if (GET_OPCODE(*i) != OP_TESTSET) - return 0; /* cannot patch other instructions */ - if (reg != NO_REG && reg != GETARG_B(*i)) - SETARG_A(*i, reg); - else { - /* no register to put value or register already has the value; - change instruction to simple test */ - *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); - } - return 1; -} - - -/* -** Traverse a list of tests ensuring no one produces a value -*/ -static void removevalues (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) - patchtestreg(fs, list, NO_REG); -} - - -/* -** Traverse a list of tests, patching their destination address and -** registers: tests producing values jump to 'vtarget' (and put their -** values in 'reg'), other tests jump to 'dtarget'. -*/ -static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, - int dtarget) { - while (list != NO_JUMP) { - int next = getjump(fs, list); - if (patchtestreg(fs, list, reg)) - fixjump(fs, list, vtarget); - else - fixjump(fs, list, dtarget); /* jump to default target */ - list = next; - } -} - - -/* -** Ensure all pending jumps to current position are fixed (jumping -** to current position with no values) and reset list of pending -** jumps -*/ -static void dischargejpc (FuncState *fs) { - patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); - fs->jpc = NO_JUMP; -} - - -/* -** Add elements in 'list' to list of pending jumps to "here" -** (current position) -*/ -void luaK_patchtohere (FuncState *fs, int list) { - luaK_getlabel(fs); /* mark "here" as a jump target */ - luaK_concat(fs, &fs->jpc, list); -} - - -/* -** Path all jumps in 'list' to jump to 'target'. -** (The assert means that we cannot fix a jump to a forward address -** because we only know addresses once code is generated.) -*/ -void luaK_patchlist (FuncState *fs, int list, int target) { - if (target == fs->pc) /* 'target' is current position? */ - luaK_patchtohere(fs, list); /* add list to pending jumps */ - else { - lua_assert(target < fs->pc); - patchlistaux(fs, list, target, NO_REG, target); - } -} - - -/* -** Path all jumps in 'list' to close upvalues up to given 'level' -** (The assertion checks that jumps either were closing nothing -** or were closing higher levels, from inner blocks.) -*/ -void luaK_patchclose (FuncState *fs, int list, int level) { - level++; /* argument is +1 to reserve 0 as non-op */ - for (; list != NO_JUMP; list = getjump(fs, list)) { - lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP && - (GETARG_A(fs->f->code[list]) == 0 || - GETARG_A(fs->f->code[list]) >= level)); - SETARG_A(fs->f->code[list], level); - } -} - - -/* -** Emit instruction 'i', checking for array sizes and saving also its -** line information. Return 'i' position. -*/ -static int luaK_code (FuncState *fs, Instruction i) { - Proto *f = fs->f; - dischargejpc(fs); /* 'pc' will change */ - /* put new instruction in code array */ - luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, - MAX_INT, "opcodes"); - f->code[fs->pc] = i; - /* save corresponding line information */ - luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int, - MAX_INT, "opcodes"); - f->lineinfo[fs->pc] = fs->ls->lastline; - return fs->pc++; -} - - -/* -** Format and emit an 'iABC' instruction. (Assertions check consistency -** of parameters versus opcode.) -*/ -int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { - lua_assert(getOpMode(o) == iABC); - lua_assert(getBMode(o) != OpArgN || b == 0); - lua_assert(getCMode(o) != OpArgN || c == 0); - lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C); - return luaK_code(fs, CREATE_ABC(o, a, b, c)); -} - - -/* -** Format and emit an 'iABx' instruction. -*/ -int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { - lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); - lua_assert(getCMode(o) == OpArgN); - lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx); - return luaK_code(fs, CREATE_ABx(o, a, bc)); -} - - -/* -** Emit an "extra argument" instruction (format 'iAx') -*/ -static int codeextraarg (FuncState *fs, int a) { - lua_assert(a <= MAXARG_Ax); - return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a)); -} - - -/* -** Emit a "load constant" instruction, using either 'OP_LOADK' -** (if constant index 'k' fits in 18 bits) or an 'OP_LOADKX' -** instruction with "extra argument". -*/ -int luaK_codek (FuncState *fs, int reg, int k) { - if (k <= MAXARG_Bx) - return luaK_codeABx(fs, OP_LOADK, reg, k); - else { - int p = luaK_codeABx(fs, OP_LOADKX, reg, 0); - codeextraarg(fs, k); - return p; - } -} - - -/* -** Check register-stack level, keeping track of its maximum size -** in field 'maxstacksize' -*/ -void luaK_checkstack (FuncState *fs, int n) { - int newstack = fs->freereg + n; - if (newstack > fs->f->maxstacksize) { - if (newstack >= MAXREGS) - luaX_syntaxerror(fs->ls, - "function or expression needs too many registers"); - fs->f->maxstacksize = cast_byte(newstack); - } -} - - -/* -** Reserve 'n' registers in register stack -*/ -void luaK_reserveregs (FuncState *fs, int n) { - luaK_checkstack(fs, n); - fs->freereg += n; -} - - -/* -** Free register 'reg', if it is neither a constant index nor -** a local variable. -) -*/ -static void freereg (FuncState *fs, int reg) { - if (!ISK(reg) && reg >= fs->nactvar) { - fs->freereg--; - lua_assert(reg == fs->freereg); - } -} - - -/* -** Free register used by expression 'e' (if any) -*/ -static void freeexp (FuncState *fs, expdesc *e) { - if (e->k == VNONRELOC) - freereg(fs, e->u.info); -} - - -/* -** Free registers used by expressions 'e1' and 'e2' (if any) in proper -** order. -*/ -static void freeexps (FuncState *fs, expdesc *e1, expdesc *e2) { - int r1 = (e1->k == VNONRELOC) ? e1->u.info : -1; - int r2 = (e2->k == VNONRELOC) ? e2->u.info : -1; - if (r1 > r2) { - freereg(fs, r1); - freereg(fs, r2); - } - else { - freereg(fs, r2); - freereg(fs, r1); - } -} - - -/* -** Add constant 'v' to prototype's list of constants (field 'k'). -** Use scanner's table to cache position of constants in constant list -** and try to reuse constants. Because some values should not be used -** as keys (nil cannot be a key, integer keys can collapse with float -** keys), the caller must provide a useful 'key' for indexing the cache. -*/ -static int addk (FuncState *fs, TValue *key, TValue *v) { - lua_State *L = fs->ls->L; - Proto *f = fs->f; - TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */ - int k, oldsize; - if (ttisinteger(idx)) { /* is there an index there? */ - k = cast_int(ivalue(idx)); - /* correct value? (warning: must distinguish floats from integers!) */ - if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && - luaV_rawequalobj(&f->k[k], v)) - return k; /* reuse index */ - } - /* constant not found; create a new entry */ - oldsize = f->sizek; - k = fs->nk; - /* numerical value does not need GC barrier; - table has no metatable, so it does not need to invalidate cache */ - setivalue(idx, k); - luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); - while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); - setobj(L, &f->k[k], v); - fs->nk++; - luaC_barrier(L, f, v); - return k; -} - - -/* -** Add a string to list of constants and return its index. -*/ -int luaK_stringK (FuncState *fs, TString *s) { - TValue o; - setsvalue(fs->ls->L, &o, s); - return addk(fs, &o, &o); /* use string itself as key */ -} - - -/* -** Add an integer to list of constants and return its index. -** Integers use userdata as keys to avoid collision with floats with -** same value; conversion to 'void*' is used only for hashing, so there -** are no "precision" problems. -*/ -int luaK_intK (FuncState *fs, lua_Integer n) { - TValue k, o; - setpvalue(&k, cast(void*, cast(size_t, n))); - setivalue(&o, n); - return addk(fs, &k, &o); -} - -/* -** Add a float to list of constants and return its index. -*/ -static int luaK_numberK (FuncState *fs, lua_Number r) { - TValue o; - setfltvalue(&o, r); - return addk(fs, &o, &o); /* use number itself as key */ -} - - -/* -** Add a boolean to list of constants and return its index. -*/ -static int boolK (FuncState *fs, int b) { - TValue o; - setbvalue(&o, b); - return addk(fs, &o, &o); /* use boolean itself as key */ -} - - -/* -** Add nil to list of constants and return its index. -*/ -static int nilK (FuncState *fs) { - TValue k, v; - setnilvalue(&v); - /* cannot use nil as key; instead use table itself to represent nil */ - sethvalue(fs->ls->L, &k, fs->ls->h); - return addk(fs, &k, &v); -} - - -/* -** Fix an expression to return the number of results 'nresults'. -** Either 'e' is a multi-ret expression (function call or vararg) -** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). -*/ -void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { - if (e->k == VCALL) { /* expression is an open function call? */ - SETARG_C(getinstruction(fs, e), nresults + 1); - } - else if (e->k == VVARARG) { - Instruction *pc = &getinstruction(fs, e); - SETARG_B(*pc, nresults + 1); - SETARG_A(*pc, fs->freereg); - luaK_reserveregs(fs, 1); - } - else lua_assert(nresults == LUA_MULTRET); -} - - -/* -** Fix an expression to return one result. -** If expression is not a multi-ret expression (function call or -** vararg), it already returns one result, so nothing needs to be done. -** Function calls become VNONRELOC expressions (as its result comes -** fixed in the base register of the call), while vararg expressions -** become VRELOCABLE (as OP_VARARG puts its results where it wants). -** (Calls are created returning one result, so that does not need -** to be fixed.) -*/ -void luaK_setoneret (FuncState *fs, expdesc *e) { - if (e->k == VCALL) { /* expression is an open function call? */ - /* already returns 1 value */ - lua_assert(GETARG_C(getinstruction(fs, e)) == 2); - e->k = VNONRELOC; /* result has fixed position */ - e->u.info = GETARG_A(getinstruction(fs, e)); - } - else if (e->k == VVARARG) { - SETARG_B(getinstruction(fs, e), 2); - e->k = VRELOCABLE; /* can relocate its simple result */ - } -} - - -/* -** Ensure that expression 'e' is not a variable. -*/ -void luaK_dischargevars (FuncState *fs, expdesc *e) { - switch (e->k) { - case VLOCAL: { /* already in a register */ - e->k = VNONRELOC; /* becomes a non-relocatable value */ - break; - } - case VUPVAL: { /* move value to some (pending) register */ - e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0); - e->k = VRELOCABLE; - break; - } - case VINDEXED: { - OpCode op; - freereg(fs, e->u.ind.idx); - if (e->u.ind.vt == VLOCAL) { /* is 't' in a register? */ - freereg(fs, e->u.ind.t); - op = OP_GETTABLE; - } - else { - lua_assert(e->u.ind.vt == VUPVAL); - op = OP_GETTABUP; /* 't' is in an upvalue */ - } - e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx); - e->k = VRELOCABLE; - break; - } - case VVARARG: case VCALL: { - luaK_setoneret(fs, e); - break; - } - default: break; /* there is one value available (somewhere) */ - } -} - - -/* -** Ensures expression value is in register 'reg' (and therefore -** 'e' will become a non-relocatable expression). -*/ -static void discharge2reg (FuncState *fs, expdesc *e, int reg) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: { - luaK_nil(fs, reg, 1); - break; - } - case VFALSE: case VTRUE: { - luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); - break; - } - case VK: { - luaK_codek(fs, reg, e->u.info); - break; - } - case VKFLT: { - luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval)); - break; - } - case VKINT: { - luaK_codek(fs, reg, luaK_intK(fs, e->u.ival)); - break; - } - case VRELOCABLE: { - Instruction *pc = &getinstruction(fs, e); - SETARG_A(*pc, reg); /* instruction will put result in 'reg' */ - break; - } - case VNONRELOC: { - if (reg != e->u.info) - luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0); - break; - } - default: { - lua_assert(e->k == VJMP); - return; /* nothing to do... */ - } - } - e->u.info = reg; - e->k = VNONRELOC; -} - - -/* -** Ensures expression value is in any register. -*/ -static void discharge2anyreg (FuncState *fs, expdesc *e) { - if (e->k != VNONRELOC) { /* no fixed register yet? */ - luaK_reserveregs(fs, 1); /* get a register */ - discharge2reg(fs, e, fs->freereg-1); /* put value there */ - } -} - - -static int code_loadbool (FuncState *fs, int A, int b, int jump) { - luaK_getlabel(fs); /* those instructions may be jump targets */ - return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); -} - - -/* -** check whether list has any jump that do not produce a value -** or produce an inverted value -*/ -static int need_value (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) { - Instruction i = *getjumpcontrol(fs, list); - if (GET_OPCODE(i) != OP_TESTSET) return 1; - } - return 0; /* not found */ -} - - -/* -** Ensures final expression result (including results from its jump -** lists) is in register 'reg'. -** If expression has jumps, need to patch these jumps either to -** its final position or to "load" instructions (for those tests -** that do not produce values). -*/ -static void exp2reg (FuncState *fs, expdesc *e, int reg) { - discharge2reg(fs, e, reg); - if (e->k == VJMP) /* expression itself is a test? */ - luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ - if (hasjumps(e)) { - int final; /* position after whole expression */ - int p_f = NO_JUMP; /* position of an eventual LOAD false */ - int p_t = NO_JUMP; /* position of an eventual LOAD true */ - if (need_value(fs, e->t) || need_value(fs, e->f)) { - int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); - p_f = code_loadbool(fs, reg, 0, 1); - p_t = code_loadbool(fs, reg, 1, 0); - luaK_patchtohere(fs, fj); - } - final = luaK_getlabel(fs); - patchlistaux(fs, e->f, final, reg, p_f); - patchlistaux(fs, e->t, final, reg, p_t); - } - e->f = e->t = NO_JUMP; - e->u.info = reg; - e->k = VNONRELOC; -} - - -/* -** Ensures final expression result (including results from its jump -** lists) is in next available register. -*/ -void luaK_exp2nextreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - freeexp(fs, e); - luaK_reserveregs(fs, 1); - exp2reg(fs, e, fs->freereg - 1); -} - - -/* -** Ensures final expression result (including results from its jump -** lists) is in some (any) register and return that register. -*/ -int luaK_exp2anyreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - if (e->k == VNONRELOC) { /* expression already has a register? */ - if (!hasjumps(e)) /* no jumps? */ - return e->u.info; /* result is already in a register */ - if (e->u.info >= fs->nactvar) { /* reg. is not a local? */ - exp2reg(fs, e, e->u.info); /* put final result in it */ - return e->u.info; - } - } - luaK_exp2nextreg(fs, e); /* otherwise, use next available register */ - return e->u.info; -} - - -/* -** Ensures final expression result is either in a register or in an -** upvalue. -*/ -void luaK_exp2anyregup (FuncState *fs, expdesc *e) { - if (e->k != VUPVAL || hasjumps(e)) - luaK_exp2anyreg(fs, e); -} - - -/* -** Ensures final expression result is either in a register or it is -** a constant. -*/ -void luaK_exp2val (FuncState *fs, expdesc *e) { - if (hasjumps(e)) - luaK_exp2anyreg(fs, e); - else - luaK_dischargevars(fs, e); -} - - -/* -** Ensures final expression result is in a valid R/K index -** (that is, it is either in a register or in 'k' with an index -** in the range of R/K indices). -** Returns R/K index. -*/ -int luaK_exp2RK (FuncState *fs, expdesc *e) { - luaK_exp2val(fs, e); - switch (e->k) { /* move constants to 'k' */ - case VTRUE: e->u.info = boolK(fs, 1); goto vk; - case VFALSE: e->u.info = boolK(fs, 0); goto vk; - case VNIL: e->u.info = nilK(fs); goto vk; - case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk; - case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk; - case VK: - vk: - e->k = VK; - if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */ - return RKASK(e->u.info); - else break; - default: break; - } - /* not a constant in the right range: put it in a register */ - return luaK_exp2anyreg(fs, e); -} - - -/* -** Generate code to store result of expression 'ex' into variable 'var'. -*/ -void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { - switch (var->k) { - case VLOCAL: { - freeexp(fs, ex); - exp2reg(fs, ex, var->u.info); /* compute 'ex' into proper place */ - return; - } - case VUPVAL: { - int e = luaK_exp2anyreg(fs, ex); - luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); - break; - } - case VINDEXED: { - OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP; - int e = luaK_exp2RK(fs, ex); - luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e); - break; - } - default: lua_assert(0); /* invalid var kind to store */ - } - freeexp(fs, ex); -} - - -/* -** Emit SELF instruction (convert expression 'e' into 'e:key(e,'). -*/ -void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { - int ereg; - luaK_exp2anyreg(fs, e); - ereg = e->u.info; /* register where 'e' was placed */ - freeexp(fs, e); - e->u.info = fs->freereg; /* base register for op_self */ - e->k = VNONRELOC; /* self expression has a fixed register */ - luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ - luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key)); - freeexp(fs, key); -} - - -/* -** Negate condition 'e' (where 'e' is a comparison). -*/ -static void negatecondition (FuncState *fs, expdesc *e) { - Instruction *pc = getjumpcontrol(fs, e->u.info); - lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && - GET_OPCODE(*pc) != OP_TEST); - SETARG_A(*pc, !(GETARG_A(*pc))); -} - - -/* -** Emit instruction to jump if 'e' is 'cond' (that is, if 'cond' -** is true, code will jump if 'e' is true.) Return jump position. -** Optimize when 'e' is 'not' something, inverting the condition -** and removing the 'not'. -*/ -static int jumponcond (FuncState *fs, expdesc *e, int cond) { - if (e->k == VRELOCABLE) { - Instruction ie = getinstruction(fs, e); - if (GET_OPCODE(ie) == OP_NOT) { - fs->pc--; /* remove previous OP_NOT */ - return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); - } - /* else go through */ - } - discharge2anyreg(fs, e); - freeexp(fs, e); - return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond); -} - - -/* -** Emit code to go through if 'e' is true, jump otherwise. -*/ -void luaK_goiftrue (FuncState *fs, expdesc *e) { - int pc; /* pc of new jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VJMP: { /* condition? */ - negatecondition(fs, e); /* jump when it is false */ - pc = e->u.info; /* save jump position */ - break; - } - case VK: case VKFLT: case VKINT: case VTRUE: { - pc = NO_JUMP; /* always true; do nothing */ - break; - } - default: { - pc = jumponcond(fs, e, 0); /* jump when false */ - break; - } - } - luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ - luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ - e->t = NO_JUMP; -} - - -/* -** Emit code to go through if 'e' is false, jump otherwise. -*/ -void luaK_goiffalse (FuncState *fs, expdesc *e) { - int pc; /* pc of new jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VJMP: { - pc = e->u.info; /* already jump if true */ - break; - } - case VNIL: case VFALSE: { - pc = NO_JUMP; /* always false; do nothing */ - break; - } - default: { - pc = jumponcond(fs, e, 1); /* jump if true */ - break; - } - } - luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */ - luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */ - e->f = NO_JUMP; -} - - -/* -** Code 'not e', doing constant folding. -*/ -static void codenot (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: case VFALSE: { - e->k = VTRUE; /* true == not nil == not false */ - break; - } - case VK: case VKFLT: case VKINT: case VTRUE: { - e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */ - break; - } - case VJMP: { - negatecondition(fs, e); - break; - } - case VRELOCABLE: - case VNONRELOC: { - discharge2anyreg(fs, e); - freeexp(fs, e); - e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0); - e->k = VRELOCABLE; - break; - } - default: lua_assert(0); /* cannot happen */ - } - /* interchange true and false lists */ - { int temp = e->f; e->f = e->t; e->t = temp; } - removevalues(fs, e->f); /* values are useless when negated */ - removevalues(fs, e->t); -} - - -/* -** Create expression 't[k]'. 't' must have its final result already in a -** register or upvalue. -*/ -void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { - lua_assert(!hasjumps(t) && (vkisinreg(t->k) || t->k == VUPVAL)); - t->u.ind.t = t->u.info; /* register or upvalue index */ - t->u.ind.idx = luaK_exp2RK(fs, k); /* R/K index for key */ - t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL : VLOCAL; - t->k = VINDEXED; -} - - -/* -** Return false if folding can raise an error. -** Bitwise operations need operands convertible to integers; division -** operations cannot have 0 as divisor. -*/ -static int validop (int op, TValue *v1, TValue *v2) { - switch (op) { - case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: - case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: { /* conversion errors */ - lua_Integer i; - return (tointeger(v1, &i) && tointeger(v2, &i)); - } - case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */ - return (nvalue(v2) != 0); - default: return 1; /* everything else is valid */ - } -} - - -/* -** Try to "constant-fold" an operation; return 1 iff successful. -** (In this case, 'e1' has the final result.) -*/ -static int constfolding (FuncState *fs, int op, expdesc *e1, - const expdesc *e2) { - TValue v1, v2, res; - if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2)) - return 0; /* non-numeric operands or not safe to fold */ - luaO_arith(fs->ls->L, op, &v1, &v2, &res); /* does operation */ - if (ttisinteger(&res)) { - e1->k = VKINT; - e1->u.ival = ivalue(&res); - } - else { /* folds neither NaN nor 0.0 (to avoid problems with -0.0) */ - lua_Number n = fltvalue(&res); - if (luai_numisnan(n) || n == 0) - return 0; - e1->k = VKFLT; - e1->u.nval = n; - } - return 1; -} - - -/* -** Emit code for unary expressions that "produce values" -** (everything but 'not'). -** Expression to produce final result will be encoded in 'e'. -*/ -static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) { - int r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */ - freeexp(fs, e); - e->u.info = luaK_codeABC(fs, op, 0, r, 0); /* generate opcode */ - e->k = VRELOCABLE; /* all those operations are relocatable */ - luaK_fixline(fs, line); -} - - -/* -** Emit code for binary expressions that "produce values" -** (everything but logical operators 'and'/'or' and comparison -** operators). -** Expression to produce final result will be encoded in 'e1'. -** Because 'luaK_exp2RK' can free registers, its calls must be -** in "stack order" (that is, first on 'e2', which may have more -** recent registers to be released). -*/ -static void codebinexpval (FuncState *fs, OpCode op, - expdesc *e1, expdesc *e2, int line) { - int rk2 = luaK_exp2RK(fs, e2); /* both operands are "RK" */ - int rk1 = luaK_exp2RK(fs, e1); - freeexps(fs, e1, e2); - e1->u.info = luaK_codeABC(fs, op, 0, rk1, rk2); /* generate opcode */ - e1->k = VRELOCABLE; /* all those operations are relocatable */ - luaK_fixline(fs, line); -} - - -/* -** Emit code for comparisons. -** 'e1' was already put in R/K form by 'luaK_infix'. -*/ -static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { - int rk1 = (e1->k == VK) ? RKASK(e1->u.info) - : check_exp(e1->k == VNONRELOC, e1->u.info); - int rk2 = luaK_exp2RK(fs, e2); - freeexps(fs, e1, e2); - switch (opr) { - case OPR_NE: { /* '(a ~= b)' ==> 'not (a == b)' */ - e1->u.info = condjump(fs, OP_EQ, 0, rk1, rk2); - break; - } - case OPR_GT: case OPR_GE: { - /* '(a > b)' ==> '(b < a)'; '(a >= b)' ==> '(b <= a)' */ - OpCode op = cast(OpCode, (opr - OPR_NE) + OP_EQ); - e1->u.info = condjump(fs, op, 1, rk2, rk1); /* invert operands */ - break; - } - default: { /* '==', '<', '<=' use their own opcodes */ - OpCode op = cast(OpCode, (opr - OPR_EQ) + OP_EQ); - e1->u.info = condjump(fs, op, 1, rk1, rk2); - break; - } - } - e1->k = VJMP; -} - - -/* -** Aplly prefix operation 'op' to expression 'e'. -*/ -void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { - static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; - switch (op) { - case OPR_MINUS: case OPR_BNOT: /* use 'ef' as fake 2nd operand */ - if (constfolding(fs, op + LUA_OPUNM, e, &ef)) - break; - /* FALLTHROUGH */ - case OPR_LEN: - codeunexpval(fs, cast(OpCode, op + OP_UNM), e, line); - break; - case OPR_NOT: codenot(fs, e); break; - default: lua_assert(0); - } -} - - -/* -** Process 1st operand 'v' of binary operation 'op' before reading -** 2nd operand. -*/ -void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { - switch (op) { - case OPR_AND: { - luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ - break; - } - case OPR_OR: { - luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ - break; - } - case OPR_CONCAT: { - luaK_exp2nextreg(fs, v); /* operand must be on the 'stack' */ - break; - } - case OPR_ADD: case OPR_SUB: - case OPR_MUL: case OPR_DIV: case OPR_IDIV: - case OPR_MOD: case OPR_POW: - case OPR_BAND: case OPR_BOR: case OPR_BXOR: - case OPR_SHL: case OPR_SHR: { - if (!tonumeral(v, NULL)) - luaK_exp2RK(fs, v); - /* else keep numeral, which may be folded with 2nd operand */ - break; - } - default: { - luaK_exp2RK(fs, v); - break; - } - } -} - - -/* -** Finalize code for binary operation, after reading 2nd operand. -** For '(a .. b .. c)' (which is '(a .. (b .. c))', because -** concatenation is right associative), merge second CONCAT into first -** one. -*/ -void luaK_posfix (FuncState *fs, BinOpr op, - expdesc *e1, expdesc *e2, int line) { - switch (op) { - case OPR_AND: { - lua_assert(e1->t == NO_JUMP); /* list closed by 'luK_infix' */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->f, e1->f); - *e1 = *e2; - break; - } - case OPR_OR: { - lua_assert(e1->f == NO_JUMP); /* list closed by 'luK_infix' */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->t, e1->t); - *e1 = *e2; - break; - } - case OPR_CONCAT: { - luaK_exp2val(fs, e2); - if (e2->k == VRELOCABLE && - GET_OPCODE(getinstruction(fs, e2)) == OP_CONCAT) { - lua_assert(e1->u.info == GETARG_B(getinstruction(fs, e2))-1); - freeexp(fs, e1); - SETARG_B(getinstruction(fs, e2), e1->u.info); - e1->k = VRELOCABLE; e1->u.info = e2->u.info; - } - else { - luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ - codebinexpval(fs, OP_CONCAT, e1, e2, line); - } - break; - } - case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: - case OPR_IDIV: case OPR_MOD: case OPR_POW: - case OPR_BAND: case OPR_BOR: case OPR_BXOR: - case OPR_SHL: case OPR_SHR: { - if (!constfolding(fs, op + LUA_OPADD, e1, e2)) - codebinexpval(fs, cast(OpCode, op + OP_ADD), e1, e2, line); - break; - } - case OPR_EQ: case OPR_LT: case OPR_LE: - case OPR_NE: case OPR_GT: case OPR_GE: { - codecomp(fs, op, e1, e2); - break; - } - default: lua_assert(0); - } -} - - -/* -** Change line information associated with current position. -*/ -void luaK_fixline (FuncState *fs, int line) { - fs->f->lineinfo[fs->pc - 1] = line; -} - - -/* -** Emit a SETLIST instruction. -** 'base' is register that keeps table; -** 'nelems' is #table plus those to be stored now; -** 'tostore' is number of values (in registers 'base + 1',...) to add to -** table (or LUA_MULTRET to add up to stack top). -*/ -void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { - int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; - int b = (tostore == LUA_MULTRET) ? 0 : tostore; - lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); - if (c <= MAXARG_C) - luaK_codeABC(fs, OP_SETLIST, base, b, c); - else if (c <= MAXARG_Ax) { - luaK_codeABC(fs, OP_SETLIST, base, b, 0); - codeextraarg(fs, c); - } - else - luaX_syntaxerror(fs->ls, "constructor too long"); - fs->freereg = base + 1; /* free registers with list values */ -} - diff --git a/deps/rcheevos/test/lua/src/lcode.h b/deps/rcheevos/test/lua/src/lcode.h deleted file mode 100644 index cd306d573a..0000000000 --- a/deps/rcheevos/test/lua/src/lcode.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -** $Id: lcode.h,v 1.64 2016/01/05 16:22:37 roberto Exp $ -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - -#ifndef lcode_h -#define lcode_h - -#include "llex.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" - - -/* -** Marks the end of a patch list. It is an invalid value both as an absolute -** address, and as a list link (would link an element to itself). -*/ -#define NO_JUMP (-1) - - -/* -** grep "ORDER OPR" if you change these enums (ORDER OP) -*/ -typedef enum BinOpr { - OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW, - OPR_DIV, - OPR_IDIV, - OPR_BAND, OPR_BOR, OPR_BXOR, - OPR_SHL, OPR_SHR, - OPR_CONCAT, - OPR_EQ, OPR_LT, OPR_LE, - OPR_NE, OPR_GT, OPR_GE, - OPR_AND, OPR_OR, - OPR_NOBINOPR -} BinOpr; - - -typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; - - -/* get (pointer to) instruction of given 'expdesc' */ -#define getinstruction(fs,e) ((fs)->f->code[(e)->u.info]) - -#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) - -#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) - -#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) - -LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); -LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); -LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k); -LUAI_FUNC void luaK_fixline (FuncState *fs, int line); -LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); -LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); -LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); -LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); -LUAI_FUNC int luaK_intK (FuncState *fs, lua_Integer n); -LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); -LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); -LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); -LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); -LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_jump (FuncState *fs); -LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); -LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); -LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); -LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level); -LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); -LUAI_FUNC int luaK_getlabel (FuncState *fs); -LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); -LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); -LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, - expdesc *v2, int line); -LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); - - -#endif diff --git a/deps/rcheevos/test/lua/src/lcorolib.c b/deps/rcheevos/test/lua/src/lcorolib.c deleted file mode 100644 index 2303429e7b..0000000000 --- a/deps/rcheevos/test/lua/src/lcorolib.c +++ /dev/null @@ -1,168 +0,0 @@ -/* -** $Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp $ -** Coroutine Library -** See Copyright Notice in lua.h -*/ - -#define lcorolib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -static lua_State *getco (lua_State *L) { - lua_State *co = lua_tothread(L, 1); - luaL_argcheck(L, co, 1, "thread expected"); - return co; -} - - -static int auxresume (lua_State *L, lua_State *co, int narg) { - int status; - if (!lua_checkstack(co, narg)) { - lua_pushliteral(L, "too many arguments to resume"); - return -1; /* error flag */ - } - if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) { - lua_pushliteral(L, "cannot resume dead coroutine"); - return -1; /* error flag */ - } - lua_xmove(L, co, narg); - status = lua_resume(co, L, narg); - if (status == LUA_OK || status == LUA_YIELD) { - int nres = lua_gettop(co); - if (!lua_checkstack(L, nres + 1)) { - lua_pop(co, nres); /* remove results anyway */ - lua_pushliteral(L, "too many results to resume"); - return -1; /* error flag */ - } - lua_xmove(co, L, nres); /* move yielded values */ - return nres; - } - else { - lua_xmove(co, L, 1); /* move error message */ - return -1; /* error flag */ - } -} - - -static int luaB_coresume (lua_State *L) { - lua_State *co = getco(L); - int r; - r = auxresume(L, co, lua_gettop(L) - 1); - if (r < 0) { - lua_pushboolean(L, 0); - lua_insert(L, -2); - return 2; /* return false + error message */ - } - else { - lua_pushboolean(L, 1); - lua_insert(L, -(r + 1)); - return r + 1; /* return true + 'resume' returns */ - } -} - - -static int luaB_auxwrap (lua_State *L) { - lua_State *co = lua_tothread(L, lua_upvalueindex(1)); - int r = auxresume(L, co, lua_gettop(L)); - if (r < 0) { - if (lua_type(L, -1) == LUA_TSTRING) { /* error object is a string? */ - luaL_where(L, 1); /* add extra info */ - lua_insert(L, -2); - lua_concat(L, 2); - } - return lua_error(L); /* propagate error */ - } - return r; -} - - -static int luaB_cocreate (lua_State *L) { - lua_State *NL; - luaL_checktype(L, 1, LUA_TFUNCTION); - NL = lua_newthread(L); - lua_pushvalue(L, 1); /* move function to top */ - lua_xmove(L, NL, 1); /* move function from L to NL */ - return 1; -} - - -static int luaB_cowrap (lua_State *L) { - luaB_cocreate(L); - lua_pushcclosure(L, luaB_auxwrap, 1); - return 1; -} - - -static int luaB_yield (lua_State *L) { - return lua_yield(L, lua_gettop(L)); -} - - -static int luaB_costatus (lua_State *L) { - lua_State *co = getco(L); - if (L == co) lua_pushliteral(L, "running"); - else { - switch (lua_status(co)) { - case LUA_YIELD: - lua_pushliteral(L, "suspended"); - break; - case LUA_OK: { - lua_Debug ar; - if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ - lua_pushliteral(L, "normal"); /* it is running */ - else if (lua_gettop(co) == 0) - lua_pushliteral(L, "dead"); - else - lua_pushliteral(L, "suspended"); /* initial state */ - break; - } - default: /* some error occurred */ - lua_pushliteral(L, "dead"); - break; - } - } - return 1; -} - - -static int luaB_yieldable (lua_State *L) { - lua_pushboolean(L, lua_isyieldable(L)); - return 1; -} - - -static int luaB_corunning (lua_State *L) { - int ismain = lua_pushthread(L); - lua_pushboolean(L, ismain); - return 2; -} - - -static const luaL_Reg co_funcs[] = { - {"create", luaB_cocreate}, - {"resume", luaB_coresume}, - {"running", luaB_corunning}, - {"status", luaB_costatus}, - {"wrap", luaB_cowrap}, - {"yield", luaB_yield}, - {"isyieldable", luaB_yieldable}, - {NULL, NULL} -}; - - - -LUAMOD_API int luaopen_coroutine (lua_State *L) { - luaL_newlib(L, co_funcs); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/lctype.c b/deps/rcheevos/test/lua/src/lctype.c deleted file mode 100644 index ae9367e691..0000000000 --- a/deps/rcheevos/test/lua/src/lctype.c +++ /dev/null @@ -1,55 +0,0 @@ -/* -** $Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp $ -** 'ctype' functions for Lua -** See Copyright Notice in lua.h -*/ - -#define lctype_c -#define LUA_CORE - -#include "lprefix.h" - - -#include "lctype.h" - -#if !LUA_USE_CTYPE /* { */ - -#include - -LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { - 0x00, /* EOZ */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ - 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ - 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ - 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, - 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ - 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -#endif /* } */ diff --git a/deps/rcheevos/test/lua/src/lctype.h b/deps/rcheevos/test/lua/src/lctype.h deleted file mode 100644 index 99c7d12237..0000000000 --- a/deps/rcheevos/test/lua/src/lctype.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $ -** 'ctype' functions for Lua -** See Copyright Notice in lua.h -*/ - -#ifndef lctype_h -#define lctype_h - -#include "lua.h" - - -/* -** WARNING: the functions defined here do not necessarily correspond -** to the similar functions in the standard C ctype.h. They are -** optimized for the specific needs of Lua -*/ - -#if !defined(LUA_USE_CTYPE) - -#if 'A' == 65 && '0' == 48 -/* ASCII case: can use its own tables; faster and fixed */ -#define LUA_USE_CTYPE 0 -#else -/* must use standard C ctype */ -#define LUA_USE_CTYPE 1 -#endif - -#endif - - -#if !LUA_USE_CTYPE /* { */ - -#include - -#include "llimits.h" - - -#define ALPHABIT 0 -#define DIGITBIT 1 -#define PRINTBIT 2 -#define SPACEBIT 3 -#define XDIGITBIT 4 - - -#define MASK(B) (1 << (B)) - - -/* -** add 1 to char to allow index -1 (EOZ) -*/ -#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) - -/* -** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' -*/ -#define lislalpha(c) testprop(c, MASK(ALPHABIT)) -#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) -#define lisdigit(c) testprop(c, MASK(DIGITBIT)) -#define lisspace(c) testprop(c, MASK(SPACEBIT)) -#define lisprint(c) testprop(c, MASK(PRINTBIT)) -#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) - -/* -** this 'ltolower' only works for alphabetic characters -*/ -#define ltolower(c) ((c) | ('A' ^ 'a')) - - -/* two more entries for 0 and -1 (EOZ) */ -LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; - - -#else /* }{ */ - -/* -** use standard C ctypes -*/ - -#include - - -#define lislalpha(c) (isalpha(c) || (c) == '_') -#define lislalnum(c) (isalnum(c) || (c) == '_') -#define lisdigit(c) (isdigit(c)) -#define lisspace(c) (isspace(c)) -#define lisprint(c) (isprint(c)) -#define lisxdigit(c) (isxdigit(c)) - -#define ltolower(c) (tolower(c)) - -#endif /* } */ - -#endif - diff --git a/deps/rcheevos/test/lua/src/ldblib.c b/deps/rcheevos/test/lua/src/ldblib.c deleted file mode 100644 index 786f6cd95d..0000000000 --- a/deps/rcheevos/test/lua/src/ldblib.c +++ /dev/null @@ -1,456 +0,0 @@ -/* -** $Id: ldblib.c,v 1.151 2015/11/23 11:29:43 roberto Exp $ -** Interface from Lua to its debug API -** See Copyright Notice in lua.h -*/ - -#define ldblib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** The hook table at registry[&HOOKKEY] maps threads to their current -** hook function. (We only need the unique address of 'HOOKKEY'.) -*/ -static const int HOOKKEY = 0; - - -/* -** If L1 != L, L1 can be in any state, and therefore there are no -** guarantees about its stack space; any push in L1 must be -** checked. -*/ -static void checkstack (lua_State *L, lua_State *L1, int n) { - if (L != L1 && !lua_checkstack(L1, n)) - luaL_error(L, "stack overflow"); -} - - -static int db_getregistry (lua_State *L) { - lua_pushvalue(L, LUA_REGISTRYINDEX); - return 1; -} - - -static int db_getmetatable (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_getmetatable(L, 1)) { - lua_pushnil(L); /* no metatable */ - } - return 1; -} - - -static int db_setmetatable (lua_State *L) { - int t = lua_type(L, 2); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); - lua_settop(L, 2); - lua_setmetatable(L, 1); - return 1; /* return 1st argument */ -} - - -static int db_getuservalue (lua_State *L) { - if (lua_type(L, 1) != LUA_TUSERDATA) - lua_pushnil(L); - else - lua_getuservalue(L, 1); - return 1; -} - - -static int db_setuservalue (lua_State *L) { - luaL_checktype(L, 1, LUA_TUSERDATA); - luaL_checkany(L, 2); - lua_settop(L, 2); - lua_setuservalue(L, 1); - return 1; -} - - -/* -** Auxiliary function used by several library functions: check for -** an optional thread as function's first argument and set 'arg' with -** 1 if this argument is present (so that functions can skip it to -** access their other arguments) -*/ -static lua_State *getthread (lua_State *L, int *arg) { - if (lua_isthread(L, 1)) { - *arg = 1; - return lua_tothread(L, 1); - } - else { - *arg = 0; - return L; /* function will operate over current thread */ - } -} - - -/* -** Variations of 'lua_settable', used by 'db_getinfo' to put results -** from 'lua_getinfo' into result table. Key is always a string; -** value can be a string, an int, or a boolean. -*/ -static void settabss (lua_State *L, const char *k, const char *v) { - lua_pushstring(L, v); - lua_setfield(L, -2, k); -} - -static void settabsi (lua_State *L, const char *k, int v) { - lua_pushinteger(L, v); - lua_setfield(L, -2, k); -} - -static void settabsb (lua_State *L, const char *k, int v) { - lua_pushboolean(L, v); - lua_setfield(L, -2, k); -} - - -/* -** In function 'db_getinfo', the call to 'lua_getinfo' may push -** results on the stack; later it creates the result table to put -** these objects. Function 'treatstackoption' puts the result from -** 'lua_getinfo' on top of the result table so that it can call -** 'lua_setfield'. -*/ -static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { - if (L == L1) - lua_rotate(L, -2, 1); /* exchange object and table */ - else - lua_xmove(L1, L, 1); /* move object to the "main" stack */ - lua_setfield(L, -2, fname); /* put object into table */ -} - - -/* -** Calls 'lua_getinfo' and collects all results in a new table. -** L1 needs stack space for an optional input (function) plus -** two optional outputs (function and line table) from function -** 'lua_getinfo'. -*/ -static int db_getinfo (lua_State *L) { - lua_Debug ar; - int arg; - lua_State *L1 = getthread(L, &arg); - const char *options = luaL_optstring(L, arg+2, "flnStu"); - checkstack(L, L1, 3); - if (lua_isfunction(L, arg + 1)) { /* info about a function? */ - options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ - lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ - lua_xmove(L, L1, 1); - } - else { /* stack level */ - if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) { - lua_pushnil(L); /* level out of range */ - return 1; - } - } - if (!lua_getinfo(L1, options, &ar)) - return luaL_argerror(L, arg+2, "invalid option"); - lua_newtable(L); /* table to collect results */ - if (strchr(options, 'S')) { - settabss(L, "source", ar.source); - settabss(L, "short_src", ar.short_src); - settabsi(L, "linedefined", ar.linedefined); - settabsi(L, "lastlinedefined", ar.lastlinedefined); - settabss(L, "what", ar.what); - } - if (strchr(options, 'l')) - settabsi(L, "currentline", ar.currentline); - if (strchr(options, 'u')) { - settabsi(L, "nups", ar.nups); - settabsi(L, "nparams", ar.nparams); - settabsb(L, "isvararg", ar.isvararg); - } - if (strchr(options, 'n')) { - settabss(L, "name", ar.name); - settabss(L, "namewhat", ar.namewhat); - } - if (strchr(options, 't')) - settabsb(L, "istailcall", ar.istailcall); - if (strchr(options, 'L')) - treatstackoption(L, L1, "activelines"); - if (strchr(options, 'f')) - treatstackoption(L, L1, "func"); - return 1; /* return table */ -} - - -static int db_getlocal (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - const char *name; - int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ - if (lua_isfunction(L, arg + 1)) { /* function argument? */ - lua_pushvalue(L, arg + 1); /* push function */ - lua_pushstring(L, lua_getlocal(L, NULL, nvar)); /* push local name */ - return 1; /* return only name (there is no value) */ - } - else { /* stack-level argument */ - int level = (int)luaL_checkinteger(L, arg + 1); - if (!lua_getstack(L1, level, &ar)) /* out of range? */ - return luaL_argerror(L, arg+1, "level out of range"); - checkstack(L, L1, 1); - name = lua_getlocal(L1, &ar, nvar); - if (name) { - lua_xmove(L1, L, 1); /* move local value */ - lua_pushstring(L, name); /* push name */ - lua_rotate(L, -2, 1); /* re-order */ - return 2; - } - else { - lua_pushnil(L); /* no name (nor value) */ - return 1; - } - } -} - - -static int db_setlocal (lua_State *L) { - int arg; - const char *name; - lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - int level = (int)luaL_checkinteger(L, arg + 1); - int nvar = (int)luaL_checkinteger(L, arg + 2); - if (!lua_getstack(L1, level, &ar)) /* out of range? */ - return luaL_argerror(L, arg+1, "level out of range"); - luaL_checkany(L, arg+3); - lua_settop(L, arg+3); - checkstack(L, L1, 1); - lua_xmove(L, L1, 1); - name = lua_setlocal(L1, &ar, nvar); - if (name == NULL) - lua_pop(L1, 1); /* pop value (if not popped by 'lua_setlocal') */ - lua_pushstring(L, name); - return 1; -} - - -/* -** get (if 'get' is true) or set an upvalue from a closure -*/ -static int auxupvalue (lua_State *L, int get) { - const char *name; - int n = (int)luaL_checkinteger(L, 2); /* upvalue index */ - luaL_checktype(L, 1, LUA_TFUNCTION); /* closure */ - name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); - if (name == NULL) return 0; - lua_pushstring(L, name); - lua_insert(L, -(get+1)); /* no-op if get is false */ - return get + 1; -} - - -static int db_getupvalue (lua_State *L) { - return auxupvalue(L, 1); -} - - -static int db_setupvalue (lua_State *L) { - luaL_checkany(L, 3); - return auxupvalue(L, 0); -} - - -/* -** Check whether a given upvalue from a given closure exists and -** returns its index -*/ -static int checkupval (lua_State *L, int argf, int argnup) { - int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */ - luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */ - luaL_argcheck(L, (lua_getupvalue(L, argf, nup) != NULL), argnup, - "invalid upvalue index"); - return nup; -} - - -static int db_upvalueid (lua_State *L) { - int n = checkupval(L, 1, 2); - lua_pushlightuserdata(L, lua_upvalueid(L, 1, n)); - return 1; -} - - -static int db_upvaluejoin (lua_State *L) { - int n1 = checkupval(L, 1, 2); - int n2 = checkupval(L, 3, 4); - luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected"); - luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected"); - lua_upvaluejoin(L, 1, n1, 3, n2); - return 0; -} - - -/* -** Call hook function registered at hook table for the current -** thread (if there is one) -*/ -static void hookf (lua_State *L, lua_Debug *ar) { - static const char *const hooknames[] = - {"call", "return", "line", "count", "tail call"}; - lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); - lua_pushthread(L); - if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */ - lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */ - if (ar->currentline >= 0) - lua_pushinteger(L, ar->currentline); /* push current line */ - else lua_pushnil(L); - lua_assert(lua_getinfo(L, "lS", ar)); - lua_call(L, 2, 0); /* call hook function */ - } -} - - -/* -** Convert a string mask (for 'sethook') into a bit mask -*/ -static int makemask (const char *smask, int count) { - int mask = 0; - if (strchr(smask, 'c')) mask |= LUA_MASKCALL; - if (strchr(smask, 'r')) mask |= LUA_MASKRET; - if (strchr(smask, 'l')) mask |= LUA_MASKLINE; - if (count > 0) mask |= LUA_MASKCOUNT; - return mask; -} - - -/* -** Convert a bit mask (for 'gethook') into a string mask -*/ -static char *unmakemask (int mask, char *smask) { - int i = 0; - if (mask & LUA_MASKCALL) smask[i++] = 'c'; - if (mask & LUA_MASKRET) smask[i++] = 'r'; - if (mask & LUA_MASKLINE) smask[i++] = 'l'; - smask[i] = '\0'; - return smask; -} - - -static int db_sethook (lua_State *L) { - int arg, mask, count; - lua_Hook func; - lua_State *L1 = getthread(L, &arg); - if (lua_isnoneornil(L, arg+1)) { /* no hook? */ - lua_settop(L, arg+1); - func = NULL; mask = 0; count = 0; /* turn off hooks */ - } - else { - const char *smask = luaL_checkstring(L, arg+2); - luaL_checktype(L, arg+1, LUA_TFUNCTION); - count = (int)luaL_optinteger(L, arg + 3, 0); - func = hookf; mask = makemask(smask, count); - } - if (lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY) == LUA_TNIL) { - lua_createtable(L, 0, 2); /* create a hook table */ - lua_pushvalue(L, -1); - lua_rawsetp(L, LUA_REGISTRYINDEX, &HOOKKEY); /* set it in position */ - lua_pushstring(L, "k"); - lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */ - lua_pushvalue(L, -1); - lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */ - } - checkstack(L, L1, 1); - lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */ - lua_pushvalue(L, arg + 1); /* value (hook function) */ - lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */ - lua_sethook(L1, func, mask, count); - return 0; -} - - -static int db_gethook (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - char buff[5]; - int mask = lua_gethookmask(L1); - lua_Hook hook = lua_gethook(L1); - if (hook == NULL) /* no hook? */ - lua_pushnil(L); - else if (hook != hookf) /* external hook? */ - lua_pushliteral(L, "external hook"); - else { /* hook table must exist */ - lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); - checkstack(L, L1, 1); - lua_pushthread(L1); lua_xmove(L1, L, 1); - lua_rawget(L, -2); /* 1st result = hooktable[L1] */ - lua_remove(L, -2); /* remove hook table */ - } - lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */ - lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */ - return 3; -} - - -static int db_debug (lua_State *L) { - for (;;) { - char buffer[250]; - lua_writestringerror("%s", "lua_debug> "); - if (fgets(buffer, sizeof(buffer), stdin) == 0 || - strcmp(buffer, "cont\n") == 0) - return 0; - if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || - lua_pcall(L, 0, 0, 0)) - lua_writestringerror("%s\n", lua_tostring(L, -1)); - lua_settop(L, 0); /* remove eventual returns */ - } -} - - -static int db_traceback (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - const char *msg = lua_tostring(L, arg + 1); - if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */ - lua_pushvalue(L, arg + 1); /* return it untouched */ - else { - int level = (int)luaL_optinteger(L, arg + 2, (L == L1) ? 1 : 0); - luaL_traceback(L, L1, msg, level); - } - return 1; -} - - -static const luaL_Reg dblib[] = { - {"debug", db_debug}, - {"getuservalue", db_getuservalue}, - {"gethook", db_gethook}, - {"getinfo", db_getinfo}, - {"getlocal", db_getlocal}, - {"getregistry", db_getregistry}, - {"getmetatable", db_getmetatable}, - {"getupvalue", db_getupvalue}, - {"upvaluejoin", db_upvaluejoin}, - {"upvalueid", db_upvalueid}, - {"setuservalue", db_setuservalue}, - {"sethook", db_sethook}, - {"setlocal", db_setlocal}, - {"setmetatable", db_setmetatable}, - {"setupvalue", db_setupvalue}, - {"traceback", db_traceback}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_debug (lua_State *L) { - luaL_newlib(L, dblib); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/ldebug.c b/deps/rcheevos/test/lua/src/ldebug.c deleted file mode 100644 index 4a98cd4116..0000000000 --- a/deps/rcheevos/test/lua/src/ldebug.c +++ /dev/null @@ -1,698 +0,0 @@ -/* -** $Id: ldebug.c,v 2.121 2016/10/19 12:32:10 roberto Exp $ -** Debug Interface -** See Copyright Notice in lua.h -*/ - -#define ldebug_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - - -#define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) - - -/* Active Lua function (given call info) */ -#define ci_func(ci) (clLvalue((ci)->func)) - - -static const char *funcnamefromcode (lua_State *L, CallInfo *ci, - const char **name); - - -static int currentpc (CallInfo *ci) { - lua_assert(isLua(ci)); - return pcRel(ci->u.l.savedpc, ci_func(ci)->p); -} - - -static int currentline (CallInfo *ci) { - return getfuncline(ci_func(ci)->p, currentpc(ci)); -} - - -/* -** If function yielded, its 'func' can be in the 'extra' field. The -** next function restores 'func' to its correct value for debugging -** purposes. (It exchanges 'func' and 'extra'; so, when called again, -** after debugging, it also "re-restores" ** 'func' to its altered value. -*/ -static void swapextra (lua_State *L) { - if (L->status == LUA_YIELD) { - CallInfo *ci = L->ci; /* get function that yielded */ - StkId temp = ci->func; /* exchange its 'func' and 'extra' values */ - ci->func = restorestack(L, ci->extra); - ci->extra = savestack(L, temp); - } -} - - -/* -** This function can be called asynchronously (e.g. during a signal). -** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by -** 'resethookcount') are for debug only, and it is no problem if they -** get arbitrary values (causes at most one wrong hook call). 'hookmask' -** is an atomic value. We assume that pointers are atomic too (e.g., gcc -** ensures that for all platforms where it runs). Moreover, 'hook' is -** always checked before being called (see 'luaD_hook'). -*/ -LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { - if (func == NULL || mask == 0) { /* turn off hooks? */ - mask = 0; - func = NULL; - } - if (isLua(L->ci)) - L->oldpc = L->ci->u.l.savedpc; - L->hook = func; - L->basehookcount = count; - resethookcount(L); - L->hookmask = cast_byte(mask); -} - - -LUA_API lua_Hook lua_gethook (lua_State *L) { - return L->hook; -} - - -LUA_API int lua_gethookmask (lua_State *L) { - return L->hookmask; -} - - -LUA_API int lua_gethookcount (lua_State *L) { - return L->basehookcount; -} - - -LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { - int status; - CallInfo *ci; - if (level < 0) return 0; /* invalid (negative) level */ - lua_lock(L); - for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) - level--; - if (level == 0 && ci != &L->base_ci) { /* level found? */ - status = 1; - ar->i_ci = ci; - } - else status = 0; /* no such level */ - lua_unlock(L); - return status; -} - - -static const char *upvalname (Proto *p, int uv) { - TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name); - if (s == NULL) return "?"; - else return getstr(s); -} - - -static const char *findvararg (CallInfo *ci, int n, StkId *pos) { - int nparams = clLvalue(ci->func)->p->numparams; - if (n >= cast_int(ci->u.l.base - ci->func) - nparams) - return NULL; /* no such vararg */ - else { - *pos = ci->func + nparams + n; - return "(*vararg)"; /* generic name for any vararg */ - } -} - - -static const char *findlocal (lua_State *L, CallInfo *ci, int n, - StkId *pos) { - const char *name = NULL; - StkId base; - if (isLua(ci)) { - if (n < 0) /* access to vararg values? */ - return findvararg(ci, -n, pos); - else { - base = ci->u.l.base; - name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); - } - } - else - base = ci->func + 1; - if (name == NULL) { /* no 'standard' name? */ - StkId limit = (ci == L->ci) ? L->top : ci->next->func; - if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */ - name = "(*temporary)"; /* generic name for any valid slot */ - else - return NULL; /* no name */ - } - *pos = base + (n - 1); - return name; -} - - -LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { - const char *name; - lua_lock(L); - swapextra(L); - if (ar == NULL) { /* information about non-active function? */ - if (!isLfunction(L->top - 1)) /* not a Lua function? */ - name = NULL; - else /* consider live variables at function start (parameters) */ - name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); - } - else { /* active function; get information through 'ar' */ - StkId pos = NULL; /* to avoid warnings */ - name = findlocal(L, ar->i_ci, n, &pos); - if (name) { - setobj2s(L, L->top, pos); - api_incr_top(L); - } - } - swapextra(L); - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { - StkId pos = NULL; /* to avoid warnings */ - const char *name; - lua_lock(L); - swapextra(L); - name = findlocal(L, ar->i_ci, n, &pos); - if (name) { - setobjs2s(L, pos, L->top - 1); - L->top--; /* pop value */ - } - swapextra(L); - lua_unlock(L); - return name; -} - - -static void funcinfo (lua_Debug *ar, Closure *cl) { - if (noLuaClosure(cl)) { - ar->source = "=[C]"; - ar->linedefined = -1; - ar->lastlinedefined = -1; - ar->what = "C"; - } - else { - Proto *p = cl->l.p; - ar->source = p->source ? getstr(p->source) : "=?"; - ar->linedefined = p->linedefined; - ar->lastlinedefined = p->lastlinedefined; - ar->what = (ar->linedefined == 0) ? "main" : "Lua"; - } - luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); -} - - -static void collectvalidlines (lua_State *L, Closure *f) { - if (noLuaClosure(f)) { - setnilvalue(L->top); - api_incr_top(L); - } - else { - int i; - TValue v; - int *lineinfo = f->l.p->lineinfo; - Table *t = luaH_new(L); /* new table to store active lines */ - sethvalue(L, L->top, t); /* push it on stack */ - api_incr_top(L); - setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ - for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */ - luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ - } -} - - -static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { - if (ci == NULL) /* no 'ci'? */ - return NULL; /* no info */ - else if (ci->callstatus & CIST_FIN) { /* is this a finalizer? */ - *name = "__gc"; - return "metamethod"; /* report it as such */ - } - /* calling function is a known Lua function? */ - else if (!(ci->callstatus & CIST_TAIL) && isLua(ci->previous)) - return funcnamefromcode(L, ci->previous, name); - else return NULL; /* no way to find a name */ -} - - -static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, - Closure *f, CallInfo *ci) { - int status = 1; - for (; *what; what++) { - switch (*what) { - case 'S': { - funcinfo(ar, f); - break; - } - case 'l': { - ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1; - break; - } - case 'u': { - ar->nups = (f == NULL) ? 0 : f->c.nupvalues; - if (noLuaClosure(f)) { - ar->isvararg = 1; - ar->nparams = 0; - } - else { - ar->isvararg = f->l.p->is_vararg; - ar->nparams = f->l.p->numparams; - } - break; - } - case 't': { - ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; - break; - } - case 'n': { - ar->namewhat = getfuncname(L, ci, &ar->name); - if (ar->namewhat == NULL) { - ar->namewhat = ""; /* not found */ - ar->name = NULL; - } - break; - } - case 'L': - case 'f': /* handled by lua_getinfo */ - break; - default: status = 0; /* invalid option */ - } - } - return status; -} - - -LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { - int status; - Closure *cl; - CallInfo *ci; - StkId func; - lua_lock(L); - swapextra(L); - if (*what == '>') { - ci = NULL; - func = L->top - 1; - api_check(L, ttisfunction(func), "function expected"); - what++; /* skip the '>' */ - L->top--; /* pop function */ - } - else { - ci = ar->i_ci; - func = ci->func; - lua_assert(ttisfunction(ci->func)); - } - cl = ttisclosure(func) ? clvalue(func) : NULL; - status = auxgetinfo(L, what, ar, cl, ci); - if (strchr(what, 'f')) { - setobjs2s(L, L->top, func); - api_incr_top(L); - } - swapextra(L); /* correct before option 'L', which can raise a mem. error */ - if (strchr(what, 'L')) - collectvalidlines(L, cl); - lua_unlock(L); - return status; -} - - -/* -** {====================================================== -** Symbolic Execution -** ======================================================= -*/ - -static const char *getobjname (Proto *p, int lastpc, int reg, - const char **name); - - -/* -** find a "name" for the RK value 'c' -*/ -static void kname (Proto *p, int pc, int c, const char **name) { - if (ISK(c)) { /* is 'c' a constant? */ - TValue *kvalue = &p->k[INDEXK(c)]; - if (ttisstring(kvalue)) { /* literal constant? */ - *name = svalue(kvalue); /* it is its own name */ - return; - } - /* else no reasonable name found */ - } - else { /* 'c' is a register */ - const char *what = getobjname(p, pc, c, name); /* search for 'c' */ - if (what && *what == 'c') { /* found a constant name? */ - return; /* 'name' already filled */ - } - /* else no reasonable name found */ - } - *name = "?"; /* no reasonable name found */ -} - - -static int filterpc (int pc, int jmptarget) { - if (pc < jmptarget) /* is code conditional (inside a jump)? */ - return -1; /* cannot know who sets that register */ - else return pc; /* current position sets that register */ -} - - -/* -** try to find last instruction before 'lastpc' that modified register 'reg' -*/ -static int findsetreg (Proto *p, int lastpc, int reg) { - int pc; - int setreg = -1; /* keep last instruction that changed 'reg' */ - int jmptarget = 0; /* any code before this address is conditional */ - for (pc = 0; pc < lastpc; pc++) { - Instruction i = p->code[pc]; - OpCode op = GET_OPCODE(i); - int a = GETARG_A(i); - switch (op) { - case OP_LOADNIL: { - int b = GETARG_B(i); - if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_TFORCALL: { - if (reg >= a + 2) /* affect all regs above its base */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_CALL: - case OP_TAILCALL: { - if (reg >= a) /* affect all registers above base */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_JMP: { - int b = GETARG_sBx(i); - int dest = pc + 1 + b; - /* jump is forward and do not skip 'lastpc'? */ - if (pc < dest && dest <= lastpc) { - if (dest > jmptarget) - jmptarget = dest; /* update 'jmptarget' */ - } - break; - } - default: - if (testAMode(op) && reg == a) /* any instruction that set A */ - setreg = filterpc(pc, jmptarget); - break; - } - } - return setreg; -} - - -static const char *getobjname (Proto *p, int lastpc, int reg, - const char **name) { - int pc; - *name = luaF_getlocalname(p, reg + 1, lastpc); - if (*name) /* is a local? */ - return "local"; - /* else try symbolic execution */ - pc = findsetreg(p, lastpc, reg); - if (pc != -1) { /* could find instruction? */ - Instruction i = p->code[pc]; - OpCode op = GET_OPCODE(i); - switch (op) { - case OP_MOVE: { - int b = GETARG_B(i); /* move from 'b' to 'a' */ - if (b < GETARG_A(i)) - return getobjname(p, pc, b, name); /* get name for 'b' */ - break; - } - case OP_GETTABUP: - case OP_GETTABLE: { - int k = GETARG_C(i); /* key index */ - int t = GETARG_B(i); /* table index */ - const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ - ? luaF_getlocalname(p, t + 1, pc) - : upvalname(p, t); - kname(p, pc, k, name); - return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; - } - case OP_GETUPVAL: { - *name = upvalname(p, GETARG_B(i)); - return "upvalue"; - } - case OP_LOADK: - case OP_LOADKX: { - int b = (op == OP_LOADK) ? GETARG_Bx(i) - : GETARG_Ax(p->code[pc + 1]); - if (ttisstring(&p->k[b])) { - *name = svalue(&p->k[b]); - return "constant"; - } - break; - } - case OP_SELF: { - int k = GETARG_C(i); /* key index */ - kname(p, pc, k, name); - return "method"; - } - default: break; /* go through to return NULL */ - } - } - return NULL; /* could not find reasonable name */ -} - - -/* -** Try to find a name for a function based on the code that called it. -** (Only works when function was called by a Lua function.) -** Returns what the name is (e.g., "for iterator", "method", -** "metamethod") and sets '*name' to point to the name. -*/ -static const char *funcnamefromcode (lua_State *L, CallInfo *ci, - const char **name) { - TMS tm = (TMS)0; /* (initial value avoids warnings) */ - Proto *p = ci_func(ci)->p; /* calling function */ - int pc = currentpc(ci); /* calling instruction index */ - Instruction i = p->code[pc]; /* calling instruction */ - if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ - *name = "?"; - return "hook"; - } - switch (GET_OPCODE(i)) { - case OP_CALL: - case OP_TAILCALL: - return getobjname(p, pc, GETARG_A(i), name); /* get function name */ - case OP_TFORCALL: { /* for iterator */ - *name = "for iterator"; - return "for iterator"; - } - /* other instructions can do calls through metamethods */ - case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: - tm = TM_INDEX; - break; - case OP_SETTABUP: case OP_SETTABLE: - tm = TM_NEWINDEX; - break; - case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: - case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: - case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { - int offset = cast_int(GET_OPCODE(i)) - cast_int(OP_ADD); /* ORDER OP */ - tm = cast(TMS, offset + cast_int(TM_ADD)); /* ORDER TM */ - break; - } - case OP_UNM: tm = TM_UNM; break; - case OP_BNOT: tm = TM_BNOT; break; - case OP_LEN: tm = TM_LEN; break; - case OP_CONCAT: tm = TM_CONCAT; break; - case OP_EQ: tm = TM_EQ; break; - case OP_LT: tm = TM_LT; break; - case OP_LE: tm = TM_LE; break; - default: - return NULL; /* cannot find a reasonable name */ - } - *name = getstr(G(L)->tmname[tm]); - return "metamethod"; -} - -/* }====================================================== */ - - - -/* -** The subtraction of two potentially unrelated pointers is -** not ISO C, but it should not crash a program; the subsequent -** checks are ISO C and ensure a correct result. -*/ -static int isinstack (CallInfo *ci, const TValue *o) { - ptrdiff_t i = o - ci->u.l.base; - return (0 <= i && i < (ci->top - ci->u.l.base) && ci->u.l.base + i == o); -} - - -/* -** Checks whether value 'o' came from an upvalue. (That can only happen -** with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on -** upvalues.) -*/ -static const char *getupvalname (CallInfo *ci, const TValue *o, - const char **name) { - LClosure *c = ci_func(ci); - int i; - for (i = 0; i < c->nupvalues; i++) { - if (c->upvals[i]->v == o) { - *name = upvalname(c->p, i); - return "upvalue"; - } - } - return NULL; -} - - -static const char *varinfo (lua_State *L, const TValue *o) { - const char *name = NULL; /* to avoid warnings */ - CallInfo *ci = L->ci; - const char *kind = NULL; - if (isLua(ci)) { - kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ - if (!kind && isinstack(ci, o)) /* no? try a register */ - kind = getobjname(ci_func(ci)->p, currentpc(ci), - cast_int(o - ci->u.l.base), &name); - } - return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; -} - - -l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { - const char *t = luaT_objtypename(L, o); - luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o)); -} - - -l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { - if (ttisstring(p1) || cvt2str(p1)) p1 = p2; - luaG_typeerror(L, p1, "concatenate"); -} - - -l_noret luaG_opinterror (lua_State *L, const TValue *p1, - const TValue *p2, const char *msg) { - lua_Number temp; - if (!tonumber(p1, &temp)) /* first operand is wrong? */ - p2 = p1; /* now second is wrong */ - luaG_typeerror(L, p2, msg); -} - - -/* -** Error when both values are convertible to numbers, but not to integers -*/ -l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2) { - lua_Integer temp; - if (!tointeger(p1, &temp)) - p2 = p1; - luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2)); -} - - -l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { - const char *t1 = luaT_objtypename(L, p1); - const char *t2 = luaT_objtypename(L, p2); - if (strcmp(t1, t2) == 0) - luaG_runerror(L, "attempt to compare two %s values", t1); - else - luaG_runerror(L, "attempt to compare %s with %s", t1, t2); -} - - -/* add src:line information to 'msg' */ -const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, - int line) { - char buff[LUA_IDSIZE]; - if (src) - luaO_chunkid(buff, getstr(src), LUA_IDSIZE); - else { /* no source available; use "?" instead */ - buff[0] = '?'; buff[1] = '\0'; - } - return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); -} - - -l_noret luaG_errormsg (lua_State *L) { - if (L->errfunc != 0) { /* is there an error handling function? */ - StkId errfunc = restorestack(L, L->errfunc); - setobjs2s(L, L->top, L->top - 1); /* move argument */ - setobjs2s(L, L->top - 1, errfunc); /* push function */ - L->top++; /* assume EXTRC_STACK */ - luaD_callnoyield(L, L->top - 2, 1); /* call it */ - } - luaD_throw(L, LUA_ERRRUN); -} - - -l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { - CallInfo *ci = L->ci; - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(L, fmt, argp); /* format message */ - va_end(argp); - if (isLua(ci)) /* if Lua function, add source:line information */ - luaG_addinfo(L, msg, ci_func(ci)->p->source, currentline(ci)); - luaG_errormsg(L); -} - - -void luaG_traceexec (lua_State *L) { - CallInfo *ci = L->ci; - lu_byte mask = L->hookmask; - int counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT)); - if (counthook) - resethookcount(L); /* reset count */ - else if (!(mask & LUA_MASKLINE)) - return; /* no line hook and count != 0; nothing to be done */ - if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */ - ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */ - return; /* do not call hook again (VM yielded, so it did not move) */ - } - if (counthook) - luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ - if (mask & LUA_MASKLINE) { - Proto *p = ci_func(ci)->p; - int npc = pcRel(ci->u.l.savedpc, p); - int newline = getfuncline(p, npc); - if (npc == 0 || /* call linehook when enter a new function, */ - ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ - newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ - luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ - } - L->oldpc = ci->u.l.savedpc; - if (L->status == LUA_YIELD) { /* did hook yield? */ - if (counthook) - L->hookcount = 1; /* undo decrement to zero */ - ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ - ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ - ci->func = L->top - 1; /* protect stack below results */ - luaD_throw(L, LUA_YIELD); - } -} - diff --git a/deps/rcheevos/test/lua/src/ldebug.h b/deps/rcheevos/test/lua/src/ldebug.h deleted file mode 100644 index 0e31546b1b..0000000000 --- a/deps/rcheevos/test/lua/src/ldebug.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp $ -** Auxiliary functions from Debug Interface module -** See Copyright Notice in lua.h -*/ - -#ifndef ldebug_h -#define ldebug_h - - -#include "lstate.h" - - -#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) - -#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) - -#define resethookcount(L) (L->hookcount = L->basehookcount) - - -LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, - const char *opname); -LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, - const TValue *p2, - const char *msg); -LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); -LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, - TString *src, int line); -LUAI_FUNC l_noret luaG_errormsg (lua_State *L); -LUAI_FUNC void luaG_traceexec (lua_State *L); - - -#endif diff --git a/deps/rcheevos/test/lua/src/ldo.c b/deps/rcheevos/test/lua/src/ldo.c deleted file mode 100644 index 0a0132ce90..0000000000 --- a/deps/rcheevos/test/lua/src/ldo.c +++ /dev/null @@ -1,802 +0,0 @@ -/* -** $Id: ldo.c,v 2.157 2016/12/13 15:52:21 roberto Exp $ -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - -#define ldo_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" -#include "lzio.h" - - - -#define errorstatus(s) ((s) > LUA_YIELD) - - -/* -** {====================================================== -** Error-recovery functions -** ======================================================= -*/ - -/* -** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By -** default, Lua handles errors with exceptions when compiling as -** C++ code, with _longjmp/_setjmp when asked to use them, and with -** longjmp/setjmp otherwise. -*/ -#if !defined(LUAI_THROW) /* { */ - -#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */ - -/* C++ exceptions */ -#define LUAI_THROW(L,c) throw(c) -#define LUAI_TRY(L,c,a) \ - try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } -#define luai_jmpbuf int /* dummy variable */ - -#elif defined(LUA_USE_POSIX) /* }{ */ - -/* in POSIX, try _longjmp/_setjmp (more efficient) */ -#define LUAI_THROW(L,c) _longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#else /* }{ */ - -/* ISO C handling with long jumps */ -#define LUAI_THROW(L,c) longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#endif /* } */ - -#endif /* } */ - - - -/* chain list of long jump buffers */ -struct lua_longjmp { - struct lua_longjmp *previous; - luai_jmpbuf b; - volatile int status; /* error code */ -}; - - -static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { - switch (errcode) { - case LUA_ERRMEM: { /* memory error? */ - setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ - break; - } - case LUA_ERRERR: { - setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); - break; - } - default: { - setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ - break; - } - } - L->top = oldtop + 1; -} - - -l_noret luaD_throw (lua_State *L, int errcode) { - if (L->errorJmp) { /* thread has an error handler? */ - L->errorJmp->status = errcode; /* set status */ - LUAI_THROW(L, L->errorJmp); /* jump to it */ - } - else { /* thread has no error handler */ - global_State *g = G(L); - L->status = cast_byte(errcode); /* mark it as dead */ - if (g->mainthread->errorJmp) { /* main thread has a handler? */ - setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ - luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ - } - else { /* no handler at all; abort */ - if (g->panic) { /* panic function? */ - seterrorobj(L, errcode, L->top); /* assume EXTRC_STACK */ - if (L->ci->top < L->top) - L->ci->top = L->top; /* pushing msg. can break this invariant */ - lua_unlock(L); - g->panic(L); /* call panic function (last chance to jump out) */ - } - abort(); - } - } -} - - -int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { - unsigned short oldnCcalls = L->nCcalls; - struct lua_longjmp lj; - lj.status = LUA_OK; - lj.previous = L->errorJmp; /* chain new error handler */ - L->errorJmp = &lj; - LUAI_TRY(L, &lj, - (*f)(L, ud); - ); - L->errorJmp = lj.previous; /* restore old error handler */ - L->nCcalls = oldnCcalls; - return lj.status; -} - -/* }====================================================== */ - - -/* -** {================================================================== -** Stack reallocation -** =================================================================== -*/ -static void correctstack (lua_State *L, TValue *oldstack) { - CallInfo *ci; - UpVal *up; - L->top = (L->top - oldstack) + L->stack; - for (up = L->openupval; up != NULL; up = up->u.open.next) - up->v = (up->v - oldstack) + L->stack; - for (ci = L->ci; ci != NULL; ci = ci->previous) { - ci->top = (ci->top - oldstack) + L->stack; - ci->func = (ci->func - oldstack) + L->stack; - if (isLua(ci)) - ci->u.l.base = (ci->u.l.base - oldstack) + L->stack; - } -} - - -/* some space for error handling */ -#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) - - -void luaD_reallocstack (lua_State *L, int newsize) { - TValue *oldstack = L->stack; - int lim = L->stacksize; - lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); - lua_assert(L->stack_last - L->stack == L->stacksize - EXTRC_STACK); - luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue); - for (; lim < newsize; lim++) - setnilvalue(L->stack + lim); /* erase new segment */ - L->stacksize = newsize; - L->stack_last = L->stack + newsize - EXTRC_STACK; - correctstack(L, oldstack); -} - - -void luaD_growstack (lua_State *L, int n) { - int size = L->stacksize; - if (size > LUAI_MAXSTACK) /* error after extra size? */ - luaD_throw(L, LUA_ERRERR); - else { - int needed = cast_int(L->top - L->stack) + n + EXTRC_STACK; - int newsize = 2 * size; - if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; - if (newsize < needed) newsize = needed; - if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ - luaD_reallocstack(L, ERRORSTACKSIZE); - luaG_runerror(L, "stack overflow"); - } - else - luaD_reallocstack(L, newsize); - } -} - - -static int stackinuse (lua_State *L) { - CallInfo *ci; - StkId lim = L->top; - for (ci = L->ci; ci != NULL; ci = ci->previous) { - if (lim < ci->top) lim = ci->top; - } - lua_assert(lim <= L->stack_last); - return cast_int(lim - L->stack) + 1; /* part of stack in use */ -} - - -void luaD_shrinkstack (lua_State *L) { - int inuse = stackinuse(L); - int goodsize = inuse + (inuse / 8) + 2*EXTRC_STACK; - if (goodsize > LUAI_MAXSTACK) - goodsize = LUAI_MAXSTACK; /* respect stack limit */ - if (L->stacksize > LUAI_MAXSTACK) /* had been handling stack overflow? */ - luaE_freeCI(L); /* free all CIs (list grew because of an error) */ - else - luaE_shrinkCI(L); /* shrink list */ - /* if thread is currently not handling a stack overflow and its - good size is smaller than current size, shrink its stack */ - if (inuse <= (LUAI_MAXSTACK - EXTRC_STACK) && - goodsize < L->stacksize) - luaD_reallocstack(L, goodsize); - else /* don't change stack */ - condmovestack(L,{},{}); /* (change only for debugging) */ -} - - -void luaD_inctop (lua_State *L) { - luaD_checkstack(L, 1); - L->top++; -} - -/* }================================================================== */ - - -/* -** Call a hook for the given event. Make sure there is a hook to be -** called. (Both 'L->hook' and 'L->hookmask', which triggers this -** function, can be changed asynchronously by signals.) -*/ -void luaD_hook (lua_State *L, int event, int line) { - lua_Hook hook = L->hook; - if (hook && L->allowhook) { /* make sure there is a hook */ - CallInfo *ci = L->ci; - ptrdiff_t top = savestack(L, L->top); - ptrdiff_t ci_top = savestack(L, ci->top); - lua_Debug ar; - ar.event = event; - ar.currentline = line; - ar.i_ci = ci; - luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ - ci->top = L->top + LUA_MINSTACK; - lua_assert(ci->top <= L->stack_last); - L->allowhook = 0; /* cannot call hooks inside a hook */ - ci->callstatus |= CIST_HOOKED; - lua_unlock(L); - (*hook)(L, &ar); - lua_lock(L); - lua_assert(!L->allowhook); - L->allowhook = 1; - ci->top = restorestack(L, ci_top); - L->top = restorestack(L, top); - ci->callstatus &= ~CIST_HOOKED; - } -} - - -static void callhook (lua_State *L, CallInfo *ci) { - int hook = LUA_HOOKCALL; - ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ - if (isLua(ci->previous) && - GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) { - ci->callstatus |= CIST_TAIL; - hook = LUA_HOOKTAILCALL; - } - luaD_hook(L, hook, -1); - ci->u.l.savedpc--; /* correct 'pc' */ -} - - -static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { - int i; - int nfixargs = p->numparams; - StkId base, fixed; - /* move fixed parameters to final position */ - fixed = L->top - actual; /* first fixed argument */ - base = L->top; /* final position of first argument */ - for (i = 0; i < nfixargs && i < actual; i++) { - setobjs2s(L, L->top++, fixed + i); - setnilvalue(fixed + i); /* erase original copy (for GC) */ - } - for (; i < nfixargs; i++) - setnilvalue(L->top++); /* complete missing arguments */ - return base; -} - - -/* -** Check whether __call metafield of 'func' is a function. If so, put -** it in stack below original 'func' so that 'luaD_precall' can call -** it. Raise an error if __call metafield is not a function. -*/ -static void tryfuncTM (lua_State *L, StkId func) { - const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); - StkId p; - if (!ttisfunction(tm)) - luaG_typeerror(L, func, "call"); - /* Open a hole inside the stack at 'func' */ - for (p = L->top; p > func; p--) - setobjs2s(L, p, p-1); - L->top++; /* slot ensured by caller */ - setobj2s(L, func, tm); /* tag method is the new function to be called */ -} - - -/* -** Given 'nres' results at 'firstResult', move 'wanted' of them to 'res'. -** Handle most typical cases (zero results for commands, one result for -** expressions, multiple results for tail calls/single parameters) -** separated. -*/ -static int moveresults (lua_State *L, const TValue *firstResult, StkId res, - int nres, int wanted) { - switch (wanted) { /* handle typical cases separately */ - case 0: break; /* nothing to move */ - case 1: { /* one result needed */ - if (nres == 0) /* no results? */ - firstResult = luaO_nilobject; /* adjust with nil */ - setobjs2s(L, res, firstResult); /* move it to proper place */ - break; - } - case LUA_MULTRET: { - int i; - for (i = 0; i < nres; i++) /* move all results to correct place */ - setobjs2s(L, res + i, firstResult + i); - L->top = res + nres; - return 0; /* wanted == LUA_MULTRET */ - } - default: { - int i; - if (wanted <= nres) { /* enough results? */ - for (i = 0; i < wanted; i++) /* move wanted results to correct place */ - setobjs2s(L, res + i, firstResult + i); - } - else { /* not enough results; use all of them plus nils */ - for (i = 0; i < nres; i++) /* move all results to correct place */ - setobjs2s(L, res + i, firstResult + i); - for (; i < wanted; i++) /* complete wanted number of results */ - setnilvalue(res + i); - } - break; - } - } - L->top = res + wanted; /* top points after the last result */ - return 1; -} - - -/* -** Finishes a function call: calls hook if necessary, removes CallInfo, -** moves current number of results to proper place; returns 0 iff call -** wanted multiple (variable number of) results. -*/ -int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) { - StkId res; - int wanted = ci->nresults; - if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { - if (L->hookmask & LUA_MASKRET) { - ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ - luaD_hook(L, LUA_HOOKRET, -1); - firstResult = restorestack(L, fr); - } - L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ - } - res = ci->func; /* res == final position of 1st result */ - L->ci = ci->previous; /* back to caller */ - /* move results to proper place */ - return moveresults(L, firstResult, res, nres, wanted); -} - - - -#define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L))) - - -/* macro to check stack size, preserving 'p' */ -#define checkstackp(L,n,p) \ - luaD_checkstackaux(L, n, \ - ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ - luaC_checkGC(L), /* stack grow uses memory */ \ - p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ - - -/* -** Prepares a function call: checks the stack, creates a new CallInfo -** entry, fills in the relevant information, calls hook if needed. -** If function is a C function, does the call, too. (Otherwise, leave -** the execution ('luaV_execute') to the caller, to allow stackless -** calls.) Returns true iff function has been executed (C function). -*/ -int luaD_precall (lua_State *L, StkId func, int nresults) { - lua_CFunction f; - CallInfo *ci; - switch (ttype(func)) { - case LUA_TCCL: /* C closure */ - f = clCvalue(func)->f; - goto Cfunc; - case LUA_TLCF: /* light C function */ - f = fvalue(func); - Cfunc: { - int n; /* number of returns */ - checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ - ci = next_ci(L); /* now 'enter' new function */ - ci->nresults = nresults; - ci->func = func; - ci->top = L->top + LUA_MINSTACK; - lua_assert(ci->top <= L->stack_last); - ci->callstatus = 0; - if (L->hookmask & LUA_MASKCALL) - luaD_hook(L, LUA_HOOKCALL, -1); - lua_unlock(L); - n = (*f)(L); /* do the actual call */ - lua_lock(L); - api_checknelems(L, n); - luaD_poscall(L, ci, L->top - n, n); - return 1; - } - case LUA_TLCL: { /* Lua function: prepare its call */ - StkId base; - Proto *p = clLvalue(func)->p; - int n = cast_int(L->top - func) - 1; /* number of real arguments */ - int fsize = p->maxstacksize; /* frame size */ - checkstackp(L, fsize, func); - if (p->is_vararg) - base = adjust_varargs(L, p, n); - else { /* non vararg function */ - for (; n < p->numparams; n++) - setnilvalue(L->top++); /* complete missing arguments */ - base = func + 1; - } - ci = next_ci(L); /* now 'enter' new function */ - ci->nresults = nresults; - ci->func = func; - ci->u.l.base = base; - L->top = ci->top = base + fsize; - lua_assert(ci->top <= L->stack_last); - ci->u.l.savedpc = p->code; /* starting point */ - ci->callstatus = CIST_LUA; - if (L->hookmask & LUA_MASKCALL) - callhook(L, ci); - return 0; - } - default: { /* not a function */ - checkstackp(L, 1, func); /* ensure space for metamethod */ - tryfuncTM(L, func); /* try to get '__call' metamethod */ - return luaD_precall(L, func, nresults); /* now it must be a function */ - } - } -} - - -/* -** Check appropriate error for stack overflow ("regular" overflow or -** overflow while handling stack overflow). If 'nCalls' is larger than -** LUAI_MAXCCALLS (which means it is handling a "regular" overflow) but -** smaller than 9/8 of LUAI_MAXCCALLS, does not report an error (to -** allow overflow handling to work) -*/ -static void stackerror (lua_State *L) { - if (L->nCcalls == LUAI_MAXCCALLS) - luaG_runerror(L, "C stack overflow"); - else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) - luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ -} - - -/* -** Call a function (C or Lua). The function to be called is at *func. -** The arguments are on the stack, right after the function. -** When returns, all the results are on the stack, starting at the original -** function position. -*/ -void luaD_call (lua_State *L, StkId func, int nResults) { - if (++L->nCcalls >= LUAI_MAXCCALLS) - stackerror(L); - if (!luaD_precall(L, func, nResults)) /* is a Lua function? */ - luaV_execute(L); /* call it */ - L->nCcalls--; -} - - -/* -** Similar to 'luaD_call', but does not allow yields during the call -*/ -void luaD_callnoyield (lua_State *L, StkId func, int nResults) { - L->nny++; - luaD_call(L, func, nResults); - L->nny--; -} - - -/* -** Completes the execution of an interrupted C function, calling its -** continuation function. -*/ -static void finishCcall (lua_State *L, int status) { - CallInfo *ci = L->ci; - int n; - /* must have a continuation and must be able to call it */ - lua_assert(ci->u.c.k != NULL && L->nny == 0); - /* error status can only happen in a protected call */ - lua_assert((ci->callstatus & CIST_YPCALL) || status == LUA_YIELD); - if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */ - ci->callstatus &= ~CIST_YPCALL; /* continuation is also inside it */ - L->errfunc = ci->u.c.old_errfunc; /* with the same error function */ - } - /* finish 'lua_callk'/'lua_pcall'; CIST_YPCALL and 'errfunc' already - handled */ - adjustresults(L, ci->nresults); - lua_unlock(L); - n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation function */ - lua_lock(L); - api_checknelems(L, n); - luaD_poscall(L, ci, L->top - n, n); /* finish 'luaD_precall' */ -} - - -/* -** Executes "full continuation" (everything in the stack) of a -** previously interrupted coroutine until the stack is empty (or another -** interruption long-jumps out of the loop). If the coroutine is -** recovering from an error, 'ud' points to the error status, which must -** be passed to the first continuation function (otherwise the default -** status is LUA_YIELD). -*/ -static void unroll (lua_State *L, void *ud) { - if (ud != NULL) /* error status? */ - finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */ - while (L->ci != &L->base_ci) { /* something in the stack */ - if (!isLua(L->ci)) /* C function? */ - finishCcall(L, LUA_YIELD); /* complete its execution */ - else { /* Lua function */ - luaV_finishOp(L); /* finish interrupted instruction */ - luaV_execute(L); /* execute down to higher C 'boundary' */ - } - } -} - - -/* -** Try to find a suspended protected call (a "recover point") for the -** given thread. -*/ -static CallInfo *findpcall (lua_State *L) { - CallInfo *ci; - for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ - if (ci->callstatus & CIST_YPCALL) - return ci; - } - return NULL; /* no pending pcall */ -} - - -/* -** Recovers from an error in a coroutine. Finds a recover point (if -** there is one) and completes the execution of the interrupted -** 'luaD_pcall'. If there is no recover point, returns zero. -*/ -static int recover (lua_State *L, int status) { - StkId oldtop; - CallInfo *ci = findpcall(L); - if (ci == NULL) return 0; /* no recovery point */ - /* "finish" luaD_pcall */ - oldtop = restorestack(L, ci->extra); - luaF_close(L, oldtop); - seterrorobj(L, status, oldtop); - L->ci = ci; - L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */ - L->nny = 0; /* should be zero to be yieldable */ - luaD_shrinkstack(L); - L->errfunc = ci->u.c.old_errfunc; - return 1; /* continue running the coroutine */ -} - - -/* -** Signal an error in the call to 'lua_resume', not in the execution -** of the coroutine itself. (Such errors should not be handled by any -** coroutine error handler and should not kill the coroutine.) -*/ -static int resume_error (lua_State *L, const char *msg, int narg) { - L->top -= narg; /* remove args from the stack */ - setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ - api_incr_top(L); - lua_unlock(L); - return LUA_ERRRUN; -} - - -/* -** Do the work for 'lua_resume' in protected mode. Most of the work -** depends on the status of the coroutine: initial state, suspended -** inside a hook, or regularly suspended (optionally with a continuation -** function), plus erroneous cases: non-suspended coroutine or dead -** coroutine. -*/ -static void resume (lua_State *L, void *ud) { - int n = *(cast(int*, ud)); /* number of arguments */ - StkId firstArg = L->top - n; /* first argument */ - CallInfo *ci = L->ci; - if (L->status == LUA_OK) { /* starting a coroutine? */ - if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) /* Lua function? */ - luaV_execute(L); /* call it */ - } - else { /* resuming from previous yield */ - lua_assert(L->status == LUA_YIELD); - L->status = LUA_OK; /* mark that it is running (again) */ - ci->func = restorestack(L, ci->extra); - if (isLua(ci)) /* yielded inside a hook? */ - luaV_execute(L); /* just continue running Lua code */ - else { /* 'common' yield */ - if (ci->u.c.k != NULL) { /* does it have a continuation function? */ - lua_unlock(L); - n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */ - lua_lock(L); - api_checknelems(L, n); - firstArg = L->top - n; /* yield results come from continuation */ - } - luaD_poscall(L, ci, firstArg, n); /* finish 'luaD_precall' */ - } - unroll(L, NULL); /* run continuation */ - } -} - - -LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { - int status; - unsigned short oldnny = L->nny; /* save "number of non-yieldable" calls */ - lua_lock(L); - if (L->status == LUA_OK) { /* may be starting a coroutine */ - if (L->ci != &L->base_ci) /* not in base level? */ - return resume_error(L, "cannot resume non-suspended coroutine", nargs); - } - else if (L->status != LUA_YIELD) - return resume_error(L, "cannot resume dead coroutine", nargs); - L->nCcalls = (from) ? from->nCcalls + 1 : 1; - if (L->nCcalls >= LUAI_MAXCCALLS) - return resume_error(L, "C stack overflow", nargs); - luai_userstateresume(L, nargs); - L->nny = 0; /* allow yields */ - api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); - status = luaD_rawrunprotected(L, resume, &nargs); - if (status == -1) /* error calling 'lua_resume'? */ - status = LUA_ERRRUN; - else { /* continue running after recoverable errors */ - while (errorstatus(status) && recover(L, status)) { - /* unroll continuation */ - status = luaD_rawrunprotected(L, unroll, &status); - } - if (errorstatus(status)) { /* unrecoverable error? */ - L->status = cast_byte(status); /* mark thread as 'dead' */ - seterrorobj(L, status, L->top); /* push error message */ - L->ci->top = L->top; - } - else lua_assert(status == L->status); /* normal end or yield */ - } - L->nny = oldnny; /* restore 'nny' */ - L->nCcalls--; - lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); - lua_unlock(L); - return status; -} - - -LUA_API int lua_isyieldable (lua_State *L) { - return (L->nny == 0); -} - - -LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, - lua_KFunction k) { - CallInfo *ci = L->ci; - luai_userstateyield(L, nresults); - lua_lock(L); - api_checknelems(L, nresults); - if (L->nny > 0) { - if (L != G(L)->mainthread) - luaG_runerror(L, "attempt to yield across a C-call boundary"); - else - luaG_runerror(L, "attempt to yield from outside a coroutine"); - } - L->status = LUA_YIELD; - ci->extra = savestack(L, ci->func); /* save current 'func' */ - if (isLua(ci)) { /* inside a hook? */ - api_check(L, k == NULL, "hooks cannot continue after yielding"); - } - else { - if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ - ci->u.c.ctx = ctx; /* save context */ - ci->func = L->top - nresults - 1; /* protect stack below results */ - luaD_throw(L, LUA_YIELD); - } - lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ - lua_unlock(L); - return 0; /* return to 'luaD_hook' */ -} - - -int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t old_top, ptrdiff_t ef) { - int status; - CallInfo *old_ci = L->ci; - lu_byte old_allowhooks = L->allowhook; - unsigned short old_nny = L->nny; - ptrdiff_t old_errfunc = L->errfunc; - L->errfunc = ef; - status = luaD_rawrunprotected(L, func, u); - if (status != LUA_OK) { /* an error occurred? */ - StkId oldtop = restorestack(L, old_top); - luaF_close(L, oldtop); /* close possible pending closures */ - seterrorobj(L, status, oldtop); - L->ci = old_ci; - L->allowhook = old_allowhooks; - L->nny = old_nny; - luaD_shrinkstack(L); - } - L->errfunc = old_errfunc; - return status; -} - - - -/* -** Execute a protected parser. -*/ -struct SParser { /* data to 'f_parser' */ - ZIO *z; - Mbuffer buff; /* dynamic structure used by the scanner */ - Dyndata dyd; /* dynamic structures used by the parser */ - const char *mode; - const char *name; -}; - - -static void checkmode (lua_State *L, const char *mode, const char *x) { - if (mode && strchr(mode, x[0]) == NULL) { - luaO_pushfstring(L, - "attempt to load a %s chunk (mode is '%s')", x, mode); - luaD_throw(L, LUA_ERRSYNTAX); - } -} - - -static void f_parser (lua_State *L, void *ud) { - LClosure *cl; - struct SParser *p = cast(struct SParser *, ud); - int c = zgetc(p->z); /* read first character */ - if (c == LUA_SIGNATURE[0]) { - checkmode(L, p->mode, "binary"); - cl = luaU_undump(L, p->z, p->name); - } - else { - checkmode(L, p->mode, "text"); - cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); - } - lua_assert(cl->nupvalues == cl->p->sizeupvalues); - luaF_initupvals(L, cl); -} - - -int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, - const char *mode) { - struct SParser p; - int status; - L->nny++; /* cannot yield during parsing */ - p.z = z; p.name = name; p.mode = mode; - p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0; - p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; - p.dyd.label.arr = NULL; p.dyd.label.size = 0; - luaZ_initbuffer(L, &p.buff); - status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); - luaZ_freebuffer(L, &p.buff); - luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); - luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); - luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size); - L->nny--; - return status; -} - - diff --git a/deps/rcheevos/test/lua/src/ldo.h b/deps/rcheevos/test/lua/src/ldo.h deleted file mode 100644 index 4f5d51c3c7..0000000000 --- a/deps/rcheevos/test/lua/src/ldo.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -** $Id: ldo.h,v 2.29 2015/12/21 13:02:14 roberto Exp $ -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - -#ifndef ldo_h -#define ldo_h - - -#include "lobject.h" -#include "lstate.h" -#include "lzio.h" - - -/* -** Macro to check stack size and grow stack if needed. Parameters -** 'pre'/'pos' allow the macro to preserve a pointer into the -** stack across reallocations, doing the work only when needed. -** 'condmovestack' is used in heavy tests to force a stack reallocation -** at every check. -*/ -#define luaD_checkstackaux(L,n,pre,pos) \ - if (L->stack_last - L->top <= (n)) \ - { pre; luaD_growstack(L, n); pos; } else { condmovestack(L,pre,pos); } - -/* In general, 'pre'/'pos' are empty (nothing to save) */ -#define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) - - - -#define savestack(L,p) ((char *)(p) - (char *)L->stack) -#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) - - -/* type of protected functions, to be ran by 'runprotected' */ -typedef void (*Pfunc) (lua_State *L, void *ud); - -LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, - const char *mode); -LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); -LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); -LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); -LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); -LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t oldtop, ptrdiff_t ef); -LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, - int nres); -LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); -LUAI_FUNC void luaD_growstack (lua_State *L, int n); -LUAI_FUNC void luaD_shrinkstack (lua_State *L); -LUAI_FUNC void luaD_inctop (lua_State *L); - -LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); -LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); - -#endif - diff --git a/deps/rcheevos/test/lua/src/ldump.c b/deps/rcheevos/test/lua/src/ldump.c deleted file mode 100644 index 016e300822..0000000000 --- a/deps/rcheevos/test/lua/src/ldump.c +++ /dev/null @@ -1,215 +0,0 @@ -/* -** $Id: ldump.c,v 2.37 2015/10/08 15:53:49 roberto Exp $ -** save precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#define ldump_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lobject.h" -#include "lstate.h" -#include "lundump.h" - - -typedef struct { - lua_State *L; - lua_Writer writer; - void *data; - int strip; - int status; -} DumpState; - - -/* -** All high-level dumps go through DumpVector; you can change it to -** change the endianness of the result -*/ -#define DumpVector(v,n,D) DumpBlock(v,(n)*sizeof((v)[0]),D) - -#define DumpLiteral(s,D) DumpBlock(s, sizeof(s) - sizeof(char), D) - - -static void DumpBlock (const void *b, size_t size, DumpState *D) { - if (D->status == 0 && size > 0) { - lua_unlock(D->L); - D->status = (*D->writer)(D->L, b, size, D->data); - lua_lock(D->L); - } -} - - -#define DumpVar(x,D) DumpVector(&x,1,D) - - -static void DumpByte (int y, DumpState *D) { - lu_byte x = (lu_byte)y; - DumpVar(x, D); -} - - -static void DumpInt (int x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpNumber (lua_Number x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpInteger (lua_Integer x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpString (const TString *s, DumpState *D) { - if (s == NULL) - DumpByte(0, D); - else { - size_t size = tsslen(s) + 1; /* include trailing '\0' */ - const char *str = getstr(s); - if (size < 0xFF) - DumpByte(cast_int(size), D); - else { - DumpByte(0xFF, D); - DumpVar(size, D); - } - DumpVector(str, size - 1, D); /* no need to save '\0' */ - } -} - - -static void DumpCode (const Proto *f, DumpState *D) { - DumpInt(f->sizecode, D); - DumpVector(f->code, f->sizecode, D); -} - - -static void DumpFunction(const Proto *f, TString *psource, DumpState *D); - -static void DumpConstants (const Proto *f, DumpState *D) { - int i; - int n = f->sizek; - DumpInt(n, D); - for (i = 0; i < n; i++) { - const TValue *o = &f->k[i]; - DumpByte(ttype(o), D); - switch (ttype(o)) { - case LUA_TNIL: - break; - case LUA_TBOOLEAN: - DumpByte(bvalue(o), D); - break; - case LUA_TNUMFLT: - DumpNumber(fltvalue(o), D); - break; - case LUA_TNUMINT: - DumpInteger(ivalue(o), D); - break; - case LUA_TSHRSTR: - case LUA_TLNGSTR: - DumpString(tsvalue(o), D); - break; - default: - lua_assert(0); - } - } -} - - -static void DumpProtos (const Proto *f, DumpState *D) { - int i; - int n = f->sizep; - DumpInt(n, D); - for (i = 0; i < n; i++) - DumpFunction(f->p[i], f->source, D); -} - - -static void DumpUpvalues (const Proto *f, DumpState *D) { - int i, n = f->sizeupvalues; - DumpInt(n, D); - for (i = 0; i < n; i++) { - DumpByte(f->upvalues[i].instack, D); - DumpByte(f->upvalues[i].idx, D); - } -} - - -static void DumpDebug (const Proto *f, DumpState *D) { - int i, n; - n = (D->strip) ? 0 : f->sizelineinfo; - DumpInt(n, D); - DumpVector(f->lineinfo, n, D); - n = (D->strip) ? 0 : f->sizelocvars; - DumpInt(n, D); - for (i = 0; i < n; i++) { - DumpString(f->locvars[i].varname, D); - DumpInt(f->locvars[i].startpc, D); - DumpInt(f->locvars[i].endpc, D); - } - n = (D->strip) ? 0 : f->sizeupvalues; - DumpInt(n, D); - for (i = 0; i < n; i++) - DumpString(f->upvalues[i].name, D); -} - - -static void DumpFunction (const Proto *f, TString *psource, DumpState *D) { - if (D->strip || f->source == psource) - DumpString(NULL, D); /* no debug info or same source as its parent */ - else - DumpString(f->source, D); - DumpInt(f->linedefined, D); - DumpInt(f->lastlinedefined, D); - DumpByte(f->numparams, D); - DumpByte(f->is_vararg, D); - DumpByte(f->maxstacksize, D); - DumpCode(f, D); - DumpConstants(f, D); - DumpUpvalues(f, D); - DumpProtos(f, D); - DumpDebug(f, D); -} - - -static void DumpHeader (DumpState *D) { - DumpLiteral(LUA_SIGNATURE, D); - DumpByte(LUAC_VERSION, D); - DumpByte(LUAC_FORMAT, D); - DumpLiteral(LUAC_DATA, D); - DumpByte(sizeof(int), D); - DumpByte(sizeof(size_t), D); - DumpByte(sizeof(Instruction), D); - DumpByte(sizeof(lua_Integer), D); - DumpByte(sizeof(lua_Number), D); - DumpInteger(LUAC_INT, D); - DumpNumber(LUAC_NUM, D); -} - - -/* -** dump Lua function as precompiled chunk -*/ -int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, - int strip) { - DumpState D; - D.L = L; - D.writer = w; - D.data = data; - D.strip = strip; - D.status = 0; - DumpHeader(&D); - DumpByte(f->sizeupvalues, &D); - DumpFunction(f, NULL, &D); - return D.status; -} - diff --git a/deps/rcheevos/test/lua/src/lfunc.c b/deps/rcheevos/test/lua/src/lfunc.c deleted file mode 100644 index 67967dab3f..0000000000 --- a/deps/rcheevos/test/lua/src/lfunc.c +++ /dev/null @@ -1,151 +0,0 @@ -/* -** $Id: lfunc.c,v 2.45 2014/11/02 19:19:04 roberto Exp $ -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - -#define lfunc_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -CClosure *luaF_newCclosure (lua_State *L, int n) { - GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n)); - CClosure *c = gco2ccl(o); - c->nupvalues = cast_byte(n); - return c; -} - - -LClosure *luaF_newLclosure (lua_State *L, int n) { - GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n)); - LClosure *c = gco2lcl(o); - c->p = NULL; - c->nupvalues = cast_byte(n); - while (n--) c->upvals[n] = NULL; - return c; -} - -/* -** fill a closure with new closed upvalues -*/ -void luaF_initupvals (lua_State *L, LClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) { - UpVal *uv = luaM_new(L, UpVal); - uv->refcount = 1; - uv->v = &uv->u.value; /* make it closed */ - setnilvalue(uv->v); - cl->upvals[i] = uv; - } -} - - -UpVal *luaF_findupval (lua_State *L, StkId level) { - UpVal **pp = &L->openupval; - UpVal *p; - UpVal *uv; - lua_assert(isintwups(L) || L->openupval == NULL); - while (*pp != NULL && (p = *pp)->v >= level) { - lua_assert(upisopen(p)); - if (p->v == level) /* found a corresponding upvalue? */ - return p; /* return it */ - pp = &p->u.open.next; - } - /* not found: create a new upvalue */ - uv = luaM_new(L, UpVal); - uv->refcount = 0; - uv->u.open.next = *pp; /* link it to list of open upvalues */ - uv->u.open.touched = 1; - *pp = uv; - uv->v = level; /* current value lives in the stack */ - if (!isintwups(L)) { /* thread not in list of threads with upvalues? */ - L->twups = G(L)->twups; /* link it to the list */ - G(L)->twups = L; - } - return uv; -} - - -void luaF_close (lua_State *L, StkId level) { - UpVal *uv; - while (L->openupval != NULL && (uv = L->openupval)->v >= level) { - lua_assert(upisopen(uv)); - L->openupval = uv->u.open.next; /* remove from 'open' list */ - if (uv->refcount == 0) /* no references? */ - luaM_free(L, uv); /* free upvalue */ - else { - setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ - uv->v = &uv->u.value; /* now current value lives here */ - luaC_upvalbarrier(L, uv); - } - } -} - - -Proto *luaF_newproto (lua_State *L) { - GCObject *o = luaC_newobj(L, LUA_TPROTO, sizeof(Proto)); - Proto *f = gco2p(o); - f->k = NULL; - f->sizek = 0; - f->p = NULL; - f->sizep = 0; - f->code = NULL; - f->cache = NULL; - f->sizecode = 0; - f->lineinfo = NULL; - f->sizelineinfo = 0; - f->upvalues = NULL; - f->sizeupvalues = 0; - f->numparams = 0; - f->is_vararg = 0; - f->maxstacksize = 0; - f->locvars = NULL; - f->sizelocvars = 0; - f->linedefined = 0; - f->lastlinedefined = 0; - f->source = NULL; - return f; -} - - -void luaF_freeproto (lua_State *L, Proto *f) { - luaM_freearray(L, f->code, f->sizecode); - luaM_freearray(L, f->p, f->sizep); - luaM_freearray(L, f->k, f->sizek); - luaM_freearray(L, f->lineinfo, f->sizelineinfo); - luaM_freearray(L, f->locvars, f->sizelocvars); - luaM_freearray(L, f->upvalues, f->sizeupvalues); - luaM_free(L, f); -} - - -/* -** Look for n-th local variable at line 'line' in function 'func'. -** Returns NULL if not found. -*/ -const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { - int i; - for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { - if (pc < f->locvars[i].endpc) { /* is variable active? */ - local_number--; - if (local_number == 0) - return getstr(f->locvars[i].varname); - } - } - return NULL; /* not found */ -} - diff --git a/deps/rcheevos/test/lua/src/lfunc.h b/deps/rcheevos/test/lua/src/lfunc.h deleted file mode 100644 index 2eeb0d5a48..0000000000 --- a/deps/rcheevos/test/lua/src/lfunc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -** $Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp $ -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - -#ifndef lfunc_h -#define lfunc_h - - -#include "lobject.h" - - -#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ - cast(int, sizeof(TValue)*((n)-1))) - -#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ - cast(int, sizeof(TValue *)*((n)-1))) - - -/* test whether thread is in 'twups' list */ -#define isintwups(L) (L->twups != L) - - -/* -** maximum number of upvalues in a closure (both C and Lua). (Value -** must fit in a VM register.) -*/ -#define MAXUPVAL 255 - - -/* -** Upvalues for Lua closures -*/ -struct UpVal { - TValue *v; /* points to stack or to its own value */ - lu_mem refcount; /* reference counter */ - union { - struct { /* (when open) */ - UpVal *next; /* linked list */ - int touched; /* mark to avoid cycles with dead threads */ - } open; - TValue value; /* the value (when closed) */ - } u; -}; - -#define upisopen(up) ((up)->v != &(up)->u.value) - - -LUAI_FUNC Proto *luaF_newproto (lua_State *L); -LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); -LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); -LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); -LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); -LUAI_FUNC void luaF_close (lua_State *L, StkId level); -LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); -LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, - int pc); - - -#endif diff --git a/deps/rcheevos/test/lua/src/lgc.c b/deps/rcheevos/test/lua/src/lgc.c deleted file mode 100644 index ba2c19e14e..0000000000 --- a/deps/rcheevos/test/lua/src/lgc.c +++ /dev/null @@ -1,1178 +0,0 @@ -/* -** $Id: lgc.c,v 2.215 2016/12/22 13:08:50 roberto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#define lgc_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -/* -** internal state for collector while inside the atomic phase. The -** collector should never be in this state while running regular code. -*/ -#define GCSinsideatomic (GCSpause + 1) - -/* -** cost of sweeping one element (the size of a small object divided -** by some adjust for the sweep speed) -*/ -#define GCSWEEPCOST ((sizeof(TString) + 4) / 4) - -/* maximum number of elements to sweep in each single step */ -#define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) - -/* cost of calling one finalizer */ -#define GCFINALIZECOST GCSWEEPCOST - - -/* -** macro to adjust 'stepmul': 'stepmul' is actually used like -** 'stepmul / STEPMULADJ' (value chosen by tests) -*/ -#define STEPMULADJ 200 - - -/* -** macro to adjust 'pause': 'pause' is actually used like -** 'pause / PAUSEADJ' (value chosen by tests) -*/ -#define PAUSEADJ 100 - - -/* -** 'makewhite' erases all color bits then sets only the current white -** bit -*/ -#define maskcolors (~(bitmask(BLACKBIT) | WHITEBITS)) -#define makewhite(g,x) \ - (x->marked = cast_byte((x->marked & maskcolors) | luaC_white(g))) - -#define white2gray(x) resetbits(x->marked, WHITEBITS) -#define black2gray(x) resetbit(x->marked, BLACKBIT) - - -#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) - -#define checkdeadkey(n) lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n))) - - -#define checkconsistency(obj) \ - lua_longassert(!iscollectable(obj) || righttt(obj)) - - -#define markvalue(g,o) { checkconsistency(o); \ - if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } - -#define markobject(g,t) { if (iswhite(t)) reallymarkobject(g, obj2gco(t)); } - -/* -** mark an object that can be NULL (either because it is really optional, -** or it was stripped as debug info, or inside an uncompleted structure) -*/ -#define markobjectN(g,t) { if (t) markobject(g,t); } - -static void reallymarkobject (global_State *g, GCObject *o); - - -/* -** {====================================================== -** Generic functions -** ======================================================= -*/ - - -/* -** one after last element in a hash array -*/ -#define gnodelast(h) gnode(h, cast(size_t, sizenode(h))) - - -/* -** link collectable object 'o' into list pointed by 'p' -*/ -#define linkgclist(o,p) ((o)->gclist = (p), (p) = obj2gco(o)) - - -/* -** If key is not marked, mark its entry as dead. This allows key to be -** collected, but keeps its entry in the table. A dead node is needed -** when Lua looks up for a key (it may be part of a chain) and when -** traversing a weak table (key might be removed from the table during -** traversal). Other places never manipulate dead keys, because its -** associated nil value is enough to signal that the entry is logically -** empty. -*/ -static void removeentry (Node *n) { - lua_assert(ttisnil(gval(n))); - if (valiswhite(gkey(n))) - setdeadvalue(wgkey(n)); /* unused and unmarked key; remove it */ -} - - -/* -** tells whether a key or value can be cleared from a weak -** table. Non-collectable objects are never removed from weak -** tables. Strings behave as 'values', so are never removed too. for -** other objects: if really collected, cannot keep them; for objects -** being finalized, keep them in keys, but not in values -*/ -static int iscleared (global_State *g, const TValue *o) { - if (!iscollectable(o)) return 0; - else if (ttisstring(o)) { - markobject(g, tsvalue(o)); /* strings are 'values', so are never weak */ - return 0; - } - else return iswhite(gcvalue(o)); -} - - -/* -** barrier that moves collector forward, that is, mark the white object -** being pointed by a black object. (If in sweep phase, clear the black -** object to white [sweep it] to avoid other barrier calls for this -** same object.) -*/ -void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { - global_State *g = G(L); - lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); - if (keepinvariant(g)) /* must keep invariant? */ - reallymarkobject(g, v); /* restore invariant */ - else { /* sweep phase */ - lua_assert(issweepphase(g)); - makewhite(g, o); /* mark main obj. as white to avoid other barriers */ - } -} - - -/* -** barrier that moves collector backward, that is, mark the black object -** pointing to a white object as gray again. -*/ -void luaC_barrierback_ (lua_State *L, Table *t) { - global_State *g = G(L); - lua_assert(isblack(t) && !isdead(g, t)); - black2gray(t); /* make table gray (again) */ - linkgclist(t, g->grayagain); -} - - -/* -** barrier for assignments to closed upvalues. Because upvalues are -** shared among closures, it is impossible to know the color of all -** closures pointing to it. So, we assume that the object being assigned -** must be marked. -*/ -void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) { - global_State *g = G(L); - GCObject *o = gcvalue(uv->v); - lua_assert(!upisopen(uv)); /* ensured by macro luaC_upvalbarrier */ - if (keepinvariant(g)) - markobject(g, o); -} - - -void luaC_fix (lua_State *L, GCObject *o) { - global_State *g = G(L); - lua_assert(g->allgc == o); /* object must be 1st in 'allgc' list! */ - white2gray(o); /* they will be gray forever */ - g->allgc = o->next; /* remove object from 'allgc' list */ - o->next = g->fixedgc; /* link it to 'fixedgc' list */ - g->fixedgc = o; -} - - -/* -** create a new collectable object (with given type and size) and link -** it to 'allgc' list. -*/ -GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { - global_State *g = G(L); - GCObject *o = cast(GCObject *, luaM_newobject(L, novariant(tt), sz)); - o->marked = luaC_white(g); - o->tt = tt; - o->next = g->allgc; - g->allgc = o; - return o; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** Mark functions -** ======================================================= -*/ - - -/* -** mark an object. Userdata, strings, and closed upvalues are visited -** and turned black here. Other objects are marked gray and added -** to appropriate list to be visited (and turned black) later. (Open -** upvalues are already linked in 'headuv' list.) -*/ -static void reallymarkobject (global_State *g, GCObject *o) { - reentry: - white2gray(o); - switch (o->tt) { - case LUA_TSHRSTR: { - gray2black(o); - g->GCmemtrav += sizelstring(gco2ts(o)->shrlen); - break; - } - case LUA_TLNGSTR: { - gray2black(o); - g->GCmemtrav += sizelstring(gco2ts(o)->u.lnglen); - break; - } - case LUA_TUSERDATA: { - TValue uvalue; - markobjectN(g, gco2u(o)->metatable); /* mark its metatable */ - gray2black(o); - g->GCmemtrav += sizeudata(gco2u(o)); - getuservalue(g->mainthread, gco2u(o), &uvalue); - if (valiswhite(&uvalue)) { /* markvalue(g, &uvalue); */ - o = gcvalue(&uvalue); - goto reentry; - } - break; - } - case LUA_TLCL: { - linkgclist(gco2lcl(o), g->gray); - break; - } - case LUA_TCCL: { - linkgclist(gco2ccl(o), g->gray); - break; - } - case LUA_TTABLE: { - linkgclist(gco2t(o), g->gray); - break; - } - case LUA_TTHREAD: { - linkgclist(gco2th(o), g->gray); - break; - } - case LUA_TPROTO: { - linkgclist(gco2p(o), g->gray); - break; - } - default: lua_assert(0); break; - } -} - - -/* -** mark metamethods for basic types -*/ -static void markmt (global_State *g) { - int i; - for (i=0; i < LUA_NUMTAGS; i++) - markobjectN(g, g->mt[i]); -} - - -/* -** mark all objects in list of being-finalized -*/ -static void markbeingfnz (global_State *g) { - GCObject *o; - for (o = g->tobefnz; o != NULL; o = o->next) - markobject(g, o); -} - - -/* -** Mark all values stored in marked open upvalues from non-marked threads. -** (Values from marked threads were already marked when traversing the -** thread.) Remove from the list threads that no longer have upvalues and -** not-marked threads. -*/ -static void remarkupvals (global_State *g) { - lua_State *thread; - lua_State **p = &g->twups; - while ((thread = *p) != NULL) { - lua_assert(!isblack(thread)); /* threads are never black */ - if (isgray(thread) && thread->openupval != NULL) - p = &thread->twups; /* keep marked thread with upvalues in the list */ - else { /* thread is not marked or without upvalues */ - UpVal *uv; - *p = thread->twups; /* remove thread from the list */ - thread->twups = thread; /* mark that it is out of list */ - for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { - if (uv->u.open.touched) { - markvalue(g, uv->v); /* remark upvalue's value */ - uv->u.open.touched = 0; - } - } - } - } -} - - -/* -** mark root set and reset all gray lists, to start a new collection -*/ -static void restartcollection (global_State *g) { - g->gray = g->grayagain = NULL; - g->weak = g->allweak = g->ephemeron = NULL; - markobject(g, g->mainthread); - markvalue(g, &g->l_registry); - markmt(g); - markbeingfnz(g); /* mark any finalizing object left from previous cycle */ -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Traverse functions -** ======================================================= -*/ - -/* -** Traverse a table with weak values and link it to proper list. During -** propagate phase, keep it in 'grayagain' list, to be revisited in the -** atomic phase. In the atomic phase, if table has any white value, -** put it in 'weak' list, to be cleared. -*/ -static void traverseweakvalue (global_State *g, Table *h) { - Node *n, *limit = gnodelast(h); - /* if there is array part, assume it may have white values (it is not - worth traversing it now just to check) */ - int hasclears = (h->sizearray > 0); - for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else { - lua_assert(!ttisnil(gkey(n))); - markvalue(g, gkey(n)); /* mark key */ - if (!hasclears && iscleared(g, gval(n))) /* is there a white value? */ - hasclears = 1; /* table will have to be cleared */ - } - } - if (g->gcstate == GCSpropagate) - linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ - else if (hasclears) - linkgclist(h, g->weak); /* has to be cleared later */ -} - - -/* -** Traverse an ephemeron table and link it to proper list. Returns true -** iff any object was marked during this traversal (which implies that -** convergence has to continue). During propagation phase, keep table -** in 'grayagain' list, to be visited again in the atomic phase. In -** the atomic phase, if table has any white->white entry, it has to -** be revisited during ephemeron convergence (as that key may turn -** black). Otherwise, if it has any white key, table has to be cleared -** (in the atomic phase). -*/ -static int traverseephemeron (global_State *g, Table *h) { - int marked = 0; /* true if an object is marked in this traversal */ - int hasclears = 0; /* true if table has white keys */ - int hasww = 0; /* true if table has entry "white-key -> white-value" */ - Node *n, *limit = gnodelast(h); - unsigned int i; - /* traverse array part */ - for (i = 0; i < h->sizearray; i++) { - if (valiswhite(&h->array[i])) { - marked = 1; - reallymarkobject(g, gcvalue(&h->array[i])); - } - } - /* traverse hash part */ - for (n = gnode(h, 0); n < limit; n++) { - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else if (iscleared(g, gkey(n))) { /* key is not marked (yet)? */ - hasclears = 1; /* table must be cleared */ - if (valiswhite(gval(n))) /* value not marked yet? */ - hasww = 1; /* white-white entry */ - } - else if (valiswhite(gval(n))) { /* value not marked yet? */ - marked = 1; - reallymarkobject(g, gcvalue(gval(n))); /* mark it now */ - } - } - /* link table into proper list */ - if (g->gcstate == GCSpropagate) - linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ - else if (hasww) /* table has white->white entries? */ - linkgclist(h, g->ephemeron); /* have to propagate again */ - else if (hasclears) /* table has white keys? */ - linkgclist(h, g->allweak); /* may have to clean white keys */ - return marked; -} - - -static void traversestrongtable (global_State *g, Table *h) { - Node *n, *limit = gnodelast(h); - unsigned int i; - for (i = 0; i < h->sizearray; i++) /* traverse array part */ - markvalue(g, &h->array[i]); - for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else { - lua_assert(!ttisnil(gkey(n))); - markvalue(g, gkey(n)); /* mark key */ - markvalue(g, gval(n)); /* mark value */ - } - } -} - - -static lu_mem traversetable (global_State *g, Table *h) { - const char *weakkey, *weakvalue; - const TValue *mode = gfasttm(g, h->metatable, TM_MODE); - markobjectN(g, h->metatable); - if (mode && ttisstring(mode) && /* is there a weak mode? */ - ((weakkey = strchr(svalue(mode), 'k')), - (weakvalue = strchr(svalue(mode), 'v')), - (weakkey || weakvalue))) { /* is really weak? */ - black2gray(h); /* keep table gray */ - if (!weakkey) /* strong keys? */ - traverseweakvalue(g, h); - else if (!weakvalue) /* strong values? */ - traverseephemeron(g, h); - else /* all weak */ - linkgclist(h, g->allweak); /* nothing to traverse now */ - } - else /* not weak */ - traversestrongtable(g, h); - return sizeof(Table) + sizeof(TValue) * h->sizearray + - sizeof(Node) * cast(size_t, allocsizenode(h)); -} - - -/* -** Traverse a prototype. (While a prototype is being build, its -** arrays can be larger than needed; the extra slots are filled with -** NULL, so the use of 'markobjectN') -*/ -static int traverseproto (global_State *g, Proto *f) { - int i; - if (f->cache && iswhite(f->cache)) - f->cache = NULL; /* allow cache to be collected */ - markobjectN(g, f->source); - for (i = 0; i < f->sizek; i++) /* mark literals */ - markvalue(g, &f->k[i]); - for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ - markobjectN(g, f->upvalues[i].name); - for (i = 0; i < f->sizep; i++) /* mark nested protos */ - markobjectN(g, f->p[i]); - for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ - markobjectN(g, f->locvars[i].varname); - return sizeof(Proto) + sizeof(Instruction) * f->sizecode + - sizeof(Proto *) * f->sizep + - sizeof(TValue) * f->sizek + - sizeof(int) * f->sizelineinfo + - sizeof(LocVar) * f->sizelocvars + - sizeof(Upvaldesc) * f->sizeupvalues; -} - - -static lu_mem traverseCclosure (global_State *g, CClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) /* mark its upvalues */ - markvalue(g, &cl->upvalue[i]); - return sizeCclosure(cl->nupvalues); -} - -/* -** open upvalues point to values in a thread, so those values should -** be marked when the thread is traversed except in the atomic phase -** (because then the value cannot be changed by the thread and the -** thread may not be traversed again) -*/ -static lu_mem traverseLclosure (global_State *g, LClosure *cl) { - int i; - markobjectN(g, cl->p); /* mark its prototype */ - for (i = 0; i < cl->nupvalues; i++) { /* mark its upvalues */ - UpVal *uv = cl->upvals[i]; - if (uv != NULL) { - if (upisopen(uv) && g->gcstate != GCSinsideatomic) - uv->u.open.touched = 1; /* can be marked in 'remarkupvals' */ - else - markvalue(g, uv->v); - } - } - return sizeLclosure(cl->nupvalues); -} - - -static lu_mem traversethread (global_State *g, lua_State *th) { - StkId o = th->stack; - if (o == NULL) - return 1; /* stack not completely built yet */ - lua_assert(g->gcstate == GCSinsideatomic || - th->openupval == NULL || isintwups(th)); - for (; o < th->top; o++) /* mark live elements in the stack */ - markvalue(g, o); - if (g->gcstate == GCSinsideatomic) { /* final traversal? */ - StkId lim = th->stack + th->stacksize; /* real end of stack */ - for (; o < lim; o++) /* clear not-marked stack slice */ - setnilvalue(o); - /* 'remarkupvals' may have removed thread from 'twups' list */ - if (!isintwups(th) && th->openupval != NULL) { - th->twups = g->twups; /* link it back to the list */ - g->twups = th; - } - } - else if (g->gckind != KGC_EMERGENCY) - luaD_shrinkstack(th); /* do not change stack in emergency cycle */ - return (sizeof(lua_State) + sizeof(TValue) * th->stacksize + - sizeof(CallInfo) * th->nci); -} - - -/* -** traverse one gray object, turning it to black (except for threads, -** which are always gray). -*/ -static void propagatemark (global_State *g) { - lu_mem size; - GCObject *o = g->gray; - lua_assert(isgray(o)); - gray2black(o); - switch (o->tt) { - case LUA_TTABLE: { - Table *h = gco2t(o); - g->gray = h->gclist; /* remove from 'gray' list */ - size = traversetable(g, h); - break; - } - case LUA_TLCL: { - LClosure *cl = gco2lcl(o); - g->gray = cl->gclist; /* remove from 'gray' list */ - size = traverseLclosure(g, cl); - break; - } - case LUA_TCCL: { - CClosure *cl = gco2ccl(o); - g->gray = cl->gclist; /* remove from 'gray' list */ - size = traverseCclosure(g, cl); - break; - } - case LUA_TTHREAD: { - lua_State *th = gco2th(o); - g->gray = th->gclist; /* remove from 'gray' list */ - linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ - black2gray(o); - size = traversethread(g, th); - break; - } - case LUA_TPROTO: { - Proto *p = gco2p(o); - g->gray = p->gclist; /* remove from 'gray' list */ - size = traverseproto(g, p); - break; - } - default: lua_assert(0); return; - } - g->GCmemtrav += size; -} - - -static void propagateall (global_State *g) { - while (g->gray) propagatemark(g); -} - - -static void convergeephemerons (global_State *g) { - int changed; - do { - GCObject *w; - GCObject *next = g->ephemeron; /* get ephemeron list */ - g->ephemeron = NULL; /* tables may return to this list when traversed */ - changed = 0; - while ((w = next) != NULL) { - next = gco2t(w)->gclist; - if (traverseephemeron(g, gco2t(w))) { /* traverse marked some value? */ - propagateall(g); /* propagate changes */ - changed = 1; /* will have to revisit all ephemeron tables */ - } - } - } while (changed); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Sweep Functions -** ======================================================= -*/ - - -/* -** clear entries with unmarked keys from all weaktables in list 'l' up -** to element 'f' -*/ -static void clearkeys (global_State *g, GCObject *l, GCObject *f) { - for (; l != f; l = gco2t(l)->gclist) { - Table *h = gco2t(l); - Node *n, *limit = gnodelast(h); - for (n = gnode(h, 0); n < limit; n++) { - if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) { - setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* and remove entry from table */ - } - } - } -} - - -/* -** clear entries with unmarked values from all weaktables in list 'l' up -** to element 'f' -*/ -static void clearvalues (global_State *g, GCObject *l, GCObject *f) { - for (; l != f; l = gco2t(l)->gclist) { - Table *h = gco2t(l); - Node *n, *limit = gnodelast(h); - unsigned int i; - for (i = 0; i < h->sizearray; i++) { - TValue *o = &h->array[i]; - if (iscleared(g, o)) /* value was collected? */ - setnilvalue(o); /* remove value */ - } - for (n = gnode(h, 0); n < limit; n++) { - if (!ttisnil(gval(n)) && iscleared(g, gval(n))) { - setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* and remove entry from table */ - } - } - } -} - - -void luaC_upvdeccount (lua_State *L, UpVal *uv) { - lua_assert(uv->refcount > 0); - uv->refcount--; - if (uv->refcount == 0 && !upisopen(uv)) - luaM_free(L, uv); -} - - -static void freeLclosure (lua_State *L, LClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) { - UpVal *uv = cl->upvals[i]; - if (uv) - luaC_upvdeccount(L, uv); - } - luaM_freemem(L, cl, sizeLclosure(cl->nupvalues)); -} - - -static void freeobj (lua_State *L, GCObject *o) { - switch (o->tt) { - case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; - case LUA_TLCL: { - freeLclosure(L, gco2lcl(o)); - break; - } - case LUA_TCCL: { - luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues)); - break; - } - case LUA_TTABLE: luaH_free(L, gco2t(o)); break; - case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break; - case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; - case LUA_TSHRSTR: - luaS_remove(L, gco2ts(o)); /* remove it from hash table */ - luaM_freemem(L, o, sizelstring(gco2ts(o)->shrlen)); - break; - case LUA_TLNGSTR: { - luaM_freemem(L, o, sizelstring(gco2ts(o)->u.lnglen)); - break; - } - default: lua_assert(0); - } -} - - -#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) -static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count); - - -/* -** sweep at most 'count' elements from a list of GCObjects erasing dead -** objects, where a dead object is one marked with the old (non current) -** white; change all non-dead objects back to white, preparing for next -** collection cycle. Return where to continue the traversal or NULL if -** list is finished. -*/ -static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { - global_State *g = G(L); - int ow = otherwhite(g); - int white = luaC_white(g); /* current white */ - while (*p != NULL && count-- > 0) { - GCObject *curr = *p; - int marked = curr->marked; - if (isdeadm(ow, marked)) { /* is 'curr' dead? */ - *p = curr->next; /* remove 'curr' from list */ - freeobj(L, curr); /* erase 'curr' */ - } - else { /* change mark to 'white' */ - curr->marked = cast_byte((marked & maskcolors) | white); - p = &curr->next; /* go to next element */ - } - } - return (*p == NULL) ? NULL : p; -} - - -/* -** sweep a list until a live object (or end of list) -*/ -static GCObject **sweeptolive (lua_State *L, GCObject **p) { - GCObject **old = p; - do { - p = sweeplist(L, p, 1); - } while (p == old); - return p; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Finalization -** ======================================================= -*/ - -/* -** If possible, shrink string table -*/ -static void checkSizes (lua_State *L, global_State *g) { - if (g->gckind != KGC_EMERGENCY) { - l_mem olddebt = g->GCdebt; - if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ - luaS_resize(L, g->strt.size / 2); /* shrink it a little */ - g->GCestimate += g->GCdebt - olddebt; /* update estimate */ - } -} - - -static GCObject *udata2finalize (global_State *g) { - GCObject *o = g->tobefnz; /* get first element */ - lua_assert(tofinalize(o)); - g->tobefnz = o->next; /* remove it from 'tobefnz' list */ - o->next = g->allgc; /* return it to 'allgc' list */ - g->allgc = o; - resetbit(o->marked, FINALIZEDBIT); /* object is "normal" again */ - if (issweepphase(g)) - makewhite(g, o); /* "sweep" object */ - return o; -} - - -static void dothecall (lua_State *L, void *ud) { - UNUSED(ud); - luaD_callnoyield(L, L->top - 2, 0); -} - - -static void GCTM (lua_State *L, int propagateerrors) { - global_State *g = G(L); - const TValue *tm; - TValue v; - setgcovalue(L, &v, udata2finalize(g)); - tm = luaT_gettmbyobj(L, &v, TM_GC); - if (tm != NULL && ttisfunction(tm)) { /* is there a finalizer? */ - int status; - lu_byte oldah = L->allowhook; - int running = g->gcrunning; - L->allowhook = 0; /* stop debug hooks during GC metamethod */ - g->gcrunning = 0; /* avoid GC steps */ - setobj2s(L, L->top, tm); /* push finalizer... */ - setobj2s(L, L->top + 1, &v); /* ... and its argument */ - L->top += 2; /* and (next line) call the finalizer */ - L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ - status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); - L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ - L->allowhook = oldah; /* restore hooks */ - g->gcrunning = running; /* restore state */ - if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ - if (status == LUA_ERRRUN) { /* is there an error object? */ - const char *msg = (ttisstring(L->top - 1)) - ? svalue(L->top - 1) - : "no message"; - luaO_pushfstring(L, "error in __gc metamethod (%s)", msg); - status = LUA_ERRGCMM; /* error in __gc metamethod */ - } - luaD_throw(L, status); /* re-throw error */ - } - } -} - - -/* -** call a few (up to 'g->gcfinnum') finalizers -*/ -static int runafewfinalizers (lua_State *L) { - global_State *g = G(L); - unsigned int i; - lua_assert(!g->tobefnz || g->gcfinnum > 0); - for (i = 0; g->tobefnz && i < g->gcfinnum; i++) - GCTM(L, 1); /* call one finalizer */ - g->gcfinnum = (!g->tobefnz) ? 0 /* nothing more to finalize? */ - : g->gcfinnum * 2; /* else call a few more next time */ - return i; -} - - -/* -** call all pending finalizers -*/ -static void callallpendingfinalizers (lua_State *L) { - global_State *g = G(L); - while (g->tobefnz) - GCTM(L, 0); -} - - -/* -** find last 'next' field in list 'p' list (to add elements in its end) -*/ -static GCObject **findlast (GCObject **p) { - while (*p != NULL) - p = &(*p)->next; - return p; -} - - -/* -** move all unreachable objects (or 'all' objects) that need -** finalization from list 'finobj' to list 'tobefnz' (to be finalized) -*/ -static void separatetobefnz (global_State *g, int all) { - GCObject *curr; - GCObject **p = &g->finobj; - GCObject **lastnext = findlast(&g->tobefnz); - while ((curr = *p) != NULL) { /* traverse all finalizable objects */ - lua_assert(tofinalize(curr)); - if (!(iswhite(curr) || all)) /* not being collected? */ - p = &curr->next; /* don't bother with it */ - else { - *p = curr->next; /* remove 'curr' from 'finobj' list */ - curr->next = *lastnext; /* link at the end of 'tobefnz' list */ - *lastnext = curr; - lastnext = &curr->next; - } - } -} - - -/* -** if object 'o' has a finalizer, remove it from 'allgc' list (must -** search the list to find it) and link it in 'finobj' list. -*/ -void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { - global_State *g = G(L); - if (tofinalize(o) || /* obj. is already marked... */ - gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */ - return; /* nothing to be done */ - else { /* move 'o' to 'finobj' list */ - GCObject **p; - if (issweepphase(g)) { - makewhite(g, o); /* "sweep" object 'o' */ - if (g->sweepgc == &o->next) /* should not remove 'sweepgc' object */ - g->sweepgc = sweeptolive(L, g->sweepgc); /* change 'sweepgc' */ - } - /* search for pointer pointing to 'o' */ - for (p = &g->allgc; *p != o; p = &(*p)->next) { /* empty */ } - *p = o->next; /* remove 'o' from 'allgc' list */ - o->next = g->finobj; /* link it in 'finobj' list */ - g->finobj = o; - l_setbit(o->marked, FINALIZEDBIT); /* mark it as such */ - } -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** GC control -** ======================================================= -*/ - - -/* -** Set a reasonable "time" to wait before starting a new GC cycle; cycle -** will start when memory use hits threshold. (Division by 'estimate' -** should be OK: it cannot be zero (because Lua cannot even start with -** less than PAUSEADJ bytes). -*/ -static void setpause (global_State *g) { - l_mem threshold, debt; - l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */ - lua_assert(estimate > 0); - threshold = (g->gcpause < MAX_LMEM / estimate) /* overflow? */ - ? estimate * g->gcpause /* no overflow */ - : MAX_LMEM; /* overflow; truncate to maximum */ - debt = gettotalbytes(g) - threshold; - luaE_setdebt(g, debt); -} - - -/* -** Enter first sweep phase. -** The call to 'sweeplist' tries to make pointer point to an object -** inside the list (instead of to the header), so that the real sweep do -** not need to skip objects created between "now" and the start of the -** real sweep. -*/ -static void entersweep (lua_State *L) { - global_State *g = G(L); - g->gcstate = GCSswpallgc; - lua_assert(g->sweepgc == NULL); - g->sweepgc = sweeplist(L, &g->allgc, 1); -} - - -void luaC_freeallobjects (lua_State *L) { - global_State *g = G(L); - separatetobefnz(g, 1); /* separate all objects with finalizers */ - lua_assert(g->finobj == NULL); - callallpendingfinalizers(L); - lua_assert(g->tobefnz == NULL); - g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */ - g->gckind = KGC_NORMAL; - sweepwholelist(L, &g->finobj); - sweepwholelist(L, &g->allgc); - sweepwholelist(L, &g->fixedgc); /* collect fixed objects */ - lua_assert(g->strt.nuse == 0); -} - - -static l_mem atomic (lua_State *L) { - global_State *g = G(L); - l_mem work; - GCObject *origweak, *origall; - GCObject *grayagain = g->grayagain; /* save original list */ - lua_assert(g->ephemeron == NULL && g->weak == NULL); - lua_assert(!iswhite(g->mainthread)); - g->gcstate = GCSinsideatomic; - g->GCmemtrav = 0; /* start counting work */ - markobject(g, L); /* mark running thread */ - /* registry and global metatables may be changed by API */ - markvalue(g, &g->l_registry); - markmt(g); /* mark global metatables */ - /* remark occasional upvalues of (maybe) dead threads */ - remarkupvals(g); - propagateall(g); /* propagate changes */ - work = g->GCmemtrav; /* stop counting (do not recount 'grayagain') */ - g->gray = grayagain; - propagateall(g); /* traverse 'grayagain' list */ - g->GCmemtrav = 0; /* restart counting */ - convergeephemerons(g); - /* at this point, all strongly accessible objects are marked. */ - /* Clear values from weak tables, before checking finalizers */ - clearvalues(g, g->weak, NULL); - clearvalues(g, g->allweak, NULL); - origweak = g->weak; origall = g->allweak; - work += g->GCmemtrav; /* stop counting (objects being finalized) */ - separatetobefnz(g, 0); /* separate objects to be finalized */ - g->gcfinnum = 1; /* there may be objects to be finalized */ - markbeingfnz(g); /* mark objects that will be finalized */ - propagateall(g); /* remark, to propagate 'resurrection' */ - g->GCmemtrav = 0; /* restart counting */ - convergeephemerons(g); - /* at this point, all resurrected objects are marked. */ - /* remove dead objects from weak tables */ - clearkeys(g, g->ephemeron, NULL); /* clear keys from all ephemeron tables */ - clearkeys(g, g->allweak, NULL); /* clear keys from all 'allweak' tables */ - /* clear values from resurrected weak tables */ - clearvalues(g, g->weak, origweak); - clearvalues(g, g->allweak, origall); - luaS_clearcache(g); - g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ - work += g->GCmemtrav; /* complete counting */ - return work; /* estimate of memory marked by 'atomic' */ -} - - -static lu_mem sweepstep (lua_State *L, global_State *g, - int nextstate, GCObject **nextlist) { - if (g->sweepgc) { - l_mem olddebt = g->GCdebt; - g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); - g->GCestimate += g->GCdebt - olddebt; /* update estimate */ - if (g->sweepgc) /* is there still something to sweep? */ - return (GCSWEEPMAX * GCSWEEPCOST); - } - /* else enter next state */ - g->gcstate = nextstate; - g->sweepgc = nextlist; - return 0; -} - - -static lu_mem singlestep (lua_State *L) { - global_State *g = G(L); - switch (g->gcstate) { - case GCSpause: { - g->GCmemtrav = g->strt.size * sizeof(GCObject*); - restartcollection(g); - g->gcstate = GCSpropagate; - return g->GCmemtrav; - } - case GCSpropagate: { - g->GCmemtrav = 0; - lua_assert(g->gray); - propagatemark(g); - if (g->gray == NULL) /* no more gray objects? */ - g->gcstate = GCSatomic; /* finish propagate phase */ - return g->GCmemtrav; /* memory traversed in this step */ - } - case GCSatomic: { - lu_mem work; - propagateall(g); /* make sure gray list is empty */ - work = atomic(L); /* work is what was traversed by 'atomic' */ - entersweep(L); - g->GCestimate = gettotalbytes(g); /* first estimate */; - return work; - } - case GCSswpallgc: { /* sweep "regular" objects */ - return sweepstep(L, g, GCSswpfinobj, &g->finobj); - } - case GCSswpfinobj: { /* sweep objects with finalizers */ - return sweepstep(L, g, GCSswptobefnz, &g->tobefnz); - } - case GCSswptobefnz: { /* sweep objects to be finalized */ - return sweepstep(L, g, GCSswpend, NULL); - } - case GCSswpend: { /* finish sweeps */ - makewhite(g, g->mainthread); /* sweep main thread */ - checkSizes(L, g); - g->gcstate = GCScallfin; - return 0; - } - case GCScallfin: { /* call remaining finalizers */ - if (g->tobefnz && g->gckind != KGC_EMERGENCY) { - int n = runafewfinalizers(L); - return (n * GCFINALIZECOST); - } - else { /* emergency mode or no more finalizers */ - g->gcstate = GCSpause; /* finish collection */ - return 0; - } - } - default: lua_assert(0); return 0; - } -} - - -/* -** advances the garbage collector until it reaches a state allowed -** by 'statemask' -*/ -void luaC_runtilstate (lua_State *L, int statesmask) { - global_State *g = G(L); - while (!testbit(statesmask, g->gcstate)) - singlestep(L); -} - - -/* -** get GC debt and convert it from Kb to 'work units' (avoid zero debt -** and overflows) -*/ -static l_mem getdebt (global_State *g) { - l_mem debt = g->GCdebt; - int stepmul = g->gcstepmul; - if (debt <= 0) return 0; /* minimal debt */ - else { - debt = (debt / STEPMULADJ) + 1; - debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM; - return debt; - } -} - -/* -** performs a basic GC step when collector is running -*/ -void luaC_step (lua_State *L) { - global_State *g = G(L); - l_mem debt = getdebt(g); /* GC deficit (be paid now) */ - if (!g->gcrunning) { /* not running? */ - luaE_setdebt(g, -GCSTEPSIZE * 10); /* avoid being called too often */ - return; - } - do { /* repeat until pause or enough "credit" (negative debt) */ - lu_mem work = singlestep(L); /* perform one single step */ - debt -= work; - } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause); - if (g->gcstate == GCSpause) - setpause(g); /* pause until next cycle */ - else { - debt = (debt / g->gcstepmul) * STEPMULADJ; /* convert 'work units' to Kb */ - luaE_setdebt(g, debt); - runafewfinalizers(L); - } -} - - -/* -** Performs a full GC cycle; if 'isemergency', set a flag to avoid -** some operations which could change the interpreter state in some -** unexpected ways (running finalizers and shrinking some structures). -** Before running the collection, check 'keepinvariant'; if it is true, -** there may be some objects marked as black, so the collector has -** to sweep all objects to turn them back to white (as white has not -** changed, nothing will be collected). -*/ -void luaC_fullgc (lua_State *L, int isemergency) { - global_State *g = G(L); - lua_assert(g->gckind == KGC_NORMAL); - if (isemergency) g->gckind = KGC_EMERGENCY; /* set flag */ - if (keepinvariant(g)) { /* black objects? */ - entersweep(L); /* sweep everything to turn them back to white */ - } - /* finish any pending sweep phase to start a new cycle */ - luaC_runtilstate(L, bitmask(GCSpause)); - luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */ - luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */ - /* estimate must be correct after a full GC cycle */ - lua_assert(g->GCestimate == gettotalbytes(g)); - luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ - g->gckind = KGC_NORMAL; - setpause(g); -} - -/* }====================================================== */ - - diff --git a/deps/rcheevos/test/lua/src/lgc.h b/deps/rcheevos/test/lua/src/lgc.h deleted file mode 100644 index aed3e18a5f..0000000000 --- a/deps/rcheevos/test/lua/src/lgc.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -** $Id: lgc.h,v 2.91 2015/12/21 13:02:14 roberto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#ifndef lgc_h -#define lgc_h - - -#include "lobject.h" -#include "lstate.h" - -/* -** Collectable objects may have one of three colors: white, which -** means the object is not marked; gray, which means the -** object is marked, but its references may be not marked; and -** black, which means that the object and all its references are marked. -** The main invariant of the garbage collector, while marking objects, -** is that a black object can never point to a white one. Moreover, -** any gray object must be in a "gray list" (gray, grayagain, weak, -** allweak, ephemeron) so that it can be visited again before finishing -** the collection cycle. These lists have no meaning when the invariant -** is not being enforced (e.g., sweep phase). -*/ - - - -/* how much to allocate before next GC step */ -#if !defined(GCSTEPSIZE) -/* ~100 small strings */ -#define GCSTEPSIZE (cast_int(100 * sizeof(TString))) -#endif - - -/* -** Possible states of the Garbage Collector -*/ -#define GCSpropagate 0 -#define GCSatomic 1 -#define GCSswpallgc 2 -#define GCSswpfinobj 3 -#define GCSswptobefnz 4 -#define GCSswpend 5 -#define GCScallfin 6 -#define GCSpause 7 - - -#define issweepphase(g) \ - (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) - - -/* -** macro to tell when main invariant (white objects cannot point to black -** ones) must be kept. During a collection, the sweep -** phase may break the invariant, as objects turned white may point to -** still-black objects. The invariant is restored when sweep ends and -** all objects are white again. -*/ - -#define keepinvariant(g) ((g)->gcstate <= GCSatomic) - - -/* -** some useful bit tricks -*/ -#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) -#define setbits(x,m) ((x) |= (m)) -#define testbits(x,m) ((x) & (m)) -#define bitmask(b) (1<<(b)) -#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) -#define l_setbit(x,b) setbits(x, bitmask(b)) -#define resetbit(x,b) resetbits(x, bitmask(b)) -#define testbit(x,b) testbits(x, bitmask(b)) - - -/* Layout for bit use in 'marked' field: */ -#define WHITE0BIT 0 /* object is white (type 0) */ -#define WHITE1BIT 1 /* object is white (type 1) */ -#define BLACKBIT 2 /* object is black */ -#define FINALIZEDBIT 3 /* object has been marked for finalization */ -/* bit 7 is currently used by tests (luaL_checkmemory) */ - -#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) - - -#define iswhite(x) testbits((x)->marked, WHITEBITS) -#define isblack(x) testbit((x)->marked, BLACKBIT) -#define isgray(x) /* neither white nor black */ \ - (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT))) - -#define tofinalize(x) testbit((x)->marked, FINALIZEDBIT) - -#define otherwhite(g) ((g)->currentwhite ^ WHITEBITS) -#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) -#define isdead(g,v) isdeadm(otherwhite(g), (v)->marked) - -#define changewhite(x) ((x)->marked ^= WHITEBITS) -#define gray2black(x) l_setbit((x)->marked, BLACKBIT) - -#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) - - -/* -** Does one step of collection when debt becomes positive. 'pre'/'pos' -** allows some adjustments to be done only when needed. macro -** 'condchangemem' is used only for heavy tests (forcing a full -** GC cycle on every opportunity) -*/ -#define luaC_condGC(L,pre,pos) \ - { if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; \ - condchangemem(L,pre,pos); } - -/* more often than not, 'pre'/'pos' are empty */ -#define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0) - - -#define luaC_barrier(L,p,v) ( \ - (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ - luaC_barrier_(L,obj2gco(p),gcvalue(v)) : cast_void(0)) - -#define luaC_barrierback(L,p,v) ( \ - (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ - luaC_barrierback_(L,p) : cast_void(0)) - -#define luaC_objbarrier(L,p,o) ( \ - (isblack(p) && iswhite(o)) ? \ - luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) - -#define luaC_upvalbarrier(L,uv) ( \ - (iscollectable((uv)->v) && !upisopen(uv)) ? \ - luaC_upvalbarrier_(L,uv) : cast_void(0)) - -LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); -LUAI_FUNC void luaC_freeallobjects (lua_State *L); -LUAI_FUNC void luaC_step (lua_State *L); -LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); -LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); -LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); -LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); -LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o); -LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv); -LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); -LUAI_FUNC void luaC_upvdeccount (lua_State *L, UpVal *uv); - - -#endif diff --git a/deps/rcheevos/test/lua/src/linit.c b/deps/rcheevos/test/lua/src/linit.c deleted file mode 100644 index afcaf98b24..0000000000 --- a/deps/rcheevos/test/lua/src/linit.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -** $Id: linit.c,v 1.39 2016/12/04 20:17:24 roberto Exp $ -** Initialization of libraries for lua.c and other clients -** See Copyright Notice in lua.h -*/ - - -#define linit_c -#define LUA_LIB - -/* -** If you embed Lua in your program and need to open the standard -** libraries, call luaL_openlibs in your program. If you need a -** different set of libraries, copy this file to your project and edit -** it to suit your needs. -** -** You can also *preload* libraries, so that a later 'require' can -** open the library, which is already linked to the application. -** For that, do the following code: -** -** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); -** lua_pushcfunction(L, luaopen_modname); -** lua_setfield(L, -2, modname); -** lua_pop(L, 1); // remove PRELOAD table -*/ - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lualib.h" -#include "lauxlib.h" - - -/* -** these libs are loaded by lua.c and are readily available to any Lua -** program -*/ -static const luaL_Reg loadedlibs[] = { - {"_G", luaopen_base}, - {LUA_LOADLIBNAME, luaopen_package}, - {LUA_COLIBNAME, luaopen_coroutine}, - {LUA_TABLIBNAME, luaopen_table}, - {LUA_IOLIBNAME, luaopen_io}, - {LUA_OSLIBNAME, luaopen_os}, - {LUA_STRLIBNAME, luaopen_string}, - {LUA_MATHLIBNAME, luaopen_math}, - {LUA_UTF8LIBNAME, luaopen_utf8}, - {LUA_DBLIBNAME, luaopen_debug}, -#if defined(LUA_COMPAT_BITLIB) - {LUA_BITLIBNAME, luaopen_bit32}, -#endif - {NULL, NULL} -}; - - -LUALIB_API void luaL_openlibs (lua_State *L) { - const luaL_Reg *lib; - /* "require" functions from 'loadedlibs' and set results to global table */ - for (lib = loadedlibs; lib->func; lib++) { - luaL_requiref(L, lib->name, lib->func, 1); - lua_pop(L, 1); /* remove lib */ - } -} - diff --git a/deps/rcheevos/test/lua/src/liolib.c b/deps/rcheevos/test/lua/src/liolib.c deleted file mode 100644 index 156840358d..0000000000 --- a/deps/rcheevos/test/lua/src/liolib.c +++ /dev/null @@ -1,771 +0,0 @@ -/* -** $Id: liolib.c,v 2.151 2016/12/20 18:37:00 roberto Exp $ -** Standard I/O (and system) library -** See Copyright Notice in lua.h -*/ - -#define liolib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - - - -/* -** Change this macro to accept other modes for 'fopen' besides -** the standard ones. -*/ -#if !defined(l_checkmode) - -/* accepted extensions to 'mode' in 'fopen' */ -#if !defined(L_MODEEXT) -#define L_MODEEXT "b" -#endif - -/* Check whether 'mode' matches '[rwa]%+?[L_MODEEXT]*' */ -static int l_checkmode (const char *mode) { - return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && - (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */ - (strspn(mode, L_MODEEXT) == strlen(mode))); /* check extensions */ -} - -#endif - -/* -** {====================================================== -** l_popen spawns a new process connected to the current -** one through the file streams. -** ======================================================= -*/ - -#if !defined(l_popen) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#define l_popen(L,c,m) (fflush(NULL), popen(c,m)) -#define l_pclose(L,file) (pclose(file)) - -#elif defined(LUA_USE_WINDOWS) /* }{ */ - -#define l_popen(L,c,m) (_popen(c,m)) -#define l_pclose(L,file) (_pclose(file)) - -#else /* }{ */ - -/* ISO C definitions */ -#define l_popen(L,c,m) \ - ((void)((void)c, m), \ - luaL_error(L, "'popen' not supported"), \ - (FILE*)0) -#define l_pclose(L,file) ((void)L, (void)file, -1) - -#endif /* } */ - -#endif /* } */ - -/* }====================================================== */ - - -#if !defined(l_getc) /* { */ - -#if defined(LUA_USE_POSIX) -#define l_getc(f) getc_unlocked(f) -#define l_lockfile(f) flockfile(f) -#define l_unlockfile(f) funlockfile(f) -#else -#define l_getc(f) getc(f) -#define l_lockfile(f) ((void)0) -#define l_unlockfile(f) ((void)0) -#endif - -#endif /* } */ - - -/* -** {====================================================== -** l_fseek: configuration for longer offsets -** ======================================================= -*/ - -#if !defined(l_fseek) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#include - -#define l_fseek(f,o,w) fseeko(f,o,w) -#define l_ftell(f) ftello(f) -#define l_seeknum off_t - -#elif defined(LUA_USE_WINDOWS) && !defined(_CRTIMP_TYPEINFO) \ - && defined(_MSC_VER) && (_MSC_VER >= 1400) /* }{ */ - -/* Windows (but not DDK) and Visual C++ 2005 or higher */ -#define l_fseek(f,o,w) _fseeki64(f,o,w) -#define l_ftell(f) _ftelli64(f) -#define l_seeknum __int64 - -#else /* }{ */ - -/* ISO C definitions */ -#define l_fseek(f,o,w) fseek(f,o,w) -#define l_ftell(f) ftell(f) -#define l_seeknum long - -#endif /* } */ - -#endif /* } */ - -/* }====================================================== */ - - -#define IO_PREFIX "_IO_" -#define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) -#define IO_INPUT (IO_PREFIX "input") -#define IO_OUTPUT (IO_PREFIX "output") - - -typedef luaL_Stream LStream; - - -#define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) - -#define isclosed(p) ((p)->closef == NULL) - - -static int io_type (lua_State *L) { - LStream *p; - luaL_checkany(L, 1); - p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE); - if (p == NULL) - lua_pushnil(L); /* not a file */ - else if (isclosed(p)) - lua_pushliteral(L, "closed file"); - else - lua_pushliteral(L, "file"); - return 1; -} - - -static int f_tostring (lua_State *L) { - LStream *p = tolstream(L); - if (isclosed(p)) - lua_pushliteral(L, "file (closed)"); - else - lua_pushfstring(L, "file (%p)", p->f); - return 1; -} - - -static FILE *tofile (lua_State *L) { - LStream *p = tolstream(L); - if (isclosed(p)) - luaL_error(L, "attempt to use a closed file"); - lua_assert(p->f); - return p->f; -} - - -/* -** When creating file handles, always creates a 'closed' file handle -** before opening the actual file; so, if there is a memory error, the -** handle is in a consistent state. -*/ -static LStream *newprefile (lua_State *L) { - LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream)); - p->closef = NULL; /* mark file handle as 'closed' */ - luaL_setmetatable(L, LUA_FILEHANDLE); - return p; -} - - -/* -** Calls the 'close' function from a file handle. The 'volatile' avoids -** a bug in some versions of the Clang compiler (e.g., clang 3.0 for -** 32 bits). -*/ -static int aux_close (lua_State *L) { - LStream *p = tolstream(L); - volatile lua_CFunction cf = p->closef; - p->closef = NULL; /* mark stream as closed */ - return (*cf)(L); /* close it */ -} - - -static int io_close (lua_State *L) { - if (lua_isnone(L, 1)) /* no argument? */ - lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ - tofile(L); /* make sure argument is an open stream */ - return aux_close(L); -} - - -static int f_gc (lua_State *L) { - LStream *p = tolstream(L); - if (!isclosed(p) && p->f != NULL) - aux_close(L); /* ignore closed and incompletely open files */ - return 0; -} - - -/* -** function to close regular files -*/ -static int io_fclose (lua_State *L) { - LStream *p = tolstream(L); - int res = fclose(p->f); - return luaL_fileresult(L, (res == 0), NULL); -} - - -static LStream *newfile (lua_State *L) { - LStream *p = newprefile(L); - p->f = NULL; - p->closef = &io_fclose; - return p; -} - - -static void opencheck (lua_State *L, const char *fname, const char *mode) { - LStream *p = newfile(L); - p->f = fopen(fname, mode); - if (p->f == NULL) - luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno)); -} - - -static int io_open (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); - LStream *p = newfile(L); - const char *md = mode; /* to traverse/check mode */ - luaL_argcheck(L, l_checkmode(md), 2, "invalid mode"); - p->f = fopen(filename, mode); - return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; -} - - -/* -** function to close 'popen' files -*/ -static int io_pclose (lua_State *L) { - LStream *p = tolstream(L); - return luaL_execresult(L, l_pclose(L, p->f)); -} - - -static int io_popen (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); - LStream *p = newprefile(L); - p->f = l_popen(L, filename, mode); - p->closef = &io_pclose; - return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; -} - - -static int io_tmpfile (lua_State *L) { - LStream *p = newfile(L); - p->f = tmpfile(); - return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1; -} - - -static FILE *getiofile (lua_State *L, const char *findex) { - LStream *p; - lua_getfield(L, LUA_REGISTRYINDEX, findex); - p = (LStream *)lua_touserdata(L, -1); - if (isclosed(p)) - luaL_error(L, "standard %s file is closed", findex + IOPREF_LEN); - return p->f; -} - - -static int g_iofile (lua_State *L, const char *f, const char *mode) { - if (!lua_isnoneornil(L, 1)) { - const char *filename = lua_tostring(L, 1); - if (filename) - opencheck(L, filename, mode); - else { - tofile(L); /* check that it's a valid file handle */ - lua_pushvalue(L, 1); - } - lua_setfield(L, LUA_REGISTRYINDEX, f); - } - /* return current value */ - lua_getfield(L, LUA_REGISTRYINDEX, f); - return 1; -} - - -static int io_input (lua_State *L) { - return g_iofile(L, IO_INPUT, "r"); -} - - -static int io_output (lua_State *L) { - return g_iofile(L, IO_OUTPUT, "w"); -} - - -static int io_readline (lua_State *L); - - -/* -** maximum number of arguments to 'f:lines'/'io.lines' (it + 3 must fit -** in the limit for upvalues of a closure) -*/ -#define MAXARGLINE 250 - -static void aux_lines (lua_State *L, int toclose) { - int n = lua_gettop(L) - 1; /* number of arguments to read */ - luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments"); - lua_pushinteger(L, n); /* number of arguments to read */ - lua_pushboolean(L, toclose); /* close/not close file when finished */ - lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ - lua_pushcclosure(L, io_readline, 3 + n); -} - - -static int f_lines (lua_State *L) { - tofile(L); /* check that it's a valid file handle */ - aux_lines(L, 0); - return 1; -} - - -static int io_lines (lua_State *L) { - int toclose; - if (lua_isnone(L, 1)) lua_pushnil(L); /* at least one argument */ - if (lua_isnil(L, 1)) { /* no file name? */ - lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT); /* get default input */ - lua_replace(L, 1); /* put it at index 1 */ - tofile(L); /* check that it's a valid file handle */ - toclose = 0; /* do not close it after iteration */ - } - else { /* open a new file */ - const char *filename = luaL_checkstring(L, 1); - opencheck(L, filename, "r"); - lua_replace(L, 1); /* put file at index 1 */ - toclose = 1; /* close it after iteration */ - } - aux_lines(L, toclose); - return 1; -} - - -/* -** {====================================================== -** READ -** ======================================================= -*/ - - -/* maximum length of a numeral */ -#if !defined (L_MAXLENNUM) -#define L_MAXLENNUM 200 -#endif - - -/* auxiliary structure used by 'read_number' */ -typedef struct { - FILE *f; /* file being read */ - int c; /* current character (look ahead) */ - int n; /* number of elements in buffer 'buff' */ - char buff[L_MAXLENNUM + 1]; /* +1 for ending '\0' */ -} RN; - - -/* -** Add current char to buffer (if not out of space) and read next one -*/ -static int nextc (RN *rn) { - if (rn->n >= L_MAXLENNUM) { /* buffer overflow? */ - rn->buff[0] = '\0'; /* invalidate result */ - return 0; /* fail */ - } - else { - rn->buff[rn->n++] = rn->c; /* save current char */ - rn->c = l_getc(rn->f); /* read next one */ - return 1; - } -} - - -/* -** Accept current char if it is in 'set' (of size 2) -*/ -static int test2 (RN *rn, const char *set) { - if (rn->c == set[0] || rn->c == set[1]) - return nextc(rn); - else return 0; -} - - -/* -** Read a sequence of (hex)digits -*/ -static int readdigits (RN *rn, int hex) { - int count = 0; - while ((hex ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) - count++; - return count; -} - - -/* -** Read a number: first reads a valid prefix of a numeral into a buffer. -** Then it calls 'lua_stringtonumber' to check whether the format is -** correct and to convert it to a Lua number -*/ -static int read_number (lua_State *L, FILE *f) { - RN rn; - int count = 0; - int hex = 0; - char decp[2]; - rn.f = f; rn.n = 0; - decp[0] = lua_getlocaledecpoint(); /* get decimal point from locale */ - decp[1] = '.'; /* always accept a dot */ - l_lockfile(rn.f); - do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ - test2(&rn, "-+"); /* optional signal */ - if (test2(&rn, "00")) { - if (test2(&rn, "xX")) hex = 1; /* numeral is hexadecimal */ - else count = 1; /* count initial '0' as a valid digit */ - } - count += readdigits(&rn, hex); /* integral part */ - if (test2(&rn, decp)) /* decimal point? */ - count += readdigits(&rn, hex); /* fractional part */ - if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) { /* exponent mark? */ - test2(&rn, "-+"); /* exponent signal */ - readdigits(&rn, 0); /* exponent digits */ - } - ungetc(rn.c, rn.f); /* unread look-ahead char */ - l_unlockfile(rn.f); - rn.buff[rn.n] = '\0'; /* finish string */ - if (lua_stringtonumber(L, rn.buff)) /* is this a valid number? */ - return 1; /* ok */ - else { /* invalid format */ - lua_pushnil(L); /* "result" to be removed */ - return 0; /* read fails */ - } -} - - -static int test_eof (lua_State *L, FILE *f) { - int c = getc(f); - ungetc(c, f); /* no-op when c == EOF */ - lua_pushliteral(L, ""); - return (c != EOF); -} - - -static int read_line (lua_State *L, FILE *f, int chop) { - luaL_Buffer b; - int c = '\0'; - luaL_buffinit(L, &b); - while (c != EOF && c != '\n') { /* repeat until end of line */ - char *buff = luaL_prepbuffer(&b); /* preallocate buffer */ - int i = 0; - l_lockfile(f); /* no memory errors can happen inside the lock */ - while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n') - buff[i++] = c; - l_unlockfile(f); - luaL_addsize(&b, i); - } - if (!chop && c == '\n') /* want a newline and have one? */ - luaL_addchar(&b, c); /* add ending newline to result */ - luaL_pushresult(&b); /* close buffer */ - /* return ok if read something (either a newline or something else) */ - return (c == '\n' || lua_rawlen(L, -1) > 0); -} - - -static void read_all (lua_State *L, FILE *f) { - size_t nr; - luaL_Buffer b; - luaL_buffinit(L, &b); - do { /* read file in chunks of LUAL_BUFFERSIZE bytes */ - char *p = luaL_prepbuffer(&b); - nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f); - luaL_addsize(&b, nr); - } while (nr == LUAL_BUFFERSIZE); - luaL_pushresult(&b); /* close buffer */ -} - - -static int read_chars (lua_State *L, FILE *f, size_t n) { - size_t nr; /* number of chars actually read */ - char *p; - luaL_Buffer b; - luaL_buffinit(L, &b); - p = luaL_prepbuffsize(&b, n); /* prepare buffer to read whole block */ - nr = fread(p, sizeof(char), n, f); /* try to read 'n' chars */ - luaL_addsize(&b, nr); - luaL_pushresult(&b); /* close buffer */ - return (nr > 0); /* true iff read something */ -} - - -static int g_read (lua_State *L, FILE *f, int first) { - int nargs = lua_gettop(L) - 1; - int success; - int n; - clearerr(f); - if (nargs == 0) { /* no arguments? */ - success = read_line(L, f, 1); - n = first+1; /* to return 1 result */ - } - else { /* ensure stack space for all results and for auxlib's buffer */ - luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); - success = 1; - for (n = first; nargs-- && success; n++) { - if (lua_type(L, n) == LUA_TNUMBER) { - size_t l = (size_t)luaL_checkinteger(L, n); - success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); - } - else { - const char *p = luaL_checkstring(L, n); - if (*p == '*') p++; /* skip optional '*' (for compatibility) */ - switch (*p) { - case 'n': /* number */ - success = read_number(L, f); - break; - case 'l': /* line */ - success = read_line(L, f, 1); - break; - case 'L': /* line with end-of-line */ - success = read_line(L, f, 0); - break; - case 'a': /* file */ - read_all(L, f); /* read entire file */ - success = 1; /* always success */ - break; - default: - return luaL_argerror(L, n, "invalid format"); - } - } - } - } - if (ferror(f)) - return luaL_fileresult(L, 0, NULL); - if (!success) { - lua_pop(L, 1); /* remove last result */ - lua_pushnil(L); /* push nil instead */ - } - return n - first; -} - - -static int io_read (lua_State *L) { - return g_read(L, getiofile(L, IO_INPUT), 1); -} - - -static int f_read (lua_State *L) { - return g_read(L, tofile(L), 2); -} - - -static int io_readline (lua_State *L) { - LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1)); - int i; - int n = (int)lua_tointeger(L, lua_upvalueindex(2)); - if (isclosed(p)) /* file is already closed? */ - return luaL_error(L, "file is already closed"); - lua_settop(L , 1); - luaL_checkstack(L, n, "too many arguments"); - for (i = 1; i <= n; i++) /* push arguments to 'g_read' */ - lua_pushvalue(L, lua_upvalueindex(3 + i)); - n = g_read(L, p->f, 2); /* 'n' is number of results */ - lua_assert(n > 0); /* should return at least a nil */ - if (lua_toboolean(L, -n)) /* read at least one value? */ - return n; /* return them */ - else { /* first result is nil: EOF or error */ - if (n > 1) { /* is there error information? */ - /* 2nd result is error message */ - return luaL_error(L, "%s", lua_tostring(L, -n + 1)); - } - if (lua_toboolean(L, lua_upvalueindex(3))) { /* generator created file? */ - lua_settop(L, 0); - lua_pushvalue(L, lua_upvalueindex(1)); - aux_close(L); /* close it */ - } - return 0; - } -} - -/* }====================================================== */ - - -static int g_write (lua_State *L, FILE *f, int arg) { - int nargs = lua_gettop(L) - arg; - int status = 1; - for (; nargs--; arg++) { - if (lua_type(L, arg) == LUA_TNUMBER) { - /* optimization: could be done exactly as for strings */ - int len = lua_isinteger(L, arg) - ? fprintf(f, LUA_INTEGER_FMT, - (LUAI_UACINT)lua_tointeger(L, arg)) - : fprintf(f, LUA_NUMBER_FMT, - (LUAI_UACNUMBER)lua_tonumber(L, arg)); - status = status && (len > 0); - } - else { - size_t l; - const char *s = luaL_checklstring(L, arg, &l); - status = status && (fwrite(s, sizeof(char), l, f) == l); - } - } - if (status) return 1; /* file handle already on stack top */ - else return luaL_fileresult(L, status, NULL); -} - - -static int io_write (lua_State *L) { - return g_write(L, getiofile(L, IO_OUTPUT), 1); -} - - -static int f_write (lua_State *L) { - FILE *f = tofile(L); - lua_pushvalue(L, 1); /* push file at the stack top (to be returned) */ - return g_write(L, f, 2); -} - - -static int f_seek (lua_State *L) { - static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; - static const char *const modenames[] = {"set", "cur", "end", NULL}; - FILE *f = tofile(L); - int op = luaL_checkoption(L, 2, "cur", modenames); - lua_Integer p3 = luaL_optinteger(L, 3, 0); - l_seeknum offset = (l_seeknum)p3; - luaL_argcheck(L, (lua_Integer)offset == p3, 3, - "not an integer in proper range"); - op = l_fseek(f, offset, mode[op]); - if (op) - return luaL_fileresult(L, 0, NULL); /* error */ - else { - lua_pushinteger(L, (lua_Integer)l_ftell(f)); - return 1; - } -} - - -static int f_setvbuf (lua_State *L) { - static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; - static const char *const modenames[] = {"no", "full", "line", NULL}; - FILE *f = tofile(L); - int op = luaL_checkoption(L, 2, NULL, modenames); - lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); - int res = setvbuf(f, NULL, mode[op], (size_t)sz); - return luaL_fileresult(L, res == 0, NULL); -} - - - -static int io_flush (lua_State *L) { - return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); -} - - -static int f_flush (lua_State *L) { - return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL); -} - - -/* -** functions for 'io' library -*/ -static const luaL_Reg iolib[] = { - {"close", io_close}, - {"flush", io_flush}, - {"input", io_input}, - {"lines", io_lines}, - {"open", io_open}, - {"output", io_output}, - {"popen", io_popen}, - {"read", io_read}, - {"tmpfile", io_tmpfile}, - {"type", io_type}, - {"write", io_write}, - {NULL, NULL} -}; - - -/* -** methods for file handles -*/ -static const luaL_Reg flib[] = { - {"close", io_close}, - {"flush", f_flush}, - {"lines", f_lines}, - {"read", f_read}, - {"seek", f_seek}, - {"setvbuf", f_setvbuf}, - {"write", f_write}, - {"__gc", f_gc}, - {"__tostring", f_tostring}, - {NULL, NULL} -}; - - -static void createmeta (lua_State *L) { - luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ - lua_pushvalue(L, -1); /* push metatable */ - lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ - luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */ - lua_pop(L, 1); /* pop new metatable */ -} - - -/* -** function to (not) close the standard files stdin, stdout, and stderr -*/ -static int io_noclose (lua_State *L) { - LStream *p = tolstream(L); - p->closef = &io_noclose; /* keep file opened */ - lua_pushnil(L); - lua_pushliteral(L, "cannot close standard file"); - return 2; -} - - -static void createstdfile (lua_State *L, FILE *f, const char *k, - const char *fname) { - LStream *p = newprefile(L); - p->f = f; - p->closef = &io_noclose; - if (k != NULL) { - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, k); /* add file to registry */ - } - lua_setfield(L, -2, fname); /* add file to module */ -} - - -LUAMOD_API int luaopen_io (lua_State *L) { - luaL_newlib(L, iolib); /* new module */ - createmeta(L); - /* create (and set) default files */ - createstdfile(L, stdin, IO_INPUT, "stdin"); - createstdfile(L, stdout, IO_OUTPUT, "stdout"); - createstdfile(L, stderr, NULL, "stderr"); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/llex.c b/deps/rcheevos/test/lua/src/llex.c deleted file mode 100644 index 70328273f7..0000000000 --- a/deps/rcheevos/test/lua/src/llex.c +++ /dev/null @@ -1,565 +0,0 @@ -/* -** $Id: llex.c,v 2.96 2016/05/02 14:02:12 roberto Exp $ -** Lexical Analyzer -** See Copyright Notice in lua.h -*/ - -#define llex_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lctype.h" -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "llex.h" -#include "lobject.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "lzio.h" - - - -#define next(ls) (ls->current = zgetc(ls->z)) - - - -#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') - - -/* ORDER RESERVED */ -static const char *const luaX_tokens [] = { - "and", "break", "do", "else", "elseif", - "end", "false", "for", "function", "goto", "if", - "in", "local", "nil", "not", "or", "repeat", - "return", "then", "true", "until", "while", - "//", "..", "...", "==", ">=", "<=", "~=", - "<<", ">>", "::", "", - "", "", "", "" -}; - - -#define save_and_next(ls) (save(ls, ls->current), next(ls)) - - -static l_noret lexerror (LexState *ls, const char *msg, int token); - - -static void save (LexState *ls, int c) { - Mbuffer *b = ls->buff; - if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) { - size_t newsize; - if (luaZ_sizebuffer(b) >= MAX_SIZE/2) - lexerror(ls, "lexical element too long", 0); - newsize = luaZ_sizebuffer(b) * 2; - luaZ_resizebuffer(ls->L, b, newsize); - } - b->buffer[luaZ_bufflen(b)++] = cast(char, c); -} - - -void luaX_init (lua_State *L) { - int i; - TString *e = luaS_newliteral(L, LUA_ENV); /* create env name */ - luaC_fix(L, obj2gco(e)); /* never collect this name */ - for (i=0; iextra = cast_byte(i+1); /* reserved word */ - } -} - - -const char *luaX_token2str (LexState *ls, int token) { - if (token < FIRST_RESERVED) { /* single-byte symbols? */ - lua_assert(token == cast_uchar(token)); - return luaO_pushfstring(ls->L, "'%c'", token); - } - else { - const char *s = luaX_tokens[token - FIRST_RESERVED]; - if (token < TK_EOS) /* fixed format (symbols and reserved words)? */ - return luaO_pushfstring(ls->L, "'%s'", s); - else /* names, strings, and numerals */ - return s; - } -} - - -static const char *txtToken (LexState *ls, int token) { - switch (token) { - case TK_NAME: case TK_STRING: - case TK_FLT: case TK_INT: - save(ls, '\0'); - return luaO_pushfstring(ls->L, "'%s'", luaZ_buffer(ls->buff)); - default: - return luaX_token2str(ls, token); - } -} - - -static l_noret lexerror (LexState *ls, const char *msg, int token) { - msg = luaG_addinfo(ls->L, msg, ls->source, ls->linenumber); - if (token) - luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); - luaD_throw(ls->L, LUA_ERRSYNTAX); -} - - -l_noret luaX_syntaxerror (LexState *ls, const char *msg) { - lexerror(ls, msg, ls->t.token); -} - - -/* -** creates a new string and anchors it in scanner's table so that -** it will not be collected until the end of the compilation -** (by that time it should be anchored somewhere) -*/ -TString *luaX_newstring (LexState *ls, const char *str, size_t l) { - lua_State *L = ls->L; - TValue *o; /* entry for 'str' */ - TString *ts = luaS_newlstr(L, str, l); /* create new string */ - setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ - o = luaH_set(L, ls->h, L->top - 1); - if (ttisnil(o)) { /* not in use yet? */ - /* boolean value does not need GC barrier; - table has no metatable, so it does not need to invalidate cache */ - setbvalue(o, 1); /* t[string] = true */ - luaC_checkGC(L); - } - else { /* string already present */ - ts = tsvalue(keyfromval(o)); /* re-use value previously stored */ - } - L->top--; /* remove string from stack */ - return ts; -} - - -/* -** increment line number and skips newline sequence (any of -** \n, \r, \n\r, or \r\n) -*/ -static void inclinenumber (LexState *ls) { - int old = ls->current; - lua_assert(currIsNewline(ls)); - next(ls); /* skip '\n' or '\r' */ - if (currIsNewline(ls) && ls->current != old) - next(ls); /* skip '\n\r' or '\r\n' */ - if (++ls->linenumber >= MAX_INT) - lexerror(ls, "chunk has too many lines", 0); -} - - -void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, - int firstchar) { - ls->t.token = 0; - ls->L = L; - ls->current = firstchar; - ls->lookahead.token = TK_EOS; /* no look-ahead token */ - ls->z = z; - ls->fs = NULL; - ls->linenumber = 1; - ls->lastline = 1; - ls->source = source; - ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */ - luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ -} - - - -/* -** ======================================================= -** LEXICAL ANALYZER -** ======================================================= -*/ - - -static int check_next1 (LexState *ls, int c) { - if (ls->current == c) { - next(ls); - return 1; - } - else return 0; -} - - -/* -** Check whether current char is in set 'set' (with two chars) and -** saves it -*/ -static int check_next2 (LexState *ls, const char *set) { - lua_assert(set[2] == '\0'); - if (ls->current == set[0] || ls->current == set[1]) { - save_and_next(ls); - return 1; - } - else return 0; -} - - -/* LUA_NUMBER */ -/* -** this function is quite liberal in what it accepts, as 'luaO_str2num' -** will reject ill-formed numerals. -*/ -static int read_numeral (LexState *ls, SemInfo *seminfo) { - TValue obj; - const char *expo = "Ee"; - int first = ls->current; - lua_assert(lisdigit(ls->current)); - save_and_next(ls); - if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ - expo = "Pp"; - for (;;) { - if (check_next2(ls, expo)) /* exponent part? */ - check_next2(ls, "-+"); /* optional exponent sign */ - if (lisxdigit(ls->current)) - save_and_next(ls); - else if (ls->current == '.') - save_and_next(ls); - else break; - } - save(ls, '\0'); - if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ - lexerror(ls, "malformed number", TK_FLT); - if (ttisinteger(&obj)) { - seminfo->i = ivalue(&obj); - return TK_INT; - } - else { - lua_assert(ttisfloat(&obj)); - seminfo->r = fltvalue(&obj); - return TK_FLT; - } -} - - -/* -** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return -** its number of '='s; otherwise, return a negative number (-1 iff there -** are no '='s after initial bracket) -*/ -static int skip_sep (LexState *ls) { - int count = 0; - int s = ls->current; - lua_assert(s == '[' || s == ']'); - save_and_next(ls); - while (ls->current == '=') { - save_and_next(ls); - count++; - } - return (ls->current == s) ? count : (-count) - 1; -} - - -static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { - int line = ls->linenumber; /* initial line (for error message) */ - save_and_next(ls); /* skip 2nd '[' */ - if (currIsNewline(ls)) /* string starts with a newline? */ - inclinenumber(ls); /* skip it */ - for (;;) { - switch (ls->current) { - case EOZ: { /* error */ - const char *what = (seminfo ? "string" : "comment"); - const char *msg = luaO_pushfstring(ls->L, - "unfinished long %s (starting at line %d)", what, line); - lexerror(ls, msg, TK_EOS); - break; /* to avoid warnings */ - } - case ']': { - if (skip_sep(ls) == sep) { - save_and_next(ls); /* skip 2nd ']' */ - goto endloop; - } - break; - } - case '\n': case '\r': { - save(ls, '\n'); - inclinenumber(ls); - if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ - break; - } - default: { - if (seminfo) save_and_next(ls); - else next(ls); - } - } - } endloop: - if (seminfo) - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), - luaZ_bufflen(ls->buff) - 2*(2 + sep)); -} - - -static void esccheck (LexState *ls, int c, const char *msg) { - if (!c) { - if (ls->current != EOZ) - save_and_next(ls); /* add current to buffer for error message */ - lexerror(ls, msg, TK_STRING); - } -} - - -static int gethexa (LexState *ls) { - save_and_next(ls); - esccheck (ls, lisxdigit(ls->current), "hexadecimal digit expected"); - return luaO_hexavalue(ls->current); -} - - -static int readhexaesc (LexState *ls) { - int r = gethexa(ls); - r = (r << 4) + gethexa(ls); - luaZ_buffremove(ls->buff, 2); /* remove saved chars from buffer */ - return r; -} - - -static unsigned long readutf8esc (LexState *ls) { - unsigned long r; - int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ - save_and_next(ls); /* skip 'u' */ - esccheck(ls, ls->current == '{', "missing '{'"); - r = gethexa(ls); /* must have at least one digit */ - while ((save_and_next(ls), lisxdigit(ls->current))) { - i++; - r = (r << 4) + luaO_hexavalue(ls->current); - esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); - } - esccheck(ls, ls->current == '}', "missing '}'"); - next(ls); /* skip '}' */ - luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ - return r; -} - - -static void utf8esc (LexState *ls) { - char buff[UTF8BUFFSZ]; - int n = luaO_utf8esc(buff, readutf8esc(ls)); - for (; n > 0; n--) /* add 'buff' to string */ - save(ls, buff[UTF8BUFFSZ - n]); -} - - -static int readdecesc (LexState *ls) { - int i; - int r = 0; /* result accumulator */ - for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */ - r = 10*r + ls->current - '0'; - save_and_next(ls); - } - esccheck(ls, r <= UCHAR_MAX, "decimal escape too large"); - luaZ_buffremove(ls->buff, i); /* remove read digits from buffer */ - return r; -} - - -static void read_string (LexState *ls, int del, SemInfo *seminfo) { - save_and_next(ls); /* keep delimiter (for error messages) */ - while (ls->current != del) { - switch (ls->current) { - case EOZ: - lexerror(ls, "unfinished string", TK_EOS); - break; /* to avoid warnings */ - case '\n': - case '\r': - lexerror(ls, "unfinished string", TK_STRING); - break; /* to avoid warnings */ - case '\\': { /* escape sequences */ - int c; /* final character to be saved */ - save_and_next(ls); /* keep '\\' for error messages */ - switch (ls->current) { - case 'a': c = '\a'; goto read_save; - case 'b': c = '\b'; goto read_save; - case 'f': c = '\f'; goto read_save; - case 'n': c = '\n'; goto read_save; - case 'r': c = '\r'; goto read_save; - case 't': c = '\t'; goto read_save; - case 'v': c = '\v'; goto read_save; - case 'x': c = readhexaesc(ls); goto read_save; - case 'u': utf8esc(ls); goto no_save; - case '\n': case '\r': - inclinenumber(ls); c = '\n'; goto only_save; - case '\\': case '\"': case '\'': - c = ls->current; goto read_save; - case EOZ: goto no_save; /* will raise an error next loop */ - case 'z': { /* zap following span of spaces */ - luaZ_buffremove(ls->buff, 1); /* remove '\\' */ - next(ls); /* skip the 'z' */ - while (lisspace(ls->current)) { - if (currIsNewline(ls)) inclinenumber(ls); - else next(ls); - } - goto no_save; - } - default: { - esccheck(ls, lisdigit(ls->current), "invalid escape sequence"); - c = readdecesc(ls); /* digital escape '\ddd' */ - goto only_save; - } - } - read_save: - next(ls); - /* go through */ - only_save: - luaZ_buffremove(ls->buff, 1); /* remove '\\' */ - save(ls, c); - /* go through */ - no_save: break; - } - default: - save_and_next(ls); - } - } - save_and_next(ls); /* skip delimiter */ - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, - luaZ_bufflen(ls->buff) - 2); -} - - -static int llex (LexState *ls, SemInfo *seminfo) { - luaZ_resetbuffer(ls->buff); - for (;;) { - switch (ls->current) { - case '\n': case '\r': { /* line breaks */ - inclinenumber(ls); - break; - } - case ' ': case '\f': case '\t': case '\v': { /* spaces */ - next(ls); - break; - } - case '-': { /* '-' or '--' (comment) */ - next(ls); - if (ls->current != '-') return '-'; - /* else is a comment */ - next(ls); - if (ls->current == '[') { /* long comment? */ - int sep = skip_sep(ls); - luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ - if (sep >= 0) { - read_long_string(ls, NULL, sep); /* skip long comment */ - luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ - break; - } - } - /* else short comment */ - while (!currIsNewline(ls) && ls->current != EOZ) - next(ls); /* skip until end of line (or end of file) */ - break; - } - case '[': { /* long string or simply '[' */ - int sep = skip_sep(ls); - if (sep >= 0) { - read_long_string(ls, seminfo, sep); - return TK_STRING; - } - else if (sep != -1) /* '[=...' missing second bracket */ - lexerror(ls, "invalid long string delimiter", TK_STRING); - return '['; - } - case '=': { - next(ls); - if (check_next1(ls, '=')) return TK_EQ; - else return '='; - } - case '<': { - next(ls); - if (check_next1(ls, '=')) return TK_LE; - else if (check_next1(ls, '<')) return TK_SHL; - else return '<'; - } - case '>': { - next(ls); - if (check_next1(ls, '=')) return TK_GE; - else if (check_next1(ls, '>')) return TK_SHR; - else return '>'; - } - case '/': { - next(ls); - if (check_next1(ls, '/')) return TK_IDIV; - else return '/'; - } - case '~': { - next(ls); - if (check_next1(ls, '=')) return TK_NE; - else return '~'; - } - case ':': { - next(ls); - if (check_next1(ls, ':')) return TK_DBCOLON; - else return ':'; - } - case '"': case '\'': { /* short literal strings */ - read_string(ls, ls->current, seminfo); - return TK_STRING; - } - case '.': { /* '.', '..', '...', or number */ - save_and_next(ls); - if (check_next1(ls, '.')) { - if (check_next1(ls, '.')) - return TK_DOTS; /* '...' */ - else return TK_CONCAT; /* '..' */ - } - else if (!lisdigit(ls->current)) return '.'; - else return read_numeral(ls, seminfo); - } - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': { - return read_numeral(ls, seminfo); - } - case EOZ: { - return TK_EOS; - } - default: { - if (lislalpha(ls->current)) { /* identifier or reserved word? */ - TString *ts; - do { - save_and_next(ls); - } while (lislalnum(ls->current)); - ts = luaX_newstring(ls, luaZ_buffer(ls->buff), - luaZ_bufflen(ls->buff)); - seminfo->ts = ts; - if (isreserved(ts)) /* reserved word? */ - return ts->extra - 1 + FIRST_RESERVED; - else { - return TK_NAME; - } - } - else { /* single-char tokens (+ - / ...) */ - int c = ls->current; - next(ls); - return c; - } - } - } - } -} - - -void luaX_next (LexState *ls) { - ls->lastline = ls->linenumber; - if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ - ls->t = ls->lookahead; /* use this one */ - ls->lookahead.token = TK_EOS; /* and discharge it */ - } - else - ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ -} - - -int luaX_lookahead (LexState *ls) { - lua_assert(ls->lookahead.token == TK_EOS); - ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); - return ls->lookahead.token; -} - diff --git a/deps/rcheevos/test/lua/src/llex.h b/deps/rcheevos/test/lua/src/llex.h deleted file mode 100644 index 2363d87e40..0000000000 --- a/deps/rcheevos/test/lua/src/llex.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -** $Id: llex.h,v 1.79 2016/05/02 14:02:12 roberto Exp $ -** Lexical Analyzer -** See Copyright Notice in lua.h -*/ - -#ifndef llex_h -#define llex_h - -#include "lobject.h" -#include "lzio.h" - - -#define FIRST_RESERVED 257 - - -#if !defined(LUA_ENV) -#define LUA_ENV "_ENV" -#endif - - -/* -* WARNING: if you change the order of this enumeration, -* grep "ORDER RESERVED" -*/ -enum RESERVED { - /* terminal symbols denoted by reserved words */ - TK_AND = FIRST_RESERVED, TK_BREAK, - TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, - TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, - TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, - /* other terminal symbols */ - TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, - TK_SHL, TK_SHR, - TK_DBCOLON, TK_EOS, - TK_FLT, TK_INT, TK_NAME, TK_STRING -}; - -/* number of reserved words */ -#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) - - -typedef union { - lua_Number r; - lua_Integer i; - TString *ts; -} SemInfo; /* semantics information */ - - -typedef struct Token { - int token; - SemInfo seminfo; -} Token; - - -/* state of the lexer plus state of the parser when shared by all - functions */ -typedef struct LexState { - int current; /* current character (charint) */ - int linenumber; /* input line counter */ - int lastline; /* line of last token 'consumed' */ - Token t; /* current token */ - Token lookahead; /* look ahead token */ - struct FuncState *fs; /* current function (parser) */ - struct lua_State *L; - ZIO *z; /* input stream */ - Mbuffer *buff; /* buffer for tokens */ - Table *h; /* to avoid collection/reuse strings */ - struct Dyndata *dyd; /* dynamic structures used by the parser */ - TString *source; /* current source name */ - TString *envn; /* environment variable name */ -} LexState; - - -LUAI_FUNC void luaX_init (lua_State *L); -LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, - TString *source, int firstchar); -LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); -LUAI_FUNC void luaX_next (LexState *ls); -LUAI_FUNC int luaX_lookahead (LexState *ls); -LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); -LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); - - -#endif diff --git a/deps/rcheevos/test/lua/src/llimits.h b/deps/rcheevos/test/lua/src/llimits.h deleted file mode 100644 index f21377fef9..0000000000 --- a/deps/rcheevos/test/lua/src/llimits.h +++ /dev/null @@ -1,323 +0,0 @@ -/* -** $Id: llimits.h,v 1.141 2015/11/19 19:16:22 roberto Exp $ -** Limits, basic types, and some other 'installation-dependent' definitions -** See Copyright Notice in lua.h -*/ - -#ifndef llimits_h -#define llimits_h - - -#include -#include - - -#include "lua.h" - -/* -** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count -** the total memory used by Lua (in bytes). Usually, 'size_t' and -** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. -*/ -#if defined(LUAI_MEM) /* { external definitions? */ -typedef LUAI_UMEM lu_mem; -typedef LUAI_MEM l_mem; -#elif LUAI_BITSINT >= 32 /* }{ */ -typedef size_t lu_mem; -typedef ptrdiff_t l_mem; -#else /* 16-bit ints */ /* }{ */ -typedef unsigned long lu_mem; -typedef long l_mem; -#endif /* } */ - - -/* chars used as small naturals (so that 'char' is reserved for characters) */ -typedef unsigned char lu_byte; - - -/* maximum value for size_t */ -#define MAX_SIZET ((size_t)(~(size_t)0)) - -/* maximum size visible for Lua (must be representable in a lua_Integer */ -#define MAX_SIZE (sizeof(size_t) < sizeof(lua_Integer) ? MAX_SIZET \ - : (size_t)(LUA_MAXINTEGER)) - - -#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) - -#define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1)) - - -#define MAX_INT INT_MAX /* maximum value of an int */ - - -/* -** conversion of pointer to unsigned integer: -** this is for hashing only; there is no problem if the integer -** cannot hold the whole pointer value -*/ -#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX)) - - - -/* type to ensure maximum alignment */ -#if defined(LUAI_USER_ALIGNMENT_T) -typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; -#else -typedef union { - lua_Number n; - double u; - void *s; - lua_Integer i; - long l; -} L_Umaxalign; -#endif - - - -/* types of 'usual argument conversions' for lua_Number and lua_Integer */ -typedef LUAI_UACNUMBER l_uacNumber; -typedef LUAI_UACINT l_uacInt; - - -/* internal assertions for in-house debugging */ -#if defined(lua_assert) -#define check_exp(c,e) (lua_assert(c), (e)) -/* to avoid problems with conditions too long */ -#define lua_longassert(c) ((c) ? (void)0 : lua_assert(0)) -#else -#define lua_assert(c) ((void)0) -#define check_exp(c,e) (e) -#define lua_longassert(c) ((void)0) -#endif - -/* -** assertion for checking API calls -*/ -#if !defined(luai_apicheck) -#define luai_apicheck(l,e) lua_assert(e) -#endif - -#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) - - -/* macro to avoid warnings about unused variables */ -#if !defined(UNUSED) -#define UNUSED(x) ((void)(x)) -#endif - - -/* type casts (a macro highlights casts in the code) */ -#define cast(t, exp) ((t)(exp)) - -#define cast_void(i) cast(void, (i)) -#define cast_byte(i) cast(lu_byte, (i)) -#define cast_num(i) cast(lua_Number, (i)) -#define cast_int(i) cast(int, (i)) -#define cast_uchar(i) cast(unsigned char, (i)) - - -/* cast a signed lua_Integer to lua_Unsigned */ -#if !defined(l_castS2U) -#define l_castS2U(i) ((lua_Unsigned)(i)) -#endif - -/* -** cast a lua_Unsigned to a signed lua_Integer; this cast is -** not strict ISO C, but two-complement architectures should -** work fine. -*/ -#if !defined(l_castU2S) -#define l_castU2S(i) ((lua_Integer)(i)) -#endif - - -/* -** non-return type -*/ -#if defined(__GNUC__) -#define l_noret void __attribute__((noreturn)) -#elif defined(_MSC_VER) && _MSC_VER >= 1200 -#define l_noret void __declspec(noreturn) -#else -#define l_noret void -#endif - - - -/* -** maximum depth for nested C calls and syntactical nested non-terminals -** in a program. (Value must fit in an unsigned short int.) -*/ -#if !defined(LUAI_MAXCCALLS) -#define LUAI_MAXCCALLS 200 -#endif - - - -/* -** type for virtual-machine instructions; -** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) -*/ -#if LUAI_BITSINT >= 32 -typedef unsigned int Instruction; -#else -typedef unsigned long Instruction; -#endif - - - -/* -** Maximum length for short strings, that is, strings that are -** internalized. (Cannot be smaller than reserved words or tags for -** metamethods, as these strings must be internalized; -** #("function") = 8, #("__newindex") = 10.) -*/ -#if !defined(LUAI_MAXSHORTLEN) -#define LUAI_MAXSHORTLEN 40 -#endif - - -/* -** Initial size for the string table (must be power of 2). -** The Lua core alone registers ~50 strings (reserved words + -** metaevent keys + a few others). Libraries would typically add -** a few dozens more. -*/ -#if !defined(MINSTRTABSIZE) -#define MINSTRTABSIZE 128 -#endif - - -/* -** Size of cache for strings in the API. 'N' is the number of -** sets (better be a prime) and "M" is the size of each set (M == 1 -** makes a direct cache.) -*/ -#if !defined(STRCACHE_N) -#define STRCACHE_N 53 -#define STRCACHE_M 2 -#endif - - -/* minimum size for string buffer */ -#if !defined(LUA_MINBUFFER) -#define LUA_MINBUFFER 32 -#endif - - -/* -** macros that are executed whenever program enters the Lua core -** ('lua_lock') and leaves the core ('lua_unlock') -*/ -#if !defined(lua_lock) -#define lua_lock(L) ((void) 0) -#define lua_unlock(L) ((void) 0) -#endif - -/* -** macro executed during Lua functions at points where the -** function can yield. -*/ -#if !defined(luai_threadyield) -#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} -#endif - - -/* -** these macros allow user-specific actions on threads when you defined -** LUAI_EXTRASPACE and need to do something extra when a thread is -** created/deleted/resumed/yielded. -*/ -#if !defined(luai_userstateopen) -#define luai_userstateopen(L) ((void)L) -#endif - -#if !defined(luai_userstateclose) -#define luai_userstateclose(L) ((void)L) -#endif - -#if !defined(luai_userstatethread) -#define luai_userstatethread(L,L1) ((void)L) -#endif - -#if !defined(luai_userstatefree) -#define luai_userstatefree(L,L1) ((void)L) -#endif - -#if !defined(luai_userstateresume) -#define luai_userstateresume(L,n) ((void)L) -#endif - -#if !defined(luai_userstateyield) -#define luai_userstateyield(L,n) ((void)L) -#endif - - - -/* -** The luai_num* macros define the primitive operations over numbers. -*/ - -/* floor division (defined as 'floor(a/b)') */ -#if !defined(luai_numidiv) -#define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) -#endif - -/* float division */ -#if !defined(luai_numdiv) -#define luai_numdiv(L,a,b) ((a)/(b)) -#endif - -/* -** modulo: defined as 'a - floor(a/b)*b'; this definition gives NaN when -** 'b' is huge, but the result should be 'a'. 'fmod' gives the result of -** 'a - trunc(a/b)*b', and therefore must be corrected when 'trunc(a/b) -** ~= floor(a/b)'. That happens when the division has a non-integer -** negative result, which is equivalent to the test below. -*/ -#if !defined(luai_nummod) -#define luai_nummod(L,a,b,m) \ - { (m) = l_mathop(fmod)(a,b); if ((m)*(b) < 0) (m) += (b); } -#endif - -/* exponentiation */ -#if !defined(luai_numpow) -#define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b)) -#endif - -/* the others are quite standard operations */ -#if !defined(luai_numadd) -#define luai_numadd(L,a,b) ((a)+(b)) -#define luai_numsub(L,a,b) ((a)-(b)) -#define luai_nummul(L,a,b) ((a)*(b)) -#define luai_numunm(L,a) (-(a)) -#define luai_numeq(a,b) ((a)==(b)) -#define luai_numlt(a,b) ((a)<(b)) -#define luai_numle(a,b) ((a)<=(b)) -#define luai_numisnan(a) (!luai_numeq((a), (a))) -#endif - - - - - -/* -** macro to control inclusion of some hard tests on stack reallocation -*/ -#if !defined(HARDSTACKTESTS) -#define condmovestack(L,pre,pos) ((void)0) -#else -/* realloc stack keeping its size */ -#define condmovestack(L,pre,pos) \ - { int sz_ = (L)->stacksize; pre; luaD_reallocstack((L), sz_); pos; } -#endif - -#if !defined(HARDMEMTESTS) -#define condchangemem(L,pre,pos) ((void)0) -#else -#define condchangemem(L,pre,pos) \ - { if (G(L)->gcrunning) { pre; luaC_fullgc(L, 0); pos; } } -#endif - -#endif diff --git a/deps/rcheevos/test/lua/src/lmathlib.c b/deps/rcheevos/test/lua/src/lmathlib.c deleted file mode 100644 index b7f8baee07..0000000000 --- a/deps/rcheevos/test/lua/src/lmathlib.c +++ /dev/null @@ -1,410 +0,0 @@ -/* -** $Id: lmathlib.c,v 1.119 2016/12/22 13:08:50 roberto Exp $ -** Standard mathematical library -** See Copyright Notice in lua.h -*/ - -#define lmathlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#undef PI -#define PI (l_mathop(3.141592653589793238462643383279502884)) - - -#if !defined(l_rand) /* { */ -#if defined(LUA_USE_POSIX) -#define l_rand() random() -#define l_srand(x) srandom(x) -#define L_RANDMAX 2147483647 /* (2^31 - 1), following POSIX */ -#else -#define l_rand() rand() -#define l_srand(x) srand(x) -#define L_RANDMAX RAND_MAX -#endif -#endif /* } */ - - -static int math_abs (lua_State *L) { - if (lua_isinteger(L, 1)) { - lua_Integer n = lua_tointeger(L, 1); - if (n < 0) n = (lua_Integer)(0u - (lua_Unsigned)n); - lua_pushinteger(L, n); - } - else - lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sin (lua_State *L) { - lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_cos (lua_State *L) { - lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tan (lua_State *L) { - lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_asin (lua_State *L) { - lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_acos (lua_State *L) { - lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_atan (lua_State *L) { - lua_Number y = luaL_checknumber(L, 1); - lua_Number x = luaL_optnumber(L, 2, 1); - lua_pushnumber(L, l_mathop(atan2)(y, x)); - return 1; -} - - -static int math_toint (lua_State *L) { - int valid; - lua_Integer n = lua_tointegerx(L, 1, &valid); - if (valid) - lua_pushinteger(L, n); - else { - luaL_checkany(L, 1); - lua_pushnil(L); /* value is not convertible to integer */ - } - return 1; -} - - -static void pushnumint (lua_State *L, lua_Number d) { - lua_Integer n; - if (lua_numbertointeger(d, &n)) /* does 'd' fit in an integer? */ - lua_pushinteger(L, n); /* result is integer */ - else - lua_pushnumber(L, d); /* result is float */ -} - - -static int math_floor (lua_State *L) { - if (lua_isinteger(L, 1)) - lua_settop(L, 1); /* integer is its own floor */ - else { - lua_Number d = l_mathop(floor)(luaL_checknumber(L, 1)); - pushnumint(L, d); - } - return 1; -} - - -static int math_ceil (lua_State *L) { - if (lua_isinteger(L, 1)) - lua_settop(L, 1); /* integer is its own ceil */ - else { - lua_Number d = l_mathop(ceil)(luaL_checknumber(L, 1)); - pushnumint(L, d); - } - return 1; -} - - -static int math_fmod (lua_State *L) { - if (lua_isinteger(L, 1) && lua_isinteger(L, 2)) { - lua_Integer d = lua_tointeger(L, 2); - if ((lua_Unsigned)d + 1u <= 1u) { /* special cases: -1 or 0 */ - luaL_argcheck(L, d != 0, 2, "zero"); - lua_pushinteger(L, 0); /* avoid overflow with 0x80000... / -1 */ - } - else - lua_pushinteger(L, lua_tointeger(L, 1) % d); - } - else - lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1), - luaL_checknumber(L, 2))); - return 1; -} - - -/* -** next function does not use 'modf', avoiding problems with 'double*' -** (which is not compatible with 'float*') when lua_Number is not -** 'double'. -*/ -static int math_modf (lua_State *L) { - if (lua_isinteger(L ,1)) { - lua_settop(L, 1); /* number is its own integer part */ - lua_pushnumber(L, 0); /* no fractional part */ - } - else { - lua_Number n = luaL_checknumber(L, 1); - /* integer part (rounds toward zero) */ - lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); - pushnumint(L, ip); - /* fractional part (test needed for inf/-inf) */ - lua_pushnumber(L, (n == ip) ? l_mathop(0.0) : (n - ip)); - } - return 2; -} - - -static int math_sqrt (lua_State *L) { - lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1))); - return 1; -} - - -static int math_ult (lua_State *L) { - lua_Integer a = luaL_checkinteger(L, 1); - lua_Integer b = luaL_checkinteger(L, 2); - lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b); - return 1; -} - -static int math_log (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - lua_Number res; - if (lua_isnoneornil(L, 2)) - res = l_mathop(log)(x); - else { - lua_Number base = luaL_checknumber(L, 2); -#if !defined(LUA_USE_C89) - if (base == l_mathop(2.0)) - res = l_mathop(log2)(x); else -#endif - if (base == l_mathop(10.0)) - res = l_mathop(log10)(x); - else - res = l_mathop(log)(x)/l_mathop(log)(base); - } - lua_pushnumber(L, res); - return 1; -} - -static int math_exp (lua_State *L) { - lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_deg (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1) * (l_mathop(180.0) / PI)); - return 1; -} - -static int math_rad (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1) * (PI / l_mathop(180.0))); - return 1; -} - - -static int math_min (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int imin = 1; /* index of current minimum value */ - int i; - luaL_argcheck(L, n >= 1, 1, "value expected"); - for (i = 2; i <= n; i++) { - if (lua_compare(L, i, imin, LUA_OPLT)) - imin = i; - } - lua_pushvalue(L, imin); - return 1; -} - - -static int math_max (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int imax = 1; /* index of current maximum value */ - int i; - luaL_argcheck(L, n >= 1, 1, "value expected"); - for (i = 2; i <= n; i++) { - if (lua_compare(L, imax, i, LUA_OPLT)) - imax = i; - } - lua_pushvalue(L, imax); - return 1; -} - -/* -** This function uses 'double' (instead of 'lua_Number') to ensure that -** all bits from 'l_rand' can be represented, and that 'RANDMAX + 1.0' -** will keep full precision (ensuring that 'r' is always less than 1.0.) -*/ -static int math_random (lua_State *L) { - lua_Integer low, up; - double r = (double)l_rand() * (1.0 / ((double)L_RANDMAX + 1.0)); - switch (lua_gettop(L)) { /* check number of arguments */ - case 0: { /* no arguments */ - lua_pushnumber(L, (lua_Number)r); /* Number between 0 and 1 */ - return 1; - } - case 1: { /* only upper limit */ - low = 1; - up = luaL_checkinteger(L, 1); - break; - } - case 2: { /* lower and upper limits */ - low = luaL_checkinteger(L, 1); - up = luaL_checkinteger(L, 2); - break; - } - default: return luaL_error(L, "wrong number of arguments"); - } - /* random integer in the interval [low, up] */ - luaL_argcheck(L, low <= up, 1, "interval is empty"); - luaL_argcheck(L, low >= 0 || up <= LUA_MAXINTEGER + low, 1, - "interval too large"); - r *= (double)(up - low) + 1.0; - lua_pushinteger(L, (lua_Integer)r + low); - return 1; -} - - -static int math_randomseed (lua_State *L) { - l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); - (void)l_rand(); /* discard first value to avoid undesirable correlations */ - return 0; -} - - -static int math_type (lua_State *L) { - if (lua_type(L, 1) == LUA_TNUMBER) { - if (lua_isinteger(L, 1)) - lua_pushliteral(L, "integer"); - else - lua_pushliteral(L, "float"); - } - else { - luaL_checkany(L, 1); - lua_pushnil(L); - } - return 1; -} - - -/* -** {================================================================== -** Deprecated functions (for compatibility only) -** =================================================================== -*/ -#if defined(LUA_COMPAT_MATHLIB) - -static int math_cosh (lua_State *L) { - lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sinh (lua_State *L) { - lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tanh (lua_State *L) { - lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_pow (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - lua_Number y = luaL_checknumber(L, 2); - lua_pushnumber(L, l_mathop(pow)(x, y)); - return 1; -} - -static int math_frexp (lua_State *L) { - int e; - lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e)); - lua_pushinteger(L, e); - return 2; -} - -static int math_ldexp (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - int ep = (int)luaL_checkinteger(L, 2); - lua_pushnumber(L, l_mathop(ldexp)(x, ep)); - return 1; -} - -static int math_log10 (lua_State *L) { - lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1))); - return 1; -} - -#endif -/* }================================================================== */ - - - -static const luaL_Reg mathlib[] = { - {"abs", math_abs}, - {"acos", math_acos}, - {"asin", math_asin}, - {"atan", math_atan}, - {"ceil", math_ceil}, - {"cos", math_cos}, - {"deg", math_deg}, - {"exp", math_exp}, - {"tointeger", math_toint}, - {"floor", math_floor}, - {"fmod", math_fmod}, - {"ult", math_ult}, - {"log", math_log}, - {"max", math_max}, - {"min", math_min}, - {"modf", math_modf}, - {"rad", math_rad}, - {"random", math_random}, - {"randomseed", math_randomseed}, - {"sin", math_sin}, - {"sqrt", math_sqrt}, - {"tan", math_tan}, - {"type", math_type}, -#if defined(LUA_COMPAT_MATHLIB) - {"atan2", math_atan}, - {"cosh", math_cosh}, - {"sinh", math_sinh}, - {"tanh", math_tanh}, - {"pow", math_pow}, - {"frexp", math_frexp}, - {"ldexp", math_ldexp}, - {"log10", math_log10}, -#endif - /* placeholders */ - {"pi", NULL}, - {"huge", NULL}, - {"maxinteger", NULL}, - {"mininteger", NULL}, - {NULL, NULL} -}; - - -/* -** Open math library -*/ -LUAMOD_API int luaopen_math (lua_State *L) { - luaL_newlib(L, mathlib); - lua_pushnumber(L, PI); - lua_setfield(L, -2, "pi"); - lua_pushnumber(L, (lua_Number)HUGE_VAL); - lua_setfield(L, -2, "huge"); - lua_pushinteger(L, LUA_MAXINTEGER); - lua_setfield(L, -2, "maxinteger"); - lua_pushinteger(L, LUA_MININTEGER); - lua_setfield(L, -2, "mininteger"); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/lmem.c b/deps/rcheevos/test/lua/src/lmem.c deleted file mode 100644 index 0a0476cc77..0000000000 --- a/deps/rcheevos/test/lua/src/lmem.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -** $Id: lmem.c,v 1.91 2015/03/06 19:45:54 roberto Exp $ -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - -#define lmem_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -/* -** About the realloc function: -** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); -** ('osize' is the old size, 'nsize' is the new size) -** -** * frealloc(ud, NULL, x, s) creates a new block of size 's' (no -** matter 'x'). -** -** * frealloc(ud, p, x, 0) frees the block 'p' -** (in this specific case, frealloc must return NULL); -** particularly, frealloc(ud, NULL, 0, 0) does nothing -** (which is equivalent to free(NULL) in ISO C) -** -** frealloc returns NULL if it cannot create or reallocate the area -** (any reallocation to an equal or smaller size cannot fail!) -*/ - - - -#define MINSIZEARRAY 4 - - -void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, - int limit, const char *what) { - void *newblock; - int newsize; - if (*size >= limit/2) { /* cannot double it? */ - if (*size >= limit) /* cannot grow even a little? */ - luaG_runerror(L, "too many %s (limit is %d)", what, limit); - newsize = limit; /* still have at least one free place */ - } - else { - newsize = (*size)*2; - if (newsize < MINSIZEARRAY) - newsize = MINSIZEARRAY; /* minimum size */ - } - newblock = luaM_reallocv(L, block, *size, newsize, size_elems); - *size = newsize; /* update only when everything else is OK */ - return newblock; -} - - -l_noret luaM_toobig (lua_State *L) { - luaG_runerror(L, "memory allocation error: block too big"); -} - - - -/* -** generic allocation routine. -*/ -void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { - void *newblock; - global_State *g = G(L); - size_t realosize = (block) ? osize : 0; - lua_assert((realosize == 0) == (block == NULL)); -#if defined(HARDMEMTESTS) - if (nsize > realosize && g->gcrunning) - luaC_fullgc(L, 1); /* force a GC whenever possible */ -#endif - newblock = (*g->frealloc)(g->ud, block, osize, nsize); - if (newblock == NULL && nsize > 0) { - lua_assert(nsize > realosize); /* cannot fail when shrinking a block */ - if (g->version) { /* is state fully built? */ - luaC_fullgc(L, 1); /* try to free some memory... */ - newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ - } - if (newblock == NULL) - luaD_throw(L, LUA_ERRMEM); - } - lua_assert((nsize == 0) == (newblock == NULL)); - g->GCdebt = (g->GCdebt + nsize) - realosize; - return newblock; -} - diff --git a/deps/rcheevos/test/lua/src/lmem.h b/deps/rcheevos/test/lua/src/lmem.h deleted file mode 100644 index 30f484895e..0000000000 --- a/deps/rcheevos/test/lua/src/lmem.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -** $Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp $ -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - -#ifndef lmem_h -#define lmem_h - - -#include - -#include "llimits.h" -#include "lua.h" - - -/* -** This macro reallocs a vector 'b' from 'on' to 'n' elements, where -** each element has size 'e'. In case of arithmetic overflow of the -** product 'n'*'e', it raises an error (calling 'luaM_toobig'). Because -** 'e' is always constant, it avoids the runtime division MAX_SIZET/(e). -** -** (The macro is somewhat complex to avoid warnings: The 'sizeof' -** comparison avoids a runtime comparison when overflow cannot occur. -** The compiler should be able to optimize the real test by itself, but -** when it does it, it may give a warning about "comparison is always -** false due to limited range of data type"; the +1 tricks the compiler, -** avoiding this warning but also this optimization.) -*/ -#define luaM_reallocv(L,b,on,n,e) \ - (((sizeof(n) >= sizeof(size_t) && cast(size_t, (n)) + 1 > MAX_SIZET/(e)) \ - ? luaM_toobig(L) : cast_void(0)) , \ - luaM_realloc_(L, (b), (on)*(e), (n)*(e))) - -/* -** Arrays of chars do not need any test -*/ -#define luaM_reallocvchar(L,b,on,n) \ - cast(char *, luaM_realloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) - -#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) -#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) -#define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) - -#define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) -#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) -#define luaM_newvector(L,n,t) \ - cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) - -#define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) - -#define luaM_growvector(L,v,nelems,size,t,limit,e) \ - if ((nelems)+1 > (size)) \ - ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) - -#define luaM_reallocvector(L, v,oldn,n,t) \ - ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) - -LUAI_FUNC l_noret luaM_toobig (lua_State *L); - -/* not to be called directly */ -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, - size_t size); -LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, - size_t size_elem, int limit, - const char *what); - -#endif - diff --git a/deps/rcheevos/test/lua/src/loadlib.c b/deps/rcheevos/test/lua/src/loadlib.c deleted file mode 100644 index 4791e748b1..0000000000 --- a/deps/rcheevos/test/lua/src/loadlib.c +++ /dev/null @@ -1,790 +0,0 @@ -/* -** $Id: loadlib.c,v 1.130 2017/01/12 17:14:26 roberto Exp $ -** Dynamic library loader for Lua -** See Copyright Notice in lua.h -** -** This module contains an implementation of loadlib for Unix systems -** that have dlfcn, an implementation for Windows, and a stub for other -** systems. -*/ - -#define loadlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** LUA_IGMARK is a mark to ignore all before it when building the -** luaopen_ function name. -*/ -#if !defined (LUA_IGMARK) -#define LUA_IGMARK "-" -#endif - - -/* -** LUA_CSUBSEP is the character that replaces dots in submodule names -** when searching for a C loader. -** LUA_LSUBSEP is the character that replaces dots in submodule names -** when searching for a Lua loader. -*/ -#if !defined(LUA_CSUBSEP) -#define LUA_CSUBSEP LUA_DIRSEP -#endif - -#if !defined(LUA_LSUBSEP) -#define LUA_LSUBSEP LUA_DIRSEP -#endif - - -/* prefix for open functions in C libraries */ -#define LUA_POF "luaopen_" - -/* separator for open functions in C libraries */ -#define LUA_OFSEP "_" - - -/* -** unique key for table in the registry that keeps handles -** for all loaded C libraries -*/ -static const int CLIBS = 0; - -#define LIB_FAIL "open" - - -#define setprogdir(L) ((void)0) - - -/* -** system-dependent functions -*/ - -/* -** unload library 'lib' -*/ -static void lsys_unloadlib (void *lib); - -/* -** load C library in file 'path'. If 'seeglb', load with all names in -** the library global. -** Returns the library; in case of error, returns NULL plus an -** error string in the stack. -*/ -static void *lsys_load (lua_State *L, const char *path, int seeglb); - -/* -** Try to find a function named 'sym' in library 'lib'. -** Returns the function; in case of error, returns NULL plus an -** error string in the stack. -*/ -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym); - - - - -#if defined(LUA_USE_DLOPEN) /* { */ -/* -** {======================================================================== -** This is an implementation of loadlib based on the dlfcn interface. -** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, -** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least -** as an emulation layer on top of native functions. -** ========================================================================= -*/ - -#include - -/* -** Macro to convert pointer-to-void* to pointer-to-function. This cast -** is undefined according to ISO C, but POSIX assumes that it works. -** (The '__extension__' in gnu compilers is only to avoid warnings.) -*/ -#if defined(__GNUC__) -#define cast_func(p) (__extension__ (lua_CFunction)(p)) -#else -#define cast_func(p) ((lua_CFunction)(p)) -#endif - - -static void lsys_unloadlib (void *lib) { - dlclose(lib); -} - - -static void *lsys_load (lua_State *L, const char *path, int seeglb) { - void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL)); - if (lib == NULL) lua_pushstring(L, dlerror()); - return lib; -} - - -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = cast_func(dlsym(lib, sym)); - if (f == NULL) lua_pushstring(L, dlerror()); - return f; -} - -/* }====================================================== */ - - - -#elif defined(LUA_DL_DLL) /* }{ */ -/* -** {====================================================================== -** This is an implementation of loadlib for Windows using native functions. -** ======================================================================= -*/ - -#include - - -/* -** optional flags for LoadLibraryEx -*/ -#if !defined(LUA_LLE_FLAGS) -#define LUA_LLE_FLAGS 0 -#endif - - -#undef setprogdir - - -/* -** Replace in the path (on the top of the stack) any occurrence -** of LUA_EXEC_DIR with the executable's path. -*/ -static void setprogdir (lua_State *L) { - char buff[MAX_PATH + 1]; - char *lb; - DWORD nsize = sizeof(buff)/sizeof(char); - DWORD n = GetModuleFileNameA(NULL, buff, nsize); /* get exec. name */ - if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) - luaL_error(L, "unable to get ModuleFileName"); - else { - *lb = '\0'; /* cut name on the last '\\' to get the path */ - luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff); - lua_remove(L, -2); /* remove original string */ - } -} - - - - -static void pusherror (lua_State *L) { - int error = GetLastError(); - char buffer[128]; - if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL)) - lua_pushstring(L, buffer); - else - lua_pushfstring(L, "system error %d\n", error); -} - -static void lsys_unloadlib (void *lib) { - FreeLibrary((HMODULE)lib); -} - - -static void *lsys_load (lua_State *L, const char *path, int seeglb) { - HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS); - (void)(seeglb); /* not used: symbols are 'global' by default */ - if (lib == NULL) pusherror(L); - return lib; -} - - -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym); - if (f == NULL) pusherror(L); - return f; -} - -/* }====================================================== */ - - -#else /* }{ */ -/* -** {====================================================== -** Fallback for other systems -** ======================================================= -*/ - -#undef LIB_FAIL -#define LIB_FAIL "absent" - - -#define DLMSG "dynamic libraries not enabled; check your Lua installation" - - -static void lsys_unloadlib (void *lib) { - (void)(lib); /* not used */ -} - - -static void *lsys_load (lua_State *L, const char *path, int seeglb) { - (void)(path); (void)(seeglb); /* not used */ - lua_pushliteral(L, DLMSG); - return NULL; -} - - -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - (void)(lib); (void)(sym); /* not used */ - lua_pushliteral(L, DLMSG); - return NULL; -} - -/* }====================================================== */ -#endif /* } */ - - -/* -** {================================================================== -** Set Paths -** =================================================================== -*/ - -/* -** LUA_PATH_VAR and LUA_CPATH_VAR are the names of the environment -** variables that Lua check to set its paths. -*/ -#if !defined(LUA_PATH_VAR) -#define LUA_PATH_VAR "LUA_PATH" -#endif - -#if !defined(LUA_CPATH_VAR) -#define LUA_CPATH_VAR "LUA_CPATH" -#endif - - -#define AUXMARK "\1" /* auxiliary mark */ - - -/* -** return registry.LUA_NOENV as a boolean -*/ -static int noenv (lua_State *L) { - int b; - lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); - b = lua_toboolean(L, -1); - lua_pop(L, 1); /* remove value */ - return b; -} - - -/* -** Set a path -*/ -static void setpath (lua_State *L, const char *fieldname, - const char *envname, - const char *dft) { - const char *nver = lua_pushfstring(L, "%s%s", envname, LUA_VERSUFFIX); - const char *path = getenv(nver); /* use versioned name */ - if (path == NULL) /* no environment variable? */ - path = getenv(envname); /* try unversioned name */ - if (path == NULL || noenv(L)) /* no environment variable? */ - lua_pushstring(L, dft); /* use default */ - else { - /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ - path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP, - LUA_PATH_SEP AUXMARK LUA_PATH_SEP); - luaL_gsub(L, path, AUXMARK, dft); - lua_remove(L, -2); /* remove result from 1st 'gsub' */ - } - setprogdir(L); - lua_setfield(L, -3, fieldname); /* package[fieldname] = path value */ - lua_pop(L, 1); /* pop versioned variable name */ -} - -/* }================================================================== */ - - -/* -** return registry.CLIBS[path] -*/ -static void *checkclib (lua_State *L, const char *path) { - void *plib; - lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); - lua_getfield(L, -1, path); - plib = lua_touserdata(L, -1); /* plib = CLIBS[path] */ - lua_pop(L, 2); /* pop CLIBS table and 'plib' */ - return plib; -} - - -/* -** registry.CLIBS[path] = plib -- for queries -** registry.CLIBS[#CLIBS + 1] = plib -- also keep a list of all libraries -*/ -static void addtoclib (lua_State *L, const char *path, void *plib) { - lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); - lua_pushlightuserdata(L, plib); - lua_pushvalue(L, -1); - lua_setfield(L, -3, path); /* CLIBS[path] = plib */ - lua_rawseti(L, -2, luaL_len(L, -2) + 1); /* CLIBS[#CLIBS + 1] = plib */ - lua_pop(L, 1); /* pop CLIBS table */ -} - - -/* -** __gc tag method for CLIBS table: calls 'lsys_unloadlib' for all lib -** handles in list CLIBS -*/ -static int gctm (lua_State *L) { - lua_Integer n = luaL_len(L, 1); - for (; n >= 1; n--) { /* for each handle, in reverse order */ - lua_rawgeti(L, 1, n); /* get handle CLIBS[n] */ - lsys_unloadlib(lua_touserdata(L, -1)); - lua_pop(L, 1); /* pop handle */ - } - return 0; -} - - - -/* error codes for 'lookforfunc' */ -#define ERRLIB 1 -#define ERRFUNC 2 - -/* -** Look for a C function named 'sym' in a dynamically loaded library -** 'path'. -** First, check whether the library is already loaded; if not, try -** to load it. -** Then, if 'sym' is '*', return true (as library has been loaded). -** Otherwise, look for symbol 'sym' in the library and push a -** C function with that symbol. -** Return 0 and 'true' or a function in the stack; in case of -** errors, return an error code and an error message in the stack. -*/ -static int lookforfunc (lua_State *L, const char *path, const char *sym) { - void *reg = checkclib(L, path); /* check loaded C libraries */ - if (reg == NULL) { /* must load library? */ - reg = lsys_load(L, path, *sym == '*'); /* global symbols if 'sym'=='*' */ - if (reg == NULL) return ERRLIB; /* unable to load library */ - addtoclib(L, path, reg); - } - if (*sym == '*') { /* loading only library (no function)? */ - lua_pushboolean(L, 1); /* return 'true' */ - return 0; /* no errors */ - } - else { - lua_CFunction f = lsys_sym(L, reg, sym); - if (f == NULL) - return ERRFUNC; /* unable to find function */ - lua_pushcfunction(L, f); /* else create new function */ - return 0; /* no errors */ - } -} - - -static int ll_loadlib (lua_State *L) { - const char *path = luaL_checkstring(L, 1); - const char *init = luaL_checkstring(L, 2); - int stat = lookforfunc(L, path, init); - if (stat == 0) /* no errors? */ - return 1; /* return the loaded function */ - else { /* error; error message is on stack top */ - lua_pushnil(L); - lua_insert(L, -2); - lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); - return 3; /* return nil, error message, and where */ - } -} - - - -/* -** {====================================================== -** 'require' function -** ======================================================= -*/ - - -static int readable (const char *filename) { - FILE *f = fopen(filename, "r"); /* try to open file */ - if (f == NULL) return 0; /* open failed */ - fclose(f); - return 1; -} - - -static const char *pushnexttemplate (lua_State *L, const char *path) { - const char *l; - while (*path == *LUA_PATH_SEP) path++; /* skip separators */ - if (*path == '\0') return NULL; /* no more templates */ - l = strchr(path, *LUA_PATH_SEP); /* find next separator */ - if (l == NULL) l = path + strlen(path); - lua_pushlstring(L, path, l - path); /* template */ - return l; -} - - -static const char *searchpath (lua_State *L, const char *name, - const char *path, - const char *sep, - const char *dirsep) { - luaL_Buffer msg; /* to build error message */ - luaL_buffinit(L, &msg); - if (*sep != '\0') /* non-empty separator? */ - name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */ - while ((path = pushnexttemplate(L, path)) != NULL) { - const char *filename = luaL_gsub(L, lua_tostring(L, -1), - LUA_PATH_MARK, name); - lua_remove(L, -2); /* remove path template */ - if (readable(filename)) /* does file exist and is readable? */ - return filename; /* return that file name */ - lua_pushfstring(L, "\n\tno file '%s'", filename); - lua_remove(L, -2); /* remove file name */ - luaL_addvalue(&msg); /* concatenate error msg. entry */ - } - luaL_pushresult(&msg); /* create error message */ - return NULL; /* not found */ -} - - -static int ll_searchpath (lua_State *L) { - const char *f = searchpath(L, luaL_checkstring(L, 1), - luaL_checkstring(L, 2), - luaL_optstring(L, 3, "."), - luaL_optstring(L, 4, LUA_DIRSEP)); - if (f != NULL) return 1; - else { /* error message is on top of the stack */ - lua_pushnil(L); - lua_insert(L, -2); - return 2; /* return nil + error message */ - } -} - - -static const char *findfile (lua_State *L, const char *name, - const char *pname, - const char *dirsep) { - const char *path; - lua_getfield(L, lua_upvalueindex(1), pname); - path = lua_tostring(L, -1); - if (path == NULL) - luaL_error(L, "'package.%s' must be a string", pname); - return searchpath(L, name, path, ".", dirsep); -} - - -static int checkload (lua_State *L, int stat, const char *filename) { - if (stat) { /* module loaded successfully? */ - lua_pushstring(L, filename); /* will be 2nd argument to module */ - return 2; /* return open function and file name */ - } - else - return luaL_error(L, "error loading module '%s' from file '%s':\n\t%s", - lua_tostring(L, 1), filename, lua_tostring(L, -1)); -} - - -static int searcher_Lua (lua_State *L) { - const char *filename; - const char *name = luaL_checkstring(L, 1); - filename = findfile(L, name, "path", LUA_LSUBSEP); - if (filename == NULL) return 1; /* module not found in this path */ - return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename); -} - - -/* -** Try to find a load function for module 'modname' at file 'filename'. -** First, change '.' to '_' in 'modname'; then, if 'modname' has -** the form X-Y (that is, it has an "ignore mark"), build a function -** name "luaopen_X" and look for it. (For compatibility, if that -** fails, it also tries "luaopen_Y".) If there is no ignore mark, -** look for a function named "luaopen_modname". -*/ -static int loadfunc (lua_State *L, const char *filename, const char *modname) { - const char *openfunc; - const char *mark; - modname = luaL_gsub(L, modname, ".", LUA_OFSEP); - mark = strchr(modname, *LUA_IGMARK); - if (mark) { - int stat; - openfunc = lua_pushlstring(L, modname, mark - modname); - openfunc = lua_pushfstring(L, LUA_POF"%s", openfunc); - stat = lookforfunc(L, filename, openfunc); - if (stat != ERRFUNC) return stat; - modname = mark + 1; /* else go ahead and try old-style name */ - } - openfunc = lua_pushfstring(L, LUA_POF"%s", modname); - return lookforfunc(L, filename, openfunc); -} - - -static int searcher_C (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - const char *filename = findfile(L, name, "cpath", LUA_CSUBSEP); - if (filename == NULL) return 1; /* module not found in this path */ - return checkload(L, (loadfunc(L, filename, name) == 0), filename); -} - - -static int searcher_Croot (lua_State *L) { - const char *filename; - const char *name = luaL_checkstring(L, 1); - const char *p = strchr(name, '.'); - int stat; - if (p == NULL) return 0; /* is root */ - lua_pushlstring(L, name, p - name); - filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP); - if (filename == NULL) return 1; /* root not found */ - if ((stat = loadfunc(L, filename, name)) != 0) { - if (stat != ERRFUNC) - return checkload(L, 0, filename); /* real error */ - else { /* open function not found */ - lua_pushfstring(L, "\n\tno module '%s' in file '%s'", name, filename); - return 1; - } - } - lua_pushstring(L, filename); /* will be 2nd argument to module */ - return 2; -} - - -static int searcher_preload (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - lua_getfield(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); - if (lua_getfield(L, -1, name) == LUA_TNIL) /* not found? */ - lua_pushfstring(L, "\n\tno field package.preload['%s']", name); - return 1; -} - - -static void findloader (lua_State *L, const char *name) { - int i; - luaL_Buffer msg; /* to build error message */ - luaL_buffinit(L, &msg); - /* push 'package.searchers' to index 3 in the stack */ - if (lua_getfield(L, lua_upvalueindex(1), "searchers") != LUA_TTABLE) - luaL_error(L, "'package.searchers' must be a table"); - /* iterate over available searchers to find a loader */ - for (i = 1; ; i++) { - if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ - lua_pop(L, 1); /* remove nil */ - luaL_pushresult(&msg); /* create error message */ - luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); - } - lua_pushstring(L, name); - lua_call(L, 1, 2); /* call it */ - if (lua_isfunction(L, -2)) /* did it find a loader? */ - return; /* module loader found */ - else if (lua_isstring(L, -2)) { /* searcher returned error message? */ - lua_pop(L, 1); /* remove extra return */ - luaL_addvalue(&msg); /* concatenate error message */ - } - else - lua_pop(L, 2); /* remove both returns */ - } -} - - -static int ll_require (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - lua_settop(L, 1); /* LOADED table will be at index 2 */ - lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); - lua_getfield(L, 2, name); /* LOADED[name] */ - if (lua_toboolean(L, -1)) /* is it there? */ - return 1; /* package is already loaded */ - /* else must load package */ - lua_pop(L, 1); /* remove 'getfield' result */ - findloader(L, name); - lua_pushstring(L, name); /* pass name as argument to module loader */ - lua_insert(L, -2); /* name is 1st argument (before search data) */ - lua_call(L, 2, 1); /* run loader to load module */ - if (!lua_isnil(L, -1)) /* non-nil return? */ - lua_setfield(L, 2, name); /* LOADED[name] = returned value */ - if (lua_getfield(L, 2, name) == LUA_TNIL) { /* module set no value? */ - lua_pushboolean(L, 1); /* use true as result */ - lua_pushvalue(L, -1); /* extra copy to be returned */ - lua_setfield(L, 2, name); /* LOADED[name] = true */ - } - return 1; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** 'module' function -** ======================================================= -*/ -#if defined(LUA_COMPAT_MODULE) - -/* -** changes the environment variable of calling function -*/ -static void set_env (lua_State *L) { - lua_Debug ar; - if (lua_getstack(L, 1, &ar) == 0 || - lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ - lua_iscfunction(L, -1)) - luaL_error(L, "'module' not called from a Lua function"); - lua_pushvalue(L, -2); /* copy new environment table to top */ - lua_setupvalue(L, -2, 1); - lua_pop(L, 1); /* remove function */ -} - - -static void dooptions (lua_State *L, int n) { - int i; - for (i = 2; i <= n; i++) { - if (lua_isfunction(L, i)) { /* avoid 'calling' extra info. */ - lua_pushvalue(L, i); /* get option (a function) */ - lua_pushvalue(L, -2); /* module */ - lua_call(L, 1, 0); - } - } -} - - -static void modinit (lua_State *L, const char *modname) { - const char *dot; - lua_pushvalue(L, -1); - lua_setfield(L, -2, "_M"); /* module._M = module */ - lua_pushstring(L, modname); - lua_setfield(L, -2, "_NAME"); - dot = strrchr(modname, '.'); /* look for last dot in module name */ - if (dot == NULL) dot = modname; - else dot++; - /* set _PACKAGE as package name (full module name minus last part) */ - lua_pushlstring(L, modname, dot - modname); - lua_setfield(L, -2, "_PACKAGE"); -} - - -static int ll_module (lua_State *L) { - const char *modname = luaL_checkstring(L, 1); - int lastarg = lua_gettop(L); /* last parameter */ - luaL_pushmodule(L, modname, 1); /* get/create module table */ - /* check whether table already has a _NAME field */ - if (lua_getfield(L, -1, "_NAME") != LUA_TNIL) - lua_pop(L, 1); /* table is an initialized module */ - else { /* no; initialize it */ - lua_pop(L, 1); - modinit(L, modname); - } - lua_pushvalue(L, -1); - set_env(L); - dooptions(L, lastarg); - return 1; -} - - -static int ll_seeall (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - if (!lua_getmetatable(L, 1)) { - lua_createtable(L, 0, 1); /* create new metatable */ - lua_pushvalue(L, -1); - lua_setmetatable(L, 1); - } - lua_pushglobaltable(L); - lua_setfield(L, -2, "__index"); /* mt.__index = _G */ - return 0; -} - -#endif -/* }====================================================== */ - - - -static const luaL_Reg pk_funcs[] = { - {"loadlib", ll_loadlib}, - {"searchpath", ll_searchpath}, -#if defined(LUA_COMPAT_MODULE) - {"seeall", ll_seeall}, -#endif - /* placeholders */ - {"preload", NULL}, - {"cpath", NULL}, - {"path", NULL}, - {"searchers", NULL}, - {"loaded", NULL}, - {NULL, NULL} -}; - - -static const luaL_Reg ll_funcs[] = { -#if defined(LUA_COMPAT_MODULE) - {"module", ll_module}, -#endif - {"require", ll_require}, - {NULL, NULL} -}; - - -static void createsearcherstable (lua_State *L) { - static const lua_CFunction searchers[] = - {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL}; - int i; - /* create 'searchers' table */ - lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0); - /* fill it with predefined searchers */ - for (i=0; searchers[i] != NULL; i++) { - lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */ - lua_pushcclosure(L, searchers[i], 1); - lua_rawseti(L, -2, i+1); - } -#if defined(LUA_COMPAT_LOADERS) - lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ - lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */ -#endif - lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ -} - - -/* -** create table CLIBS to keep track of loaded C libraries, -** setting a finalizer to close all libraries when closing state. -*/ -static void createclibstable (lua_State *L) { - lua_newtable(L); /* create CLIBS table */ - lua_createtable(L, 0, 1); /* create metatable for CLIBS */ - lua_pushcfunction(L, gctm); - lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */ - lua_setmetatable(L, -2); - lua_rawsetp(L, LUA_REGISTRYINDEX, &CLIBS); /* set CLIBS table in registry */ -} - - -LUAMOD_API int luaopen_package (lua_State *L) { - createclibstable(L); - luaL_newlib(L, pk_funcs); /* create 'package' table */ - createsearcherstable(L); - /* set paths */ - setpath(L, "path", LUA_PATH_VAR, LUA_PATH_DEFAULT); - setpath(L, "cpath", LUA_CPATH_VAR, LUA_CPATH_DEFAULT); - /* store config information */ - lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n" - LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); - lua_setfield(L, -2, "config"); - /* set field 'loaded' */ - luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); - lua_setfield(L, -2, "loaded"); - /* set field 'preload' */ - luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); - lua_setfield(L, -2, "preload"); - lua_pushglobaltable(L); - lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ - luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */ - lua_pop(L, 1); /* pop global table */ - return 1; /* return 'package' table */ -} - diff --git a/deps/rcheevos/test/lua/src/lobject.c b/deps/rcheevos/test/lua/src/lobject.c deleted file mode 100644 index 2da76899a2..0000000000 --- a/deps/rcheevos/test/lua/src/lobject.c +++ /dev/null @@ -1,521 +0,0 @@ -/* -** $Id: lobject.c,v 2.113 2016/12/22 13:08:50 roberto Exp $ -** Some generic functions over Lua objects -** See Copyright Notice in lua.h -*/ - -#define lobject_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lctype.h" -#include "ldebug.h" -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "lvm.h" - - - -LUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT}; - - -/* -** converts an integer to a "floating point byte", represented as -** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if -** eeeee != 0 and (xxx) otherwise. -*/ -int luaO_int2fb (unsigned int x) { - int e = 0; /* exponent */ - if (x < 8) return x; - while (x >= (8 << 4)) { /* coarse steps */ - x = (x + 0xf) >> 4; /* x = ceil(x / 16) */ - e += 4; - } - while (x >= (8 << 1)) { /* fine steps */ - x = (x + 1) >> 1; /* x = ceil(x / 2) */ - e++; - } - return ((e+1) << 3) | (cast_int(x) - 8); -} - - -/* converts back */ -int luaO_fb2int (int x) { - return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1); -} - - -/* -** Computes ceil(log2(x)) -*/ -int luaO_ceillog2 (unsigned int x) { - static const lu_byte log_2[256] = { /* log_2[i] = ceil(log2(i - 1)) */ - 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 - }; - int l = 0; - x--; - while (x >= 256) { l += 8; x >>= 8; } - return l + log_2[x]; -} - - -static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, - lua_Integer v2) { - switch (op) { - case LUA_OPADD: return intop(+, v1, v2); - case LUA_OPSUB:return intop(-, v1, v2); - case LUA_OPMUL:return intop(*, v1, v2); - case LUA_OPMOD: return luaV_mod(L, v1, v2); - case LUA_OPIDIV: return luaV_div(L, v1, v2); - case LUA_OPBAND: return intop(&, v1, v2); - case LUA_OPBOR: return intop(|, v1, v2); - case LUA_OPBXOR: return intop(^, v1, v2); - case LUA_OPSHL: return luaV_shiftl(v1, v2); - case LUA_OPSHR: return luaV_shiftl(v1, -v2); - case LUA_OPUNM: return intop(-, 0, v1); - case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); - default: lua_assert(0); return 0; - } -} - - -static lua_Number numarith (lua_State *L, int op, lua_Number v1, - lua_Number v2) { - switch (op) { - case LUA_OPADD: return luai_numadd(L, v1, v2); - case LUA_OPSUB: return luai_numsub(L, v1, v2); - case LUA_OPMUL: return luai_nummul(L, v1, v2); - case LUA_OPDIV: return luai_numdiv(L, v1, v2); - case LUA_OPPOW: return luai_numpow(L, v1, v2); - case LUA_OPIDIV: return luai_numidiv(L, v1, v2); - case LUA_OPUNM: return luai_numunm(L, v1); - case LUA_OPMOD: { - lua_Number m; - luai_nummod(L, v1, v2, m); - return m; - } - default: lua_assert(0); return 0; - } -} - - -void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, - TValue *res) { - switch (op) { - case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: - case LUA_OPSHL: case LUA_OPSHR: - case LUA_OPBNOT: { /* operate only on integers */ - lua_Integer i1; lua_Integer i2; - if (tointeger(p1, &i1) && tointeger(p2, &i2)) { - setivalue(res, intarith(L, op, i1, i2)); - return; - } - else break; /* go to the end */ - } - case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */ - lua_Number n1; lua_Number n2; - if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setfltvalue(res, numarith(L, op, n1, n2)); - return; - } - else break; /* go to the end */ - } - default: { /* other operations */ - lua_Number n1; lua_Number n2; - if (ttisinteger(p1) && ttisinteger(p2)) { - setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2))); - return; - } - else if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setfltvalue(res, numarith(L, op, n1, n2)); - return; - } - else break; /* go to the end */ - } - } - /* could not perform raw operation; try metamethod */ - lua_assert(L != NULL); /* should not fail when folding (compile time) */ - luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD)); -} - - -int luaO_hexavalue (int c) { - if (lisdigit(c)) return c - '0'; - else return (ltolower(c) - 'a') + 10; -} - - -static int isneg (const char **s) { - if (**s == '-') { (*s)++; return 1; } - else if (**s == '+') (*s)++; - return 0; -} - - - -/* -** {================================================================== -** Lua's implementation for 'lua_strx2number' -** =================================================================== -*/ - -#if !defined(lua_strx2number) - -/* maximum number of significant digits to read (to avoid overflows - even with single floats) */ -#define MAXSIGDIG 30 - -/* -** convert an hexadecimal numeric string to a number, following -** C99 specification for 'strtod' -*/ -static lua_Number lua_strx2number (const char *s, char **endptr) { - int dot = lua_getlocaledecpoint(); - lua_Number r = 0.0; /* result (accumulator) */ - int sigdig = 0; /* number of significant digits */ - int nosigdig = 0; /* number of non-significant digits */ - int e = 0; /* exponent correction */ - int neg; /* 1 if number is negative */ - int hasdot = 0; /* true after seen a dot */ - *endptr = cast(char *, s); /* nothing is valid yet */ - while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ - neg = isneg(&s); /* check signal */ - if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ - return 0.0; /* invalid format (no '0x') */ - for (s += 2; ; s++) { /* skip '0x' and read numeral */ - if (*s == dot) { - if (hasdot) break; /* second dot? stop loop */ - else hasdot = 1; - } - else if (lisxdigit(cast_uchar(*s))) { - if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ - nosigdig++; - else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ - r = (r * cast_num(16.0)) + luaO_hexavalue(*s); - else e++; /* too many digits; ignore, but still count for exponent */ - if (hasdot) e--; /* decimal digit? correct exponent */ - } - else break; /* neither a dot nor a digit */ - } - if (nosigdig + sigdig == 0) /* no digits? */ - return 0.0; /* invalid format */ - *endptr = cast(char *, s); /* valid up to here */ - e *= 4; /* each digit multiplies/divides value by 2^4 */ - if (*s == 'p' || *s == 'P') { /* exponent part? */ - int exp1 = 0; /* exponent value */ - int neg1; /* exponent signal */ - s++; /* skip 'p' */ - neg1 = isneg(&s); /* signal */ - if (!lisdigit(cast_uchar(*s))) - return 0.0; /* invalid; must have at least one digit */ - while (lisdigit(cast_uchar(*s))) /* read exponent */ - exp1 = exp1 * 10 + *(s++) - '0'; - if (neg1) exp1 = -exp1; - e += exp1; - *endptr = cast(char *, s); /* valid up to here */ - } - if (neg) r = -r; - return l_mathop(ldexp)(r, e); -} - -#endif -/* }====================================================== */ - - -/* maximum length of a numeral */ -#if !defined (L_MAXLENNUM) -#define L_MAXLENNUM 200 -#endif - -static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { - char *endptr; - *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ - : lua_str2number(s, &endptr); - if (endptr == s) return NULL; /* nothing recognized? */ - while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ - return (*endptr == '\0') ? endptr : NULL; /* OK if no trailing characters */ -} - - -/* -** Convert string 's' to a Lua number (put in 'result'). Return NULL -** on fail or the address of the ending '\0' on success. -** 'pmode' points to (and 'mode' contains) special things in the string: -** - 'x'/'X' means an hexadecimal numeral -** - 'n'/'N' means 'inf' or 'nan' (which should be rejected) -** - '.' just optimizes the search for the common case (nothing special) -** This function accepts both the current locale or a dot as the radix -** mark. If the convertion fails, it may mean number has a dot but -** locale accepts something else. In that case, the code copies 's' -** to a buffer (because 's' is read-only), changes the dot to the -** current locale radix mark, and tries to convert again. -*/ -static const char *l_str2d (const char *s, lua_Number *result) { - const char *endptr; - const char *pmode = strpbrk(s, ".xXnN"); - int mode = pmode ? ltolower(cast_uchar(*pmode)) : 0; - if (mode == 'n') /* reject 'inf' and 'nan' */ - return NULL; - endptr = l_str2dloc(s, result, mode); /* try to convert */ - if (endptr == NULL) { /* failed? may be a different locale */ - char buff[L_MAXLENNUM + 1]; - const char *pdot = strchr(s, '.'); - if (strlen(s) > L_MAXLENNUM || pdot == NULL) - return NULL; /* string too long or no dot; fail */ - strcpy(buff, s); /* copy string to buffer */ - buff[pdot - s] = lua_getlocaledecpoint(); /* correct decimal point */ - endptr = l_str2dloc(buff, result, mode); /* try again */ - if (endptr != NULL) - endptr = s + (endptr - buff); /* make relative to 's' */ - } - return endptr; -} - - -#define MAXBY10 cast(lua_Unsigned, LUA_MAXINTEGER / 10) -#define MAXLASTD cast_int(LUA_MAXINTEGER % 10) - -static const char *l_str2int (const char *s, lua_Integer *result) { - lua_Unsigned a = 0; - int empty = 1; - int neg; - while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ - neg = isneg(&s); - if (s[0] == '0' && - (s[1] == 'x' || s[1] == 'X')) { /* hex? */ - s += 2; /* skip '0x' */ - for (; lisxdigit(cast_uchar(*s)); s++) { - a = a * 16 + luaO_hexavalue(*s); - empty = 0; - } - } - else { /* decimal */ - for (; lisdigit(cast_uchar(*s)); s++) { - int d = *s - '0'; - if (a >= MAXBY10 && (a > MAXBY10 || d > MAXLASTD + neg)) /* overflow? */ - return NULL; /* do not accept it (as integer) */ - a = a * 10 + d; - empty = 0; - } - } - while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ - if (empty || *s != '\0') return NULL; /* something wrong in the numeral */ - else { - *result = l_castU2S((neg) ? 0u - a : a); - return s; - } -} - - -size_t luaO_str2num (const char *s, TValue *o) { - lua_Integer i; lua_Number n; - const char *e; - if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */ - setivalue(o, i); - } - else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */ - setfltvalue(o, n); - } - else - return 0; /* conversion failed */ - return (e - s) + 1; /* success; return string size */ -} - - -int luaO_utf8esc (char *buff, unsigned long x) { - int n = 1; /* number of bytes put in buffer (backwards) */ - lua_assert(x <= 0x10FFFF); - if (x < 0x80) /* ascii? */ - buff[UTF8BUFFSZ - 1] = cast(char, x); - else { /* need continuation bytes */ - unsigned int mfb = 0x3f; /* maximum that fits in first byte */ - do { /* add continuation bytes */ - buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f)); - x >>= 6; /* remove added bits */ - mfb >>= 1; /* now there is one less bit available in first byte */ - } while (x > mfb); /* still needs continuation byte? */ - buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */ - } - return n; -} - - -/* maximum length of the conversion of a number to a string */ -#define MAXNUMBER2STR 50 - - -/* -** Convert a number object to a string -*/ -void luaO_tostring (lua_State *L, StkId obj) { - char buff[MAXNUMBER2STR]; - size_t len; - lua_assert(ttisnumber(obj)); - if (ttisinteger(obj)) - len = lua_integer2str(buff, sizeof(buff), ivalue(obj)); - else { - len = lua_number2str(buff, sizeof(buff), fltvalue(obj)); -#if !defined(LUA_COMPAT_FLOATSTRING) - if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ - buff[len++] = lua_getlocaledecpoint(); - buff[len++] = '0'; /* adds '.0' to result */ - } -#endif - } - setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); -} - - -static void pushstr (lua_State *L, const char *str, size_t l) { - setsvalue2s(L, L->top, luaS_newlstr(L, str, l)); - luaD_inctop(L); -} - - -/* -** this function handles only '%d', '%c', '%f', '%p', and '%s' - conventional formats, plus Lua-specific '%I' and '%U' -*/ -const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { - int n = 0; - for (;;) { - const char *e = strchr(fmt, '%'); - if (e == NULL) break; - pushstr(L, fmt, e - fmt); - switch (*(e+1)) { - case 's': { /* zero-terminated string */ - const char *s = va_arg(argp, char *); - if (s == NULL) s = "(null)"; - pushstr(L, s, strlen(s)); - break; - } - case 'c': { /* an 'int' as a character */ - char buff = cast(char, va_arg(argp, int)); - if (lisprint(cast_uchar(buff))) - pushstr(L, &buff, 1); - else /* non-printable character; print its code */ - luaO_pushfstring(L, "<\\%d>", cast_uchar(buff)); - break; - } - case 'd': { /* an 'int' */ - setivalue(L->top, va_arg(argp, int)); - goto top2str; - } - case 'I': { /* a 'lua_Integer' */ - setivalue(L->top, cast(lua_Integer, va_arg(argp, l_uacInt))); - goto top2str; - } - case 'f': { /* a 'lua_Number' */ - setfltvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); - top2str: /* convert the top element to a string */ - luaD_inctop(L); - luaO_tostring(L, L->top - 1); - break; - } - case 'p': { /* a pointer */ - char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */ - int l = l_sprintf(buff, sizeof(buff), "%p", va_arg(argp, void *)); - pushstr(L, buff, l); - break; - } - case 'U': { /* an 'int' as a UTF-8 sequence */ - char buff[UTF8BUFFSZ]; - int l = luaO_utf8esc(buff, cast(long, va_arg(argp, long))); - pushstr(L, buff + UTF8BUFFSZ - l, l); - break; - } - case '%': { - pushstr(L, "%", 1); - break; - } - default: { - luaG_runerror(L, "invalid option '%%%c' to 'lua_pushfstring'", - *(e + 1)); - } - } - n += 2; - fmt = e+2; - } - luaD_checkstack(L, 1); - pushstr(L, fmt, strlen(fmt)); - if (n > 0) luaV_concat(L, n + 1); - return svalue(L->top - 1); -} - - -const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - return msg; -} - - -/* number of chars of a literal string without the ending \0 */ -#define LL(x) (sizeof(x)/sizeof(char) - 1) - -#define RETS "..." -#define PRE "[string \"" -#define POS "\"]" - -#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) ) - -void luaO_chunkid (char *out, const char *source, size_t bufflen) { - size_t l = strlen(source); - if (*source == '=') { /* 'literal' source */ - if (l <= bufflen) /* small enough? */ - memcpy(out, source + 1, l * sizeof(char)); - else { /* truncate it */ - addstr(out, source + 1, bufflen - 1); - *out = '\0'; - } - } - else if (*source == '@') { /* file name */ - if (l <= bufflen) /* small enough? */ - memcpy(out, source + 1, l * sizeof(char)); - else { /* add '...' before rest of name */ - addstr(out, RETS, LL(RETS)); - bufflen -= LL(RETS); - memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char)); - } - } - else { /* string; format as [string "source"] */ - const char *nl = strchr(source, '\n'); /* find first new line (if any) */ - addstr(out, PRE, LL(PRE)); /* add prefix */ - bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */ - if (l < bufflen && nl == NULL) { /* small one-line source? */ - addstr(out, source, l); /* keep it */ - } - else { - if (nl != NULL) l = nl - source; /* stop at first newline */ - if (l > bufflen) l = bufflen; - addstr(out, source, l); - addstr(out, RETS, LL(RETS)); - } - memcpy(out, POS, (LL(POS) + 1) * sizeof(char)); - } -} - diff --git a/deps/rcheevos/test/lua/src/lobject.h b/deps/rcheevos/test/lua/src/lobject.h deleted file mode 100644 index 3c04228949..0000000000 --- a/deps/rcheevos/test/lua/src/lobject.h +++ /dev/null @@ -1,549 +0,0 @@ -/* -** $Id: lobject.h,v 2.117 2016/08/01 19:51:24 roberto Exp $ -** Type definitions for Lua objects -** See Copyright Notice in lua.h -*/ - - -#ifndef lobject_h -#define lobject_h - - -#include - - -#include "llimits.h" -#include "lua.h" - - -/* -** Extra tags for non-values -*/ -#define LUA_TPROTO LUA_NUMTAGS /* function prototypes */ -#define LUA_TDEADKEY (LUA_NUMTAGS+1) /* removed keys in tables */ - -/* -** number of all possible tags (including LUA_TNONE but excluding DEADKEY) -*/ -#define LUA_TOTALTAGS (LUA_TPROTO + 2) - - -/* -** tags for Tagged Values have the following use of bits: -** bits 0-3: actual tag (a LUA_T* value) -** bits 4-5: variant bits -** bit 6: whether value is collectable -*/ - - -/* -** LUA_TFUNCTION variants: -** 0 - Lua function -** 1 - light C function -** 2 - regular C function (closure) -*/ - -/* Variant tags for functions */ -#define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ -#define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ -#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ - - -/* Variant tags for strings */ -#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */ -#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */ - - -/* Variant tags for numbers */ -#define LUA_TNUMFLT (LUA_TNUMBER | (0 << 4)) /* float numbers */ -#define LUA_TNUMINT (LUA_TNUMBER | (1 << 4)) /* integer numbers */ - - -/* Bit mark for collectable types */ -#define BIT_ISCOLLECTABLE (1 << 6) - -/* mark a tag as collectable */ -#define ctb(t) ((t) | BIT_ISCOLLECTABLE) - - -/* -** Common type for all collectable objects -*/ -typedef struct GCObject GCObject; - - -/* -** Common Header for all collectable objects (in macro form, to be -** included in other objects) -*/ -#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked - - -/* -** Common type has only the common header -*/ -struct GCObject { - CommonHeader; -}; - - - - -/* -** Tagged Values. This is the basic representation of values in Lua, -** an actual value plus a tag with its type. -*/ - -/* -** Union of all Lua values -*/ -typedef union Value { - GCObject *gc; /* collectable objects */ - void *p; /* light userdata */ - int b; /* booleans */ - lua_CFunction f; /* light C functions */ - lua_Integer i; /* integer numbers */ - lua_Number n; /* float numbers */ -} Value; - - -#define TValuefields Value value_; int tt_ - - -typedef struct lua_TValue { - TValuefields; -} TValue; - - - -/* macro defining a nil value */ -#define NILCONSTANT {NULL}, LUA_TNIL - - -#define val_(o) ((o)->value_) - - -/* raw type tag of a TValue */ -#define rttype(o) ((o)->tt_) - -/* tag with no variants (bits 0-3) */ -#define novariant(x) ((x) & 0x0F) - -/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ -#define ttype(o) (rttype(o) & 0x3F) - -/* type tag of a TValue with no variants (bits 0-3) */ -#define ttnov(o) (novariant(rttype(o))) - - -/* Macros to test type */ -#define checktag(o,t) (rttype(o) == (t)) -#define checktype(o,t) (ttnov(o) == (t)) -#define ttisnumber(o) checktype((o), LUA_TNUMBER) -#define ttisfloat(o) checktag((o), LUA_TNUMFLT) -#define ttisinteger(o) checktag((o), LUA_TNUMINT) -#define ttisnil(o) checktag((o), LUA_TNIL) -#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) -#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) -#define ttisstring(o) checktype((o), LUA_TSTRING) -#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) -#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) -#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) -#define ttisfunction(o) checktype(o, LUA_TFUNCTION) -#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) -#define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) -#define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) -#define ttislcf(o) checktag((o), LUA_TLCF) -#define ttisfulluserdata(o) checktag((o), ctb(LUA_TUSERDATA)) -#define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) -#define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) - - -/* Macros to access values */ -#define ivalue(o) check_exp(ttisinteger(o), val_(o).i) -#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) -#define nvalue(o) check_exp(ttisnumber(o), \ - (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o))) -#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) -#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) -#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) -#define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc)) -#define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc)) -#define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc)) -#define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc)) -#define fvalue(o) check_exp(ttislcf(o), val_(o).f) -#define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc)) -#define bvalue(o) check_exp(ttisboolean(o), val_(o).b) -#define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc)) -/* a dead value may get the 'gc' field, but cannot access its contents */ -#define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) - -#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) - - -#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) - - -/* Macros for internal tests */ -#define righttt(obj) (ttype(obj) == gcvalue(obj)->tt) - -#define checkliveness(L,obj) \ - lua_longassert(!iscollectable(obj) || \ - (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))) - - -/* Macros to set values */ -#define settt_(o,t) ((o)->tt_=(t)) - -#define setfltvalue(obj,x) \ - { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } - -#define chgfltvalue(obj,x) \ - { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } - -#define setivalue(obj,x) \ - { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } - -#define chgivalue(obj,x) \ - { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } - -#define setnilvalue(obj) settt_(obj, LUA_TNIL) - -#define setfvalue(obj,x) \ - { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } - -#define setpvalue(obj,x) \ - { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } - -#define setbvalue(obj,x) \ - { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } - -#define setgcovalue(L,obj,x) \ - { TValue *io = (obj); GCObject *i_g=(x); \ - val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); } - -#define setsvalue(L,obj,x) \ - { TValue *io = (obj); TString *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \ - checkliveness(L,io); } - -#define setuvalue(L,obj,x) \ - { TValue *io = (obj); Udata *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \ - checkliveness(L,io); } - -#define setthvalue(L,obj,x) \ - { TValue *io = (obj); lua_State *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \ - checkliveness(L,io); } - -#define setclLvalue(L,obj,x) \ - { TValue *io = (obj); LClosure *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \ - checkliveness(L,io); } - -#define setclCvalue(L,obj,x) \ - { TValue *io = (obj); CClosure *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \ - checkliveness(L,io); } - -#define sethvalue(L,obj,x) \ - { TValue *io = (obj); Table *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \ - checkliveness(L,io); } - -#define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) - - - -#define setobj(L,obj1,obj2) \ - { TValue *io1=(obj1); *io1 = *(obj2); \ - (void)L; checkliveness(L,io1); } - - -/* -** different types of assignments, according to destination -*/ - -/* from stack to (same) stack */ -#define setobjs2s setobj -/* to stack (not from same stack) */ -#define setobj2s setobj -#define setsvalue2s setsvalue -#define sethvalue2s sethvalue -#define setptvalue2s setptvalue -/* from table to same table */ -#define setobjt2t setobj -/* to new object */ -#define setobj2n setobj -#define setsvalue2n setsvalue - -/* to table (define it as an expression to be used in macros) */ -#define setobj2t(L,o1,o2) ((void)L, *(o1)=*(o2), checkliveness(L,(o1))) - - - - -/* -** {====================================================== -** types and prototypes -** ======================================================= -*/ - - -typedef TValue *StkId; /* index to stack elements */ - - - - -/* -** Header for string value; string bytes follow the end of this structure -** (aligned according to 'UTString'; see next). -*/ -typedef struct TString { - CommonHeader; - lu_byte extra; /* reserved words for short strings; "has hash" for longs */ - lu_byte shrlen; /* length for short strings */ - unsigned int hash; - union { - size_t lnglen; /* length for long strings */ - struct TString *hnext; /* linked list for hash table */ - } u; -} TString; - - -/* -** Ensures that address after this type is always fully aligned. -*/ -typedef union UTString { - L_Umaxalign dummy; /* ensures maximum alignment for strings */ - TString tsv; -} UTString; - - -/* -** Get the actual string (array of bytes) from a 'TString'. -** (Access to 'extra' ensures that value is really a 'TString'.) -*/ -#define getstr(ts) \ - check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) - - -/* get the actual string (array of bytes) from a Lua value */ -#define svalue(o) getstr(tsvalue(o)) - -/* get string length from 'TString *s' */ -#define tsslen(s) ((s)->tt == LUA_TSHRSTR ? (s)->shrlen : (s)->u.lnglen) - -/* get string length from 'TValue *o' */ -#define vslen(o) tsslen(tsvalue(o)) - - -/* -** Header for userdata; memory area follows the end of this structure -** (aligned according to 'UUdata'; see next). -*/ -typedef struct Udata { - CommonHeader; - lu_byte ttuv_; /* user value's tag */ - struct Table *metatable; - size_t len; /* number of bytes */ - union Value user_; /* user value */ -} Udata; - - -/* -** Ensures that address after this type is always fully aligned. -*/ -typedef union UUdata { - L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */ - Udata uv; -} UUdata; - - -/* -** Get the address of memory block inside 'Udata'. -** (Access to 'ttuv_' ensures that value is really a 'Udata'.) -*/ -#define getudatamem(u) \ - check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata))) - -#define setuservalue(L,u,o) \ - { const TValue *io=(o); Udata *iu = (u); \ - iu->user_ = io->value_; iu->ttuv_ = rttype(io); \ - checkliveness(L,io); } - - -#define getuservalue(L,u,o) \ - { TValue *io=(o); const Udata *iu = (u); \ - io->value_ = iu->user_; settt_(io, iu->ttuv_); \ - checkliveness(L,io); } - - -/* -** Description of an upvalue for function prototypes -*/ -typedef struct Upvaldesc { - TString *name; /* upvalue name (for debug information) */ - lu_byte instack; /* whether it is in stack (register) */ - lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ -} Upvaldesc; - - -/* -** Description of a local variable for function prototypes -** (used for debug information) -*/ -typedef struct LocVar { - TString *varname; - int startpc; /* first point where variable is active */ - int endpc; /* first point where variable is dead */ -} LocVar; - - -/* -** Function Prototypes -*/ -typedef struct Proto { - CommonHeader; - lu_byte numparams; /* number of fixed parameters */ - lu_byte is_vararg; - lu_byte maxstacksize; /* number of registers needed by this function */ - int sizeupvalues; /* size of 'upvalues' */ - int sizek; /* size of 'k' */ - int sizecode; - int sizelineinfo; - int sizep; /* size of 'p' */ - int sizelocvars; - int linedefined; /* debug information */ - int lastlinedefined; /* debug information */ - TValue *k; /* constants used by the function */ - Instruction *code; /* opcodes */ - struct Proto **p; /* functions defined inside the function */ - int *lineinfo; /* map from opcodes to source lines (debug information) */ - LocVar *locvars; /* information about local variables (debug information) */ - Upvaldesc *upvalues; /* upvalue information */ - struct LClosure *cache; /* last-created closure with this prototype */ - TString *source; /* used for debug information */ - GCObject *gclist; -} Proto; - - - -/* -** Lua Upvalues -*/ -typedef struct UpVal UpVal; - - -/* -** Closures -*/ - -#define ClosureHeader \ - CommonHeader; lu_byte nupvalues; GCObject *gclist - -typedef struct CClosure { - ClosureHeader; - lua_CFunction f; - TValue upvalue[1]; /* list of upvalues */ -} CClosure; - - -typedef struct LClosure { - ClosureHeader; - struct Proto *p; - UpVal *upvals[1]; /* list of upvalues */ -} LClosure; - - -typedef union Closure { - CClosure c; - LClosure l; -} Closure; - - -#define isLfunction(o) ttisLclosure(o) - -#define getproto(o) (clLvalue(o)->p) - - -/* -** Tables -*/ - -typedef union TKey { - struct { - TValuefields; - int next; /* for chaining (offset for next node) */ - } nk; - TValue tvk; -} TKey; - - -/* copy a value into a key without messing up field 'next' */ -#define setnodekey(L,key,obj) \ - { TKey *k_=(key); const TValue *io_=(obj); \ - k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ - (void)L; checkliveness(L,io_); } - - -typedef struct Node { - TValue i_val; - TKey i_key; -} Node; - - -typedef struct Table { - CommonHeader; - lu_byte flags; /* 1<

lsizenode)) - - -/* -** (address of) a fixed nil value -*/ -#define luaO_nilobject (&luaO_nilobject_) - - -LUAI_DDEC const TValue luaO_nilobject_; - -/* size of buffer for 'luaO_utf8esc' function */ -#define UTF8BUFFSZ 8 - -LUAI_FUNC int luaO_int2fb (unsigned int x); -LUAI_FUNC int luaO_fb2int (int x); -LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); -LUAI_FUNC int luaO_ceillog2 (unsigned int x); -LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, - const TValue *p2, TValue *res); -LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); -LUAI_FUNC int luaO_hexavalue (int c); -LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj); -LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, - va_list argp); -LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); -LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); - - -#endif - diff --git a/deps/rcheevos/test/lua/src/lopcodes.c b/deps/rcheevos/test/lua/src/lopcodes.c deleted file mode 100644 index a1cbef8573..0000000000 --- a/deps/rcheevos/test/lua/src/lopcodes.c +++ /dev/null @@ -1,124 +0,0 @@ -/* -** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $ -** Opcodes for Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#define lopcodes_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lopcodes.h" - - -/* ORDER OP */ - -LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { - "MOVE", - "LOADK", - "LOADKX", - "LOADBOOL", - "LOADNIL", - "GETUPVAL", - "GETTABUP", - "GETTABLE", - "SETTABUP", - "SETUPVAL", - "SETTABLE", - "NEWTABLE", - "SELF", - "ADD", - "SUB", - "MUL", - "MOD", - "POW", - "DIV", - "IDIV", - "BAND", - "BOR", - "BXOR", - "SHL", - "SHR", - "UNM", - "BNOT", - "NOT", - "LEN", - "CONCAT", - "JMP", - "EQ", - "LT", - "LE", - "TEST", - "TESTSET", - "CALL", - "TAILCALL", - "RETURN", - "FORLOOP", - "FORPREP", - "TFORCALL", - "TFORLOOP", - "SETLIST", - "CLOSURE", - "VARARG", - "EXTRAARG", - NULL -}; - - -#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) - -LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { -/* T A B C mode opcode */ - opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ - ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ - ,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ - ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ - ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ - ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_IDIV */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHL */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHR */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ - ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ - ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ - ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ - ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ - ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ - ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ - ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ - ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ -}; - diff --git a/deps/rcheevos/test/lua/src/lopcodes.h b/deps/rcheevos/test/lua/src/lopcodes.h deleted file mode 100644 index bbc4b61968..0000000000 --- a/deps/rcheevos/test/lua/src/lopcodes.h +++ /dev/null @@ -1,297 +0,0 @@ -/* -** $Id: lopcodes.h,v 1.149 2016/07/19 17:12:21 roberto Exp $ -** Opcodes for Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lopcodes_h -#define lopcodes_h - -#include "llimits.h" - - -/*=========================================================================== - We assume that instructions are unsigned numbers. - All instructions have an opcode in the first 6 bits. - Instructions can have the following fields: - 'A' : 8 bits - 'B' : 9 bits - 'C' : 9 bits - 'Ax' : 26 bits ('A', 'B', and 'C' together) - 'Bx' : 18 bits ('B' and 'C' together) - 'sBx' : signed Bx - - A signed argument is represented in excess K; that is, the number - value is the unsigned value minus K. K is exactly the maximum value - for that argument (so that -max is represented by 0, and +max is - represented by 2*max), which is half the maximum for the corresponding - unsigned argument. -===========================================================================*/ - - -enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ - - -/* -** size and position of opcode arguments. -*/ -#define SIZE_C 9 -#define SIZE_B 9 -#define SIZE_Bx (SIZE_C + SIZE_B) -#define SIZE_A 8 -#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) - -#define SIZE_OP 6 - -#define POS_OP 0 -#define POS_A (POS_OP + SIZE_OP) -#define POS_C (POS_A + SIZE_A) -#define POS_B (POS_C + SIZE_C) -#define POS_Bx POS_C -#define POS_Ax POS_A - - -/* -** limits for opcode arguments. -** we use (signed) int to manipulate most arguments, -** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) -*/ -#if SIZE_Bx < LUAI_BITSINT-1 -#define MAXARG_Bx ((1<>1) /* 'sBx' is signed */ -#else -#define MAXARG_Bx MAX_INT -#define MAXARG_sBx MAX_INT -#endif - -#if SIZE_Ax < LUAI_BITSINT-1 -#define MAXARG_Ax ((1<>POS_OP) & MASK1(SIZE_OP,0))) -#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ - ((cast(Instruction, o)<>pos) & MASK1(size,0))) -#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ - ((cast(Instruction, v)<> RK(C) */ -OP_UNM,/* A B R(A) := -R(B) */ -OP_BNOT,/* A B R(A) := ~R(B) */ -OP_NOT,/* A B R(A) := not R(B) */ -OP_LEN,/* A B R(A) := length of R(B) */ - -OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ - -OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */ -OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ -OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ -OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ - -OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ -OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ - -OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ - -OP_FORLOOP,/* A sBx R(A)+=R(A+2); - if R(A) > 4) & 3)) -#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) -#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) -#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) - - -LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ - - -/* number of list items to accumulate before a SETLIST instruction */ -#define LFIELDS_PER_FLUSH 50 - - -#endif diff --git a/deps/rcheevos/test/lua/src/loslib.c b/deps/rcheevos/test/lua/src/loslib.c deleted file mode 100644 index 5a94eb9068..0000000000 --- a/deps/rcheevos/test/lua/src/loslib.c +++ /dev/null @@ -1,407 +0,0 @@ -/* -** $Id: loslib.c,v 1.65 2016/07/18 17:58:58 roberto Exp $ -** Standard Operating System library -** See Copyright Notice in lua.h -*/ - -#define loslib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** {================================================================== -** List of valid conversion specifiers for the 'strftime' function; -** options are grouped by length; group of length 2 start with '||'. -** =================================================================== -*/ -#if !defined(LUA_STRFTIMEOPTIONS) /* { */ - -/* options for ANSI C 89 (only 1-char options) */ -#define L_STRFTIMEC89 "aAbBcdHIjmMpSUwWxXyYZ%" - -/* options for ISO C 99 and POSIX */ -#define L_STRFTIMEC99 "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \ - "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */ - -/* options for Windows */ -#define L_STRFTIMEWIN "aAbBcdHIjmMpSUwWxXyYzZ%" \ - "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */ - -#if defined(LUA_USE_WINDOWS) -#define LUA_STRFTIMEOPTIONS L_STRFTIMEWIN -#elif defined(LUA_USE_C89) -#define LUA_STRFTIMEOPTIONS L_STRFTIMEC89 -#else /* C99 specification */ -#define LUA_STRFTIMEOPTIONS L_STRFTIMEC99 -#endif - -#endif /* } */ -/* }================================================================== */ - - -/* -** {================================================================== -** Configuration for time-related stuff -** =================================================================== -*/ - -#if !defined(l_time_t) /* { */ -/* -** type to represent time_t in Lua -*/ -#define l_timet lua_Integer -#define l_pushtime(L,t) lua_pushinteger(L,(lua_Integer)(t)) - -static time_t l_checktime (lua_State *L, int arg) { - lua_Integer t = luaL_checkinteger(L, arg); - luaL_argcheck(L, (time_t)t == t, arg, "time out-of-bounds"); - return (time_t)t; -} - -#endif /* } */ - - -#if !defined(l_gmtime) /* { */ -/* -** By default, Lua uses gmtime/localtime, except when POSIX is available, -** where it uses gmtime_r/localtime_r -*/ - -#if defined(LUA_USE_POSIX) /* { */ - -#define l_gmtime(t,r) gmtime_r(t,r) -#define l_localtime(t,r) localtime_r(t,r) - -#else /* }{ */ - -/* ISO C definitions */ -#define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) -#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) - -#endif /* } */ - -#endif /* } */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Configuration for 'tmpnam': -** By default, Lua uses tmpnam except when POSIX is available, where -** it uses mkstemp. -** =================================================================== -*/ -#if !defined(lua_tmpnam) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#include - -#define LUA_TMPNAMBUFSIZE 32 - -#if !defined(LUA_TMPNAMTEMPLATE) -#define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX" -#endif - -#define lua_tmpnam(b,e) { \ - strcpy(b, LUA_TMPNAMTEMPLATE); \ - e = mkstemp(b); \ - if (e != -1) close(e); \ - e = (e == -1); } - -#else /* }{ */ - -/* ISO C definitions */ -#define LUA_TMPNAMBUFSIZE L_tmpnam -#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } - -#endif /* } */ - -#endif /* } */ -/* }================================================================== */ - - - - -static int os_execute (lua_State *L) { - const char *cmd = luaL_optstring(L, 1, NULL); - int stat = system(cmd); - if (cmd != NULL) - return luaL_execresult(L, stat); - else { - lua_pushboolean(L, stat); /* true if there is a shell */ - return 1; - } -} - - -static int os_remove (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - return luaL_fileresult(L, remove(filename) == 0, filename); -} - - -static int os_rename (lua_State *L) { - const char *fromname = luaL_checkstring(L, 1); - const char *toname = luaL_checkstring(L, 2); - return luaL_fileresult(L, rename(fromname, toname) == 0, NULL); -} - - -static int os_tmpname (lua_State *L) { - char buff[LUA_TMPNAMBUFSIZE]; - int err; - lua_tmpnam(buff, err); - if (err) - return luaL_error(L, "unable to generate a unique filename"); - lua_pushstring(L, buff); - return 1; -} - - -static int os_getenv (lua_State *L) { - lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ - return 1; -} - - -static int os_clock (lua_State *L) { - lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); - return 1; -} - - -/* -** {====================================================== -** Time/Date operations -** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, -** wday=%w+1, yday=%j, isdst=? } -** ======================================================= -*/ - -static void setfield (lua_State *L, const char *key, int value) { - lua_pushinteger(L, value); - lua_setfield(L, -2, key); -} - -static void setboolfield (lua_State *L, const char *key, int value) { - if (value < 0) /* undefined? */ - return; /* does not set field */ - lua_pushboolean(L, value); - lua_setfield(L, -2, key); -} - - -/* -** Set all fields from structure 'tm' in the table on top of the stack -*/ -static void setallfields (lua_State *L, struct tm *stm) { - setfield(L, "sec", stm->tm_sec); - setfield(L, "min", stm->tm_min); - setfield(L, "hour", stm->tm_hour); - setfield(L, "day", stm->tm_mday); - setfield(L, "month", stm->tm_mon + 1); - setfield(L, "year", stm->tm_year + 1900); - setfield(L, "wday", stm->tm_wday + 1); - setfield(L, "yday", stm->tm_yday + 1); - setboolfield(L, "isdst", stm->tm_isdst); -} - - -static int getboolfield (lua_State *L, const char *key) { - int res; - res = (lua_getfield(L, -1, key) == LUA_TNIL) ? -1 : lua_toboolean(L, -1); - lua_pop(L, 1); - return res; -} - - -/* maximum value for date fields (to avoid arithmetic overflows with 'int') */ -#if !defined(L_MAXDATEFIELD) -#define L_MAXDATEFIELD (INT_MAX / 2) -#endif - -static int getfield (lua_State *L, const char *key, int d, int delta) { - int isnum; - int t = lua_getfield(L, -1, key); /* get field and its type */ - lua_Integer res = lua_tointegerx(L, -1, &isnum); - if (!isnum) { /* field is not an integer? */ - if (t != LUA_TNIL) /* some other value? */ - return luaL_error(L, "field '%s' is not an integer", key); - else if (d < 0) /* absent field; no default? */ - return luaL_error(L, "field '%s' missing in date table", key); - res = d; - } - else { - if (!(-L_MAXDATEFIELD <= res && res <= L_MAXDATEFIELD)) - return luaL_error(L, "field '%s' is out-of-bound", key); - res -= delta; - } - lua_pop(L, 1); - return (int)res; -} - - -static const char *checkoption (lua_State *L, const char *conv, - ptrdiff_t convlen, char *buff) { - const char *option = LUA_STRFTIMEOPTIONS; - int oplen = 1; /* length of options being checked */ - for (; *option != '\0' && oplen <= convlen; option += oplen) { - if (*option == '|') /* next block? */ - oplen++; /* will check options with next length (+1) */ - else if (memcmp(conv, option, oplen) == 0) { /* match? */ - memcpy(buff, conv, oplen); /* copy valid option to buffer */ - buff[oplen] = '\0'; - return conv + oplen; /* return next item */ - } - } - luaL_argerror(L, 1, - lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv)); - return conv; /* to avoid warnings */ -} - - -/* maximum size for an individual 'strftime' item */ -#define SIZETIMEFMT 250 - - -static int os_date (lua_State *L) { - size_t slen; - const char *s = luaL_optlstring(L, 1, "%c", &slen); - time_t t = luaL_opt(L, l_checktime, 2, time(NULL)); - const char *se = s + slen; /* 's' end */ - struct tm tmr, *stm; - if (*s == '!') { /* UTC? */ - stm = l_gmtime(&t, &tmr); - s++; /* skip '!' */ - } - else - stm = l_localtime(&t, &tmr); - if (stm == NULL) /* invalid date? */ - luaL_error(L, "time result cannot be represented in this installation"); - if (strcmp(s, "*t") == 0) { - lua_createtable(L, 0, 9); /* 9 = number of fields */ - setallfields(L, stm); - } - else { - char cc[4]; /* buffer for individual conversion specifiers */ - luaL_Buffer b; - cc[0] = '%'; - luaL_buffinit(L, &b); - while (s < se) { - if (*s != '%') /* not a conversion specifier? */ - luaL_addchar(&b, *s++); - else { - size_t reslen; - char *buff = luaL_prepbuffsize(&b, SIZETIMEFMT); - s++; /* skip '%' */ - s = checkoption(L, s, se - s, cc + 1); /* copy specifier to 'cc' */ - reslen = strftime(buff, SIZETIMEFMT, cc, stm); - luaL_addsize(&b, reslen); - } - } - luaL_pushresult(&b); - } - return 1; -} - - -static int os_time (lua_State *L) { - time_t t; - if (lua_isnoneornil(L, 1)) /* called without args? */ - t = time(NULL); /* get current time */ - else { - struct tm ts; - luaL_checktype(L, 1, LUA_TTABLE); - lua_settop(L, 1); /* make sure table is at the top */ - ts.tm_sec = getfield(L, "sec", 0, 0); - ts.tm_min = getfield(L, "min", 0, 0); - ts.tm_hour = getfield(L, "hour", 12, 0); - ts.tm_mday = getfield(L, "day", -1, 0); - ts.tm_mon = getfield(L, "month", -1, 1); - ts.tm_year = getfield(L, "year", -1, 1900); - ts.tm_isdst = getboolfield(L, "isdst"); - t = mktime(&ts); - setallfields(L, &ts); /* update fields with normalized values */ - } - if (t != (time_t)(l_timet)t || t == (time_t)(-1)) - luaL_error(L, "time result cannot be represented in this installation"); - l_pushtime(L, t); - return 1; -} - - -static int os_difftime (lua_State *L) { - time_t t1 = l_checktime(L, 1); - time_t t2 = l_checktime(L, 2); - lua_pushnumber(L, (lua_Number)difftime(t1, t2)); - return 1; -} - -/* }====================================================== */ - - -static int os_setlocale (lua_State *L) { - static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, - LC_NUMERIC, LC_TIME}; - static const char *const catnames[] = {"all", "collate", "ctype", "monetary", - "numeric", "time", NULL}; - const char *l = luaL_optstring(L, 1, NULL); - int op = luaL_checkoption(L, 2, "all", catnames); - lua_pushstring(L, setlocale(cat[op], l)); - return 1; -} - - -static int os_exit (lua_State *L) { - int status; - if (lua_isboolean(L, 1)) - status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE); - else - status = (int)luaL_optinteger(L, 1, EXIT_SUCCESS); - if (lua_toboolean(L, 2)) - lua_close(L); - if (L) exit(status); /* 'if' to avoid warnings for unreachable 'return' */ - return 0; -} - - -static const luaL_Reg syslib[] = { - {"clock", os_clock}, - {"date", os_date}, - {"difftime", os_difftime}, - {"execute", os_execute}, - {"exit", os_exit}, - {"getenv", os_getenv}, - {"remove", os_remove}, - {"rename", os_rename}, - {"setlocale", os_setlocale}, - {"time", os_time}, - {"tmpname", os_tmpname}, - {NULL, NULL} -}; - -/* }====================================================== */ - - - -LUAMOD_API int luaopen_os (lua_State *L) { - luaL_newlib(L, syslib); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/lparser.c b/deps/rcheevos/test/lua/src/lparser.c deleted file mode 100644 index cd4512d4d4..0000000000 --- a/deps/rcheevos/test/lua/src/lparser.c +++ /dev/null @@ -1,1650 +0,0 @@ -/* -** $Id: lparser.c,v 2.155 2016/08/01 19:51:24 roberto Exp $ -** Lua Parser -** See Copyright Notice in lua.h -*/ - -#define lparser_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" - - - -/* maximum number of local variables per function (must be smaller - than 250, due to the bytecode format) */ -#define MAXVARS 200 - - -#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) - - -/* because all strings are unified by the scanner, the parser - can use pointer equality for string equality */ -#define eqstr(a,b) ((a) == (b)) - - -/* -** nodes for block list (list of active blocks) -*/ -typedef struct BlockCnt { - struct BlockCnt *previous; /* chain */ - int firstlabel; /* index of first label in this block */ - int firstgoto; /* index of first pending goto in this block */ - lu_byte nactvar; /* # active locals outside the block */ - lu_byte upval; /* true if some variable in the block is an upvalue */ - lu_byte isloop; /* true if 'block' is a loop */ -} BlockCnt; - - - -/* -** prototypes for recursive non-terminal functions -*/ -static void statement (LexState *ls); -static void expr (LexState *ls, expdesc *v); - - -/* semantic error */ -static l_noret semerror (LexState *ls, const char *msg) { - ls->t.token = 0; /* remove "near " from final message */ - luaX_syntaxerror(ls, msg); -} - - -static l_noret error_expected (LexState *ls, int token) { - luaX_syntaxerror(ls, - luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); -} - - -static l_noret errorlimit (FuncState *fs, int limit, const char *what) { - lua_State *L = fs->ls->L; - const char *msg; - int line = fs->f->linedefined; - const char *where = (line == 0) - ? "main function" - : luaO_pushfstring(L, "function at line %d", line); - msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s", - what, limit, where); - luaX_syntaxerror(fs->ls, msg); -} - - -static void checklimit (FuncState *fs, int v, int l, const char *what) { - if (v > l) errorlimit(fs, l, what); -} - - -static int testnext (LexState *ls, int c) { - if (ls->t.token == c) { - luaX_next(ls); - return 1; - } - else return 0; -} - - -static void check (LexState *ls, int c) { - if (ls->t.token != c) - error_expected(ls, c); -} - - -static void checknext (LexState *ls, int c) { - check(ls, c); - luaX_next(ls); -} - - -#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } - - - -static void check_match (LexState *ls, int what, int who, int where) { - if (!testnext(ls, what)) { - if (where == ls->linenumber) - error_expected(ls, what); - else { - luaX_syntaxerror(ls, luaO_pushfstring(ls->L, - "%s expected (to close %s at line %d)", - luaX_token2str(ls, what), luaX_token2str(ls, who), where)); - } - } -} - - -static TString *str_checkname (LexState *ls) { - TString *ts; - check(ls, TK_NAME); - ts = ls->t.seminfo.ts; - luaX_next(ls); - return ts; -} - - -static void init_exp (expdesc *e, expkind k, int i) { - e->f = e->t = NO_JUMP; - e->k = k; - e->u.info = i; -} - - -static void codestring (LexState *ls, expdesc *e, TString *s) { - init_exp(e, VK, luaK_stringK(ls->fs, s)); -} - - -static void checkname (LexState *ls, expdesc *e) { - codestring(ls, e, str_checkname(ls)); -} - - -static int registerlocalvar (LexState *ls, TString *varname) { - FuncState *fs = ls->fs; - Proto *f = fs->f; - int oldsize = f->sizelocvars; - luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, - LocVar, SHRT_MAX, "local variables"); - while (oldsize < f->sizelocvars) - f->locvars[oldsize++].varname = NULL; - f->locvars[fs->nlocvars].varname = varname; - luaC_objbarrier(ls->L, f, varname); - return fs->nlocvars++; -} - - -static void new_localvar (LexState *ls, TString *name) { - FuncState *fs = ls->fs; - Dyndata *dyd = ls->dyd; - int reg = registerlocalvar(ls, name); - checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, - MAXVARS, "local variables"); - luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1, - dyd->actvar.size, Vardesc, MAX_INT, "local variables"); - dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg); -} - - -static void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) { - new_localvar(ls, luaX_newstring(ls, name, sz)); -} - -#define new_localvarliteral(ls,v) \ - new_localvarliteral_(ls, "" v, (sizeof(v)/sizeof(char))-1) - - -static LocVar *getlocvar (FuncState *fs, int i) { - int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx; - lua_assert(idx < fs->nlocvars); - return &fs->f->locvars[idx]; -} - - -static void adjustlocalvars (LexState *ls, int nvars) { - FuncState *fs = ls->fs; - fs->nactvar = cast_byte(fs->nactvar + nvars); - for (; nvars; nvars--) { - getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc; - } -} - - -static void removevars (FuncState *fs, int tolevel) { - fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel); - while (fs->nactvar > tolevel) - getlocvar(fs, --fs->nactvar)->endpc = fs->pc; -} - - -static int searchupvalue (FuncState *fs, TString *name) { - int i; - Upvaldesc *up = fs->f->upvalues; - for (i = 0; i < fs->nups; i++) { - if (eqstr(up[i].name, name)) return i; - } - return -1; /* not found */ -} - - -static int newupvalue (FuncState *fs, TString *name, expdesc *v) { - Proto *f = fs->f; - int oldsize = f->sizeupvalues; - checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); - luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, - Upvaldesc, MAXUPVAL, "upvalues"); - while (oldsize < f->sizeupvalues) - f->upvalues[oldsize++].name = NULL; - f->upvalues[fs->nups].instack = (v->k == VLOCAL); - f->upvalues[fs->nups].idx = cast_byte(v->u.info); - f->upvalues[fs->nups].name = name; - luaC_objbarrier(fs->ls->L, f, name); - return fs->nups++; -} - - -static int searchvar (FuncState *fs, TString *n) { - int i; - for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) { - if (eqstr(n, getlocvar(fs, i)->varname)) - return i; - } - return -1; /* not found */ -} - - -/* - Mark block where variable at given level was defined - (to emit close instructions later). -*/ -static void markupval (FuncState *fs, int level) { - BlockCnt *bl = fs->bl; - while (bl->nactvar > level) - bl = bl->previous; - bl->upval = 1; -} - - -/* - Find variable with given name 'n'. If it is an upvalue, add this - upvalue into all intermediate functions. -*/ -static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { - if (fs == NULL) /* no more levels? */ - init_exp(var, VVOID, 0); /* default is global */ - else { - int v = searchvar(fs, n); /* look up locals at current level */ - if (v >= 0) { /* found? */ - init_exp(var, VLOCAL, v); /* variable is local */ - if (!base) - markupval(fs, v); /* local will be used as an upval */ - } - else { /* not found as local at current level; try upvalues */ - int idx = searchupvalue(fs, n); /* try existing upvalues */ - if (idx < 0) { /* not found? */ - singlevaraux(fs->prev, n, var, 0); /* try upper levels */ - if (var->k == VVOID) /* not found? */ - return; /* it is a global */ - /* else was LOCAL or UPVAL */ - idx = newupvalue(fs, n, var); /* will be a new upvalue */ - } - init_exp(var, VUPVAL, idx); /* new or old upvalue */ - } - } -} - - -static void singlevar (LexState *ls, expdesc *var) { - TString *varname = str_checkname(ls); - FuncState *fs = ls->fs; - singlevaraux(fs, varname, var, 1); - if (var->k == VVOID) { /* global name? */ - expdesc key; - singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ - lua_assert(var->k != VVOID); /* this one must exist */ - codestring(ls, &key, varname); /* key is variable name */ - luaK_indexed(fs, var, &key); /* env[varname] */ - } -} - - -static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { - FuncState *fs = ls->fs; - int extra = nvars - nexps; - if (hasmultret(e->k)) { - extra++; /* includes call itself */ - if (extra < 0) extra = 0; - luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ - if (extra > 1) luaK_reserveregs(fs, extra-1); - } - else { - if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ - if (extra > 0) { - int reg = fs->freereg; - luaK_reserveregs(fs, extra); - luaK_nil(fs, reg, extra); - } - } - if (nexps > nvars) - ls->fs->freereg -= nexps - nvars; /* remove extra values */ -} - - -static void enterlevel (LexState *ls) { - lua_State *L = ls->L; - ++L->nCcalls; - checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels"); -} - - -#define leavelevel(ls) ((ls)->L->nCcalls--) - - -static void closegoto (LexState *ls, int g, Labeldesc *label) { - int i; - FuncState *fs = ls->fs; - Labellist *gl = &ls->dyd->gt; - Labeldesc *gt = &gl->arr[g]; - lua_assert(eqstr(gt->name, label->name)); - if (gt->nactvar < label->nactvar) { - TString *vname = getlocvar(fs, gt->nactvar)->varname; - const char *msg = luaO_pushfstring(ls->L, - " at line %d jumps into the scope of local '%s'", - getstr(gt->name), gt->line, getstr(vname)); - semerror(ls, msg); - } - luaK_patchlist(fs, gt->pc, label->pc); - /* remove goto from pending list */ - for (i = g; i < gl->n - 1; i++) - gl->arr[i] = gl->arr[i + 1]; - gl->n--; -} - - -/* -** try to close a goto with existing labels; this solves backward jumps -*/ -static int findlabel (LexState *ls, int g) { - int i; - BlockCnt *bl = ls->fs->bl; - Dyndata *dyd = ls->dyd; - Labeldesc *gt = &dyd->gt.arr[g]; - /* check labels in current block for a match */ - for (i = bl->firstlabel; i < dyd->label.n; i++) { - Labeldesc *lb = &dyd->label.arr[i]; - if (eqstr(lb->name, gt->name)) { /* correct label? */ - if (gt->nactvar > lb->nactvar && - (bl->upval || dyd->label.n > bl->firstlabel)) - luaK_patchclose(ls->fs, gt->pc, lb->nactvar); - closegoto(ls, g, lb); /* close it */ - return 1; - } - } - return 0; /* label not found; cannot close goto */ -} - - -static int newlabelentry (LexState *ls, Labellist *l, TString *name, - int line, int pc) { - int n = l->n; - luaM_growvector(ls->L, l->arr, n, l->size, - Labeldesc, SHRT_MAX, "labels/gotos"); - l->arr[n].name = name; - l->arr[n].line = line; - l->arr[n].nactvar = ls->fs->nactvar; - l->arr[n].pc = pc; - l->n = n + 1; - return n; -} - - -/* -** check whether new label 'lb' matches any pending gotos in current -** block; solves forward jumps -*/ -static void findgotos (LexState *ls, Labeldesc *lb) { - Labellist *gl = &ls->dyd->gt; - int i = ls->fs->bl->firstgoto; - while (i < gl->n) { - if (eqstr(gl->arr[i].name, lb->name)) - closegoto(ls, i, lb); - else - i++; - } -} - - -/* -** export pending gotos to outer level, to check them against -** outer labels; if the block being exited has upvalues, and -** the goto exits the scope of any variable (which can be the -** upvalue), close those variables being exited. -*/ -static void movegotosout (FuncState *fs, BlockCnt *bl) { - int i = bl->firstgoto; - Labellist *gl = &fs->ls->dyd->gt; - /* correct pending gotos to current block and try to close it - with visible labels */ - while (i < gl->n) { - Labeldesc *gt = &gl->arr[i]; - if (gt->nactvar > bl->nactvar) { - if (bl->upval) - luaK_patchclose(fs, gt->pc, bl->nactvar); - gt->nactvar = bl->nactvar; - } - if (!findlabel(fs->ls, i)) - i++; /* move to next one */ - } -} - - -static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { - bl->isloop = isloop; - bl->nactvar = fs->nactvar; - bl->firstlabel = fs->ls->dyd->label.n; - bl->firstgoto = fs->ls->dyd->gt.n; - bl->upval = 0; - bl->previous = fs->bl; - fs->bl = bl; - lua_assert(fs->freereg == fs->nactvar); -} - - -/* -** create a label named 'break' to resolve break statements -*/ -static void breaklabel (LexState *ls) { - TString *n = luaS_new(ls->L, "break"); - int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc); - findgotos(ls, &ls->dyd->label.arr[l]); -} - -/* -** generates an error for an undefined 'goto'; choose appropriate -** message when label name is a reserved word (which can only be 'break') -*/ -static l_noret undefgoto (LexState *ls, Labeldesc *gt) { - const char *msg = isreserved(gt->name) - ? "<%s> at line %d not inside a loop" - : "no visible label '%s' for at line %d"; - msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); - semerror(ls, msg); -} - - -static void leaveblock (FuncState *fs) { - BlockCnt *bl = fs->bl; - LexState *ls = fs->ls; - if (bl->previous && bl->upval) { - /* create a 'jump to here' to close upvalues */ - int j = luaK_jump(fs); - luaK_patchclose(fs, j, bl->nactvar); - luaK_patchtohere(fs, j); - } - if (bl->isloop) - breaklabel(ls); /* close pending breaks */ - fs->bl = bl->previous; - removevars(fs, bl->nactvar); - lua_assert(bl->nactvar == fs->nactvar); - fs->freereg = fs->nactvar; /* free registers */ - ls->dyd->label.n = bl->firstlabel; /* remove local labels */ - if (bl->previous) /* inner block? */ - movegotosout(fs, bl); /* update pending gotos to outer block */ - else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */ - undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */ -} - - -/* -** adds a new prototype into list of prototypes -*/ -static Proto *addprototype (LexState *ls) { - Proto *clp; - lua_State *L = ls->L; - FuncState *fs = ls->fs; - Proto *f = fs->f; /* prototype of current function */ - if (fs->np >= f->sizep) { - int oldsize = f->sizep; - luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); - while (oldsize < f->sizep) - f->p[oldsize++] = NULL; - } - f->p[fs->np++] = clp = luaF_newproto(L); - luaC_objbarrier(L, f, clp); - return clp; -} - - -/* -** codes instruction to create new closure in parent function. -** The OP_CLOSURE instruction must use the last available register, -** so that, if it invokes the GC, the GC knows which registers -** are in use at that time. -*/ -static void codeclosure (LexState *ls, expdesc *v) { - FuncState *fs = ls->fs->prev; - init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); - luaK_exp2nextreg(fs, v); /* fix it at the last register */ -} - - -static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { - Proto *f; - fs->prev = ls->fs; /* linked list of funcstates */ - fs->ls = ls; - ls->fs = fs; - fs->pc = 0; - fs->lasttarget = 0; - fs->jpc = NO_JUMP; - fs->freereg = 0; - fs->nk = 0; - fs->np = 0; - fs->nups = 0; - fs->nlocvars = 0; - fs->nactvar = 0; - fs->firstlocal = ls->dyd->actvar.n; - fs->bl = NULL; - f = fs->f; - f->source = ls->source; - f->maxstacksize = 2; /* registers 0/1 are always valid */ - enterblock(fs, bl, 0); -} - - -static void close_func (LexState *ls) { - lua_State *L = ls->L; - FuncState *fs = ls->fs; - Proto *f = fs->f; - luaK_ret(fs, 0, 0); /* final return */ - leaveblock(fs); - luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); - f->sizecode = fs->pc; - luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); - f->sizelineinfo = fs->pc; - luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); - f->sizek = fs->nk; - luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); - f->sizep = fs->np; - luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); - f->sizelocvars = fs->nlocvars; - luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc); - f->sizeupvalues = fs->nups; - lua_assert(fs->bl == NULL); - ls->fs = fs->prev; - luaC_checkGC(L); -} - - - -/*============================================================*/ -/* GRAMMAR RULES */ -/*============================================================*/ - - -/* -** check whether current token is in the follow set of a block. -** 'until' closes syntactical blocks, but do not close scope, -** so it is handled in separate. -*/ -static int block_follow (LexState *ls, int withuntil) { - switch (ls->t.token) { - case TK_ELSE: case TK_ELSEIF: - case TK_END: case TK_EOS: - return 1; - case TK_UNTIL: return withuntil; - default: return 0; - } -} - - -static void statlist (LexState *ls) { - /* statlist -> { stat [';'] } */ - while (!block_follow(ls, 1)) { - if (ls->t.token == TK_RETURN) { - statement(ls); - return; /* 'return' must be last statement */ - } - statement(ls); - } -} - - -static void fieldsel (LexState *ls, expdesc *v) { - /* fieldsel -> ['.' | ':'] NAME */ - FuncState *fs = ls->fs; - expdesc key; - luaK_exp2anyregup(fs, v); - luaX_next(ls); /* skip the dot or colon */ - checkname(ls, &key); - luaK_indexed(fs, v, &key); -} - - -static void yindex (LexState *ls, expdesc *v) { - /* index -> '[' expr ']' */ - luaX_next(ls); /* skip the '[' */ - expr(ls, v); - luaK_exp2val(ls->fs, v); - checknext(ls, ']'); -} - - -/* -** {====================================================================== -** Rules for Constructors -** ======================================================================= -*/ - - -struct ConsControl { - expdesc v; /* last list item read */ - expdesc *t; /* table descriptor */ - int nh; /* total number of 'record' elements */ - int na; /* total number of array elements */ - int tostore; /* number of array elements pending to be stored */ -}; - - -static void recfield (LexState *ls, struct ConsControl *cc) { - /* recfield -> (NAME | '['exp1']') = exp1 */ - FuncState *fs = ls->fs; - int reg = ls->fs->freereg; - expdesc key, val; - int rkkey; - if (ls->t.token == TK_NAME) { - checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); - checkname(ls, &key); - } - else /* ls->t.token == '[' */ - yindex(ls, &key); - cc->nh++; - checknext(ls, '='); - rkkey = luaK_exp2RK(fs, &key); - expr(ls, &val); - luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); - fs->freereg = reg; /* free registers */ -} - - -static void closelistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->v.k == VVOID) return; /* there is no list item */ - luaK_exp2nextreg(fs, &cc->v); - cc->v.k = VVOID; - if (cc->tostore == LFIELDS_PER_FLUSH) { - luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ - cc->tostore = 0; /* no more items pending */ - } -} - - -static void lastlistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->tostore == 0) return; - if (hasmultret(cc->v.k)) { - luaK_setmultret(fs, &cc->v); - luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); - cc->na--; /* do not count last expression (unknown number of elements) */ - } - else { - if (cc->v.k != VVOID) - luaK_exp2nextreg(fs, &cc->v); - luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); - } -} - - -static void listfield (LexState *ls, struct ConsControl *cc) { - /* listfield -> exp */ - expr(ls, &cc->v); - checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); - cc->na++; - cc->tostore++; -} - - -static void field (LexState *ls, struct ConsControl *cc) { - /* field -> listfield | recfield */ - switch(ls->t.token) { - case TK_NAME: { /* may be 'listfield' or 'recfield' */ - if (luaX_lookahead(ls) != '=') /* expression? */ - listfield(ls, cc); - else - recfield(ls, cc); - break; - } - case '[': { - recfield(ls, cc); - break; - } - default: { - listfield(ls, cc); - break; - } - } -} - - -static void constructor (LexState *ls, expdesc *t) { - /* constructor -> '{' [ field { sep field } [sep] ] '}' - sep -> ',' | ';' */ - FuncState *fs = ls->fs; - int line = ls->linenumber; - int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); - struct ConsControl cc; - cc.na = cc.nh = cc.tostore = 0; - cc.t = t; - init_exp(t, VRELOCABLE, pc); - init_exp(&cc.v, VVOID, 0); /* no value (yet) */ - luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */ - checknext(ls, '{'); - do { - lua_assert(cc.v.k == VVOID || cc.tostore > 0); - if (ls->t.token == '}') break; - closelistfield(fs, &cc); - field(ls, &cc); - } while (testnext(ls, ',') || testnext(ls, ';')); - check_match(ls, '}', '{', line); - lastlistfield(fs, &cc); - SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ - SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ -} - -/* }====================================================================== */ - - - -static void parlist (LexState *ls) { - /* parlist -> [ param { ',' param } ] */ - FuncState *fs = ls->fs; - Proto *f = fs->f; - int nparams = 0; - f->is_vararg = 0; - if (ls->t.token != ')') { /* is 'parlist' not empty? */ - do { - switch (ls->t.token) { - case TK_NAME: { /* param -> NAME */ - new_localvar(ls, str_checkname(ls)); - nparams++; - break; - } - case TK_DOTS: { /* param -> '...' */ - luaX_next(ls); - f->is_vararg = 1; /* declared vararg */ - break; - } - default: luaX_syntaxerror(ls, " or '...' expected"); - } - } while (!f->is_vararg && testnext(ls, ',')); - } - adjustlocalvars(ls, nparams); - f->numparams = cast_byte(fs->nactvar); - luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ -} - - -static void body (LexState *ls, expdesc *e, int ismethod, int line) { - /* body -> '(' parlist ')' block END */ - FuncState new_fs; - BlockCnt bl; - new_fs.f = addprototype(ls); - new_fs.f->linedefined = line; - open_func(ls, &new_fs, &bl); - checknext(ls, '('); - if (ismethod) { - new_localvarliteral(ls, "self"); /* create 'self' parameter */ - adjustlocalvars(ls, 1); - } - parlist(ls); - checknext(ls, ')'); - statlist(ls); - new_fs.f->lastlinedefined = ls->linenumber; - check_match(ls, TK_END, TK_FUNCTION, line); - codeclosure(ls, e); - close_func(ls); -} - - -static int explist (LexState *ls, expdesc *v) { - /* explist -> expr { ',' expr } */ - int n = 1; /* at least one expression */ - expr(ls, v); - while (testnext(ls, ',')) { - luaK_exp2nextreg(ls->fs, v); - expr(ls, v); - n++; - } - return n; -} - - -static void funcargs (LexState *ls, expdesc *f, int line) { - FuncState *fs = ls->fs; - expdesc args; - int base, nparams; - switch (ls->t.token) { - case '(': { /* funcargs -> '(' [ explist ] ')' */ - luaX_next(ls); - if (ls->t.token == ')') /* arg list is empty? */ - args.k = VVOID; - else { - explist(ls, &args); - luaK_setmultret(fs, &args); - } - check_match(ls, ')', '(', line); - break; - } - case '{': { /* funcargs -> constructor */ - constructor(ls, &args); - break; - } - case TK_STRING: { /* funcargs -> STRING */ - codestring(ls, &args, ls->t.seminfo.ts); - luaX_next(ls); /* must use 'seminfo' before 'next' */ - break; - } - default: { - luaX_syntaxerror(ls, "function arguments expected"); - } - } - lua_assert(f->k == VNONRELOC); - base = f->u.info; /* base register for call */ - if (hasmultret(args.k)) - nparams = LUA_MULTRET; /* open call */ - else { - if (args.k != VVOID) - luaK_exp2nextreg(fs, &args); /* close last argument */ - nparams = fs->freereg - (base+1); - } - init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); - luaK_fixline(fs, line); - fs->freereg = base+1; /* call remove function and arguments and leaves - (unless changed) one result */ -} - - - - -/* -** {====================================================================== -** Expression parsing -** ======================================================================= -*/ - - -static void primaryexp (LexState *ls, expdesc *v) { - /* primaryexp -> NAME | '(' expr ')' */ - switch (ls->t.token) { - case '(': { - int line = ls->linenumber; - luaX_next(ls); - expr(ls, v); - check_match(ls, ')', '(', line); - luaK_dischargevars(ls->fs, v); - return; - } - case TK_NAME: { - singlevar(ls, v); - return; - } - default: { - luaX_syntaxerror(ls, "unexpected symbol"); - } - } -} - - -static void suffixedexp (LexState *ls, expdesc *v) { - /* suffixedexp -> - primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ - FuncState *fs = ls->fs; - int line = ls->linenumber; - primaryexp(ls, v); - for (;;) { - switch (ls->t.token) { - case '.': { /* fieldsel */ - fieldsel(ls, v); - break; - } - case '[': { /* '[' exp1 ']' */ - expdesc key; - luaK_exp2anyregup(fs, v); - yindex(ls, &key); - luaK_indexed(fs, v, &key); - break; - } - case ':': { /* ':' NAME funcargs */ - expdesc key; - luaX_next(ls); - checkname(ls, &key); - luaK_self(fs, v, &key); - funcargs(ls, v, line); - break; - } - case '(': case TK_STRING: case '{': { /* funcargs */ - luaK_exp2nextreg(fs, v); - funcargs(ls, v, line); - break; - } - default: return; - } - } -} - - -static void simpleexp (LexState *ls, expdesc *v) { - /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | - constructor | FUNCTION body | suffixedexp */ - switch (ls->t.token) { - case TK_FLT: { - init_exp(v, VKFLT, 0); - v->u.nval = ls->t.seminfo.r; - break; - } - case TK_INT: { - init_exp(v, VKINT, 0); - v->u.ival = ls->t.seminfo.i; - break; - } - case TK_STRING: { - codestring(ls, v, ls->t.seminfo.ts); - break; - } - case TK_NIL: { - init_exp(v, VNIL, 0); - break; - } - case TK_TRUE: { - init_exp(v, VTRUE, 0); - break; - } - case TK_FALSE: { - init_exp(v, VFALSE, 0); - break; - } - case TK_DOTS: { /* vararg */ - FuncState *fs = ls->fs; - check_condition(ls, fs->f->is_vararg, - "cannot use '...' outside a vararg function"); - init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); - break; - } - case '{': { /* constructor */ - constructor(ls, v); - return; - } - case TK_FUNCTION: { - luaX_next(ls); - body(ls, v, 0, ls->linenumber); - return; - } - default: { - suffixedexp(ls, v); - return; - } - } - luaX_next(ls); -} - - -static UnOpr getunopr (int op) { - switch (op) { - case TK_NOT: return OPR_NOT; - case '-': return OPR_MINUS; - case '~': return OPR_BNOT; - case '#': return OPR_LEN; - default: return OPR_NOUNOPR; - } -} - - -static BinOpr getbinopr (int op) { - switch (op) { - case '+': return OPR_ADD; - case '-': return OPR_SUB; - case '*': return OPR_MUL; - case '%': return OPR_MOD; - case '^': return OPR_POW; - case '/': return OPR_DIV; - case TK_IDIV: return OPR_IDIV; - case '&': return OPR_BAND; - case '|': return OPR_BOR; - case '~': return OPR_BXOR; - case TK_SHL: return OPR_SHL; - case TK_SHR: return OPR_SHR; - case TK_CONCAT: return OPR_CONCAT; - case TK_NE: return OPR_NE; - case TK_EQ: return OPR_EQ; - case '<': return OPR_LT; - case TK_LE: return OPR_LE; - case '>': return OPR_GT; - case TK_GE: return OPR_GE; - case TK_AND: return OPR_AND; - case TK_OR: return OPR_OR; - default: return OPR_NOBINOPR; - } -} - - -static const struct { - lu_byte left; /* left priority for each binary operator */ - lu_byte right; /* right priority */ -} priority[] = { /* ORDER OPR */ - {10, 10}, {10, 10}, /* '+' '-' */ - {11, 11}, {11, 11}, /* '*' '%' */ - {14, 13}, /* '^' (right associative) */ - {11, 11}, {11, 11}, /* '/' '//' */ - {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */ - {7, 7}, {7, 7}, /* '<<' '>>' */ - {9, 8}, /* '..' (right associative) */ - {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ - {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ - {2, 2}, {1, 1} /* and, or */ -}; - -#define UNARY_PRIORITY 12 /* priority for unary operators */ - - -/* -** subexpr -> (simpleexp | unop subexpr) { binop subexpr } -** where 'binop' is any binary operator with a priority higher than 'limit' -*/ -static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { - BinOpr op; - UnOpr uop; - enterlevel(ls); - uop = getunopr(ls->t.token); - if (uop != OPR_NOUNOPR) { - int line = ls->linenumber; - luaX_next(ls); - subexpr(ls, v, UNARY_PRIORITY); - luaK_prefix(ls->fs, uop, v, line); - } - else simpleexp(ls, v); - /* expand while operators have priorities higher than 'limit' */ - op = getbinopr(ls->t.token); - while (op != OPR_NOBINOPR && priority[op].left > limit) { - expdesc v2; - BinOpr nextop; - int line = ls->linenumber; - luaX_next(ls); - luaK_infix(ls->fs, op, v); - /* read sub-expression with higher priority */ - nextop = subexpr(ls, &v2, priority[op].right); - luaK_posfix(ls->fs, op, v, &v2, line); - op = nextop; - } - leavelevel(ls); - return op; /* return first untreated operator */ -} - - -static void expr (LexState *ls, expdesc *v) { - subexpr(ls, v, 0); -} - -/* }==================================================================== */ - - - -/* -** {====================================================================== -** Rules for Statements -** ======================================================================= -*/ - - -static void block (LexState *ls) { - /* block -> statlist */ - FuncState *fs = ls->fs; - BlockCnt bl; - enterblock(fs, &bl, 0); - statlist(ls); - leaveblock(fs); -} - - -/* -** structure to chain all variables in the left-hand side of an -** assignment -*/ -struct LHS_assign { - struct LHS_assign *prev; - expdesc v; /* variable (global, local, upvalue, or indexed) */ -}; - - -/* -** check whether, in an assignment to an upvalue/local variable, the -** upvalue/local variable is begin used in a previous assignment to a -** table. If so, save original upvalue/local value in a safe place and -** use this safe copy in the previous assignment. -*/ -static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { - FuncState *fs = ls->fs; - int extra = fs->freereg; /* eventual position to save local variable */ - int conflict = 0; - for (; lh; lh = lh->prev) { /* check all previous assignments */ - if (lh->v.k == VINDEXED) { /* assigning to a table? */ - /* table is the upvalue/local being assigned now? */ - if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) { - conflict = 1; - lh->v.u.ind.vt = VLOCAL; - lh->v.u.ind.t = extra; /* previous assignment will use safe copy */ - } - /* index is the local being assigned? (index cannot be upvalue) */ - if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { - conflict = 1; - lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ - } - } - } - if (conflict) { - /* copy upvalue/local value to a temporary (in position 'extra') */ - OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; - luaK_codeABC(fs, op, extra, v->u.info, 0); - luaK_reserveregs(fs, 1); - } -} - - -static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { - expdesc e; - check_condition(ls, vkisvar(lh->v.k), "syntax error"); - if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */ - struct LHS_assign nv; - nv.prev = lh; - suffixedexp(ls, &nv.v); - if (nv.v.k != VINDEXED) - check_conflict(ls, lh, &nv.v); - checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS, - "C levels"); - assignment(ls, &nv, nvars+1); - } - else { /* assignment -> '=' explist */ - int nexps; - checknext(ls, '='); - nexps = explist(ls, &e); - if (nexps != nvars) - adjust_assign(ls, nvars, nexps, &e); - else { - luaK_setoneret(ls->fs, &e); /* close last expression */ - luaK_storevar(ls->fs, &lh->v, &e); - return; /* avoid default */ - } - } - init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ - luaK_storevar(ls->fs, &lh->v, &e); -} - - -static int cond (LexState *ls) { - /* cond -> exp */ - expdesc v; - expr(ls, &v); /* read condition */ - if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */ - luaK_goiftrue(ls->fs, &v); - return v.f; -} - - -static void gotostat (LexState *ls, int pc) { - int line = ls->linenumber; - TString *label; - int g; - if (testnext(ls, TK_GOTO)) - label = str_checkname(ls); - else { - luaX_next(ls); /* skip break */ - label = luaS_new(ls->L, "break"); - } - g = newlabelentry(ls, &ls->dyd->gt, label, line, pc); - findlabel(ls, g); /* close it if label already defined */ -} - - -/* check for repeated labels on the same block */ -static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) { - int i; - for (i = fs->bl->firstlabel; i < ll->n; i++) { - if (eqstr(label, ll->arr[i].name)) { - const char *msg = luaO_pushfstring(fs->ls->L, - "label '%s' already defined on line %d", - getstr(label), ll->arr[i].line); - semerror(fs->ls, msg); - } - } -} - - -/* skip no-op statements */ -static void skipnoopstat (LexState *ls) { - while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) - statement(ls); -} - - -static void labelstat (LexState *ls, TString *label, int line) { - /* label -> '::' NAME '::' */ - FuncState *fs = ls->fs; - Labellist *ll = &ls->dyd->label; - int l; /* index of new label being created */ - checkrepeated(fs, ll, label); /* check for repeated labels */ - checknext(ls, TK_DBCOLON); /* skip double colon */ - /* create new entry for this label */ - l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); - skipnoopstat(ls); /* skip other no-op statements */ - if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ - /* assume that locals are already out of scope */ - ll->arr[l].nactvar = fs->bl->nactvar; - } - findgotos(ls, &ll->arr[l]); -} - - -static void whilestat (LexState *ls, int line) { - /* whilestat -> WHILE cond DO block END */ - FuncState *fs = ls->fs; - int whileinit; - int condexit; - BlockCnt bl; - luaX_next(ls); /* skip WHILE */ - whileinit = luaK_getlabel(fs); - condexit = cond(ls); - enterblock(fs, &bl, 1); - checknext(ls, TK_DO); - block(ls); - luaK_jumpto(fs, whileinit); - check_match(ls, TK_END, TK_WHILE, line); - leaveblock(fs); - luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ -} - - -static void repeatstat (LexState *ls, int line) { - /* repeatstat -> REPEAT block UNTIL cond */ - int condexit; - FuncState *fs = ls->fs; - int repeat_init = luaK_getlabel(fs); - BlockCnt bl1, bl2; - enterblock(fs, &bl1, 1); /* loop block */ - enterblock(fs, &bl2, 0); /* scope block */ - luaX_next(ls); /* skip REPEAT */ - statlist(ls); - check_match(ls, TK_UNTIL, TK_REPEAT, line); - condexit = cond(ls); /* read condition (inside scope block) */ - if (bl2.upval) /* upvalues? */ - luaK_patchclose(fs, condexit, bl2.nactvar); - leaveblock(fs); /* finish scope */ - luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ - leaveblock(fs); /* finish loop */ -} - - -static int exp1 (LexState *ls) { - expdesc e; - int reg; - expr(ls, &e); - luaK_exp2nextreg(ls->fs, &e); - lua_assert(e.k == VNONRELOC); - reg = e.u.info; - return reg; -} - - -static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { - /* forbody -> DO block */ - BlockCnt bl; - FuncState *fs = ls->fs; - int prep, endfor; - adjustlocalvars(ls, 3); /* control variables */ - checknext(ls, TK_DO); - prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); - enterblock(fs, &bl, 0); /* scope for declared variables */ - adjustlocalvars(ls, nvars); - luaK_reserveregs(fs, nvars); - block(ls); - leaveblock(fs); /* end of scope for declared variables */ - luaK_patchtohere(fs, prep); - if (isnum) /* numeric for? */ - endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP); - else { /* generic for */ - luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars); - luaK_fixline(fs, line); - endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP); - } - luaK_patchlist(fs, endfor, prep + 1); - luaK_fixline(fs, line); -} - - -static void fornum (LexState *ls, TString *varname, int line) { - /* fornum -> NAME = exp1,exp1[,exp1] forbody */ - FuncState *fs = ls->fs; - int base = fs->freereg; - new_localvarliteral(ls, "(for index)"); - new_localvarliteral(ls, "(for limit)"); - new_localvarliteral(ls, "(for step)"); - new_localvar(ls, varname); - checknext(ls, '='); - exp1(ls); /* initial value */ - checknext(ls, ','); - exp1(ls); /* limit */ - if (testnext(ls, ',')) - exp1(ls); /* optional step */ - else { /* default step = 1 */ - luaK_codek(fs, fs->freereg, luaK_intK(fs, 1)); - luaK_reserveregs(fs, 1); - } - forbody(ls, base, line, 1, 1); -} - - -static void forlist (LexState *ls, TString *indexname) { - /* forlist -> NAME {,NAME} IN explist forbody */ - FuncState *fs = ls->fs; - expdesc e; - int nvars = 4; /* gen, state, control, plus at least one declared var */ - int line; - int base = fs->freereg; - /* create control variables */ - new_localvarliteral(ls, "(for generator)"); - new_localvarliteral(ls, "(for state)"); - new_localvarliteral(ls, "(for control)"); - /* create declared variables */ - new_localvar(ls, indexname); - while (testnext(ls, ',')) { - new_localvar(ls, str_checkname(ls)); - nvars++; - } - checknext(ls, TK_IN); - line = ls->linenumber; - adjust_assign(ls, 3, explist(ls, &e), &e); - luaK_checkstack(fs, 3); /* extra space to call generator */ - forbody(ls, base, line, nvars - 3, 0); -} - - -static void forstat (LexState *ls, int line) { - /* forstat -> FOR (fornum | forlist) END */ - FuncState *fs = ls->fs; - TString *varname; - BlockCnt bl; - enterblock(fs, &bl, 1); /* scope for loop and control variables */ - luaX_next(ls); /* skip 'for' */ - varname = str_checkname(ls); /* first variable name */ - switch (ls->t.token) { - case '=': fornum(ls, varname, line); break; - case ',': case TK_IN: forlist(ls, varname); break; - default: luaX_syntaxerror(ls, "'=' or 'in' expected"); - } - check_match(ls, TK_END, TK_FOR, line); - leaveblock(fs); /* loop scope ('break' jumps to this point) */ -} - - -static void test_then_block (LexState *ls, int *escapelist) { - /* test_then_block -> [IF | ELSEIF] cond THEN block */ - BlockCnt bl; - FuncState *fs = ls->fs; - expdesc v; - int jf; /* instruction to skip 'then' code (if condition is false) */ - luaX_next(ls); /* skip IF or ELSEIF */ - expr(ls, &v); /* read condition */ - checknext(ls, TK_THEN); - if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) { - luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */ - enterblock(fs, &bl, 0); /* must enter block before 'goto' */ - gotostat(ls, v.t); /* handle goto/break */ - skipnoopstat(ls); /* skip other no-op statements */ - if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ - leaveblock(fs); - return; /* and that is it */ - } - else /* must skip over 'then' part if condition is false */ - jf = luaK_jump(fs); - } - else { /* regular case (not goto/break) */ - luaK_goiftrue(ls->fs, &v); /* skip over block if condition is false */ - enterblock(fs, &bl, 0); - jf = v.f; - } - statlist(ls); /* 'then' part */ - leaveblock(fs); - if (ls->t.token == TK_ELSE || - ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ - luaK_concat(fs, escapelist, luaK_jump(fs)); /* must jump over it */ - luaK_patchtohere(fs, jf); -} - - -static void ifstat (LexState *ls, int line) { - /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ - FuncState *fs = ls->fs; - int escapelist = NO_JUMP; /* exit list for finished parts */ - test_then_block(ls, &escapelist); /* IF cond THEN block */ - while (ls->t.token == TK_ELSEIF) - test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ - if (testnext(ls, TK_ELSE)) - block(ls); /* 'else' part */ - check_match(ls, TK_END, TK_IF, line); - luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ -} - - -static void localfunc (LexState *ls) { - expdesc b; - FuncState *fs = ls->fs; - new_localvar(ls, str_checkname(ls)); /* new local variable */ - adjustlocalvars(ls, 1); /* enter its scope */ - body(ls, &b, 0, ls->linenumber); /* function created in next register */ - /* debug information will only see the variable after this point! */ - getlocvar(fs, b.u.info)->startpc = fs->pc; -} - - -static void localstat (LexState *ls) { - /* stat -> LOCAL NAME {',' NAME} ['=' explist] */ - int nvars = 0; - int nexps; - expdesc e; - do { - new_localvar(ls, str_checkname(ls)); - nvars++; - } while (testnext(ls, ',')); - if (testnext(ls, '=')) - nexps = explist(ls, &e); - else { - e.k = VVOID; - nexps = 0; - } - adjust_assign(ls, nvars, nexps, &e); - adjustlocalvars(ls, nvars); -} - - -static int funcname (LexState *ls, expdesc *v) { - /* funcname -> NAME {fieldsel} [':' NAME] */ - int ismethod = 0; - singlevar(ls, v); - while (ls->t.token == '.') - fieldsel(ls, v); - if (ls->t.token == ':') { - ismethod = 1; - fieldsel(ls, v); - } - return ismethod; -} - - -static void funcstat (LexState *ls, int line) { - /* funcstat -> FUNCTION funcname body */ - int ismethod; - expdesc v, b; - luaX_next(ls); /* skip FUNCTION */ - ismethod = funcname(ls, &v); - body(ls, &b, ismethod, line); - luaK_storevar(ls->fs, &v, &b); - luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ -} - - -static void exprstat (LexState *ls) { - /* stat -> func | assignment */ - FuncState *fs = ls->fs; - struct LHS_assign v; - suffixedexp(ls, &v.v); - if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */ - v.prev = NULL; - assignment(ls, &v, 1); - } - else { /* stat -> func */ - check_condition(ls, v.v.k == VCALL, "syntax error"); - SETARG_C(getinstruction(fs, &v.v), 1); /* call statement uses no results */ - } -} - - -static void retstat (LexState *ls) { - /* stat -> RETURN [explist] [';'] */ - FuncState *fs = ls->fs; - expdesc e; - int first, nret; /* registers with returned values */ - if (block_follow(ls, 1) || ls->t.token == ';') - first = nret = 0; /* return no values */ - else { - nret = explist(ls, &e); /* optional return values */ - if (hasmultret(e.k)) { - luaK_setmultret(fs, &e); - if (e.k == VCALL && nret == 1) { /* tail call? */ - SET_OPCODE(getinstruction(fs,&e), OP_TAILCALL); - lua_assert(GETARG_A(getinstruction(fs,&e)) == fs->nactvar); - } - first = fs->nactvar; - nret = LUA_MULTRET; /* return all values */ - } - else { - if (nret == 1) /* only one single value? */ - first = luaK_exp2anyreg(fs, &e); - else { - luaK_exp2nextreg(fs, &e); /* values must go to the stack */ - first = fs->nactvar; /* return all active values */ - lua_assert(nret == fs->freereg - first); - } - } - } - luaK_ret(fs, first, nret); - testnext(ls, ';'); /* skip optional semicolon */ -} - - -static void statement (LexState *ls) { - int line = ls->linenumber; /* may be needed for error messages */ - enterlevel(ls); - switch (ls->t.token) { - case ';': { /* stat -> ';' (empty statement) */ - luaX_next(ls); /* skip ';' */ - break; - } - case TK_IF: { /* stat -> ifstat */ - ifstat(ls, line); - break; - } - case TK_WHILE: { /* stat -> whilestat */ - whilestat(ls, line); - break; - } - case TK_DO: { /* stat -> DO block END */ - luaX_next(ls); /* skip DO */ - block(ls); - check_match(ls, TK_END, TK_DO, line); - break; - } - case TK_FOR: { /* stat -> forstat */ - forstat(ls, line); - break; - } - case TK_REPEAT: { /* stat -> repeatstat */ - repeatstat(ls, line); - break; - } - case TK_FUNCTION: { /* stat -> funcstat */ - funcstat(ls, line); - break; - } - case TK_LOCAL: { /* stat -> localstat */ - luaX_next(ls); /* skip LOCAL */ - if (testnext(ls, TK_FUNCTION)) /* local function? */ - localfunc(ls); - else - localstat(ls); - break; - } - case TK_DBCOLON: { /* stat -> label */ - luaX_next(ls); /* skip double colon */ - labelstat(ls, str_checkname(ls), line); - break; - } - case TK_RETURN: { /* stat -> retstat */ - luaX_next(ls); /* skip RETURN */ - retstat(ls); - break; - } - case TK_BREAK: /* stat -> breakstat */ - case TK_GOTO: { /* stat -> 'goto' NAME */ - gotostat(ls, luaK_jump(ls->fs)); - break; - } - default: { /* stat -> func | assignment */ - exprstat(ls); - break; - } - } - lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && - ls->fs->freereg >= ls->fs->nactvar); - ls->fs->freereg = ls->fs->nactvar; /* free registers */ - leavelevel(ls); -} - -/* }====================================================================== */ - - -/* -** compiles the main function, which is a regular vararg function with an -** upvalue named LUA_ENV -*/ -static void mainfunc (LexState *ls, FuncState *fs) { - BlockCnt bl; - expdesc v; - open_func(ls, fs, &bl); - fs->f->is_vararg = 1; /* main function is always declared vararg */ - init_exp(&v, VLOCAL, 0); /* create and... */ - newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ - luaX_next(ls); /* read first token */ - statlist(ls); /* parse main body */ - check(ls, TK_EOS); - close_func(ls); -} - - -LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - Dyndata *dyd, const char *name, int firstchar) { - LexState lexstate; - FuncState funcstate; - LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ - setclLvalue(L, L->top, cl); /* anchor it (to avoid being collected) */ - luaD_inctop(L); - lexstate.h = luaH_new(L); /* create table for scanner */ - sethvalue(L, L->top, lexstate.h); /* anchor it */ - luaD_inctop(L); - funcstate.f = cl->p = luaF_newproto(L); - funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ - lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ - lexstate.buff = buff; - lexstate.dyd = dyd; - dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; - luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar); - mainfunc(&lexstate, &funcstate); - lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); - /* all scopes should be correctly finished */ - lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); - L->top--; /* remove scanner's table */ - return cl; /* closure is on the stack, too */ -} - diff --git a/deps/rcheevos/test/lua/src/lparser.h b/deps/rcheevos/test/lua/src/lparser.h deleted file mode 100644 index 02e9b03aeb..0000000000 --- a/deps/rcheevos/test/lua/src/lparser.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -** $Id: lparser.h,v 1.76 2015/12/30 18:16:13 roberto Exp $ -** Lua Parser -** See Copyright Notice in lua.h -*/ - -#ifndef lparser_h -#define lparser_h - -#include "llimits.h" -#include "lobject.h" -#include "lzio.h" - - -/* -** Expression and variable descriptor. -** Code generation for variables and expressions can be delayed to allow -** optimizations; An 'expdesc' structure describes a potentially-delayed -** variable/expression. It has a description of its "main" value plus a -** list of conditional jumps that can also produce its value (generated -** by short-circuit operators 'and'/'or'). -*/ - -/* kinds of variables/expressions */ -typedef enum { - VVOID, /* when 'expdesc' describes the last expression a list, - this kind means an empty list (so, no expression) */ - VNIL, /* constant nil */ - VTRUE, /* constant true */ - VFALSE, /* constant false */ - VK, /* constant in 'k'; info = index of constant in 'k' */ - VKFLT, /* floating constant; nval = numerical float value */ - VKINT, /* integer constant; nval = numerical integer value */ - VNONRELOC, /* expression has its value in a fixed register; - info = result register */ - VLOCAL, /* local variable; info = local register */ - VUPVAL, /* upvalue variable; info = index of upvalue in 'upvalues' */ - VINDEXED, /* indexed variable; - ind.vt = whether 't' is register or upvalue; - ind.t = table register or upvalue; - ind.idx = key's R/K index */ - VJMP, /* expression is a test/comparison; - info = pc of corresponding jump instruction */ - VRELOCABLE, /* expression can put result in any register; - info = instruction pc */ - VCALL, /* expression is a function call; info = instruction pc */ - VVARARG /* vararg expression; info = instruction pc */ -} expkind; - - -#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) -#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) - -typedef struct expdesc { - expkind k; - union { - lua_Integer ival; /* for VKINT */ - lua_Number nval; /* for VKFLT */ - int info; /* for generic use */ - struct { /* for indexed variables (VINDEXED) */ - short idx; /* index (R/K) */ - lu_byte t; /* table (register or upvalue) */ - lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ - } ind; - } u; - int t; /* patch list of 'exit when true' */ - int f; /* patch list of 'exit when false' */ -} expdesc; - - -/* description of active local variable */ -typedef struct Vardesc { - short idx; /* variable index in stack */ -} Vardesc; - - -/* description of pending goto statements and label statements */ -typedef struct Labeldesc { - TString *name; /* label identifier */ - int pc; /* position in code */ - int line; /* line where it appeared */ - lu_byte nactvar; /* local level where it appears in current block */ -} Labeldesc; - - -/* list of labels or gotos */ -typedef struct Labellist { - Labeldesc *arr; /* array */ - int n; /* number of entries in use */ - int size; /* array size */ -} Labellist; - - -/* dynamic structures used by the parser */ -typedef struct Dyndata { - struct { /* list of active local variables */ - Vardesc *arr; - int n; - int size; - } actvar; - Labellist gt; /* list of pending gotos */ - Labellist label; /* list of active labels */ -} Dyndata; - - -/* control of blocks */ -struct BlockCnt; /* defined in lparser.c */ - - -/* state needed to generate code for a given function */ -typedef struct FuncState { - Proto *f; /* current function header */ - struct FuncState *prev; /* enclosing function */ - struct LexState *ls; /* lexical state */ - struct BlockCnt *bl; /* chain of current blocks */ - int pc; /* next position to code (equivalent to 'ncode') */ - int lasttarget; /* 'label' of last 'jump label' */ - int jpc; /* list of pending jumps to 'pc' */ - int nk; /* number of elements in 'k' */ - int np; /* number of elements in 'p' */ - int firstlocal; /* index of first local var (in Dyndata array) */ - short nlocvars; /* number of elements in 'f->locvars' */ - lu_byte nactvar; /* number of active local variables */ - lu_byte nups; /* number of upvalues */ - lu_byte freereg; /* first free register */ -} FuncState; - - -LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - Dyndata *dyd, const char *name, int firstchar); - - -#endif diff --git a/deps/rcheevos/test/lua/src/lprefix.h b/deps/rcheevos/test/lua/src/lprefix.h deleted file mode 100644 index 02daa837f5..0000000000 --- a/deps/rcheevos/test/lua/src/lprefix.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ -** Definitions for Lua code that must come before any other header file -** See Copyright Notice in lua.h -*/ - -#ifndef lprefix_h -#define lprefix_h - - -/* -** Allows POSIX/XSI stuff -*/ -#if !defined(LUA_USE_C89) /* { */ - -#if !defined(_XOPEN_SOURCE) -#define _XOPEN_SOURCE 600 -#elif _XOPEN_SOURCE == 0 -#undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ -#endif - -/* -** Allows manipulation of large files in gcc and some other compilers -*/ -#if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) -#define _LARGEFILE_SOURCE 1 -#define _FILE_OFFSET_BITS 64 -#endif - -#endif /* } */ - - -/* -** Windows stuff -*/ -#if defined(_WIN32) /* { */ - -#if !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ -#endif - -#endif /* } */ - -#endif - diff --git a/deps/rcheevos/test/lua/src/lstate.c b/deps/rcheevos/test/lua/src/lstate.c deleted file mode 100644 index 9e4c8f0616..0000000000 --- a/deps/rcheevos/test/lua/src/lstate.c +++ /dev/null @@ -1,347 +0,0 @@ -/* -** $Id: lstate.c,v 2.133 2015/11/13 12:16:51 roberto Exp $ -** Global State -** See Copyright Notice in lua.h -*/ - -#define lstate_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -#if !defined(LUAI_GCPAUSE) -#define LUAI_GCPAUSE 200 /* 200% */ -#endif - -#if !defined(LUAI_GCMUL) -#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ -#endif - - -/* -** a macro to help the creation of a unique random seed when a state is -** created; the seed is used to randomize hashes. -*/ -#if !defined(luai_makeseed) -#include -#define luai_makeseed() cast(unsigned int, time(NULL)) -#endif - - - -/* -** thread state + extra space -*/ -typedef struct LX { - lu_byte extrc_[LUA_EXTRASPACE]; - lua_State l; -} LX; - - -/* -** Main thread combines a thread state and the global state -*/ -typedef struct LG { - LX l; - global_State g; -} LG; - - - -#define fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) - - -/* -** Compute an initial seed as random as possible. Rely on Address Space -** Layout Randomization (if present) to increase randomness.. -*/ -#define addbuff(b,p,e) \ - { size_t t = cast(size_t, e); \ - memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } - -static unsigned int makeseed (lua_State *L) { - char buff[4 * sizeof(size_t)]; - unsigned int h = luai_makeseed(); - int p = 0; - addbuff(buff, p, L); /* heap variable */ - addbuff(buff, p, &h); /* local variable */ - addbuff(buff, p, luaO_nilobject); /* global variable */ - addbuff(buff, p, &lua_newstate); /* public function */ - lua_assert(p == sizeof(buff)); - return luaS_hash(buff, p, h); -} - - -/* -** set GCdebt to a new value keeping the value (totalbytes + GCdebt) -** invariant (and avoiding underflows in 'totalbytes') -*/ -void luaE_setdebt (global_State *g, l_mem debt) { - l_mem tb = gettotalbytes(g); - lua_assert(tb > 0); - if (debt < tb - MAX_LMEM) - debt = tb - MAX_LMEM; /* will make 'totalbytes == MAX_LMEM' */ - g->totalbytes = tb - debt; - g->GCdebt = debt; -} - - -CallInfo *luaE_extendCI (lua_State *L) { - CallInfo *ci = luaM_new(L, CallInfo); - lua_assert(L->ci->next == NULL); - L->ci->next = ci; - ci->previous = L->ci; - ci->next = NULL; - L->nci++; - return ci; -} - - -/* -** free all CallInfo structures not in use by a thread -*/ -void luaE_freeCI (lua_State *L) { - CallInfo *ci = L->ci; - CallInfo *next = ci->next; - ci->next = NULL; - while ((ci = next) != NULL) { - next = ci->next; - luaM_free(L, ci); - L->nci--; - } -} - - -/* -** free half of the CallInfo structures not in use by a thread -*/ -void luaE_shrinkCI (lua_State *L) { - CallInfo *ci = L->ci; - CallInfo *next2; /* next's next */ - /* while there are two nexts */ - while (ci->next != NULL && (next2 = ci->next->next) != NULL) { - luaM_free(L, ci->next); /* free next */ - L->nci--; - ci->next = next2; /* remove 'next' from the list */ - next2->previous = ci; - ci = next2; /* keep next's next */ - } -} - - -static void stack_init (lua_State *L1, lua_State *L) { - int i; CallInfo *ci; - /* initialize stack array */ - L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue); - L1->stacksize = BASIC_STACK_SIZE; - for (i = 0; i < BASIC_STACK_SIZE; i++) - setnilvalue(L1->stack + i); /* erase new stack */ - L1->top = L1->stack; - L1->stack_last = L1->stack + L1->stacksize - EXTRC_STACK; - /* initialize first ci */ - ci = &L1->base_ci; - ci->next = ci->previous = NULL; - ci->callstatus = 0; - ci->func = L1->top; - setnilvalue(L1->top++); /* 'function' entry for this 'ci' */ - ci->top = L1->top + LUA_MINSTACK; - L1->ci = ci; -} - - -static void freestack (lua_State *L) { - if (L->stack == NULL) - return; /* stack not completely built yet */ - L->ci = &L->base_ci; /* free the entire 'ci' list */ - luaE_freeCI(L); - lua_assert(L->nci == 0); - luaM_freearray(L, L->stack, L->stacksize); /* free stack array */ -} - - -/* -** Create registry table and its predefined values -*/ -static void init_registry (lua_State *L, global_State *g) { - TValue temp; - /* create registry */ - Table *registry = luaH_new(L); - sethvalue(L, &g->l_registry, registry); - luaH_resize(L, registry, LUA_RIDX_LAST, 0); - /* registry[LUA_RIDX_MAINTHREAD] = L */ - setthvalue(L, &temp, L); /* temp = L */ - luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); - /* registry[LUA_RIDX_GLOBALS] = table of globals */ - sethvalue(L, &temp, luaH_new(L)); /* temp = new table (global table) */ - luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp); -} - - -/* -** open parts of the state that may cause memory-allocation errors. -** ('g->version' != NULL flags that the state was completely build) -*/ -static void f_luaopen (lua_State *L, void *ud) { - global_State *g = G(L); - UNUSED(ud); - stack_init(L, L); /* init stack */ - init_registry(L, g); - luaS_init(L); - luaT_init(L); - luaX_init(L); - g->gcrunning = 1; /* allow gc */ - g->version = lua_version(NULL); - luai_userstateopen(L); -} - - -/* -** preinitialize a thread with consistent values without allocating -** any memory (to avoid errors) -*/ -static void preinit_thread (lua_State *L, global_State *g) { - G(L) = g; - L->stack = NULL; - L->ci = NULL; - L->nci = 0; - L->stacksize = 0; - L->twups = L; /* thread has no upvalues */ - L->errorJmp = NULL; - L->nCcalls = 0; - L->hook = NULL; - L->hookmask = 0; - L->basehookcount = 0; - L->allowhook = 1; - resethookcount(L); - L->openupval = NULL; - L->nny = 1; - L->status = LUA_OK; - L->errfunc = 0; -} - - -static void close_state (lua_State *L) { - global_State *g = G(L); - luaF_close(L, L->stack); /* close all upvalues for this thread */ - luaC_freeallobjects(L); /* collect all objects */ - if (g->version) /* closing a fully built state? */ - luai_userstateclose(L); - luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); - freestack(L); - lua_assert(gettotalbytes(g) == sizeof(LG)); - (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ -} - - -LUA_API lua_State *lua_newthread (lua_State *L) { - global_State *g = G(L); - lua_State *L1; - lua_lock(L); - luaC_checkGC(L); - /* create new thread */ - L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; - L1->marked = luaC_white(g); - L1->tt = LUA_TTHREAD; - /* link it on list 'allgc' */ - L1->next = g->allgc; - g->allgc = obj2gco(L1); - /* anchor it on L stack */ - setthvalue(L, L->top, L1); - api_incr_top(L); - preinit_thread(L1, g); - L1->hookmask = L->hookmask; - L1->basehookcount = L->basehookcount; - L1->hook = L->hook; - resethookcount(L1); - /* initialize L1 extra space */ - memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread), - LUA_EXTRASPACE); - luai_userstatethread(L, L1); - stack_init(L1, L); /* init stack */ - lua_unlock(L); - return L1; -} - - -void luaE_freethread (lua_State *L, lua_State *L1) { - LX *l = fromstate(L1); - luaF_close(L1, L1->stack); /* close all upvalues for this thread */ - lua_assert(L1->openupval == NULL); - luai_userstatefree(L, L1); - freestack(L1); - luaM_free(L, l); -} - - -LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { - int i; - lua_State *L; - global_State *g; - LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG))); - if (l == NULL) return NULL; - L = &l->l.l; - g = &l->g; - L->next = NULL; - L->tt = LUA_TTHREAD; - g->currentwhite = bitmask(WHITE0BIT); - L->marked = luaC_white(g); - preinit_thread(L, g); - g->frealloc = f; - g->ud = ud; - g->mainthread = L; - g->seed = makeseed(L); - g->gcrunning = 0; /* no GC while building state */ - g->GCestimate = 0; - g->strt.size = g->strt.nuse = 0; - g->strt.hash = NULL; - setnilvalue(&g->l_registry); - g->panic = NULL; - g->version = NULL; - g->gcstate = GCSpause; - g->gckind = KGC_NORMAL; - g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; - g->sweepgc = NULL; - g->gray = g->grayagain = NULL; - g->weak = g->ephemeron = g->allweak = NULL; - g->twups = NULL; - g->totalbytes = sizeof(LG); - g->GCdebt = 0; - g->gcfinnum = 0; - g->gcpause = LUAI_GCPAUSE; - g->gcstepmul = LUAI_GCMUL; - for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; - if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { - /* memory allocation error: free partial state */ - close_state(L); - L = NULL; - } - return L; -} - - -LUA_API void lua_close (lua_State *L) { - L = G(L)->mainthread; /* only the main thread can be closed */ - lua_lock(L); - close_state(L); -} - - diff --git a/deps/rcheevos/test/lua/src/lstate.h b/deps/rcheevos/test/lua/src/lstate.h deleted file mode 100644 index ed621c4dfa..0000000000 --- a/deps/rcheevos/test/lua/src/lstate.h +++ /dev/null @@ -1,235 +0,0 @@ -/* -** $Id: lstate.h,v 2.133 2016/12/22 13:08:50 roberto Exp $ -** Global State -** See Copyright Notice in lua.h -*/ - -#ifndef lstate_h -#define lstate_h - -#include "lua.h" - -#include "lobject.h" -#include "ltm.h" -#include "lzio.h" - - -/* - -** Some notes about garbage-collected objects: All objects in Lua must -** be kept somehow accessible until being freed, so all objects always -** belong to one (and only one) of these lists, using field 'next' of -** the 'CommonHeader' for the link: -** -** 'allgc': all objects not marked for finalization; -** 'finobj': all objects marked for finalization; -** 'tobefnz': all objects ready to be finalized; -** 'fixedgc': all objects that are not to be collected (currently -** only small strings, such as reserved words). - -*/ - - -struct lua_longjmp; /* defined in ldo.c */ - - -/* -** Atomic type (relative to signals) to better ensure that 'lua_sethook' -** is thread safe -*/ -#if !defined(l_signalT) -#include -#define l_signalT sig_atomic_t -#endif - - -/* extra stack space to handle TM calls and some other extras */ -#define EXTRC_STACK 5 - - -#define BASIC_STACK_SIZE (2*LUA_MINSTACK) - - -/* kinds of Garbage Collection */ -#define KGC_NORMAL 0 -#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ - - -typedef struct stringtable { - TString **hash; - int nuse; /* number of elements */ - int size; -} stringtable; - - -/* -** Information about a call. -** When a thread yields, 'func' is adjusted to pretend that the -** top function has only the yielded values in its stack; in that -** case, the actual 'func' value is saved in field 'extra'. -** When a function calls another with a continuation, 'extra' keeps -** the function index so that, in case of errors, the continuation -** function can be called with the correct top. -*/ -typedef struct CallInfo { - StkId func; /* function index in the stack */ - StkId top; /* top for this function */ - struct CallInfo *previous, *next; /* dynamic call link */ - union { - struct { /* only for Lua functions */ - StkId base; /* base for this function */ - const Instruction *savedpc; - } l; - struct { /* only for C functions */ - lua_KFunction k; /* continuation in case of yields */ - ptrdiff_t old_errfunc; - lua_KContext ctx; /* context info. in case of yields */ - } c; - } u; - ptrdiff_t extra; - short nresults; /* expected number of results from this function */ - unsigned short callstatus; -} CallInfo; - - -/* -** Bits in CallInfo status -*/ -#define CIST_OAH (1<<0) /* original value of 'allowhook' */ -#define CIST_LUA (1<<1) /* call is running a Lua function */ -#define CIST_HOOKED (1<<2) /* call is running a debug hook */ -#define CIST_FRESH (1<<3) /* call is running on a fresh invocation - of luaV_execute */ -#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ -#define CIST_TAIL (1<<5) /* call was tail called */ -#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ -#define CIST_LEQ (1<<7) /* using __lt for __le */ -#define CIST_FIN (1<<8) /* call is running a finalizer */ - -#define isLua(ci) ((ci)->callstatus & CIST_LUA) - -/* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ -#define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) -#define getoah(st) ((st) & CIST_OAH) - - -/* -** 'global state', shared by all threads of this state -*/ -typedef struct global_State { - lua_Alloc frealloc; /* function to reallocate memory */ - void *ud; /* auxiliary data to 'frealloc' */ - l_mem totalbytes; /* number of bytes currently allocated - GCdebt */ - l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ - lu_mem GCmemtrav; /* memory traversed by the GC */ - lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ - stringtable strt; /* hash table for strings */ - TValue l_registry; - unsigned int seed; /* randomized seed for hashes */ - lu_byte currentwhite; - lu_byte gcstate; /* state of garbage collector */ - lu_byte gckind; /* kind of GC running */ - lu_byte gcrunning; /* true if GC is running */ - GCObject *allgc; /* list of all collectable objects */ - GCObject **sweepgc; /* current position of sweep in list */ - GCObject *finobj; /* list of collectable objects with finalizers */ - GCObject *gray; /* list of gray objects */ - GCObject *grayagain; /* list of objects to be traversed atomically */ - GCObject *weak; /* list of tables with weak values */ - GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ - GCObject *allweak; /* list of all-weak tables */ - GCObject *tobefnz; /* list of userdata to be GC */ - GCObject *fixedgc; /* list of objects not to be collected */ - struct lua_State *twups; /* list of threads with open upvalues */ - unsigned int gcfinnum; /* number of finalizers to call in each GC step */ - int gcpause; /* size of pause between successive GCs */ - int gcstepmul; /* GC 'granularity' */ - lua_CFunction panic; /* to be called in unprotected errors */ - struct lua_State *mainthread; - const lua_Number *version; /* pointer to version number */ - TString *memerrmsg; /* memory-error message */ - TString *tmname[TM_N]; /* array with tag-method names */ - struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ - TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */ -} global_State; - - -/* -** 'per thread' state -*/ -struct lua_State { - CommonHeader; - unsigned short nci; /* number of items in 'ci' list */ - lu_byte status; - StkId top; /* first free slot in the stack */ - global_State *l_G; - CallInfo *ci; /* call info for current function */ - const Instruction *oldpc; /* last pc traced */ - StkId stack_last; /* last free slot in the stack */ - StkId stack; /* stack base */ - UpVal *openupval; /* list of open upvalues in this stack */ - GCObject *gclist; - struct lua_State *twups; /* list of threads with open upvalues */ - struct lua_longjmp *errorJmp; /* current error recover point */ - CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ - volatile lua_Hook hook; - ptrdiff_t errfunc; /* current error handling function (stack index) */ - int stacksize; - int basehookcount; - int hookcount; - unsigned short nny; /* number of non-yieldable calls in stack */ - unsigned short nCcalls; /* number of nested C calls */ - l_signalT hookmask; - lu_byte allowhook; -}; - - -#define G(L) (L->l_G) - - -/* -** Union of all collectable objects (only for conversions) -*/ -union GCUnion { - GCObject gc; /* common header */ - struct TString ts; - struct Udata u; - union Closure cl; - struct Table h; - struct Proto p; - struct lua_State th; /* thread */ -}; - - -#define cast_u(o) cast(union GCUnion *, (o)) - -/* macros to convert a GCObject into a specific value */ -#define gco2ts(o) \ - check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) -#define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) -#define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) -#define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) -#define gco2cl(o) \ - check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) -#define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) -#define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) -#define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) - - -/* macro to convert a Lua object into a GCObject */ -#define obj2gco(v) \ - check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc))) - - -/* actual number of total bytes allocated */ -#define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt) - -LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); -LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); -LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); -LUAI_FUNC void luaE_freeCI (lua_State *L); -LUAI_FUNC void luaE_shrinkCI (lua_State *L); - - -#endif - diff --git a/deps/rcheevos/test/lua/src/lstring.c b/deps/rcheevos/test/lua/src/lstring.c deleted file mode 100644 index 9351766fd6..0000000000 --- a/deps/rcheevos/test/lua/src/lstring.c +++ /dev/null @@ -1,248 +0,0 @@ -/* -** $Id: lstring.c,v 2.56 2015/11/23 11:32:51 roberto Exp $ -** String table (keeps all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - -#define lstring_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" - - -#define MEMERRMSG "not enough memory" - - -/* -** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to -** compute its hash -*/ -#if !defined(LUAI_HASHLIMIT) -#define LUAI_HASHLIMIT 5 -#endif - - -/* -** equality for long strings -*/ -int luaS_eqlngstr (TString *a, TString *b) { - size_t len = a->u.lnglen; - lua_assert(a->tt == LUA_TLNGSTR && b->tt == LUA_TLNGSTR); - return (a == b) || /* same instance or... */ - ((len == b->u.lnglen) && /* equal length and ... */ - (memcmp(getstr(a), getstr(b), len) == 0)); /* equal contents */ -} - - -unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { - unsigned int h = seed ^ cast(unsigned int, l); - size_t step = (l >> LUAI_HASHLIMIT) + 1; - for (; l >= step; l -= step) - h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); - return h; -} - - -unsigned int luaS_hashlongstr (TString *ts) { - lua_assert(ts->tt == LUA_TLNGSTR); - if (ts->extra == 0) { /* no hash? */ - ts->hash = luaS_hash(getstr(ts), ts->u.lnglen, ts->hash); - ts->extra = 1; /* now it has its hash */ - } - return ts->hash; -} - - -/* -** resizes the string table -*/ -void luaS_resize (lua_State *L, int newsize) { - int i; - stringtable *tb = &G(L)->strt; - if (newsize > tb->size) { /* grow table if needed */ - luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); - for (i = tb->size; i < newsize; i++) - tb->hash[i] = NULL; - } - for (i = 0; i < tb->size; i++) { /* rehash */ - TString *p = tb->hash[i]; - tb->hash[i] = NULL; - while (p) { /* for each node in the list */ - TString *hnext = p->u.hnext; /* save next */ - unsigned int h = lmod(p->hash, newsize); /* new position */ - p->u.hnext = tb->hash[h]; /* chain it */ - tb->hash[h] = p; - p = hnext; - } - } - if (newsize < tb->size) { /* shrink table if needed */ - /* vanishing slice should be empty */ - lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL); - luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); - } - tb->size = newsize; -} - - -/* -** Clear API string cache. (Entries cannot be empty, so fill them with -** a non-collectable string.) -*/ -void luaS_clearcache (global_State *g) { - int i, j; - for (i = 0; i < STRCACHE_N; i++) - for (j = 0; j < STRCACHE_M; j++) { - if (iswhite(g->strcache[i][j])) /* will entry be collected? */ - g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */ - } -} - - -/* -** Initialize the string table and the string cache -*/ -void luaS_init (lua_State *L) { - global_State *g = G(L); - int i, j; - luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ - /* pre-create memory-error message */ - g->memerrmsg = luaS_newliteral(L, MEMERRMSG); - luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */ - for (i = 0; i < STRCACHE_N; i++) /* fill cache with valid strings */ - for (j = 0; j < STRCACHE_M; j++) - g->strcache[i][j] = g->memerrmsg; -} - - - -/* -** creates a new string object -*/ -static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) { - TString *ts; - GCObject *o; - size_t totalsize; /* total size of TString object */ - totalsize = sizelstring(l); - o = luaC_newobj(L, tag, totalsize); - ts = gco2ts(o); - ts->hash = h; - ts->extra = 0; - getstr(ts)[l] = '\0'; /* ending 0 */ - return ts; -} - - -TString *luaS_createlngstrobj (lua_State *L, size_t l) { - TString *ts = createstrobj(L, l, LUA_TLNGSTR, G(L)->seed); - ts->u.lnglen = l; - return ts; -} - - -void luaS_remove (lua_State *L, TString *ts) { - stringtable *tb = &G(L)->strt; - TString **p = &tb->hash[lmod(ts->hash, tb->size)]; - while (*p != ts) /* find previous element */ - p = &(*p)->u.hnext; - *p = (*p)->u.hnext; /* remove element from its list */ - tb->nuse--; -} - - -/* -** checks whether short string exists and reuses it or creates a new one -*/ -static TString *internshrstr (lua_State *L, const char *str, size_t l) { - TString *ts; - global_State *g = G(L); - unsigned int h = luaS_hash(str, l, g->seed); - TString **list = &g->strt.hash[lmod(h, g->strt.size)]; - lua_assert(str != NULL); /* otherwise 'memcmp'/'memcpy' are undefined */ - for (ts = *list; ts != NULL; ts = ts->u.hnext) { - if (l == ts->shrlen && - (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { - /* found! */ - if (isdead(g, ts)) /* dead (but not collected yet)? */ - changewhite(ts); /* resurrect it */ - return ts; - } - } - if (g->strt.nuse >= g->strt.size && g->strt.size <= MAX_INT/2) { - luaS_resize(L, g->strt.size * 2); - list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ - } - ts = createstrobj(L, l, LUA_TSHRSTR, h); - memcpy(getstr(ts), str, l * sizeof(char)); - ts->shrlen = cast_byte(l); - ts->u.hnext = *list; - *list = ts; - g->strt.nuse++; - return ts; -} - - -/* -** new string (with explicit length) -*/ -TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { - if (l <= LUAI_MAXSHORTLEN) /* short string? */ - return internshrstr(L, str, l); - else { - TString *ts; - if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char)) - luaM_toobig(L); - ts = luaS_createlngstrobj(L, l); - memcpy(getstr(ts), str, l * sizeof(char)); - return ts; - } -} - - -/* -** Create or reuse a zero-terminated string, first checking in the -** cache (using the string address as a key). The cache can contain -** only zero-terminated strings, so it is safe to use 'strcmp' to -** check hits. -*/ -TString *luaS_new (lua_State *L, const char *str) { - unsigned int i = point2uint(str) % STRCACHE_N; /* hash */ - int j; - TString **p = G(L)->strcache[i]; - for (j = 0; j < STRCACHE_M; j++) { - if (strcmp(str, getstr(p[j])) == 0) /* hit? */ - return p[j]; /* that is it */ - } - /* normal route */ - for (j = STRCACHE_M - 1; j > 0; j--) - p[j] = p[j - 1]; /* move out last element */ - /* new element is first in the list */ - p[0] = luaS_newlstr(L, str, strlen(str)); - return p[0]; -} - - -Udata *luaS_newudata (lua_State *L, size_t s) { - Udata *u; - GCObject *o; - if (s > MAX_SIZE - sizeof(Udata)) - luaM_toobig(L); - o = luaC_newobj(L, LUA_TUSERDATA, sizeludata(s)); - u = gco2u(o); - u->len = s; - u->metatable = NULL; - setuservalue(L, u, luaO_nilobject); - return u; -} - diff --git a/deps/rcheevos/test/lua/src/lstring.h b/deps/rcheevos/test/lua/src/lstring.h deleted file mode 100644 index 27efd20772..0000000000 --- a/deps/rcheevos/test/lua/src/lstring.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -** $Id: lstring.h,v 1.61 2015/11/03 15:36:01 roberto Exp $ -** String table (keep all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - -#ifndef lstring_h -#define lstring_h - -#include "lgc.h" -#include "lobject.h" -#include "lstate.h" - - -#define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) - -#define sizeludata(l) (sizeof(union UUdata) + (l)) -#define sizeudata(u) sizeludata((u)->len) - -#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ - (sizeof(s)/sizeof(char))-1)) - - -/* -** test whether a string is a reserved word -*/ -#define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) - - -/* -** equality for short strings, which are always internalized -*/ -#define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) - - -LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); -LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); -LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); -LUAI_FUNC void luaS_resize (lua_State *L, int newsize); -LUAI_FUNC void luaS_clearcache (global_State *g); -LUAI_FUNC void luaS_init (lua_State *L); -LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); -LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); -LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); -LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); - - -#endif diff --git a/deps/rcheevos/test/lua/src/lstrlib.c b/deps/rcheevos/test/lua/src/lstrlib.c deleted file mode 100644 index c7aa755fab..0000000000 --- a/deps/rcheevos/test/lua/src/lstrlib.c +++ /dev/null @@ -1,1584 +0,0 @@ -/* -** $Id: lstrlib.c,v 1.254 2016/12/22 13:08:50 roberto Exp $ -** Standard library for string operations and pattern-matching -** See Copyright Notice in lua.h -*/ - -#define lstrlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** maximum number of captures that a pattern can do during -** pattern-matching. This limit is arbitrary, but must fit in -** an unsigned char. -*/ -#if !defined(LUA_MAXCAPTURES) -#define LUA_MAXCAPTURES 32 -#endif - - -/* macro to 'unsign' a character */ -#define uchar(c) ((unsigned char)(c)) - - -/* -** Some sizes are better limited to fit in 'int', but must also fit in -** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) -*/ -#define MAX_SIZET ((size_t)(~(size_t)0)) - -#define MAXSIZE \ - (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX)) - - - - -static int str_len (lua_State *L) { - size_t l; - luaL_checklstring(L, 1, &l); - lua_pushinteger(L, (lua_Integer)l); - return 1; -} - - -/* translate a relative string position: negative means back from end */ -static lua_Integer posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -static int str_sub (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - lua_Integer start = posrelat(luaL_checkinteger(L, 2), l); - lua_Integer end = posrelat(luaL_optinteger(L, 3, -1), l); - if (start < 1) start = 1; - if (end > (lua_Integer)l) end = l; - if (start <= end) - lua_pushlstring(L, s + start - 1, (size_t)(end - start) + 1); - else lua_pushliteral(L, ""); - return 1; -} - - -static int str_reverse (lua_State *L) { - size_t l, i; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - char *p = luaL_buffinitsize(L, &b, l); - for (i = 0; i < l; i++) - p[i] = s[l - i - 1]; - luaL_pushresultsize(&b, l); - return 1; -} - - -static int str_lower (lua_State *L) { - size_t l; - size_t i; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - char *p = luaL_buffinitsize(L, &b, l); - for (i=0; i MAXSIZE / n) /* may overflow? */ - return luaL_error(L, "resulting string too large"); - else { - size_t totallen = (size_t)n * l + (size_t)(n - 1) * lsep; - luaL_Buffer b; - char *p = luaL_buffinitsize(L, &b, totallen); - while (n-- > 1) { /* first n-1 copies (followed by separator) */ - memcpy(p, s, l * sizeof(char)); p += l; - if (lsep > 0) { /* empty 'memcpy' is not that cheap */ - memcpy(p, sep, lsep * sizeof(char)); - p += lsep; - } - } - memcpy(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ - luaL_pushresultsize(&b, totallen); - } - return 1; -} - - -static int str_byte (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - lua_Integer posi = posrelat(luaL_optinteger(L, 2, 1), l); - lua_Integer pose = posrelat(luaL_optinteger(L, 3, posi), l); - int n, i; - if (posi < 1) posi = 1; - if (pose > (lua_Integer)l) pose = l; - if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= INT_MAX) /* arithmetic overflow? */ - return luaL_error(L, "string slice too long"); - n = (int)(pose - posi) + 1; - luaL_checkstack(L, n, "string slice too long"); - for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) - return luaL_error(ms->L, "invalid capture index %%%d", l + 1); - return l; -} - - -static int capture_to_close (MatchState *ms) { - int level = ms->level; - for (level--; level>=0; level--) - if (ms->capture[level].len == CAP_UNFINISHED) return level; - return luaL_error(ms->L, "invalid pattern capture"); -} - - -static const char *classend (MatchState *ms, const char *p) { - switch (*p++) { - case L_ESC: { - if (p == ms->p_end) - luaL_error(ms->L, "malformed pattern (ends with '%%')"); - return p+1; - } - case '[': { - if (*p == '^') p++; - do { /* look for a ']' */ - if (p == ms->p_end) - luaL_error(ms->L, "malformed pattern (missing ']')"); - if (*(p++) == L_ESC && p < ms->p_end) - p++; /* skip escapes (e.g. '%]') */ - } while (*p != ']'); - return p+1; - } - default: { - return p; - } - } -} - - -static int match_class (int c, int cl) { - int res; - switch (tolower(cl)) { - case 'a' : res = isalpha(c); break; - case 'c' : res = iscntrl(c); break; - case 'd' : res = isdigit(c); break; - case 'g' : res = isgraph(c); break; - case 'l' : res = islower(c); break; - case 'p' : res = ispunct(c); break; - case 's' : res = isspace(c); break; - case 'u' : res = isupper(c); break; - case 'w' : res = isalnum(c); break; - case 'x' : res = isxdigit(c); break; - case 'z' : res = (c == 0); break; /* deprecated option */ - default: return (cl == c); - } - return (islower(cl) ? res : !res); -} - - -static int matchbracketclass (int c, const char *p, const char *ec) { - int sig = 1; - if (*(p+1) == '^') { - sig = 0; - p++; /* skip the '^' */ - } - while (++p < ec) { - if (*p == L_ESC) { - p++; - if (match_class(c, uchar(*p))) - return sig; - } - else if ((*(p+1) == '-') && (p+2 < ec)) { - p+=2; - if (uchar(*(p-2)) <= c && c <= uchar(*p)) - return sig; - } - else if (uchar(*p) == c) return sig; - } - return !sig; -} - - -static int singlematch (MatchState *ms, const char *s, const char *p, - const char *ep) { - if (s >= ms->src_end) - return 0; - else { - int c = uchar(*s); - switch (*p) { - case '.': return 1; /* matches any char */ - case L_ESC: return match_class(c, uchar(*(p+1))); - case '[': return matchbracketclass(c, p, ep-1); - default: return (uchar(*p) == c); - } - } -} - - -static const char *matchbalance (MatchState *ms, const char *s, - const char *p) { - if (p >= ms->p_end - 1) - luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')"); - if (*s != *p) return NULL; - else { - int b = *p; - int e = *(p+1); - int cont = 1; - while (++s < ms->src_end) { - if (*s == e) { - if (--cont == 0) return s+1; - } - else if (*s == b) cont++; - } - } - return NULL; /* string ends out of balance */ -} - - -static const char *max_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - ptrdiff_t i = 0; /* counts maximum expand for item */ - while (singlematch(ms, s + i, p, ep)) - i++; - /* keeps trying to match with the maximum repetitions */ - while (i>=0) { - const char *res = match(ms, (s+i), ep+1); - if (res) return res; - i--; /* else didn't match; reduce 1 repetition to try again */ - } - return NULL; -} - - -static const char *min_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - for (;;) { - const char *res = match(ms, s, ep+1); - if (res != NULL) - return res; - else if (singlematch(ms, s, p, ep)) - s++; /* try with one more repetition */ - else return NULL; - } -} - - -static const char *start_capture (MatchState *ms, const char *s, - const char *p, int what) { - const char *res; - int level = ms->level; - if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); - ms->capture[level].init = s; - ms->capture[level].len = what; - ms->level = level+1; - if ((res=match(ms, s, p)) == NULL) /* match failed? */ - ms->level--; /* undo capture */ - return res; -} - - -static const char *end_capture (MatchState *ms, const char *s, - const char *p) { - int l = capture_to_close(ms); - const char *res; - ms->capture[l].len = s - ms->capture[l].init; /* close capture */ - if ((res = match(ms, s, p)) == NULL) /* match failed? */ - ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ - return res; -} - - -static const char *match_capture (MatchState *ms, const char *s, int l) { - size_t len; - l = check_capture(ms, l); - len = ms->capture[l].len; - if ((size_t)(ms->src_end-s) >= len && - memcmp(ms->capture[l].init, s, len) == 0) - return s+len; - else return NULL; -} - - -static const char *match (MatchState *ms, const char *s, const char *p) { - if (ms->matchdepth-- == 0) - luaL_error(ms->L, "pattern too complex"); - init: /* using goto's to optimize tail recursion */ - if (p != ms->p_end) { /* end of pattern? */ - switch (*p) { - case '(': { /* start capture */ - if (*(p + 1) == ')') /* position capture? */ - s = start_capture(ms, s, p + 2, CAP_POSITION); - else - s = start_capture(ms, s, p + 1, CAP_UNFINISHED); - break; - } - case ')': { /* end capture */ - s = end_capture(ms, s, p + 1); - break; - } - case '$': { - if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */ - goto dflt; /* no; go to default */ - s = (s == ms->src_end) ? s : NULL; /* check end of string */ - break; - } - case L_ESC: { /* escaped sequences not in the format class[*+?-]? */ - switch (*(p + 1)) { - case 'b': { /* balanced string? */ - s = matchbalance(ms, s, p + 2); - if (s != NULL) { - p += 4; goto init; /* return match(ms, s, p + 4); */ - } /* else fail (s == NULL) */ - break; - } - case 'f': { /* frontier? */ - const char *ep; char previous; - p += 2; - if (*p != '[') - luaL_error(ms->L, "missing '[' after '%%f' in pattern"); - ep = classend(ms, p); /* points to what is next */ - previous = (s == ms->src_init) ? '\0' : *(s - 1); - if (!matchbracketclass(uchar(previous), p, ep - 1) && - matchbracketclass(uchar(*s), p, ep - 1)) { - p = ep; goto init; /* return match(ms, s, ep); */ - } - s = NULL; /* match failed */ - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': { /* capture results (%0-%9)? */ - s = match_capture(ms, s, uchar(*(p + 1))); - if (s != NULL) { - p += 2; goto init; /* return match(ms, s, p + 2) */ - } - break; - } - default: goto dflt; - } - break; - } - default: dflt: { /* pattern class plus optional suffix */ - const char *ep = classend(ms, p); /* points to optional suffix */ - /* does not match at least once? */ - if (!singlematch(ms, s, p, ep)) { - if (*ep == '*' || *ep == '?' || *ep == '-') { /* accept empty? */ - p = ep + 1; goto init; /* return match(ms, s, ep + 1); */ - } - else /* '+' or no suffix */ - s = NULL; /* fail */ - } - else { /* matched once */ - switch (*ep) { /* handle optional suffix */ - case '?': { /* optional */ - const char *res; - if ((res = match(ms, s + 1, ep + 1)) != NULL) - s = res; - else { - p = ep + 1; goto init; /* else return match(ms, s, ep + 1); */ - } - break; - } - case '+': /* 1 or more repetitions */ - s++; /* 1 match already done */ - /* FALLTHROUGH */ - case '*': /* 0 or more repetitions */ - s = max_expand(ms, s, p, ep); - break; - case '-': /* 0 or more repetitions (minimum) */ - s = min_expand(ms, s, p, ep); - break; - default: /* no suffix */ - s++; p = ep; goto init; /* return match(ms, s + 1, ep); */ - } - } - break; - } - } - } - ms->matchdepth++; - return s; -} - - - -static const char *lmemfind (const char *s1, size_t l1, - const char *s2, size_t l2) { - if (l2 == 0) return s1; /* empty strings are everywhere */ - else if (l2 > l1) return NULL; /* avoids a negative 'l1' */ - else { - const char *init; /* to search for a '*s2' inside 's1' */ - l2--; /* 1st char will be checked by 'memchr' */ - l1 = l1-l2; /* 's2' cannot be found after that */ - while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { - init++; /* 1st char is already checked */ - if (memcmp(init, s2+1, l2) == 0) - return init-1; - else { /* correct 'l1' and 's1' to try again */ - l1 -= init-s1; - s1 = init; - } - } - return NULL; /* not found */ - } -} - - -static void push_onecapture (MatchState *ms, int i, const char *s, - const char *e) { - if (i >= ms->level) { - if (i == 0) /* ms->level == 0, too */ - lua_pushlstring(ms->L, s, e - s); /* add whole match */ - else - luaL_error(ms->L, "invalid capture index %%%d", i + 1); - } - else { - ptrdiff_t l = ms->capture[i].len; - if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); - if (l == CAP_POSITION) - lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); - else - lua_pushlstring(ms->L, ms->capture[i].init, l); - } -} - - -static int push_captures (MatchState *ms, const char *s, const char *e) { - int i; - int nlevels = (ms->level == 0 && s) ? 1 : ms->level; - luaL_checkstack(ms->L, nlevels, "too many captures"); - for (i = 0; i < nlevels; i++) - push_onecapture(ms, i, s, e); - return nlevels; /* number of strings pushed */ -} - - -/* check whether pattern has no special characters */ -static int nospecials (const char *p, size_t l) { - size_t upto = 0; - do { - if (strpbrk(p + upto, SPECIALS)) - return 0; /* pattern has a special character */ - upto += strlen(p + upto) + 1; /* may have more after \0 */ - } while (upto <= l); - return 1; /* no special chars found */ -} - - -static void prepstate (MatchState *ms, lua_State *L, - const char *s, size_t ls, const char *p, size_t lp) { - ms->L = L; - ms->matchdepth = MAXCCALLS; - ms->src_init = s; - ms->src_end = s + ls; - ms->p_end = p + lp; -} - - -static void reprepstate (MatchState *ms) { - ms->level = 0; - lua_assert(ms->matchdepth == MAXCCALLS); -} - - -static int str_find_aux (lua_State *L, int find) { - size_t ls, lp; - const char *s = luaL_checklstring(L, 1, &ls); - const char *p = luaL_checklstring(L, 2, &lp); - lua_Integer init = posrelat(luaL_optinteger(L, 3, 1), ls); - if (init < 1) init = 1; - else if (init > (lua_Integer)ls + 1) { /* start after string's end? */ - lua_pushnil(L); /* cannot find anything */ - return 1; - } - /* explicit request or no special characters? */ - if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) { - /* do a plain search */ - const char *s2 = lmemfind(s + init - 1, ls - (size_t)init + 1, p, lp); - if (s2) { - lua_pushinteger(L, (s2 - s) + 1); - lua_pushinteger(L, (s2 - s) + lp); - return 2; - } - } - else { - MatchState ms; - const char *s1 = s + init - 1; - int anchor = (*p == '^'); - if (anchor) { - p++; lp--; /* skip anchor character */ - } - prepstate(&ms, L, s, ls, p, lp); - do { - const char *res; - reprepstate(&ms); - if ((res=match(&ms, s1, p)) != NULL) { - if (find) { - lua_pushinteger(L, (s1 - s) + 1); /* start */ - lua_pushinteger(L, res - s); /* end */ - return push_captures(&ms, NULL, 0) + 2; - } - else - return push_captures(&ms, s1, res); - } - } while (s1++ < ms.src_end && !anchor); - } - lua_pushnil(L); /* not found */ - return 1; -} - - -static int str_find (lua_State *L) { - return str_find_aux(L, 1); -} - - -static int str_match (lua_State *L) { - return str_find_aux(L, 0); -} - - -/* state for 'gmatch' */ -typedef struct GMatchState { - const char *src; /* current position */ - const char *p; /* pattern */ - const char *lastmatch; /* end of last match */ - MatchState ms; /* match state */ -} GMatchState; - - -static int gmatch_aux (lua_State *L) { - GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3)); - const char *src; - gm->ms.L = L; - for (src = gm->src; src <= gm->ms.src_end; src++) { - const char *e; - reprepstate(&gm->ms); - if ((e = match(&gm->ms, src, gm->p)) != NULL && e != gm->lastmatch) { - gm->src = gm->lastmatch = e; - return push_captures(&gm->ms, src, e); - } - } - return 0; /* not found */ -} - - -static int gmatch (lua_State *L) { - size_t ls, lp; - const char *s = luaL_checklstring(L, 1, &ls); - const char *p = luaL_checklstring(L, 2, &lp); - GMatchState *gm; - lua_settop(L, 2); /* keep them on closure to avoid being collected */ - gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState)); - prepstate(&gm->ms, L, s, ls, p, lp); - gm->src = s; gm->p = p; gm->lastmatch = NULL; - lua_pushcclosure(L, gmatch_aux, 3); - return 1; -} - - -static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e) { - size_t l, i; - lua_State *L = ms->L; - const char *news = lua_tolstring(L, 3, &l); - for (i = 0; i < l; i++) { - if (news[i] != L_ESC) - luaL_addchar(b, news[i]); - else { - i++; /* skip ESC */ - if (!isdigit(uchar(news[i]))) { - if (news[i] != L_ESC) - luaL_error(L, "invalid use of '%c' in replacement string", L_ESC); - luaL_addchar(b, news[i]); - } - else if (news[i] == '0') - luaL_addlstring(b, s, e - s); - else { - push_onecapture(ms, news[i] - '1', s, e); - luaL_tolstring(L, -1, NULL); /* if number, convert it to string */ - lua_remove(L, -2); /* remove original value */ - luaL_addvalue(b); /* add capture to accumulated result */ - } - } - } -} - - -static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e, int tr) { - lua_State *L = ms->L; - switch (tr) { - case LUA_TFUNCTION: { - int n; - lua_pushvalue(L, 3); - n = push_captures(ms, s, e); - lua_call(L, n, 1); - break; - } - case LUA_TTABLE: { - push_onecapture(ms, 0, s, e); - lua_gettable(L, 3); - break; - } - default: { /* LUA_TNUMBER or LUA_TSTRING */ - add_s(ms, b, s, e); - return; - } - } - if (!lua_toboolean(L, -1)) { /* nil or false? */ - lua_pop(L, 1); - lua_pushlstring(L, s, e - s); /* keep original text */ - } - else if (!lua_isstring(L, -1)) - luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); - luaL_addvalue(b); /* add result to accumulator */ -} - - -static int str_gsub (lua_State *L) { - size_t srcl, lp; - const char *src = luaL_checklstring(L, 1, &srcl); /* subject */ - const char *p = luaL_checklstring(L, 2, &lp); /* pattern */ - const char *lastmatch = NULL; /* end of last match */ - int tr = lua_type(L, 3); /* replacement type */ - lua_Integer max_s = luaL_optinteger(L, 4, srcl + 1); /* max replacements */ - int anchor = (*p == '^'); - lua_Integer n = 0; /* replacement count */ - MatchState ms; - luaL_Buffer b; - luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || - tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, - "string/function/table expected"); - luaL_buffinit(L, &b); - if (anchor) { - p++; lp--; /* skip anchor character */ - } - prepstate(&ms, L, src, srcl, p, lp); - while (n < max_s) { - const char *e; - reprepstate(&ms); /* (re)prepare state for new match */ - if ((e = match(&ms, src, p)) != NULL && e != lastmatch) { /* match? */ - n++; - add_value(&ms, &b, src, e, tr); /* add replacement to buffer */ - src = lastmatch = e; - } - else if (src < ms.src_end) /* otherwise, skip one character */ - luaL_addchar(&b, *src++); - else break; /* end of subject */ - if (anchor) break; - } - luaL_addlstring(&b, src, ms.src_end-src); - luaL_pushresult(&b); - lua_pushinteger(L, n); /* number of substitutions */ - return 2; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** STRING FORMAT -** ======================================================= -*/ - -#if !defined(lua_number2strx) /* { */ - -/* -** Hexadecimal floating-point formatter -*/ - -#include - -#define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) - - -/* -** Number of bits that goes into the first digit. It can be any value -** between 1 and 4; the following definition tries to align the number -** to nibble boundaries by making what is left after that first digit a -** multiple of 4. -*/ -#define L_NBFD ((l_mathlim(MANT_DIG) - 1)%4 + 1) - - -/* -** Add integer part of 'x' to buffer and return new 'x' -*/ -static lua_Number adddigit (char *buff, int n, lua_Number x) { - lua_Number dd = l_mathop(floor)(x); /* get integer part from 'x' */ - int d = (int)dd; - buff[n] = (d < 10 ? d + '0' : d - 10 + 'a'); /* add to buffer */ - return x - dd; /* return what is left */ -} - - -static int num2straux (char *buff, int sz, lua_Number x) { - /* if 'inf' or 'NaN', format it like '%g' */ - if (x != x || x == (lua_Number)HUGE_VAL || x == -(lua_Number)HUGE_VAL) - return l_sprintf(buff, sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)x); - else if (x == 0) { /* can be -0... */ - /* create "0" or "-0" followed by exponent */ - return l_sprintf(buff, sz, LUA_NUMBER_FMT "x0p+0", (LUAI_UACNUMBER)x); - } - else { - int e; - lua_Number m = l_mathop(frexp)(x, &e); /* 'x' fraction and exponent */ - int n = 0; /* character count */ - if (m < 0) { /* is number negative? */ - buff[n++] = '-'; /* add signal */ - m = -m; /* make it positive */ - } - buff[n++] = '0'; buff[n++] = 'x'; /* add "0x" */ - m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ - e -= L_NBFD; /* this digit goes before the radix point */ - if (m > 0) { /* more digits? */ - buff[n++] = lua_getlocaledecpoint(); /* add radix point */ - do { /* add as many digits as needed */ - m = adddigit(buff, n++, m * 16); - } while (m > 0); - } - n += l_sprintf(buff + n, sz - n, "p%+d", e); /* add exponent */ - lua_assert(n < sz); - return n; - } -} - - -static int lua_number2strx (lua_State *L, char *buff, int sz, - const char *fmt, lua_Number x) { - int n = num2straux(buff, sz, x); - if (fmt[SIZELENMOD] == 'A') { - int i; - for (i = 0; i < n; i++) - buff[i] = toupper(uchar(buff[i])); - } - else if (fmt[SIZELENMOD] != 'a') - luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); - return n; -} - -#endif /* } */ - - -/* -** Maximum size of each formatted item. This maximum size is produced -** by format('%.99f', -maxfloat), and is equal to 99 + 3 ('-', '.', -** and '\0') + number of decimal digits to represent maxfloat (which -** is maximum exponent + 1). (99+3+1 then rounded to 120 for "extra -** expenses", such as locale-dependent stuff) -*/ -#define MAX_ITEM (120 + l_mathlim(MAX_10_EXP)) - - -/* valid flags in a format specification */ -#define FLAGS "-+ #0" - -/* -** maximum size of each format specification (such as "%-099.99d") -*/ -#define MAX_FORMAT 32 - - -static void addquoted (luaL_Buffer *b, const char *s, size_t len) { - luaL_addchar(b, '"'); - while (len--) { - if (*s == '"' || *s == '\\' || *s == '\n') { - luaL_addchar(b, '\\'); - luaL_addchar(b, *s); - } - else if (iscntrl(uchar(*s))) { - char buff[10]; - if (!isdigit(uchar(*(s+1)))) - l_sprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s)); - else - l_sprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s)); - luaL_addstring(b, buff); - } - else - luaL_addchar(b, *s); - s++; - } - luaL_addchar(b, '"'); -} - - -/* -** Ensures the 'buff' string uses a dot as the radix character. -*/ -static void checkdp (char *buff, int nb) { - if (memchr(buff, '.', nb) == NULL) { /* no dot? */ - char point = lua_getlocaledecpoint(); /* try locale point */ - char *ppoint = (char *)memchr(buff, point, nb); - if (ppoint) *ppoint = '.'; /* change it to a dot */ - } -} - - -static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { - switch (lua_type(L, arg)) { - case LUA_TSTRING: { - size_t len; - const char *s = lua_tolstring(L, arg, &len); - addquoted(b, s, len); - break; - } - case LUA_TNUMBER: { - char *buff = luaL_prepbuffsize(b, MAX_ITEM); - int nb; - if (!lua_isinteger(L, arg)) { /* float? */ - lua_Number n = lua_tonumber(L, arg); /* write as hexa ('%a') */ - nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n); - checkdp(buff, nb); /* ensure it uses a dot */ - } - else { /* integers */ - lua_Integer n = lua_tointeger(L, arg); - const char *format = (n == LUA_MININTEGER) /* corner case? */ - ? "0x%" LUA_INTEGER_FRMLEN "x" /* use hexa */ - : LUA_INTEGER_FMT; /* else use default format */ - nb = l_sprintf(buff, MAX_ITEM, format, (LUAI_UACINT)n); - } - luaL_addsize(b, nb); - break; - } - case LUA_TNIL: case LUA_TBOOLEAN: { - luaL_tolstring(L, arg, NULL); - luaL_addvalue(b); - break; - } - default: { - luaL_argerror(L, arg, "value has no literal form"); - } - } -} - - -static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { - const char *p = strfrmt; - while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ - if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) - luaL_error(L, "invalid format (repeated flags)"); - if (isdigit(uchar(*p))) p++; /* skip width */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - if (*p == '.') { - p++; - if (isdigit(uchar(*p))) p++; /* skip precision */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - } - if (isdigit(uchar(*p))) - luaL_error(L, "invalid format (width or precision too long)"); - *(form++) = '%'; - memcpy(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char)); - form += (p - strfrmt) + 1; - *form = '\0'; - return p; -} - - -/* -** add length modifier into formats -*/ -static void addlenmod (char *form, const char *lenmod) { - size_t l = strlen(form); - size_t lm = strlen(lenmod); - char spec = form[l - 1]; - strcpy(form + l - 1, lenmod); - form[l + lm - 1] = spec; - form[l + lm] = '\0'; -} - - -static int str_format (lua_State *L) { - int top = lua_gettop(L); - int arg = 1; - size_t sfl; - const char *strfrmt = luaL_checklstring(L, arg, &sfl); - const char *strfrmt_end = strfrmt+sfl; - luaL_Buffer b; - luaL_buffinit(L, &b); - while (strfrmt < strfrmt_end) { - if (*strfrmt != L_ESC) - luaL_addchar(&b, *strfrmt++); - else if (*++strfrmt == L_ESC) - luaL_addchar(&b, *strfrmt++); /* %% */ - else { /* format item */ - char form[MAX_FORMAT]; /* to store the format ('%...') */ - char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ - int nb = 0; /* number of bytes in added item */ - if (++arg > top) - luaL_argerror(L, arg, "no value"); - strfrmt = scanformat(L, strfrmt, form); - switch (*strfrmt++) { - case 'c': { - nb = l_sprintf(buff, MAX_ITEM, form, (int)luaL_checkinteger(L, arg)); - break; - } - case 'd': case 'i': - case 'o': case 'u': case 'x': case 'X': { - lua_Integer n = luaL_checkinteger(L, arg); - addlenmod(form, LUA_INTEGER_FRMLEN); - nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACINT)n); - break; - } - case 'a': case 'A': - addlenmod(form, LUA_NUMBER_FRMLEN); - nb = lua_number2strx(L, buff, MAX_ITEM, form, - luaL_checknumber(L, arg)); - break; - case 'e': case 'E': case 'f': - case 'g': case 'G': { - lua_Number n = luaL_checknumber(L, arg); - addlenmod(form, LUA_NUMBER_FRMLEN); - nb = l_sprintf(buff, MAX_ITEM, form, (LUAI_UACNUMBER)n); - break; - } - case 'q': { - addliteral(L, &b, arg); - break; - } - case 's': { - size_t l; - const char *s = luaL_tolstring(L, arg, &l); - if (form[2] == '\0') /* no modifiers? */ - luaL_addvalue(&b); /* keep entire string */ - else { - luaL_argcheck(L, l == strlen(s), arg, "string contains zeros"); - if (!strchr(form, '.') && l >= 100) { - /* no precision and string is too long to be formatted */ - luaL_addvalue(&b); /* keep entire string */ - } - else { /* format the string into 'buff' */ - nb = l_sprintf(buff, MAX_ITEM, form, s); - lua_pop(L, 1); /* remove result from 'luaL_tolstring' */ - } - } - break; - } - default: { /* also treat cases 'pnLlh' */ - return luaL_error(L, "invalid option '%%%c' to 'format'", - *(strfrmt - 1)); - } - } - lua_assert(nb < MAX_ITEM); - luaL_addsize(&b, nb); - } - } - luaL_pushresult(&b); - return 1; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** PACK/UNPACK -** ======================================================= -*/ - - -/* value used for padding */ -#if !defined(LUAL_PACKPADBYTE) -#define LUAL_PACKPADBYTE 0x00 -#endif - -/* maximum size for the binary representation of an integer */ -#define MAXINTSIZE 16 - -/* number of bits in a character */ -#define NB CHAR_BIT - -/* mask for one character (NB 1's) */ -#define MC ((1 << NB) - 1) - -/* size of a lua_Integer */ -#define SZINT ((int)sizeof(lua_Integer)) - - -/* dummy union to get native endianness */ -static const union { - int dummy; - char little; /* true iff machine is little endian */ -} nativeendian = {1}; - - -/* dummy structure to get native alignment requirements */ -struct cD { - char c; - union { double d; void *p; lua_Integer i; lua_Number n; } u; -}; - -#define MAXALIGN (offsetof(struct cD, u)) - - -/* -** Union for serializing floats -*/ -typedef union Ftypes { - float f; - double d; - lua_Number n; - char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ -} Ftypes; - - -/* -** information to pack/unpack stuff -*/ -typedef struct Header { - lua_State *L; - int islittle; - int maxalign; -} Header; - - -/* -** options for pack/unpack -*/ -typedef enum KOption { - Kint, /* signed integers */ - Kuint, /* unsigned integers */ - Kfloat, /* floating-point numbers */ - Kchar, /* fixed-length strings */ - Kstring, /* strings with prefixed length */ - Kzstr, /* zero-terminated strings */ - Kpadding, /* padding */ - Kpaddalign, /* padding for alignment */ - Knop /* no-op (configuration or spaces) */ -} KOption; - - -/* -** Read an integer numeral from string 'fmt' or return 'df' if -** there is no numeral -*/ -static int digit (int c) { return '0' <= c && c <= '9'; } - -static int getnum (const char **fmt, int df) { - if (!digit(**fmt)) /* no number? */ - return df; /* return default value */ - else { - int a = 0; - do { - a = a*10 + (*((*fmt)++) - '0'); - } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); - return a; - } -} - - -/* -** Read an integer numeral and raises an error if it is larger -** than the maximum size for integers. -*/ -static int getnumlimit (Header *h, const char **fmt, int df) { - int sz = getnum(fmt, df); - if (sz > MAXINTSIZE || sz <= 0) - luaL_error(h->L, "integral size (%d) out of limits [1,%d]", - sz, MAXINTSIZE); - return sz; -} - - -/* -** Initialize Header -*/ -static void initheader (lua_State *L, Header *h) { - h->L = L; - h->islittle = nativeendian.little; - h->maxalign = 1; -} - - -/* -** Read and classify next option. 'size' is filled with option's size. -*/ -static KOption getoption (Header *h, const char **fmt, int *size) { - int opt = *((*fmt)++); - *size = 0; /* default */ - switch (opt) { - case 'b': *size = sizeof(char); return Kint; - case 'B': *size = sizeof(char); return Kuint; - case 'h': *size = sizeof(short); return Kint; - case 'H': *size = sizeof(short); return Kuint; - case 'l': *size = sizeof(long); return Kint; - case 'L': *size = sizeof(long); return Kuint; - case 'j': *size = sizeof(lua_Integer); return Kint; - case 'J': *size = sizeof(lua_Integer); return Kuint; - case 'T': *size = sizeof(size_t); return Kuint; - case 'f': *size = sizeof(float); return Kfloat; - case 'd': *size = sizeof(double); return Kfloat; - case 'n': *size = sizeof(lua_Number); return Kfloat; - case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; - case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; - case 's': *size = getnumlimit(h, fmt, sizeof(size_t)); return Kstring; - case 'c': - *size = getnum(fmt, -1); - if (*size == -1) - luaL_error(h->L, "missing size for format option 'c'"); - return Kchar; - case 'z': return Kzstr; - case 'x': *size = 1; return Kpadding; - case 'X': return Kpaddalign; - case ' ': break; - case '<': h->islittle = 1; break; - case '>': h->islittle = 0; break; - case '=': h->islittle = nativeendian.little; break; - case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; - default: luaL_error(h->L, "invalid format option '%c'", opt); - } - return Knop; -} - - -/* -** Read, classify, and fill other details about the next option. -** 'psize' is filled with option's size, 'notoalign' with its -** alignment requirements. -** Local variable 'size' gets the size to be aligned. (Kpadal option -** always gets its full alignment, other options are limited by -** the maximum alignment ('maxalign'). Kchar option needs no alignment -** despite its size. -*/ -static KOption getdetails (Header *h, size_t totalsize, - const char **fmt, int *psize, int *ntoalign) { - KOption opt = getoption(h, fmt, psize); - int align = *psize; /* usually, alignment follows size */ - if (opt == Kpaddalign) { /* 'X' gets alignment from following option */ - if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) - luaL_argerror(h->L, 1, "invalid next option for option 'X'"); - } - if (align <= 1 || opt == Kchar) /* need no alignment? */ - *ntoalign = 0; - else { - if (align > h->maxalign) /* enforce maximum alignment */ - align = h->maxalign; - if ((align & (align - 1)) != 0) /* is 'align' not a power of 2? */ - luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); - *ntoalign = (align - (int)(totalsize & (align - 1))) & (align - 1); - } - return opt; -} - - -/* -** Pack integer 'n' with 'size' bytes and 'islittle' endianness. -** The final 'if' handles the case when 'size' is larger than -** the size of a Lua integer, correcting the extra sign-extension -** bytes if necessary (by default they would be zeros). -*/ -static void packint (luaL_Buffer *b, lua_Unsigned n, - int islittle, int size, int neg) { - char *buff = luaL_prepbuffsize(b, size); - int i; - buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ - for (i = 1; i < size; i++) { - n >>= NB; - buff[islittle ? i : size - 1 - i] = (char)(n & MC); - } - if (neg && size > SZINT) { /* negative number need sign extension? */ - for (i = SZINT; i < size; i++) /* correct extra bytes */ - buff[islittle ? i : size - 1 - i] = (char)MC; - } - luaL_addsize(b, size); /* add result to buffer */ -} - - -/* -** Copy 'size' bytes from 'src' to 'dest', correcting endianness if -** given 'islittle' is different from native endianness. -*/ -static void copywithendian (volatile char *dest, volatile const char *src, - int size, int islittle) { - if (islittle == nativeendian.little) { - while (size-- != 0) - *(dest++) = *(src++); - } - else { - dest += size - 1; - while (size-- != 0) - *(dest--) = *(src++); - } -} - - -static int str_pack (lua_State *L) { - luaL_Buffer b; - Header h; - const char *fmt = luaL_checkstring(L, 1); /* format string */ - int arg = 1; /* current argument to pack */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - lua_pushnil(L); /* mark to separate arguments from string buffer */ - luaL_buffinit(L, &b); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - totalsize += ntoalign + size; - while (ntoalign-- > 0) - luaL_addchar(&b, LUAL_PACKPADBYTE); /* fill alignment */ - arg++; - switch (opt) { - case Kint: { /* signed integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) { /* need overflow check? */ - lua_Integer lim = (lua_Integer)1 << ((size * NB) - 1); - luaL_argcheck(L, -lim <= n && n < lim, arg, "integer overflow"); - } - packint(&b, (lua_Unsigned)n, h.islittle, size, (n < 0)); - break; - } - case Kuint: { /* unsigned integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) /* need overflow check? */ - luaL_argcheck(L, (lua_Unsigned)n < ((lua_Unsigned)1 << (size * NB)), - arg, "unsigned overflow"); - packint(&b, (lua_Unsigned)n, h.islittle, size, 0); - break; - } - case Kfloat: { /* floating-point options */ - volatile Ftypes u; - char *buff = luaL_prepbuffsize(&b, size); - lua_Number n = luaL_checknumber(L, arg); /* get argument */ - if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ - else if (size == sizeof(u.d)) u.d = (double)n; - else u.n = n; - /* move 'u' to final result, correcting endianness if needed */ - copywithendian(buff, u.buff, size, h.islittle); - luaL_addsize(&b, size); - break; - } - case Kchar: { /* fixed-size string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, len <= (size_t)size, arg, - "string longer than given size"); - luaL_addlstring(&b, s, len); /* add string */ - while (len++ < (size_t)size) /* pad extra space */ - luaL_addchar(&b, LUAL_PACKPADBYTE); - break; - } - case Kstring: { /* strings with length count */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, size >= (int)sizeof(size_t) || - len < ((size_t)1 << (size * NB)), - arg, "string length does not fit in given size"); - packint(&b, (lua_Unsigned)len, h.islittle, size, 0); /* pack length */ - luaL_addlstring(&b, s, len); - totalsize += len; - break; - } - case Kzstr: { /* zero-terminated string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); - luaL_addlstring(&b, s, len); - luaL_addchar(&b, '\0'); /* add zero at the end */ - totalsize += len + 1; - break; - } - case Kpadding: luaL_addchar(&b, LUAL_PACKPADBYTE); /* FALLTHROUGH */ - case Kpaddalign: case Knop: - arg--; /* undo increment */ - break; - } - } - luaL_pushresult(&b); - return 1; -} - - -static int str_packsize (lua_State *L) { - Header h; - const char *fmt = luaL_checkstring(L, 1); /* format string */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - size += ntoalign; /* total space used by option */ - luaL_argcheck(L, totalsize <= MAXSIZE - size, 1, - "format result too large"); - totalsize += size; - switch (opt) { - case Kstring: /* strings with length count */ - case Kzstr: /* zero-terminated string */ - luaL_argerror(L, 1, "variable-length format"); - /* call never return, but to avoid warnings: *//* FALLTHROUGH */ - default: break; - } - } - lua_pushinteger(L, (lua_Integer)totalsize); - return 1; -} - - -/* -** Unpack an integer with 'size' bytes and 'islittle' endianness. -** If size is smaller than the size of a Lua integer and integer -** is signed, must do sign extension (propagating the sign to the -** higher bits); if size is larger than the size of a Lua integer, -** it must check the unread bytes to see whether they do not cause an -** overflow. -*/ -static lua_Integer unpackint (lua_State *L, const char *str, - int islittle, int size, int issigned) { - lua_Unsigned res = 0; - int i; - int limit = (size <= SZINT) ? size : SZINT; - for (i = limit - 1; i >= 0; i--) { - res <<= NB; - res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i]; - } - if (size < SZINT) { /* real size smaller than lua_Integer? */ - if (issigned) { /* needs sign extension? */ - lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1); - res = ((res ^ mask) - mask); /* do sign extension */ - } - } - else if (size > SZINT) { /* must check unread bytes */ - int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC; - for (i = limit; i < size; i++) { - if ((unsigned char)str[islittle ? i : size - 1 - i] != mask) - luaL_error(L, "%d-byte integer does not fit into Lua Integer", size); - } - } - return (lua_Integer)res; -} - - -static int str_unpack (lua_State *L) { - Header h; - const char *fmt = luaL_checkstring(L, 1); - size_t ld; - const char *data = luaL_checklstring(L, 2, &ld); - size_t pos = (size_t)posrelat(luaL_optinteger(L, 3, 1), ld) - 1; - int n = 0; /* number of results */ - luaL_argcheck(L, pos <= ld, 3, "initial position out of string"); - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, pos, &fmt, &size, &ntoalign); - if ((size_t)ntoalign + size > ~pos || pos + ntoalign + size > ld) - luaL_argerror(L, 2, "data string too short"); - pos += ntoalign; /* skip alignment */ - /* stack space for item + next position */ - luaL_checkstack(L, 2, "too many results"); - n++; - switch (opt) { - case Kint: - case Kuint: { - lua_Integer res = unpackint(L, data + pos, h.islittle, size, - (opt == Kint)); - lua_pushinteger(L, res); - break; - } - case Kfloat: { - volatile Ftypes u; - lua_Number num; - copywithendian(u.buff, data + pos, size, h.islittle); - if (size == sizeof(u.f)) num = (lua_Number)u.f; - else if (size == sizeof(u.d)) num = (lua_Number)u.d; - else num = u.n; - lua_pushnumber(L, num); - break; - } - case Kchar: { - lua_pushlstring(L, data + pos, size); - break; - } - case Kstring: { - size_t len = (size_t)unpackint(L, data + pos, h.islittle, size, 0); - luaL_argcheck(L, pos + len + size <= ld, 2, "data string too short"); - lua_pushlstring(L, data + pos + size, len); - pos += len; /* skip string */ - break; - } - case Kzstr: { - size_t len = (int)strlen(data + pos); - lua_pushlstring(L, data + pos, len); - pos += len + 1; /* skip string plus final '\0' */ - break; - } - case Kpaddalign: case Kpadding: case Knop: - n--; /* undo increment */ - break; - } - pos += size; - } - lua_pushinteger(L, pos + 1); /* next position */ - return n + 1; -} - -/* }====================================================== */ - - -static const luaL_Reg strlib[] = { - {"byte", str_byte}, - {"char", str_char}, - {"dump", str_dump}, - {"find", str_find}, - {"format", str_format}, - {"gmatch", gmatch}, - {"gsub", str_gsub}, - {"len", str_len}, - {"lower", str_lower}, - {"match", str_match}, - {"rep", str_rep}, - {"reverse", str_reverse}, - {"sub", str_sub}, - {"upper", str_upper}, - {"pack", str_pack}, - {"packsize", str_packsize}, - {"unpack", str_unpack}, - {NULL, NULL} -}; - - -static void createmetatable (lua_State *L) { - lua_createtable(L, 0, 1); /* table to be metatable for strings */ - lua_pushliteral(L, ""); /* dummy string */ - lua_pushvalue(L, -2); /* copy table */ - lua_setmetatable(L, -2); /* set table as metatable for strings */ - lua_pop(L, 1); /* pop dummy string */ - lua_pushvalue(L, -2); /* get string library */ - lua_setfield(L, -2, "__index"); /* metatable.__index = string */ - lua_pop(L, 1); /* pop metatable */ -} - - -/* -** Open string library -*/ -LUAMOD_API int luaopen_string (lua_State *L) { - luaL_newlib(L, strlib); - createmetatable(L); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/ltable.c b/deps/rcheevos/test/lua/src/ltable.c deleted file mode 100644 index d080189f28..0000000000 --- a/deps/rcheevos/test/lua/src/ltable.c +++ /dev/null @@ -1,669 +0,0 @@ -/* -** $Id: ltable.c,v 2.118 2016/11/07 12:38:35 roberto Exp $ -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - -#define ltable_c -#define LUA_CORE - -#include "lprefix.h" - - -/* -** Implementation of tables (aka arrays, objects, or hash tables). -** Tables keep its elements in two parts: an array part and a hash part. -** Non-negative integer keys are all candidates to be kept in the array -** part. The actual size of the array is the largest 'n' such that -** more than half the slots between 1 and n are in use. -** Hash uses a mix of chained scatter table with Brent's variation. -** A main invariant of these tables is that, if an element is not -** in its main position (i.e. the 'original' position that its hash gives -** to it), then the colliding element is in its own main position. -** Hence even when the load factor reaches 100%, performance remains good. -*/ - -#include -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "lvm.h" - - -/* -** Maximum size of array part (MAXASIZE) is 2^MAXABITS. MAXABITS is -** the largest integer such that MAXASIZE fits in an unsigned int. -*/ -#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1) -#define MAXASIZE (1u << MAXABITS) - -/* -** Maximum size of hash part is 2^MAXHBITS. MAXHBITS is the largest -** integer such that 2^MAXHBITS fits in a signed int. (Note that the -** maximum number of elements in a table, 2^MAXABITS + 2^MAXHBITS, still -** fits comfortably in an unsigned int.) -*/ -#define MAXHBITS (MAXABITS - 1) - - -#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) - -#define hashstr(t,str) hashpow2(t, (str)->hash) -#define hashboolean(t,p) hashpow2(t, p) -#define hashint(t,i) hashpow2(t, i) - - -/* -** for some types, it is better to avoid modulus by power of 2, as -** they tend to have many 2 factors. -*/ -#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) - - -#define hashpointer(t,p) hashmod(t, point2uint(p)) - - -#define dummynode (&dummynode_) - -static const Node dummynode_ = { - {NILCONSTANT}, /* value */ - {{NILCONSTANT, 0}} /* key */ -}; - - -/* -** Hash for floating-point numbers. -** The main computation should be just -** n = frexp(n, &i); return (n * INT_MAX) + i -** but there are some numerical subtleties. -** In a two-complement representation, INT_MAX does not has an exact -** representation as a float, but INT_MIN does; because the absolute -** value of 'frexp' is smaller than 1 (unless 'n' is inf/NaN), the -** absolute value of the product 'frexp * -INT_MIN' is smaller or equal -** to INT_MAX. Next, the use of 'unsigned int' avoids overflows when -** adding 'i'; the use of '~u' (instead of '-u') avoids problems with -** INT_MIN. -*/ -#if !defined(l_hashfloat) -static int l_hashfloat (lua_Number n) { - int i; - lua_Integer ni; - n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN); - if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */ - lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == cast_num(HUGE_VAL)); - return 0; - } - else { /* normal case */ - unsigned int u = cast(unsigned int, i) + cast(unsigned int, ni); - return cast_int(u <= cast(unsigned int, INT_MAX) ? u : ~u); - } -} -#endif - - -/* -** returns the 'main' position of an element in a table (that is, the index -** of its hash value) -*/ -static Node *mainposition (const Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TNUMINT: - return hashint(t, ivalue(key)); - case LUA_TNUMFLT: - return hashmod(t, l_hashfloat(fltvalue(key))); - case LUA_TSHRSTR: - return hashstr(t, tsvalue(key)); - case LUA_TLNGSTR: - return hashpow2(t, luaS_hashlongstr(tsvalue(key))); - case LUA_TBOOLEAN: - return hashboolean(t, bvalue(key)); - case LUA_TLIGHTUSERDATA: - return hashpointer(t, pvalue(key)); - case LUA_TLCF: - return hashpointer(t, fvalue(key)); - default: - lua_assert(!ttisdeadkey(key)); - return hashpointer(t, gcvalue(key)); - } -} - - -/* -** returns the index for 'key' if 'key' is an appropriate key to live in -** the array part of the table, 0 otherwise. -*/ -static unsigned int arrayindex (const TValue *key) { - if (ttisinteger(key)) { - lua_Integer k = ivalue(key); - if (0 < k && (lua_Unsigned)k <= MAXASIZE) - return cast(unsigned int, k); /* 'key' is an appropriate array index */ - } - return 0; /* 'key' did not match some condition */ -} - - -/* -** returns the index of a 'key' for table traversals. First goes all -** elements in the array part, then elements in the hash part. The -** beginning of a traversal is signaled by 0. -*/ -static unsigned int findindex (lua_State *L, Table *t, StkId key) { - unsigned int i; - if (ttisnil(key)) return 0; /* first iteration */ - i = arrayindex(key); - if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */ - return i; /* yes; that's the index */ - else { - int nx; - Node *n = mainposition(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - /* key may be dead already, but it is ok to use it in 'next' */ - if (luaV_rawequalobj(gkey(n), key) || - (ttisdeadkey(gkey(n)) && iscollectable(key) && - deadvalue(gkey(n)) == gcvalue(key))) { - i = cast_int(n - gnode(t, 0)); /* key index in hash table */ - /* hash elements are numbered after array ones */ - return (i + 1) + t->sizearray; - } - nx = gnext(n); - if (nx == 0) - luaG_runerror(L, "invalid key to 'next'"); /* key not found */ - else n += nx; - } - } -} - - -int luaH_next (lua_State *L, Table *t, StkId key) { - unsigned int i = findindex(L, t, key); /* find original element */ - for (; i < t->sizearray; i++) { /* try first array part */ - if (!ttisnil(&t->array[i])) { /* a non-nil value? */ - setivalue(key, i + 1); - setobj2s(L, key+1, &t->array[i]); - return 1; - } - } - for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */ - if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ - setobj2s(L, key, gkey(gnode(t, i))); - setobj2s(L, key+1, gval(gnode(t, i))); - return 1; - } - } - return 0; /* no more elements */ -} - - -/* -** {============================================================= -** Rehash -** ============================================================== -*/ - -/* -** Compute the optimal size for the array part of table 't'. 'nums' is a -** "count array" where 'nums[i]' is the number of integers in the table -** between 2^(i - 1) + 1 and 2^i. 'pna' enters with the total number of -** integer keys in the table and leaves with the number of keys that -** will go to the array part; return the optimal size. -*/ -static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { - int i; - unsigned int twotoi; /* 2^i (candidate for optimal size) */ - unsigned int a = 0; /* number of elements smaller than 2^i */ - unsigned int na = 0; /* number of elements to go to array part */ - unsigned int optimal = 0; /* optimal size for array part */ - /* loop while keys can fill more than half of total size */ - for (i = 0, twotoi = 1; *pna > twotoi / 2; i++, twotoi *= 2) { - if (nums[i] > 0) { - a += nums[i]; - if (a > twotoi/2) { /* more than half elements present? */ - optimal = twotoi; /* optimal size (till now) */ - na = a; /* all elements up to 'optimal' will go to array part */ - } - } - } - lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal); - *pna = na; - return optimal; -} - - -static int countint (const TValue *key, unsigned int *nums) { - unsigned int k = arrayindex(key); - if (k != 0) { /* is 'key' an appropriate array index? */ - nums[luaO_ceillog2(k)]++; /* count as such */ - return 1; - } - else - return 0; -} - - -/* -** Count keys in array part of table 't': Fill 'nums[i]' with -** number of keys that will go into corresponding slice and return -** total number of non-nil keys. -*/ -static unsigned int numusearray (const Table *t, unsigned int *nums) { - int lg; - unsigned int ttlg; /* 2^lg */ - unsigned int ause = 0; /* summation of 'nums' */ - unsigned int i = 1; /* count to traverse all array keys */ - /* traverse each slice */ - for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { - unsigned int lc = 0; /* counter */ - unsigned int lim = ttlg; - if (lim > t->sizearray) { - lim = t->sizearray; /* adjust upper limit */ - if (i > lim) - break; /* no more elements to count */ - } - /* count elements in range (2^(lg - 1), 2^lg] */ - for (; i <= lim; i++) { - if (!ttisnil(&t->array[i-1])) - lc++; - } - nums[lg] += lc; - ause += lc; - } - return ause; -} - - -static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { - int totaluse = 0; /* total number of elements */ - int ause = 0; /* elements added to 'nums' (can go to array part) */ - int i = sizenode(t); - while (i--) { - Node *n = &t->node[i]; - if (!ttisnil(gval(n))) { - ause += countint(gkey(n), nums); - totaluse++; - } - } - *pna += ause; - return totaluse; -} - - -static void setarrayvector (lua_State *L, Table *t, unsigned int size) { - unsigned int i; - luaM_reallocvector(L, t->array, t->sizearray, size, TValue); - for (i=t->sizearray; iarray[i]); - t->sizearray = size; -} - - -static void setnodevector (lua_State *L, Table *t, unsigned int size) { - if (size == 0) { /* no elements to hash part? */ - t->node = cast(Node *, dummynode); /* use common 'dummynode' */ - t->lsizenode = 0; - t->lastfree = NULL; /* signal that it is using dummy node */ - } - else { - int i; - int lsize = luaO_ceillog2(size); - if (lsize > MAXHBITS) - luaG_runerror(L, "table overflow"); - size = twoto(lsize); - t->node = luaM_newvector(L, size, Node); - for (i = 0; i < (int)size; i++) { - Node *n = gnode(t, i); - gnext(n) = 0; - setnilvalue(wgkey(n)); - setnilvalue(gval(n)); - } - t->lsizenode = cast_byte(lsize); - t->lastfree = gnode(t, size); /* all positions are free */ - } -} - - -void luaH_resize (lua_State *L, Table *t, unsigned int nasize, - unsigned int nhsize) { - unsigned int i; - int j; - unsigned int oldasize = t->sizearray; - int oldhsize = allocsizenode(t); - Node *nold = t->node; /* save old hash ... */ - if (nasize > oldasize) /* array part must grow? */ - setarrayvector(L, t, nasize); - /* create new hash part with appropriate size */ - setnodevector(L, t, nhsize); - if (nasize < oldasize) { /* array part must shrink? */ - t->sizearray = nasize; - /* re-insert elements from vanishing slice */ - for (i=nasize; iarray[i])) - luaH_setint(L, t, i + 1, &t->array[i]); - } - /* shrink array */ - luaM_reallocvector(L, t->array, oldasize, nasize, TValue); - } - /* re-insert elements from hash part */ - for (j = oldhsize - 1; j >= 0; j--) { - Node *old = nold + j; - if (!ttisnil(gval(old))) { - /* doesn't need barrier/invalidate cache, as entry was - already present in the table */ - setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); - } - } - if (oldhsize > 0) /* not the dummy node? */ - luaM_freearray(L, nold, cast(size_t, oldhsize)); /* free old hash */ -} - - -void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) { - int nsize = allocsizenode(t); - luaH_resize(L, t, nasize, nsize); -} - -/* -** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i -*/ -static void rehash (lua_State *L, Table *t, const TValue *ek) { - unsigned int asize; /* optimal size for array part */ - unsigned int na; /* number of keys in the array part */ - unsigned int nums[MAXABITS + 1]; - int i; - int totaluse; - for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ - na = numusearray(t, nums); /* count keys in array part */ - totaluse = na; /* all those keys are integer keys */ - totaluse += numusehash(t, nums, &na); /* count keys in hash part */ - /* count extra key */ - na += countint(ek, nums); - totaluse++; - /* compute new size for array part */ - asize = computesizes(nums, &na); - /* resize the table to new computed sizes */ - luaH_resize(L, t, asize, totaluse - na); -} - - - -/* -** }============================================================= -*/ - - -Table *luaH_new (lua_State *L) { - GCObject *o = luaC_newobj(L, LUA_TTABLE, sizeof(Table)); - Table *t = gco2t(o); - t->metatable = NULL; - t->flags = cast_byte(~0); - t->array = NULL; - t->sizearray = 0; - setnodevector(L, t, 0); - return t; -} - - -void luaH_free (lua_State *L, Table *t) { - if (!isdummy(t)) - luaM_freearray(L, t->node, cast(size_t, sizenode(t))); - luaM_freearray(L, t->array, t->sizearray); - luaM_free(L, t); -} - - -static Node *getfreepos (Table *t) { - if (!isdummy(t)) { - while (t->lastfree > t->node) { - t->lastfree--; - if (ttisnil(gkey(t->lastfree))) - return t->lastfree; - } - } - return NULL; /* could not find a free place */ -} - - - -/* -** inserts a new key into a hash table; first, check whether key's main -** position is free. If not, check whether colliding node is in its main -** position or not: if it is not, move colliding node to an empty place and -** put new key in its main position; otherwise (colliding node is in its main -** position), new key goes to an empty position. -*/ -TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { - Node *mp; - TValue aux; - if (ttisnil(key)) luaG_runerror(L, "table index is nil"); - else if (ttisfloat(key)) { - lua_Integer k; - if (luaV_tointeger(key, &k, 0)) { /* does index fit in an integer? */ - setivalue(&aux, k); - key = &aux; /* insert it as an integer */ - } - else if (luai_numisnan(fltvalue(key))) - luaG_runerror(L, "table index is NaN"); - } - mp = mainposition(t, key); - if (!ttisnil(gval(mp)) || isdummy(t)) { /* main position is taken? */ - Node *othern; - Node *f = getfreepos(t); /* get a free place */ - if (f == NULL) { /* cannot find a free place? */ - rehash(L, t, key); /* grow table */ - /* whatever called 'newkey' takes care of TM cache */ - return luaH_set(L, t, key); /* insert key into grown table */ - } - lua_assert(!isdummy(t)); - othern = mainposition(t, gkey(mp)); - if (othern != mp) { /* is colliding node out of its main position? */ - /* yes; move colliding node into free position */ - while (othern + gnext(othern) != mp) /* find previous */ - othern += gnext(othern); - gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ - *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ - if (gnext(mp) != 0) { - gnext(f) += cast_int(mp - f); /* correct 'next' */ - gnext(mp) = 0; /* now 'mp' is free */ - } - setnilvalue(gval(mp)); - } - else { /* colliding node is in its own main position */ - /* new node will go into free position */ - if (gnext(mp) != 0) - gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ - else lua_assert(gnext(f) == 0); - gnext(mp) = cast_int(f - mp); - mp = f; - } - } - setnodekey(L, &mp->i_key, key); - luaC_barrierback(L, t, key); - lua_assert(ttisnil(gval(mp))); - return gval(mp); -} - - -/* -** search function for integers -*/ -const TValue *luaH_getint (Table *t, lua_Integer key) { - /* (1 <= key && key <= t->sizearray) */ - if (l_castS2U(key) - 1 < t->sizearray) - return &t->array[key - 1]; - else { - Node *n = hashint(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) break; - n += nx; - } - } - return luaO_nilobject; - } -} - - -/* -** search function for short strings -*/ -const TValue *luaH_getshortstr (Table *t, TString *key) { - Node *n = hashstr(t, key); - lua_assert(key->tt == LUA_TSHRSTR); - for (;;) { /* check whether 'key' is somewhere in the chain */ - const TValue *k = gkey(n); - if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) - return luaO_nilobject; /* not found */ - n += nx; - } - } -} - - -/* -** "Generic" get version. (Not that generic: not valid for integers, -** which may be in array part, nor for floats with integral values.) -*/ -static const TValue *getgeneric (Table *t, const TValue *key) { - Node *n = mainposition(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - if (luaV_rawequalobj(gkey(n), key)) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) - return luaO_nilobject; /* not found */ - n += nx; - } - } -} - - -const TValue *luaH_getstr (Table *t, TString *key) { - if (key->tt == LUA_TSHRSTR) - return luaH_getshortstr(t, key); - else { /* for long strings, use generic case */ - TValue ko; - setsvalue(cast(lua_State *, NULL), &ko, key); - return getgeneric(t, &ko); - } -} - - -/* -** main search function -*/ -const TValue *luaH_get (Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TSHRSTR: return luaH_getshortstr(t, tsvalue(key)); - case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); - case LUA_TNIL: return luaO_nilobject; - case LUA_TNUMFLT: { - lua_Integer k; - if (luaV_tointeger(key, &k, 0)) /* index is int? */ - return luaH_getint(t, k); /* use specialized version */ - /* else... */ - } /* FALLTHROUGH */ - default: - return getgeneric(t, key); - } -} - - -/* -** beware: when using this function you probably need to check a GC -** barrier and invalidate the TM cache. -*/ -TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { - const TValue *p = luaH_get(t, key); - if (p != luaO_nilobject) - return cast(TValue *, p); - else return luaH_newkey(L, t, key); -} - - -void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { - const TValue *p = luaH_getint(t, key); - TValue *cell; - if (p != luaO_nilobject) - cell = cast(TValue *, p); - else { - TValue k; - setivalue(&k, key); - cell = luaH_newkey(L, t, &k); - } - setobj2t(L, cell, value); -} - - -static int unbound_search (Table *t, unsigned int j) { - unsigned int i = j; /* i is zero or a present index */ - j++; - /* find 'i' and 'j' such that i is present and j is not */ - while (!ttisnil(luaH_getint(t, j))) { - i = j; - if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */ - /* table was built with bad purposes: resort to linear search */ - i = 1; - while (!ttisnil(luaH_getint(t, i))) i++; - return i - 1; - } - j *= 2; - } - /* now do a binary search between them */ - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(luaH_getint(t, m))) j = m; - else i = m; - } - return i; -} - - -/* -** Try to find a boundary in table 't'. A 'boundary' is an integer index -** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). -*/ -int luaH_getn (Table *t) { - unsigned int j = t->sizearray; - if (j > 0 && ttisnil(&t->array[j - 1])) { - /* there is a boundary in the array part: (binary) search for it */ - unsigned int i = 0; - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(&t->array[m - 1])) j = m; - else i = m; - } - return i; - } - /* else must find a boundary in hash part */ - else if (isdummy(t)) /* hash part is empty? */ - return j; /* that is easy... */ - else return unbound_search(t, j); -} - - - -#if defined(LUA_DEBUG) - -Node *luaH_mainposition (const Table *t, const TValue *key) { - return mainposition(t, key); -} - -int luaH_isdummy (const Table *t) { return isdummy(t); } - -#endif diff --git a/deps/rcheevos/test/lua/src/ltable.h b/deps/rcheevos/test/lua/src/ltable.h deleted file mode 100644 index 6da9024fe1..0000000000 --- a/deps/rcheevos/test/lua/src/ltable.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -** $Id: ltable.h,v 2.23 2016/12/22 13:08:50 roberto Exp $ -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - -#ifndef ltable_h -#define ltable_h - -#include "lobject.h" - - -#define gnode(t,i) (&(t)->node[i]) -#define gval(n) (&(n)->i_val) -#define gnext(n) ((n)->i_key.nk.next) - - -/* 'const' to avoid wrong writings that can mess up field 'next' */ -#define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) - -/* -** writable version of 'gkey'; allows updates to individual fields, -** but not to the whole (which has incompatible type) -*/ -#define wgkey(n) (&(n)->i_key.nk) - -#define invalidateTMcache(t) ((t)->flags = 0) - - -/* true when 't' is using 'dummynode' as its hash part */ -#define isdummy(t) ((t)->lastfree == NULL) - - -/* allocated size for hash nodes */ -#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) - - -/* returns the key, given the value of a table entry */ -#define keyfromval(v) \ - (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) - - -LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); -LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, - TValue *value); -LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); -LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); -LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); -LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); -LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); -LUAI_FUNC Table *luaH_new (lua_State *L); -LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, - unsigned int nhsize); -LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); -LUAI_FUNC void luaH_free (lua_State *L, Table *t); -LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); -LUAI_FUNC int luaH_getn (Table *t); - - -#if defined(LUA_DEBUG) -LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); -LUAI_FUNC int luaH_isdummy (const Table *t); -#endif - - -#endif diff --git a/deps/rcheevos/test/lua/src/ltablib.c b/deps/rcheevos/test/lua/src/ltablib.c deleted file mode 100644 index 98b2f87137..0000000000 --- a/deps/rcheevos/test/lua/src/ltablib.c +++ /dev/null @@ -1,450 +0,0 @@ -/* -** $Id: ltablib.c,v 1.93 2016/02/25 19:41:54 roberto Exp $ -** Library for Table Manipulation -** See Copyright Notice in lua.h -*/ - -#define ltablib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** Operations that an object must define to mimic a table -** (some functions only need some of them) -*/ -#define TAB_R 1 /* read */ -#define TAB_W 2 /* write */ -#define TAB_L 4 /* length */ -#define TAB_RW (TAB_R | TAB_W) /* read/write */ - - -#define aux_getn(L,n,w) (checktab(L, n, (w) | TAB_L), luaL_len(L, n)) - - -static int checkfield (lua_State *L, const char *key, int n) { - lua_pushstring(L, key); - return (lua_rawget(L, -n) != LUA_TNIL); -} - - -/* -** Check that 'arg' either is a table or can behave like one (that is, -** has a metatable with the required metamethods) -*/ -static void checktab (lua_State *L, int arg, int what) { - if (lua_type(L, arg) != LUA_TTABLE) { /* is it not a table? */ - int n = 1; /* number of elements to pop */ - if (lua_getmetatable(L, arg) && /* must have metatable */ - (!(what & TAB_R) || checkfield(L, "__index", ++n)) && - (!(what & TAB_W) || checkfield(L, "__newindex", ++n)) && - (!(what & TAB_L) || checkfield(L, "__len", ++n))) { - lua_pop(L, n); /* pop metatable and tested metamethods */ - } - else - luaL_checktype(L, arg, LUA_TTABLE); /* force an error */ - } -} - - -#if defined(LUA_COMPAT_MAXN) -static int maxn (lua_State *L) { - lua_Number max = 0; - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushnil(L); /* first key */ - while (lua_next(L, 1)) { - lua_pop(L, 1); /* remove value */ - if (lua_type(L, -1) == LUA_TNUMBER) { - lua_Number v = lua_tonumber(L, -1); - if (v > max) max = v; - } - } - lua_pushnumber(L, max); - return 1; -} -#endif - - -static int tinsert (lua_State *L) { - lua_Integer e = aux_getn(L, 1, TAB_RW) + 1; /* first empty element */ - lua_Integer pos; /* where to insert new element */ - switch (lua_gettop(L)) { - case 2: { /* called with only 2 arguments */ - pos = e; /* insert new element at the end */ - break; - } - case 3: { - lua_Integer i; - pos = luaL_checkinteger(L, 2); /* 2nd argument is the position */ - luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds"); - for (i = e; i > pos; i--) { /* move up elements */ - lua_geti(L, 1, i - 1); - lua_seti(L, 1, i); /* t[i] = t[i - 1] */ - } - break; - } - default: { - return luaL_error(L, "wrong number of arguments to 'insert'"); - } - } - lua_seti(L, 1, pos); /* t[pos] = v */ - return 0; -} - - -static int tremove (lua_State *L) { - lua_Integer size = aux_getn(L, 1, TAB_RW); - lua_Integer pos = luaL_optinteger(L, 2, size); - if (pos != size) /* validate 'pos' if given */ - luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); - lua_geti(L, 1, pos); /* result = t[pos] */ - for ( ; pos < size; pos++) { - lua_geti(L, 1, pos + 1); - lua_seti(L, 1, pos); /* t[pos] = t[pos + 1] */ - } - lua_pushnil(L); - lua_seti(L, 1, pos); /* t[pos] = nil */ - return 1; -} - - -/* -** Copy elements (1[f], ..., 1[e]) into (tt[t], tt[t+1], ...). Whenever -** possible, copy in increasing order, which is better for rehashing. -** "possible" means destination after original range, or smaller -** than origin, or copying to another table. -*/ -static int tmove (lua_State *L) { - lua_Integer f = luaL_checkinteger(L, 2); - lua_Integer e = luaL_checkinteger(L, 3); - lua_Integer t = luaL_checkinteger(L, 4); - int tt = !lua_isnoneornil(L, 5) ? 5 : 1; /* destination table */ - checktab(L, 1, TAB_R); - checktab(L, tt, TAB_W); - if (e >= f) { /* otherwise, nothing to move */ - lua_Integer n, i; - luaL_argcheck(L, f > 0 || e < LUA_MAXINTEGER + f, 3, - "too many elements to move"); - n = e - f + 1; /* number of elements to move */ - luaL_argcheck(L, t <= LUA_MAXINTEGER - n + 1, 4, - "destination wrap around"); - if (t > e || t <= f || (tt != 1 && !lua_compare(L, 1, tt, LUA_OPEQ))) { - for (i = 0; i < n; i++) { - lua_geti(L, 1, f + i); - lua_seti(L, tt, t + i); - } - } - else { - for (i = n - 1; i >= 0; i--) { - lua_geti(L, 1, f + i); - lua_seti(L, tt, t + i); - } - } - } - lua_pushvalue(L, tt); /* return destination table */ - return 1; -} - - -static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) { - lua_geti(L, 1, i); - if (!lua_isstring(L, -1)) - luaL_error(L, "invalid value (%s) at index %d in table for 'concat'", - luaL_typename(L, -1), i); - luaL_addvalue(b); -} - - -static int tconcat (lua_State *L) { - luaL_Buffer b; - lua_Integer last = aux_getn(L, 1, TAB_R); - size_t lsep; - const char *sep = luaL_optlstring(L, 2, "", &lsep); - lua_Integer i = luaL_optinteger(L, 3, 1); - last = luaL_optinteger(L, 4, last); - luaL_buffinit(L, &b); - for (; i < last; i++) { - addfield(L, &b, i); - luaL_addlstring(&b, sep, lsep); - } - if (i == last) /* add last value (if interval was not empty) */ - addfield(L, &b, i); - luaL_pushresult(&b); - return 1; -} - - -/* -** {====================================================== -** Pack/unpack -** ======================================================= -*/ - -static int pack (lua_State *L) { - int i; - int n = lua_gettop(L); /* number of elements to pack */ - lua_createtable(L, n, 1); /* create result table */ - lua_insert(L, 1); /* put it at index 1 */ - for (i = n; i >= 1; i--) /* assign elements */ - lua_seti(L, 1, i); - lua_pushinteger(L, n); - lua_setfield(L, 1, "n"); /* t.n = number of elements */ - return 1; /* return table */ -} - - -static int unpack (lua_State *L) { - lua_Unsigned n; - lua_Integer i = luaL_optinteger(L, 2, 1); - lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); - if (i > e) return 0; /* empty range */ - n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ - if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n))) - return luaL_error(L, "too many results to unpack"); - for (; i < e; i++) { /* push arg[i..e - 1] (to avoid overflows) */ - lua_geti(L, 1, i); - } - lua_geti(L, 1, e); /* push last element */ - return (int)n; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** Quicksort -** (based on 'Algorithms in MODULA-3', Robert Sedgewick; -** Addison-Wesley, 1993.) -** ======================================================= -*/ - - -/* type for array indices */ -typedef unsigned int IdxT; - - -/* -** Produce a "random" 'unsigned int' to randomize pivot choice. This -** macro is used only when 'sort' detects a big imbalance in the result -** of a partition. (If you don't want/need this "randomness", ~0 is a -** good choice.) -*/ -#if !defined(l_randomizePivot) /* { */ - -#include - -/* size of 'e' measured in number of 'unsigned int's */ -#define sof(e) (sizeof(e) / sizeof(unsigned int)) - -/* -** Use 'time' and 'clock' as sources of "randomness". Because we don't -** know the types 'clock_t' and 'time_t', we cannot cast them to -** anything without risking overflows. A safe way to use their values -** is to copy them to an array of a known type and use the array values. -*/ -static unsigned int l_randomizePivot (void) { - clock_t c = clock(); - time_t t = time(NULL); - unsigned int buff[sof(c) + sof(t)]; - unsigned int i, rnd = 0; - memcpy(buff, &c, sof(c) * sizeof(unsigned int)); - memcpy(buff + sof(c), &t, sof(t) * sizeof(unsigned int)); - for (i = 0; i < sof(buff); i++) - rnd += buff[i]; - return rnd; -} - -#endif /* } */ - - -/* arrays larger than 'RANLIMIT' may use randomized pivots */ -#define RANLIMIT 100u - - -static void set2 (lua_State *L, IdxT i, IdxT j) { - lua_seti(L, 1, i); - lua_seti(L, 1, j); -} - - -/* -** Return true iff value at stack index 'a' is less than the value at -** index 'b' (according to the order of the sort). -*/ -static int sort_comp (lua_State *L, int a, int b) { - if (lua_isnil(L, 2)) /* no function? */ - return lua_compare(L, a, b, LUA_OPLT); /* a < b */ - else { /* function */ - int res; - lua_pushvalue(L, 2); /* push function */ - lua_pushvalue(L, a-1); /* -1 to compensate function */ - lua_pushvalue(L, b-2); /* -2 to compensate function and 'a' */ - lua_call(L, 2, 1); /* call function */ - res = lua_toboolean(L, -1); /* get result */ - lua_pop(L, 1); /* pop result */ - return res; - } -} - - -/* -** Does the partition: Pivot P is at the top of the stack. -** precondition: a[lo] <= P == a[up-1] <= a[up], -** so it only needs to do the partition from lo + 1 to up - 2. -** Pos-condition: a[lo .. i - 1] <= a[i] == P <= a[i + 1 .. up] -** returns 'i'. -*/ -static IdxT partition (lua_State *L, IdxT lo, IdxT up) { - IdxT i = lo; /* will be incremented before first use */ - IdxT j = up - 1; /* will be decremented before first use */ - /* loop invariant: a[lo .. i] <= P <= a[j .. up] */ - for (;;) { - /* next loop: repeat ++i while a[i] < P */ - while (lua_geti(L, 1, ++i), sort_comp(L, -1, -2)) { - if (i == up - 1) /* a[i] < P but a[up - 1] == P ?? */ - luaL_error(L, "invalid order function for sorting"); - lua_pop(L, 1); /* remove a[i] */ - } - /* after the loop, a[i] >= P and a[lo .. i - 1] < P */ - /* next loop: repeat --j while P < a[j] */ - while (lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { - if (j < i) /* j < i but a[j] > P ?? */ - luaL_error(L, "invalid order function for sorting"); - lua_pop(L, 1); /* remove a[j] */ - } - /* after the loop, a[j] <= P and a[j + 1 .. up] >= P */ - if (j < i) { /* no elements out of place? */ - /* a[lo .. i - 1] <= P <= a[j + 1 .. i .. up] */ - lua_pop(L, 1); /* pop a[j] */ - /* swap pivot (a[up - 1]) with a[i] to satisfy pos-condition */ - set2(L, up - 1, i); - return i; - } - /* otherwise, swap a[i] - a[j] to restore invariant and repeat */ - set2(L, i, j); - } -} - - -/* -** Choose an element in the middle (2nd-3th quarters) of [lo,up] -** "randomized" by 'rnd' -*/ -static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) { - IdxT r4 = (up - lo) / 4; /* range/4 */ - IdxT p = rnd % (r4 * 2) + (lo + r4); - lua_assert(lo + r4 <= p && p <= up - r4); - return p; -} - - -/* -** QuickSort algorithm (recursive function) -*/ -static void auxsort (lua_State *L, IdxT lo, IdxT up, - unsigned int rnd) { - while (lo < up) { /* loop for tail recursion */ - IdxT p; /* Pivot index */ - IdxT n; /* to be used later */ - /* sort elements 'lo', 'p', and 'up' */ - lua_geti(L, 1, lo); - lua_geti(L, 1, up); - if (sort_comp(L, -1, -2)) /* a[up] < a[lo]? */ - set2(L, lo, up); /* swap a[lo] - a[up] */ - else - lua_pop(L, 2); /* remove both values */ - if (up - lo == 1) /* only 2 elements? */ - return; /* already sorted */ - if (up - lo < RANLIMIT || rnd == 0) /* small interval or no randomize? */ - p = (lo + up)/2; /* middle element is a good pivot */ - else /* for larger intervals, it is worth a random pivot */ - p = choosePivot(lo, up, rnd); - lua_geti(L, 1, p); - lua_geti(L, 1, lo); - if (sort_comp(L, -2, -1)) /* a[p] < a[lo]? */ - set2(L, p, lo); /* swap a[p] - a[lo] */ - else { - lua_pop(L, 1); /* remove a[lo] */ - lua_geti(L, 1, up); - if (sort_comp(L, -1, -2)) /* a[up] < a[p]? */ - set2(L, p, up); /* swap a[up] - a[p] */ - else - lua_pop(L, 2); - } - if (up - lo == 2) /* only 3 elements? */ - return; /* already sorted */ - lua_geti(L, 1, p); /* get middle element (Pivot) */ - lua_pushvalue(L, -1); /* push Pivot */ - lua_geti(L, 1, up - 1); /* push a[up - 1] */ - set2(L, p, up - 1); /* swap Pivot (a[p]) with a[up - 1] */ - p = partition(L, lo, up); - /* a[lo .. p - 1] <= a[p] == P <= a[p + 1 .. up] */ - if (p - lo < up - p) { /* lower interval is smaller? */ - auxsort(L, lo, p - 1, rnd); /* call recursively for lower interval */ - n = p - lo; /* size of smaller interval */ - lo = p + 1; /* tail call for [p + 1 .. up] (upper interval) */ - } - else { - auxsort(L, p + 1, up, rnd); /* call recursively for upper interval */ - n = up - p; /* size of smaller interval */ - up = p - 1; /* tail call for [lo .. p - 1] (lower interval) */ - } - if ((up - lo) / 128 > n) /* partition too imbalanced? */ - rnd = l_randomizePivot(); /* try a new randomization */ - } /* tail call auxsort(L, lo, up, rnd) */ -} - - -static int sort (lua_State *L) { - lua_Integer n = aux_getn(L, 1, TAB_RW); - if (n > 1) { /* non-trivial interval? */ - luaL_argcheck(L, n < INT_MAX, 1, "array too big"); - if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */ - luaL_checktype(L, 2, LUA_TFUNCTION); /* must be a function */ - lua_settop(L, 2); /* make sure there are two arguments */ - auxsort(L, 1, (IdxT)n, 0); - } - return 0; -} - -/* }====================================================== */ - - -static const luaL_Reg tab_funcs[] = { - {"concat", tconcat}, -#if defined(LUA_COMPAT_MAXN) - {"maxn", maxn}, -#endif - {"insert", tinsert}, - {"pack", pack}, - {"unpack", unpack}, - {"remove", tremove}, - {"move", tmove}, - {"sort", sort}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_table (lua_State *L) { - luaL_newlib(L, tab_funcs); -#if defined(LUA_COMPAT_UNPACK) - /* _G.unpack = table.unpack */ - lua_getfield(L, -1, "unpack"); - lua_setglobal(L, "unpack"); -#endif - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/ltm.c b/deps/rcheevos/test/lua/src/ltm.c deleted file mode 100644 index bc8f64eb31..0000000000 --- a/deps/rcheevos/test/lua/src/ltm.c +++ /dev/null @@ -1,165 +0,0 @@ -/* -** $Id: ltm.c,v 2.38 2016/12/22 13:08:50 roberto Exp $ -** Tag methods -** See Copyright Notice in lua.h -*/ - -#define ltm_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - -static const char udatatypename[] = "userdata"; - -LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = { - "no value", - "nil", "boolean", udatatypename, "number", - "string", "table", "function", udatatypename, "thread", - "proto" /* this last case is used for tests only */ -}; - - -void luaT_init (lua_State *L) { - static const char *const luaT_eventname[] = { /* ORDER TM */ - "__index", "__newindex", - "__gc", "__mode", "__len", "__eq", - "__add", "__sub", "__mul", "__mod", "__pow", - "__div", "__idiv", - "__band", "__bor", "__bxor", "__shl", "__shr", - "__unm", "__bnot", "__lt", "__le", - "__concat", "__call" - }; - int i; - for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); - luaC_fix(L, obj2gco(G(L)->tmname[i])); /* never collect these names */ - } -} - - -/* -** function to be used with macro "fasttm": optimized for absence of -** tag methods -*/ -const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { - const TValue *tm = luaH_getshortstr(events, ename); - lua_assert(event <= TM_EQ); - if (ttisnil(tm)) { /* no tag method? */ - events->flags |= cast_byte(1u<metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(o)->metatable; - break; - default: - mt = G(L)->mt[ttnov(o)]; - } - return (mt ? luaH_getshortstr(mt, G(L)->tmname[event]) : luaO_nilobject); -} - - -/* -** Return the name of the type of an object. For tables and userdata -** with metatable, use their '__name' metafield, if present. -*/ -const char *luaT_objtypename (lua_State *L, const TValue *o) { - Table *mt; - if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) || - (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) { - const TValue *name = luaH_getshortstr(mt, luaS_new(L, "__name")); - if (ttisstring(name)) /* is '__name' a string? */ - return getstr(tsvalue(name)); /* use it as type name */ - } - return ttypename(ttnov(o)); /* else use standard type name */ -} - - -void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, - const TValue *p2, TValue *p3, int hasres) { - ptrdiff_t result = savestack(L, p3); - StkId func = L->top; - setobj2s(L, func, f); /* push function (assume EXTRC_STACK) */ - setobj2s(L, func + 1, p1); /* 1st argument */ - setobj2s(L, func + 2, p2); /* 2nd argument */ - L->top += 3; - if (!hasres) /* no result? 'p3' is third argument */ - setobj2s(L, L->top++, p3); /* 3rd argument */ - /* metamethod may yield only when called from Lua code */ - if (isLua(L->ci)) - luaD_call(L, func, hasres); - else - luaD_callnoyield(L, func, hasres); - if (hasres) { /* if has result, move it to its place */ - p3 = restorestack(L, result); - setobjs2s(L, p3, --L->top); - } -} - - -int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event) { - const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ - if (ttisnil(tm)) - tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ - if (ttisnil(tm)) return 0; - luaT_callTM(L, tm, p1, p2, res, 1); - return 1; -} - - -void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event) { - if (!luaT_callbinTM(L, p1, p2, res, event)) { - switch (event) { - case TM_CONCAT: - luaG_concaterror(L, p1, p2); - /* call never returns, but to avoid warnings: *//* FALLTHROUGH */ - case TM_BAND: case TM_BOR: case TM_BXOR: - case TM_SHL: case TM_SHR: case TM_BNOT: { - lua_Number dummy; - if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) - luaG_tointerror(L, p1, p2); - else - luaG_opinterror(L, p1, p2, "perform bitwise operation on"); - } - /* calls never return, but to avoid warnings: *//* FALLTHROUGH */ - default: - luaG_opinterror(L, p1, p2, "perform arithmetic on"); - } - } -} - - -int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, - TMS event) { - if (!luaT_callbinTM(L, p1, p2, L->top, event)) - return -1; /* no metamethod */ - else - return !l_isfalse(L->top); -} - diff --git a/deps/rcheevos/test/lua/src/ltm.h b/deps/rcheevos/test/lua/src/ltm.h deleted file mode 100644 index 63db7269bb..0000000000 --- a/deps/rcheevos/test/lua/src/ltm.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -** $Id: ltm.h,v 2.22 2016/02/26 19:20:15 roberto Exp $ -** Tag methods -** See Copyright Notice in lua.h -*/ - -#ifndef ltm_h -#define ltm_h - - -#include "lobject.h" - - -/* -* WARNING: if you change the order of this enumeration, -* grep "ORDER TM" and "ORDER OP" -*/ -typedef enum { - TM_INDEX, - TM_NEWINDEX, - TM_GC, - TM_MODE, - TM_LEN, - TM_EQ, /* last tag method with fast access */ - TM_ADD, - TM_SUB, - TM_MUL, - TM_MOD, - TM_POW, - TM_DIV, - TM_IDIV, - TM_BAND, - TM_BOR, - TM_BXOR, - TM_SHL, - TM_SHR, - TM_UNM, - TM_BNOT, - TM_LT, - TM_LE, - TM_CONCAT, - TM_CALL, - TM_N /* number of elements in the enum */ -} TMS; - - - -#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ - ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) - -#define fasttm(l,et,e) gfasttm(G(l), et, e) - -#define ttypename(x) luaT_typenames_[(x) + 1] - -LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; - - -LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o); - -LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); -LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, - TMS event); -LUAI_FUNC void luaT_init (lua_State *L); - -LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, - const TValue *p2, TValue *p3, int hasres); -LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event); -LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event); -LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, - const TValue *p2, TMS event); - - - -#endif diff --git a/deps/rcheevos/test/lua/src/lua.c b/deps/rcheevos/test/lua/src/lua.c deleted file mode 100644 index 3f082da6be..0000000000 --- a/deps/rcheevos/test/lua/src/lua.c +++ /dev/null @@ -1,612 +0,0 @@ -/* -** $Id: lua.c,v 1.230 2017/01/12 17:14:26 roberto Exp $ -** Lua stand-alone interpreter -** See Copyright Notice in lua.h -*/ - -#define lua_c - -#include "lprefix.h" - - -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - - -#if !defined(LUA_PROMPT) -#define LUA_PROMPT "> " -#define LUA_PROMPT2 ">> " -#endif - -#if !defined(LUA_PROGNAME) -#define LUA_PROGNAME "lua" -#endif - -#if !defined(LUA_MAXINPUT) -#define LUA_MAXINPUT 512 -#endif - -#if !defined(LUA_INIT_VAR) -#define LUA_INIT_VAR "LUA_INIT" -#endif - -#define LUA_INITVARVERSION LUA_INIT_VAR LUA_VERSUFFIX - - -/* -** lua_stdin_is_tty detects whether the standard input is a 'tty' (that -** is, whether we're running lua interactively). -*/ -#if !defined(lua_stdin_is_tty) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#include -#define lua_stdin_is_tty() isatty(0) - -#elif defined(LUA_USE_WINDOWS) /* }{ */ - -#include -#include - -#define lua_stdin_is_tty() _isatty(_fileno(stdin)) - -#else /* }{ */ - -/* ISO C definition */ -#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ - -#endif /* } */ - -#endif /* } */ - - -/* -** lua_readline defines how to show a prompt and then read a line from -** the standard input. -** lua_saveline defines how to "save" a read line in a "history". -** lua_freeline defines how to free a line read by lua_readline. -*/ -#if !defined(lua_readline) /* { */ - -#if defined(LUA_USE_READLINE) /* { */ - -#include -#include -#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) -#define lua_saveline(L,line) ((void)L, add_history(line)) -#define lua_freeline(L,b) ((void)L, free(b)) - -#else /* }{ */ - -#define lua_readline(L,b,p) \ - ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ - fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ -#define lua_saveline(L,line) { (void)L; (void)line; } -#define lua_freeline(L,b) { (void)L; (void)b; } - -#endif /* } */ - -#endif /* } */ - - - - -static lua_State *globalL = NULL; - -static const char *progname = LUA_PROGNAME; - - -/* -** Hook set by signal function to stop the interpreter. -*/ -static void lstop (lua_State *L, lua_Debug *ar) { - (void)ar; /* unused arg. */ - lua_sethook(L, NULL, 0, 0); /* reset hook */ - luaL_error(L, "interrupted!"); -} - - -/* -** Function to be called at a C signal. Because a C signal cannot -** just change a Lua state (as there is no proper synchronization), -** this function only sets a hook that, when called, will stop the -** interpreter. -*/ -static void laction (int i) { - signal(i, SIG_DFL); /* if another SIGINT happens, terminate process */ - lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); -} - - -static void print_usage (const char *badoption) { - lua_writestringerror("%s: ", progname); - if (badoption[1] == 'e' || badoption[1] == 'l') - lua_writestringerror("'%s' needs argument\n", badoption); - else - lua_writestringerror("unrecognized option '%s'\n", badoption); - lua_writestringerror( - "usage: %s [options] [script [args]]\n" - "Available options are:\n" - " -e stat execute string 'stat'\n" - " -i enter interactive mode after executing 'script'\n" - " -l name require library 'name'\n" - " -v show version information\n" - " -E ignore environment variables\n" - " -- stop handling options\n" - " - stop handling options and execute stdin\n" - , - progname); -} - - -/* -** Prints an error message, adding the program name in front of it -** (if present) -*/ -static void l_message (const char *pname, const char *msg) { - if (pname) lua_writestringerror("%s: ", pname); - lua_writestringerror("%s\n", msg); -} - - -/* -** Check whether 'status' is not OK and, if so, prints the error -** message on the top of the stack. It assumes that the error object -** is a string, as it was either generated by Lua or by 'msghandler'. -*/ -static int report (lua_State *L, int status) { - if (status != LUA_OK) { - const char *msg = lua_tostring(L, -1); - l_message(progname, msg); - lua_pop(L, 1); /* remove message */ - } - return status; -} - - -/* -** Message handler used to run all chunks -*/ -static int msghandler (lua_State *L) { - const char *msg = lua_tostring(L, 1); - if (msg == NULL) { /* is error object not a string? */ - if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ - lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ - return 1; /* that is the message */ - else - msg = lua_pushfstring(L, "(error object is a %s value)", - luaL_typename(L, 1)); - } - luaL_traceback(L, L, msg, 1); /* append a standard traceback */ - return 1; /* return the traceback */ -} - - -/* -** Interface to 'lua_pcall', which sets appropriate message function -** and C-signal handler. Used to run all chunks. -*/ -static int docall (lua_State *L, int narg, int nres) { - int status; - int base = lua_gettop(L) - narg; /* function index */ - lua_pushcfunction(L, msghandler); /* push message handler */ - lua_insert(L, base); /* put it under function and args */ - globalL = L; /* to be available to 'laction' */ - signal(SIGINT, laction); /* set C-signal handler */ - status = lua_pcall(L, narg, nres, base); - signal(SIGINT, SIG_DFL); /* reset C-signal handler */ - lua_remove(L, base); /* remove message handler from the stack */ - return status; -} - - -static void print_version (void) { - lua_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT)); - lua_writeline(); -} - - -/* -** Create the 'arg' table, which stores all arguments from the -** command line ('argv'). It should be aligned so that, at index 0, -** it has 'argv[script]', which is the script name. The arguments -** to the script (everything after 'script') go to positive indices; -** other arguments (before the script name) go to negative indices. -** If there is no script name, assume interpreter's name as base. -*/ -static void createargtable (lua_State *L, char **argv, int argc, int script) { - int i, narg; - if (script == argc) script = 0; /* no script name? */ - narg = argc - (script + 1); /* number of positive indices */ - lua_createtable(L, narg, script + 1); - for (i = 0; i < argc; i++) { - lua_pushstring(L, argv[i]); - lua_rawseti(L, -2, i - script); - } - lua_setglobal(L, "arg"); -} - - -static int dochunk (lua_State *L, int status) { - if (status == LUA_OK) status = docall(L, 0, 0); - return report(L, status); -} - - -static int dofile (lua_State *L, const char *name) { - return dochunk(L, luaL_loadfile(L, name)); -} - - -static int dostring (lua_State *L, const char *s, const char *name) { - return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name)); -} - - -/* -** Calls 'require(name)' and stores the result in a global variable -** with the given name. -*/ -static int dolibrary (lua_State *L, const char *name) { - int status; - lua_getglobal(L, "require"); - lua_pushstring(L, name); - status = docall(L, 1, 1); /* call 'require(name)' */ - if (status == LUA_OK) - lua_setglobal(L, name); /* global[name] = require return */ - return report(L, status); -} - - -/* -** Returns the string to be used as a prompt by the interpreter. -*/ -static const char *get_prompt (lua_State *L, int firstline) { - const char *p; - lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2"); - p = lua_tostring(L, -1); - if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); - return p; -} - -/* mark in error messages for incomplete statements */ -#define EOFMARK "" -#define marklen (sizeof(EOFMARK)/sizeof(char) - 1) - - -/* -** Check whether 'status' signals a syntax error and the error -** message at the top of the stack ends with the above mark for -** incomplete statements. -*/ -static int incomplete (lua_State *L, int status) { - if (status == LUA_ERRSYNTAX) { - size_t lmsg; - const char *msg = lua_tolstring(L, -1, &lmsg); - if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) { - lua_pop(L, 1); - return 1; - } - } - return 0; /* else... */ -} - - -/* -** Prompt the user, read a line, and push it into the Lua stack. -*/ -static int pushline (lua_State *L, int firstline) { - char buffer[LUA_MAXINPUT]; - char *b = buffer; - size_t l; - const char *prmt = get_prompt(L, firstline); - int readstatus = lua_readline(L, b, prmt); - if (readstatus == 0) - return 0; /* no input (prompt will be popped by caller) */ - lua_pop(L, 1); /* remove prompt */ - l = strlen(b); - if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ - b[--l] = '\0'; /* remove it */ - if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ - lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ - else - lua_pushlstring(L, b, l); - lua_freeline(L, b); - return 1; -} - - -/* -** Try to compile line on the stack as 'return ;'; on return, stack -** has either compiled chunk or original line (if compilation failed). -*/ -static int addreturn (lua_State *L) { - const char *line = lua_tostring(L, -1); /* original line */ - const char *retline = lua_pushfstring(L, "return %s;", line); - int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin"); - if (status == LUA_OK) { - lua_remove(L, -2); /* remove modified line */ - if (line[0] != '\0') /* non empty? */ - lua_saveline(L, line); /* keep history */ - } - else - lua_pop(L, 2); /* pop result from 'luaL_loadbuffer' and modified line */ - return status; -} - - -/* -** Read multiple lines until a complete Lua statement -*/ -static int multiline (lua_State *L) { - for (;;) { /* repeat until gets a complete statement */ - size_t len; - const char *line = lua_tolstring(L, 1, &len); /* get what it has */ - int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ - if (!incomplete(L, status) || !pushline(L, 0)) { - lua_saveline(L, line); /* keep history */ - return status; /* cannot or should not try to add continuation line */ - } - lua_pushliteral(L, "\n"); /* add newline... */ - lua_insert(L, -2); /* ...between the two lines */ - lua_concat(L, 3); /* join them */ - } -} - - -/* -** Read a line and try to load (compile) it first as an expression (by -** adding "return " in front of it) and second as a statement. Return -** the final status of load/call with the resulting function (if any) -** in the top of the stack. -*/ -static int loadline (lua_State *L) { - int status; - lua_settop(L, 0); - if (!pushline(L, 1)) - return -1; /* no input */ - if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */ - status = multiline(L); /* try as command, maybe with continuation lines */ - lua_remove(L, 1); /* remove line from the stack */ - lua_assert(lua_gettop(L) == 1); - return status; -} - - -/* -** Prints (calling the Lua 'print' function) any values on the stack -*/ -static void l_print (lua_State *L) { - int n = lua_gettop(L); - if (n > 0) { /* any result to be printed? */ - luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); - lua_getglobal(L, "print"); - lua_insert(L, 1); - if (lua_pcall(L, n, 0, 0) != LUA_OK) - l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", - lua_tostring(L, -1))); - } -} - - -/* -** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and -** print any results. -*/ -static void doREPL (lua_State *L) { - int status; - const char *oldprogname = progname; - progname = NULL; /* no 'progname' on errors in interactive mode */ - while ((status = loadline(L)) != -1) { - if (status == LUA_OK) - status = docall(L, 0, LUA_MULTRET); - if (status == LUA_OK) l_print(L); - else report(L, status); - } - lua_settop(L, 0); /* clear stack */ - lua_writeline(); - progname = oldprogname; -} - - -/* -** Push on the stack the contents of table 'arg' from 1 to #arg -*/ -static int pushargs (lua_State *L) { - int i, n; - if (lua_getglobal(L, "arg") != LUA_TTABLE) - luaL_error(L, "'arg' is not a table"); - n = (int)luaL_len(L, -1); - luaL_checkstack(L, n + 3, "too many arguments to script"); - for (i = 1; i <= n; i++) - lua_rawgeti(L, -i, i); - lua_remove(L, -i); /* remove table from the stack */ - return n; -} - - -static int handle_script (lua_State *L, char **argv) { - int status; - const char *fname = argv[0]; - if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0) - fname = NULL; /* stdin */ - status = luaL_loadfile(L, fname); - if (status == LUA_OK) { - int n = pushargs(L); /* push arguments to script */ - status = docall(L, n, LUA_MULTRET); - } - return report(L, status); -} - - - -/* bits of various argument indicators in 'args' */ -#define has_error 1 /* bad option */ -#define has_i 2 /* -i */ -#define has_v 4 /* -v */ -#define has_e 8 /* -e */ -#define has_E 16 /* -E */ - -/* -** Traverses all arguments from 'argv', returning a mask with those -** needed before running any Lua code (or an error code if it finds -** any invalid argument). 'first' returns the first not-handled argument -** (either the script name or a bad argument in case of error). -*/ -static int collectargs (char **argv, int *first) { - int args = 0; - int i; - for (i = 1; argv[i] != NULL; i++) { - *first = i; - if (argv[i][0] != '-') /* not an option? */ - return args; /* stop handling options */ - switch (argv[i][1]) { /* else check option */ - case '-': /* '--' */ - if (argv[i][2] != '\0') /* extra characters after '--'? */ - return has_error; /* invalid option */ - *first = i + 1; - return args; - case '\0': /* '-' */ - return args; /* script "name" is '-' */ - case 'E': - if (argv[i][2] != '\0') /* extra characters after 1st? */ - return has_error; /* invalid option */ - args |= has_E; - break; - case 'i': - args |= has_i; /* (-i implies -v) *//* FALLTHROUGH */ - case 'v': - if (argv[i][2] != '\0') /* extra characters after 1st? */ - return has_error; /* invalid option */ - args |= has_v; - break; - case 'e': - args |= has_e; /* FALLTHROUGH */ - case 'l': /* both options need an argument */ - if (argv[i][2] == '\0') { /* no concatenated argument? */ - i++; /* try next 'argv' */ - if (argv[i] == NULL || argv[i][0] == '-') - return has_error; /* no next argument or it is another option */ - } - break; - default: /* invalid option */ - return has_error; - } - } - *first = i; /* no script name */ - return args; -} - - -/* -** Processes options 'e' and 'l', which involve running Lua code. -** Returns 0 if some code raises an error. -*/ -static int runargs (lua_State *L, char **argv, int n) { - int i; - for (i = 1; i < n; i++) { - int option = argv[i][1]; - lua_assert(argv[i][0] == '-'); /* already checked */ - if (option == 'e' || option == 'l') { - int status; - const char *extra = argv[i] + 2; /* both options need an argument */ - if (*extra == '\0') extra = argv[++i]; - lua_assert(extra != NULL); - status = (option == 'e') - ? dostring(L, extra, "=(command line)") - : dolibrary(L, extra); - if (status != LUA_OK) return 0; - } - } - return 1; -} - - - -static int handle_luainit (lua_State *L) { - const char *name = "=" LUA_INITVARVERSION; - const char *init = getenv(name + 1); - if (init == NULL) { - name = "=" LUA_INIT_VAR; - init = getenv(name + 1); /* try alternative name */ - } - if (init == NULL) return LUA_OK; - else if (init[0] == '@') - return dofile(L, init+1); - else - return dostring(L, init, name); -} - - -/* -** Main body of stand-alone interpreter (to be called in protected mode). -** Reads the options and handles them all. -*/ -static int pmain (lua_State *L) { - int argc = (int)lua_tointeger(L, 1); - char **argv = (char **)lua_touserdata(L, 2); - int script; - int args = collectargs(argv, &script); - luaL_checkversion(L); /* check that interpreter has correct version */ - if (argv[0] && argv[0][0]) progname = argv[0]; - if (args == has_error) { /* bad arg? */ - print_usage(argv[script]); /* 'script' has index of bad arg. */ - return 0; - } - if (args & has_v) /* option '-v'? */ - print_version(); - if (args & has_E) { /* option '-E'? */ - lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */ - lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); - } - luaL_openlibs(L); /* open standard libraries */ - createargtable(L, argv, argc, script); /* create table 'arg' */ - if (!(args & has_E)) { /* no option '-E'? */ - if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ - return 0; /* error running LUA_INIT */ - } - if (!runargs(L, argv, script)) /* execute arguments -e and -l */ - return 0; /* something failed */ - if (script < argc && /* execute main script (if there is one) */ - handle_script(L, argv + script) != LUA_OK) - return 0; - if (args & has_i) /* -i option? */ - doREPL(L); /* do read-eval-print loop */ - else if (script == argc && !(args & (has_e | has_v))) { /* no arguments? */ - if (lua_stdin_is_tty()) { /* running in interactive mode? */ - print_version(); - doREPL(L); /* do read-eval-print loop */ - } - else dofile(L, NULL); /* executes stdin as a file */ - } - lua_pushboolean(L, 1); /* signal no errors */ - return 1; -} - - -int main (int argc, char **argv) { - int status, result; - lua_State *L = luaL_newstate(); /* create state */ - if (L == NULL) { - l_message(argv[0], "cannot create state: not enough memory"); - return EXIT_FAILURE; - } - lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ - lua_pushinteger(L, argc); /* 1st argument */ - lua_pushlightuserdata(L, argv); /* 2nd argument */ - status = lua_pcall(L, 2, 1, 0); /* do the call */ - result = lua_toboolean(L, -1); /* get result */ - report(L, status); - lua_close(L); - return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE; -} - diff --git a/deps/rcheevos/test/lua/src/lua.h b/deps/rcheevos/test/lua/src/lua.h deleted file mode 100644 index 26c0e2d698..0000000000 --- a/deps/rcheevos/test/lua/src/lua.h +++ /dev/null @@ -1,486 +0,0 @@ -/* -** $Id: lua.h,v 1.332 2016/12/22 15:51:20 roberto Exp $ -** Lua - A Scripting Language -** Lua.org, PUC-Rio, Brazil (http://www.lua.org) -** See Copyright Notice at the end of this file -*/ - - -#ifndef lua_h -#define lua_h - -#include -#include - - -#include "luaconf.h" - - -#define LUA_VERSION_MAJOR "5" -#define LUA_VERSION_MINOR "3" -#define LUA_VERSION_NUM 503 -#define LUA_VERSION_RELEASE "4" - -#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR -#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE -#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2017 Lua.org, PUC-Rio" -#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" - - -/* mark for precompiled code ('Lua') */ -#define LUA_SIGNATURE "\x1bLua" - -/* option for multiple returns in 'lua_pcall' and 'lua_call' */ -#define LUA_MULTRET (-1) - - -/* -** Pseudo-indices -** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty -** space after that to help overflow detection) -*/ -#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) -#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) - - -/* thread status */ -#define LUA_OK 0 -#define LUA_YIELD 1 -#define LUA_ERRRUN 2 -#define LUA_ERRSYNTAX 3 -#define LUA_ERRMEM 4 -#define LUA_ERRGCMM 5 -#define LUA_ERRERR 6 - - -typedef struct lua_State lua_State; - - -/* -** basic types -*/ -#define LUA_TNONE (-1) - -#define LUA_TNIL 0 -#define LUA_TBOOLEAN 1 -#define LUA_TLIGHTUSERDATA 2 -#define LUA_TNUMBER 3 -#define LUA_TSTRING 4 -#define LUA_TTABLE 5 -#define LUA_TFUNCTION 6 -#define LUA_TUSERDATA 7 -#define LUA_TTHREAD 8 - -#define LUA_NUMTAGS 9 - - - -/* minimum Lua stack available to a C function */ -#define LUA_MINSTACK 20 - - -/* predefined values in the registry */ -#define LUA_RIDX_MAINTHREAD 1 -#define LUA_RIDX_GLOBALS 2 -#define LUA_RIDX_LAST LUA_RIDX_GLOBALS - - -/* type of numbers in Lua */ -typedef LUA_NUMBER lua_Number; - - -/* type for integer functions */ -typedef LUA_INTEGER lua_Integer; - -/* unsigned integer type */ -typedef LUA_UNSIGNED lua_Unsigned; - -/* type for continuation-function contexts */ -typedef LUA_KCONTEXT lua_KContext; - - -/* -** Type for C functions registered with Lua -*/ -typedef int (*lua_CFunction) (lua_State *L); - -/* -** Type for continuation functions -*/ -typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); - - -/* -** Type for functions that read/write blocks when loading/dumping Lua chunks -*/ -typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); - -typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); - - -/* -** Type for memory-allocation functions -*/ -typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); - - - -/* -** generic extra include file -*/ -#if defined(LUA_USER_H) -#include LUA_USER_H -#endif - - -/* -** RCS ident string -*/ -extern const char lua_ident[]; - - -/* -** state manipulation -*/ -LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); -LUA_API void (lua_close) (lua_State *L); -LUA_API lua_State *(lua_newthread) (lua_State *L); - -LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); - - -LUA_API const lua_Number *(lua_version) (lua_State *L); - - -/* -** basic stack manipulation -*/ -LUA_API int (lua_absindex) (lua_State *L, int idx); -LUA_API int (lua_gettop) (lua_State *L); -LUA_API void (lua_settop) (lua_State *L, int idx); -LUA_API void (lua_pushvalue) (lua_State *L, int idx); -LUA_API void (lua_rotate) (lua_State *L, int idx, int n); -LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); -LUA_API int (lua_checkstack) (lua_State *L, int n); - -LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); - - -/* -** access functions (stack -> C) -*/ - -LUA_API int (lua_isnumber) (lua_State *L, int idx); -LUA_API int (lua_isstring) (lua_State *L, int idx); -LUA_API int (lua_iscfunction) (lua_State *L, int idx); -LUA_API int (lua_isinteger) (lua_State *L, int idx); -LUA_API int (lua_isuserdata) (lua_State *L, int idx); -LUA_API int (lua_type) (lua_State *L, int idx); -LUA_API const char *(lua_typename) (lua_State *L, int tp); - -LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); -LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); -LUA_API int (lua_toboolean) (lua_State *L, int idx); -LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); -LUA_API size_t (lua_rawlen) (lua_State *L, int idx); -LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); -LUA_API void *(lua_touserdata) (lua_State *L, int idx); -LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); -LUA_API const void *(lua_topointer) (lua_State *L, int idx); - - -/* -** Comparison and arithmetic functions -*/ - -#define LUA_OPADD 0 /* ORDER TM, ORDER OP */ -#define LUA_OPSUB 1 -#define LUA_OPMUL 2 -#define LUA_OPMOD 3 -#define LUA_OPPOW 4 -#define LUA_OPDIV 5 -#define LUA_OPIDIV 6 -#define LUA_OPBAND 7 -#define LUA_OPBOR 8 -#define LUA_OPBXOR 9 -#define LUA_OPSHL 10 -#define LUA_OPSHR 11 -#define LUA_OPUNM 12 -#define LUA_OPBNOT 13 - -LUA_API void (lua_arith) (lua_State *L, int op); - -#define LUA_OPEQ 0 -#define LUA_OPLT 1 -#define LUA_OPLE 2 - -LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); -LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); - - -/* -** push functions (C -> stack) -*/ -LUA_API void (lua_pushnil) (lua_State *L); -LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); -LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); -LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); -LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); -LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, - va_list argp); -LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); -LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); -LUA_API void (lua_pushboolean) (lua_State *L, int b); -LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); -LUA_API int (lua_pushthread) (lua_State *L); - - -/* -** get functions (Lua -> stack) -*/ -LUA_API int (lua_getglobal) (lua_State *L, const char *name); -LUA_API int (lua_gettable) (lua_State *L, int idx); -LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k); -LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n); -LUA_API int (lua_rawget) (lua_State *L, int idx); -LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); -LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); - -LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); -LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); -LUA_API int (lua_getmetatable) (lua_State *L, int objindex); -LUA_API int (lua_getuservalue) (lua_State *L, int idx); - - -/* -** set functions (stack -> Lua) -*/ -LUA_API void (lua_setglobal) (lua_State *L, const char *name); -LUA_API void (lua_settable) (lua_State *L, int idx); -LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); -LUA_API void (lua_seti) (lua_State *L, int idx, lua_Integer n); -LUA_API void (lua_rawset) (lua_State *L, int idx); -LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); -LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); -LUA_API int (lua_setmetatable) (lua_State *L, int objindex); -LUA_API void (lua_setuservalue) (lua_State *L, int idx); - - -/* -** 'load' and 'call' functions (load and run Lua code) -*/ -LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, - lua_KContext ctx, lua_KFunction k); -#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) - -LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, - lua_KContext ctx, lua_KFunction k); -#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) - -LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, - const char *chunkname, const char *mode); - -LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); - - -/* -** coroutine functions -*/ -LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, - lua_KFunction k); -LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); -LUA_API int (lua_status) (lua_State *L); -LUA_API int (lua_isyieldable) (lua_State *L); - -#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) - - -/* -** garbage-collection function and options -*/ - -#define LUA_GCSTOP 0 -#define LUA_GCRESTART 1 -#define LUA_GCCOLLECT 2 -#define LUA_GCCOUNT 3 -#define LUA_GCCOUNTB 4 -#define LUA_GCSTEP 5 -#define LUA_GCSETPAUSE 6 -#define LUA_GCSETSTEPMUL 7 -#define LUA_GCISRUNNING 9 - -LUA_API int (lua_gc) (lua_State *L, int what, int data); - - -/* -** miscellaneous functions -*/ - -LUA_API int (lua_error) (lua_State *L); - -LUA_API int (lua_next) (lua_State *L, int idx); - -LUA_API void (lua_concat) (lua_State *L, int n); -LUA_API void (lua_len) (lua_State *L, int idx); - -LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); - -LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); -LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); - - - -/* -** {============================================================== -** some useful macros -** =============================================================== -*/ - -#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE)) - -#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) -#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) - -#define lua_pop(L,n) lua_settop(L, -(n)-1) - -#define lua_newtable(L) lua_createtable(L, 0, 0) - -#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) - -#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) - -#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) -#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) -#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) -#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) -#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) -#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) -#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) -#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) - -#define lua_pushliteral(L, s) lua_pushstring(L, "" s) - -#define lua_pushglobaltable(L) \ - ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)) - -#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) - - -#define lua_insert(L,idx) lua_rotate(L, (idx), 1) - -#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1)) - -#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1)) - -/* }============================================================== */ - - -/* -** {============================================================== -** compatibility macros for unsigned conversions -** =============================================================== -*/ -#if defined(LUA_COMPAT_APIINTCASTS) - -#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) -#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is)) -#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) - -#endif -/* }============================================================== */ - -/* -** {====================================================================== -** Debug API -** ======================================================================= -*/ - - -/* -** Event codes -*/ -#define LUA_HOOKCALL 0 -#define LUA_HOOKRET 1 -#define LUA_HOOKLINE 2 -#define LUA_HOOKCOUNT 3 -#define LUA_HOOKTAILCALL 4 - - -/* -** Event masks -*/ -#define LUA_MASKCALL (1 << LUA_HOOKCALL) -#define LUA_MASKRET (1 << LUA_HOOKRET) -#define LUA_MASKLINE (1 << LUA_HOOKLINE) -#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) - -typedef struct lua_Debug lua_Debug; /* activation record */ - - -/* Functions to be called by the debugger in specific events */ -typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); - - -LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); -LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); -LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n); -LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); - -LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); -LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, - int fidx2, int n2); - -LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); -LUA_API lua_Hook (lua_gethook) (lua_State *L); -LUA_API int (lua_gethookmask) (lua_State *L); -LUA_API int (lua_gethookcount) (lua_State *L); - - -struct lua_Debug { - int event; - const char *name; /* (n) */ - const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ - const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ - const char *source; /* (S) */ - int currentline; /* (l) */ - int linedefined; /* (S) */ - int lastlinedefined; /* (S) */ - unsigned char nups; /* (u) number of upvalues */ - unsigned char nparams;/* (u) number of parameters */ - char isvararg; /* (u) */ - char istailcall; /* (t) */ - char short_src[LUA_IDSIZE]; /* (S) */ - /* private part */ - struct CallInfo *i_ci; /* active function */ -}; - -/* }====================================================================== */ - - -/****************************************************************************** -* Copyright (C) 1994-2017 Lua.org, PUC-Rio. -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -******************************************************************************/ - - -#endif diff --git a/deps/rcheevos/test/lua/src/lua.hpp b/deps/rcheevos/test/lua/src/lua.hpp deleted file mode 100644 index ec417f5946..0000000000 --- a/deps/rcheevos/test/lua/src/lua.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// lua.hpp -// Lua header files for C++ -// <> not supplied automatically because Lua also compiles as C++ - -extern "C" { -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" -} diff --git a/deps/rcheevos/test/lua/src/luac.c b/deps/rcheevos/test/lua/src/luac.c deleted file mode 100644 index c0c91d017a..0000000000 --- a/deps/rcheevos/test/lua/src/luac.c +++ /dev/null @@ -1,449 +0,0 @@ -/* -** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $ -** Lua compiler (saves bytecodes to files; also lists bytecodes) -** See Copyright Notice in lua.h -*/ - -#define luac_c -#define LUA_CORE - -#include "lprefix.h" - -#include -#include -#include -#include -#include - -#include "lua.h" -#include "lauxlib.h" - -#include "lobject.h" -#include "lstate.h" -#include "lundump.h" - -static void PrintFunction(const Proto* f, int full); -#define luaU_print PrintFunction - -#define PROGNAME "luac" /* default program name */ -#define OUTPUT PROGNAME ".out" /* default output file */ - -static int listing=0; /* list bytecodes? */ -static int dumping=1; /* dump bytecodes? */ -static int stripping=0; /* strip debug information? */ -static char Output[]={ OUTPUT }; /* default output file name */ -static const char* output=Output; /* actual output file name */ -static const char* progname=PROGNAME; /* actual program name */ - -static void fatal(const char* message) -{ - fprintf(stderr,"%s: %s\n",progname,message); - exit(EXIT_FAILURE); -} - -static void cannot(const char* what) -{ - fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); - exit(EXIT_FAILURE); -} - -static void usage(const char* message) -{ - if (*message=='-') - fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); - else - fprintf(stderr,"%s: %s\n",progname,message); - fprintf(stderr, - "usage: %s [options] [filenames]\n" - "Available options are:\n" - " -l list (use -l -l for full listing)\n" - " -o name output to file 'name' (default is \"%s\")\n" - " -p parse only\n" - " -s strip debug information\n" - " -v show version information\n" - " -- stop handling options\n" - " - stop handling options and process stdin\n" - ,progname,Output); - exit(EXIT_FAILURE); -} - -#define IS(s) (strcmp(argv[i],s)==0) - -static int doargs(int argc, char* argv[]) -{ - int i; - int version=0; - if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; - for (i=1; itop+(i)) - -static const Proto* combine(lua_State* L, int n) -{ - if (n==1) - return toproto(L,-1); - else - { - Proto* f; - int i=n; - if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1)); - f=toproto(L,-1); - for (i=0; ip[i]=toproto(L,i-n-1); - if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0; - } - f->sizelineinfo=0; - return f; - } -} - -static int writer(lua_State* L, const void* p, size_t size, void* u) -{ - UNUSED(L); - return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); -} - -static int pmain(lua_State* L) -{ - int argc=(int)lua_tointeger(L,1); - char** argv=(char**)lua_touserdata(L,2); - const Proto* f; - int i; - if (!lua_checkstack(L,argc)) fatal("too many input files"); - for (i=0; i1); - if (dumping) - { - FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); - if (D==NULL) cannot("open"); - lua_lock(L); - luaU_dump(L,f,writer,D,stripping); - lua_unlock(L); - if (ferror(D)) cannot("write"); - if (fclose(D)) cannot("close"); - } - return 0; -} - -int main(int argc, char* argv[]) -{ - lua_State* L; - int i=doargs(argc,argv); - argc-=i; argv+=i; - if (argc<=0) usage("no input files given"); - L=luaL_newstate(); - if (L==NULL) fatal("cannot create state: not enough memory"); - lua_pushcfunction(L,&pmain); - lua_pushinteger(L,argc); - lua_pushlightuserdata(L,argv); - if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1)); - lua_close(L); - return EXIT_SUCCESS; -} - -/* -** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $ -** print bytecodes -** See Copyright Notice in lua.h -*/ - -#include -#include - -#define luac_c -#define LUA_CORE - -#include "ldebug.h" -#include "lobject.h" -#include "lopcodes.h" - -#define VOID(p) ((const void*)(p)) - -static void PrintString(const TString* ts) -{ - const char* s=getstr(ts); - size_t i,n=tsslen(ts); - printf("%c",'"'); - for (i=0; ik[i]; - switch (ttype(o)) - { - case LUA_TNIL: - printf("nil"); - break; - case LUA_TBOOLEAN: - printf(bvalue(o) ? "true" : "false"); - break; - case LUA_TNUMFLT: - { - char buff[100]; - sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); - printf("%s",buff); - if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); - break; - } - case LUA_TNUMINT: - printf(LUA_INTEGER_FMT,ivalue(o)); - break; - case LUA_TSHRSTR: case LUA_TLNGSTR: - PrintString(tsvalue(o)); - break; - default: /* cannot happen */ - printf("? type=%d",ttype(o)); - break; - } -} - -#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") -#define MYK(x) (-1-(x)) - -static void PrintCode(const Proto* f) -{ - const Instruction* code=f->code; - int pc,n=f->sizecode; - for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); - printf("%-9s\t",luaP_opnames[o]); - switch (getOpMode(o)) - { - case iABC: - printf("%d",a); - if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (MYK(INDEXK(b))) : b); - if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (MYK(INDEXK(c))) : c); - break; - case iABx: - printf("%d",a); - if (getBMode(o)==OpArgK) printf(" %d",MYK(bx)); - if (getBMode(o)==OpArgU) printf(" %d",bx); - break; - case iAsBx: - printf("%d %d",a,sbx); - break; - case iAx: - printf("%d",MYK(ax)); - break; - } - switch (o) - { - case OP_LOADK: - printf("\t; "); PrintConstant(f,bx); - break; - case OP_GETUPVAL: - case OP_SETUPVAL: - printf("\t; %s",UPVALNAME(b)); - break; - case OP_GETTABUP: - printf("\t; %s",UPVALNAME(b)); - if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } - break; - case OP_SETTABUP: - printf("\t; %s",UPVALNAME(a)); - if (ISK(b)) { printf(" "); PrintConstant(f,INDEXK(b)); } - if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } - break; - case OP_GETTABLE: - case OP_SELF: - if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } - break; - case OP_SETTABLE: - case OP_ADD: - case OP_SUB: - case OP_MUL: - case OP_POW: - case OP_DIV: - case OP_IDIV: - case OP_BAND: - case OP_BOR: - case OP_BXOR: - case OP_SHL: - case OP_SHR: - case OP_EQ: - case OP_LT: - case OP_LE: - if (ISK(b) || ISK(c)) - { - printf("\t; "); - if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); - printf(" "); - if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); - } - break; - case OP_JMP: - case OP_FORLOOP: - case OP_FORPREP: - case OP_TFORLOOP: - printf("\t; to %d",sbx+pc+2); - break; - case OP_CLOSURE: - printf("\t; %p",VOID(f->p[bx])); - break; - case OP_SETLIST: - if (c==0) printf("\t; %d",(int)code[++pc]); else printf("\t; %d",c); - break; - case OP_EXTRAARG: - printf("\t; "); PrintConstant(f,ax); - break; - default: - break; - } - printf("\n"); - } -} - -#define SS(x) ((x==1)?"":"s") -#define S(x) (int)(x),SS(x) - -static void PrintHeader(const Proto* f) -{ - const char* s=f->source ? getstr(f->source) : "=?"; - if (*s=='@' || *s=='=') - s++; - else if (*s==LUA_SIGNATURE[0]) - s="(bstring)"; - else - s="(string)"; - printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", - (f->linedefined==0)?"main":"function",s, - f->linedefined,f->lastlinedefined, - S(f->sizecode),VOID(f)); - printf("%d%s param%s, %d slot%s, %d upvalue%s, ", - (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), - S(f->maxstacksize),S(f->sizeupvalues)); - printf("%d local%s, %d constant%s, %d function%s\n", - S(f->sizelocvars),S(f->sizek),S(f->sizep)); -} - -static void PrintDebug(const Proto* f) -{ - int i,n; - n=f->sizek; - printf("constants (%d) for %p:\n",n,VOID(f)); - for (i=0; isizelocvars; - printf("locals (%d) for %p:\n",n,VOID(f)); - for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); - } - n=f->sizeupvalues; - printf("upvalues (%d) for %p:\n",n,VOID(f)); - for (i=0; iupvalues[i].instack,f->upvalues[i].idx); - } -} - -static void PrintFunction(const Proto* f, int full) -{ - int i,n=f->sizep; - PrintHeader(f); - PrintCode(f); - if (full) PrintDebug(f); - for (i=0; ip[i],full); -} diff --git a/deps/rcheevos/test/lua/src/luaconf.h b/deps/rcheevos/test/lua/src/luaconf.h deleted file mode 100644 index f37bea0964..0000000000 --- a/deps/rcheevos/test/lua/src/luaconf.h +++ /dev/null @@ -1,783 +0,0 @@ -/* -** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $ -** Configuration file for Lua -** See Copyright Notice in lua.h -*/ - - -#ifndef luaconf_h -#define luaconf_h - -#include -#include - - -/* -** =================================================================== -** Search for "@@" to find all configurable definitions. -** =================================================================== -*/ - - -/* -** {==================================================================== -** System Configuration: macros to adapt (if needed) Lua to some -** particular platform, for instance compiling it with 32-bit numbers or -** restricting it to C89. -** ===================================================================== -*/ - -/* -@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You -** can also define LUA_32BITS in the make file, but changing here you -** ensure that all software connected to Lua will be compiled with the -** same configuration. -*/ -/* #define LUA_32BITS */ - - -/* -@@ LUA_USE_C89 controls the use of non-ISO-C89 features. -** Define it if you want Lua to avoid the use of a few C99 features -** or Windows-specific features on Windows. -*/ -/* #define LUA_USE_C89 */ - - -/* -** By default, Lua on Windows use (some) specific Windows features -*/ -#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) -#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ -#endif - - -#if defined(LUA_USE_WINDOWS) -#define LUA_DL_DLL /* enable support for DLL */ -#define LUA_USE_C89 /* broadly, Windows is C89 */ -#endif - - -#if defined(LUA_USE_LINUX) -#define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ -#define LUA_USE_READLINE /* needs some extra libraries */ -#endif - - -#if defined(LUA_USE_MACOSX) -#define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ -#define LUA_USE_READLINE /* needs an extra library: -lreadline */ -#endif - - -/* -@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for -** C89 ('long' and 'double'); Windows always has '__int64', so it does -** not need to use this case. -*/ -#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) -#define LUA_C89_NUMBERS -#endif - - - -/* -@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. -*/ -/* avoid undefined shifts */ -#if ((INT_MAX >> 15) >> 15) >= 1 -#define LUAI_BITSINT 32 -#else -/* 'int' always must have at least 16 bits */ -#define LUAI_BITSINT 16 -#endif - - -/* -@@ LUA_INT_TYPE defines the type for Lua integers. -@@ LUA_FLOAT_TYPE defines the type for Lua floats. -** Lua should work fine with any mix of these options (if supported -** by your C compiler). The usual configurations are 64-bit integers -** and 'double' (the default), 32-bit integers and 'float' (for -** restricted platforms), and 'long'/'double' (for C compilers not -** compliant with C99, which may not have support for 'long long'). -*/ - -/* predefined options for LUA_INT_TYPE */ -#define LUA_INT_INT 1 -#define LUA_INT_LONG 2 -#define LUA_INT_LONGLONG 3 - -/* predefined options for LUA_FLOAT_TYPE */ -#define LUA_FLOAT_FLOAT 1 -#define LUA_FLOAT_DOUBLE 2 -#define LUA_FLOAT_LONGDOUBLE 3 - -#if defined(LUA_32BITS) /* { */ -/* -** 32-bit integers and 'float' -*/ -#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ -#define LUA_INT_TYPE LUA_INT_INT -#else /* otherwise use 'long' */ -#define LUA_INT_TYPE LUA_INT_LONG -#endif -#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT - -#elif defined(LUA_C89_NUMBERS) /* }{ */ -/* -** largest types available for C89 ('long' and 'double') -*/ -#define LUA_INT_TYPE LUA_INT_LONG -#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE - -#endif /* } */ - - -/* -** default configuration for 64-bit Lua ('long long' and 'double') -*/ -#if !defined(LUA_INT_TYPE) -#define LUA_INT_TYPE LUA_INT_LONGLONG -#endif - -#if !defined(LUA_FLOAT_TYPE) -#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE -#endif - -/* }================================================================== */ - - - - -/* -** {================================================================== -** Configuration for Paths. -** =================================================================== -*/ - -/* -** LUA_PATH_SEP is the character that separates templates in a path. -** LUA_PATH_MARK is the string that marks the substitution points in a -** template. -** LUA_EXEC_DIR in a Windows path is replaced by the executable's -** directory. -*/ -#define LUA_PATH_SEP ";" -#define LUA_PATH_MARK "?" -#define LUA_EXEC_DIR "!" - - -/* -@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for -** Lua libraries. -@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for -** C libraries. -** CHANGE them if your machine has a non-conventional directory -** hierarchy or if you want to install your libraries in -** non-conventional directories. -*/ -#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR -#if defined(_WIN32) /* { */ -/* -** In Windows, any exclamation mark ('!') in the path is replaced by the -** path of the directory of the executable file of the current process. -*/ -#define LUA_LDIR "!\\lua\\" -#define LUA_CDIR "!\\" -#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" -#define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ - LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ - ".\\?.lua;" ".\\?\\init.lua" -#define LUA_CPATH_DEFAULT \ - LUA_CDIR"?.dll;" \ - LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ - LUA_CDIR"loadall.dll;" ".\\?.dll" - -#else /* }{ */ - -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" -#define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ - "./?.lua;" "./?/init.lua" -#define LUA_CPATH_DEFAULT \ - LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" -#endif /* } */ - - -/* -@@ LUA_DIRSEP is the directory separator (for submodules). -** CHANGE it if your machine does not use "/" as the directory separator -** and is not Windows. (On Windows Lua automatically uses "\".) -*/ -#if defined(_WIN32) -#define LUA_DIRSEP "\\" -#else -#define LUA_DIRSEP "/" -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Marks for exported symbols in the C code -** =================================================================== -*/ - -/* -@@ LUA_API is a mark for all core API functions. -@@ LUALIB_API is a mark for all auxiliary library functions. -@@ LUAMOD_API is a mark for all standard library opening functions. -** CHANGE them if you need to define those functions in some special way. -** For instance, if you want to create one Windows DLL with the core and -** the libraries, you may want to use the following definition (define -** LUA_BUILD_AS_DLL to get it). -*/ -#if defined(LUA_BUILD_AS_DLL) /* { */ - -#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ -#define LUA_API __declspec(dllexport) -#else /* }{ */ -#define LUA_API __declspec(dllimport) -#endif /* } */ - -#else /* }{ */ - -#define LUA_API extern - -#endif /* } */ - - -/* more often than not the libs go together with the core */ -#define LUALIB_API LUA_API -#define LUAMOD_API LUALIB_API - - -/* -@@ LUAI_FUNC is a mark for all extern functions that are not to be -** exported to outside modules. -@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables -** that are not to be exported to outside modules (LUAI_DDEF for -** definitions and LUAI_DDEC for declarations). -** CHANGE them if you need to mark them in some special way. Elf/gcc -** (versions 3.2 and later) mark them as "hidden" to optimize access -** when Lua is compiled as a shared library. Not all elf targets support -** this attribute. Unfortunately, gcc does not offer a way to check -** whether the target offers that support, and those without support -** give a warning about it. To avoid these warnings, change to the -** default definition. -*/ -#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ - defined(__ELF__) /* { */ -#define LUAI_FUNC __attribute__((visibility("hidden"))) extern -#else /* }{ */ -#define LUAI_FUNC extern -#endif /* } */ - -#define LUAI_DDEC LUAI_FUNC -#define LUAI_DDEF /* empty */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Compatibility with previous versions -** =================================================================== -*/ - -/* -@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. -@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. -** You can define it to get all options, or change specific options -** to fit your specific needs. -*/ -#if defined(LUA_COMPAT_5_2) /* { */ - -/* -@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated -** functions in the mathematical library. -*/ -#define LUA_COMPAT_MATHLIB - -/* -@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. -*/ -#define LUA_COMPAT_BITLIB - -/* -@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. -*/ -#define LUA_COMPAT_IPAIRS - -/* -@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for -** manipulating other integer types (lua_pushunsigned, lua_tounsigned, -** luaL_checkint, luaL_checklong, etc.) -*/ -#define LUA_COMPAT_APIINTCASTS - -#endif /* } */ - - -#if defined(LUA_COMPAT_5_1) /* { */ - -/* Incompatibilities from 5.2 -> 5.3 */ -#define LUA_COMPAT_MATHLIB -#define LUA_COMPAT_APIINTCASTS - -/* -@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. -** You can replace it with 'table.unpack'. -*/ -#define LUA_COMPAT_UNPACK - -/* -@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. -** You can replace it with 'package.searchers'. -*/ -#define LUA_COMPAT_LOADERS - -/* -@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. -** You can call your C function directly (with light C functions). -*/ -#define lua_cpcall(L,f,u) \ - (lua_pushcfunction(L, (f)), \ - lua_pushlightuserdata(L,(u)), \ - lua_pcall(L,1,0,0)) - - -/* -@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. -** You can rewrite 'log10(x)' as 'log(x, 10)'. -*/ -#define LUA_COMPAT_LOG10 - -/* -@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base -** library. You can rewrite 'loadstring(s)' as 'load(s)'. -*/ -#define LUA_COMPAT_LOADSTRING - -/* -@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. -*/ -#define LUA_COMPAT_MAXN - -/* -@@ The following macros supply trivial compatibility for some -** changes in the API. The macros themselves document how to -** change your code to avoid using them. -*/ -#define lua_strlen(L,i) lua_rawlen(L, (i)) - -#define lua_objlen(L,i) lua_rawlen(L, (i)) - -#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) -#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) - -/* -@@ LUA_COMPAT_MODULE controls compatibility with previous -** module functions 'module' (Lua) and 'luaL_register' (C). -*/ -#define LUA_COMPAT_MODULE - -#endif /* } */ - - -/* -@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a -@@ a float mark ('.0'). -** This macro is not on by default even in compatibility mode, -** because this is not really an incompatibility. -*/ -/* #define LUA_COMPAT_FLOATSTRING */ - -/* }================================================================== */ - - - -/* -** {================================================================== -** Configuration for Numbers. -** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* -** satisfy your needs. -** =================================================================== -*/ - -/* -@@ LUA_NUMBER is the floating-point type used by Lua. -@@ LUAI_UACNUMBER is the result of a 'default argument promotion' -@@ over a floating number. -@@ l_mathlim(x) corrects limit name 'x' to the proper float type -** by prefixing it with one of FLT/DBL/LDBL. -@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. -@@ LUA_NUMBER_FMT is the format for writing floats. -@@ lua_number2str converts a float to a string. -@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. -@@ l_floor takes the floor of a float. -@@ lua_str2number converts a decimal numeric string to a number. -*/ - - -/* The following definitions are good for most cases here */ - -#define l_floor(x) (l_mathop(floor)(x)) - -#define lua_number2str(s,sz,n) \ - l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) - -/* -@@ lua_numbertointeger converts a float number to an integer, or -** returns 0 if float is not within the range of a lua_Integer. -** (The range comparisons are tricky because of rounding. The tests -** here assume a two-complement representation, where MININTEGER always -** has an exact representation as a float; MAXINTEGER may not have one, -** and therefore its conversion to float may have an ill-defined value.) -*/ -#define lua_numbertointeger(n,p) \ - ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ - (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ - (*(p) = (LUA_INTEGER)(n), 1)) - - -/* now the variable definitions */ - -#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ - -#define LUA_NUMBER float - -#define l_mathlim(n) (FLT_##n) - -#define LUAI_UACNUMBER double - -#define LUA_NUMBER_FRMLEN "" -#define LUA_NUMBER_FMT "%.7g" - -#define l_mathop(op) op##f - -#define lua_str2number(s,p) strtof((s), (p)) - - -#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ - -#define LUA_NUMBER long double - -#define l_mathlim(n) (LDBL_##n) - -#define LUAI_UACNUMBER long double - -#define LUA_NUMBER_FRMLEN "L" -#define LUA_NUMBER_FMT "%.19Lg" - -#define l_mathop(op) op##l - -#define lua_str2number(s,p) strtold((s), (p)) - -#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ - -#define LUA_NUMBER double - -#define l_mathlim(n) (DBL_##n) - -#define LUAI_UACNUMBER double - -#define LUA_NUMBER_FRMLEN "" -#define LUA_NUMBER_FMT "%.14g" - -#define l_mathop(op) op - -#define lua_str2number(s,p) strtod((s), (p)) - -#else /* }{ */ - -#error "numeric float type not defined" - -#endif /* } */ - - - -/* -@@ LUA_INTEGER is the integer type used by Lua. -** -@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. -** -@@ LUAI_UACINT is the result of a 'default argument promotion' -@@ over a lUA_INTEGER. -@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. -@@ LUA_INTEGER_FMT is the format for writing integers. -@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. -@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. -@@ lua_integer2str converts an integer to a string. -*/ - - -/* The following definitions are good for most cases here */ - -#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" - -#define LUAI_UACINT LUA_INTEGER - -#define lua_integer2str(s,sz,n) \ - l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) - -/* -** use LUAI_UACINT here to avoid problems with promotions (which -** can turn a comparison between unsigneds into a signed comparison) -*/ -#define LUA_UNSIGNED unsigned LUAI_UACINT - - -/* now the variable definitions */ - -#if LUA_INT_TYPE == LUA_INT_INT /* { int */ - -#define LUA_INTEGER int -#define LUA_INTEGER_FRMLEN "" - -#define LUA_MAXINTEGER INT_MAX -#define LUA_MININTEGER INT_MIN - -#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ - -#define LUA_INTEGER long -#define LUA_INTEGER_FRMLEN "l" - -#define LUA_MAXINTEGER LONG_MAX -#define LUA_MININTEGER LONG_MIN - -#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ - -/* use presence of macro LLONG_MAX as proxy for C99 compliance */ -#if defined(LLONG_MAX) /* { */ -/* use ISO C99 stuff */ - -#define LUA_INTEGER long long -#define LUA_INTEGER_FRMLEN "ll" - -#define LUA_MAXINTEGER LLONG_MAX -#define LUA_MININTEGER LLONG_MIN - -#elif defined(LUA_USE_WINDOWS) /* }{ */ -/* in Windows, can use specific Windows types */ - -#define LUA_INTEGER __int64 -#define LUA_INTEGER_FRMLEN "I64" - -#define LUA_MAXINTEGER _I64_MAX -#define LUA_MININTEGER _I64_MIN - -#else /* }{ */ - -#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ - or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" - -#endif /* } */ - -#else /* }{ */ - -#error "numeric integer type not defined" - -#endif /* } */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Dependencies with C99 and other C details -** =================================================================== -*/ - -/* -@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. -** (All uses in Lua have only one format item.) -*/ -#if !defined(LUA_USE_C89) -#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) -#else -#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) -#endif - - -/* -@@ lua_strx2number converts an hexadecimal numeric string to a number. -** In C99, 'strtod' does that conversion. Otherwise, you can -** leave 'lua_strx2number' undefined and Lua will provide its own -** implementation. -*/ -#if !defined(LUA_USE_C89) -#define lua_strx2number(s,p) lua_str2number(s,p) -#endif - - -/* -@@ lua_number2strx converts a float to an hexadecimal numeric string. -** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. -** Otherwise, you can leave 'lua_number2strx' undefined and Lua will -** provide its own implementation. -*/ -#if !defined(LUA_USE_C89) -#define lua_number2strx(L,b,sz,f,n) \ - ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) -#endif - - -/* -** 'strtof' and 'opf' variants for math functions are not valid in -** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the -** availability of these variants. ('math.h' is already included in -** all files that use these macros.) -*/ -#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) -#undef l_mathop /* variants not available */ -#undef lua_str2number -#define l_mathop(op) (lua_Number)op /* no variant */ -#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) -#endif - - -/* -@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation -** functions. It must be a numerical type; Lua will use 'intptr_t' if -** available, otherwise it will use 'ptrdiff_t' (the nearest thing to -** 'intptr_t' in C89) -*/ -#define LUA_KCONTEXT ptrdiff_t - -#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ - __STDC_VERSION__ >= 199901L -#include -#if defined(INTPTR_MAX) /* even in C99 this type is optional */ -#undef LUA_KCONTEXT -#define LUA_KCONTEXT intptr_t -#endif -#endif - - -/* -@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). -** Change that if you do not want to use C locales. (Code using this -** macro must include header 'locale.h'.) -*/ -#if !defined(lua_getlocaledecpoint) -#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Language Variations -** ===================================================================== -*/ - -/* -@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some -** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from -** numbers to strings. Define LUA_NOCVTS2N to turn off automatic -** coercion from strings to numbers. -*/ -/* #define LUA_NOCVTN2S */ -/* #define LUA_NOCVTS2N */ - - -/* -@@ LUA_USE_APICHECK turns on several consistency checks on the C API. -** Define it as a help when debugging C code. -*/ -#if defined(LUA_USE_APICHECK) -#include -#define luai_apicheck(l,e) assert(e) -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Macros that affect the API and must be stable (that is, must be the -** same when you compile Lua and when you compile code that links to -** Lua). You probably do not want/need to change them. -** ===================================================================== -*/ - -/* -@@ LUAI_MAXSTACK limits the size of the Lua stack. -** CHANGE it if you need a different limit. This limit is arbitrary; -** its only purpose is to stop Lua from consuming unlimited stack -** space (and to reserve some numbers for pseudo-indices). -*/ -#if LUAI_BITSINT >= 32 -#define LUAI_MAXSTACK 1000000 -#else -#define LUAI_MAXSTACK 15000 -#endif - - -/* -@@ LUA_EXTRASPACE defines the size of a raw memory area associated with -** a Lua state with very fast access. -** CHANGE it if you need a different size. -*/ -#define LUA_EXTRASPACE (sizeof(void *)) - - -/* -@@ LUA_IDSIZE gives the maximum size for the description of the source -@@ of a function in debug information. -** CHANGE it if you want a different size. -*/ -#define LUA_IDSIZE 60 - - -/* -@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. -** CHANGE it if it uses too much C-stack space. (For long double, -** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a -** smaller buffer would force a memory allocation for each call to -** 'string.format'.) -*/ -#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE -#define LUAL_BUFFERSIZE 8192 -#else -#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) -#endif - -/* }================================================================== */ - - -/* -@@ LUA_QL describes how error messages quote program elements. -** Lua does not use these macros anymore; they are here for -** compatibility only. -*/ -#define LUA_QL(x) "'" x "'" -#define LUA_QS LUA_QL("%s") - - - - -/* =================================================================== */ - -/* -** Local configuration. You can use this space to add your redefinitions -** without modifying the main part of the file. -*/ - - - - - -#endif - diff --git a/deps/rcheevos/test/lua/src/lualib.h b/deps/rcheevos/test/lua/src/lualib.h deleted file mode 100644 index 6c0bc4cb08..0000000000 --- a/deps/rcheevos/test/lua/src/lualib.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -** $Id: lualib.h,v 1.45 2017/01/12 17:14:26 roberto Exp $ -** Lua standard libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lualib_h -#define lualib_h - -#include "lua.h" - - -/* version suffix for environment variable names */ -#define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR - - -LUAMOD_API int (luaopen_base) (lua_State *L); - -#define LUA_COLIBNAME "coroutine" -LUAMOD_API int (luaopen_coroutine) (lua_State *L); - -#define LUA_TABLIBNAME "table" -LUAMOD_API int (luaopen_table) (lua_State *L); - -#define LUA_IOLIBNAME "io" -LUAMOD_API int (luaopen_io) (lua_State *L); - -#define LUA_OSLIBNAME "os" -LUAMOD_API int (luaopen_os) (lua_State *L); - -#define LUA_STRLIBNAME "string" -LUAMOD_API int (luaopen_string) (lua_State *L); - -#define LUA_UTF8LIBNAME "utf8" -LUAMOD_API int (luaopen_utf8) (lua_State *L); - -#define LUA_BITLIBNAME "bit32" -LUAMOD_API int (luaopen_bit32) (lua_State *L); - -#define LUA_MATHLIBNAME "math" -LUAMOD_API int (luaopen_math) (lua_State *L); - -#define LUA_DBLIBNAME "debug" -LUAMOD_API int (luaopen_debug) (lua_State *L); - -#define LUA_LOADLIBNAME "package" -LUAMOD_API int (luaopen_package) (lua_State *L); - - -/* open all previous libraries */ -LUALIB_API void (luaL_openlibs) (lua_State *L); - - - -#if !defined(lua_assert) -#define lua_assert(x) ((void)0) -#endif - - -#endif diff --git a/deps/rcheevos/test/lua/src/lundump.c b/deps/rcheevos/test/lua/src/lundump.c deleted file mode 100644 index 4080af9c0d..0000000000 --- a/deps/rcheevos/test/lua/src/lundump.c +++ /dev/null @@ -1,279 +0,0 @@ -/* -** $Id: lundump.c,v 2.44 2015/11/02 16:09:30 roberto Exp $ -** load precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#define lundump_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstring.h" -#include "lundump.h" -#include "lzio.h" - - -#if !defined(luai_verifycode) -#define luai_verifycode(L,b,f) /* empty */ -#endif - - -typedef struct { - lua_State *L; - ZIO *Z; - const char *name; -} LoadState; - - -static l_noret error(LoadState *S, const char *why) { - luaO_pushfstring(S->L, "%s: %s precompiled chunk", S->name, why); - luaD_throw(S->L, LUA_ERRSYNTAX); -} - - -/* -** All high-level loads go through LoadVector; you can change it to -** adapt to the endianness of the input -*/ -#define LoadVector(S,b,n) LoadBlock(S,b,(n)*sizeof((b)[0])) - -static void LoadBlock (LoadState *S, void *b, size_t size) { - if (luaZ_read(S->Z, b, size) != 0) - error(S, "truncated"); -} - - -#define LoadVar(S,x) LoadVector(S,&x,1) - - -static lu_byte LoadByte (LoadState *S) { - lu_byte x; - LoadVar(S, x); - return x; -} - - -static int LoadInt (LoadState *S) { - int x; - LoadVar(S, x); - return x; -} - - -static lua_Number LoadNumber (LoadState *S) { - lua_Number x; - LoadVar(S, x); - return x; -} - - -static lua_Integer LoadInteger (LoadState *S) { - lua_Integer x; - LoadVar(S, x); - return x; -} - - -static TString *LoadString (LoadState *S) { - size_t size = LoadByte(S); - if (size == 0xFF) - LoadVar(S, size); - if (size == 0) - return NULL; - else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ - char buff[LUAI_MAXSHORTLEN]; - LoadVector(S, buff, size); - return luaS_newlstr(S->L, buff, size); - } - else { /* long string */ - TString *ts = luaS_createlngstrobj(S->L, size); - LoadVector(S, getstr(ts), size); /* load directly in final place */ - return ts; - } -} - - -static void LoadCode (LoadState *S, Proto *f) { - int n = LoadInt(S); - f->code = luaM_newvector(S->L, n, Instruction); - f->sizecode = n; - LoadVector(S, f->code, n); -} - - -static void LoadFunction(LoadState *S, Proto *f, TString *psource); - - -static void LoadConstants (LoadState *S, Proto *f) { - int i; - int n = LoadInt(S); - f->k = luaM_newvector(S->L, n, TValue); - f->sizek = n; - for (i = 0; i < n; i++) - setnilvalue(&f->k[i]); - for (i = 0; i < n; i++) { - TValue *o = &f->k[i]; - int t = LoadByte(S); - switch (t) { - case LUA_TNIL: - setnilvalue(o); - break; - case LUA_TBOOLEAN: - setbvalue(o, LoadByte(S)); - break; - case LUA_TNUMFLT: - setfltvalue(o, LoadNumber(S)); - break; - case LUA_TNUMINT: - setivalue(o, LoadInteger(S)); - break; - case LUA_TSHRSTR: - case LUA_TLNGSTR: - setsvalue2n(S->L, o, LoadString(S)); - break; - default: - lua_assert(0); - } - } -} - - -static void LoadProtos (LoadState *S, Proto *f) { - int i; - int n = LoadInt(S); - f->p = luaM_newvector(S->L, n, Proto *); - f->sizep = n; - for (i = 0; i < n; i++) - f->p[i] = NULL; - for (i = 0; i < n; i++) { - f->p[i] = luaF_newproto(S->L); - LoadFunction(S, f->p[i], f->source); - } -} - - -static void LoadUpvalues (LoadState *S, Proto *f) { - int i, n; - n = LoadInt(S); - f->upvalues = luaM_newvector(S->L, n, Upvaldesc); - f->sizeupvalues = n; - for (i = 0; i < n; i++) - f->upvalues[i].name = NULL; - for (i = 0; i < n; i++) { - f->upvalues[i].instack = LoadByte(S); - f->upvalues[i].idx = LoadByte(S); - } -} - - -static void LoadDebug (LoadState *S, Proto *f) { - int i, n; - n = LoadInt(S); - f->lineinfo = luaM_newvector(S->L, n, int); - f->sizelineinfo = n; - LoadVector(S, f->lineinfo, n); - n = LoadInt(S); - f->locvars = luaM_newvector(S->L, n, LocVar); - f->sizelocvars = n; - for (i = 0; i < n; i++) - f->locvars[i].varname = NULL; - for (i = 0; i < n; i++) { - f->locvars[i].varname = LoadString(S); - f->locvars[i].startpc = LoadInt(S); - f->locvars[i].endpc = LoadInt(S); - } - n = LoadInt(S); - for (i = 0; i < n; i++) - f->upvalues[i].name = LoadString(S); -} - - -static void LoadFunction (LoadState *S, Proto *f, TString *psource) { - f->source = LoadString(S); - if (f->source == NULL) /* no source in dump? */ - f->source = psource; /* reuse parent's source */ - f->linedefined = LoadInt(S); - f->lastlinedefined = LoadInt(S); - f->numparams = LoadByte(S); - f->is_vararg = LoadByte(S); - f->maxstacksize = LoadByte(S); - LoadCode(S, f); - LoadConstants(S, f); - LoadUpvalues(S, f); - LoadProtos(S, f); - LoadDebug(S, f); -} - - -static void checkliteral (LoadState *S, const char *s, const char *msg) { - char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ - size_t len = strlen(s); - LoadVector(S, buff, len); - if (memcmp(s, buff, len) != 0) - error(S, msg); -} - - -static void fchecksize (LoadState *S, size_t size, const char *tname) { - if (LoadByte(S) != size) - error(S, luaO_pushfstring(S->L, "%s size mismatch in", tname)); -} - - -#define checksize(S,t) fchecksize(S,sizeof(t),#t) - -static void checkHeader (LoadState *S) { - checkliteral(S, LUA_SIGNATURE + 1, "not a"); /* 1st char already checked */ - if (LoadByte(S) != LUAC_VERSION) - error(S, "version mismatch in"); - if (LoadByte(S) != LUAC_FORMAT) - error(S, "format mismatch in"); - checkliteral(S, LUAC_DATA, "corrupted"); - checksize(S, int); - checksize(S, size_t); - checksize(S, Instruction); - checksize(S, lua_Integer); - checksize(S, lua_Number); - if (LoadInteger(S) != LUAC_INT) - error(S, "endianness mismatch in"); - if (LoadNumber(S) != LUAC_NUM) - error(S, "float format mismatch in"); -} - - -/* -** load precompiled chunk -*/ -LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) { - LoadState S; - LClosure *cl; - if (*name == '@' || *name == '=') - S.name = name + 1; - else if (*name == LUA_SIGNATURE[0]) - S.name = "binary string"; - else - S.name = name; - S.L = L; - S.Z = Z; - checkHeader(&S); - cl = luaF_newLclosure(L, LoadByte(&S)); - setclLvalue(L, L->top, cl); - luaD_inctop(L); - cl->p = luaF_newproto(L); - LoadFunction(&S, cl->p, NULL); - lua_assert(cl->nupvalues == cl->p->sizeupvalues); - luai_verifycode(L, buff, cl->p); - return cl; -} - diff --git a/deps/rcheevos/test/lua/src/lundump.h b/deps/rcheevos/test/lua/src/lundump.h deleted file mode 100644 index aa5cc82f1b..0000000000 --- a/deps/rcheevos/test/lua/src/lundump.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -** $Id: lundump.h,v 1.45 2015/09/08 15:41:05 roberto Exp $ -** load precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#ifndef lundump_h -#define lundump_h - -#include "llimits.h" -#include "lobject.h" -#include "lzio.h" - - -/* data to catch conversion errors */ -#define LUAC_DATA "\x19\x93\r\n\x1a\n" - -#define LUAC_INT 0x5678 -#define LUAC_NUM cast_num(370.5) - -#define MYINT(s) (s[0]-'0') -#define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) -#define LUAC_FORMAT 0 /* this is the official format */ - -/* load one chunk; from lundump.c */ -LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); - -/* dump one chunk; from ldump.c */ -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, - void* data, int strip); - -#endif diff --git a/deps/rcheevos/test/lua/src/lutf8lib.c b/deps/rcheevos/test/lua/src/lutf8lib.c deleted file mode 100644 index de9e3dcdd6..0000000000 --- a/deps/rcheevos/test/lua/src/lutf8lib.c +++ /dev/null @@ -1,256 +0,0 @@ -/* -** $Id: lutf8lib.c,v 1.16 2016/12/22 13:08:50 roberto Exp $ -** Standard library for UTF-8 manipulation -** See Copyright Notice in lua.h -*/ - -#define lutf8lib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - -#define MAXUNICODE 0x10FFFF - -#define iscont(p) ((*(p) & 0xC0) == 0x80) - - -/* from strlib */ -/* translate a relative string position: negative means back from end */ -static lua_Integer u_posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -/* -** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. -*/ -static const char *utf8_decode (const char *o, int *val) { - static const unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; - const unsigned char *s = (const unsigned char *)o; - unsigned int c = s[0]; - unsigned int res = 0; /* final result */ - if (c < 0x80) /* ascii? */ - res = c; - else { - int count = 0; /* to count number of continuation bytes */ - while (c & 0x40) { /* still have continuation bytes? */ - int cc = s[++count]; /* read next byte */ - if ((cc & 0xC0) != 0x80) /* not a continuation byte? */ - return NULL; /* invalid byte sequence */ - res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ - c <<= 1; /* to test next bit */ - } - res |= ((c & 0x7F) << (count * 5)); /* add first byte */ - if (count > 3 || res > MAXUNICODE || res <= limits[count]) - return NULL; /* invalid byte sequence */ - s += count; /* skip continuation bytes read */ - } - if (val) *val = res; - return (const char *)s + 1; /* +1 to include first byte */ -} - - -/* -** utf8len(s [, i [, j]]) --> number of characters that start in the -** range [i,j], or nil + current position if 's' is not well formed in -** that interval -*/ -static int utflen (lua_State *L) { - int n = 0; - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, - "initial position out of string"); - luaL_argcheck(L, --posj < (lua_Integer)len, 3, - "final position out of string"); - while (posi <= posj) { - const char *s1 = utf8_decode(s + posi, NULL); - if (s1 == NULL) { /* conversion error? */ - lua_pushnil(L); /* return nil ... */ - lua_pushinteger(L, posi + 1); /* ... and current position */ - return 2; - } - posi = s1 - s; - n++; - } - lua_pushinteger(L, n); - return 1; -} - - -/* -** codepoint(s, [i, [j]]) -> returns codepoints for all characters -** that start in the range [i,j] -*/ -static int codepoint (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); - int n; - const char *se; - luaL_argcheck(L, posi >= 1, 2, "out of range"); - luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of range"); - if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ - return luaL_error(L, "string slice too long"); - n = (int)(pose - posi) + 1; - luaL_checkstack(L, n, "string slice too long"); - n = 0; - se = s + pose; - for (s += posi - 1; s < se;) { - int code; - s = utf8_decode(s, &code); - if (s == NULL) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, code); - n++; - } - return n; -} - - -static void pushutfchar (lua_State *L, int arg) { - lua_Integer code = luaL_checkinteger(L, arg); - luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); - lua_pushfstring(L, "%U", (long)code); -} - - -/* -** utfchar(n1, n2, ...) -> char(n1)..char(n2)... -*/ -static int utfchar (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - if (n == 1) /* optimize common case of single char */ - pushutfchar(L, 1); - else { - int i; - luaL_Buffer b; - luaL_buffinit(L, &b); - for (i = 1; i <= n; i++) { - pushutfchar(L, i); - luaL_addvalue(&b); - } - luaL_pushresult(&b); - } - return 1; -} - - -/* -** offset(s, n, [i]) -> index where n-th character counting from -** position 'i' starts; 0 means character at 'i'. -*/ -static int byteoffset (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = luaL_checkinteger(L, 2); - lua_Integer posi = (n >= 0) ? 1 : len + 1; - posi = u_posrelat(luaL_optinteger(L, 3, posi), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, - "position out of range"); - if (n == 0) { - /* find beginning of current byte sequence */ - while (posi > 0 && iscont(s + posi)) posi--; - } - else { - if (iscont(s + posi)) - luaL_error(L, "initial position is a continuation byte"); - if (n < 0) { - while (n < 0 && posi > 0) { /* move back */ - do { /* find beginning of previous character */ - posi--; - } while (posi > 0 && iscont(s + posi)); - n++; - } - } - else { - n--; /* do not move for 1st character */ - while (n > 0 && posi < (lua_Integer)len) { - do { /* find beginning of next character */ - posi++; - } while (iscont(s + posi)); /* (cannot pass final '\0') */ - n--; - } - } - } - if (n == 0) /* did it find given character? */ - lua_pushinteger(L, posi + 1); - else /* no such character */ - lua_pushnil(L); - return 1; -} - - -static int iter_aux (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = lua_tointeger(L, 2) - 1; - if (n < 0) /* first iteration? */ - n = 0; /* start from here */ - else if (n < (lua_Integer)len) { - n++; /* skip current byte */ - while (iscont(s + n)) n++; /* and its continuations */ - } - if (n >= (lua_Integer)len) - return 0; /* no more codepoints */ - else { - int code; - const char *next = utf8_decode(s + n, &code); - if (next == NULL || iscont(next)) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, n + 1); - lua_pushinteger(L, code); - return 2; - } -} - - -static int iter_codes (lua_State *L) { - luaL_checkstring(L, 1); - lua_pushcfunction(L, iter_aux); - lua_pushvalue(L, 1); - lua_pushinteger(L, 0); - return 3; -} - - -/* pattern to match a single UTF-8 character */ -#define UTF8PATT "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" - - -static const luaL_Reg funcs[] = { - {"offset", byteoffset}, - {"codepoint", codepoint}, - {"char", utfchar}, - {"len", utflen}, - {"codes", iter_codes}, - /* placeholders */ - {"charpattern", NULL}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_utf8 (lua_State *L) { - luaL_newlib(L, funcs); - lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT)/sizeof(char) - 1); - lua_setfield(L, -2, "charpattern"); - return 1; -} - diff --git a/deps/rcheevos/test/lua/src/lvm.c b/deps/rcheevos/test/lua/src/lvm.c deleted file mode 100644 index 84ade6b2fa..0000000000 --- a/deps/rcheevos/test/lua/src/lvm.c +++ /dev/null @@ -1,1322 +0,0 @@ -/* -** $Id: lvm.c,v 2.268 2016/02/05 19:59:14 roberto Exp $ -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#define lvm_c -#define LUA_CORE - -#include "lprefix.h" - -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - -/* limit for table tag-method chains (to avoid loops) */ -#define MAXTAGLOOP 2000 - - - -/* -** 'l_intfitsf' checks whether a given integer can be converted to a -** float without rounding. Used in comparisons. Left undefined if -** all integers fit in a float precisely. -*/ -#if !defined(l_intfitsf) - -/* number of bits in the mantissa of a float */ -#define NBM (l_mathlim(MANT_DIG)) - -/* -** Check whether some integers may not fit in a float, that is, whether -** (maxinteger >> NBM) > 0 (that implies (1 << NBM) <= maxinteger). -** (The shifts are done in parts to avoid shifting by more than the size -** of an integer. In a worst case, NBM == 113 for long double and -** sizeof(integer) == 32.) -*/ -#if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \ - >> (NBM - (3 * (NBM / 4)))) > 0 - -#define l_intfitsf(i) \ - (-((lua_Integer)1 << NBM) <= (i) && (i) <= ((lua_Integer)1 << NBM)) - -#endif - -#endif - - - -/* -** Try to convert a value to a float. The float case is already handled -** by the macro 'tonumber'. -*/ -int luaV_tonumber_ (const TValue *obj, lua_Number *n) { - TValue v; - if (ttisinteger(obj)) { - *n = cast_num(ivalue(obj)); - return 1; - } - else if (cvt2num(obj) && /* string convertible to number? */ - luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { - *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */ - return 1; - } - else - return 0; /* conversion failed */ -} - - -/* -** try to convert a value to an integer, rounding according to 'mode': -** mode == 0: accepts only integral values -** mode == 1: takes the floor of the number -** mode == 2: takes the ceil of the number -*/ -int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode) { - TValue v; - again: - if (ttisfloat(obj)) { - lua_Number n = fltvalue(obj); - lua_Number f = l_floor(n); - if (n != f) { /* not an integral value? */ - if (mode == 0) return 0; /* fails if mode demands integral value */ - else if (mode > 1) /* needs ceil? */ - f += 1; /* convert floor to ceil (remember: n != f) */ - } - return lua_numbertointeger(f, p); - } - else if (ttisinteger(obj)) { - *p = ivalue(obj); - return 1; - } - else if (cvt2num(obj) && - luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { - obj = &v; - goto again; /* convert result from 'luaO_str2num' to an integer */ - } - return 0; /* conversion failed */ -} - - -/* -** Try to convert a 'for' limit to an integer, preserving the -** semantics of the loop. -** (The following explanation assumes a non-negative step; it is valid -** for negative steps mutatis mutandis.) -** If the limit can be converted to an integer, rounding down, that is -** it. -** Otherwise, check whether the limit can be converted to a number. If -** the number is too large, it is OK to set the limit as LUA_MAXINTEGER, -** which means no limit. If the number is too negative, the loop -** should not run, because any initial integer value is larger than the -** limit. So, it sets the limit to LUA_MININTEGER. 'stopnow' corrects -** the extreme case when the initial value is LUA_MININTEGER, in which -** case the LUA_MININTEGER limit would still run the loop once. -*/ -static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step, - int *stopnow) { - *stopnow = 0; /* usually, let loops run */ - if (!luaV_tointeger(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */ - lua_Number n; /* try to convert to float */ - if (!tonumber(obj, &n)) /* cannot convert to float? */ - return 0; /* not a number */ - if (luai_numlt(0, n)) { /* if true, float is larger than max integer */ - *p = LUA_MAXINTEGER; - if (step < 0) *stopnow = 1; - } - else { /* float is smaller than min integer */ - *p = LUA_MININTEGER; - if (step >= 0) *stopnow = 1; - } - } - return 1; -} - - -/* -** Finish the table access 'val = t[key]'. -** if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to -** t[k] entry (which must be nil). -*/ -void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val, - const TValue *slot) { - int loop; /* counter to avoid infinite loops */ - const TValue *tm; /* metamethod */ - for (loop = 0; loop < MAXTAGLOOP; loop++) { - if (slot == NULL) { /* 't' is not a table? */ - lua_assert(!ttistable(t)); - tm = luaT_gettmbyobj(L, t, TM_INDEX); - if (ttisnil(tm)) - luaG_typeerror(L, t, "index"); /* no metamethod */ - /* else will try the metamethod */ - } - else { /* 't' is a table */ - lua_assert(ttisnil(slot)); - tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); /* table's metamethod */ - if (tm == NULL) { /* no metamethod? */ - setnilvalue(val); /* result is nil */ - return; - } - /* else will try the metamethod */ - } - if (ttisfunction(tm)) { /* is metamethod a function? */ - luaT_callTM(L, tm, t, key, val, 1); /* call it */ - return; - } - t = tm; /* else try to access 'tm[key]' */ - if (luaV_fastget(L,t,key,slot,luaH_get)) { /* fast track? */ - setobj2s(L, val, slot); /* done */ - return; - } - /* else repeat (tail call 'luaV_finishget') */ - } - luaG_runerror(L, "'__index' chain too long; possible loop"); -} - - -/* -** Finish a table assignment 't[key] = val'. -** If 'slot' is NULL, 't' is not a table. Otherwise, 'slot' points -** to the entry 't[key]', or to 'luaO_nilobject' if there is no such -** entry. (The value at 'slot' must be nil, otherwise 'luaV_fastset' -** would have done the job.) -*/ -void luaV_finishset (lua_State *L, const TValue *t, TValue *key, - StkId val, const TValue *slot) { - int loop; /* counter to avoid infinite loops */ - for (loop = 0; loop < MAXTAGLOOP; loop++) { - const TValue *tm; /* '__newindex' metamethod */ - if (slot != NULL) { /* is 't' a table? */ - Table *h = hvalue(t); /* save 't' table */ - lua_assert(ttisnil(slot)); /* old value must be nil */ - tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */ - if (tm == NULL) { /* no metamethod? */ - if (slot == luaO_nilobject) /* no previous entry? */ - slot = luaH_newkey(L, h, key); /* create one */ - /* no metamethod and (now) there is an entry with given key */ - setobj2t(L, cast(TValue *, slot), val); /* set its new value */ - invalidateTMcache(h); - luaC_barrierback(L, h, val); - return; - } - /* else will try the metamethod */ - } - else { /* not a table; check metamethod */ - if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) - luaG_typeerror(L, t, "index"); - } - /* try the metamethod */ - if (ttisfunction(tm)) { - luaT_callTM(L, tm, t, key, val, 0); - return; - } - t = tm; /* else repeat assignment over 'tm' */ - if (luaV_fastset(L, t, key, slot, luaH_get, val)) - return; /* done */ - /* else loop */ - } - luaG_runerror(L, "'__newindex' chain too long; possible loop"); -} - - -/* -** Compare two strings 'ls' x 'rs', returning an integer smaller-equal- -** -larger than zero if 'ls' is smaller-equal-larger than 'rs'. -** The code is a little tricky because it allows '\0' in the strings -** and it uses 'strcoll' (to respect locales) for each segments -** of the strings. -*/ -static int l_strcmp (const TString *ls, const TString *rs) { - const char *l = getstr(ls); - size_t ll = tsslen(ls); - const char *r = getstr(rs); - size_t lr = tsslen(rs); - for (;;) { /* for each segment */ - int temp = strcoll(l, r); - if (temp != 0) /* not equal? */ - return temp; /* done */ - else { /* strings are equal up to a '\0' */ - size_t len = strlen(l); /* index of first '\0' in both strings */ - if (len == lr) /* 'rs' is finished? */ - return (len == ll) ? 0 : 1; /* check 'ls' */ - else if (len == ll) /* 'ls' is finished? */ - return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */ - /* both strings longer than 'len'; go on comparing after the '\0' */ - len++; - l += len; ll -= len; r += len; lr -= len; - } - } -} - - -/* -** Check whether integer 'i' is less than float 'f'. If 'i' has an -** exact representation as a float ('l_intfitsf'), compare numbers as -** floats. Otherwise, if 'f' is outside the range for integers, result -** is trivial. Otherwise, compare them as integers. (When 'i' has no -** float representation, either 'f' is "far away" from 'i' or 'f' has -** no precision left for a fractional part; either way, how 'f' is -** truncated is irrelevant.) When 'f' is NaN, comparisons must result -** in false. -*/ -static int LTintfloat (lua_Integer i, lua_Number f) { -#if defined(l_intfitsf) - if (!l_intfitsf(i)) { - if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ - return 1; /* f >= maxint + 1 > i */ - else if (f > cast_num(LUA_MININTEGER)) /* minint < f <= maxint ? */ - return (i < cast(lua_Integer, f)); /* compare them as integers */ - else /* f <= minint <= i (or 'f' is NaN) --> not(i < f) */ - return 0; - } -#endif - return luai_numlt(cast_num(i), f); /* compare them as floats */ -} - - -/* -** Check whether integer 'i' is less than or equal to float 'f'. -** See comments on previous function. -*/ -static int LEintfloat (lua_Integer i, lua_Number f) { -#if defined(l_intfitsf) - if (!l_intfitsf(i)) { - if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ - return 1; /* f >= maxint + 1 > i */ - else if (f >= cast_num(LUA_MININTEGER)) /* minint <= f <= maxint ? */ - return (i <= cast(lua_Integer, f)); /* compare them as integers */ - else /* f < minint <= i (or 'f' is NaN) --> not(i <= f) */ - return 0; - } -#endif - return luai_numle(cast_num(i), f); /* compare them as floats */ -} - - -/* -** Return 'l < r', for numbers. -*/ -static int LTnum (const TValue *l, const TValue *r) { - if (ttisinteger(l)) { - lua_Integer li = ivalue(l); - if (ttisinteger(r)) - return li < ivalue(r); /* both are integers */ - else /* 'l' is int and 'r' is float */ - return LTintfloat(li, fltvalue(r)); /* l < r ? */ - } - else { - lua_Number lf = fltvalue(l); /* 'l' must be float */ - if (ttisfloat(r)) - return luai_numlt(lf, fltvalue(r)); /* both are float */ - else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ - return 0; /* NaN < i is always false */ - else /* without NaN, (l < r) <--> not(r <= l) */ - return !LEintfloat(ivalue(r), lf); /* not (r <= l) ? */ - } -} - - -/* -** Return 'l <= r', for numbers. -*/ -static int LEnum (const TValue *l, const TValue *r) { - if (ttisinteger(l)) { - lua_Integer li = ivalue(l); - if (ttisinteger(r)) - return li <= ivalue(r); /* both are integers */ - else /* 'l' is int and 'r' is float */ - return LEintfloat(li, fltvalue(r)); /* l <= r ? */ - } - else { - lua_Number lf = fltvalue(l); /* 'l' must be float */ - if (ttisfloat(r)) - return luai_numle(lf, fltvalue(r)); /* both are float */ - else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ - return 0; /* NaN <= i is always false */ - else /* without NaN, (l <= r) <--> not(r < l) */ - return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */ - } -} - - -/* -** Main operation less than; return 'l < r'. -*/ -int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { - int res; - if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */ - return LTnum(l, r); - else if (ttisstring(l) && ttisstring(r)) /* both are strings? */ - return l_strcmp(tsvalue(l), tsvalue(r)) < 0; - else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) /* no metamethod? */ - luaG_ordererror(L, l, r); /* error */ - return res; -} - - -/* -** Main operation less than or equal to; return 'l <= r'. If it needs -** a metamethod and there is no '__le', try '__lt', based on -** l <= r iff !(r < l) (assuming a total order). If the metamethod -** yields during this substitution, the continuation has to know -** about it (to negate the result of r= 0) /* try 'le' */ - return res; - else { /* try 'lt': */ - L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ - res = luaT_callorderTM(L, r, l, TM_LT); - L->ci->callstatus ^= CIST_LEQ; /* clear mark */ - if (res < 0) - luaG_ordererror(L, l, r); - return !res; /* result is negated */ - } -} - - -/* -** Main operation for equality of Lua values; return 't1 == t2'. -** L == NULL means raw equality (no metamethods) -*/ -int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { - const TValue *tm; - if (ttype(t1) != ttype(t2)) { /* not the same variant? */ - if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER) - return 0; /* only numbers can be equal with different variants */ - else { /* two numbers with different variants */ - lua_Integer i1, i2; /* compare them as integers */ - return (tointeger(t1, &i1) && tointeger(t2, &i2) && i1 == i2); - } - } - /* values have same type and same variant */ - switch (ttype(t1)) { - case LUA_TNIL: return 1; - case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); - case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); - case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ - case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); - case LUA_TLCF: return fvalue(t1) == fvalue(t2); - case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); - case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2)); - case LUA_TUSERDATA: { - if (uvalue(t1) == uvalue(t2)) return 1; - else if (L == NULL) return 0; - tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); - if (tm == NULL) - tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); - break; /* will try TM */ - } - case LUA_TTABLE: { - if (hvalue(t1) == hvalue(t2)) return 1; - else if (L == NULL) return 0; - tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); - if (tm == NULL) - tm = fasttm(L, hvalue(t2)->metatable, TM_EQ); - break; /* will try TM */ - } - default: - return gcvalue(t1) == gcvalue(t2); - } - if (tm == NULL) /* no TM? */ - return 0; /* objects are different */ - luaT_callTM(L, tm, t1, t2, L->top, 1); /* call TM */ - return !l_isfalse(L->top); -} - - -/* macro used by 'luaV_concat' to ensure that element at 'o' is a string */ -#define tostring(L,o) \ - (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) - -#define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) - -/* copy strings in stack from top - n up to top - 1 to buffer */ -static void copy2buff (StkId top, int n, char *buff) { - size_t tl = 0; /* size already copied */ - do { - size_t l = vslen(top - n); /* length of string being copied */ - memcpy(buff + tl, svalue(top - n), l * sizeof(char)); - tl += l; - } while (--n > 0); -} - - -/* -** Main operation for concatenation: concat 'total' values in the stack, -** from 'L->top - total' up to 'L->top - 1'. -*/ -void luaV_concat (lua_State *L, int total) { - lua_assert(total >= 2); - do { - StkId top = L->top; - int n = 2; /* number of elements handled in this pass (at least 2) */ - if (!(ttisstring(top-2) || cvt2str(top-2)) || !tostring(L, top-1)) - luaT_trybinTM(L, top-2, top-1, top-2, TM_CONCAT); - else if (isemptystr(top - 1)) /* second operand is empty? */ - cast_void(tostring(L, top - 2)); /* result is first operand */ - else if (isemptystr(top - 2)) { /* first operand is an empty string? */ - setobjs2s(L, top - 2, top - 1); /* result is second op. */ - } - else { - /* at least two non-empty string values; get as many as possible */ - size_t tl = vslen(top - 1); - TString *ts; - /* collect total length and number of strings */ - for (n = 1; n < total && tostring(L, top - n - 1); n++) { - size_t l = vslen(top - n - 1); - if (l >= (MAX_SIZE/sizeof(char)) - tl) - luaG_runerror(L, "string length overflow"); - tl += l; - } - if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */ - char buff[LUAI_MAXSHORTLEN]; - copy2buff(top, n, buff); /* copy strings to buffer */ - ts = luaS_newlstr(L, buff, tl); - } - else { /* long string; copy strings directly to final result */ - ts = luaS_createlngstrobj(L, tl); - copy2buff(top, n, getstr(ts)); - } - setsvalue2s(L, top - n, ts); /* create result */ - } - total -= n-1; /* got 'n' strings to create 1 new */ - L->top -= n-1; /* popped 'n' strings and pushed one */ - } while (total > 1); /* repeat until only 1 result left */ -} - - -/* -** Main operation 'ra' = #rb'. -*/ -void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { - const TValue *tm; - switch (ttype(rb)) { - case LUA_TTABLE: { - Table *h = hvalue(rb); - tm = fasttm(L, h->metatable, TM_LEN); - if (tm) break; /* metamethod? break switch to call it */ - setivalue(ra, luaH_getn(h)); /* else primitive len */ - return; - } - case LUA_TSHRSTR: { - setivalue(ra, tsvalue(rb)->shrlen); - return; - } - case LUA_TLNGSTR: { - setivalue(ra, tsvalue(rb)->u.lnglen); - return; - } - default: { /* try metamethod */ - tm = luaT_gettmbyobj(L, rb, TM_LEN); - if (ttisnil(tm)) /* no metamethod? */ - luaG_typeerror(L, rb, "get length of"); - break; - } - } - luaT_callTM(L, tm, rb, rb, ra, 1); -} - - -/* -** Integer division; return 'm // n', that is, floor(m/n). -** C division truncates its result (rounds towards zero). -** 'floor(q) == trunc(q)' when 'q >= 0' or when 'q' is integer, -** otherwise 'floor(q) == trunc(q) - 1'. -*/ -lua_Integer luaV_div (lua_State *L, lua_Integer m, lua_Integer n) { - if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ - if (n == 0) - luaG_runerror(L, "attempt to divide by zero"); - return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */ - } - else { - lua_Integer q = m / n; /* perform C division */ - if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */ - q -= 1; /* correct result for different rounding */ - return q; - } -} - - -/* -** Integer modulus; return 'm % n'. (Assume that C '%' with -** negative operands follows C99 behavior. See previous comment -** about luaV_div.) -*/ -lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) { - if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ - if (n == 0) - luaG_runerror(L, "attempt to perform 'n%%0'"); - return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */ - } - else { - lua_Integer r = m % n; - if (r != 0 && (m ^ n) < 0) /* 'm/n' would be non-integer negative? */ - r += n; /* correct result for different rounding */ - return r; - } -} - - -/* number of bits in an integer */ -#define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT) - -/* -** Shift left operation. (Shift right just negates 'y'.) -*/ -lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { - if (y < 0) { /* shift right? */ - if (y <= -NBITS) return 0; - else return intop(>>, x, -y); - } - else { /* shift left */ - if (y >= NBITS) return 0; - else return intop(<<, x, y); - } -} - - -/* -** check whether cached closure in prototype 'p' may be reused, that is, -** whether there is a cached closure with the same upvalues needed by -** new closure to be created. -*/ -static LClosure *getcached (Proto *p, UpVal **encup, StkId base) { - LClosure *c = p->cache; - if (c != NULL) { /* is there a cached closure? */ - int nup = p->sizeupvalues; - Upvaldesc *uv = p->upvalues; - int i; - for (i = 0; i < nup; i++) { /* check whether it has right upvalues */ - TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v; - if (c->upvals[i]->v != v) - return NULL; /* wrong upvalue; cannot reuse closure */ - } - } - return c; /* return cached closure (or NULL if no cached closure) */ -} - - -/* -** create a new Lua closure, push it in the stack, and initialize -** its upvalues. Note that the closure is not cached if prototype is -** already black (which means that 'cache' was already cleared by the -** GC). -*/ -static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, - StkId ra) { - int nup = p->sizeupvalues; - Upvaldesc *uv = p->upvalues; - int i; - LClosure *ncl = luaF_newLclosure(L, nup); - ncl->p = p; - setclLvalue(L, ra, ncl); /* anchor new closure in stack */ - for (i = 0; i < nup; i++) { /* fill in its upvalues */ - if (uv[i].instack) /* upvalue refers to local variable? */ - ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); - else /* get upvalue from enclosing function */ - ncl->upvals[i] = encup[uv[i].idx]; - ncl->upvals[i]->refcount++; - /* new closure is white, so we do not need a barrier here */ - } - if (!isblack(p)) /* cache will not break GC invariant? */ - p->cache = ncl; /* save it on cache for reuse */ -} - - -/* -** finish execution of an opcode interrupted by an yield -*/ -void luaV_finishOp (lua_State *L) { - CallInfo *ci = L->ci; - StkId base = ci->u.l.base; - Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ - OpCode op = GET_OPCODE(inst); - switch (op) { /* finish its execution */ - case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV: - case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: - case OP_MOD: case OP_POW: - case OP_UNM: case OP_BNOT: case OP_LEN: - case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { - setobjs2s(L, base + GETARG_A(inst), --L->top); - break; - } - case OP_LE: case OP_LT: case OP_EQ: { - int res = !l_isfalse(L->top - 1); - L->top--; - if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ - lua_assert(op == OP_LE); - ci->callstatus ^= CIST_LEQ; /* clear mark */ - res = !res; /* negate result */ - } - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); - if (res != GETARG_A(inst)) /* condition failed? */ - ci->u.l.savedpc++; /* skip jump instruction */ - break; - } - case OP_CONCAT: { - StkId top = L->top - 1; /* top when 'luaT_trybinTM' was called */ - int b = GETARG_B(inst); /* first element to concatenate */ - int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */ - setobj2s(L, top - 2, top); /* put TM result in proper position */ - if (total > 1) { /* are there elements to concat? */ - L->top = top - 1; /* top is one after last element (at top-2) */ - luaV_concat(L, total); /* concat them (may yield again) */ - } - /* move final result to final position */ - setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1); - L->top = ci->top; /* restore top */ - break; - } - case OP_TFORCALL: { - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP); - L->top = ci->top; /* correct top */ - break; - } - case OP_CALL: { - if (GETARG_C(inst) - 1 >= 0) /* nresults >= 0? */ - L->top = ci->top; /* adjust results */ - break; - } - case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE: - break; - default: lua_assert(0); - } -} - - - - -/* -** {================================================================== -** Function 'luaV_execute': main interpreter loop -** =================================================================== -*/ - - -/* -** some macros for common tasks in 'luaV_execute' -*/ - - -#define RA(i) (base+GETARG_A(i)) -#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) -#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) -#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) -#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) - - -/* execute a jump instruction */ -#define dojump(ci,i,e) \ - { int a = GETARG_A(i); \ - if (a != 0) luaF_close(L, ci->u.l.base + a - 1); \ - ci->u.l.savedpc += GETARG_sBx(i) + e; } - -/* for test instructions, execute the jump instruction that follows it */ -#define donextjump(ci) { i = *ci->u.l.savedpc; dojump(ci, i, 1); } - - -#define Protect(x) { {x;}; base = ci->u.l.base; } - -#define checkGC(L,c) \ - { luaC_condGC(L, L->top = (c), /* limit of live values */ \ - Protect(L->top = ci->top)); /* restore top */ \ - luai_threadyield(L); } - - -/* fetch an instruction and prepare its execution */ -#define vmfetch() { \ - i = *(ci->u.l.savedpc++); \ - if (L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) \ - Protect(luaG_traceexec(L)); \ - ra = RA(i); /* WARNING: any stack reallocation invalidates 'ra' */ \ - lua_assert(base == ci->u.l.base); \ - lua_assert(base <= L->top && L->top < L->stack + L->stacksize); \ -} - -#define vmdispatch(o) switch(o) -#define vmcase(l) case l: -#define vmbreak break - - -/* -** copy of 'luaV_gettable', but protecting the call to potential -** metamethod (which can reallocate the stack) -*/ -#define gettableProtected(L,t,k,v) { const TValue *slot; \ - if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ - else Protect(luaV_finishget(L,t,k,v,slot)); } - - -/* same for 'luaV_settable' */ -#define settableProtected(L,t,k,v) { const TValue *slot; \ - if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ - Protect(luaV_finishset(L,t,k,v,slot)); } - - - -void luaV_execute (lua_State *L) { - CallInfo *ci = L->ci; - LClosure *cl; - TValue *k; - StkId base; - ci->callstatus |= CIST_FRESH; /* fresh invocation of 'luaV_execute" */ - newframe: /* reentry point when frame changes (call/return) */ - lua_assert(ci == L->ci); - cl = clLvalue(ci->func); /* local reference to function's closure */ - k = cl->p->k; /* local reference to function's constant table */ - base = ci->u.l.base; /* local copy of function's base */ - /* main loop of interpreter */ - for (;;) { - Instruction i; - StkId ra; - vmfetch(); - vmdispatch (GET_OPCODE(i)) { - vmcase(OP_MOVE) { - setobjs2s(L, ra, RB(i)); - vmbreak; - } - vmcase(OP_LOADK) { - TValue *rb = k + GETARG_Bx(i); - setobj2s(L, ra, rb); - vmbreak; - } - vmcase(OP_LOADKX) { - TValue *rb; - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); - rb = k + GETARG_Ax(*ci->u.l.savedpc++); - setobj2s(L, ra, rb); - vmbreak; - } - vmcase(OP_LOADBOOL) { - setbvalue(ra, GETARG_B(i)); - if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */ - vmbreak; - } - vmcase(OP_LOADNIL) { - int b = GETARG_B(i); - do { - setnilvalue(ra++); - } while (b--); - vmbreak; - } - vmcase(OP_GETUPVAL) { - int b = GETARG_B(i); - setobj2s(L, ra, cl->upvals[b]->v); - vmbreak; - } - vmcase(OP_GETTABUP) { - TValue *upval = cl->upvals[GETARG_B(i)]->v; - TValue *rc = RKC(i); - gettableProtected(L, upval, rc, ra); - vmbreak; - } - vmcase(OP_GETTABLE) { - StkId rb = RB(i); - TValue *rc = RKC(i); - gettableProtected(L, rb, rc, ra); - vmbreak; - } - vmcase(OP_SETTABUP) { - TValue *upval = cl->upvals[GETARG_A(i)]->v; - TValue *rb = RKB(i); - TValue *rc = RKC(i); - settableProtected(L, upval, rb, rc); - vmbreak; - } - vmcase(OP_SETUPVAL) { - UpVal *uv = cl->upvals[GETARG_B(i)]; - setobj(L, uv->v, ra); - luaC_upvalbarrier(L, uv); - vmbreak; - } - vmcase(OP_SETTABLE) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - settableProtected(L, ra, rb, rc); - vmbreak; - } - vmcase(OP_NEWTABLE) { - int b = GETARG_B(i); - int c = GETARG_C(i); - Table *t = luaH_new(L); - sethvalue(L, ra, t); - if (b != 0 || c != 0) - luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); - checkGC(L, ra + 1); - vmbreak; - } - vmcase(OP_SELF) { - const TValue *aux; - StkId rb = RB(i); - TValue *rc = RKC(i); - TString *key = tsvalue(rc); /* key must be a string */ - setobjs2s(L, ra + 1, rb); - if (luaV_fastget(L, rb, key, aux, luaH_getstr)) { - setobj2s(L, ra, aux); - } - else Protect(luaV_finishget(L, rb, rc, ra, aux)); - vmbreak; - } - vmcase(OP_ADD) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(+, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numadd(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } - vmbreak; - } - vmcase(OP_SUB) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(-, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numsub(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } - vmbreak; - } - vmcase(OP_MUL) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(*, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_nummul(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } - vmbreak; - } - vmcase(OP_DIV) { /* float division (always with floats) */ - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numdiv(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } - vmbreak; - } - vmcase(OP_BAND) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(&, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BAND)); } - vmbreak; - } - vmcase(OP_BOR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(|, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BOR)); } - vmbreak; - } - vmcase(OP_BXOR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(^, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BXOR)); } - vmbreak; - } - vmcase(OP_SHL) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_shiftl(ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHL)); } - vmbreak; - } - vmcase(OP_SHR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_shiftl(ib, -ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHR)); } - vmbreak; - } - vmcase(OP_MOD) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, luaV_mod(L, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - lua_Number m; - luai_nummod(L, nb, nc, m); - setfltvalue(ra, m); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } - vmbreak; - } - vmcase(OP_IDIV) { /* floor division */ - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, luaV_div(L, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numidiv(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); } - vmbreak; - } - vmcase(OP_POW) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numpow(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } - vmbreak; - } - vmcase(OP_UNM) { - TValue *rb = RB(i); - lua_Number nb; - if (ttisinteger(rb)) { - lua_Integer ib = ivalue(rb); - setivalue(ra, intop(-, 0, ib)); - } - else if (tonumber(rb, &nb)) { - setfltvalue(ra, luai_numunm(L, nb)); - } - else { - Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); - } - vmbreak; - } - vmcase(OP_BNOT) { - TValue *rb = RB(i); - lua_Integer ib; - if (tointeger(rb, &ib)) { - setivalue(ra, intop(^, ~l_castS2U(0), ib)); - } - else { - Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); - } - vmbreak; - } - vmcase(OP_NOT) { - TValue *rb = RB(i); - int res = l_isfalse(rb); /* next assignment may change this value */ - setbvalue(ra, res); - vmbreak; - } - vmcase(OP_LEN) { - Protect(luaV_objlen(L, ra, RB(i))); - vmbreak; - } - vmcase(OP_CONCAT) { - int b = GETARG_B(i); - int c = GETARG_C(i); - StkId rb; - L->top = base + c + 1; /* mark the end of concat operands */ - Protect(luaV_concat(L, c - b + 1)); - ra = RA(i); /* 'luaV_concat' may invoke TMs and move the stack */ - rb = base + b; - setobjs2s(L, ra, rb); - checkGC(L, (ra >= rb ? ra + 1 : rb)); - L->top = ci->top; /* restore top */ - vmbreak; - } - vmcase(OP_JMP) { - dojump(ci, i, 0); - vmbreak; - } - vmcase(OP_EQ) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - Protect( - if (luaV_equalobj(L, rb, rc) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_LT) { - Protect( - if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_LE) { - Protect( - if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_TEST) { - if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra)) - ci->u.l.savedpc++; - else - donextjump(ci); - vmbreak; - } - vmcase(OP_TESTSET) { - TValue *rb = RB(i); - if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb)) - ci->u.l.savedpc++; - else { - setobjs2s(L, ra, rb); - donextjump(ci); - } - vmbreak; - } - vmcase(OP_CALL) { - int b = GETARG_B(i); - int nresults = GETARG_C(i) - 1; - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - if (luaD_precall(L, ra, nresults)) { /* C function? */ - if (nresults >= 0) - L->top = ci->top; /* adjust results */ - Protect((void)0); /* update 'base' */ - } - else { /* Lua function */ - ci = L->ci; - goto newframe; /* restart luaV_execute over new Lua function */ - } - vmbreak; - } - vmcase(OP_TAILCALL) { - int b = GETARG_B(i); - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); - if (luaD_precall(L, ra, LUA_MULTRET)) { /* C function? */ - Protect((void)0); /* update 'base' */ - } - else { - /* tail call: put called frame (n) in place of caller one (o) */ - CallInfo *nci = L->ci; /* called frame */ - CallInfo *oci = nci->previous; /* caller frame */ - StkId nfunc = nci->func; /* called function */ - StkId ofunc = oci->func; /* caller function */ - /* last stack slot filled by 'precall' */ - StkId lim = nci->u.l.base + getproto(nfunc)->numparams; - int aux; - /* close all upvalues from previous call */ - if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base); - /* move new frame into old one */ - for (aux = 0; nfunc + aux < lim; aux++) - setobjs2s(L, ofunc + aux, nfunc + aux); - oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ - oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ - oci->u.l.savedpc = nci->u.l.savedpc; - oci->callstatus |= CIST_TAIL; /* function was tail called */ - ci = L->ci = oci; /* remove new frame */ - lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); - goto newframe; /* restart luaV_execute over new Lua function */ - } - vmbreak; - } - vmcase(OP_RETURN) { - int b = GETARG_B(i); - if (cl->p->sizep > 0) luaF_close(L, base); - b = luaD_poscall(L, ci, ra, (b != 0 ? b - 1 : cast_int(L->top - ra))); - if (ci->callstatus & CIST_FRESH) /* local 'ci' still from callee */ - return; /* external invocation: return */ - else { /* invocation via reentry: continue execution */ - ci = L->ci; - if (b) L->top = ci->top; - lua_assert(isLua(ci)); - lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL); - goto newframe; /* restart luaV_execute over new Lua function */ - } - } - vmcase(OP_FORLOOP) { - if (ttisinteger(ra)) { /* integer loop? */ - lua_Integer step = ivalue(ra + 2); - lua_Integer idx = intop(+, ivalue(ra), step); /* increment index */ - lua_Integer limit = ivalue(ra + 1); - if ((0 < step) ? (idx <= limit) : (limit <= idx)) { - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - chgivalue(ra, idx); /* update internal index... */ - setivalue(ra + 3, idx); /* ...and external index */ - } - } - else { /* floating loop */ - lua_Number step = fltvalue(ra + 2); - lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ - lua_Number limit = fltvalue(ra + 1); - if (luai_numlt(0, step) ? luai_numle(idx, limit) - : luai_numle(limit, idx)) { - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - chgfltvalue(ra, idx); /* update internal index... */ - setfltvalue(ra + 3, idx); /* ...and external index */ - } - } - vmbreak; - } - vmcase(OP_FORPREP) { - TValue *init = ra; - TValue *plimit = ra + 1; - TValue *pstep = ra + 2; - lua_Integer ilimit; - int stopnow; - if (ttisinteger(init) && ttisinteger(pstep) && - forlimit(plimit, &ilimit, ivalue(pstep), &stopnow)) { - /* all values are integer */ - lua_Integer initv = (stopnow ? 0 : ivalue(init)); - setivalue(plimit, ilimit); - setivalue(init, intop(-, initv, ivalue(pstep))); - } - else { /* try making all values floats */ - lua_Number ninit; lua_Number nlimit; lua_Number nstep; - if (!tonumber(plimit, &nlimit)) - luaG_runerror(L, "'for' limit must be a number"); - setfltvalue(plimit, nlimit); - if (!tonumber(pstep, &nstep)) - luaG_runerror(L, "'for' step must be a number"); - setfltvalue(pstep, nstep); - if (!tonumber(init, &ninit)) - luaG_runerror(L, "'for' initial value must be a number"); - setfltvalue(init, luai_numsub(L, ninit, nstep)); - } - ci->u.l.savedpc += GETARG_sBx(i); - vmbreak; - } - vmcase(OP_TFORCALL) { - StkId cb = ra + 3; /* call base */ - setobjs2s(L, cb+2, ra+2); - setobjs2s(L, cb+1, ra+1); - setobjs2s(L, cb, ra); - L->top = cb + 3; /* func. + 2 args (state and index) */ - Protect(luaD_call(L, cb, GETARG_C(i))); - L->top = ci->top; - i = *(ci->u.l.savedpc++); /* go to next instruction */ - ra = RA(i); - lua_assert(GET_OPCODE(i) == OP_TFORLOOP); - goto l_tforloop; - } - vmcase(OP_TFORLOOP) { - l_tforloop: - if (!ttisnil(ra + 1)) { /* continue loop? */ - setobjs2s(L, ra, ra + 1); /* save control variable */ - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - } - vmbreak; - } - vmcase(OP_SETLIST) { - int n = GETARG_B(i); - int c = GETARG_C(i); - unsigned int last; - Table *h; - if (n == 0) n = cast_int(L->top - ra) - 1; - if (c == 0) { - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); - c = GETARG_Ax(*ci->u.l.savedpc++); - } - h = hvalue(ra); - last = ((c-1)*LFIELDS_PER_FLUSH) + n; - if (last > h->sizearray) /* needs more space? */ - luaH_resizearray(L, h, last); /* preallocate it at once */ - for (; n > 0; n--) { - TValue *val = ra+n; - luaH_setint(L, h, last--, val); - luaC_barrierback(L, h, val); - } - L->top = ci->top; /* correct top (in case of previous open call) */ - vmbreak; - } - vmcase(OP_CLOSURE) { - Proto *p = cl->p->p[GETARG_Bx(i)]; - LClosure *ncl = getcached(p, cl->upvals, base); /* cached closure */ - if (ncl == NULL) /* no match? */ - pushclosure(L, p, cl->upvals, base, ra); /* create a new one */ - else - setclLvalue(L, ra, ncl); /* push cashed closure */ - checkGC(L, ra + 1); - vmbreak; - } - vmcase(OP_VARARG) { - int b = GETARG_B(i) - 1; /* required results */ - int j; - int n = cast_int(base - ci->func) - cl->p->numparams - 1; - if (n < 0) /* less arguments than parameters? */ - n = 0; /* no vararg arguments */ - if (b < 0) { /* B == 0? */ - b = n; /* get all var. arguments */ - Protect(luaD_checkstack(L, n)); - ra = RA(i); /* previous call may change the stack */ - L->top = ra + n; - } - for (j = 0; j < b && j < n; j++) - setobjs2s(L, ra + j, base - n + j); - for (; j < b; j++) /* complete required results with nil */ - setnilvalue(ra + j); - vmbreak; - } - vmcase(OP_EXTRAARG) { - lua_assert(0); - vmbreak; - } - } - } -} - -/* }================================================================== */ - diff --git a/deps/rcheevos/test/lua/src/lvm.h b/deps/rcheevos/test/lua/src/lvm.h deleted file mode 100644 index 422f871949..0000000000 --- a/deps/rcheevos/test/lua/src/lvm.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -** $Id: lvm.h,v 2.41 2016/12/22 13:08:50 roberto Exp $ -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lvm_h -#define lvm_h - - -#include "ldo.h" -#include "lobject.h" -#include "ltm.h" - - -#if !defined(LUA_NOCVTN2S) -#define cvt2str(o) ttisnumber(o) -#else -#define cvt2str(o) 0 /* no conversion from numbers to strings */ -#endif - - -#if !defined(LUA_NOCVTS2N) -#define cvt2num(o) ttisstring(o) -#else -#define cvt2num(o) 0 /* no conversion from strings to numbers */ -#endif - - -/* -** You can define LUA_FLOORN2I if you want to convert floats to integers -** by flooring them (instead of raising an error if they are not -** integral values) -*/ -#if !defined(LUA_FLOORN2I) -#define LUA_FLOORN2I 0 -#endif - - -#define tonumber(o,n) \ - (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) - -#define tointeger(o,i) \ - (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) - -#define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) - -#define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) - - -/* -** fast track for 'gettable': if 't' is a table and 't[k]' is not nil, -** return 1 with 'slot' pointing to 't[k]' (final result). Otherwise, -** return 0 (meaning it will have to check metamethod) with 'slot' -** pointing to a nil 't[k]' (if 't' is a table) or NULL (otherwise). -** 'f' is the raw get function to use. -*/ -#define luaV_fastget(L,t,k,slot,f) \ - (!ttistable(t) \ - ? (slot = NULL, 0) /* not a table; 'slot' is NULL and result is 0 */ \ - : (slot = f(hvalue(t), k), /* else, do raw access */ \ - !ttisnil(slot))) /* result not nil? */ - -/* -** standard implementation for 'gettable' -*/ -#define luaV_gettable(L,t,k,v) { const TValue *slot; \ - if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \ - else luaV_finishget(L,t,k,v,slot); } - - -/* -** Fast track for set table. If 't' is a table and 't[k]' is not nil, -** call GC barrier, do a raw 't[k]=v', and return true; otherwise, -** return false with 'slot' equal to NULL (if 't' is not a table) or -** 'nil'. (This is needed by 'luaV_finishget'.) Note that, if the macro -** returns true, there is no need to 'invalidateTMcache', because the -** call is not creating a new entry. -*/ -#define luaV_fastset(L,t,k,slot,f,v) \ - (!ttistable(t) \ - ? (slot = NULL, 0) \ - : (slot = f(hvalue(t), k), \ - ttisnil(slot) ? 0 \ - : (luaC_barrierback(L, hvalue(t), v), \ - setobj2t(L, cast(TValue *,slot), v), \ - 1))) - - -#define luaV_settable(L,t,k,v) { const TValue *slot; \ - if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \ - luaV_finishset(L,t,k,v,slot); } - - - -LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); -LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); -LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); -LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); -LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); -LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, - StkId val, const TValue *slot); -LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, - StkId val, const TValue *slot); -LUAI_FUNC void luaV_finishOp (lua_State *L); -LUAI_FUNC void luaV_execute (lua_State *L); -LUAI_FUNC void luaV_concat (lua_State *L, int total); -LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); -LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); -LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); -LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); - -#endif diff --git a/deps/rcheevos/test/lua/src/lzio.c b/deps/rcheevos/test/lua/src/lzio.c deleted file mode 100644 index c9e1f491f3..0000000000 --- a/deps/rcheevos/test/lua/src/lzio.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -** $Id: lzio.c,v 1.37 2015/09/08 15:41:05 roberto Exp $ -** Buffered streams -** See Copyright Notice in lua.h -*/ - -#define lzio_c -#define LUA_CORE - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "llimits.h" -#include "lmem.h" -#include "lstate.h" -#include "lzio.h" - - -int luaZ_fill (ZIO *z) { - size_t size; - lua_State *L = z->L; - const char *buff; - lua_unlock(L); - buff = z->reader(L, z->data, &size); - lua_lock(L); - if (buff == NULL || size == 0) - return EOZ; - z->n = size - 1; /* discount char being returned */ - z->p = buff; - return cast_uchar(*(z->p++)); -} - - -void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { - z->L = L; - z->reader = reader; - z->data = data; - z->n = 0; - z->p = NULL; -} - - -/* --------------------------------------------------------------- read --- */ -size_t luaZ_read (ZIO *z, void *b, size_t n) { - while (n) { - size_t m; - if (z->n == 0) { /* no bytes in buffer? */ - if (luaZ_fill(z) == EOZ) /* try to read more */ - return n; /* no more input; return number of missing bytes */ - else { - z->n++; /* luaZ_fill consumed first byte; put it back */ - z->p--; - } - } - m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ - memcpy(b, z->p, m); - z->n -= m; - z->p += m; - b = (char *)b + m; - n -= m; - } - return 0; -} - diff --git a/deps/rcheevos/test/lua/src/lzio.h b/deps/rcheevos/test/lua/src/lzio.h deleted file mode 100644 index e7b6f34b1e..0000000000 --- a/deps/rcheevos/test/lua/src/lzio.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -** $Id: lzio.h,v 1.31 2015/09/08 15:41:05 roberto Exp $ -** Buffered streams -** See Copyright Notice in lua.h -*/ - - -#ifndef lzio_h -#define lzio_h - -#include "lua.h" - -#include "lmem.h" - - -#define EOZ (-1) /* end of stream */ - -typedef struct Zio ZIO; - -#define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) - - -typedef struct Mbuffer { - char *buffer; - size_t n; - size_t buffsize; -} Mbuffer; - -#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) - -#define luaZ_buffer(buff) ((buff)->buffer) -#define luaZ_sizebuffer(buff) ((buff)->buffsize) -#define luaZ_bufflen(buff) ((buff)->n) - -#define luaZ_buffremove(buff,i) ((buff)->n -= (i)) -#define luaZ_resetbuffer(buff) ((buff)->n = 0) - - -#define luaZ_resizebuffer(L, buff, size) \ - ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ - (buff)->buffsize, size), \ - (buff)->buffsize = size) - -#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) - - -LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, - void *data); -LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ - - - -/* --------- Private Part ------------------ */ - -struct Zio { - size_t n; /* bytes still unread */ - const char *p; /* current position in buffer */ - lua_Reader reader; /* reader function */ - void *data; /* additional data */ - lua_State *L; /* Lua state (for reader) */ -}; - - -LUAI_FUNC int luaZ_fill (ZIO *z); - -#endif From 7b5e317ad08c93689043f0ac08bd086a1e09f266 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Sun, 2 Sep 2018 14:50:16 +0100 Subject: [PATCH 0010/1292] Fix merge error --- command.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/command.c b/command.c index dfc8d05afa..113ba16503 100644 --- a/command.c +++ b/command.c @@ -282,8 +282,6 @@ static bool command_read_ram(const char *arg) data = cheevos_patch_address(addr, cheevos_get_console()); - data = cheevos_var_get_memory(&var); - if (data) { for (i=0;i Date: Sun, 2 Sep 2018 14:56:12 +0100 Subject: [PATCH 0011/1292] Fixed screenshot code after merge --- cheevos/cheevos.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index c892817a5d..2b31e59f34 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -493,16 +493,19 @@ static void cheevos_award(cheevos_cheevo_t* cheevo, int mode) /* Take a screenshot of the achievement. */ if (settings && settings->bools.cheevos_auto_screenshot) { - snprintf(buffer, sizeof(buffer), "%s/%s-cheevo-%u", - settings->paths.directory_screenshot, - path_basename(path_get(RARCH_PATH_BASENAME)), - cheevo->info->id); + char shotname[256]; - if (take_screenshot(buffer, true, - video_driver_cached_frame_has_valid_framebuffer())) - CHEEVOS_LOG(CHEEVOS_TAG "Took a screenshot for cheevo %u\n", cheevo->info->id); + snprintf(shotname, sizeof(shotname), "%s/%s-cheevo-%u", + settings->paths.directory_screenshot, + path_basename(path_get(RARCH_PATH_BASENAME)), + cheevo->info->id); + shotname[sizeof(shotname) - 1] = '\0'; + + if (take_screenshot(shotname, true, + video_driver_cached_frame_has_valid_framebuffer(), false, true)) + CHEEVOS_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->info->id); else - CHEEVOS_LOG(CHEEVOS_TAG "Failed to take screenshot for cheevo %u\n", cheevo->info->id); + CHEEVOS_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->info->id); } } From 0f6cdde65b7fb1fe5d1c3f9e7826239993dc1308 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Sun, 2 Sep 2018 15:00:42 +0100 Subject: [PATCH 0012/1292] Fixed indentation --- cheevos/cheevos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 2b31e59f34..53293181d5 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -503,9 +503,9 @@ static void cheevos_award(cheevos_cheevo_t* cheevo, int mode) if (take_screenshot(shotname, true, video_driver_cached_frame_has_valid_framebuffer(), false, true)) - CHEEVOS_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->info->id); + CHEEVOS_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->info->id); else - CHEEVOS_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->info->id); + CHEEVOS_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->info->id); } } From 2d7c4b4f9d29efe406d5323cefc2b5b457ec5ee3 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Sun, 2 Sep 2018 15:11:33 +0100 Subject: [PATCH 0013/1292] Use CHEEVOS_TAG --- cheevos/cheevos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 53293181d5..aedd0df002 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -503,9 +503,9 @@ static void cheevos_award(cheevos_cheevo_t* cheevo, int mode) if (take_screenshot(shotname, true, video_driver_cached_frame_has_valid_framebuffer(), false, true)) - CHEEVOS_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->info->id); + CHEEVOS_LOG(CHEEVOS_TAG "got a screenshot for cheevo %u\n", cheevo->info->id); else - CHEEVOS_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->info->id); + CHEEVOS_LOG(CHEEVOS_TAG "failed to get screenshot for cheevo %u\n", cheevo->info->id); } } From 4c01697d3f3996ea5799a43f7650a3a54aed99c1 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Mon, 3 Sep 2018 19:17:03 +0100 Subject: [PATCH 0014/1292] Use the correct console id --- cheevos/cheevos.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index aedd0df002..9288515254 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -115,7 +115,6 @@ typedef struct slock_t* task_lock; #endif - int console_id; bool core_supports; cheevos_rapatchdata_t patchdata; @@ -511,7 +510,8 @@ static void cheevos_award(cheevos_cheevo_t* cheevo, int mode) static unsigned cheevos_peek(unsigned address, unsigned num_bytes, void* ud) { - const uint8_t* data = cheevos_fixup_find(&cheevos_locals.fixups, address, cheevos_locals.console_id); + const uint8_t* data = cheevos_fixup_find(&cheevos_locals.fixups, + address, cheevos_locals.patchdata.console_id); unsigned value = 0; switch (num_bytes) @@ -981,7 +981,7 @@ bool cheevos_get_support_cheevos(void) int cheevos_get_console(void) { - return cheevos_locals.console_id; + return cheevos_locals.patchdata.console_id; } static void cheevos_unlock_cb(unsigned id, void* userdata) @@ -1031,8 +1031,8 @@ static void cheevos_unlock_cb(unsigned id, void* userdata) * * https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html */ -#undef CORO_YIELD -#define CORO_YIELD() +/*#undef CORO_YIELD +#define CORO_YIELD()*/ typedef struct { From 377d256ce974a28ab3f477831e112df0aabcf272 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Mon, 3 Sep 2018 22:51:07 +0100 Subject: [PATCH 0015/1292] Properly initialize cheevos_locals --- cheevos/cheevos.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 9288515254..e442957e77 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -144,7 +144,20 @@ typedef struct uint8_t reserve[8]; } cheevos_nes_header_t; -static cheevos_locals_t cheevos_locals; +static cheevos_locals_t cheevos_locals = +{ + NULL, /* task */ +#ifdef HAVE_THREADS + NULL, /* task_lock */ +#endif + true, /* core_supports */ + {0}, /* patchdata */ + NULL, /* core */ + NULL, /* unofficial */ + NULL, /* lboards */ + {0}, /* fixups */ + {0}, /* token */ +}; bool cheevos_loaded = false; bool cheevos_hardcore_active = false; @@ -712,7 +725,8 @@ void cheevos_populate_menu(void* data) menu_displaylist_info_t* info = (menu_displaylist_info_t*)data; cheevos_cheevo_t* cheevo = NULL; - if ( settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable + if ( settings->bools.cheevos_enable + && settings->bools.cheevos_hardcore_mode_enable && cheevos_loaded) { if (!cheevos_hardcore_paused) @@ -907,15 +921,15 @@ bool cheevos_unload(void) CHEEVOS_FREE(cheevos_locals.lboards); cheevos_free_patchdata(&cheevos_locals.patchdata); cheevos_fixup_destroy(&cheevos_locals.fixups); + + cheevos_locals.core = NULL; + cheevos_locals.unofficial = NULL; + cheevos_locals.lboards = NULL; + + cheevos_loaded = false; + cheevos_hardcore_paused = false; } - cheevos_locals.core = NULL; - cheevos_locals.unofficial = NULL; - cheevos_locals.lboards = NULL; - - cheevos_loaded = false; - cheevos_hardcore_paused = false; - return true; } @@ -927,7 +941,8 @@ bool cheevos_toggle_hardcore_mode(void) return false; /* reset and deinit rewind to avoid cheat the score */ - if (settings->bools.cheevos_hardcore_mode_enable && !cheevos_hardcore_paused) + if ( settings->bools.cheevos_hardcore_mode_enable + && !cheevos_hardcore_paused) { const char *msg = msg_hash_to_str( MSG_CHEEVOS_HARDCORE_MODE_ENABLE); From 8f40baf7ff038eb925a23abb7b924822f8e40e8e Mon Sep 17 00:00:00 2001 From: Zlika Date: Sat, 22 Sep 2018 22:27:07 +0200 Subject: [PATCH 0016/1292] Fix for #7130, take two --- menu/menu_input.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/menu/menu_input.c b/menu/menu_input.c index 8fdeb4f106..4d33a9ba5e 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -565,10 +565,15 @@ static int menu_input_pointer_post_iterate( void menu_input_post_iterate(int *ret, unsigned action) { menu_entry_t entry; + size_t selection; + menu_file_list_cbs_t *cbs; settings_t *settings = config_get_ptr(); file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); - size_t selection = menu_navigation_get_selection(); - menu_file_list_cbs_t *cbs = selection_buf ? + menu_input_t *menu_input = menu_input_get_ptr(); + if (menu_input != NULL && menu_input->pointer.pressed[0]) + menu_navigation_set_selection(menu_input->pointer.ptr); + selection = menu_navigation_get_selection(); + cbs = selection_buf ? (menu_file_list_cbs_t*)file_list_get_actiondata_at_offset(selection_buf, selection) : NULL; menu_entry_init(&entry); From badac565da4ce9dad14532bca4199df01a389c37 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 23 Sep 2018 20:45:24 +0200 Subject: [PATCH 0017/1292] Take this out --- runahead/dirty_input.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/runahead/dirty_input.c b/runahead/dirty_input.c index 89a9a8c077..6a9cc68a21 100644 --- a/runahead/dirty_input.c +++ b/runahead/dirty_input.c @@ -131,16 +131,13 @@ int16_t input_state_get_last(unsigned port, { InputListElement *element = (InputListElement*)input_state_list->data[i]; - const unsigned MAX_ID = sizeof(element->state) / sizeof(int16_t); if ( (element->port == port) && (element->device == device) && (element->index == index)) { if (id < element->state_size) - { return element->state[id]; - } return 0; } } From 1987b741796f7b5492714ec3bfac79b9e69845bc Mon Sep 17 00:00:00 2001 From: Dwedit Date: Sun, 23 Sep 2018 14:20:25 -0500 Subject: [PATCH 0018/1292] Fixed random filename generator, no longer resets to the first value each attempt. --- runahead/secondary_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runahead/secondary_core.c b/runahead/secondary_core.c index 623933da7d..801d2e491e 100644 --- a/runahead/secondary_core.c +++ b/runahead/secondary_core.c @@ -85,6 +85,7 @@ static bool write_file_with_random_name(char **tempDllPath, bool okay = false; const char *prefix = "tmp"; time_t time_value = time(NULL); + unsigned number_value = (unsigned)time_value; char *ext = strcpy_alloc_force( path_get_extension(*tempDllPath)); int ext_len = (int)strlen(ext); @@ -100,8 +101,9 @@ static bool write_file_with_random_name(char **tempDllPath, /* Try up to 30 'random' filenames before giving up */ for (i = 0; i < 30; i++) { - unsigned int number_value = (unsigned int)time_value * 214013 + 2531011; - int number = (number_value >> 14) % 100000; + int number; + number_value = number_value * 214013 + 2531011; + number = (number_value >> 14) % 100000; snprintf(number_buf, sizeof(number_buf), "%05d", number); From b62fa8d9edd44fb23e52a5b7fff46f742008a6d1 Mon Sep 17 00:00:00 2001 From: Sven <40953353+RetroSven@users.noreply.github.com> Date: Sun, 23 Sep 2018 15:25:51 -0400 Subject: [PATCH 0019/1292] add ability to edit emu-style cheat code value ; change default handler to emu --- managers/cheat_manager.c | 5 +++++ managers/cheat_manager.h | 3 ++- menu/cbs/menu_cbs_left.c | 2 +- menu/cbs/menu_cbs_ok.c | 8 ++++---- menu/cbs/menu_cbs_right.c | 2 +- menu/menu_setting.c | 14 ++++++++++++++ 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index b8c2c28a72..5bf273b116 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -250,6 +250,11 @@ bool cheat_manager_copy_working_to_idx(unsigned idx) free(cheat_manager_state.cheats[idx].desc) ; cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc) ; + + if ( cheat_manager_state.cheats[idx].code != NULL ) + free(cheat_manager_state.cheats[idx].code) ; + + cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code) ; return true ; } static void cheat_manager_new(unsigned size) diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index aadcc05a73..3665ea62fd 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -78,7 +78,8 @@ enum cheat_rumble_type RUMBLE_TYPE_DECREASE_BY_VALUE }; -#define CHEAT_CODE_SCRATCH_SIZE 100 +/* Some codes are ridiculously large - over 10000 bytes */ +#define CHEAT_CODE_SCRATCH_SIZE 16*1024 #define CHEAT_DESC_SCRATCH_SIZE 255 struct item_cheat diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 654742e10d..82122151e9 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -574,7 +574,7 @@ static int action_left_cheat_num_passes(unsigned type, const char *label, new_size = cheat_manager_get_size() - 1; menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); - cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); + cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); return 0; } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 83c6a6f097..ccbe132507 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2749,7 +2749,7 @@ static int action_ok_cheat_add_top(const char *path, menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); - cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); + cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat)); tmp.idx = 0 ; @@ -2780,7 +2780,7 @@ static int action_ok_cheat_add_bottom(const char *path, menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); - cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); + cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); msg[0] = '\0'; strlcpy(msg, @@ -2812,7 +2812,7 @@ static int action_ok_cheat_add_new_after(const char *path, bool refresh = false; unsigned int new_size = cheat_manager_get_size() + 1; - cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); + cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat)); tmp.idx = cheat_manager_state.working_cheat.idx+1 ; @@ -2845,7 +2845,7 @@ static int action_ok_cheat_add_new_before(const char *path, bool refresh = false ; unsigned int new_size = cheat_manager_get_size() + 1; - cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); + cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat)); tmp.idx = cheat_manager_state.working_cheat.idx ; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 4bda401e98..e5800e17df 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -355,7 +355,7 @@ static int action_right_cheat_num_passes(unsigned type, const char *label, new_size = cheat_manager_get_size() + 1; menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); - cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO); + cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); return 0; } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 629f240197..a2d888b739 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4029,6 +4029,20 @@ static bool setting_append_list( general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + CONFIG_STRING( + list, list_info, + cheat_manager_state.working_code, + sizeof(cheat_manager_state.working_code), + MENU_ENUM_LABEL_CHEAT_CODE, + MENU_ENUM_LABEL_VALUE_CHEAT_CODE, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + config_uint_cbs(cheat_manager_state.working_cheat.handler, CHEAT_HANDLER, setting_uint_action_left_with_refresh,setting_uint_action_right_with_refresh, MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_EMU,&setting_get_string_representation_uint_as_enum, From 8140d90ebc91a063fbcd4bca5608e6879507cfac Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 23 Sep 2018 21:28:38 +0200 Subject: [PATCH 0020/1292] Add dropdown list for state slot --- menu/menu_setting.c | 2 ++ setting_list.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 629f240197..6bec455cff 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2839,6 +2839,8 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].offset_by = -1; menu_settings_list_current_add_range(list, list_info, -1, 0, 1, true, false); CONFIG_ACTION( diff --git a/setting_list.h b/setting_list.h index 2acf2bee77..32cc4b6b4f 100644 --- a/setting_list.h +++ b/setting_list.h @@ -102,7 +102,7 @@ struct rarch_setting uint8_t index; uint32_t index_offset; - int8_t offset_by; + int16_t offset_by; unsigned bind_type; uint32_t size; From 6d16b5fc932a726260a07612471307b61356f9f4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 23 Sep 2018 22:02:20 +0200 Subject: [PATCH 0021/1292] This is unnecessary - if you already know the enum_idx - use menu_setting_find_by_enum instead - it will be faster --- menu/cbs/menu_cbs_ok.c | 16 ++++++++-------- menu/menu_displaylist.c | 12 ++++++------ menu/menu_setting.c | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index ccbe132507..68931e30ca 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -850,22 +850,22 @@ int generic_action_ok_displaylist_push(const char *path, rarch_setting_t *setting = NULL; cheat_manager_copy_idx_to_working(type-MENU_SETTINGS_CHEAT_BEGIN); - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_IDX)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_IDX); if (setting) setting->max = cheat_manager_get_size()-1 ; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_VALUE)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_VALUE); if (setting) setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE); if (setting) setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION); if (setting) { int max_bit_position = cheat_manager_state.working_cheat.memory_search_size<3 ? 7 : 0 ; setting->max = max_bit_position ; } - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS); if (setting) { cheat_manager_state.browse_address = *setting->value.target.unsigned_integer ; @@ -875,13 +875,13 @@ int generic_action_ok_displaylist_push(const char *path, } case ACTION_OK_DL_CHEAT_SEARCH_SETTINGS_LIST: { - rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT)); + rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT); if (setting) setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS); if (setting) setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS); if (setting) setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1; action_ok_dl_lbl(action_ok_dl_to_enum(action_type), DISPLAYLIST_GENERIC); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 8c2032da5e..c58564138c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5206,15 +5206,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) if ( !cheat_manager_state.memory_initialized) cheat_manager_initialize_memory(NULL,true) ; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS); if ( setting ) setting->max = cheat_manager_state.total_memory_size==0?0:cheat_manager_state.total_memory_size-1; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION); if ( setting ) setting->max = cheat_manager_state.working_cheat.memory_search_size<3 ? 255 : 0 ; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY); if ( setting ) setting->max = cheat_manager_state.actual_memory_size>0?cheat_manager_state.actual_memory_size-1:0 ; @@ -5403,13 +5403,13 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_DELETE_MATCH)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_DELETE_MATCH); if (setting) setting->max = cheat_manager_state.num_matches-1; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_COPY_MATCH)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_COPY_MATCH); if (setting) setting->max = cheat_manager_state.num_matches-1; - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY); if (setting) setting->max = cheat_manager_state.actual_memory_size>0?cheat_manager_state.actual_memory_size-1:0 ; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 5874dd9651..dfcb45f0af 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2329,19 +2329,19 @@ void general_write_handler(rarch_setting_t *setting) break; case MENU_ENUM_LABEL_CHEAT_MEMORY_SEARCH_SIZE: { - rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_VALUE)); + rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_VALUE); if (setting) { *(setting->value.target.unsigned_integer) = 0 ; setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1; } - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE); if (setting) { *setting->value.target.unsigned_integer = 0 ; setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1; } - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION); if (setting) { int max_bit_position; @@ -2354,19 +2354,19 @@ void general_write_handler(rarch_setting_t *setting) break; case MENU_ENUM_LABEL_CHEAT_START_OR_RESTART: { - rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT)); + rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT); if (setting) { *setting->value.target.unsigned_integer = 0 ; setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1; } - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS); if (setting) { *setting->value.target.unsigned_integer = 0 ; setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1; } - setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS)); + setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS); if (setting) { *setting->value.target.unsigned_integer = 0 ; From c9494a922bd6ab6a04b06979a2a5164bb207c41f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 23 Sep 2018 22:05:51 +0200 Subject: [PATCH 0022/1292] Use menu_setting_find_enum --- menu/menu_setting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index dfcb45f0af..7f36029141 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2322,7 +2322,7 @@ void general_write_handler(rarch_setting_t *setting) break; case MENU_ENUM_LABEL_REWIND_BUFFER_SIZE_STEP: { - rarch_setting_t *buffer_size_setting = menu_setting_find("rewind_buffer_size"); + rarch_setting_t *buffer_size_setting = menu_setting_find_enum(MENU_ENUM_LABEL_REWIND_BUFFER_SIZE); if (buffer_size_setting) buffer_size_setting->step = (*setting->value.target.unsigned_integer)*1024*1024 ; } From e0f01fd85ed715f88357388d905a908f761fc20b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 23 Sep 2018 22:16:31 +0200 Subject: [PATCH 0023/1292] Cleanups --- menu/cbs/menu_cbs_get_value.c | 25 ------------------------- menu/menu_setting.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index c7790e8a8a..d9efe59a9b 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1290,25 +1290,6 @@ static void menu_action_setting_disp_set_label_no_items( strlcpy(s2, path, len2); } -static void menu_action_setting_disp_set_label_video_msg_color( - file_list_t* list, - unsigned *w, unsigned type, unsigned i, - const char *label, - char *s, size_t len, - const char *entry_label, - const char *path, - char *s2, size_t len2) -{ - rarch_setting_t *setting = menu_setting_find(list->list[i].label); - - if (!setting) - return; - - *w = 19; - - snprintf(s, len, "%d", (int)(*setting->value.target.fraction * 255.0f)); -} - static void menu_action_setting_disp_set_label(file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, @@ -1488,12 +1469,6 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_menu_more); break; - case MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_RED: - case MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_GREEN: - case MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_BLUE: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_video_msg_color); - break; default: return - 1; } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 7f36029141..b4304e17d5 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -175,6 +175,16 @@ static int setting_action_ok_uint(void *data, bool wraparound) return 0; } +static void setting_get_string_representation_float_video_msg_color(void *data, + char *s, size_t len) +{ + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return; + + snprintf(s, len, "%d", (int)(*setting->value.target.fraction * 255.0f)); +} + static void setting_get_string_representation_max_users(void *data, char *s, size_t len) { @@ -6293,6 +6303,8 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_float_video_msg_color; menu_settings_list_current_add_range(list, list_info, 0, 1, 1.0f/255.0f, true, true); CONFIG_FLOAT( @@ -6307,6 +6319,8 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_float_video_msg_color; menu_settings_list_current_add_range(list, list_info, 0, 1, 1.0f/255.0f, true, true); CONFIG_FLOAT( @@ -6321,6 +6335,8 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_float_video_msg_color; menu_settings_list_current_add_range(list, list_info, 0, 1, 1.0f/255.0f, true, true); CONFIG_BOOL( @@ -7016,6 +7032,8 @@ static bool setting_append_list( general_write_handler, general_read_handler); (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_float_video_msg_color; menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); @@ -7030,6 +7048,8 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_float_video_msg_color; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); From c42784794414d9918f4966635dc8e8dae6028cf7 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 23 Sep 2018 18:43:26 -0500 Subject: [PATCH 0024/1292] [record] define quality profiles --- configuration.c | 11 ++- configuration.h | 2 + menu/menu_setting.c | 16 ---- record/drivers/record_ffmpeg.c | 151 ++++++++++++++++++++++----------- record/record_driver.c | 5 -- record/record_driver.h | 11 +-- 6 files changed, 121 insertions(+), 75 deletions(-) diff --git a/configuration.c b/configuration.c index 524efd6180..758e111fc6 100644 --- a/configuration.c +++ b/configuration.c @@ -54,6 +54,10 @@ #include "../list_special.h" +#ifdef HAVE_FFMPEG +#include "record/record_driver.h" +#endif + static const char* invalid_filename_chars[] = { /* https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names--fo */ "~", "#", "%", "&", "*", "{", "}", "\\", ":", "[", "]", "?", "/", "|", "\'", "\"", @@ -1593,7 +1597,6 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("aspect_ratio_index", &settings->uints.video_aspect_ratio_idx, true, aspect_ratio_idx, false); #ifdef HAVE_NETWORKING SETTING_UINT("netplay_ip_port", &settings->uints.netplay_port, true, RARCH_DEFAULT_PORT, false); - SETTING_UINT("video_stream_port", &settings->uints.video_stream_port, true, RARCH_STREAM_DEFAULT_PORT, false); SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT); SETTING_UINT("netplay_input_latency_frames_min",&settings->uints.netplay_input_latency_frames_min, true, 0, false); SETTING_UINT("netplay_input_latency_frames_range",&settings->uints.netplay_input_latency_frames_range, true, 0, false); @@ -1614,6 +1617,12 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("midi_volume", &settings->uints.midi_volume, true, midi_volume, false); +#ifdef HAVE_FFMPEG + SETTING_UINT("video_stream_port", &settings->uints.video_stream_port, true, RARCH_STREAM_DEFAULT_PORT, false); + SETTING_UINT("video_record_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, false); + SETTING_UINT("video_stream_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, false); +#endif + *size = count; return tmp; diff --git a/configuration.h b/configuration.h index fd84cda742..291e27d942 100644 --- a/configuration.h +++ b/configuration.h @@ -388,6 +388,8 @@ typedef struct settings unsigned video_msg_bgcolor_green; unsigned video_msg_bgcolor_blue; unsigned video_stream_port; + unsigned video_record_quality; + unsigned video_stream_quality; unsigned menu_thumbnails; unsigned menu_left_thumbnails; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 629f240197..50090a759d 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -5952,22 +5952,6 @@ static bool setting_append_list( general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); - CONFIG_BOOL( - list, list_info, - recording_driver_get_use_output_dir_ptr(), - MENU_ENUM_LABEL_RECORD_USE_OUTPUT_DIRECTORY, - MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, - false, - MENU_ENUM_LABEL_VALUE_OFF, - MENU_ENUM_LABEL_VALUE_ON, - &group_info, - &subgroup_info, - parent_group, - general_write_handler, - general_read_handler, - SD_FLAG_NONE - ); - END_SUB_GROUP(list, list_info, parent_group); START_SUB_GROUP(list, list_info, "Miscellaneous", &group_info, &subgroup_info, parent_group); diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 5194681266..c20a61333d 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -89,6 +89,10 @@ extern "C" { #define PIX_FMT_YUV444P AV_PIX_FMT_YUV444P #endif +#ifndef PIX_FMT_YUV420P +#define PIX_FMT_YUV420P AV_PIX_FMT_YUV420P +#endif + #ifndef PIX_FMT_BGR24 #define PIX_FMT_BGR24 AV_PIX_FMT_BGR24 #endif @@ -544,29 +548,112 @@ static bool ffmpeg_init_video(ffmpeg_t *handle) return true; } -static bool ffmpeg_init_config_common(struct ff_config_param *params) +static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned preset) { - params->scale_factor = 1; - params->threads = 1; - params->frame_drop_ratio = 1; - params->audio_enable = true; - params->audio_global_quality = 75; - params->out_pix_fmt = PIX_FMT_YUV444P; + char buf[256]; - strlcpy(params->vcodec, "libx264", sizeof(params->vcodec)); - strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec)); - strlcpy(params->format, "flv", sizeof(params->format)); + switch (preset) + { + case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY: + case RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY: + params->scale_factor = 1; + params->threads = 1; + params->frame_drop_ratio = 1; + params->audio_enable = true; + params->audio_global_quality = 75; + params->out_pix_fmt = PIX_FMT_YUV420P; - av_dict_set(¶ms->video_opts, "video_preset", "ultrafast", 0); - av_dict_set(¶ms->video_opts, "video_tune", "ultrafast", 0); - av_dict_set(¶ms->video_opts, "video_crf", "18", 0); - av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0); + strlcpy(params->vcodec, "libx264", sizeof(params->vcodec)); + strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "preset", "ultrafast", 0); + av_dict_set(¶ms->video_opts, "tune", "animation", 0); + av_dict_set(¶ms->video_opts, "crf", "30", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0); + break; + case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY: + case RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY: + params->scale_factor = 1; + params->threads = 1; + params->frame_drop_ratio = 1; + params->audio_enable = true; + params->audio_global_quality = 75; + params->out_pix_fmt = PIX_FMT_YUV420P; + + strlcpy(params->vcodec, "libx264", sizeof(params->vcodec)); + strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "preset", "superfast", 0); + av_dict_set(¶ms->video_opts, "tune", "animation", 0); + av_dict_set(¶ms->video_opts, "crf", "25", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0); + break; + case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY: + case RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY: + params->scale_factor = 1; + params->threads = 1; + params->frame_drop_ratio = 1; + params->audio_enable = true; + params->audio_global_quality = 100; + params->out_pix_fmt = PIX_FMT_YUV444P; + + strlcpy(params->vcodec, "libx264", sizeof(params->vcodec)); + strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "preset", "medium", 0); + av_dict_set(¶ms->video_opts, "tune", "animation", 0); + av_dict_set(¶ms->video_opts, "crf", "15", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); + break; + case RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY: + params->scale_factor = 1; + params->threads = 1; + params->frame_drop_ratio = 1; + params->audio_enable = true; + params->audio_global_quality = 100; + params->out_pix_fmt = PIX_FMT_BGR24; + + strlcpy(params->vcodec, "libx264rgb", sizeof(params->vcodec)); + strlcpy(params->acodec, "flac", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "preset", "medium", 0); + av_dict_set(¶ms->video_opts, "tune", "animation", 0); + av_dict_set(¶ms->video_opts, "crf", "0", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); + break; + case RECORD_CONFIG_TYPE_STREAMING_NETPLAY: + params->scale_factor = 1; + params->threads = 1; + params->frame_drop_ratio = 1; + params->audio_enable = true; + params->audio_global_quality = 50; + params->out_pix_fmt = PIX_FMT_YUV420P; + + strlcpy(params->vcodec, "libx264", sizeof(params->vcodec)); + strlcpy(params->acodec, "mp3", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "preset", "ultrafast", 0); + av_dict_set(¶ms->video_opts, "tune", "zerolatency", 0); + av_dict_set(¶ms->video_opts, "crf", "20", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "50", 0); + break; + default: + break; + } + + if (preset <= RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY) + strlcpy(params->format, "matroska", sizeof(params->format)); + else if (preset <= RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY) + strlcpy(params->format, "flv", sizeof(params->format)); + else + strlcpy(params->format, "flv", sizeof(params->format)); return true; } static bool ffmpeg_init_config_recording(struct ff_config_param *params) { + return true; params->threads = 0; params->audio_global_quality = 100; @@ -703,7 +790,7 @@ static bool ffmpeg_init_muxer_post(ffmpeg_t *handle) } av_dict_set(&handle->muxer.ctx->metadata, "title", - "RetroArch video dump", 0); + "RetroArch Video Dump", 0); return avformat_write_header(handle->muxer.ctx, NULL) >= 0; } @@ -843,39 +930,7 @@ static void *ffmpeg_new(const struct record_params *params) goto error; } else - { - - switch (params->config_type) - { - case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY: - ffmpeg_init_config_common(&handle->config); - ffmpeg_init_config_recording(&handle->config); - break; - case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY: - ffmpeg_init_config_common(&handle->config); - ffmpeg_init_config_recording(&handle->config); - break; - case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY: - ffmpeg_init_config_common(&handle->config); - ffmpeg_init_config_recording(&handle->config); - break; - case RECORD_CONFIG_TYPE_STREAM_YOUTUBE: - ffmpeg_init_config_common(&handle->config); - /* TODO/FIXME - fill this in */ - break; - case RECORD_CONFIG_TYPE_STREAM_DISCORD: - ffmpeg_init_config_common(&handle->config); - /* TODO/FIXME - fill this in */ - break; - case RECORD_CONFIG_TYPE_STREAM_TWITCH: - ffmpeg_init_config_common(&handle->config); - /* TODO/FIXME - fill this in */ - break; - default: - case RECORD_CONFIG_TYPE_RECORDING_CUSTOM: - break; - } - } + ffmpeg_init_config_common(&handle->config, params->config_type); if (!ffmpeg_init_muxer_pre(handle)) goto error; diff --git a/record/record_driver.c b/record/record_driver.c index 2506e81845..1121749c81 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -510,11 +510,6 @@ void recording_driver_set_data_ptr(void *data) recording_data = data; } -bool *recording_driver_get_use_output_dir_ptr(void) -{ - return &recording_use_output_dir; -} - unsigned *recording_driver_get_width(void) { return &recording_width; diff --git a/record/record_driver.h b/record/record_driver.h index 40c7e7be75..853ec5f338 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -37,9 +37,12 @@ enum record_config_type RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY, RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY, RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY, - RECORD_CONFIG_TYPE_STREAM_YOUTUBE, - RECORD_CONFIG_TYPE_STREAM_TWITCH, - RECORD_CONFIG_TYPE_STREAM_DISCORD + RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, + RECORD_CONFIG_TYPE_STREAMING_CUSTOM, + RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, + RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY, + RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY, + RECORD_CONFIG_TYPE_STREAMING_NETPLAY }; /* Parameters passed to ffemu_new() */ @@ -187,8 +190,6 @@ void recording_driver_clear_data_ptr(void); void recording_driver_set_data_ptr(void *data); -bool *recording_driver_get_use_output_dir_ptr(void); - unsigned *recording_driver_get_width(void); unsigned *recording_driver_get_height(void); From bcb960d248b9cbb6b8790aa3199d41d25047c811 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 23 Sep 2018 19:02:12 -0500 Subject: [PATCH 0025/1292] record] start adding menu entries --- .vscode/settings.json | 3 ++- configuration.c | 2 +- intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_us.h | 6 +++++- menu/cbs/menu_cbs_deferred_push.c | 4 ++++ menu/menu_displaylist.c | 5 +++++ menu/menu_displaylist.h | 1 + menu/menu_setting.c | 31 +++++++++++++++++++++++-------- msg_hash.h | 1 + record/record_driver.c | 6 ------ 10 files changed, 44 insertions(+), 17 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1fde8c11fd..efae5a0931 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,7 +19,8 @@ "iosfwd": "c", "xlocbuf": "c", "xmemory0": "c", - "ios": "c" + "ios": "c", + "list": "c" }, "C_Cpp.dimInactiveRegions": false, } \ No newline at end of file diff --git a/configuration.c b/configuration.c index 758e111fc6..57fcafdff2 100644 --- a/configuration.c +++ b/configuration.c @@ -1620,7 +1620,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, #ifdef HAVE_FFMPEG SETTING_UINT("video_stream_port", &settings->uints.video_stream_port, true, RARCH_STREAM_DEFAULT_PORT, false); SETTING_UINT("video_record_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, false); - SETTING_UINT("video_stream_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, false); + SETTING_UINT("video_stream_quality", &settings->uints.video_stream_quality, true, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, false); #endif *size = count; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index f2e17652d5..e48254fbdd 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -903,6 +903,8 @@ MSG_HASH(MENU_ENUM_LABEL_RECORDING_SETTINGS, "recording_settings") MSG_HASH(MENU_ENUM_LABEL_RECORD_CONFIG, "record_config") +MSG_HASH(MENU_ENUM_LABEL_STREAM_CONFIG, + "stream_config") MSG_HASH(MENU_ENUM_LABEL_RECORD_DRIVER, "record_driver") MSG_HASH(MENU_ENUM_LABEL_MIDI_DRIVER, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 5737f704b4..215d584580 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2151,7 +2151,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, - "Load Recording Config..." + "Custom Record Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, + "Custom Stream Config" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 4c3fac9c5c..fd5008c71b 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -118,6 +118,7 @@ generic_deferred_push(deferred_push_cheat_file_load, DISPLAYLIST_ generic_deferred_push(deferred_push_cheat_file_load_append, DISPLAYLIST_CHEAT_FILES) generic_deferred_push(deferred_push_remap_file_load, DISPLAYLIST_REMAP_FILES) generic_deferred_push(deferred_push_record_configfile, DISPLAYLIST_RECORD_CONFIG_FILES) +generic_deferred_push(deferred_push_stream_configfile, DISPLAYLIST_STREAM_CONFIG_FILES) generic_deferred_push(deferred_push_input_overlay, DISPLAYLIST_OVERLAYS) generic_deferred_push(deferred_push_video_font_path, DISPLAYLIST_FONTS) generic_deferred_push(deferred_push_xmb_font_path, DISPLAYLIST_FONTS) @@ -1034,6 +1035,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_ENUM_LABEL_RECORD_CONFIG: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_record_configfile); break; + case MENU_ENUM_LABEL_STREAM_CONFIG: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_stream_configfile); + break; case MENU_ENUM_LABEL_SHADER_OPTIONS: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_shader_options); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 8c2032da5e..0cee50acdc 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7058,6 +7058,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_RECORD_CONFIG, PARSE_ONLY_PATH, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_STREAM_CONFIG, + PARSE_ONLY_PATH, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_RECORD_PATH, PARSE_ONLY_STRING, false) == 0) @@ -7618,6 +7622,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->exts = strdup("cfg"); break; case DISPLAYLIST_RECORD_CONFIG_FILES: + case DISPLAYLIST_STREAM_CONFIG_FILES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); filebrowser_clear_type(); info->type_default = FILE_TYPE_RECORD_CONFIG; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 10a0ad40aa..5a8d49b79f 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -102,6 +102,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_CHEAT_FILES, DISPLAYLIST_REMAP_FILES, DISPLAYLIST_RECORD_CONFIG_FILES, + DISPLAYLIST_STREAM_CONFIG_FILES, DISPLAYLIST_CONFIG_FILES, DISPLAYLIST_CONTENT_HISTORY, DISPLAYLIST_IMAGES, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 50090a759d..1f9e026f43 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -5926,8 +5926,8 @@ static bool setting_append_list( START_SUB_GROUP(list, list_info, "State", &group_info, &subgroup_info, parent_group); CONFIG_PATH( list, list_info, - global->record.config, - sizeof(global->record.config), + settings->paths.path_record_config, + sizeof(settings->paths.path_record_config), MENU_ENUM_LABEL_RECORD_CONFIG, MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, "", @@ -5938,19 +5938,34 @@ static bool setting_append_list( general_read_handler); menu_settings_list_current_add_values(list, list_info, "cfg"); - CONFIG_STRING( + CONFIG_PATH( list, list_info, - global->record.path, - sizeof(global->record.path), - MENU_ENUM_LABEL_RECORD_PATH, - MENU_ENUM_LABEL_VALUE_RECORD_PATH, + settings->paths.path_stream_config, + sizeof(settings->paths.path_stream_config), + MENU_ENUM_LABEL_STREAM_CONFIG, + MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, "", &group_info, &subgroup_info, parent_group, general_write_handler, general_read_handler); - settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + menu_settings_list_current_add_values(list, list_info, "cfg"); + + CONFIG_DIR( + list, list_info, + global->record.output_dir, + sizeof(global->record.output_dir), + MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY, + MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, + g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], + MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_start = directory_action_start_generic; END_SUB_GROUP(list, list_info, parent_group); diff --git a/msg_hash.h b/msg_hash.h index 954b91a4e9..30038dc55a 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1680,6 +1680,7 @@ enum msg_hash_enums MENU_LABEL(VIDEO_GPU_RECORD), MENU_LABEL(RECORD_USE_OUTPUT_DIRECTORY), MENU_LABEL(RECORD_CONFIG), + MENU_LABEL(STREAM_CONFIG), MENU_LABEL(RECORD_PATH), MENU_LABEL(VIDEO_POST_FILTER_RECORD), MENU_LABEL(RECORD_ENABLE), diff --git a/record/record_driver.c b/record/record_driver.c index 1121749c81..a6ef7af312 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -52,7 +52,6 @@ size_t recording_gpu_width = 0; size_t recording_gpu_height = 0; static bool recording_enable = false; static bool streaming_enable = false; -static bool recording_use_output_dir = false; static const record_driver_t *recording_driver = NULL; void *recording_data = NULL; @@ -374,10 +373,6 @@ bool recording_init(void) } } - if (recording_use_output_dir) - fill_pathname_join(output, - global->record.output_dir, - global->record.path, sizeof(output)); params.out_width = av_info->geometry.base_width; params.out_height = av_info->geometry.base_height; @@ -522,7 +517,6 @@ unsigned *recording_driver_get_height(void) void recording_driver_free_state(void) { - recording_use_output_dir = false; recording_gpu_width = 0; recording_gpu_height = 0; recording_width = 0; From 0900f086966d1d9eec677b4701812f151b990416 Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Sun, 23 Sep 2018 17:26:45 -0700 Subject: [PATCH 0026/1292] Wii U: Fix menu lag when built with DevKitPro r32 == DETAILS Updates to the newlib library bundled with DevKitPro have caused incorrect behavior in `cpu_features_get_time_usec()`. Specifically, it defines `_POSIX_MONTONIC_CLOCK` which results in calling newlib's time functions which are.. buggy, at least on Wii U. By moving the WIIU case higher up, we end up calling the actual Wii U time library routines, and get nice snappy animations as a result. == TESTING I tested this locally on my wiiu and confirmed resolved menu sluggishness. --- libretro-common/features/features_cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index 9bf919c15d..fdefe92714 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -221,6 +221,8 @@ retro_time_t cpu_features_get_time_usec(void) return sys_time_get_system_time(); #elif defined(GEKKO) return ticks_to_microsecs(gettime()); +#elif defined(WIIU) + return ticks_to_us(OSGetSystemTime()); #elif defined(SWITCH) || defined(HAVE_LIBNX) return (svcGetSystemTick() * 10) / 192; #elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__) @@ -238,8 +240,6 @@ retro_time_t cpu_features_get_time_usec(void) return osGetTime() * 1000; #elif defined(VITA) return sceKernelGetProcessTimeWide(); -#elif defined(WIIU) - return ticks_to_us(OSGetSystemTime()); #else #error "Your platform does not have a timer function implemented in cpu_features_get_time_usec(). Cannot continue." #endif From 554ad5a4940d2a62ee7269df7506aed3f8737491 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 23 Sep 2018 19:29:19 -0500 Subject: [PATCH 0027/1292] [record] hookup quality --- record/drivers/record_ffmpeg.c | 6 ++++-- record/record_driver.c | 6 ++++++ record/record_driver.h | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index c20a61333d..6c4e2b40c9 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -651,6 +651,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p return true; } +/* static bool ffmpeg_init_config_recording(struct ff_config_param *params) { return true; @@ -667,6 +668,7 @@ static bool ffmpeg_init_config_recording(struct ff_config_param *params) return true; } +*/ static bool ffmpeg_init_config(struct ff_config_param *params, const char *config) @@ -924,13 +926,13 @@ static void *ffmpeg_new(const struct record_params *params) handle->params = *params; - if (params->config_type == RECORD_CONFIG_TYPE_RECORDING_CUSTOM) + if (params->preset == RECORD_CONFIG_TYPE_RECORDING_CUSTOM) { if (!ffmpeg_init_config(&handle->config, params->config)) goto error; } else - ffmpeg_init_config_common(&handle->config, params->config_type); + ffmpeg_init_config_common(&handle->config, params->preset); if (!ffmpeg_init_muxer_pre(handle)) goto error; diff --git a/record/record_driver.c b/record/record_driver.c index a6ef7af312..6f02833859 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -391,9 +391,15 @@ bool recording_init(void) else { if (streaming_is_enabled()) + { params.config = settings->paths.path_stream_config; + params.preset = settings->uints.video_stream_quality; + } else + { params.config = settings->paths.path_record_config; + params.preset = settings->uints.video_record_quality; + } } if (video_driver_supports_recording()) diff --git a/record/record_driver.h b/record/record_driver.h index 853ec5f338..400fcbe87f 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -69,7 +69,7 @@ struct record_params /* Audio channels. */ unsigned channels; - enum record_config_type config_type; + enum record_config_type preset; /* Input pixel format. */ enum ffemu_pix_format pix_fmt; From 58b7621559d548c4b5659ef17d8d5d4cc54e9157 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 23 Sep 2018 19:53:13 -0500 Subject: [PATCH 0028/1292] [record] add settings for video scale factor --- configuration.c | 2 ++ configuration.h | 2 ++ record/drivers/record_ffmpeg.c | 24 ++++++++++++++++++------ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/configuration.c b/configuration.c index 57fcafdff2..d4ec814f49 100644 --- a/configuration.c +++ b/configuration.c @@ -1621,6 +1621,8 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("video_stream_port", &settings->uints.video_stream_port, true, RARCH_STREAM_DEFAULT_PORT, false); SETTING_UINT("video_record_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, false); SETTING_UINT("video_stream_quality", &settings->uints.video_stream_quality, true, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, false); + SETTING_UINT("video_record_scale_factor", &settings->uints.video_record_scale_factor, true, 1, false); + SETTING_UINT("video_stream_scale_factor", &settings->uints.video_stream_scale_factor, true, 1, false); #endif *size = count; diff --git a/configuration.h b/configuration.h index 291e27d942..281471252b 100644 --- a/configuration.h +++ b/configuration.h @@ -390,6 +390,8 @@ typedef struct settings unsigned video_stream_port; unsigned video_record_quality; unsigned video_stream_quality; + unsigned video_record_scale_factor; + unsigned video_stream_scale_factor; unsigned menu_thumbnails; unsigned menu_left_thumbnails; diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 6c4e2b40c9..d7831962b3 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -550,13 +550,12 @@ static bool ffmpeg_init_video(ffmpeg_t *handle) static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned preset) { - char buf[256]; + settings_t *settings = config_get_ptr(); switch (preset) { case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY: - params->scale_factor = 1; params->threads = 1; params->frame_drop_ratio = 1; params->audio_enable = true; @@ -573,7 +572,6 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p break; case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY: - params->scale_factor = 1; params->threads = 1; params->frame_drop_ratio = 1; params->audio_enable = true; @@ -590,7 +588,6 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p break; case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY: - params->scale_factor = 1; params->threads = 1; params->frame_drop_ratio = 1; params->audio_enable = true; @@ -606,7 +603,6 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); break; case RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY: - params->scale_factor = 1; params->threads = 1; params->frame_drop_ratio = 1; params->audio_enable = true; @@ -622,7 +618,6 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); break; case RECORD_CONFIG_TYPE_STREAMING_NETPLAY: - params->scale_factor = 1; params->threads = 1; params->frame_drop_ratio = 1; params->audio_enable = true; @@ -642,11 +637,28 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p } if (preset <= RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY) + { + if (!settings->bools.video_gpu_record) + params->scale_factor = settings->uints.video_record_scale_factor > 0 ? + settings->uints.video_record_scale_factor : 1; + else + params->scale_factor = 1; strlcpy(params->format, "matroska", sizeof(params->format)); + } else if (preset <= RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY) + { + if (!settings->bools.video_gpu_record) + params->scale_factor = settings->uints.video_stream_scale_factor > 0 ? + settings->uints.video_stream_scale_factor : 1; + else + params->scale_factor = 1; strlcpy(params->format, "flv", sizeof(params->format)); + } else + { + params->scale_factor = 1; strlcpy(params->format, "flv", sizeof(params->format)); + } return true; } From f071460d7adaa88e53edf9c303cf1dc9ea2475d6 Mon Sep 17 00:00:00 2001 From: Yoshi Sugawara Date: Sun, 23 Sep 2018 22:45:44 -1000 Subject: [PATCH 0029/1292] use safe area to account for notch for iPhone X and adjust main view size --- ui/drivers/cocoa/cocoa_common.m | 34 ++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 8ce30fe99a..09163291c8 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -191,7 +191,7 @@ void *glkitview_init(void); { float width = 0.0f, height = 0.0f, tenpctw, tenpcth; RAScreen *screen = (__bridge RAScreen*)get_chosen_screen(); - UIInterfaceOrientation orientation = self.interfaceOrientation; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; CGRect screenSize = [screen bounds]; SEL selector = NSSelectorFromString(BOXSTRING("coordinateSpace")); @@ -212,8 +212,40 @@ void *glkitview_init(void); g_pause_indicator_view.frame = CGRectMake(tenpctw * 4.0f, 0.0f, tenpctw * 2.0f, tenpcth); [g_pause_indicator_view viewWithTag:1].frame = CGRectMake(0, 0, tenpctw * 2.0f, tenpcth); + + [self adjustViewFrameForSafeArea]; } +-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + if (@available(iOS 11, *)) { + [coordinator animateAlongsideTransition:^(id _Nonnull context) { + [self adjustViewFrameForSafeArea]; + } completion:^(id _Nonnull context) { + }]; + } +} + +-(void)adjustViewFrameForSafeArea { + // This is for adjusting the view frame to account for the notch in iPhone X phones + if (@available(iOS 11, *)) { + RAScreen *screen = (__bridge RAScreen*)get_chosen_screen(); + CGRect screenSize = [screen bounds]; + UIEdgeInsets inset = [[UIApplication sharedApplication] delegate].window.safeAreaInsets; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; + CGRect newFrame = screenSize; + if ( orientation == UIInterfaceOrientationPortrait ) { + newFrame = CGRectMake(screenSize.origin.x, screenSize.origin.y + inset.top, screenSize.size.width, screenSize.size.height - inset.top); + } else if ( orientation == UIInterfaceOrientationLandscapeLeft ) { + newFrame = CGRectMake(screenSize.origin.x, screenSize.origin.y, screenSize.size.width - inset.right, screenSize.size.height); + } else if ( orientation == UIInterfaceOrientationLandscapeRight ) { + newFrame = CGRectMake(screenSize.origin.x + inset.left, screenSize.origin.y, screenSize.size.width - inset.left, screenSize.size.height); + } + self.view.frame = newFrame; + } +} + + #define ALMOST_INVISIBLE (.021f) - (void)hidePauseButton From 393d15ee0d5a7b8d776081ebb873cc18cb319319 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 11:53:02 +0200 Subject: [PATCH 0030/1292] Update CHANGES.md --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 1e1788554a..c1e71cad06 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,10 +4,12 @@ - CRT: New porches and interlaced bug fix. - COMMON: Support for "OEM-102" key (usually '\' on Euro keyboards). - DISCORD: Add 'Ask To Join' Feature. +- IOS: Use safe area to account for notch for iPhone X and adjust main view. - LOCALIZATION: Update Portuguese / Brazilian translation. - LOCALIZATION: Update Japanese translation. - LOCALIZATION: Update Polish translation. - LOCALIZATION: Update Spanish translation. +- MENU: Add dropdown lists for many settings. - MENU/QT/WIMP: Add option to filter extensions inside archives when adding to a playlist. - MENU/QT/WIMP: Rename playlist entries with 2 single clicks. - MENU/QT/WIMP: Fix shader parameter checkboxes not working From a0e550911ad2c6b0bad50f9d8e2613f3367c09f2 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 11:53:33 +0200 Subject: [PATCH 0031/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index c1e71cad06..f6353d7f91 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ - SWITCH: Merging of RetroNX Nintendo Switch port, based on libnx SDK. - VULKAN: Fix race condition in threaded mailbox emulation. - VULKAN: Maintenance fixes. +- WIIU: Fix menu lag when built with DevKitPro r32. # 1.7.4 - ANDROID: Add sustained performance mode, can be turned on/off in Power Management settings menu. From 66dcf0f6f73dba7e4fcfbfa65447265f59bb1b09 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 11:54:18 +0200 Subject: [PATCH 0032/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index f6353d7f91..1232d03520 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ - CAMERA: Fix Video4Linux2 driver that broke years ago. - CHEEVOS: Support headerless NES hashing. - CRT: New porches and interlaced bug fix. +- CRT: New functionality, ability to switch between 15KHz and 31KHz, etc. - COMMON: Support for "OEM-102" key (usually '\' on Euro keyboards). - DISCORD: Add 'Ask To Join' Feature. - IOS: Use safe area to account for notch for iPhone X and adjust main view. From 72cf259d49bf9b67af0ee3044fe17c180b830c41 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 11:55:05 +0200 Subject: [PATCH 0033/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 1232d03520..281e05184c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ - NETPLAY: Save lobby details received back from server after first announcement. - OPENGL/GLX: Implement Adaptive VSync - GLX_EXT_swap_control_tear. - OPENGL/WGL: Implement Adaptive VSync - WGL_EXT_swap_control_tear. +- RUNAHEAD: Fix performance degradation that could happen over time (after approx. 30 mins). Fixed input IDs outside of range 0-35 causing slow performance in runahead. - SWITCH: Merging of RetroNX Nintendo Switch port, based on libnx SDK. - VULKAN: Fix race condition in threaded mailbox emulation. - VULKAN: Maintenance fixes. From dc83e1162a5f6bd93bcd7f5559d38dcd117979cf Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 11:55:40 +0200 Subject: [PATCH 0034/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 281e05184c..fd66a1e2a2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,7 @@ - LOCALIZATION: Update Polish translation. - LOCALIZATION: Update Spanish translation. - MENU: Add dropdown lists for many settings. +- MENU: Fix crash that could happen when changing core's options on Android. - MENU/QT/WIMP: Add option to filter extensions inside archives when adding to a playlist. - MENU/QT/WIMP: Rename playlist entries with 2 single clicks. - MENU/QT/WIMP: Fix shader parameter checkboxes not working From 70f5f49c33e00bdf11bdb94257d4fa36cbb80eec Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 11:56:35 +0200 Subject: [PATCH 0035/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index fd66a1e2a2..2676e079c2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ # 1.7.5 (future) - CAMERA: Fix Video4Linux2 driver that broke years ago. +- CHEATS: Add support for Rumble when increase or decrease by the rumble value. - CHEEVOS: Support headerless NES hashing. - CRT: New porches and interlaced bug fix. - CRT: New functionality, ability to switch between 15KHz and 31KHz, etc. From 8d484568adea62b4edcef3adbee6a169efcb0200 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 13:52:26 +0200 Subject: [PATCH 0036/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 2676e079c2..4a4717f9c4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ - CAMERA: Fix Video4Linux2 driver that broke years ago. - CHEATS: Add support for Rumble when increase or decrease by the rumble value. - CHEEVOS: Support headerless NES hashing. +- CHEEVOS: Prevent loading states before achievements are fully loaded. - CRT: New porches and interlaced bug fix. - CRT: New functionality, ability to switch between 15KHz and 31KHz, etc. - COMMON: Support for "OEM-102" key (usually '\' on Euro keyboards). From 0f4f11a70c91f15778a4f03b5b71fabc12f5e0be Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 24 Sep 2018 13:59:44 +0200 Subject: [PATCH 0037/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 4a4717f9c4..8f558d5217 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ - LOCALIZATION: Update Spanish translation. - MENU: Add dropdown lists for many settings. - MENU: Fix crash that could happen when changing core's options on Android. +- MENU/QT/WIMP: Add option to rename playlists. - MENU/QT/WIMP: Add option to filter extensions inside archives when adding to a playlist. - MENU/QT/WIMP: Rename playlist entries with 2 single clicks. - MENU/QT/WIMP: Fix shader parameter checkboxes not working From 007e8dbd20580651012dcb597f01722acb6b3d66 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 24 Sep 2018 14:16:07 +0200 Subject: [PATCH 0038/1292] Add dropdown lists for cheat options --- menu/menu_setting.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 897b580f20..7897a44f51 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4059,6 +4059,7 @@ static bool setting_append_list( setting_uint_action_left_with_refresh,setting_uint_action_right_with_refresh, MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_EMU,&setting_get_string_representation_uint_as_enum, CHEAT_HANDLER_TYPE_EMU,CHEAT_HANDLER_TYPE_RETRO,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; CONFIG_STRING( list, list_info, @@ -4077,15 +4078,18 @@ static bool setting_append_list( setting_uint_action_left_with_refresh,setting_uint_action_right_with_refresh, MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_1,&setting_get_string_representation_uint_as_enum, 0,5,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.cheat_type, CHEAT_TYPE, setting_uint_action_left_default,setting_uint_action_right_default, MENU_ENUM_LABEL_CHEAT_TYPE_DISABLED,&setting_get_string_representation_uint_as_enum, CHEAT_TYPE_DISABLED,CHEAT_TYPE_RUN_NEXT_IF_GT,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.value, CHEAT_VALUE, setting_uint_action_left_default,setting_uint_action_right_default, 0,&setting_get_string_representation_hex_and_uint,0,(int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.address, CHEAT_ADDRESS, setting_uint_action_left_with_refresh,setting_uint_action_right_with_refresh, @@ -4115,15 +4119,18 @@ static bool setting_append_list( setting_uint_action_left_default,setting_uint_action_right_default, MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED,&setting_get_string_representation_uint_as_enum, RUMBLE_TYPE_DISABLED,RUMBLE_TYPE_GT_VALUE,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.rumble_value, CHEAT_RUMBLE_VALUE, setting_uint_action_left_default,setting_uint_action_right_default, 0,&setting_get_string_representation_hex_and_uint,0,(int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.rumble_port, CHEAT_RUMBLE_PORT, setting_uint_action_left_default,setting_uint_action_right_default, MENU_ENUM_LABEL_RUMBLE_PORT_0,&setting_get_string_representation_uint_as_enum, 0,16,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.rumble_primary_strength, CHEAT_RUMBLE_PRIMARY_STRENGTH, setting_uint_action_left_default,setting_uint_action_right_default, @@ -4132,6 +4139,7 @@ static bool setting_append_list( config_uint_cbs(cheat_manager_state.working_cheat.rumble_primary_duration, CHEAT_RUMBLE_PRIMARY_DURATION, setting_uint_action_left_default,setting_uint_action_right_default, 0,&setting_get_string_representation_uint,0,5000,1) ; + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.rumble_secondary_strength, CHEAT_RUMBLE_SECONDARY_STRENGTH, setting_uint_action_left_default,setting_uint_action_right_default, @@ -4140,8 +4148,7 @@ static bool setting_append_list( config_uint_cbs(cheat_manager_state.working_cheat.rumble_secondary_duration, CHEAT_RUMBLE_SECONDARY_DURATION, setting_uint_action_left_default,setting_uint_action_right_default, 0,&setting_get_string_representation_uint,0,5000,1) ; - - + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; END_SUB_GROUP(list, list_info, parent_group); END_GROUP(list, list_info, parent_group); From 384b36ac4ca42e679b25a2ddefa1e9abfc4af772 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 24 Sep 2018 14:34:43 +0200 Subject: [PATCH 0039/1292] Comment this out for now - initial implementation of dropdown list for float --- menu/cbs/menu_cbs_get_value.c | 1 + menu/cbs/menu_cbs_ok.c | 17 +++++++++++++ menu/menu_displaylist.c | 47 +++++++++++++++++++++++++++++++++++ menu/menu_driver.h | 1 + menu/menu_setting.c | 3 +++ 5 files changed, 69 insertions(+) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index d9efe59a9b..60a962f498 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1646,6 +1646,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_type( break; case MENU_SETTING_DROPDOWN_SETTING_INT_ITEM: case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM: + case MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM: case MENU_SETTING_DROPDOWN_ITEM: case MENU_SETTING_NO_ITEM: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_no_items); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 68931e30ca..c803e0d07d 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -4328,6 +4328,20 @@ static int action_ok_push_dropdown_setting_int_item(const char *path, return action_cancel_pop_default(NULL, NULL, 0, 0); } +static int action_ok_push_dropdown_setting_float_item(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(label); + rarch_setting_t *setting = menu_setting_find_enum(enum_idx); + float val = (float)atof(path); + + if (!setting) + return -1; + + *setting->value.target.fraction = (float)val; + return action_cancel_pop_default(NULL, NULL, 0, 0); +} + static int action_ok_push_dropdown_setting_uint_item(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -5420,6 +5434,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case MENU_SETTING_DROPDOWN_SETTING_INT_ITEM: BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_int_item); break; + case MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM: + BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_float_item); + break; case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM: BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_uint_item); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index a4287c11e2..f3c3d4b62b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7824,6 +7824,53 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) } } break; + case ST_FLOAT: + { + float i; + float orig_value = *setting->value.target.fraction; + unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM; + float step = setting->step; + double min = setting->enforce_minrange ? setting->min : 0.00; + double max = setting->enforce_maxrange ? setting->max : 999.00; + + if (setting->get_string_representation) + { + for (i = min; i <= max; i += step) + { + char val_s[256], val_d[256]; + + *setting->value.target.fraction = i; + + setting->get_string_representation(setting, + val_s, sizeof(val_s)); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, 0, 0); + } + + *setting->value.target.fraction = orig_value; + } + else + { + for (i = min; i <= max; i += step) + { + char val_s[16], val_d[16]; + + snprintf(val_s, sizeof(val_s), "%.2f", i); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, 0, 0); + } + } + } + break; case ST_UINT: { float i; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index ddeb8bbae2..cdd5679b3f 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -150,6 +150,7 @@ enum menu_settings_type MENU_SETTING_DROPDOWN_ITEM, MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM, MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM, + MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM, MENU_SETTING_DROPDOWN_SETTING_INT_ITEM, MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM, MENU_SETTING_NO_ITEM, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 7897a44f51..e0c04656b0 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -6309,6 +6309,9 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); +#if 0 + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; +#endif (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_float_video_msg_color; menu_settings_list_current_add_range(list, list_info, 0, 1, 1.0f/255.0f, true, true); From d5a1ce272c58b3368f4f29ec3c7c3135922a4d17 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 24 Sep 2018 15:02:12 +0200 Subject: [PATCH 0040/1292] Add dropdown lists for most float settings --- menu/menu_setting.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index e0c04656b0..a9a0a24201 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4761,6 +4761,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 1.0, 10.0, 1.0, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); CONFIG_UINT( @@ -5312,6 +5313,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, -80, 12, 1.0, true, true); CONFIG_FLOAT( @@ -5326,6 +5328,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, -80, 12, 1.0, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); @@ -5424,6 +5427,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range( list, list_info, @@ -5851,6 +5855,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0, 1.00, 0.001, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); @@ -6097,6 +6102,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_SET_FRAME_LIMIT); menu_settings_list_current_add_range(list, list_info, 0, 10, 1.0, true, true); @@ -6128,6 +6134,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 1, 10, 0.1, true, true); CONFIG_BOOL( @@ -6267,6 +6274,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 1.00, 100.00, 1.0, true, true); CONFIG_FLOAT( @@ -6281,6 +6289,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true); CONFIG_FLOAT( @@ -6295,6 +6304,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true); CONFIG_FLOAT( @@ -6416,6 +6426,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true); END_SUB_GROUP(list, list_info, parent_group); @@ -6540,6 +6551,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_OVERLAY_SET_ALPHA_MOD); menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO); @@ -6556,6 +6568,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_OVERLAY_SET_SCALE_FACTOR); menu_settings_list_current_add_range(list, list_info, 0, 2, 0.01, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO); @@ -6606,6 +6619,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.010, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); @@ -6621,6 +6635,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.010, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); } @@ -7528,6 +7543,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.010, true, true); CONFIG_FLOAT( @@ -7542,6 +7558,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.010, true, true); } #endif From 9fd580e5de6042a8f70e302132e46c81eb4990a2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 24 Sep 2018 17:03:11 +0200 Subject: [PATCH 0041/1292] Don't enable adaptive vsync by default --- config.def.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index de9215a0a5..027e8eb1d9 100644 --- a/config.def.h +++ b/config.def.h @@ -148,7 +148,7 @@ static const bool vsync = true; static const unsigned max_swapchain_images = 3; -static const bool adaptive_vsync = true; +static const bool adaptive_vsync = false; /* Attempts to hard-synchronize CPU and GPU. * Can reduce latency at cost of performance. */ From a945b7b985fcdf127a58ff75f9a9646e47b58115 Mon Sep 17 00:00:00 2001 From: waitingmoon Date: Tue, 25 Sep 2018 02:51:01 +0900 Subject: [PATCH 0042/1292] Update msg_hash_ja.h (#7284) --- intl/msg_hash_ja.h | 128 ++++++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 3e7289394f..2c8fef8385 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -16,7 +16,7 @@ MSG_HASH( "Native") MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, - "Device disconnected from port" + "デバイスがポートから切断されました" ) MSG_HASH( MSG_UNKNOWN_NETPLAY_COMMAND_RECEIVED, @@ -172,7 +172,7 @@ MSG_HASH( ) MSG_HASH( MSG_AUTOLOADING_SAVESTATE_FROM, - "Auto-loading savestate from" + "ステートセーブを自動ロード中 from" ) MSG_HASH( MSG_CAPABILITIES, @@ -180,15 +180,15 @@ MSG_HASH( ) MSG_HASH( MSG_CONNECTING_TO_NETPLAY_HOST, - "Connecting to netplay host" + "ネットプレイホストに接続中" ) MSG_HASH( MSG_CONNECTING_TO_PORT, - "Connecting to port" + "ポートに接続中" ) MSG_HASH( MSG_CONNECTION_SLOT, - "Connection slot" + "接続スロット" ) MSG_HASH( MSG_SORRY_UNIMPLEMENTED_CORES_DONT_DEMAND_CONTENT_NETPLAY, @@ -436,7 +436,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CAMERA_ALLOW, - "カメラを許す" + "カメラの使用を許可" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER, @@ -570,10 +570,10 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, - "履歴リストのサイズ" + "履歴一覧のサイズ" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, - "エントリー削除を許す") + "エントリーの削除を許可") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, "クイックメニュー" ) @@ -662,9 +662,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, "ディレクトリ") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, - "Disk Cycle Tray Status") + "ディスクトレイの開閉") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, - "Disk Image Append") + "ディスクイメージを挿入") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_INDEX, "ディスクインデックス") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, @@ -696,9 +696,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEEVOS_ENABLE, "有効") MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, - "Menu entry hover color") + "メニュー項目の選択色") MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, - "Menu entry normal color") + "メニュー項目の通常色") MSG_HASH(MENU_ENUM_LABEL_VALUE_FALSE, "偽") MSG_HASH(MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, @@ -892,9 +892,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_PLUS, "次のチートインデックス") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_TOGGLE, - "チートを切り替え") + "チートの切り替え") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_EJECT_TOGGLE, - "ディスクを取り出し") + "ディスクの取り出し") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, "次のディスクに切り替え") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, @@ -910,11 +910,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, "フルスクリーンに切り替え") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, - "マウスグラブを切り替え") + "マウスグラブの切り替え") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, - "ゲームのフォーカスを切り替え") + "ゲームのフォーカスの切り替え") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, - "デスクトップメニューを切り替え") + "デスクトップメニューに切り替え") MSG_HASH(MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE, "デスクトップメニューを有効(再起動が必要)") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, @@ -1062,7 +1062,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST, MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_STATE, "ステートロード") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_ALLOW, - "位置情報を許す") + "位置情報の使用を許可") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER, "位置情報のドライバ") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOGGING_SETTINGS, @@ -1734,7 +1734,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, "メニューバー") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, - "圧縮ファイルの読み込みに失敗しました。") + "圧縮ファイルの読み込みに失敗しました") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, "ステートロードを取り消す") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE, @@ -1778,7 +1778,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_BUILTIN_PLAYER, MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, "<このフォルダを使用>") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, - "回転を許す") + "回転を許可") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO, "コンフィグのアスペクト比") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, @@ -2040,11 +2040,11 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, MSG_HASH(MENU_ENUM_SUBLABEL_CPU_CORES, "CPUのコア数") MSG_HASH(MENU_ENUM_SUBLABEL_FPS_SHOW, - "画面で現在のフレームレートを表示する。") + "画面に現在のフレームレートを表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, "ホットキー設定を変更する。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, - "メニューに切り替えるゲームパッドのボタンコンボ") + "同時押しでメニューに切り替え") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_SETTINGS, "ゲームパッド、キーボード、マウスの設定を変更する。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, @@ -2100,7 +2100,7 @@ MSG_HASH(MSG_ADDED_TO_FAVORITES, MSG_HASH(MSG_RESET_CORE_ASSOCIATION, "プレイリストエントリーのコアの関連付けがリセットされました") MSG_HASH(MSG_APPENDED_DISK, - "ディスクを追加しました。") + "ディスクを挿入しました") MSG_HASH(MSG_APPLICATION_DIR, "アプリフォルダ") MSG_HASH(MSG_APPLYING_CHEAT, @@ -2116,9 +2116,9 @@ MSG_HASH(MSG_AUTOCONFIG_FILE_ERROR_SAVING, MSG_HASH(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY, "自動設定ファイルの保存に成功しました") MSG_HASH(MSG_AUTOSAVE_FAILED, - "Could not initialize autosave.") + "自動セーブを初期化できませんでした") MSG_HASH(MSG_AUTO_SAVE_STATE_TO, - "Auto save state to") + "自動ステートセーブ to") MSG_HASH(MSG_BLOCKING_SRAM_OVERWRITE, "Blocking SRAM Overwrite") MSG_HASH(MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, @@ -2136,7 +2136,7 @@ MSG_HASH(MSG_COMPILED_AGAINST_API, MSG_HASH(MSG_CONFIG_DIRECTORY_NOT_SET, "Config directory not set. Cannot save new config.") MSG_HASH(MSG_CONNECTED_TO, - "Connected to") + "接続しました to") MSG_HASH(MSG_CONTENT_CRC32S_DIFFER, "Content CRC32s differ. Cannot use different games.") MSG_HASH(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, @@ -2154,7 +2154,7 @@ MSG_HASH(MSG_COULD_NOT_FIND_VALID_DATA_TRACK, MSG_HASH(MSG_COULD_NOT_OPEN_DATA_TRACK, "データトラックを開くことができませんでした") MSG_HASH(MSG_COULD_NOT_READ_CONTENT_FILE, - "コンテンツファイルの読み込みはできませんでした") + "コンテンツファイルを読み込むことができませんでした") MSG_HASH(MSG_COULD_NOT_READ_MOVIE_HEADER, "Could not read movie header.") MSG_HASH(MSG_COULD_NOT_READ_STATE_FROM_MOVIE, @@ -2164,7 +2164,7 @@ MSG_HASH(MSG_CRC32_CHECKSUM_MISMATCH, MSG_HASH(MSG_CUSTOM_TIMING_GIVEN, "Custom timing given") MSG_HASH(MSG_DECOMPRESSION_ALREADY_IN_PROGRESS, - "解凍は既に実行されています") + "解凍は既に進行中です") MSG_HASH(MSG_DECOMPRESSION_FAILED, "解凍に失敗しました") MSG_HASH(MSG_DETECTED_VIEWPORT_OF, @@ -2174,9 +2174,9 @@ MSG_HASH(MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, MSG_HASH(MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, "Disconnect device from a valid port.") MSG_HASH(MSG_DISK_CLOSED, - "閉域") + "ディスクを挿入しました") MSG_HASH(MSG_DISK_EJECTED, - "取り出された") + "ディスクを排出しました") MSG_HASH(MSG_DOWNLOADING, "ダウンロード中") MSG_HASH(MSG_DOWNLOAD_FAILED, @@ -2190,13 +2190,13 @@ MSG_HASH(MSG_ERROR_LIBRETRO_CORE_REQUIRES_SPECIAL_CONTENT, MSG_HASH(MSG_ERROR_PARSING_ARGUMENTS, "Error parsing arguments.") MSG_HASH(MSG_ERROR_SAVING_CORE_OPTIONS_FILE, - "コアの設定ファイルの保存に失敗しました。") + "コアの設定ファイルの保存に失敗しました") MSG_HASH(MSG_ERROR_SAVING_REMAP_FILE, - "リマップファイルの保存に失敗しました。") + "リマップファイルの保存に失敗しました") MSG_HASH(MSG_ERROR_REMOVING_REMAP_FILE, - "リマップファイルを削除に失敗しました。") + "リマップファイルの削除に失敗しました") MSG_HASH(MSG_ERROR_SAVING_SHADER_PRESET, - "シェーダーのプリセットを保存に失敗しました。") + "シェーダーのプリセットの保存に失敗しました") MSG_HASH(MSG_EXTERNAL_APPLICATION_DIR, "外部アプリフォルダ") MSG_HASH(MSG_EXTRACTING, @@ -2204,9 +2204,9 @@ MSG_HASH(MSG_EXTRACTING, MSG_HASH(MSG_EXTRACTING_FILE, "ファイルを解凍中") MSG_HASH(MSG_FAILED_SAVING_CONFIG_TO, - "Failed saving config to") + "コンフィグの保存に失敗しました to") MSG_HASH(MSG_FAILED_TO, - "Failed to") + "失敗しました to") MSG_HASH(MSG_FAILED_TO_ACCEPT_INCOMING_SPECTATOR, "Failed to accept incoming spectator.") MSG_HASH(MSG_FAILED_TO_ALLOCATE_MEMORY_FOR_PATCHED_CONTENT, @@ -2222,7 +2222,7 @@ MSG_HASH(MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE, MSG_HASH(MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT, "クライアントのニックネームの取得に失敗しました") MSG_HASH(MSG_FAILED_TO_LOAD, - "ロードに失敗") + "ロードに失敗しました") MSG_HASH(MSG_FAILED_TO_LOAD_CONTENT, "コンテンツのロードに失敗しました") MSG_HASH(MSG_FAILED_TO_LOAD_MOVIE_FILE, @@ -2230,7 +2230,7 @@ MSG_HASH(MSG_FAILED_TO_LOAD_MOVIE_FILE, MSG_HASH(MSG_FAILED_TO_LOAD_OVERLAY, "オーバーレイのロードに失敗しました") MSG_HASH(MSG_FAILED_TO_LOAD_STATE, - "Failed to load state from") + "ロードステートに失敗しました from") MSG_HASH(MSG_FAILED_TO_OPEN_LIBRETRO_CORE, "コアのロードに失敗しました") MSG_HASH(MSG_FAILED_TO_PATCH, @@ -2252,7 +2252,7 @@ MSG_HASH(MSG_FAILED_TO_REMOVE_TEMPORARY_FILE, MSG_HASH(MSG_FAILED_TO_SAVE_SRAM, "SRAMの保存に失敗しました") MSG_HASH(MSG_FAILED_TO_SAVE_STATE_TO, - "Failed to save state to") + "ステートセーブに失敗しました to") MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME, "ニックネームの送信に失敗しました") MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME_SIZE, @@ -2278,25 +2278,25 @@ MSG_HASH(MSG_FAILED_TO_UNDO_SAVE_STATE, MSG_HASH(MSG_FAILED_TO_UNMUTE_AUDIO, "オーディオの消音解除に失敗しました") MSG_HASH(MSG_FATAL_ERROR_RECEIVED_IN, - "Fatal error received in") + "致命的なエラーが発生しました in") MSG_HASH(MSG_FILE_NOT_FOUND, "そのようなファイルはありません。") MSG_HASH(MSG_FOUND_AUTO_SAVESTATE_IN, - "Found auto savestate in") + "自動ステートセーブが見つかりました in") MSG_HASH(MSG_FOUND_DISK_LABEL, - "Found disk label") + "ディスクラベルが見つかりました") MSG_HASH(MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, - "Found first data track on file") + "ファイルの最初のデータトラックが見つかりました") MSG_HASH(MSG_FOUND_LAST_STATE_SLOT, - "Found last state slot") + "最後のステートスロットが見つかりました") MSG_HASH(MSG_FOUND_SHADER, - "Found shader") + "シェーダーが見つかりました") MSG_HASH(MSG_FRAMES, "フレーム") MSG_HASH(MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT, "Per-Game Options: game-specific core options found at") MSG_HASH(MSG_GOT_INVALID_DISK_INDEX, - "Got invalid disk index.") + "無効なディスクインデックスです") MSG_HASH(MSG_GRAB_MOUSE_STATE, "マウスステートをグラブする") MSG_HASH(MSG_GAME_FOCUS_ON, @@ -2322,7 +2322,7 @@ MSG_HASH(MSG_INTERNAL_STORAGE, MSG_HASH(MSG_REMOVABLE_STORAGE, "リムーバブルストレージ") MSG_HASH(MSG_INVALID_NICKNAME_SIZE, - "Invalid nickname size.") + "無効なニックネームサイズです") MSG_HASH(MSG_IN_BYTES, "(バイトで)") MSG_HASH(MSG_IN_GIGABYTES, @@ -2416,17 +2416,17 @@ MSG_HASH(MSG_REWIND_INIT_FAILED, MSG_HASH(MSG_REWIND_INIT_FAILED_THREADED_AUDIO, "Implementation uses threaded audio. Cannot use rewind.") MSG_HASH(MSG_REWIND_REACHED_END, - "Reached end of rewind buffer.") + "巻き戻しバッファの終わりに達しました") MSG_HASH(MSG_SAVED_NEW_CONFIG_TO, - "Saved new config to") + "新しいコンフィグを保存しました to") MSG_HASH(MSG_SAVED_STATE_TO_SLOT, "スロット%dにステートセーブしました") MSG_HASH(MSG_SAVED_STATE_TO_SLOT_AUTO, "スロット-1 (自動)にステートセーブしました") MSG_HASH(MSG_SAVED_SUCCESSFULLY_TO, - "Saved successfully to") + "保存に成功しました to") MSG_HASH(MSG_SAVING_RAM_TYPE, - "Saving RAM type") + "RAMの種類を保存中") MSG_HASH(MSG_SAVING_STATE, "ステートセーブ中") MSG_HASH(MSG_SCANNING, @@ -2440,9 +2440,9 @@ MSG_HASH(MSG_SEVERAL_PATCHES_ARE_EXPLICITLY_DEFINED, MSG_HASH(MSG_SHADER, "シェーダー") MSG_HASH(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, - "Shader preset saved successfully.") + "シェーダーのプリセットの保存に成功しました") MSG_HASH(MSG_SKIPPING_SRAM_LOAD, - "Skipping SRAM load.") + "SRAMのロードをスキップ中") MSG_HASH(MSG_SLOW_MOTION, "スローモーション") MSG_HASH(MSG_FAST_FORWARD, @@ -2450,7 +2450,7 @@ MSG_HASH(MSG_FAST_FORWARD, MSG_HASH(MSG_SLOW_MOTION_REWIND, "スローモーション巻き戻し") MSG_HASH(MSG_SRAM_WILL_NOT_BE_SAVED, - "SRAM will not be saved.") + "SRAMはセーブされません") MSG_HASH(MSG_STARTING_MOVIE_PLAYBACK, "Starting movie playback.") MSG_HASH(MSG_STARTING_MOVIE_RECORD_TO, @@ -2729,10 +2729,10 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, "ポイントでのフォントサイズ") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, - "Hide the overlay while we are inside the menu, and show it again when exiting the menu.") + "メニュー表示中はオーバーレイを隠し、メニューを閉じたときに再表示する。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, - "Content which has been scanned will appear here." + "スキャンされたコンテンツがここに表示されます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, @@ -2904,7 +2904,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_PRESET, - "Select an overlay from the file browser." + "ファイルブラウザーからオーバーレイを選択する。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, @@ -2973,7 +2973,7 @@ MSG_HASH( MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, "ネットプレイをクライアントモードで有効にする。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, - "Disconnects an active Netplay connection.") + "アクティブなネットプレイ接続を切断する。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, "フォルダの対応ファイルをスキャンしてコレクションに追加する。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_FILE, @@ -3046,7 +3046,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, - "Manage currently configured accounts." + "現在設定されたアカウントを管理する。" ) MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_REWIND, "巻き戻しの設定を管理する。") @@ -3069,7 +3069,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, "タスクを別のスレッドで実行する。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, - "Allow the user to remove entries from collections.") + "ユーザーがコレクションからエントリーを削除できるようにする。") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, "Sets the System directory. Cores can query for this directory to load BIOSes, system-specific configs, etc.") MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_BROWSER_DIRECTORY, @@ -3168,7 +3168,7 @@ MSG_HASH( MSG_HASH(MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, "指定したフォルダにセーブファイルを保存する。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, - "指定したこのフォルダにステートセーブを保存する。") + "指定したフォルダにステートセーブを保存する。") MSG_HASH(MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, "指定したフォルダにスクリーンショットを保存する。") MSG_HASH(MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, @@ -3394,7 +3394,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, "お気に入りに追加") MSG_HASH(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION, - "コア関連をリセット") + "コアの関連付けをリセット") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, "キオスクモードを無効") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, @@ -3438,7 +3438,7 @@ MSG_HASH(MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, "自動的にコンテンツをプレイリストに追加") MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, - "Automatically scans loaded content so they appear inside playlists.") + "ロードされたコンテンツは自動的にスキャンされ、プレイリストに表示される。") MSG_HASH(MSG_SCANNING_OF_FILE_FINISHED, "ファイルのスキャンは完了しました。") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, @@ -3454,7 +3454,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, MSG_HASH(MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, "統計を表示") MSG_HASH(MENU_ENUM_SUBLABEL_STATISTICS_SHOW, - "Show onscreen technical statistics.") + "技術的な統計を画面に表示する。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_ENABLE, "Enable border filler") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, From 919a23c44281f8e2d522db4a06cd6f8d98a6eedc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 24 Sep 2018 20:06:07 +0200 Subject: [PATCH 0043/1292] Revert "Fix for #7130, take two" This reverts commit 8f40baf7ff038eb925a23abb7b924822f8e40e8e. --- menu/menu_input.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/menu/menu_input.c b/menu/menu_input.c index 4d33a9ba5e..8fdeb4f106 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -565,15 +565,10 @@ static int menu_input_pointer_post_iterate( void menu_input_post_iterate(int *ret, unsigned action) { menu_entry_t entry; - size_t selection; - menu_file_list_cbs_t *cbs; settings_t *settings = config_get_ptr(); file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); - menu_input_t *menu_input = menu_input_get_ptr(); - if (menu_input != NULL && menu_input->pointer.pressed[0]) - menu_navigation_set_selection(menu_input->pointer.ptr); - selection = menu_navigation_get_selection(); - cbs = selection_buf ? + size_t selection = menu_navigation_get_selection(); + menu_file_list_cbs_t *cbs = selection_buf ? (menu_file_list_cbs_t*)file_list_get_actiondata_at_offset(selection_buf, selection) : NULL; menu_entry_init(&entry); From a0efad3cc8c0df1db9a8005643e3948f4b5d1497 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 00:07:24 +0200 Subject: [PATCH 0044/1292] menu_cbs_select.c - String option settings were not being bound to action OK callback --- menu/cbs/menu_cbs_select.c | 1 + 1 file changed, 1 insertion(+) diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index b7b27dfc95..87880cc5b1 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -67,6 +67,7 @@ static int action_select_default(const char *path, const char *label, unsigned t case ST_UINT: case ST_SIZE: case ST_FLOAT: + case ST_STRING_OPTIONS: if (cbs->action_ok) action = MENU_ACTION_OK; else From 390cb578a945f9341e5caba2cdd2299eb8af4c98 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 01:30:47 +0200 Subject: [PATCH 0045/1292] Reimplement left/right callbacks for netplay MITM server setting --- menu/cbs/menu_cbs_left.c | 41 -------------------- menu/cbs/menu_cbs_right.c | 41 -------------------- menu/menu_setting.c | 78 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 82 deletions(-) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 82122151e9..10936aa2b6 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -599,44 +599,6 @@ static int action_left_shader_num_passes(unsigned type, const char *label, return 0; } -static int action_left_netplay_mitm_server(unsigned type, const char *label, - bool wraparound) -{ - settings_t *settings = config_get_ptr(); - int i; - bool found = false; - int list_len = ARRAY_SIZE(netplay_mitm_server_list); - - for (i = 0; i < list_len; i++) - { - /* find the currently selected server in the list */ - if (string_is_equal(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i].name)) - { - /* move to the previous one in the list, wrap around if necessary */ - if (i - 1 >= 0) - { - found = true; - strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i - 1].name, sizeof(settings->arrays.netplay_mitm_server)); - break; - } - else if (wraparound) - { - found = true; - strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[list_len - 1].name, sizeof(settings->arrays.netplay_mitm_server)); - break; - } - } - } - - if (!found) - { - /* current entry was invalid, go back to the end */ - strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[list_len - 1].name, sizeof(settings->arrays.netplay_mitm_server)); - } - - return 0; -} - static int action_left_shader_watch_for_changes(unsigned type, const char *label, bool wraparound) { @@ -803,9 +765,6 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_SHADER_DEFAULT_FILTER: BIND_ACTION_LEFT(cbs, action_left_shader_filter_default); break; - case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: - BIND_ACTION_LEFT(cbs, action_left_netplay_mitm_server); - break; case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES: BIND_ACTION_LEFT(cbs, action_left_shader_watch_for_changes); break; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index e5800e17df..6aa259e50d 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -380,44 +380,6 @@ static int action_right_shader_num_passes(unsigned type, const char *label, return 0; } -static int action_right_netplay_mitm_server(unsigned type, const char *label, - bool wraparound) -{ - settings_t *settings = config_get_ptr(); - unsigned i; - bool found = false; - unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); - - for (i = 0; i < list_len; i++) - { - /* find the currently selected server in the list */ - if (string_is_equal(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i].name)) - { - /* move to the next one in the list, wrap around if necessary */ - if (i + 1 < list_len) - { - found = true; - strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[i + 1].name, sizeof(settings->arrays.netplay_mitm_server)); - break; - } - else if (wraparound) - { - found = true; - strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[0].name, sizeof(settings->arrays.netplay_mitm_server)); - break; - } - } - } - - if (!found) - { - /* current entry was invalid, go back to the start */ - strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server_list[0].name, sizeof(settings->arrays.netplay_mitm_server)); - } - - return 0; -} - static int action_right_shader_watch_for_changes(unsigned type, const char *label, bool wraparound) { @@ -695,9 +657,6 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_SHADER_DEFAULT_FILTER: BIND_ACTION_RIGHT(cbs, action_right_shader_filter_default); break; - case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: - BIND_ACTION_RIGHT(cbs, action_right_netplay_mitm_server); - break; case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES: BIND_ACTION_RIGHT(cbs, action_right_shader_watch_for_changes); break; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a9a0a24201..2d4456d1f3 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -653,6 +653,82 @@ static int setting_uint_action_left_crt_switch_resolution_super( return 0; } +static int setting_string_action_left_netplay_mitm_server( + void *data, bool wraparound) +{ + int i; + bool found = false; + unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return -1; + + for (i = 0; i < list_len; i++) + { + /* find the currently selected server in the list */ + if (string_is_equal(setting->value.target.string, netplay_mitm_server_list[i].name)) + { + /* move to the previous one in the list, wrap around if necessary */ + if (i - 1 >= 0) + { + found = true; + strlcpy(setting->value.target.string, netplay_mitm_server_list[i - 1].name, sizeof(setting->value.target.string)); + break; + } + else if (wraparound) + { + found = true; + strlcpy(setting->value.target.string, netplay_mitm_server_list[list_len - 1].name, sizeof(setting->value.target.string)); + break; + } + } + } + + /* current entry was invalid, go back to the end */ + if (!found) + strlcpy(setting->value.target.string, netplay_mitm_server_list[list_len - 1].name, sizeof(setting->value.target.string)); + + return 0; +} + +static int setting_string_action_right_netplay_mitm_server( + void *data, bool wraparound) +{ + unsigned i; + bool found = false; + unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return -1; + + for (i = 0; i < list_len; i++) + { + /* find the currently selected server in the list */ + if (string_is_equal(setting->value.target.string, netplay_mitm_server_list[i].name)) + { + /* move to the next one in the list, wrap around if necessary */ + if (i + 1 < list_len) + { + found = true; + strlcpy(setting->value.target.string, netplay_mitm_server_list[i + 1].name, sizeof(setting->value.target.string)); + break; + } + else if (wraparound) + { + found = true; + strlcpy(setting->value.target.string, netplay_mitm_server_list[0].name, sizeof(setting->value.target.string)); + break; + } + } + } + + /* current entry was invalid, go back to the start */ + if (!found) + strlcpy(setting->value.target.string, netplay_mitm_server_list[0].name, sizeof(setting->value.target.string)); + + return 0; +} + static int setting_uint_action_right_crt_switch_resolution_super( void *data, bool wraparound) { @@ -8482,6 +8558,8 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].action_left = setting_string_action_left_netplay_mitm_server; + (*list)[list_info->index - 1].action_right = setting_string_action_right_netplay_mitm_server; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_netplay_mitm_server; From 1631577b8e1c57d0ae89fae6514980974a60498d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 01:37:15 +0200 Subject: [PATCH 0046/1292] Simplify code --- menu/menu_setting.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 2d4456d1f3..3979e956c0 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -657,6 +657,7 @@ static int setting_string_action_left_netplay_mitm_server( void *data, bool wraparound) { int i; + int offset = 0; bool found = false; unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); rarch_setting_t *setting = (rarch_setting_t*)data; @@ -671,22 +672,25 @@ static int setting_string_action_left_netplay_mitm_server( /* move to the previous one in the list, wrap around if necessary */ if (i - 1 >= 0) { - found = true; - strlcpy(setting->value.target.string, netplay_mitm_server_list[i - 1].name, sizeof(setting->value.target.string)); - break; + found = true; + offset = i - 1; } else if (wraparound) { - found = true; - strlcpy(setting->value.target.string, netplay_mitm_server_list[list_len - 1].name, sizeof(setting->value.target.string)); - break; + found = true; + offset = list_len - 1; } + + if (found) + break; } } /* current entry was invalid, go back to the end */ if (!found) - strlcpy(setting->value.target.string, netplay_mitm_server_list[list_len - 1].name, sizeof(setting->value.target.string)); + offset = list_len - 1; + + strlcpy(setting->value.target.string, netplay_mitm_server_list[offset].name, sizeof(setting->value.target.string)); return 0; } @@ -695,6 +699,7 @@ static int setting_string_action_right_netplay_mitm_server( void *data, bool wraparound) { unsigned i; + int offset = 0; bool found = false; unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); rarch_setting_t *setting = (rarch_setting_t*)data; @@ -709,22 +714,22 @@ static int setting_string_action_right_netplay_mitm_server( /* move to the next one in the list, wrap around if necessary */ if (i + 1 < list_len) { - found = true; - strlcpy(setting->value.target.string, netplay_mitm_server_list[i + 1].name, sizeof(setting->value.target.string)); - break; + offset = i + 1; + found = true; } else if (wraparound) - { found = true; - strlcpy(setting->value.target.string, netplay_mitm_server_list[0].name, sizeof(setting->value.target.string)); + + if (found) break; - } } } /* current entry was invalid, go back to the start */ if (!found) - strlcpy(setting->value.target.string, netplay_mitm_server_list[0].name, sizeof(setting->value.target.string)); + offset = 0; + + strlcpy(setting->value.target.string, netplay_mitm_server_list[offset].name, sizeof(setting->value.target.string)); return 0; } From a0e218bd44de4fab1a03c33116e6b47978321b1e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 01:49:48 +0200 Subject: [PATCH 0047/1292] Cleanups --- menu/cbs/menu_cbs_left.c | 2 +- menu/cbs/menu_cbs_right.c | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 10936aa2b6..ecb9de475a 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -413,7 +413,7 @@ static int action_left_input_desc_kbd(unsigned type, const char *label, for (key_id = 0; key_id < RARCH_MAX_KEYS - 1; key_id++) { - if(remap_id == key_descriptors[key_id].key) + if (remap_id == key_descriptors[key_id].key) break; } diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 6aa259e50d..dde4c64858 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -118,7 +118,7 @@ int action_right_input_desc_kbd(unsigned type, const char *label, for (key_id = 0; key_id < RARCH_MAX_KEYS - 1; key_id++) { - if(remap_id == key_descriptors[key_id].key) + if (remap_id == key_descriptors[key_id].key) break; } @@ -159,18 +159,10 @@ int action_right_input_desc(unsigned type, const char *label, also skip all the axes until analog remapping is implemented */ if (remap_idx != RARCH_UNMAPPED) { - if ((string_is_empty(system->input_desc_btn[user_idx][remap_idx]) && remap_idx < RARCH_CUSTOM_BIND_LIST_END) /*|| - (remap_idx >= RARCH_FIRST_CUSTOM_BIND && remap_idx < RARCH_CUSTOM_BIND_LIST_END)*/) + if ((string_is_empty(system->input_desc_btn[user_idx][remap_idx]) && remap_idx < RARCH_CUSTOM_BIND_LIST_END)) action_right_input_desc(type, label, wraparound); } -#if 0 - int i = 0; - //RARCH_LOG("[remap-debug] new descriptor for %d: %s\n", remap_idx, system->input_desc_btn[user_idx][remap_idx]); - for (i = 0; i < RARCH_ANALOG_BIND_LIST_END; i++) - RARCH_LOG("[remap-debug]: user %d button %d new id %d\n", user_idx, i, settings->uints.input_remap_ids[user_idx][i]); -#endif - return 0; } From 50bb491ba237342d18a2db9f8dd060c5f7fbdf3c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 14:45:55 +0200 Subject: [PATCH 0048/1292] Bind driver settings action OK callback to dropdown list --- menu/cbs/menu_cbs_select.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 87880cc5b1..34aa9dddd6 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -115,12 +115,6 @@ static int action_select_path_use_directory(const char *path, return action_ok_path_use_directory(path, label, type, idx, 0 /* unused */); } -static int action_select_driver_setting(const char *path, const char *label, unsigned type, - size_t idx) -{ - return bind_right_generic(type, label, true); -} - static int action_select_core_setting(const char *path, const char *label, unsigned type, size_t idx) { @@ -269,17 +263,6 @@ int menu_cbs_init_bind_select(menu_file_list_cbs_t *cbs, } #endif - if (cbs->setting) - { - uint64_t flags = cbs->setting->flags; - - if (flags & SD_FLAG_IS_DRIVER) - { - BIND_ACTION_SELECT(cbs, action_select_driver_setting); - return 0; - } - } - if ((type >= MENU_SETTINGS_CORE_OPTION_START)) { BIND_ACTION_SELECT(cbs, action_select_core_setting); From 8a43580e6b225cd2b97080ae2f7109569595dd32 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 14:47:20 +0200 Subject: [PATCH 0049/1292] Cleanups --- menu/cbs/menu_cbs_select.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 34aa9dddd6..155d6c105e 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -166,28 +166,17 @@ static int action_select_netplay_connect_room(const char *path, netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); if (netplay_room_list[idx - 3].host_method == NETPLAY_HOST_METHOD_MITM) - { snprintf(tmp_hostname, sizeof(tmp_hostname), "%s|%d", netplay_room_list[idx - 3].mitm_address, netplay_room_list[idx - 3].mitm_port); - } else - { snprintf(tmp_hostname, sizeof(tmp_hostname), "%s|%d", netplay_room_list[idx - 3].address, netplay_room_list[idx - 3].port); - } - -#if 0 - RARCH_LOG("[lobby] connecting to: %s with game: %s/%08x\n", - tmp_hostname, - netplay_room_list[idx - 3].gamename, - netplay_room_list[idx - 3].gamecrc); -#endif task_push_netplay_crc_scan(netplay_room_list[idx - 3].gamecrc, netplay_room_list[idx - 3].gamename, From b7be322170b22b81fc82d3cbea8c807372919d32 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 15:00:29 +0200 Subject: [PATCH 0050/1292] Cleanups --- network/netplay/netplay.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/network/netplay/netplay.h b/network/netplay/netplay.h index 834ed0038b..06428696e8 100644 --- a/network/netplay/netplay.h +++ b/network/netplay/netplay.h @@ -66,7 +66,7 @@ enum rarch_netplay_ctl_state /* Preferences for sharing digital devices */ enum rarch_netplay_share_digital_preference { - RARCH_NETPLAY_SHARE_DIGITAL_NO_SHARING, + RARCH_NETPLAY_SHARE_DIGITAL_NO_SHARING = 0, RARCH_NETPLAY_SHARE_DIGITAL_NO_PREFERENCE, RARCH_NETPLAY_SHARE_DIGITAL_OR, RARCH_NETPLAY_SHARE_DIGITAL_XOR, @@ -77,7 +77,7 @@ enum rarch_netplay_share_digital_preference /* Preferences for sharing analog devices */ enum rarch_netplay_share_analog_preference { - RARCH_NETPLAY_SHARE_ANALOG_NO_SHARING, + RARCH_NETPLAY_SHARE_ANALOG_NO_SHARING = 0, RARCH_NETPLAY_SHARE_ANALOG_NO_PREFERENCE, RARCH_NETPLAY_SHARE_ANALOG_MAX, RARCH_NETPLAY_SHARE_ANALOG_AVERAGE, From 1e10ab1ab650f8eed676a2904a225c260b8b6026 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 15:18:51 +0200 Subject: [PATCH 0051/1292] Reimplement string representation for CRT Switch Resolution super --- menu/cbs/menu_cbs_get_value.c | 26 -------------------------- menu/menu_setting.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 60a962f498..6302a8a585 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -125,28 +125,6 @@ static void menu_action_setting_disp_set_label_cheevos_locked_entry( msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY), len); } -static void menu_action_setting_disp_set_label_crt_switch_resolution_super( - file_list_t* list, - unsigned *w, unsigned type, unsigned i, - const char *label, - char *s, size_t len, - const char *entry_label, - const char *path, - char *s2, size_t len2) -{ - settings_t *settings = config_get_ptr(); - *w = 19; - strlcpy(s2, path, len2); - - if (settings) - { - if (settings->uints.crt_switch_resolution_super == 0) - strlcpy(s, msg_hash_to_str(MSG_NATIVE), len); - else - snprintf(s, len, "%d", settings->uints.crt_switch_resolution_super); - } -} - static void menu_action_setting_disp_set_label_cheevos_unlocked_entry( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -1688,10 +1666,6 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, { switch (cbs->enum_idx) { - case MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_SUPER: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_crt_switch_resolution_super); - return 0; case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_cheevos_unlocked_entry); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 3979e956c0..5e49776cb9 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -627,6 +627,19 @@ static void setting_get_string_representation_int_audio_wasapi_sh_buffer_length( } #endif +static void setting_get_string_representation_crt_switch_resolution_super(void *data, + char *s, size_t len) +{ + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return; + + if (*setting->value.target.unsigned_integer == 0) + strlcpy(s, msg_hash_to_str(MSG_NATIVE), len); + else + snprintf(s, len, "%d", *setting->value.target.unsigned_integer); +} + static int setting_uint_action_left_crt_switch_resolution_super( void *data, bool wraparound) { @@ -5273,6 +5286,8 @@ static bool setting_append_list( settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); (*list)[list_info->index - 1].action_left = &setting_uint_action_left_crt_switch_resolution_super; (*list)[list_info->index - 1].action_right = &setting_uint_action_right_crt_switch_resolution_super; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_crt_switch_resolution_super; CONFIG_INT( list, list_info, From 839940b4bb2c9fa801a3901995d8492ad56a4bd8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 15:22:25 +0200 Subject: [PATCH 0052/1292] Add representation to state slot setting --- menu/cbs/menu_cbs_get_value.c | 25 ------------------------- menu/menu_setting.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 6302a8a585..921a51b623 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -751,27 +751,6 @@ static void menu_action_setting_disp_set_label_entry( strlcpy(s2, path, len2); } -static void menu_action_setting_disp_set_label_state( - file_list_t* list, - unsigned *w, unsigned type, unsigned i, - const char *label, - char *s, size_t len, - const char *entry_label, - const char *path, - char *s2, size_t len2) -{ - settings_t *settings = config_get_ptr(); - - if (!settings) - return; - - strlcpy(s2, path, len2); - *w = 16; - snprintf(s, len, "%d", settings->ints.state_slot); - if (settings->ints.state_slot == -1) - strlcat(s, " (Auto)", len); -} - static void menu_action_setting_disp_set_label_wifi_is_online( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -1366,10 +1345,6 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( case MENU_ENUM_LABEL_MENU_DRIVER: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label); break; - case MENU_ENUM_LABEL_STATE_SLOT: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_state); - break; case MENU_ENUM_LABEL_CONNECT_WIFI: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_wifi_is_online); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 5e49776cb9..25dcd64b29 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -175,6 +175,18 @@ static int setting_action_ok_uint(void *data, bool wraparound) return 0; } +static void setting_get_string_representation_state_slot(void *data, + char *s, size_t len) +{ + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return; + + snprintf(s, len, "%d", *setting->value.target.integer); + if (*setting->value.target.integer == -1) + strlcat(s, " (Auto)", len); +} + static void setting_get_string_representation_float_video_msg_color(void *data, char *s, size_t len) { @@ -2945,6 +2957,8 @@ static bool setting_append_list( general_read_handler); (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].offset_by = -1; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_state_slot; menu_settings_list_current_add_range(list, list_info, -1, 0, 1, true, false); CONFIG_ACTION( From aa89791b609674c5e7ec51865b581b1021224d3a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 15:40:16 +0200 Subject: [PATCH 0053/1292] Update --- menu/cbs/menu_cbs_get_value.c | 25 ------------------------- menu/menu_setting.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 921a51b623..069c91a1d3 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -228,27 +228,6 @@ static void menu_action_setting_disp_set_label_shader_filter_pass( } } -static void menu_action_setting_disp_set_label_filter( - file_list_t* list, - unsigned *w, unsigned type, unsigned i, - const char *label, - char *s, size_t len, - const char *entry_label, - const char *path, - char *s2, size_t len2) -{ - settings_t *settings = config_get_ptr(); - - *s = '\0'; - *w = 19; - strlcpy(s2, path, len2); - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len); - - if (settings && *settings->paths.path_softfilter_plugin) - fill_short_pathname_representation(s, - settings->paths.path_softfilter_plugin, len); -} - #ifdef HAVE_NETWORKING static void menu_action_setting_disp_set_label_netplay_mitm_server( file_list_t* list, @@ -1381,10 +1360,6 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_shader_default_filter); break; - case MENU_ENUM_LABEL_VIDEO_FILTER: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_filter); - break; case MENU_ENUM_LABEL_CONFIGURATIONS: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_configurations); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 25dcd64b29..6558f12423 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -175,6 +175,16 @@ static int setting_action_ok_uint(void *data, bool wraparound) return 0; } +static void setting_get_string_representation_video_filter(void *data, + char *s, size_t len) +{ + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return; + + fill_short_pathname_representation(s, setting->value.target.string, len); +} + static void setting_get_string_representation_state_slot(void *data, char *s, size_t len) { @@ -5252,6 +5262,8 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_video_filter; menu_settings_list_current_add_values(list, list_info, "filt"); menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_REINIT); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); From 8f2cda73887656eaaa449beee4b8edd424a1424f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 15:43:40 +0200 Subject: [PATCH 0054/1292] Cleanup --- menu/cbs/menu_cbs_get_value.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 069c91a1d3..0795677572 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -566,7 +566,7 @@ static void menu_action_setting_disp_set_label_cheat( cheat_manager_get_code_state(cheat_index) ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), - (cheat_manager_get_code(cheat_index) != NULL) + cheat_manager_get_code(cheat_index) ? cheat_manager_get_code(cheat_index) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE) ); @@ -1138,7 +1138,7 @@ static void menu_action_setting_disp_set_label_playlist_associations(file_list_t if (str_list->size != str_list2->size) break; - if (str_list2->elems[i].data == NULL) + if (!str_list2->elems[i].data) break; found_matching_core_association = true; @@ -1279,7 +1279,7 @@ static void menu_action_setting_disp_set_label_setting_string(file_list_t* list, *w = 19; - if (setting->value.target.string != NULL) + if (setting->value.target.string) strlcpy(s, setting->value.target.string, len); strlcpy(s2, path, len2); From bf5879a97fa6c4b65136907a478be2bacbc60730 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 15:57:28 +0200 Subject: [PATCH 0055/1292] (wii/PSP) Disable HAVE_LANGEXTRA - these systems are RAM-strapped --- Makefile.griffin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.griffin b/Makefile.griffin index 1e8b848e82..0249e2b8e5 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -193,7 +193,7 @@ else ifeq ($(libogc_platform), 1) RARCH_CONSOLE = 1 ifeq ($(platform), wii) - HAVE_LANGEXTRA := 1 + #HAVE_LANGEXTRA := 1 HAVE_WIIUSB_HID := 1 HAVE_RARCH_EXEC := 1 HAVE_RSOUND := 1 @@ -250,7 +250,7 @@ else ifeq ($(platform), psp1) HAVE_RBMP := 1 HAVE_RTGA := 1 HAVE_KERNEL_PRX := 1 - HAVE_LANGEXTRA := 1 + #HAVE_LANGEXTRA := 1 RARCH_CONSOLE = 1 ifeq ($(BUILD_PRX), 1) From 44a0c70c8a8af090210d3887dc03bc6a766e74b4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 16:28:36 +0200 Subject: [PATCH 0056/1292] Removed unused RARCH_MENU_CTL_REFRESH --- command.c | 5 ----- command.h | 1 - menu/menu_driver.c | 11 ----------- menu/menu_driver.h | 1 - menu/menu_setting.c | 1 - 5 files changed, 19 deletions(-) diff --git a/command.c b/command.c index fc2e978a10..3af7352fbb 100644 --- a/command.c +++ b/command.c @@ -1796,11 +1796,6 @@ bool command_event(enum event_command cmd, void *data) switch (cmd) { - case CMD_EVENT_MENU_REFRESH: -#ifdef HAVE_MENU - menu_driver_ctl(RARCH_MENU_CTL_REFRESH, NULL); -#endif - break; case CMD_EVENT_SET_PER_GAME_RESOLUTION: #if defined(GEKKO) { diff --git a/command.h b/command.h index ef1e89aa87..c7a0d020b5 100644 --- a/command.h +++ b/command.h @@ -157,7 +157,6 @@ enum event_command CMD_EVENT_MENU_PAUSE_LIBRETRO, /* Toggles menu on/off. */ CMD_EVENT_MENU_TOGGLE, - CMD_EVENT_MENU_REFRESH, /* Applies shader changes. */ CMD_EVENT_SHADERS_APPLY_CHANGES, /* A new shader preset has been loaded */ diff --git a/menu/menu_driver.c b/menu/menu_driver.c index ee57150ad9..d05085fe1c 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -2255,17 +2255,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) } } break; - case RARCH_MENU_CTL_REFRESH: - { -#if 0 - bool refresh = false; - menu_entries_ctl(MENU_ENTRIES_CTL_LIST_DEINIT, NULL); - menu_entries_ctl(MENU_ENTRIES_CTL_SETTINGS_DEINIT, NULL); - menu_entries_ctl(MENU_ENTRIES_CTL_INIT, NULL); - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); -#endif - } - break; case RARCH_MENU_CTL_LIST_SET_SELECTION: { file_list_t *list = (file_list_t*)data; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index cdd5679b3f..996a65d7de 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -87,7 +87,6 @@ enum menu_state_changes enum rarch_menu_ctl_state { RARCH_MENU_CTL_NONE = 0, - RARCH_MENU_CTL_REFRESH, RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, RARCH_MENU_CTL_SET_PENDING_QUIT, RARCH_MENU_CTL_SET_PENDING_SHUTDOWN, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 6558f12423..69f6e6a2ec 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -9105,7 +9105,6 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_uint_user_language; - menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_MENU_REFRESH); #endif END_SUB_GROUP(list, list_info, parent_group); From 7aea66677bf42fbbc937ca74c614fd4f59458bf5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Sep 2018 16:46:15 +0200 Subject: [PATCH 0057/1292] Merge menu_input.c and menu_event.c --- Makefile.common | 1 - griffin/griffin.c | 1 - menu/drivers/materialui.c | 2 +- menu/drivers/stripes.c | 6 +- menu/drivers/xmb.c | 6 +- menu/menu_driver.c | 2 +- menu/menu_event.c | 357 ------------------ menu/menu_event.h | 62 --- menu/menu_input.c | 347 ++++++++++++++++- menu/menu_input.h | 39 +- .../RetroArch_Metal.xcodeproj/project.pbxproj | 4 - retroarch.c | 2 +- 12 files changed, 378 insertions(+), 451 deletions(-) delete mode 100644 menu/menu_event.c delete mode 100644 menu/menu_event.h diff --git a/Makefile.common b/Makefile.common index 2622c46af0..fced34d6fa 100644 --- a/Makefile.common +++ b/Makefile.common @@ -722,7 +722,6 @@ ifeq ($(HAVE_MENU_COMMON), 1) OBJ += menu/menu_driver.o \ menu/menu_content.o \ menu/menu_input.o \ - menu/menu_event.o \ menu/menu_entries.o \ menu/menu_setting.o \ menu/menu_networking.o \ diff --git a/griffin/griffin.c b/griffin/griffin.c index e4e05c0096..db3870ff81 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1137,7 +1137,6 @@ MENU #ifdef HAVE_MENU #include "../menu/menu_driver.c" #include "../menu/menu_input.c" -#include "../menu/menu_event.c" #include "../menu/menu_entries.c" #include "../menu/menu_setting.c" #include "../menu/menu_cbs.c" diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 0c80afa196..c6eb0a901e 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -42,7 +42,7 @@ #include "../menu_driver.h" #include "../menu_animation.h" -#include "../menu_event.h" +#include "../menu_input.h" #include "../widgets/menu_input_dialog.h" #include "../widgets/menu_osk.h" diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index 0170c57e62..c466ed5599 100755 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -43,17 +43,17 @@ #include "../menu_driver.h" #include "../menu_animation.h" +#include "../menu_entries.h" +#include "../menu_input.h" #include "../../core_info.h" #include "../../core.h" -#include "../menu_entries.h" + #include "../widgets/menu_entry.h" #include "../widgets/menu_input_dialog.h" #include "../widgets/menu_osk.h" #include "../widgets/menu_filebrowser.h" -#include "../menu_event.h" - #include "../../verbosity.h" #include "../../configuration.h" #include "../../playlist.h" diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index db4a4141a7..86c8d2e4ef 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -43,17 +43,17 @@ #include "../menu_driver.h" #include "../menu_animation.h" +#include "../menu_entries.h" +#include "../menu_input.h" #include "../../core_info.h" #include "../../core.h" -#include "../menu_entries.h" + #include "../widgets/menu_entry.h" #include "../widgets/menu_input_dialog.h" #include "../widgets/menu_osk.h" #include "../widgets/menu_filebrowser.h" -#include "../menu_event.h" - #include "../../verbosity.h" #include "../../configuration.h" #include "../../playlist.h" diff --git a/menu/menu_driver.c b/menu/menu_driver.c index d05085fe1c..5c784bfc9b 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -46,7 +46,7 @@ #include "menu_animation.h" #include "menu_driver.h" #include "menu_cbs.h" -#include "menu_event.h" +#include "menu_input.h" #include "menu_entries.h" #include "widgets/menu_dialog.h" #include "menu_shader.h" diff --git a/menu/menu_event.c b/menu/menu_event.c deleted file mode 100644 index 9d1846d9fc..0000000000 --- a/menu/menu_event.c +++ /dev/null @@ -1,357 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2014-2017 - Jean-André Santoni - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include -#include -#include -#include - -#ifdef HAVE_CONFIG_H -#include "../config.h" -#endif - -#include - -#include "widgets/menu_input_dialog.h" -#include "widgets/menu_osk.h" - -#include "menu_driver.h" -#include "menu_animation.h" - -#include "../configuration.h" -#include "../retroarch.h" -#include "../tasks/tasks_internal.h" - -static unsigned char menu_keyboard_key_state[RETROK_LAST] = {0}; - -/* This function gets called for handling pointer events. - * - * Pointer events are touchscreen events that are spawned - * by touchpad/touchscreen. */ -static int menu_event_pointer(unsigned *action) -{ - rarch_joypad_info_t joypad_info; - int pointer_x, pointer_y; - size_t fb_pitch; - unsigned fb_width, fb_height; - const struct retro_keybind *binds[MAX_USERS] = {NULL}; - const input_driver_t *input_ptr = input_get_ptr(); - void *input_data = input_get_data(); - menu_input_t *menu_input = menu_input_get_ptr(); - int pointer_device = menu_driver_is_texture_set() - ? - RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN; - - menu_display_get_fb_size(&fb_width, &fb_height, - &fb_pitch); - - joypad_info.joy_idx = 0; - joypad_info.auto_binds = NULL; - joypad_info.axis_threshold = 0.0f; - - pointer_x = - input_ptr->input_state(input_data, joypad_info, binds, - 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X); - pointer_y = - input_ptr->input_state(input_data, joypad_info, binds, - 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y); - - menu_input->pointer.pressed[0] = input_ptr->input_state(input_data, - joypad_info, - binds, - 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_PRESSED); - menu_input->pointer.pressed[1] = input_ptr->input_state(input_data, - joypad_info, - binds, - 0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_PRESSED); - menu_input->pointer.back = input_ptr->input_state(input_data, - joypad_info, - binds, - 0, pointer_device, 0, RARCH_DEVICE_ID_POINTER_BACK); - - menu_input->pointer.x = ((pointer_x + 0x7fff) * (int)fb_width) / 0xFFFF; - menu_input->pointer.y = ((pointer_y + 0x7fff) * (int)fb_height) / 0xFFFF; - - return 0; -} - -/* Check if a specific keyboard key has been pressed. */ -unsigned char menu_event_kb_is_set(enum retro_key key) -{ - return menu_keyboard_key_state[key]; -} - -/* Set a specific keyboard key latch. */ -static void menu_event_kb_set_internal(unsigned idx, unsigned char key) -{ - menu_keyboard_key_state[idx] = key; -} - -/* Set a specific keyboard key. - * - * 'down' sets the latch (true would - * mean the key is being pressed down, while 'false' would mean that - * the key has been released). - **/ -void menu_event_kb_set(bool down, enum retro_key key) -{ - if (key == RETROK_UNKNOWN) - { - unsigned i; - - for (i = 0; i < RETROK_LAST; i++) - menu_event_kb_set_internal(i, (menu_event_kb_is_set((enum retro_key)i) & 1) << 1); - } - else - menu_event_kb_set_internal(key, ((menu_event_kb_is_set(key) & 1) << 1) | down); -} - -/* - * This function gets called in order to process all input events - * for the current frame. - * - * Sends input code to menu for one frame. - * - * It uses as input the local variables' input' and 'trigger_input'. - * - * Mouse and touch input events get processed inside this function. - * - * NOTE: 'input' and 'trigger_input' is sourced from the keyboard and/or - * the gamepad. It does not contain input state derived from the mouse - * and/or touch - this gets dealt with separately within this function. - * - * TODO/FIXME - maybe needs to be overhauled so we can send multiple - * events per frame if we want to, and we shouldn't send the - * entire button state either but do a separate event per button - * state. - */ -unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_input) -{ - menu_animation_ctx_delta_t delta; - float delta_time; - /* Used for key repeat */ - static float delay_timer = 0.0f; - static float delay_count = 0.0f; - static unsigned ok_old = 0; - unsigned ret = MENU_ACTION_NOOP; - static bool initial_held = true; - static bool first_held = false; - bool set_scroll = false; - bool mouse_enabled = false; - size_t new_scroll_accel = 0; - menu_input_t *menu_input = NULL; - settings_t *settings = config_get_ptr(); - bool swap_ok_cancel_btns = settings->bools.input_menu_swap_ok_cancel_buttons; - bool input_swap_override = - input_autoconfigure_get_swap_override(); - unsigned menu_ok_btn = (!input_swap_override && - swap_ok_cancel_btns) ? - RETRO_DEVICE_ID_JOYPAD_B : RETRO_DEVICE_ID_JOYPAD_A; - unsigned menu_cancel_btn = (!input_swap_override && - swap_ok_cancel_btns) ? - RETRO_DEVICE_ID_JOYPAD_A : RETRO_DEVICE_ID_JOYPAD_B; - unsigned ok_current = BIT256_GET_PTR(p_input, - menu_ok_btn ); - unsigned ok_trigger = ok_current & ~ok_old; - - ok_old = ok_current; - - if (bits_any_set(p_input->data, ARRAY_SIZE(p_input->data))) - { - if (!first_held) - { - /* don't run anything first frame, only capture held inputs - * for old_input_state. */ - - first_held = true; - delay_timer = initial_held ? 12 : 6; - delay_count = 0; - } - - if (delay_count >= delay_timer) - { - uint32_t input_repeat = 0; - BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_UP); - BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_DOWN); - BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_LEFT); - BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_RIGHT); - BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_L); - BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_R); - - set_scroll = true; - first_held = false; - p_trigger_input->data[0] |= p_input->data[0] & input_repeat; - - menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, - &new_scroll_accel); - - new_scroll_accel = MIN(new_scroll_accel + 1, 64); - } - - initial_held = false; - } - else - { - set_scroll = true; - first_held = false; - initial_held = true; - } - - if (set_scroll) - menu_driver_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL, - &new_scroll_accel); - - menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - - delta.current = delta_time; - - if (menu_animation_get_ideal_delta_time(&delta)) - delay_count += delta.ideal; - - if (menu_input_dialog_get_display_kb()) - { - menu_event_osk_iterate(); - - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_DOWN)) - { - if (menu_event_get_osk_ptr() < 33) - menu_event_set_osk_ptr(menu_event_get_osk_ptr() - + OSK_CHARS_PER_LINE); - } - - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_UP)) - { - if (menu_event_get_osk_ptr() >= OSK_CHARS_PER_LINE) - menu_event_set_osk_ptr(menu_event_get_osk_ptr() - - OSK_CHARS_PER_LINE); - } - - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_RIGHT)) - { - if (menu_event_get_osk_ptr() < 43) - menu_event_set_osk_ptr(menu_event_get_osk_ptr() + 1); - } - - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_LEFT)) - { - if (menu_event_get_osk_ptr() >= 1) - menu_event_set_osk_ptr(menu_event_get_osk_ptr() - 1); - } - - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L)) - { - if (menu_event_get_osk_idx() > OSK_TYPE_UNKNOWN + 1) - menu_event_set_osk_idx((enum osk_type)( - menu_event_get_osk_idx() - 1)); - else - menu_event_set_osk_idx((enum osk_type)(OSK_TYPE_LAST - 1)); - } - - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_R)) - { - if (menu_event_get_osk_idx() < OSK_TYPE_LAST - 1) - menu_event_set_osk_idx((enum osk_type)( - menu_event_get_osk_idx() + 1)); - else - menu_event_set_osk_idx((enum osk_type)(OSK_TYPE_UNKNOWN + 1)); - } - - if (BIT256_GET_PTR(p_trigger_input, menu_ok_btn)) - { - if (menu_event_get_osk_ptr() >= 0) - menu_event_osk_append(menu_event_get_osk_ptr()); - } - - if (BIT256_GET_PTR(p_trigger_input, menu_cancel_btn)) - input_keyboard_event(true, '\x7f', '\x7f', - 0, RETRO_DEVICE_KEYBOARD); - - /* send return key to close keyboard input window */ - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_START)) - input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD); - - BIT256_CLEAR_ALL_PTR(p_trigger_input); - } - else - { - if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_UP)) - ret = MENU_ACTION_UP; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_DOWN)) - ret = MENU_ACTION_DOWN; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_LEFT)) - ret = MENU_ACTION_LEFT; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_RIGHT)) - ret = MENU_ACTION_RIGHT; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L)) - ret = MENU_ACTION_SCROLL_UP; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_R)) - ret = MENU_ACTION_SCROLL_DOWN; - else if (ok_trigger) - ret = MENU_ACTION_OK; - else if (BIT256_GET_PTR(p_trigger_input, menu_cancel_btn)) - ret = MENU_ACTION_CANCEL; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_X)) - ret = MENU_ACTION_SEARCH; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_Y)) - ret = MENU_ACTION_SCAN; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_START)) - ret = MENU_ACTION_START; - else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_SELECT)) - ret = MENU_ACTION_INFO; - else if (BIT256_GET_PTR(p_trigger_input, RARCH_MENU_TOGGLE)) - ret = MENU_ACTION_TOGGLE; - } - - if (menu_event_kb_is_set(RETROK_F11)) - { - command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL); - menu_event_kb_set_internal(RETROK_F11, 0); - } - - if (BIT256_GET_PTR(p_trigger_input, RARCH_QUIT_KEY)) - return MENU_ACTION_QUIT; - - mouse_enabled = settings->bools.menu_mouse_enable; -#ifdef HAVE_OVERLAY - if (!mouse_enabled) - mouse_enabled = !(settings->bools.input_overlay_enable - && input_overlay_is_alive(overlay_ptr)); -#endif - - if (!(menu_input = menu_input_get_ptr())) - return 0; - - if (!mouse_enabled) - menu_input->mouse.ptr = 0; - - if (settings->bools.menu_pointer_enable) - menu_event_pointer(&ret); - else - { - menu_input->pointer.x = 0; - menu_input->pointer.y = 0; - menu_input->pointer.dx = 0; - menu_input->pointer.dy = 0; - menu_input->pointer.accel = 0; - menu_input->pointer.pressed[0] = false; - menu_input->pointer.pressed[1] = false; - menu_input->pointer.back = false; - menu_input->pointer.ptr = 0; - } - - return ret; -} diff --git a/menu/menu_event.h b/menu/menu_event.h deleted file mode 100644 index cae9ec381b..0000000000 --- a/menu/menu_event.h +++ /dev/null @@ -1,62 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef _MENU_EVENT_H -#define _MENU_EVENT_H - -#include -#include - -#include -#include - -RETRO_BEGIN_DECLS - -/* - * This function gets called in order to process all input events - * for the current frame. - * - * Sends input code to menu for one frame. - * - * It uses as input the local variables' input' and 'trigger_input'. - * - * Mouse and touch input events get processed inside this function. - * - * NOTE: 'input' and 'trigger_input' is sourced from the keyboard and/or - * the gamepad. It does not contain input state derived from the mouse - * and/or touch - this gets dealt with separately within this function. - * - * TODO/FIXME - maybe needs to be overhauled so we can send multiple - * events per frame if we want to, and we shouldn't send the - * entire button state either but do a separate event per button - * state. - */ -unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_state); - -/* Set a specific keyboard key. - * - * 'down' sets the latch (true would - * mean the key is being pressed down, while 'false' would mean that - * the key has been released). - **/ -void menu_event_kb_set(bool down, enum retro_key key); - -/* Check if a specific keyboard key has been pressed. */ -unsigned char menu_event_kb_is_set(enum retro_key key); - -RETRO_END_DECLS - -#endif diff --git a/menu/menu_input.c b/menu/menu_input.c index 8fdeb4f106..98d1fc9ed4 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -23,6 +23,8 @@ #include "../config.h" #endif +#include + #include "widgets/menu_input_dialog.h" #include "widgets/menu_input_bind_dialog.h" #include "widgets/menu_osk.h" @@ -30,10 +32,11 @@ #include "menu_driver.h" #include "menu_input.h" #include "menu_animation.h" -#include "menu_event.h" #include "../configuration.h" +#include "../retroarch.h" #include "../performance_counters.h" +#include "../tasks/tasks_internal.h" enum menu_mouse_action { @@ -48,15 +51,329 @@ enum menu_mouse_action MENU_MOUSE_ACTION_HORIZ_WHEEL_DOWN }; +static unsigned char menu_keyboard_key_state[RETROK_LAST] = {0}; + static unsigned mouse_old_x = 0; static unsigned mouse_old_y = 0; +static menu_input_t menu_input_state; static rarch_timer_t mouse_activity_timer = {0}; -menu_input_t *menu_input_get_ptr(void) +/* This function gets called for handling pointer events. + * + * Pointer events are touchscreen events that are spawned + * by touchpad/touchscreen. */ +static int menu_event_pointer(unsigned *action) { - static menu_input_t menu_input_state; - return &menu_input_state; + rarch_joypad_info_t joypad_info; + int pointer_x, pointer_y; + size_t fb_pitch; + unsigned fb_width, fb_height; + const struct retro_keybind *binds[MAX_USERS] = {NULL}; + const input_driver_t *input_ptr = input_get_ptr(); + void *input_data = input_get_data(); + menu_input_t *menu_input = &menu_input_state; + int pointer_device = menu_driver_is_texture_set() + ? + RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN; + + menu_display_get_fb_size(&fb_width, &fb_height, + &fb_pitch); + + joypad_info.joy_idx = 0; + joypad_info.auto_binds = NULL; + joypad_info.axis_threshold = 0.0f; + + pointer_x = + input_ptr->input_state(input_data, joypad_info, binds, + 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X); + pointer_y = + input_ptr->input_state(input_data, joypad_info, binds, + 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y); + + menu_input->pointer.pressed[0] = input_ptr->input_state(input_data, + joypad_info, + binds, + 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_PRESSED); + menu_input->pointer.pressed[1] = input_ptr->input_state(input_data, + joypad_info, + binds, + 0, pointer_device, 1, RETRO_DEVICE_ID_POINTER_PRESSED); + menu_input->pointer.back = input_ptr->input_state(input_data, + joypad_info, + binds, + 0, pointer_device, 0, RARCH_DEVICE_ID_POINTER_BACK); + + menu_input->pointer.x = ((pointer_x + 0x7fff) * (int)fb_width) / 0xFFFF; + menu_input->pointer.y = ((pointer_y + 0x7fff) * (int)fb_height) / 0xFFFF; + + return 0; +} + +/* Check if a specific keyboard key has been pressed. */ +unsigned char menu_event_kb_is_set(enum retro_key key) +{ + return menu_keyboard_key_state[key]; +} + +/* Set a specific keyboard key latch. */ +static void menu_event_kb_set_internal(unsigned idx, unsigned char key) +{ + menu_keyboard_key_state[idx] = key; +} + +/* Set a specific keyboard key. + * + * 'down' sets the latch (true would + * mean the key is being pressed down, while 'false' would mean that + * the key has been released). + **/ +void menu_event_kb_set(bool down, enum retro_key key) +{ + if (key == RETROK_UNKNOWN) + { + unsigned i; + + for (i = 0; i < RETROK_LAST; i++) + menu_event_kb_set_internal(i, (menu_event_kb_is_set((enum retro_key)i) & 1) << 1); + } + else + menu_event_kb_set_internal(key, ((menu_event_kb_is_set(key) & 1) << 1) | down); +} + +/* + * This function gets called in order to process all input events + * for the current frame. + * + * Sends input code to menu for one frame. + * + * It uses as input the local variables' input' and 'trigger_input'. + * + * Mouse and touch input events get processed inside this function. + * + * NOTE: 'input' and 'trigger_input' is sourced from the keyboard and/or + * the gamepad. It does not contain input state derived from the mouse + * and/or touch - this gets dealt with separately within this function. + * + * TODO/FIXME - maybe needs to be overhauled so we can send multiple + * events per frame if we want to, and we shouldn't send the + * entire button state either but do a separate event per button + * state. + */ +unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_input) +{ + menu_animation_ctx_delta_t delta; + float delta_time; + /* Used for key repeat */ + static float delay_timer = 0.0f; + static float delay_count = 0.0f; + static unsigned ok_old = 0; + unsigned ret = MENU_ACTION_NOOP; + static bool initial_held = true; + static bool first_held = false; + bool set_scroll = false; + bool mouse_enabled = false; + size_t new_scroll_accel = 0; + menu_input_t *menu_input = NULL; + settings_t *settings = config_get_ptr(); + bool swap_ok_cancel_btns = settings->bools.input_menu_swap_ok_cancel_buttons; + bool input_swap_override = + input_autoconfigure_get_swap_override(); + unsigned menu_ok_btn = (!input_swap_override && + swap_ok_cancel_btns) ? + RETRO_DEVICE_ID_JOYPAD_B : RETRO_DEVICE_ID_JOYPAD_A; + unsigned menu_cancel_btn = (!input_swap_override && + swap_ok_cancel_btns) ? + RETRO_DEVICE_ID_JOYPAD_A : RETRO_DEVICE_ID_JOYPAD_B; + unsigned ok_current = BIT256_GET_PTR(p_input, + menu_ok_btn ); + unsigned ok_trigger = ok_current & ~ok_old; + + ok_old = ok_current; + + if (bits_any_set(p_input->data, ARRAY_SIZE(p_input->data))) + { + if (!first_held) + { + /* don't run anything first frame, only capture held inputs + * for old_input_state. */ + + first_held = true; + delay_timer = initial_held ? 12 : 6; + delay_count = 0; + } + + if (delay_count >= delay_timer) + { + uint32_t input_repeat = 0; + BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_UP); + BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_DOWN); + BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_LEFT); + BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_RIGHT); + BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_L); + BIT32_SET(input_repeat, RETRO_DEVICE_ID_JOYPAD_R); + + set_scroll = true; + first_held = false; + p_trigger_input->data[0] |= p_input->data[0] & input_repeat; + + menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, + &new_scroll_accel); + + new_scroll_accel = MIN(new_scroll_accel + 1, 64); + } + + initial_held = false; + } + else + { + set_scroll = true; + first_held = false; + initial_held = true; + } + + if (set_scroll) + menu_driver_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL, + &new_scroll_accel); + + menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); + + delta.current = delta_time; + + if (menu_animation_get_ideal_delta_time(&delta)) + delay_count += delta.ideal; + + if (menu_input_dialog_get_display_kb()) + { + menu_event_osk_iterate(); + + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_DOWN)) + { + if (menu_event_get_osk_ptr() < 33) + menu_event_set_osk_ptr(menu_event_get_osk_ptr() + + OSK_CHARS_PER_LINE); + } + + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_UP)) + { + if (menu_event_get_osk_ptr() >= OSK_CHARS_PER_LINE) + menu_event_set_osk_ptr(menu_event_get_osk_ptr() + - OSK_CHARS_PER_LINE); + } + + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_RIGHT)) + { + if (menu_event_get_osk_ptr() < 43) + menu_event_set_osk_ptr(menu_event_get_osk_ptr() + 1); + } + + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_LEFT)) + { + if (menu_event_get_osk_ptr() >= 1) + menu_event_set_osk_ptr(menu_event_get_osk_ptr() - 1); + } + + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L)) + { + if (menu_event_get_osk_idx() > OSK_TYPE_UNKNOWN + 1) + menu_event_set_osk_idx((enum osk_type)( + menu_event_get_osk_idx() - 1)); + else + menu_event_set_osk_idx((enum osk_type)(OSK_TYPE_LAST - 1)); + } + + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_R)) + { + if (menu_event_get_osk_idx() < OSK_TYPE_LAST - 1) + menu_event_set_osk_idx((enum osk_type)( + menu_event_get_osk_idx() + 1)); + else + menu_event_set_osk_idx((enum osk_type)(OSK_TYPE_UNKNOWN + 1)); + } + + if (BIT256_GET_PTR(p_trigger_input, menu_ok_btn)) + { + if (menu_event_get_osk_ptr() >= 0) + menu_event_osk_append(menu_event_get_osk_ptr()); + } + + if (BIT256_GET_PTR(p_trigger_input, menu_cancel_btn)) + input_keyboard_event(true, '\x7f', '\x7f', + 0, RETRO_DEVICE_KEYBOARD); + + /* send return key to close keyboard input window */ + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_START)) + input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD); + + BIT256_CLEAR_ALL_PTR(p_trigger_input); + } + else + { + if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_UP)) + ret = MENU_ACTION_UP; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_DOWN)) + ret = MENU_ACTION_DOWN; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_LEFT)) + ret = MENU_ACTION_LEFT; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_RIGHT)) + ret = MENU_ACTION_RIGHT; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L)) + ret = MENU_ACTION_SCROLL_UP; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_R)) + ret = MENU_ACTION_SCROLL_DOWN; + else if (ok_trigger) + ret = MENU_ACTION_OK; + else if (BIT256_GET_PTR(p_trigger_input, menu_cancel_btn)) + ret = MENU_ACTION_CANCEL; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_X)) + ret = MENU_ACTION_SEARCH; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_Y)) + ret = MENU_ACTION_SCAN; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_START)) + ret = MENU_ACTION_START; + else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_SELECT)) + ret = MENU_ACTION_INFO; + else if (BIT256_GET_PTR(p_trigger_input, RARCH_MENU_TOGGLE)) + ret = MENU_ACTION_TOGGLE; + } + + if (menu_event_kb_is_set(RETROK_F11)) + { + command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL); + menu_event_kb_set_internal(RETROK_F11, 0); + } + + if (BIT256_GET_PTR(p_trigger_input, RARCH_QUIT_KEY)) + return MENU_ACTION_QUIT; + + mouse_enabled = settings->bools.menu_mouse_enable; +#ifdef HAVE_OVERLAY + if (!mouse_enabled) + mouse_enabled = !(settings->bools.input_overlay_enable + && input_overlay_is_alive(overlay_ptr)); +#endif + + menu_input = &menu_input_state; + + if (!mouse_enabled) + menu_input->mouse.ptr = 0; + + if (settings->bools.menu_pointer_enable) + menu_event_pointer(&ret); + else + { + menu_input->pointer.x = 0; + menu_input->pointer.y = 0; + menu_input->pointer.dx = 0; + menu_input->pointer.dy = 0; + menu_input->pointer.accel = 0; + menu_input->pointer.pressed[0] = false; + menu_input->pointer.pressed[1] = false; + menu_input->pointer.back = false; + menu_input->pointer.ptr = 0; + } + + return ret; } bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox) @@ -76,7 +393,7 @@ bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox bool menu_input_ctl(enum menu_input_ctl_state state, void *data) { static bool pointer_dragging = false; - menu_input_t *menu_input = menu_input_get_ptr(); + menu_input_t *menu_input = &menu_input_state; if (!menu_input) return false; @@ -148,7 +465,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse, { if (!mouse_oldleft) { - menu_input_t *menu_input = menu_input_get_ptr(); + menu_input_t *menu_input = &menu_input_state; size_t selection = menu_navigation_get_selection(); BIT64_SET(*input_mouse, MENU_MOUSE_ACTION_BUTTON_L); @@ -218,7 +535,7 @@ static int menu_input_mouse_frame( uint64_t mouse_state = MENU_MOUSE_ACTION_NONE; int ret = 0; settings_t *settings = config_get_ptr(); - menu_input_t *menu_input = menu_input_get_ptr(); + menu_input_t *menu_input = &menu_input_state; bool mouse_enable = settings->bools.menu_mouse_enable; if (mouse_enable) @@ -340,23 +657,23 @@ static int menu_input_mouse_frame( int16_t menu_input_pointer_state(enum menu_input_pointer_state state) { - menu_input_t *menu = menu_input_get_ptr(); + menu_input_t *menu_input = &menu_input_state; - if (!menu) + if (!menu_input) return 0; switch (state) { case MENU_POINTER_X_AXIS: - return menu->pointer.x; + return menu_input->pointer.x; case MENU_POINTER_Y_AXIS: - return menu->pointer.y; + return menu_input->pointer.y; case MENU_POINTER_DELTA_X_AXIS: - return menu->pointer.dx; + return menu_input->pointer.dx; case MENU_POINTER_DELTA_Y_AXIS: - return menu->pointer.dy; + return menu_input->pointer.dy; case MENU_POINTER_PRESSED: - return menu->pointer.pressed[0]; + return menu_input->pointer.pressed[0]; } return 0; @@ -419,7 +736,7 @@ static int menu_input_pointer_post_iterate( static int16_t pointer_old_x = 0; static int16_t pointer_old_y = 0; int ret = 0; - menu_input_t *menu_input = menu_input_get_ptr(); + menu_input_t *menu_input = &menu_input_state; settings_t *settings = config_get_ptr(); if (!menu_input || !settings) diff --git a/menu/menu_input.h b/menu/menu_input.h index 2c5694eb00..b612b0fe42 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -19,7 +19,12 @@ #define _MENU_INPUT_H #include +#include + #include +#include + +#include "../input/input_types.h" RETRO_BEGIN_DECLS @@ -108,6 +113,38 @@ typedef struct menu_input_ctx_hitbox int32_t y2; } menu_input_ctx_hitbox_t; +/* + * This function gets called in order to process all input events + * for the current frame. + * + * Sends input code to menu for one frame. + * + * It uses as input the local variables' input' and 'trigger_input'. + * + * Mouse and touch input events get processed inside this function. + * + * NOTE: 'input' and 'trigger_input' is sourced from the keyboard and/or + * the gamepad. It does not contain input state derived from the mouse + * and/or touch - this gets dealt with separately within this function. + * + * TODO/FIXME - maybe needs to be overhauled so we can send multiple + * events per frame if we want to, and we shouldn't send the + * entire button state either but do a separate event per button + * state. + */ +unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_state); + +/* Set a specific keyboard key. + * + * 'down' sets the latch (true would + * mean the key is being pressed down, while 'false' would mean that + * the key has been released). + **/ +void menu_event_kb_set(bool down, enum retro_key key); + +/* Check if a specific keyboard key has been pressed. */ +unsigned char menu_event_kb_is_set(enum retro_key key); + void menu_input_post_iterate(int *ret, unsigned action); int16_t menu_input_pointer_state(enum menu_input_pointer_state state); @@ -118,8 +155,6 @@ bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox bool menu_input_ctl(enum menu_input_ctl_state state, void *data); -menu_input_t *menu_input_get_ptr(void); - RETRO_END_DECLS #endif diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index 0fc5f86384..9599a0e8ce 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -208,7 +208,6 @@ 05A8C54120DB72F000FF7857 /* menu_cbs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = menu_cbs.c; sourceTree = ""; }; 05A8C54220DB72F000FF7857 /* menu_networking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_networking.h; sourceTree = ""; }; 05A8C54320DB72F000FF7857 /* menu_driver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_driver.h; sourceTree = ""; }; - 05A8C54420DB72F000FF7857 /* menu_event.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = menu_event.c; sourceTree = ""; }; 05A8C54520DB72F000FF7857 /* menu_entries.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = menu_entries.c; sourceTree = ""; }; 05A8C54620DB72F000FF7857 /* menu_setting.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = menu_setting.c; sourceTree = ""; }; 05A8C54720DB72F000FF7857 /* menu_input.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = menu_input.c; sourceTree = ""; }; @@ -218,7 +217,6 @@ 05A8C54B20DB72F000FF7857 /* menu_animation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_animation.h; sourceTree = ""; }; 05A8C54C20DB72F000FF7857 /* menu_cbs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_cbs.h; sourceTree = ""; }; 05A8C54D20DB72F000FF7857 /* menu_driver.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = menu_driver.c; sourceTree = ""; }; - 05A8C54E20DB72F000FF7857 /* menu_event.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_event.h; sourceTree = ""; }; 05A8C54F20DB72F000FF7857 /* menu_networking.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = menu_networking.c; sourceTree = ""; }; 05A8C55020DB72F000FF7857 /* menu_input.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_input.h; sourceTree = ""; }; 05A8C55120DB72F000FF7857 /* menu_setting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_setting.h; sourceTree = ""; }; @@ -760,8 +758,6 @@ 05A8C54320DB72F000FF7857 /* menu_driver.h */, 05A8C54520DB72F000FF7857 /* menu_entries.c */, 05A8C57020DB72F000FF7857 /* menu_entries.h */, - 05A8C54420DB72F000FF7857 /* menu_event.c */, - 05A8C54E20DB72F000FF7857 /* menu_event.h */, 05A8C54720DB72F000FF7857 /* menu_input.c */, 05A8C55020DB72F000FF7857 /* menu_input.h */, 05A8C54F20DB72F000FF7857 /* menu_networking.c */, diff --git a/retroarch.c b/retroarch.c index fed75b385c..5ad9443cd9 100644 --- a/retroarch.c +++ b/retroarch.c @@ -61,7 +61,7 @@ #ifdef HAVE_MENU #include "menu/menu_driver.h" -#include "menu/menu_event.h" +#include "menu/menu_input.h" #include "menu/widgets/menu_dialog.h" #include "menu/widgets/menu_input_dialog.h" #endif From 6ebf4b860b36cdcf20d600d2f868fbbf093395df Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 00:12:52 +0200 Subject: [PATCH 0058/1292] Buildfix --- menu/menu_setting.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 69f6e6a2ec..d81b22c303 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -688,6 +688,7 @@ static int setting_uint_action_left_crt_switch_resolution_super( return 0; } +#ifdef HAVE_NETWORKING static int setting_string_action_left_netplay_mitm_server( void *data, bool wraparound) { @@ -768,6 +769,7 @@ static int setting_string_action_right_netplay_mitm_server( return 0; } +#endif static int setting_uint_action_right_crt_switch_resolution_super( void *data, bool wraparound) From e4df100377c86c0d733b8e2d01c0c644d21d319e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 00:16:37 +0200 Subject: [PATCH 0059/1292] Don't bake in mbedtls when networking is not builtin --- Makefile.common | 2 ++ griffin/griffin.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Makefile.common b/Makefile.common index fced34d6fa..e3222a890d 100644 --- a/Makefile.common +++ b/Makefile.common @@ -399,6 +399,7 @@ ifneq ($(C89_BUILD), 1) HAVE_GTKPLUS = 0 ifeq ($(HAVE_SSL), 1) +ifeq ($(HAVE_NETWORKING), 1) DEFINES += -DHAVE_SSL ifeq ($(DEBUG), 1) @@ -485,6 +486,7 @@ OBJS_TLS = deps/mbedtls/debug.o \ OBJ += $(OBJS_TLS_CRYPTO) $(OBJS_TLS_X509) $(OBJS_TLS) endif endif +endif # Miscellaneous diff --git a/griffin/griffin.c b/griffin/griffin.c index db3870ff81..f1d699287f 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1426,6 +1426,7 @@ HTTP SERVER SSL ============================================================ */ #if defined(HAVE_SSL) +#if defined(HAVE_NETWORKING) #include "../deps/mbedtls/aes.c" #include "../deps/mbedtls/aesni.c" #include "../deps/mbedtls/arc4.c" @@ -1502,3 +1503,4 @@ SSL #include "../libretro-common/net/net_socket_ssl.c" #endif +#endif From 7ba7bc3a1d22d70fe2ecd9380804df7b766d3643 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 00:55:17 +0200 Subject: [PATCH 0060/1292] Add recording options at radius' request --- intl/msg_hash_ar.h | 16 ++++++ intl/msg_hash_chs.h | 16 ++++++ intl/msg_hash_cht.h | 16 ++++++ intl/msg_hash_de.h | 16 ++++++ intl/msg_hash_eo.h | 16 ++++++ intl/msg_hash_es.h | 16 ++++++ intl/msg_hash_fr.h | 16 ++++++ intl/msg_hash_it.h | 16 ++++++ intl/msg_hash_ja.h | 16 ++++++ intl/msg_hash_ko.h | 16 ++++++ intl/msg_hash_lbl.h | 8 +++ intl/msg_hash_nl.h | 20 ++++++- intl/msg_hash_pl.h | 16 ++++++ intl/msg_hash_pt_br.h | 16 ++++++ intl/msg_hash_pt_pt.h | 16 ++++++ intl/msg_hash_ru.h | 16 ++++++ intl/msg_hash_us.h | 16 ++++++ intl/msg_hash_vn.h | 16 ++++++ menu/menu_displaylist.c | 16 ++++++ menu/menu_setting.c | 115 ++++++++++++++++++++++++++++++++++++++++ msg_hash.h | 4 ++ 21 files changed, 417 insertions(+), 2 deletions(-) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 3637d73f59..a74f8553ab 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3623,3 +3623,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 4a896b5cd0..c87c2743a0 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3407,3 +3407,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 24b4208ee0..38087ed8bd 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3399,3 +3399,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index f09463e65e..88594fc318 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3509,3 +3509,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 8195b68ea2..719d9d8d4c 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3274,3 +3274,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index c1ce876b20..85d429f23c 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7529,3 +7529,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 3235d8b0c7..597f115585 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3433,3 +3433,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 6e7acd9573..80b507fc3c 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3493,3 +3493,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 2c8fef8385..4c4d8e2c7a 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3896,3 +3896,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "ストリーミングに切り替え" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 6ff9ba24db..58df079663 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3394,3 +3394,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index e48254fbdd..a4a2c5a3e4 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1679,3 +1679,11 @@ MSG_HASH(MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, "crt_switch_resolution_use_custom_refresh_rate") MSG_HASH(MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, "crt_switch_resolution_output_display_id") +MSG_HASH(MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, + "video_record_quality") +MSG_HASH(MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, + "video_stream_quality") +MSG_HASH(MENU_ENUM_LABEL_STREAMING_URL, + "streaming_url") +MSG_HASH(MENU_ENUM_LABEL_UDP_STREAM_PORT, + "udp_stream_port") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 467fda8d66..235bd5be1e 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3262,9 +3262,25 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, - "Stop Streaming" + "Stop Streamen" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, - "Stops streaming." + "Stop met streamen." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Opname Kwaliteit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Kwaliteit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Poort" ) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 720546a4e6..71a903dd96 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3696,3 +3696,19 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, "Zatrzymuje przesyłanie transmisji." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 45a3dc9b37..ab18f6e349 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7512,3 +7512,19 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, "Stops streaming." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 33d9c76954..1a168d0a9e 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3360,3 +3360,19 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, "Stops streaming." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 72d03d008c..5972d53397 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3563,3 +3563,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 215d584580..2820412ee8 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7550,3 +7550,19 @@ MSG_HASH( MSG_CHEEVOS_HARDCORE_MODE_DISABLED, "A savestate was loaded, Achievements Hardcore Mode disabled for the current session. Restart to enable hardcore mode." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index d04fb41909..99aa5ba5ac 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3431,3 +3431,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, "Streaming toggle" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Record Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Stream Quality" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Streaming URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "UDP Stream Port" + ) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index f3c3d4b62b..cccd8c0fa7 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7070,6 +7070,22 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_RECORD_USE_OUTPUT_DIRECTORY, PARSE_ONLY_BOOL, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_UDP_STREAM_PORT, + PARSE_ONLY_UINT, false) == 0) + count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, + PARSE_ONLY_UINT, false) == 0) + count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, + PARSE_ONLY_UINT, false) == 0) + count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_STREAMING_URL, + PARSE_ONLY_STRING, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_GPU_RECORD, PARSE_ONLY_BOOL, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index d81b22c303..bf2c295864 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -175,6 +175,59 @@ static int setting_action_ok_uint(void *data, bool wraparound) return 0; } +static void setting_get_string_representation_video_stream_quality(void *data, + char *s, size_t len) +{ + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return; + + /* TODO/FIXME - localize this */ + switch (*setting->value.target.unsigned_integer) + { + case 5: + strlcpy(s, "Custom", len); + break; + case 6: + strlcpy(s, "Low", len); + break; + case 7: + strlcpy(s, "Medium", len); + break; + case 8: + strlcpy(s, "High", len); + break; + } +} + +static void setting_get_string_representation_video_record_quality(void *data, + char *s, size_t len) +{ + rarch_setting_t *setting = (rarch_setting_t*)data; + if (!setting) + return; + + /* TODO/FIXME - localize this */ + switch (*setting->value.target.unsigned_integer) + { + case 0: + strlcpy(s, "Custom", len); + break; + case 1: + strlcpy(s, "Low", len); + break; + case 2: + strlcpy(s, "Medium", len); + break; + case 3: + strlcpy(s, "High", len); + break; + case 4: + strlcpy(s, "Lossless", len); + break; + } +} + static void setting_get_string_representation_video_filter(void *data, char *s, size_t len) { @@ -6114,6 +6167,68 @@ static bool setting_append_list( general_read_handler); menu_settings_list_current_add_values(list, list_info, "cfg"); + CONFIG_UINT( + list, list_info, + &settings->uints.video_stream_port, + MENU_ENUM_LABEL_UDP_STREAM_PORT, + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + 1, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].offset_by = 1; + menu_settings_list_current_add_range(list, list_info, 1, 65536, 1, true, true); + + CONFIG_UINT( + list, list_info, + &settings->uints.video_record_quality, + MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + 1, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_video_record_quality; + menu_settings_list_current_add_range(list, list_info, 0, 4, 1, true, true); + + CONFIG_UINT( + list, list_info, + &settings->uints.video_stream_quality, + MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + 1, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_video_stream_quality; + (*list)[list_info->index - 1].offset_by = 5; + menu_settings_list_current_add_range(list, list_info, 5, 8, 1, true, true); + + CONFIG_STRING( + list, list_info, + settings->paths.path_stream_url, + sizeof(settings->paths.path_stream_url), + MENU_ENUM_LABEL_STREAMING_URL, + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + CONFIG_DIR( list, list_info, global->record.output_dir, diff --git a/msg_hash.h b/msg_hash.h index 30038dc55a..173ba10965 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -415,6 +415,10 @@ enum msg_hash_enums MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, MSG_RUNAHEAD_FAILED_TO_LOAD_STATE, MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, + MENU_LABEL(VIDEO_RECORD_QUALITY), + MENU_LABEL(VIDEO_STREAM_QUALITY), + MENU_LABEL(STREAMING_URL), + MENU_LABEL(UDP_STREAM_PORT), MENU_LABEL(ADD_TO_MIXER), MENU_LABEL(ADD_TO_MIXER_AND_PLAY), MENU_LABEL(ADD_TO_MIXER_AND_COLLECTION), From 04cb02cec77bc46eeba391224e62fa26d802b2b0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 12:57:00 +0200 Subject: [PATCH 0061/1292] Use setting->size for size when strlcpying for string variables --- menu/cbs/menu_cbs_ok.c | 2 +- menu/menu_setting.c | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index c803e0d07d..deb062b659 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -4311,7 +4311,7 @@ static int action_ok_push_dropdown_setting_string_options_item(const char *path, return -1; strlcpy(setting->value.target.string, path, - sizeof(setting->value.target.string)); + setting->size); return action_cancel_pop_default(NULL, NULL, 0, 0); } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index bf2c295864..3137268689 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -779,7 +779,8 @@ static int setting_string_action_left_netplay_mitm_server( if (!found) offset = list_len - 1; - strlcpy(setting->value.target.string, netplay_mitm_server_list[offset].name, sizeof(setting->value.target.string)); + strlcpy(setting->value.target.string, + netplay_mitm_server_list[offset].name, setting->size); return 0; } @@ -818,7 +819,8 @@ static int setting_string_action_right_netplay_mitm_server( if (!found) offset = 0; - strlcpy(setting->value.target.string, netplay_mitm_server_list[offset].name, sizeof(setting->value.target.string)); + strlcpy(setting->value.target.string, + netplay_mitm_server_list[offset].name, setting->size); return 0; } @@ -924,7 +926,8 @@ static int setting_string_action_right_audio_device( if (audio_device_index == (signed)ptr->size) audio_device_index = 0; - strlcpy(setting->value.target.string, ptr->elems[audio_device_index].data, setting->size); + strlcpy(setting->value.target.string, + ptr->elems[audio_device_index].data, setting->size); return 0; } @@ -975,7 +978,8 @@ int setting_string_action_left_midi_input(void *data, bool wraparound) i = (int)list->size - 1; if (i >= 0) { - strlcpy(setting->value.target.string, list->elems[i].data, setting->size); + strlcpy(setting->value.target.string, + list->elems[i].data, setting->size); return 0; } } @@ -996,7 +1000,8 @@ int setting_string_action_right_midi_input(void *data, bool wraparound) i = 0; if (i >= 0 && i < (int)list->size) { - strlcpy(setting->value.target.string, list->elems[i].data, setting->size); + strlcpy(setting->value.target.string, + list->elems[i].data, setting->size); return 0; } } @@ -1017,7 +1022,8 @@ int setting_string_action_left_midi_output(void *data, bool wraparound) i = (int)list->size - 1; if (i >= 0) { - strlcpy(setting->value.target.string, list->elems[i].data, setting->size); + strlcpy(setting->value.target.string, + list->elems[i].data, setting->size); return 0; } } @@ -1038,7 +1044,8 @@ int setting_string_action_right_midi_output(void *data, bool wraparound) i = 0; if (i >= 0 && i < (int)list->size) { - strlcpy(setting->value.target.string, list->elems[i].data, setting->size); + strlcpy(setting->value.target.string, + list->elems[i].data, setting->size); return 0; } } From fb0c8161109ce5ef4c8e76c04425aa4e4cc32ff1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 14:03:29 +0200 Subject: [PATCH 0062/1292] Cleanups --- retroarch.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/retroarch.c b/retroarch.c index 5ad9443cd9..110d29298a 100644 --- a/retroarch.c +++ b/retroarch.c @@ -883,12 +883,8 @@ static void retroarch_parse_input_and_config(int argc, char *argv[]) case 'r': strlcpy(global->record.path, optarg, sizeof(global->record.path)); - { - bool recording_enabled = recording_is_enabled(); - - if (recording_enabled) - recording_set_state(true); - } + if (recording_is_enabled()) + recording_set_state(true); break; #ifdef HAVE_DYNAMIC @@ -898,9 +894,7 @@ static void retroarch_parse_input_and_config(int argc, char *argv[]) settings_t *settings = config_get_ptr(); if (rarch_first_start) - { core_set_on_cmdline = true; - } path_clear(RARCH_PATH_CORE); strlcpy(settings->paths.directory_libretro, optarg, @@ -915,9 +909,7 @@ static void retroarch_parse_input_and_config(int argc, char *argv[]) else if (filestream_exists(optarg)) { if (rarch_first_start) - { core_set_on_cmdline = true; - } rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH, optarg); retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_LIBRETRO, NULL); @@ -1939,7 +1931,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) if (settings && settings->bools.game_specific_options) ret = rarch_game_specific_options(&game_options_path); - if(ret) + if (ret) { runloop_game_options_active = true; runloop_core_options = @@ -1979,7 +1971,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) /* check if game options file was just created and flush to that file instead */ - if(!path_is_empty(RARCH_PATH_CORE_OPTIONS)) + if (!path_is_empty(RARCH_PATH_CORE_OPTIONS)) { core_option_manager_flush_game_specific(runloop_core_options, path_get(RARCH_PATH_CORE_OPTIONS)); From 5d1fff541b850dddb5b81d73a83962b14cb6ef97 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 14:22:22 +0200 Subject: [PATCH 0063/1292] Create new functions --- menu/cbs/menu_cbs_left.c | 6 +- menu/cbs/menu_cbs_right.c | 10 ++-- menu/menu_displaylist.c | 11 ++-- menu/menu_driver.c | 120 +++++++++++++++++++------------------- menu/menu_driver.h | 18 +++--- menu/menu_entries.c | 4 +- 6 files changed, 86 insertions(+), 83 deletions(-) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index ecb9de475a..e8ac23bff3 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -465,11 +465,11 @@ static int action_left_mainmenu(unsigned type, const char *label, if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return menu_cbs_exit(); - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info); + menu_driver_list_get_selection(&list_info); list_info.type = MENU_LIST_PLAIN; - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_info); + menu_driver_list_get_size(&list_info); if (list_info.size == 1) { @@ -498,7 +498,7 @@ static int action_left_mainmenu(unsigned type, const char *label, list_info.type = MENU_LIST_HORIZONTAL; list_info.action = MENU_ACTION_LEFT; - menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info); + menu_driver_list_cache(&list_info); if (cbs && cbs->action_content_list_switch) return cbs->action_content_list_switch( diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index dde4c64858..f1b3859530 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -225,7 +225,7 @@ static int action_right_goto_tab(void) list_info.type = MENU_LIST_HORIZONTAL; list_info.action = MENU_ACTION_RIGHT; - menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info); + menu_driver_list_cache(&list_info); if (cbs && cbs->action_content_list_switch) return cbs->action_content_list_switch(selection_buf, menu_stack, @@ -239,11 +239,11 @@ static int action_right_mainmenu(unsigned type, const char *label, { menu_ctx_list_t list_info; - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info); + menu_driver_list_get_selection(&list_info); list_info.type = MENU_LIST_PLAIN; - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_info); + menu_driver_list_get_size(&list_info); if (list_info.size == 1) { @@ -254,8 +254,8 @@ static int action_right_mainmenu(unsigned type, const char *label, list_horiz_info.type = MENU_LIST_HORIZONTAL; list_tabs_info.type = MENU_LIST_TABS; - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_horiz_info); - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_tabs_info); + menu_driver_list_get_size(&list_horiz_info); + menu_driver_list_get_size(&list_tabs_info); if ((list_info.selection != (list_horiz_info.size + list_tabs_info.size)) || settings->bools.menu_navigation_wraparound_enable) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index cccd8c0fa7..a99f3c4b3f 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2494,15 +2494,16 @@ static int menu_displaylist_parse_horizontal_list( playlist_t *playlist = NULL; struct item_file *item = NULL; - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info); + menu_driver_list_get_selection(&list_info); list_info.type = MENU_LIST_TABS; - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_info); + + menu_driver_list_get_size(&list_info); list_horiz_info.type = MENU_LIST_HORIZONTAL; list_horiz_info.idx = list_info.selection - (list_info.size +1); - menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_ENTRY, &list_horiz_info); + menu_driver_list_get_entry(&list_horiz_info); item = (struct item_file*)list_horiz_info.entry; @@ -7339,7 +7340,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) list_info.type = MENU_LIST_PLAIN; list_info.action = 0; - menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info); + menu_driver_list_cache(&list_info); menu_entries_append_enum(info->list, info->path, info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0); @@ -7355,7 +7356,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) list_info.type = MENU_LIST_PLAIN; list_info.action = 0; - menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info); + menu_driver_list_cache(&list_info); menu_entries_append_enum(info->list, info->path, info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 5c784bfc9b..26bf0a9f9f 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -1949,10 +1949,19 @@ bool menu_driver_iterate(menu_ctx_iterate_t *iterate) return true; } -/* Clear all the menu lists. */ -bool menu_driver_list_clear(void *data) +bool menu_driver_list_cache(menu_ctx_list_t *list) +{ + if (!list || !menu_driver_ctx || !menu_driver_ctx->list_cache) + return false; + + menu_driver_ctx->list_cache(menu_userdata, + list->type, list->action); + return true; +} + +/* Clear all the menu lists. */ +bool menu_driver_list_clear(file_list_t *list) { - file_list_t *list = (file_list_t*)data; if (!list) return false; if (menu_driver_ctx->list_clear) @@ -1960,6 +1969,18 @@ bool menu_driver_list_clear(void *data) return true; } +bool menu_driver_list_set_selection(file_list_t *list) +{ + if (!list) + return false; + + if (!menu_driver_ctx || !menu_driver_ctx->list_set_selection) + return false; + + menu_driver_ctx->list_set_selection(menu_userdata, list); + return true; +} + static void menu_update_libretro_info(void) { command_event(CMD_EVENT_CORE_INFO_INIT, NULL); @@ -2057,6 +2078,41 @@ void menu_driver_destroy(void) menu_userdata = NULL; } +bool menu_driver_list_get_entry(menu_ctx_list_t *list) +{ + if (!menu_driver_ctx || !menu_driver_ctx->list_get_entry) + { + list->entry = NULL; + return false; + } + list->entry = menu_driver_ctx->list_get_entry(menu_userdata, + list->type, (unsigned int)list->idx); + return true; +} + +bool menu_driver_list_get_selection(menu_ctx_list_t *list) +{ + if (!menu_driver_ctx || !menu_driver_ctx->list_get_selection) + { + list->selection = 0; + return false; + } + list->selection = menu_driver_ctx->list_get_selection(menu_userdata); + + return true; +} + +bool menu_driver_list_get_size(menu_ctx_list_t *list) +{ + if (!menu_driver_ctx || !menu_driver_ctx->list_get_size) + { + list->size = 0; + return false; + } + list->size = menu_driver_ctx->list_get_size(menu_userdata, list->type); + return true; +} + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { switch (state) @@ -2202,42 +2258,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) } menu_driver_data = NULL; break; - case RARCH_MENU_CTL_LIST_GET_ENTRY: - { - menu_ctx_list_t *list = (menu_ctx_list_t*)data; - - if (!menu_driver_ctx || !menu_driver_ctx->list_get_entry) - { - list->entry = NULL; - return false; - } - list->entry = menu_driver_ctx->list_get_entry(menu_userdata, - list->type, (unsigned int)list->idx); - } - break; - case RARCH_MENU_CTL_LIST_GET_SIZE: - { - menu_ctx_list_t *list = (menu_ctx_list_t*)data; - if (!menu_driver_ctx || !menu_driver_ctx->list_get_size) - { - list->size = 0; - return false; - } - list->size = menu_driver_ctx->list_get_size(menu_userdata, list->type); - } - break; - case RARCH_MENU_CTL_LIST_GET_SELECTION: - { - menu_ctx_list_t *list = (menu_ctx_list_t*)data; - - if (!menu_driver_ctx || !menu_driver_ctx->list_get_selection) - { - list->selection = 0; - return false; - } - list->selection = menu_driver_ctx->list_get_selection(menu_userdata); - } - break; case RARCH_MENU_CTL_LIST_FREE: { menu_ctx_list_t *list = (menu_ctx_list_t*)data; @@ -2255,28 +2275,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) } } break; - case RARCH_MENU_CTL_LIST_SET_SELECTION: - { - file_list_t *list = (file_list_t*)data; - - if (!list) - return false; - - if (!menu_driver_ctx || !menu_driver_ctx->list_set_selection) - return false; - - menu_driver_ctx->list_set_selection(menu_userdata, list); - } - break; - case RARCH_MENU_CTL_LIST_CACHE: - { - menu_ctx_list_t *list = (menu_ctx_list_t*)data; - if (!list || !menu_driver_ctx || !menu_driver_ctx->list_cache) - return false; - menu_driver_ctx->list_cache(menu_userdata, - list->type, list->action); - } - break; case RARCH_MENU_CTL_LIST_INSERT: { menu_ctx_list_t *list = (menu_ctx_list_t*)data; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 996a65d7de..ad16062a91 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -102,11 +102,6 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_OWNS_DRIVER, RARCH_MENU_CTL_FIND_DRIVER, RARCH_MENU_CTL_LIST_FREE, - RARCH_MENU_CTL_LIST_SET_SELECTION, - RARCH_MENU_CTL_LIST_GET_SELECTION, - RARCH_MENU_CTL_LIST_GET_SIZE, - RARCH_MENU_CTL_LIST_GET_ENTRY, - RARCH_MENU_CTL_LIST_CACHE, RARCH_MENU_CTL_LIST_INSERT, RARCH_MENU_CTL_ENVIRONMENT, RARCH_MENU_CTL_DRIVER_DATA_GET, @@ -655,7 +650,9 @@ bool menu_driver_is_alive(void); bool menu_driver_iterate(menu_ctx_iterate_t *iterate); -bool menu_driver_list_clear(void *data); +bool menu_driver_list_clear(file_list_t *list); + +bool menu_driver_list_cache(menu_ctx_list_t *list); void menu_driver_navigation_set(bool scroll); @@ -669,11 +666,18 @@ void menu_driver_set_thumbnail_system(char *s, size_t len); void menu_driver_set_thumbnail_content(char *s, size_t len); +bool menu_driver_list_set_selection(file_list_t *list); + +bool menu_driver_list_get_selection(menu_ctx_list_t *list); + +bool menu_driver_list_get_entry(menu_ctx_list_t *list); + +bool menu_driver_list_get_size(menu_ctx_list_t *list); + size_t menu_navigation_get_selection(void); void menu_navigation_set_selection(size_t val); - enum menu_toggle_reason menu_display_toggle_get_reason(void); void menu_display_toggle_set_reason(enum menu_toggle_reason reason); diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 3ac71df212..5c85e2d0e7 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -181,7 +181,7 @@ static bool menu_list_pop_stack(menu_list_t *list, list_info.action = 0; if (animate) - menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info); + menu_driver_list_cache(&list_info); if (menu_list->size != 0) { @@ -195,7 +195,7 @@ static bool menu_list_pop_stack(menu_list_t *list, } file_list_pop(menu_list, directory_ptr); - menu_driver_ctl(RARCH_MENU_CTL_LIST_SET_SELECTION, menu_list); + menu_driver_list_set_selection(menu_list); if (animate) menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); From 60d537fa32b59ab199dc80f1cd8e47581a4826ba Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 14:25:28 +0200 Subject: [PATCH 0064/1292] Create menu_driver_list_insert --- menu/menu_driver.c | 21 +++++++++++---------- menu/menu_driver.h | 3 ++- menu/menu_entries.c | 6 +++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 26bf0a9f9f..2750c973aa 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -1969,6 +1969,17 @@ bool menu_driver_list_clear(file_list_t *list) return true; } +bool menu_driver_list_insert(menu_ctx_list_t *list) +{ + if (!list || !menu_driver_ctx || !menu_driver_ctx->list_insert) + return false; + menu_driver_ctx->list_insert(menu_userdata, + list->list, list->path, list->fullpath, + list->label, list->idx, list->entry_type); + + return true; +} + bool menu_driver_list_set_selection(file_list_t *list) { if (!list) @@ -2275,16 +2286,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) } } break; - case RARCH_MENU_CTL_LIST_INSERT: - { - menu_ctx_list_t *list = (menu_ctx_list_t*)data; - if (!list || !menu_driver_ctx || !menu_driver_ctx->list_insert) - return false; - menu_driver_ctx->list_insert(menu_userdata, - list->list, list->path, list->fullpath, - list->label, list->idx, list->entry_type); - } - break; case RARCH_MENU_CTL_ENVIRONMENT: { menu_ctx_environment_t *menu_environ = diff --git a/menu/menu_driver.h b/menu/menu_driver.h index ad16062a91..0c2a7abfe3 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -102,7 +102,6 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_OWNS_DRIVER, RARCH_MENU_CTL_FIND_DRIVER, RARCH_MENU_CTL_LIST_FREE, - RARCH_MENU_CTL_LIST_INSERT, RARCH_MENU_CTL_ENVIRONMENT, RARCH_MENU_CTL_DRIVER_DATA_GET, RARCH_MENU_CTL_POINTER_TAP, @@ -666,6 +665,8 @@ void menu_driver_set_thumbnail_system(char *s, size_t len); void menu_driver_set_thumbnail_content(char *s, size_t len); +bool menu_driver_list_insert(menu_ctx_list_t *list); + bool menu_driver_list_set_selection(file_list_t *list); bool menu_driver_list_get_selection(menu_ctx_list_t *list); diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 5c85e2d0e7..4d28437d98 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -527,7 +527,7 @@ void menu_entries_append(file_list_t *list, const char *path, const char *label, list_info.idx = idx; list_info.entry_type = type; - menu_driver_ctl(RARCH_MENU_CTL_LIST_INSERT, &list_info); + menu_driver_list_insert(&list_info); if (list_info.fullpath) free(list_info.fullpath); @@ -575,7 +575,7 @@ void menu_entries_append_enum(file_list_t *list, const char *path, list_info.idx = idx; list_info.entry_type = type; - menu_driver_ctl(RARCH_MENU_CTL_LIST_INSERT, &list_info); + menu_driver_list_insert(&list_info); if (list_info.fullpath) free(list_info.fullpath); @@ -627,7 +627,7 @@ void menu_entries_prepend(file_list_t *list, const char *path, const char *label list_info.idx = idx; list_info.entry_type = type; - menu_driver_ctl(RARCH_MENU_CTL_LIST_INSERT, &list_info); + menu_driver_list_insert(&list_info); if (list_info.fullpath) free(list_info.fullpath); From 0a9eb98cc8cafd6d51cc489834c5d49145de8a39 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 15:46:27 +0200 Subject: [PATCH 0065/1292] Cleanups --- managers/cheat_manager.c | 88 +++--- managers/cheat_manager.h | 41 ++- menu/cbs/menu_cbs_left.c | 248 ---------------- menu/cbs/menu_cbs_ok.c | 114 -------- menu/menu_cbs.h | 32 --- menu/menu_setting.c | 597 ++++++++++++++++++++++++++++++--------- menu/menu_setting.h | 2 +- setting_list.c | 128 +++------ setting_list.h | 40 +-- 9 files changed, 593 insertions(+), 697 deletions(-) diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 5bf273b116..069776d5bd 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -659,51 +659,51 @@ bool cheat_manager_alloc_if_empty(void) return true; } -int cheat_manager_initialize_memory(void *data, bool wraparound) +int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) { - retro_ctx_memory_info_t meminfo ; - bool refresh = false; - bool is_search_initialization = (data != NULL) ; + retro_ctx_memory_info_t meminfo; + bool refresh = false; + bool is_search_initialization = (setting != NULL); - meminfo.id = RETRO_MEMORY_SYSTEM_RAM ; - if (! core_get_memory(&meminfo) ) + meminfo.id = RETRO_MEMORY_SYSTEM_RAM; + if (!core_get_memory(&meminfo)) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true); - return 0 ; + return 0; } - cheat_manager_state.actual_memory_size = (unsigned)meminfo.size ; - cheat_manager_state.curr_memory_buf = meminfo.data ; - cheat_manager_state.total_memory_size = (unsigned)meminfo.size ; - cheat_manager_state.num_matches = (cheat_manager_state.total_memory_size*8)/((int)pow(2,cheat_manager_state.search_bit_size)) ; + cheat_manager_state.actual_memory_size = (unsigned)meminfo.size; + cheat_manager_state.curr_memory_buf = meminfo.data; + cheat_manager_state.total_memory_size = (unsigned)meminfo.size; + cheat_manager_state.num_matches = (cheat_manager_state.total_memory_size*8)/((int)pow(2,cheat_manager_state.search_bit_size)); /* Ensure we're aligned on 4-byte boundary */ #if 0 if (meminfo.size % 4 > 0) - cheat_manager_state.total_memory_size = cheat_manager_state.total_memory_size + (4 - (meminfo.size%4)) ; + cheat_manager_state.total_memory_size = cheat_manager_state.total_memory_size + (4 - (meminfo.size%4)); #endif - if ( is_search_initialization ) + if (is_search_initialization) { cheat_manager_state.prev_memory_buf = (uint8_t*) calloc(cheat_manager_state.total_memory_size, sizeof(uint8_t)); - if (!cheat_manager_state.prev_memory_buf ) + if (!cheat_manager_state.prev_memory_buf) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true); - return 0 ; + return 0; } cheat_manager_state.matches = (uint8_t*) calloc(cheat_manager_state.total_memory_size, sizeof(uint8_t)); - if (!cheat_manager_state.matches ) + if (!cheat_manager_state.matches) { - free(cheat_manager_state.prev_memory_buf) ; - cheat_manager_state.prev_memory_buf = NULL ; + free(cheat_manager_state.prev_memory_buf); + cheat_manager_state.prev_memory_buf = NULL; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true); - return 0 ; + return 0; } - memset(cheat_manager_state.matches, 0xFF, cheat_manager_state.total_memory_size) ; + memset(cheat_manager_state.matches, 0xFF, cheat_manager_state.total_memory_size); memcpy(cheat_manager_state.prev_memory_buf, cheat_manager_state.curr_memory_buf, cheat_manager_state.actual_memory_size); - cheat_manager_state.memory_search_initialized = true ; + cheat_manager_state.memory_search_initialized = true; } - cheat_manager_state.memory_initialized = true ; + cheat_manager_state.memory_initialized = true; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_SUCCESS), 1, 180, true); @@ -716,7 +716,7 @@ int cheat_manager_initialize_memory(void *data, bool wraparound) } #endif - return 0 ; + return 0; } static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int *bytes_per_item, unsigned int *mask, unsigned int *bits) @@ -768,39 +768,39 @@ static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int * } } -int cheat_manager_search_exact(void *data, bool wraparound) +int cheat_manager_search_exact(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_EXACT) ; } -int cheat_manager_search_lt(void *data, bool wraparound) +int cheat_manager_search_lt(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_LT) ; } -int cheat_manager_search_gt(void *data, bool wraparound) +int cheat_manager_search_gt(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_GT) ; } -int cheat_manager_search_lte(void *data, bool wraparound) +int cheat_manager_search_lte(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_LTE) ; } -int cheat_manager_search_gte(void *data, bool wraparound) +int cheat_manager_search_gte(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_GTE) ; } -int cheat_manager_search_eq(void *data, bool wraparound) +int cheat_manager_search_eq(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_EQ) ; } -int cheat_manager_search_neq(void *data, bool wraparound) +int cheat_manager_search_neq(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_NEQ) ; } -int cheat_manager_search_eqplus(void *data, bool wraparound) +int cheat_manager_search_eqplus(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_EQPLUS) ; } -int cheat_manager_search_eqminus(void *data, bool wraparound) +int cheat_manager_search_eqminus(rarch_setting_t *setting, bool wraparound) { return cheat_manager_search(CHEAT_SEARCH_TYPE_EQMINUS) ; } @@ -808,15 +808,15 @@ int cheat_manager_search_eqminus(void *data, bool wraparound) int cheat_manager_search(enum cheat_search_type search_type) { char msg[100]; - unsigned char *curr = cheat_manager_state.curr_memory_buf ; - unsigned char *prev = cheat_manager_state.prev_memory_buf ; - unsigned int idx = 0 ; - unsigned int curr_val ; - unsigned int prev_val ; - unsigned int mask = 0 ; - unsigned int bytes_per_item = 1 ; - unsigned int bits = 8 ; - bool refresh = false; + unsigned char *curr = cheat_manager_state.curr_memory_buf; + unsigned char *prev = cheat_manager_state.prev_memory_buf; + unsigned int idx = 0; + unsigned int curr_val = 0; + unsigned int prev_val = 0; + unsigned int mask = 0; + unsigned int bytes_per_item = 1; + unsigned int bits = 8; + bool refresh = false; if (!cheat_manager_state.curr_memory_buf) { @@ -832,7 +832,7 @@ int cheat_manager_search(enum cheat_search_type search_type) { unsigned byte_part; - switch (bytes_per_item ) + switch (bytes_per_item) { case 2 : { @@ -1438,14 +1438,14 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig } } } -int cheat_manager_copy_match(void *data, bool wraparound) +int cheat_manager_copy_match(rarch_setting_t *setting, bool wraparound) { cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_COPY, cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ; return 0 ; } -int cheat_manager_delete_match(void *data, bool wraparound) +int cheat_manager_delete_match(rarch_setting_t *setting, bool wraparound) { bool refresh = false; cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_DELETE, diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index 3665ea62fd..a3bf6618bc 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -20,6 +20,8 @@ #include #include +#include "setting_list.h" + RETRO_BEGIN_DECLS @@ -217,24 +219,39 @@ void cheat_manager_load_game_specific_cheats(void); void cheat_manager_save_game_specific_cheats(void); -int cheat_manager_initialize_memory(void *data, bool wraparound); -int cheat_manager_search_exact(void *data, bool wraparound); -int cheat_manager_search_lt(void *data, bool wraparound); -int cheat_manager_search_gt(void *data, bool wraparound); -int cheat_manager_search_lte(void *data, bool wraparound); -int cheat_manager_search_gte(void *data, bool wraparound); -int cheat_manager_search_eq(void *data, bool wraparound); -int cheat_manager_search_neq(void *data, bool wraparound); -int cheat_manager_search_eqplus(void *data, bool wraparound); -int cheat_manager_search_eqminus(void *data, bool wraparound); +int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_exact(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_lt(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_gt(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_lte(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_gte(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_eq(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_neq(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_eqplus(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_search_eqminus(rarch_setting_t *setting, bool wraparound); + int cheat_manager_add_matches(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx); + void cheat_manager_apply_retro_cheats(void); + int cheat_manager_search(enum cheat_search_type search_type); + void cheat_manager_match_action(enum cheat_match_action_type match_action, unsigned int target_match_idx, unsigned int *address, unsigned int *address_mask, unsigned int *prev_value, unsigned int *curr_value); -int cheat_manager_copy_match(void *data, bool wraparound); -int cheat_manager_delete_match(void *data, bool wraparound); + +int cheat_manager_copy_match(rarch_setting_t *setting, bool wraparound); + +int cheat_manager_delete_match(rarch_setting_t *setting, bool wraparound); RETRO_END_DECLS #endif diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index e8ac23bff3..fe390d3f4a 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -51,254 +51,6 @@ extern struct key_desc key_descriptors[RARCH_MAX_KEYS]; -int setting_action_left_analog_dpad_mode(void *data, bool wraparound) -{ - unsigned port = 0; - rarch_setting_t *setting = (rarch_setting_t*)data; - settings_t *settings = config_get_ptr(); - - if (!setting) - return -1; - - port = setting->index_offset; - - configuration_set_uint(settings, settings->uints.input_analog_dpad_mode[port], - (settings->uints.input_analog_dpad_mode - [port] + ANALOG_DPAD_LAST - 1) % ANALOG_DPAD_LAST); - - return 0; -} - -int setting_action_left_libretro_device_type( - void *data, bool wraparound) -{ - retro_ctx_controller_info_t pad; - unsigned current_device, current_idx, i, devices[128], - types = 0, port = 0; - const struct retro_controller_info *desc = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; - rarch_system_info_t *system = NULL; - - if (!setting) - return -1; - - port = setting->index_offset; - - devices[types++] = RETRO_DEVICE_NONE; - devices[types++] = RETRO_DEVICE_JOYPAD; - - system = runloop_get_system_info(); - - if (system) - { - /* Only push RETRO_DEVICE_ANALOG as default if we use an - * older core which doesn't use SET_CONTROLLER_INFO. */ - if (!system->ports.size) - devices[types++] = RETRO_DEVICE_ANALOG; - - if (port < system->ports.size) - desc = &system->ports.data[port]; - } - - if (desc) - { - for (i = 0; i < desc->num_types; i++) - { - unsigned id = desc->types[i].id; - if (types < ARRAY_SIZE(devices) && - id != RETRO_DEVICE_NONE && - id != RETRO_DEVICE_JOYPAD) - devices[types++] = id; - } - } - - current_device = input_config_get_device(port); - current_idx = 0; - for (i = 0; i < types; i++) - { - if (current_device != devices[i]) - continue; - - current_idx = i; - break; - } - - current_device = devices - [(current_idx + types - 1) % types]; - - input_config_set_device(port, current_device); - - pad.port = port; - pad.device = current_device; - - core_set_controller_port_device(&pad); - - return 0; -} - -int setting_action_left_bind_device(void *data, bool wraparound) -{ - unsigned *p = NULL; - unsigned index_offset = 0; - unsigned max_devices = input_config_get_device_count(); - rarch_setting_t *setting = (rarch_setting_t*)data; - settings_t *settings = config_get_ptr(); - - if (!setting || max_devices == 0) - return -1; - - index_offset = setting->index_offset; - - p = &settings->uints.input_joypad_map[index_offset]; - - if ((*p) >= max_devices) - *p = max_devices - 1; - else if ((*p) > 0) - (*p)--; - - return 0; -} - -int setting_action_left_mouse_index(void *data, bool wraparound) -{ - rarch_setting_t *setting = (rarch_setting_t*)data; - settings_t *settings = config_get_ptr(); - - if (!setting) - return -1; - - if (settings->uints.input_mouse_index[setting->index_offset]) - { - --settings->uints.input_mouse_index[setting->index_offset]; - settings->modified = true; - } - - return 0; -} - -int setting_uint_action_left_custom_viewport_width( - void *data, bool wraparound) -{ - video_viewport_t vp; - struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); - video_viewport_t *custom = video_viewport_get_custom(); - settings_t *settings = config_get_ptr(); - struct retro_game_geometry *geom = (struct retro_game_geometry*) - &av_info->geometry; - - if (!settings || !av_info) - return -1; - - video_driver_get_viewport_info(&vp); - - if (custom->width <= 1) - custom->width = 1; - else if (settings->bools.video_scale_integer) - { - if (custom->width > geom->base_width) - custom->width -= geom->base_width; - } - else - custom->width -= 1; - - aspectratio_lut[ASPECT_RATIO_CUSTOM].value = - (float)custom->width / custom->height; - - return 0; -} - -int setting_uint_action_left_custom_viewport_height( - void *data, bool wraparound) -{ - video_viewport_t vp; - struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); - video_viewport_t *custom = video_viewport_get_custom(); - settings_t *settings = config_get_ptr(); - struct retro_game_geometry *geom = (struct retro_game_geometry*) - &av_info->geometry; - - if (!settings || !av_info) - return -1; - - video_driver_get_viewport_info(&vp); - - if (custom->height <= 1) - custom->height = 1; - else if (settings->bools.video_scale_integer) - { - if (custom->height > geom->base_height) - custom->height -= geom->base_height; - } - else - custom->height -= 1; - - aspectratio_lut[ASPECT_RATIO_CUSTOM].value = - (float)custom->width / custom->height; - - return 0; -} - -int setting_string_action_left_audio_device( - void *data, bool wraparound) -{ -#if !defined(RARCH_CONSOLE) - int audio_device_index; - struct string_list *ptr = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; - - if (!audio_driver_get_devices_list((void**)&ptr)) - return -1; - - if (!ptr) - return -1; - - /* Get index in the string list */ - audio_device_index = string_list_find_elem( - ptr, setting->value.target.string) - 1; - audio_device_index--; - - /* Reset index if needed */ - if (audio_device_index < 0) - audio_device_index = (int)(ptr->size - 1); - - strlcpy(setting->value.target.string, ptr->elems[audio_device_index].data, setting->size); -#endif - - return 0; -} - -int setting_string_action_left_driver(void *data, - bool wraparound) -{ - driver_ctx_info_t drv; - rarch_setting_t *setting = (rarch_setting_t*)data; - - if (!setting) - return -1; - - drv.label = setting->name; - drv.s = setting->value.target.string; - drv.len = setting->size; - - if (!driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv)) - { - settings_t *settings = config_get_ptr(); - - if (settings && settings->bools.menu_navigation_wraparound_enable) - { - drv.label = setting->name; - drv.s = setting->value.target.string; - drv.len = setting->size; - driver_ctl(RARCH_DRIVER_CTL_FIND_LAST, &drv); - } - } - - if (setting->change_handler) - setting->change_handler(setting); - - return 0; -} - static int generic_shader_action_parameter_left( struct video_shader_parameter *param, unsigned type, const char *label, bool wraparound) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index deb062b659..50793aecfe 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -141,120 +141,6 @@ static char *lakka_get_project(void) info.enum_idx = a; \ dl_type = b; -int setting_action_ok_video_refresh_rate_auto(void *data, bool wraparound) -{ - double video_refresh_rate = 0.0; - double deviation = 0.0; - unsigned sample_points = 0; - rarch_setting_t *setting = (rarch_setting_t*)data; - - if (!setting) - return -1; - - if (video_monitor_fps_statistics(&video_refresh_rate, - &deviation, &sample_points)) - { - float video_refresh_rate_float = (float)video_refresh_rate; - driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &video_refresh_rate_float); - /* Incase refresh rate update forced non-block video. */ - command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); - } - - if (setting_generic_action_ok_default(setting, wraparound) != 0) - return -1; - - return 0; -} - -int setting_action_ok_video_refresh_rate_polled(void *data, bool wraparound) -{ - rarch_setting_t *setting = (rarch_setting_t*)data; - float refresh_rate = 0.0; - - if (!setting) - return -1; - - if ((refresh_rate = video_driver_get_refresh_rate()) == 0.0) - return -1; - - driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &refresh_rate); - /* Incase refresh rate update forced non-block video. */ - command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); - - if (setting_generic_action_ok_default(setting, wraparound) != 0) - return -1; - - return 0; -} - -int setting_action_ok_bind_all(void *data, bool wraparound) -{ - (void)wraparound; - if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_ALL, data)) - return -1; - return 0; -} - -int setting_action_ok_bind_all_save_autoconfig(void *data, - bool wraparound) -{ - unsigned index_offset; - rarch_setting_t *setting = (rarch_setting_t*)data; - const char *name = NULL; - - (void)wraparound; - - if (!setting) - return -1; - - index_offset = setting->index_offset; - name = input_config_get_device_name(index_offset); - - if(!string_is_empty(name) && config_save_autoconf_profile(name, index_offset)) - runloop_msg_queue_push( - msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY), 1, 100, true); - else - runloop_msg_queue_push( - msg_hash_to_str(MSG_AUTOCONFIG_FILE_ERROR_SAVING), 1, 100, true); - - - return 0; -} - -int setting_action_ok_bind_defaults(void *data, bool wraparound) -{ - unsigned i; - menu_input_ctx_bind_limits_t lim; - struct retro_keybind *target = NULL; - const struct retro_keybind *def_binds = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; - - (void)wraparound; - - if (!setting) - return -1; - - target = &input_config_binds[setting->index_offset][0]; - def_binds = (setting->index_offset) ? - retro_keybinds_rest : retro_keybinds_1; - - lim.min = MENU_SETTINGS_BIND_BEGIN; - lim.max = MENU_SETTINGS_BIND_LAST; - - menu_input_key_bind_set_min_max(&lim); - - for (i = MENU_SETTINGS_BIND_BEGIN; - i <= MENU_SETTINGS_BIND_LAST; i++, target++) - { - target->key = def_binds[i - MENU_SETTINGS_BIND_BEGIN].key; - target->joykey = NO_BTN; - target->joyaxis = AXIS_NONE; - target->mbutton = NO_BTN; - } - - return 0; -} - static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl) { switch (lbl) diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 8c75106c0c..3126f8d2bf 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -178,38 +178,6 @@ int action_right_input_desc_kbd(unsigned type, const char *label, int action_right_cheat(unsigned type, const char *label, bool wraparound); -int setting_action_ok_video_refresh_rate_auto(void *data, bool wraparound); - -int setting_action_ok_video_refresh_rate_polled(void *data, bool wraparound); - -int setting_action_ok_bind_all(void *data, bool wraparound); - -int setting_action_ok_bind_all_save_autoconfig(void *data, - bool wraparound); - -int setting_action_ok_bind_defaults(void *data, bool wraparound); - -int setting_action_left_analog_dpad_mode(void *data, bool wraparound); - -int setting_action_left_libretro_device_type( - void *data, bool wraparound); - -int setting_action_left_bind_device(void *data, bool wraparound); - -int setting_action_left_mouse_index(void *data, bool wraparound); - -int setting_uint_action_left_custom_viewport_width( - void *data, bool wraparound); - -int setting_uint_action_left_custom_viewport_height( - void *data, bool wraparound); - -int setting_string_action_left_driver(void *data, - bool wraparound); - -int setting_string_action_left_audio_device( - void *data, bool wraparound); - /* End of function callbacks */ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 3137268689..7a3086f291 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -159,10 +159,122 @@ struct string_options_entry size_t len; }; -static int setting_action_ok_uint(void *data, bool wraparound) +static int setting_action_ok_bind_all(rarch_setting_t *setting, bool wraparound) +{ + (void)wraparound; + if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_ALL, setting)) + return -1; + return 0; +} + +static int setting_action_ok_bind_all_save_autoconfig(rarch_setting_t *setting, + bool wraparound) +{ + unsigned index_offset = 0; + const char *name = NULL; + + (void)wraparound; + + if (!setting) + return -1; + + index_offset = setting->index_offset; + name = input_config_get_device_name(index_offset); + + if(!string_is_empty(name) && config_save_autoconf_profile(name, index_offset)) + runloop_msg_queue_push( + msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY), 1, 100, true); + else + runloop_msg_queue_push( + msg_hash_to_str(MSG_AUTOCONFIG_FILE_ERROR_SAVING), 1, 100, true); + + + return 0; +} + +static int setting_action_ok_bind_defaults(rarch_setting_t *setting, bool wraparound) +{ + unsigned i; + menu_input_ctx_bind_limits_t lim; + struct retro_keybind *target = NULL; + const struct retro_keybind *def_binds = NULL; + + (void)wraparound; + + if (!setting) + return -1; + + target = &input_config_binds[setting->index_offset][0]; + def_binds = (setting->index_offset) ? + retro_keybinds_rest : retro_keybinds_1; + + lim.min = MENU_SETTINGS_BIND_BEGIN; + lim.max = MENU_SETTINGS_BIND_LAST; + + menu_input_key_bind_set_min_max(&lim); + + for (i = MENU_SETTINGS_BIND_BEGIN; + i <= MENU_SETTINGS_BIND_LAST; i++, target++) + { + target->key = def_binds[i - MENU_SETTINGS_BIND_BEGIN].key; + target->joykey = NO_BTN; + target->joyaxis = AXIS_NONE; + target->mbutton = NO_BTN; + } + + return 0; +} + +static int setting_action_ok_video_refresh_rate_auto( + rarch_setting_t *setting, bool wraparound) +{ + double video_refresh_rate = 0.0; + double deviation = 0.0; + unsigned sample_points = 0; + + if (!setting) + return -1; + + if (video_monitor_fps_statistics(&video_refresh_rate, + &deviation, &sample_points)) + { + float video_refresh_rate_float = (float)video_refresh_rate; + driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &video_refresh_rate_float); + /* Incase refresh rate update forced non-block video. */ + command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); + } + + if (setting_generic_action_ok_default(setting, wraparound) != 0) + return -1; + + return 0; +} + +static int setting_action_ok_video_refresh_rate_polled(rarch_setting_t *setting, + bool wraparound) +{ + float refresh_rate = 0.0; + + if (!setting) + return -1; + + if ((refresh_rate = video_driver_get_refresh_rate()) == 0.0) + return -1; + + driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &refresh_rate); + /* Incase refresh rate update forced non-block video. */ + command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); + + if (setting_generic_action_ok_default(setting, wraparound) != 0) + return -1; + + return 0; +} + + +static int setting_action_ok_uint(rarch_setting_t *setting, bool wraparound) { char enum_idx[16]; - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return -1; @@ -175,10 +287,10 @@ static int setting_action_ok_uint(void *data, bool wraparound) return 0; } -static void setting_get_string_representation_video_stream_quality(void *data, +static void setting_get_string_representation_video_stream_quality( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -200,10 +312,9 @@ static void setting_get_string_representation_video_stream_quality(void *data, } } -static void setting_get_string_representation_video_record_quality(void *data, +static void setting_get_string_representation_video_record_quality(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -228,20 +339,18 @@ static void setting_get_string_representation_video_record_quality(void *data, } } -static void setting_get_string_representation_video_filter(void *data, +static void setting_get_string_representation_video_filter(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; fill_short_pathname_representation(s, setting->value.target.string, len); } -static void setting_get_string_representation_state_slot(void *data, +static void setting_get_string_representation_state_slot(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -250,20 +359,18 @@ static void setting_get_string_representation_state_slot(void *data, strlcat(s, " (Auto)", len); } -static void setting_get_string_representation_float_video_msg_color(void *data, +static void setting_get_string_representation_float_video_msg_color(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; snprintf(s, len, "%d", (int)(*setting->value.target.fraction * 255.0f)); } -static void setting_get_string_representation_max_users(void *data, +static void setting_get_string_representation_max_users(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -271,10 +378,10 @@ static void setting_get_string_representation_max_users(void *data, } #ifdef HAVE_CHEEVOS -static void setting_get_string_representation_cheevos_password(void *data, +static void setting_get_string_representation_cheevos_password( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -286,10 +393,10 @@ static void setting_get_string_representation_cheevos_password(void *data, #endif #if TARGET_OS_IPHONE -static void setting_get_string_representation_uint_keyboard_gamepad_mapping_type(void *data, +static void setting_get_string_representation_uint_keyboard_gamepad_mapping_type( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -311,10 +418,10 @@ static void setting_get_string_representation_uint_keyboard_gamepad_mapping_type } #endif -static void setting_get_string_representation_uint_menu_thumbnails(void *data, +static void setting_get_string_representation_uint_menu_thumbnails( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -342,10 +449,10 @@ static void setting_get_string_representation_uint_menu_thumbnails(void *data, } } -static void setting_get_string_representation_uint_menu_left_thumbnails(void *data, +static void setting_get_string_representation_uint_menu_left_thumbnails( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -373,10 +480,10 @@ static void setting_get_string_representation_uint_menu_left_thumbnails(void *da } } -static void setting_get_string_representation_uint_xmb_icon_theme(void *data, +static void setting_get_string_representation_uint_xmb_icon_theme( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -429,10 +536,10 @@ static void setting_get_string_representation_uint_xmb_icon_theme(void *data, } } -static void setting_get_string_representation_uint_xmb_layout(void *data, +static void setting_get_string_representation_uint_xmb_layout( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -450,10 +557,10 @@ static void setting_get_string_representation_uint_xmb_layout(void *data, } } -static void setting_get_string_representation_uint_materialui_menu_color_theme(void *data, +static void setting_get_string_representation_uint_materialui_menu_color_theme( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -499,10 +606,10 @@ static void setting_get_string_representation_uint_materialui_menu_color_theme(v } } -static void setting_get_string_representation_uint_xmb_menu_color_theme(void *data, +static void setting_get_string_representation_uint_xmb_menu_color_theme( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -583,10 +690,10 @@ static void setting_get_string_representation_uint_xmb_menu_color_theme(void *da } } -static void setting_get_string_representation_uint_xmb_shader_pipeline(void *data, +static void setting_get_string_representation_uint_xmb_shader_pipeline( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -628,10 +735,9 @@ static void setting_get_string_representation_uint_xmb_shader_pipeline(void *dat } } -static void setting_get_string_representation_uint_video_monitor_index(void *data, +static void setting_get_string_representation_uint_video_monitor_index(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -642,12 +748,11 @@ static void setting_get_string_representation_uint_video_monitor_index(void *dat strlcpy(s, "0 (Auto)", len); } -static void setting_get_string_representation_uint_custom_viewport_width(void *data, +static void setting_get_string_representation_uint_custom_viewport_width(rarch_setting_t *setting, char *s, size_t len) { struct retro_game_geometry *geom = NULL; struct retro_system_av_info *av_info = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -663,12 +768,11 @@ static void setting_get_string_representation_uint_custom_viewport_width(void *d *setting->value.target.unsigned_integer); } -static void setting_get_string_representation_uint_custom_viewport_height(void *data, +static void setting_get_string_representation_uint_custom_viewport_height(rarch_setting_t *setting, char *s, size_t len) { struct retro_game_geometry *geom = NULL; struct retro_system_av_info *av_info = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -685,10 +789,9 @@ static void setting_get_string_representation_uint_custom_viewport_height(void * } #ifdef HAVE_WASAPI -static void setting_get_string_representation_int_audio_wasapi_sh_buffer_length(void *data, +static void setting_get_string_representation_int_audio_wasapi_sh_buffer_length(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -702,10 +805,10 @@ static void setting_get_string_representation_int_audio_wasapi_sh_buffer_length( } #endif -static void setting_get_string_representation_crt_switch_resolution_super(void *data, +static void setting_get_string_representation_crt_switch_resolution_super( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -715,10 +818,93 @@ static void setting_get_string_representation_crt_switch_resolution_super(void * snprintf(s, len, "%d", *setting->value.target.unsigned_integer); } -static int setting_uint_action_left_crt_switch_resolution_super( - void *data, bool wraparound) +static int setting_action_left_analog_dpad_mode(rarch_setting_t *setting, bool wraparound) +{ + unsigned port = 0; + settings_t *settings = config_get_ptr(); + + if (!setting) + return -1; + + port = setting->index_offset; + + configuration_set_uint(settings, settings->uints.input_analog_dpad_mode[port], + (settings->uints.input_analog_dpad_mode + [port] + ANALOG_DPAD_LAST - 1) % ANALOG_DPAD_LAST); + + return 0; +} + +static int setting_action_left_libretro_device_type( + rarch_setting_t *setting, bool wraparound) +{ + retro_ctx_controller_info_t pad; + unsigned current_device, current_idx, i, devices[128], + types = 0, port = 0; + const struct retro_controller_info *desc = NULL; + rarch_system_info_t *system = NULL; + + if (!setting) + return -1; + + port = setting->index_offset; + + devices[types++] = RETRO_DEVICE_NONE; + devices[types++] = RETRO_DEVICE_JOYPAD; + + system = runloop_get_system_info(); + + if (system) + { + /* Only push RETRO_DEVICE_ANALOG as default if we use an + * older core which doesn't use SET_CONTROLLER_INFO. */ + if (!system->ports.size) + devices[types++] = RETRO_DEVICE_ANALOG; + + if (port < system->ports.size) + desc = &system->ports.data[port]; + } + + if (desc) + { + for (i = 0; i < desc->num_types; i++) + { + unsigned id = desc->types[i].id; + if (types < ARRAY_SIZE(devices) && + id != RETRO_DEVICE_NONE && + id != RETRO_DEVICE_JOYPAD) + devices[types++] = id; + } + } + + current_device = input_config_get_device(port); + current_idx = 0; + for (i = 0; i < types; i++) + { + if (current_device != devices[i]) + continue; + + current_idx = i; + break; + } + + current_device = devices + [(current_idx + types - 1) % types]; + + input_config_set_device(port, current_device); + + pad.port = port; + pad.device = current_device; + + core_set_controller_port_device(&pad); + + return 0; +} + + +static int setting_uint_action_left_crt_switch_resolution_super( + rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return -1; @@ -741,15 +927,175 @@ static int setting_uint_action_left_crt_switch_resolution_super( return 0; } +static int setting_action_left_bind_device(rarch_setting_t *setting, bool wraparound) +{ + unsigned *p = NULL; + unsigned index_offset = 0; + unsigned max_devices = input_config_get_device_count(); + settings_t *settings = config_get_ptr(); + + if (!setting || max_devices == 0) + return -1; + + index_offset = setting->index_offset; + + p = &settings->uints.input_joypad_map[index_offset]; + + if ((*p) >= max_devices) + *p = max_devices - 1; + else if ((*p) > 0) + (*p)--; + + return 0; +} + + +static int setting_action_left_mouse_index(rarch_setting_t *setting, bool wraparound) +{ + settings_t *settings = config_get_ptr(); + + if (!setting) + return -1; + + if (settings->uints.input_mouse_index[setting->index_offset]) + { + --settings->uints.input_mouse_index[setting->index_offset]; + settings->modified = true; + } + + return 0; +} + +static int setting_uint_action_left_custom_viewport_width( + rarch_setting_t *setting, bool wraparound) +{ + video_viewport_t vp; + struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); + video_viewport_t *custom = video_viewport_get_custom(); + settings_t *settings = config_get_ptr(); + struct retro_game_geometry *geom = (struct retro_game_geometry*) + &av_info->geometry; + + if (!settings || !av_info) + return -1; + + video_driver_get_viewport_info(&vp); + + if (custom->width <= 1) + custom->width = 1; + else if (settings->bools.video_scale_integer) + { + if (custom->width > geom->base_width) + custom->width -= geom->base_width; + } + else + custom->width -= 1; + + aspectratio_lut[ASPECT_RATIO_CUSTOM].value = + (float)custom->width / custom->height; + + return 0; +} + +static int setting_uint_action_left_custom_viewport_height( + rarch_setting_t *setting, bool wraparound) +{ + video_viewport_t vp; + struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); + video_viewport_t *custom = video_viewport_get_custom(); + settings_t *settings = config_get_ptr(); + struct retro_game_geometry *geom = (struct retro_game_geometry*) + &av_info->geometry; + + if (!settings || !av_info) + return -1; + + video_driver_get_viewport_info(&vp); + + if (custom->height <= 1) + custom->height = 1; + else if (settings->bools.video_scale_integer) + { + if (custom->height > geom->base_height) + custom->height -= geom->base_height; + } + else + custom->height -= 1; + + aspectratio_lut[ASPECT_RATIO_CUSTOM].value = + (float)custom->width / custom->height; + + return 0; +} + +static int setting_string_action_left_audio_device( + rarch_setting_t *setting, bool wraparound) +{ +#if !defined(RARCH_CONSOLE) + int audio_device_index; + struct string_list *ptr = NULL; + + if (!audio_driver_get_devices_list((void**)&ptr)) + return -1; + + if (!ptr) + return -1; + + /* Get index in the string list */ + audio_device_index = string_list_find_elem( + ptr, setting->value.target.string) - 1; + audio_device_index--; + + /* Reset index if needed */ + if (audio_device_index < 0) + audio_device_index = (int)(ptr->size - 1); + + strlcpy(setting->value.target.string, ptr->elems[audio_device_index].data, setting->size); +#endif + + return 0; +} + +static int setting_string_action_left_driver(rarch_setting_t *setting, + bool wraparound) +{ + driver_ctx_info_t drv; + + if (!setting) + return -1; + + drv.label = setting->name; + drv.s = setting->value.target.string; + drv.len = setting->size; + + if (!driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv)) + { + settings_t *settings = config_get_ptr(); + + if (settings && settings->bools.menu_navigation_wraparound_enable) + { + drv.label = setting->name; + drv.s = setting->value.target.string; + drv.len = setting->size; + driver_ctl(RARCH_DRIVER_CTL_FIND_LAST, &drv); + } + } + + if (setting->change_handler) + setting->change_handler(setting); + + return 0; +} + + #ifdef HAVE_NETWORKING static int setting_string_action_left_netplay_mitm_server( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { int i; int offset = 0; bool found = false; unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return -1; @@ -786,13 +1132,12 @@ static int setting_string_action_left_netplay_mitm_server( } static int setting_string_action_right_netplay_mitm_server( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { unsigned i; int offset = 0; bool found = false; unsigned list_len = ARRAY_SIZE(netplay_mitm_server_list); - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return -1; @@ -827,9 +1172,8 @@ static int setting_string_action_right_netplay_mitm_server( #endif static int setting_uint_action_right_crt_switch_resolution_super( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return -1; @@ -853,7 +1197,7 @@ static int setting_uint_action_right_crt_switch_resolution_super( } static int setting_uint_action_right_custom_viewport_width( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { video_viewport_t vp; struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); @@ -879,7 +1223,7 @@ static int setting_uint_action_right_custom_viewport_width( } static int setting_uint_action_right_custom_viewport_height( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { video_viewport_t vp; struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); @@ -906,11 +1250,10 @@ static int setting_uint_action_right_custom_viewport_height( #if !defined(RARCH_CONSOLE) static int setting_string_action_right_audio_device( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { int audio_device_index; struct string_list *ptr = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; if (!audio_driver_get_devices_list((void**)&ptr)) return -1; @@ -933,11 +1276,10 @@ static int setting_string_action_right_audio_device( } #endif -static int setting_string_action_right_driver(void *data, +static int setting_string_action_right_driver(rarch_setting_t *setting, bool wraparound) { driver_ctx_info_t drv; - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return -1; @@ -965,13 +1307,12 @@ static int setting_string_action_right_driver(void *data, return 0; } -int setting_string_action_left_midi_input(void *data, bool wraparound) +static int setting_string_action_left_midi_input(rarch_setting_t *setting, bool wraparound) { struct string_list *list = midi_driver_get_avail_inputs(); if (list && list->size > 1) { - rarch_setting_t *setting = (rarch_setting_t*)data; int i = string_list_find_elem(list, setting->value.target.string) - 2; if (wraparound && i == -1) @@ -987,13 +1328,12 @@ int setting_string_action_left_midi_input(void *data, bool wraparound) return -1; } -int setting_string_action_right_midi_input(void *data, bool wraparound) +static int setting_string_action_right_midi_input(rarch_setting_t *setting, bool wraparound) { struct string_list *list = midi_driver_get_avail_inputs(); if (list && list->size > 1) { - rarch_setting_t *setting = (rarch_setting_t*)data; int i = string_list_find_elem(list, setting->value.target.string); if (wraparound && i == (int)list->size) @@ -1009,13 +1349,12 @@ int setting_string_action_right_midi_input(void *data, bool wraparound) return -1; } -int setting_string_action_left_midi_output(void *data, bool wraparound) +static int setting_string_action_left_midi_output(rarch_setting_t *setting, bool wraparound) { struct string_list *list = midi_driver_get_avail_outputs(); if (list && list->size > 1) { - rarch_setting_t *setting = (rarch_setting_t*)data; int i = string_list_find_elem(list, setting->value.target.string) - 2; if (wraparound && i == -1) @@ -1031,13 +1370,12 @@ int setting_string_action_left_midi_output(void *data, bool wraparound) return -1; } -int setting_string_action_right_midi_output(void *data, bool wraparound) +static int setting_string_action_right_midi_output(rarch_setting_t *setting, bool wraparound) { struct string_list *list = midi_driver_get_avail_outputs(); if (list && list->size > 1) { - rarch_setting_t *setting = (rarch_setting_t*)data; int i = string_list_find_elem(list, setting->value.target.string); if (wraparound && i == (int)list->size) @@ -1053,89 +1391,80 @@ int setting_string_action_right_midi_output(void *data, bool wraparound) return -1; } -static void setting_get_string_representation_uint_cheat_exact(void *data, +static void setting_get_string_representation_uint_cheat_exact(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL), *setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer); } -static void setting_get_string_representation_uint_cheat_lt(void *data, +static void setting_get_string_representation_uint_cheat_lt(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL), len); } -static void setting_get_string_representation_uint_cheat_gt(void *data, +static void setting_get_string_representation_uint_cheat_gt(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL), len); } -static void setting_get_string_representation_uint_cheat_lte(void *data, +static void setting_get_string_representation_uint_cheat_lte(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL), len); } -static void setting_get_string_representation_uint_cheat_gte(void *data, +static void setting_get_string_representation_uint_cheat_gte(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL), len); } -static void setting_get_string_representation_uint_cheat_eq(void *data, +static void setting_get_string_representation_uint_cheat_eq(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL), len); } -static void setting_get_string_representation_uint_cheat_neq(void *data, +static void setting_get_string_representation_uint_cheat_neq(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL), len); } -static void setting_get_string_representation_uint_cheat_eqplus(void *data, +static void setting_get_string_representation_uint_cheat_eqplus(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL), *setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer); } -static void setting_get_string_representation_uint_cheat_eqminus(void *data, +static void setting_get_string_representation_uint_cheat_eqminus(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL), *setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer); } -static void setting_get_string_representation_uint_cheat_browse_address(void *data, +static void setting_get_string_representation_uint_cheat_browse_address(rarch_setting_t *setting, char *s, size_t len) { unsigned int address = cheat_manager_state.browse_address; unsigned int address_mask = 0; unsigned int prev_val = 0; unsigned int curr_val = 0 ; - rarch_setting_t *setting = (rarch_setting_t*)data; + if (setting) snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL), *setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer); @@ -1146,10 +1475,9 @@ static void setting_get_string_representation_uint_cheat_browse_address(void *da } -static void setting_get_string_representation_uint_video_rotation(void *data, +static void setting_get_string_representation_uint_video_rotation(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) { char rotation_lut[4][32] = @@ -1166,10 +1494,9 @@ static void setting_get_string_representation_uint_video_rotation(void *data, } static void setting_get_string_representation_uint_aspect_ratio_index( - void *data, + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) strlcpy(s, aspectratio_lut[*setting->value.target.unsigned_integer].name, @@ -1177,10 +1504,9 @@ static void setting_get_string_representation_uint_aspect_ratio_index( } static void setting_get_string_representation_uint_crt_switch_resolutions( - void *data, + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1199,10 +1525,9 @@ static void setting_get_string_representation_uint_crt_switch_resolutions( } static void setting_get_string_representation_uint_audio_resampler_quality( - void *data, + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1235,14 +1560,14 @@ static void setting_get_string_representation_uint_audio_resampler_quality( } } -static void setting_get_string_representation_uint_libretro_device(void *data, +static void setting_get_string_representation_uint_libretro_device( + rarch_setting_t *setting, char *s, size_t len) { unsigned index_offset, device; const struct retro_controller_description *desc = NULL; const char *name = NULL; rarch_system_info_t *system = runloop_get_system_info(); - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1285,11 +1610,11 @@ static void setting_get_string_representation_uint_libretro_device(void *data, strlcpy(s, name, len); } -static void setting_get_string_representation_uint_analog_dpad_mode(void *data, +static void setting_get_string_representation_uint_analog_dpad_mode( + rarch_setting_t *setting, char *s, size_t len) { const char *modes[3]; - rarch_setting_t *setting = (rarch_setting_t*)data; modes[0] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE); modes[1] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG); @@ -1299,10 +1624,10 @@ static void setting_get_string_representation_uint_analog_dpad_mode(void *data, } #ifdef HAVE_THREADS -static void setting_get_string_representation_uint_autosave_interval(void *data, +static void setting_get_string_representation_uint_autosave_interval( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1315,17 +1640,18 @@ static void setting_get_string_representation_uint_autosave_interval(void *data, #endif #if defined(HAVE_NETWORKING) -static void setting_get_string_representation_netplay_mitm_server(void *data, +static void setting_get_string_representation_netplay_mitm_server( + rarch_setting_t *setting, char *s, size_t len) { } #endif -static void setting_get_string_representation_toggle_gamepad_combo(void *data, +static void setting_get_string_representation_toggle_gamepad_combo( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1350,10 +1676,10 @@ static void setting_get_string_representation_toggle_gamepad_combo(void *data, } #ifdef HAVE_NETWORKING -static void setting_get_string_representation_netplay_share_digital(void *data, +static void setting_get_string_representation_netplay_share_digital( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1381,10 +1707,10 @@ static void setting_get_string_representation_netplay_share_digital(void *data, } } -static void setting_get_string_representation_netplay_share_analog(void *data, +static void setting_get_string_representation_netplay_share_analog( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1409,10 +1735,10 @@ static void setting_get_string_representation_netplay_share_analog(void *data, } #endif -static void setting_get_string_representation_poll_type_behavior(void *data, +static void setting_get_string_representation_poll_type_behavior( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -1437,7 +1763,8 @@ static void setting_get_string_representation_poll_type_behavior(void *data, } #ifdef HAVE_LANGEXTRA -static void setting_get_string_representation_uint_user_language(void *data, +static void setting_get_string_representation_uint_user_language( + rarch_setting_t *setting, char *s, size_t len) { const char *modes[RETRO_LANGUAGE_LAST]; @@ -1464,11 +1791,10 @@ static void setting_get_string_representation_uint_user_language(void *data, } #endif -static void setting_get_string_representation_uint_libretro_log_level(void *data, +static void setting_get_string_representation_uint_libretro_log_level( + rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting) { static const char *modes[] = { @@ -1836,9 +2162,8 @@ void *setting_get_ptr(rarch_setting_t *setting) * * Get a setting value's string representation. **/ -void setting_get_string_representation(void *data, char *s, size_t len) +void setting_get_string_representation(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t* setting = (rarch_setting_t*)data; if (!setting || !s) return; @@ -1855,9 +2180,8 @@ void setting_get_string_representation(void *data, char *s, size_t len) * * Returns: 0 on success, -1 on error. **/ -static int setting_action_start_bind_device(void *data) +static int setting_action_start_bind_device(rarch_setting_t *setting) { - rarch_setting_t *setting = (rarch_setting_t*)data; settings_t *settings = config_get_ptr(); if (!setting || !settings) @@ -1869,7 +2193,7 @@ static int setting_action_start_bind_device(void *data) } -static int setting_action_start_custom_viewport_width(void *data) +static int setting_action_start_custom_viewport_width(rarch_setting_t *setting) { video_viewport_t vp; struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); @@ -1895,7 +2219,7 @@ static int setting_action_start_custom_viewport_width(void *data) return 0; } -static int setting_action_start_custom_viewport_height(void *data) +static int setting_action_start_custom_viewport_height(rarch_setting_t *setting) { video_viewport_t vp; struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); @@ -1923,10 +2247,8 @@ static int setting_action_start_custom_viewport_height(void *data) -static int setting_action_start_analog_dpad_mode(void *data) +static int setting_action_start_analog_dpad_mode(rarch_setting_t *setting) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; @@ -1935,16 +2257,15 @@ static int setting_action_start_analog_dpad_mode(void *data) return 0; } -static int setting_action_start_libretro_device_type(void *data) +static int setting_action_start_libretro_device_type(rarch_setting_t *setting) { retro_ctx_controller_info_t pad; unsigned index_offset, current_device; unsigned devices[128], types = 0, port = 0; const struct retro_controller_info *desc = NULL; rarch_system_info_t *system = runloop_get_system_info(); - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting_generic_action_start_default(setting) != 0) + if (!setting || setting_generic_action_start_default(setting) != 0) return -1; index_offset = setting->index_offset; @@ -1990,8 +2311,10 @@ static int setting_action_start_libretro_device_type(void *data) } static int setting_action_start_video_refresh_rate_auto( - void *data) + rarch_setting_t *setting) { + (void)setting; + video_driver_monitor_reset(); return 0; } @@ -2000,10 +2323,9 @@ static int setting_action_start_video_refresh_rate_auto( ******* ACTION TOGGLE CALLBACK FUNCTIONS ******* **/ -static int setting_action_right_analog_dpad_mode(void *data, bool wraparound) +static int setting_action_right_analog_dpad_mode(rarch_setting_t *setting, bool wraparound) { unsigned port = 0; - rarch_setting_t *setting = (rarch_setting_t*)data; settings_t *settings = config_get_ptr(); if (!setting) @@ -2020,13 +2342,12 @@ static int setting_action_right_analog_dpad_mode(void *data, bool wraparound) } static int setting_action_right_libretro_device_type( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { retro_ctx_controller_info_t pad; unsigned current_device, current_idx, i, devices[128], types = 0, port = 0; const struct retro_controller_info *desc = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; rarch_system_info_t *system = runloop_get_system_info(); if (!setting) @@ -2084,12 +2405,11 @@ static int setting_action_right_libretro_device_type( return 0; } -static int setting_action_right_bind_device(void *data, bool wraparound) +static int setting_action_right_bind_device(rarch_setting_t *setting, bool wraparound) { unsigned index_offset; unsigned *p = NULL; unsigned max_devices = input_config_get_device_count(); - rarch_setting_t *setting = (rarch_setting_t*)data; settings_t *settings = config_get_ptr(); if (!setting) @@ -2105,9 +2425,8 @@ static int setting_action_right_bind_device(void *data, bool wraparound) return 0; } -static int setting_action_right_mouse_index(void *data, bool wraparound) +static int setting_action_right_mouse_index(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; settings_t *settings = config_get_ptr(); if (!setting) @@ -2125,19 +2444,18 @@ static int setting_action_right_mouse_index(void *data, bool wraparound) static void setting_get_string_representation_st_float_video_refresh_rate_polled( - void *data, char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { snprintf(s, len, "%.3f Hz", video_driver_get_refresh_rate()); } static void setting_get_string_representation_st_float_video_refresh_rate_auto( - void *data, char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { double video_refresh_rate = 0.0; double deviation = 0.0; unsigned sample_points = 0; - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return; @@ -2152,12 +2470,11 @@ setting_get_string_representation_st_float_video_refresh_rate_auto( strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len); } -static void get_string_representation_bind_device(void * data, char *s, +static void get_string_representation_bind_device(rarch_setting_t *setting, char *s, size_t len) { unsigned index_offset, map = 0; unsigned max_devices = input_config_get_device_count(); - rarch_setting_t *setting = (rarch_setting_t*)data; settings_t *settings = config_get_ptr(); if (!setting) @@ -2963,10 +3280,8 @@ static const char* config_get_audio_resampler_driver_options(void) return char_list_new_special(STRING_LIST_AUDIO_RESAMPLER_DRIVERS, NULL); } -static int directory_action_start_generic(void *data) +static int directory_action_start_generic(rarch_setting_t *setting) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; diff --git a/menu/menu_setting.h b/menu/menu_setting.h index b3febd1600..b6b60ea6da 100644 --- a/menu/menu_setting.h +++ b/menu/menu_setting.h @@ -98,7 +98,7 @@ rarch_setting_t *menu_setting_find_enum(enum msg_hash_enums enum_idx); * * Get a setting value's string representation. **/ -void menu_setting_get_string_representation(void *data, char *s, size_t len); +void menu_setting_get_string_representation(rarch_setting_t *setting, char *s, size_t len); /** * menu_setting_get_label: diff --git a/setting_list.c b/setting_list.c index 57bd0579d5..f62df7c389 100644 --- a/setting_list.c +++ b/setting_list.c @@ -70,21 +70,20 @@ unsigned setting_get_bind_type(rarch_setting_t *setting) return setting->bind_type; } -static int setting_bind_action_ok(void *data, bool wraparound) +static int setting_bind_action_ok(rarch_setting_t *setting, bool wraparound) { (void)wraparound; /* TODO/FIXME - handle this */ #ifdef HAVE_MENU /* TODO - get rid of menu dependency */ - if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_SINGLE, data)) + if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_SINGLE, setting)) return -1; #endif return 0; } -static int setting_int_action_right_default(void *data, bool wraparound) +static int setting_int_action_right_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; double max = 0.0f; if (!setting) @@ -117,11 +116,10 @@ static int setting_int_action_right_default(void *data, bool wraparound) } #ifdef HAVE_MENU -static int setting_bind_action_start(void *data) +static int setting_bind_action_start(rarch_setting_t *setting) { unsigned bind_type; struct retro_keybind *keybind = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; struct retro_keybind *def_binds = (struct retro_keybind *)retro_keybinds_1; if (!setting) @@ -146,55 +144,49 @@ static int setting_bind_action_start(void *data) } #endif -static void setting_get_string_representation_hex(void *data, +static void setting_get_string_representation_hex(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, "%08x", *setting->value.target.unsigned_integer); } -void setting_get_string_representation_hex_and_uint(void *data, +void setting_get_string_representation_hex_and_uint(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, "%u (%08X)", *setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer); } -void setting_get_string_representation_uint(void *data, +void setting_get_string_representation_uint(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, "%u", *setting->value.target.unsigned_integer); } -void setting_get_string_representation_size(void *data, +void setting_get_string_representation_size(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, "%" PRI_SIZET, *setting->value.target.sizet); } -void setting_get_string_representation_size_in_mb(void *data, +void setting_get_string_representation_size_in_mb(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, "%" PRI_SIZET, (*setting->value.target.sizet)/(1024*1024)); } -void setting_get_string_representation_uint_as_enum(void *data, +void setting_get_string_representation_uint_as_enum(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; if (setting) snprintf(s, len, "%s", msg_hash_to_str((enum msg_hash_enums)( @@ -252,12 +244,11 @@ static float recalc_step_based_on_length_of_action(rarch_setting_t *setting) return step < setting->step ? setting->step : step ; } -int setting_uint_action_left_default(void *data, bool wraparound) +int setting_uint_action_left_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - double min = 0.0f; + double min = 0.0f; bool overflowed = false; - float step = 0.0f ; + float step = 0.0f ; if (!setting) return -1; @@ -293,10 +284,9 @@ int setting_uint_action_left_default(void *data, bool wraparound) return 0; } -int setting_uint_action_right_default(void *data, bool wraparound) +int setting_uint_action_right_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - double max = 0.0f; + double max = 0.0f; float step = 0.0f ; if (!setting) @@ -331,9 +321,9 @@ int setting_uint_action_right_default(void *data, bool wraparound) return 0; } -int setting_uint_action_right_with_refresh(void *data, bool wraparound) +int setting_uint_action_right_with_refresh(rarch_setting_t *setting, bool wraparound) { - int retval = setting_uint_action_right_default(data, wraparound) ; + int retval = setting_uint_action_right_default(setting, wraparound) ; bool refresh = false; #ifdef HAVE_MENU @@ -344,9 +334,9 @@ int setting_uint_action_right_with_refresh(void *data, bool wraparound) return retval ; } -int setting_uint_action_left_with_refresh(void *data, bool wraparound) +int setting_uint_action_left_with_refresh(rarch_setting_t *setting, bool wraparound) { - int retval = setting_uint_action_left_default(data, wraparound) ; + int retval = setting_uint_action_left_default(setting, wraparound) ; bool refresh = false; #ifdef HAVE_MENU @@ -359,12 +349,11 @@ int setting_uint_action_left_with_refresh(void *data, bool wraparound) } -static int setting_size_action_left_default(void *data, bool wraparound) +static int setting_size_action_left_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - double min = 0.0f; + double min = 0.0f; bool overflowed = false; - float step = 0.0f ; + float step = 0.0f ; if (!setting) return -1; @@ -400,10 +389,9 @@ static int setting_size_action_left_default(void *data, bool wraparound) return 0; } -static int setting_size_action_right_default(void *data, bool wraparound) +static int setting_size_action_right_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - double max = 0.0f; + double max = 0.0f; float step = 0.0f ; if (!setting) @@ -438,10 +426,8 @@ static int setting_size_action_right_default(void *data, bool wraparound) return 0; } -int setting_generic_action_ok_default(void *data, bool wraparound) +int setting_generic_action_ok_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; @@ -453,11 +439,9 @@ int setting_generic_action_ok_default(void *data, bool wraparound) return 0; } -static void setting_get_string_representation_int(void *data, +static void setting_get_string_representation_int(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting) snprintf(s, len, "%d", *setting->value.target.integer); } @@ -581,9 +565,8 @@ int setting_set_with_string_representation(rarch_setting_t* setting, } static int setting_fraction_action_left_default( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; double min = 0.0f; if (!setting) @@ -616,9 +599,8 @@ static int setting_fraction_action_left_default( } static int setting_fraction_action_right_default( - void *data, bool wraparound) + rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; double max = 0.0f; if (!setting) @@ -702,10 +684,8 @@ static void setting_reset_setting(rarch_setting_t* setting) setting->change_handler(setting); } -int setting_generic_action_start_default(void *data) +int setting_generic_action_start_default(rarch_setting_t *setting) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; @@ -714,10 +694,9 @@ int setting_generic_action_start_default(void *data) return 0; } -static void setting_get_string_representation_default(void *data, +static void setting_get_string_representation_default(rarch_setting_t *setting, char *s, size_t len) { - (void)data; strlcpy(s, "...", len); } @@ -730,11 +709,9 @@ static void setting_get_string_representation_default(void *data, * * Set a settings' label value. The setting is of type ST_BOOL. **/ -static void setting_get_string_representation_st_bool(void *data, +static void setting_get_string_representation_st_bool(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting) strlcpy(s, *setting->value.target.boolean ? setting->boolean.on_label : setting->boolean.off_label, len); @@ -750,21 +727,17 @@ static void setting_get_string_representation_st_bool(void *data, * * Set a settings' label value. The setting is of type ST_FLOAT. **/ -static void setting_get_string_representation_st_float(void *data, +static void setting_get_string_representation_st_float(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting) snprintf(s, len, setting->rounding_fraction, *setting->value.target.fraction); } -static void setting_get_string_representation_st_dir(void *data, +static void setting_get_string_representation_st_dir(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting) strlcpy(s, *setting->value.target.string ? @@ -772,29 +745,24 @@ static void setting_get_string_representation_st_dir(void *data, len); } -static void setting_get_string_representation_st_path(void *data, +static void setting_get_string_representation_st_path(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting) fill_short_pathname_representation(s, setting->value.target.string, len); } -static void setting_get_string_representation_st_string(void *data, +static void setting_get_string_representation_st_string(rarch_setting_t *setting, char *s, size_t len) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (setting) strlcpy(s, setting->value.target.string, len); } -static void setting_get_string_representation_st_bind(void *data, +static void setting_get_string_representation_st_bind(rarch_setting_t *setting, char *s, size_t len) { - unsigned index_offset; - rarch_setting_t *setting = (rarch_setting_t*)data; + unsigned index_offset = 0; const struct retro_keybind* keybind = NULL; const struct retro_keybind* auto_bind = NULL; @@ -809,10 +777,8 @@ static void setting_get_string_representation_st_bind(void *data, input_config_get_bind_string(s, keybind, auto_bind, len); } -static int setting_action_action_ok(void *data, bool wraparound) +static int setting_action_action_ok(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; @@ -1348,9 +1314,8 @@ static rarch_setting_t setting_bind_setting(const char* name, return result; } -static int setting_int_action_left_default(void *data, bool wraparound) +static int setting_int_action_left_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; double min = 0.0f; if (!setting) @@ -1382,10 +1347,8 @@ static int setting_int_action_left_default(void *data, bool wraparound) return 0; } -static int setting_bool_action_ok_default(void *data, bool wraparound) +static int setting_bool_action_ok_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; @@ -1397,10 +1360,8 @@ static int setting_bool_action_ok_default(void *data, bool wraparound) return 0; } -static int setting_bool_action_toggle_default(void *data, bool wraparound) +static int setting_bool_action_toggle_default(rarch_setting_t *setting, bool wraparound) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; @@ -1412,10 +1373,8 @@ static int setting_bool_action_toggle_default(void *data, bool wraparound) return 0; } -int setting_string_action_start_generic(void *data) +int setting_string_action_start_generic(rarch_setting_t *setting) { - rarch_setting_t *setting = (rarch_setting_t*)data; - if (!setting) return -1; @@ -2355,11 +2314,10 @@ static void menu_input_st_hex_cb(void *userdata, const char *str) menu_input_dialog_end(); } -static int setting_generic_action_ok_linefeed(void *data, bool wraparound) +static int setting_generic_action_ok_linefeed(rarch_setting_t *setting, bool wraparound) { menu_input_ctx_line_t line; input_keyboard_line_complete_t cb = NULL; - rarch_setting_t *setting = (rarch_setting_t*)data; if (!setting) return -1; diff --git a/setting_list.h b/setting_list.h index 32cc4b6b4f..0045f88881 100644 --- a/setting_list.h +++ b/setting_list.h @@ -74,15 +74,15 @@ typedef struct rarch_setting_info rarch_setting_info_t; typedef struct rarch_setting_group_info rarch_setting_group_info_t; typedef void (*change_handler_t )(rarch_setting_t *data); -typedef int (*action_left_handler_t )(void *data, bool wraparound); -typedef int (*action_right_handler_t )(void *data, bool wraparound); -typedef int (*action_up_handler_t )(void *data); -typedef int (*action_down_handler_t )(void *data); -typedef int (*action_start_handler_t )(void *data); -typedef int (*action_cancel_handler_t )(void *data); -typedef int (*action_ok_handler_t )(void *data, bool wraparound); -typedef int (*action_select_handler_t )(void *data, bool wraparound); -typedef void (*get_string_representation_t )(void *data, char *s, size_t len); +typedef int (*action_left_handler_t )(rarch_setting_t *data, bool wraparound); +typedef int (*action_right_handler_t )(rarch_setting_t *setting, bool wraparound); +typedef int (*action_up_handler_t )(rarch_setting_t *setting); +typedef int (*action_down_handler_t )(rarch_setting_t *setting); +typedef int (*action_start_handler_t )(rarch_setting_t *setting); +typedef int (*action_cancel_handler_t )(rarch_setting_t *setting); +typedef int (*action_ok_handler_t )(rarch_setting_t *setting, bool wraparound); +typedef int (*action_select_handler_t )(rarch_setting_t *setting, bool wraparound); +typedef void (*get_string_representation_t )(rarch_setting_t *setting, char *s, size_t len); struct rarch_setting_group_info { @@ -416,11 +416,11 @@ int setting_set_with_string_representation( unsigned setting_get_bind_type(rarch_setting_t *setting); -int setting_string_action_start_generic(void *data); +int setting_string_action_start_generic(rarch_setting_t *setting); -int setting_generic_action_ok_default(void *data, bool wraparound); +int setting_generic_action_ok_default(rarch_setting_t *setting, bool wraparound); -int setting_generic_action_start_default(void *data); +int setting_generic_action_start_default(rarch_setting_t *setting); void settings_data_list_current_add_flags( rarch_setting_t **list, @@ -432,20 +432,20 @@ void settings_data_list_current_add_free_flags( rarch_setting_info_t *list_info, unsigned values); -void setting_get_string_representation_size_in_mb(void *data, +void setting_get_string_representation_size_in_mb(rarch_setting_t *setting, char *s, size_t len); -int setting_uint_action_right_with_refresh(void *data, bool wraparound) ; +int setting_uint_action_right_with_refresh(rarch_setting_t *setting, bool wraparound); -int setting_uint_action_left_with_refresh(void *data, bool wraparound) ; +int setting_uint_action_left_with_refresh(rarch_setting_t *setting, bool wraparound) ; -void setting_get_string_representation_uint_as_enum(void *data, +void setting_get_string_representation_uint_as_enum(rarch_setting_t *setting, char *s, size_t len); -int setting_uint_action_left_default(void *data, bool wraparound); -int setting_uint_action_right_default(void *data, bool wraparound); -void setting_get_string_representation_uint(void *data,char *s, size_t len); -void setting_get_string_representation_hex_and_uint(void *data, char *s, size_t len); +int setting_uint_action_left_default(rarch_setting_t *setting, bool wraparound); +int setting_uint_action_right_default(rarch_setting_t *setting, bool wraparound); +void setting_get_string_representation_uint(rarch_setting_t *setting, char *s, size_t len); +void setting_get_string_representation_hex_and_uint(rarch_setting_t *setting, char *s, size_t len); #define setting_get_type(setting) ((setting) ? setting->type : ST_NONE) RETRO_END_DECLS From 76399013a1badcd8b99cb24eefda504f5e05948f Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 26 Sep 2018 16:13:42 +0200 Subject: [PATCH 0066/1292] Silence some warnings --- menu/cbs/menu_cbs_ok.c | 4 ++-- menu/menu_displaylist.c | 4 ++-- menu/menu_driver.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 50793aecfe..e482dcd0c5 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -4210,7 +4210,7 @@ static int action_ok_push_dropdown_setting_int_item(const char *path, if (!setting) return -1; - *setting->value.target.integer = idx + setting->offset_by; + *setting->value.target.integer = (int32_t)(idx + setting->offset_by); return action_cancel_pop_default(NULL, NULL, 0, 0); } @@ -4237,7 +4237,7 @@ static int action_ok_push_dropdown_setting_uint_item(const char *path, if (!setting) return -1; - *setting->value.target.unsigned_integer = idx + setting->offset_by; + *setting->value.target.unsigned_integer = (unsigned)(idx + setting->offset_by); return action_cancel_pop_default(NULL, NULL, 0, 0); } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index a99f3c4b3f..1f54307cbf 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7729,7 +7729,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) if (coreopts) { - unsigned size = tmp_str_list->size; + unsigned size = (unsigned)tmp_str_list->size; unsigned i = atoi(tmp_str_list->elems[size-1].data); struct core_option *option = NULL; @@ -7777,7 +7777,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) if (tmp_str_list && tmp_str_list->size > 0) { unsigned i; - unsigned size = tmp_str_list->size; + unsigned size = (unsigned)tmp_str_list->size; for (i = 0; i < size; i++) { diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 0c2a7abfe3..b084a91b35 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -686,7 +686,7 @@ void menu_display_blend_begin(video_frame_info_t *video_info); void menu_display_blend_end(video_frame_info_t *video_info); void menu_display_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height); -void menu_display_scissor_end(); +void menu_display_scissor_end(void); void menu_display_font_free(font_data_t *font); From d955af64a0fbc9a5854e8c098c0eb3d658322f74 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 16:16:17 +0200 Subject: [PATCH 0067/1292] Cleanup --- menu/drivers/menu_generic.c | 7 +++---- menu/drivers/menu_generic.h | 3 ++- menu/menu_driver.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 6ced247734..f263ea16ad 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -65,20 +65,19 @@ static enum action_iterate_type action_iterate_type(const char *label) * * Returns: 0 on success, -1 if we need to quit out of the loop. **/ -int generic_menu_iterate(void *data, void *userdata, enum menu_action action) +int generic_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action action) { enum action_iterate_type iterate_type; unsigned file_type = 0; int ret = 0; enum msg_hash_enums enum_idx = MSG_UNKNOWN; const char *label = NULL; - menu_handle_t *menu = (menu_handle_t*)data; - - menu_entries_get_last_stack(NULL, &label, &file_type, &enum_idx, NULL); if (!menu) return 0; + menu_entries_get_last_stack(NULL, &label, &file_type, &enum_idx, NULL); + menu->menu_state_msg[0] = '\0'; iterate_type = action_iterate_type(label); diff --git a/menu/drivers/menu_generic.h b/menu/drivers/menu_generic.h index d943c4b65c..8cbdf87752 100644 --- a/menu/drivers/menu_generic.h +++ b/menu/drivers/menu_generic.h @@ -20,6 +20,7 @@ #include +#include "../menu_driver.h" #include "../menu_input.h" enum action_iterate_type @@ -30,7 +31,7 @@ enum action_iterate_type ITERATE_TYPE_BIND }; -int generic_menu_iterate(void *data, void *userdata, enum menu_action action); +int generic_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action action); bool generic_menu_init_list(void *data); diff --git a/menu/menu_driver.h b/menu/menu_driver.h index b084a91b35..029eb752df 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -465,7 +465,7 @@ typedef struct menu_ctx_driver void (*set_texture)(void); /* Render a messagebox to the screen. */ void (*render_messagebox)(void *data, const char *msg); - int (*iterate)(void *data, void *userdata, enum menu_action action); + int (*iterate)(menu_handle_t *menu, void *userdata, enum menu_action action); void (*render)(void *data, bool is_idle); void (*frame)(void *data, video_frame_info_t *video_info); /* Initializes the menu driver. (setup) */ From 8c101fdfd6d4b76f51c8de1f0ef94484b7dff110 Mon Sep 17 00:00:00 2001 From: neville Date: Wed, 26 Sep 2018 18:48:30 +0200 Subject: [PATCH 0068/1292] Buildfix --- managers/cheat_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index a3bf6618bc..dada775df0 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -20,7 +20,7 @@ #include #include -#include "setting_list.h" +#include "../setting_list.h" RETRO_BEGIN_DECLS From bb0059c721606bdbe19e325ba86ef5c837e1785a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 23:00:00 +0200 Subject: [PATCH 0069/1292] Add Twitch list/Youtube list --- intl/msg_hash_ar.h | 8 +++++++ intl/msg_hash_chs.h | 8 +++++++ intl/msg_hash_cht.h | 8 +++++++ intl/msg_hash_de.h | 8 +++++++ intl/msg_hash_eo.h | 8 +++++++ intl/msg_hash_es.h | 8 +++++++ intl/msg_hash_fr.h | 8 +++++++ intl/msg_hash_it.h | 8 +++++++ intl/msg_hash_ja.h | 8 +++++++ intl/msg_hash_ko.h | 8 +++++++ intl/msg_hash_lbl.h | 8 +++++++ intl/msg_hash_nl.h | 8 +++++++ intl/msg_hash_pl.h | 8 +++++++ intl/msg_hash_pt_br.h | 8 +++++++ intl/msg_hash_pt_pt.h | 8 +++++++ intl/msg_hash_ru.h | 8 +++++++ intl/msg_hash_us.h | 8 +++++++ intl/msg_hash_vn.h | 8 +++++++ menu/cbs/menu_cbs_deferred_push.c | 18 +++++++++++++++ menu/cbs/menu_cbs_ok.c | 14 ++++++++++++ menu/cbs/menu_cbs_title.c | 18 +++++++++++++++ menu/menu_cbs.h | 2 ++ menu/menu_displaylist.c | 38 +++++++++++++++++++++++++++++++ menu/menu_displaylist.h | 2 ++ menu/menu_setting.c | 18 +++++++++++++++ msg_hash.h | 4 ++++ 26 files changed, 258 insertions(+) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index a74f8553ab..198c8ac1f0 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3639,3 +3639,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index c87c2743a0..8678ab5e10 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3423,3 +3423,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 38087ed8bd..7fe145858d 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3415,3 +3415,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 88594fc318..c2cc07eff6 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3525,3 +3525,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 719d9d8d4c..73c69d2769 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3290,3 +3290,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 85d429f23c..bae5b5b649 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7545,3 +7545,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 597f115585..5c10cc9465 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3449,3 +3449,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 80b507fc3c..170eb0ec88 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3509,3 +3509,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 4c4d8e2c7a..7fd7f82b30 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3912,3 +3912,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 58df079663..ebfcfce345 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3410,3 +3410,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index a4a2c5a3e4..46db61489b 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -4,6 +4,10 @@ MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_LIST, "accounts_list") MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, "retro_achievements") +MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_TWITCH, + "twitch") +MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_YOUTUBE, + "youtube") MSG_HASH(MENU_ENUM_LABEL_ACHIEVEMENT_LIST, "achievement_list") MSG_HASH(MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE, @@ -265,6 +269,10 @@ MSG_HASH(MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST, "deferred_browse_url_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST, "deferred_accounts_cheevos_list") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_TWITCH_LIST, + "deferred_accounts_twitch_list") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_YOUTUBE_LIST, + "deferred_accounts_youtube_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_LIST, "deferred_accounts_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_ACTION, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 235bd5be1e..f5343afc7a 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3284,3 +3284,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Poort" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 71a903dd96..11f65a864e 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3712,3 +3712,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index ab18f6e349..7288ec4122 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7528,3 +7528,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 1a168d0a9e..b584e53038 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3376,3 +3376,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 5972d53397..926f445550 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3579,3 +3579,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 2820412ee8..9539802444 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7566,3 +7566,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 99aa5ba5ac..bdb45fb9d9 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3447,3 +3447,11 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, "UDP Stream Port" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index fd5008c71b..9b76a19b6f 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -170,6 +170,8 @@ generic_deferred_push(deferred_push_recording_settings_list, DISPLAYLIST_ generic_deferred_push(deferred_push_playlist_settings_list, DISPLAYLIST_PLAYLIST_SETTINGS_LIST) generic_deferred_push(deferred_push_input_hotkey_binds_list, DISPLAYLIST_INPUT_HOTKEY_BINDS_LIST) generic_deferred_push(deferred_push_accounts_cheevos_list, DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST) +generic_deferred_push(deferred_push_accounts_twitch_list, DISPLAYLIST_ACCOUNTS_TWITCH_LIST) +generic_deferred_push(deferred_push_accounts_youtube_list, DISPLAYLIST_ACCOUNTS_YOUTUBE_LIST) generic_deferred_push(deferred_push_help, DISPLAYLIST_HELP_SCREEN_LIST) generic_deferred_push(deferred_push_rdb_entry_detail, DISPLAYLIST_DATABASE_ENTRY) generic_deferred_push(deferred_push_rpl_entry_actions, DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS) @@ -950,6 +952,16 @@ static int menu_cbs_init_bind_deferred_push_compare_label( { BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_quick_menu_override_options); } + else if (strstr(label, + msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_YOUTUBE_LIST))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_youtube_list); + } + else if (strstr(label, + msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_TWITCH_LIST))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_twitch_list); + } else { if (cbs->enum_idx != MSG_UNKNOWN) @@ -977,6 +989,12 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_cheevos_list); break; + case MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_YOUTUBE_LIST: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_youtube_list); + break; + case MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_TWITCH_LIST: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_twitch_list); + break; case MENU_ENUM_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_archive_action_detect_core); break; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e482dcd0c5..64520b48a6 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -231,6 +231,10 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl) return MENU_ENUM_LABEL_DEFERRED_PLAYLIST_SETTINGS_LIST; case ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST: return MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST; + case ACTION_OK_DL_ACCOUNTS_TWITCH_LIST: + return MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_TWITCH_LIST; + case ACTION_OK_DL_ACCOUNTS_YOUTUBE_LIST: + return MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_YOUTUBE_LIST; case ACTION_OK_DL_PLAYLIST_COLLECTION: return MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST; case ACTION_OK_DL_FAVORITES_LIST: @@ -813,6 +817,8 @@ int generic_action_ok_displaylist_push(const char *path, case ACTION_OK_DL_RECORDING_SETTINGS_LIST: case ACTION_OK_DL_PLAYLIST_SETTINGS_LIST: case ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST: + case ACTION_OK_DL_ACCOUNTS_YOUTUBE_LIST: + case ACTION_OK_DL_ACCOUNTS_TWITCH_LIST: case ACTION_OK_DL_PLAYLIST_COLLECTION: case ACTION_OK_DL_FAVORITES_LIST: case ACTION_OK_DL_BROWSE_URL_LIST: @@ -3734,6 +3740,8 @@ default_action_ok_func(action_ok_push_playlist_settings_list, ACTION_OK_DL_PLAYL default_action_ok_func(action_ok_push_input_hotkey_binds_list, ACTION_OK_DL_INPUT_HOTKEY_BINDS_LIST) default_action_ok_func(action_ok_push_user_binds_list, ACTION_OK_DL_USER_BINDS_LIST) default_action_ok_func(action_ok_push_accounts_cheevos_list, ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST) +default_action_ok_func(action_ok_push_accounts_youtube_list, ACTION_OK_DL_ACCOUNTS_YOUTUBE_LIST) +default_action_ok_func(action_ok_push_accounts_twitch_list, ACTION_OK_DL_ACCOUNTS_TWITCH_LIST) default_action_ok_func(action_ok_open_archive, ACTION_OK_DL_OPEN_ARCHIVE) static int action_ok_shader_pass(const char *path, @@ -4901,6 +4909,12 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS: BIND_ACTION_OK(cbs, action_ok_push_accounts_cheevos_list); break; + case MENU_ENUM_LABEL_ACCOUNTS_YOUTUBE: + BIND_ACTION_OK(cbs, action_ok_push_accounts_youtube_list); + break; + case MENU_ENUM_LABEL_ACCOUNTS_TWITCH: + BIND_ACTION_OK(cbs, action_ok_push_accounts_twitch_list); + break; case MENU_ENUM_LABEL_SHADER_OPTIONS: case MENU_ENUM_LABEL_CORE_OPTIONS: case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS: diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 4d5eb60cdc..cf974172f4 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -93,6 +93,8 @@ static int action_get_title_mixer_stream_actions(const char *path, const char *l default_title_macro(action_get_quick_menu_override_options, MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS) default_title_macro(action_get_user_accounts_cheevos_list, MENU_ENUM_LABEL_VALUE_ACCOUNTS_RETRO_ACHIEVEMENTS) +default_title_macro(action_get_user_accounts_youtube_list, MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE) +default_title_macro(action_get_user_accounts_twitch_list, MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH) default_title_macro(action_get_download_core_content_list, MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT) default_title_macro(action_get_user_accounts_list, MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST) default_title_macro(action_get_core_information_list, MENU_ENUM_LABEL_VALUE_CORE_INFORMATION) @@ -549,6 +551,16 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, BIND_ACTION_GET_TITLE(cbs, action_get_crt_switchres_settings_list); return 0; } + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_TWITCH_LIST))) + { + BIND_ACTION_GET_TITLE(cbs, action_get_user_accounts_twitch_list); + return 0; + } + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_YOUTUBE_LIST))) + { + BIND_ACTION_GET_TITLE(cbs, action_get_user_accounts_youtube_list); + return 0; + } else if (cbs->enum_idx != MSG_UNKNOWN) { switch (cbs->enum_idx) @@ -822,6 +834,12 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST: BIND_ACTION_GET_TITLE(cbs, action_get_user_accounts_cheevos_list); break; + case MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_TWITCH_LIST: + BIND_ACTION_GET_TITLE(cbs, action_get_user_accounts_twitch_list); + break; + case MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_YOUTUBE_LIST: + BIND_ACTION_GET_TITLE(cbs, action_get_user_accounts_youtube_list); + break; case MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST: case MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_SUBDIR_LIST: BIND_ACTION_GET_TITLE(cbs, action_get_download_core_content_list); diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 3126f8d2bf..fbddf0e4d9 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -85,6 +85,8 @@ enum ACTION_OK_DL_PLAYLIST_SETTINGS_LIST, ACTION_OK_DL_ACCOUNTS_LIST, ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST, + ACTION_OK_DL_ACCOUNTS_YOUTUBE_LIST, + ACTION_OK_DL_ACCOUNTS_TWITCH_LIST, ACTION_OK_DL_USER_BINDS_LIST, ACTION_OK_DL_CONTENT_LIST, ACTION_OK_DL_REMAP_FILE, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1f54307cbf..f16d822854 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7290,6 +7290,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) PARSE_ACTION, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_ACCOUNTS_YOUTUBE, + PARSE_ACTION, false) == 0) + count++; + + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_ACCOUNTS_TWITCH, + PARSE_ACTION, false) == 0) + count++; + if (count == 0) menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), @@ -7313,6 +7323,34 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) PARSE_ONLY_STRING, false) == 0) count++; + if (count == 0) + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_NO_ITEM, 0, 0); + + ret = 0; + info->need_refresh = true; + info->need_push = true; + break; + case DISPLAYLIST_ACCOUNTS_YOUTUBE_LIST: + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + if (count == 0) + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_NO_ITEM, 0, 0); + + ret = 0; + info->need_refresh = true; + info->need_push = true; + break; + case DISPLAYLIST_ACCOUNTS_TWITCH_LIST: + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + if (count == 0) menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 5a8d49b79f..d87c804527 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -154,6 +154,8 @@ enum menu_displaylist_ctl_state DISPLAYLIST_RECORDING_SETTINGS_LIST, DISPLAYLIST_PLAYLIST_SETTINGS_LIST, DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST, + DISPLAYLIST_ACCOUNTS_YOUTUBE_LIST, + DISPLAYLIST_ACCOUNTS_TWITCH_LIST, DISPLAYLIST_BROWSE_URL_LIST, DISPLAYLIST_BROWSE_URL_START, DISPLAYLIST_LOAD_CONTENT_LIST, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 7a3086f291..93c7b6993b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -133,6 +133,8 @@ enum settings_list_type SETTINGS_LIST_USER, SETTINGS_LIST_USER_ACCOUNTS, SETTINGS_LIST_USER_ACCOUNTS_CHEEVOS, + SETTINGS_LIST_USER_ACCOUNTS_YOUTUBE, + SETTINGS_LIST_USER_ACCOUNTS_TWITCH, SETTINGS_LIST_DIRECTORY, SETTINGS_LIST_PRIVACY, SETTINGS_LIST_MIDI @@ -9568,6 +9570,22 @@ static bool setting_append_list( parent_group); #endif + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_ACCOUNTS_YOUTUBE, + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + &group_info, + &subgroup_info, + parent_group); + + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_ACCOUNTS_TWITCH, + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + &group_info, + &subgroup_info, + parent_group); + END_SUB_GROUP(list, list_info, parent_group); END_GROUP(list, list_info, parent_group); break; diff --git a/msg_hash.h b/msg_hash.h index 173ba10965..27a7cddedc 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -966,6 +966,8 @@ enum msg_hash_enums MENU_LABEL(CHEEVOS_UNLOCKED_ACHIEVEMENTS), MENU_LABEL(CHEEVOS_LOCKED_ACHIEVEMENTS), MENU_LABEL(ACCOUNTS_RETRO_ACHIEVEMENTS), + MENU_LABEL(ACCOUNTS_TWITCH), + MENU_LABEL(ACCOUNTS_YOUTUBE), MENU_LABEL(ACCOUNTS_LIST), @@ -1071,6 +1073,8 @@ enum msg_hash_enums MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_USER_BINDS_LIST, MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST, + MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_TWITCH_LIST, + MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_YOUTUBE_LIST, MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_LIST, MENU_LABEL(FILE_DETECT_CORE_LIST_PUSH_DIR), From cf7eea30cb2715f3dce3eded6c5b4b450929fff8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 23:22:12 +0200 Subject: [PATCH 0070/1292] Add Youtube/Twitch Stream key settings --- configuration.c | 2 ++ configuration.h | 3 +++ intl/msg_hash_ar.h | 4 +++ intl/msg_hash_chs.h | 4 +++ intl/msg_hash_cht.h | 4 +++ intl/msg_hash_de.h | 4 +++ intl/msg_hash_eo.h | 4 +++ intl/msg_hash_es.h | 4 +++ intl/msg_hash_fr.h | 4 +++ intl/msg_hash_it.h | 4 +++ intl/msg_hash_ja.h | 4 +++ intl/msg_hash_ko.h | 4 +++ intl/msg_hash_lbl.h | 4 +++ intl/msg_hash_nl.h | 4 +++ intl/msg_hash_pl.h | 4 +++ intl/msg_hash_pt_br.h | 4 +++ intl/msg_hash_pt_pt.h | 4 +++ intl/msg_hash_ru.h | 4 +++ intl/msg_hash_us.h | 4 +++ intl/msg_hash_vn.h | 4 +++ menu/menu_displaylist.c | 10 ++++++++ menu/menu_setting.c | 54 +++++++++++++++++++++++++++++++++++++++++ msg_hash.h | 2 ++ 23 files changed, 143 insertions(+) diff --git a/configuration.c b/configuration.c index d4ec814f49..1831f5337c 100644 --- a/configuration.c +++ b/configuration.c @@ -1107,6 +1107,8 @@ static struct config_array_setting *populate_settings_array(settings_t *settings SETTING_ARRAY("midi_driver", settings->arrays.midi_driver, false, NULL, true); SETTING_ARRAY("midi_input", settings->arrays.midi_input, true, midi_input, true); SETTING_ARRAY("midi_output", settings->arrays.midi_output, true, midi_output, true); + SETTING_ARRAY("youtube_stream_key", settings->arrays.youtube_stream_key, true, NULL, true); + SETTING_ARRAY("twitch_stream_key", settings->arrays.twitch_stream_key, true, NULL, true); *size = count; return tmp; diff --git a/configuration.h b/configuration.h index 281471252b..9b150befb2 100644 --- a/configuration.h +++ b/configuration.h @@ -476,6 +476,9 @@ typedef struct settings char midi_input[32]; char midi_output[32]; + + char youtube_stream_key[PATH_MAX_LENGTH]; + char twitch_stream_key[PATH_MAX_LENGTH]; } arrays; struct diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 198c8ac1f0..1694947179 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3647,3 +3647,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 8678ab5e10..88f1407edd 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3431,3 +3431,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 7fe145858d..a0e2effc1d 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3423,3 +3423,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index c2cc07eff6..be45d4f8a9 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3533,3 +3533,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 73c69d2769..318589b705 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3298,3 +3298,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index bae5b5b649..52d813a1bf 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7553,3 +7553,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 5c10cc9465..52c814fd2b 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3457,3 +3457,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 170eb0ec88..8975b99735 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3517,3 +3517,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 7fd7f82b30..dcd7b75d37 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3920,3 +3920,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index ebfcfce345..4857b205e2 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3418,3 +3418,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 46db61489b..d0a3e48cef 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1695,3 +1695,7 @@ MSG_HASH(MENU_ENUM_LABEL_STREAMING_URL, "streaming_url") MSG_HASH(MENU_ENUM_LABEL_UDP_STREAM_PORT, "udp_stream_port") +MSG_HASH(MENU_ENUM_LABEL_TWITCH_STREAM_KEY, + "twitch_stream_key") +MSG_HASH(MENU_ENUM_LABEL_YOUTUBE_STREAM_KEY, + "youtube_stream_key") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index f5343afc7a..28a0130864 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3292,3 +3292,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 11f65a864e..130526327b 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3720,3 +3720,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 7288ec4122..daeff89b32 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7536,3 +7536,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index b584e53038..4c2b328b8e 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3384,3 +3384,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 926f445550..ad5e2497ed 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3587,3 +3587,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 9539802444..7628fc645c 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7574,3 +7574,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index bdb45fb9d9..77e3a2a0b2 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3455,3 +3455,7 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Twitch Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "YouTube Stream Key") diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index f16d822854..1f1a278c78 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7337,6 +7337,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_ACCOUNTS_YOUTUBE_LIST: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_YOUTUBE_STREAM_KEY, + PARSE_ONLY_STRING, false) == 0) + count++; + if (count == 0) menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), @@ -7351,6 +7356,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_ACCOUNTS_TWITCH_LIST: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_TWITCH_STREAM_KEY, + PARSE_ONLY_STRING, false) == 0) + count++; + if (count == 0) menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 93c7b6993b..1c5b303708 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -9586,6 +9586,58 @@ static bool setting_append_list( &subgroup_info, parent_group); + END_SUB_GROUP(list, list_info, parent_group); + END_GROUP(list, list_info, parent_group); + break; + case SETTINGS_LIST_USER_ACCOUNTS_YOUTUBE: + START_GROUP(list, list_info, &group_info, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE), + parent_group); + + parent_group = msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS); + + START_SUB_GROUP(list, list_info, "State", &group_info, &subgroup_info, parent_group); + + CONFIG_STRING( + list, list_info, + settings->arrays.youtube_stream_key, + sizeof(settings->arrays.youtube_stream_key), + MENU_ENUM_LABEL_YOUTUBE_STREAM_KEY, + MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + + END_SUB_GROUP(list, list_info, parent_group); + END_GROUP(list, list_info, parent_group); + break; + case SETTINGS_LIST_USER_ACCOUNTS_TWITCH: + START_GROUP(list, list_info, &group_info, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH), + parent_group); + + parent_group = msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS); + + START_SUB_GROUP(list, list_info, "State", &group_info, &subgroup_info, parent_group); + + CONFIG_STRING( + list, list_info, + settings->arrays.twitch_stream_key, + sizeof(settings->arrays.twitch_stream_key), + MENU_ENUM_LABEL_TWITCH_STREAM_KEY, + MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + END_SUB_GROUP(list, list_info, parent_group); END_GROUP(list, list_info, parent_group); break; @@ -10274,6 +10326,8 @@ static rarch_setting_t *menu_setting_new_internal(rarch_setting_info_t *list_inf SETTINGS_LIST_USER, SETTINGS_LIST_USER_ACCOUNTS, SETTINGS_LIST_USER_ACCOUNTS_CHEEVOS, + SETTINGS_LIST_USER_ACCOUNTS_YOUTUBE, + SETTINGS_LIST_USER_ACCOUNTS_TWITCH, SETTINGS_LIST_DIRECTORY, SETTINGS_LIST_PRIVACY, SETTINGS_LIST_MIDI diff --git a/msg_hash.h b/msg_hash.h index 27a7cddedc..b14254ead6 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -423,6 +423,8 @@ enum msg_hash_enums MENU_LABEL(ADD_TO_MIXER_AND_PLAY), MENU_LABEL(ADD_TO_MIXER_AND_COLLECTION), MENU_LABEL(ADD_TO_MIXER_AND_COLLECTION_AND_PLAY), + MENU_LABEL(TWITCH_STREAM_KEY), + MENU_LABEL(YOUTUBE_STREAM_KEY), MENU_ENUM_LABEL_MENU_TOGGLE, MENU_LABEL(FILTER_BY_CURRENT_CORE), From 1764bfe60f9831d371d207926afed16ad461b201 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 23:34:45 +0200 Subject: [PATCH 0071/1292] Added Streaming Mode --- configuration.c | 1 + configuration.h | 1 + intl/msg_hash_ar.h | 2 ++ intl/msg_hash_chs.h | 2 ++ intl/msg_hash_cht.h | 2 ++ intl/msg_hash_de.h | 2 ++ intl/msg_hash_eo.h | 2 ++ intl/msg_hash_es.h | 2 ++ intl/msg_hash_fr.h | 2 ++ intl/msg_hash_it.h | 2 ++ intl/msg_hash_ja.h | 2 ++ intl/msg_hash_ko.h | 2 ++ intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_nl.h | 2 ++ intl/msg_hash_pl.h | 2 ++ intl/msg_hash_pt_br.h | 2 ++ intl/msg_hash_pt_pt.h | 2 ++ intl/msg_hash_ru.h | 2 ++ intl/msg_hash_us.h | 2 ++ intl/msg_hash_vn.h | 2 ++ menu/menu_displaylist.c | 4 ++++ menu/menu_setting.c | 38 ++++++++++++++++++++++++++++++++++++++ msg_hash.h | 1 + record/record_driver.h | 7 +++++++ 24 files changed, 88 insertions(+) diff --git a/configuration.c b/configuration.c index 1831f5337c..661573c666 100644 --- a/configuration.c +++ b/configuration.c @@ -1536,6 +1536,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, unsigned count = 0; struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting)); + SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false); SETTING_UINT("crt_switch_resolution", &settings->uints.crt_switch_resolution, true, crt_switch_resolution, false); SETTING_UINT("input_bind_timeout", &settings->uints.input_bind_timeout, true, input_bind_timeout, false); SETTING_UINT("input_bind_hold", &settings->uints.input_bind_hold, true, input_bind_hold, false); diff --git a/configuration.h b/configuration.h index 9b150befb2..c873a8d094 100644 --- a/configuration.h +++ b/configuration.h @@ -432,6 +432,7 @@ typedef struct settings unsigned run_ahead_frames; unsigned midi_volume; + unsigned streaming_mode; } uints; struct diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 1694947179..5d4d0ffc6c 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3651,3 +3651,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 88f1407edd..80f308ad6a 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3435,3 +3435,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index a0e2effc1d..50e3d17f4c 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3427,3 +3427,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index be45d4f8a9..62984378c9 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3537,3 +3537,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 318589b705..a4f265f648 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3302,3 +3302,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 52d813a1bf..cdf9ab8eaa 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7557,3 +7557,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 52c814fd2b..ac1b1555b5 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3461,3 +3461,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 8975b99735..bca6a4bf45 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3521,3 +3521,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index dcd7b75d37..0b3dc7027b 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3924,3 +3924,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 4857b205e2..2cb15c3ec6 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3422,3 +3422,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index d0a3e48cef..3dc2422412 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1699,3 +1699,5 @@ MSG_HASH(MENU_ENUM_LABEL_TWITCH_STREAM_KEY, "twitch_stream_key") MSG_HASH(MENU_ENUM_LABEL_YOUTUBE_STREAM_KEY, "youtube_stream_key") +MSG_HASH(MENU_ENUM_LABEL_STREAMING_MODE, + "streaming_mode") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 28a0130864..832ce22ca4 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3296,3 +3296,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 130526327b..d00b566130 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3724,3 +3724,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index daeff89b32..799a453ae8 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7540,3 +7540,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 4c2b328b8e..c2e7238914 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3388,3 +3388,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index ad5e2497ed..4be91f3cb5 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3591,3 +3591,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 7628fc645c..9d843ed4aa 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7578,3 +7578,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 77e3a2a0b2..1c14c1f9aa 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3459,3 +3459,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1f1a278c78..556adcdf1b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7067,6 +7067,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_RECORD_PATH, PARSE_ONLY_STRING, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_STREAMING_MODE, + PARSE_ONLY_UINT, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_RECORD_USE_OUTPUT_DIRECTORY, PARSE_ONLY_BOOL, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1c5b303708..0981042b42 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -289,6 +289,28 @@ static int setting_action_ok_uint(rarch_setting_t *setting, bool wraparound) return 0; } +static void setting_get_string_representation_streaming_mode( + rarch_setting_t *setting, + char *s, size_t len) +{ + if (!setting) + return; + + /* TODO/FIXME - localize this */ + switch (*setting->value.target.unsigned_integer) + { + case STREAMING_MODE_TWITCH: + strlcpy(s, "Twitch", len); + break; + case STREAMING_MODE_YOUTUBE: + strlcpy(s, "YouTube", len); + break; + case STREAMING_MODE_UDP: + strlcpy(s, "UDP", len); + break; + } +} + static void setting_get_string_representation_video_stream_quality( rarch_setting_t *setting, char *s, size_t len) @@ -6491,6 +6513,22 @@ static bool setting_append_list( general_read_handler); menu_settings_list_current_add_values(list, list_info, "cfg"); + CONFIG_UINT( + list, list_info, + &settings->uints.streaming_mode, + MENU_ENUM_LABEL_STREAMING_MODE, + MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + STREAMING_MODE_TWITCH, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_streaming_mode; + menu_settings_list_current_add_range(list, list_info, 0, 2, 1, true, true); + CONFIG_UINT( list, list_info, &settings->uints.video_stream_port, diff --git a/msg_hash.h b/msg_hash.h index b14254ead6..87a77e7865 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -415,6 +415,7 @@ enum msg_hash_enums MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, MSG_RUNAHEAD_FAILED_TO_LOAD_STATE, MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, + MENU_LABEL(STREAMING_MODE), MENU_LABEL(VIDEO_RECORD_QUALITY), MENU_LABEL(VIDEO_STREAM_QUALITY), MENU_LABEL(STREAMING_URL), diff --git a/record/record_driver.h b/record/record_driver.h index 400fcbe87f..cf1a4c112c 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -31,6 +31,13 @@ enum ffemu_pix_format FFEMU_PIX_ARGB8888 }; +enum streaming_mode +{ + STREAMING_MODE_TWITCH = 0, + STREAMING_MODE_YOUTUBE, + STREAMING_MODE_UDP +}; + enum record_config_type { RECORD_CONFIG_TYPE_RECORDING_CUSTOM = 0, From 6f0a79acf9b3fd3567ccfe85786b097f9c863c94 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 24 Sep 2018 23:18:09 -0500 Subject: [PATCH 0072/1292] [record] hide these on non suitable platforms --- menu/menu_displaylist.c | 3 ++- record/drivers/record_ffmpeg.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 556adcdf1b..6cac82a78b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2656,6 +2656,7 @@ static int menu_displaylist_parse_load_content_settings( MENU_ENUM_LABEL_ADD_TO_FAVORITES, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); } +#ifdef HAVE_FFMPEG if (!recording_is_enabled()) { menu_entries_append_enum(info->list, @@ -2680,8 +2681,8 @@ static int menu_displaylist_parse_load_content_settings( msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING), msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING), MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING, MENU_SETTING_ACTION, 0, 0); - } +#endif if (settings->bools.quick_menu_show_options && !settings->bools.kiosk_mode_enable) { diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index d7831962b3..6d2f4fb462 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -597,7 +597,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p strlcpy(params->vcodec, "libx264", sizeof(params->vcodec)); strlcpy(params->acodec, "libmp3lame", sizeof(params->acodec)); - av_dict_set(¶ms->video_opts, "preset", "medium", 0); + av_dict_set(¶ms->video_opts, "preset", "superfast", 0); av_dict_set(¶ms->video_opts, "tune", "animation", 0); av_dict_set(¶ms->video_opts, "crf", "15", 0); av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); From 95974f9f3a7445de451d81b1bb0b7e094256ac87 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 23:50:29 +0200 Subject: [PATCH 0073/1292] Should correct setting somewhat --- menu/cbs/menu_cbs_ok.c | 25 +++++++++++++++++++++++++ menu/menu_cbs.h | 1 + menu/menu_displaylist.c | 11 ++++++++++- msg_hash.h | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 64520b48a6..97c5885fcb 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -78,6 +78,7 @@ enum { ACTION_OK_LOAD_PRESET = 0, ACTION_OK_LOAD_SHADER_PASS, + ACTION_OK_LOAD_STREAM_CONFIGFILE, ACTION_OK_LOAD_RECORD_CONFIGFILE, ACTION_OK_LOAD_REMAPPING_FILE, ACTION_OK_LOAD_CHEAT_FILE, @@ -475,6 +476,14 @@ int generic_action_ok_displaylist_push(const char *path, info_label = label; dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; + case ACTION_OK_DL_STREAM_CONFIGFILE: + filebrowser_clear_type(); + info.type = type; + info.directory_ptr = idx; + info_path = settings->paths.path_stream_config; + info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + break; case ACTION_OK_DL_RECORD_CONFIGFILE: filebrowser_clear_type(); { @@ -1291,6 +1300,14 @@ static int generic_action_ok(const char *path, } } break; + case ACTION_OK_LOAD_STREAM_CONFIGFILE: + { + settings_t *settings = config_get_ptr(); + flush_char = msg_hash_to_str(flush_id); + strlcpy(settings->paths.path_stream_config, action_path, + sizeof(settings->paths.path_stream_config)); + } + break; case ACTION_OK_LOAD_RECORD_CONFIGFILE: { global_t *global = global_get_ptr(); @@ -1417,6 +1434,7 @@ default_action_ok_set(action_ok_subsystem_add, ACTION_OK_SUBSYSTEM_ADD, default_action_ok_set(action_ok_cheat_file_load, ACTION_OK_LOAD_CHEAT_FILE, MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS) default_action_ok_set(action_ok_cheat_file_load_append, ACTION_OK_LOAD_CHEAT_FILE_APPEND, MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS) default_action_ok_set(action_ok_record_configfile_load, ACTION_OK_LOAD_RECORD_CONFIGFILE, MENU_ENUM_LABEL_RECORDING_SETTINGS) +default_action_ok_set(action_ok_stream_configfile_load, ACTION_OK_LOAD_STREAM_CONFIGFILE, MENU_ENUM_LABEL_RECORDING_SETTINGS) default_action_ok_set(action_ok_remap_file_load, ACTION_OK_LOAD_REMAPPING_FILE, MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS ) default_action_ok_set(action_ok_shader_preset_load, ACTION_OK_LOAD_PRESET , MENU_ENUM_LABEL_SHADER_OPTIONS) default_action_ok_set(action_ok_shader_pass_load, ACTION_OK_LOAD_SHADER_PASS, MENU_ENUM_LABEL_SHADER_OPTIONS) @@ -3718,6 +3736,7 @@ default_action_ok_func(action_ok_disk_image_append_list, ACTION_OK_DL_DISK_IMAGE default_action_ok_func(action_ok_subsystem_add_list, ACTION_OK_DL_SUBSYSTEM_ADD_LIST) default_action_ok_func(action_ok_subsystem_add_load, ACTION_OK_DL_SUBSYSTEM_LOAD) default_action_ok_func(action_ok_record_configfile, ACTION_OK_DL_RECORD_CONFIGFILE) +default_action_ok_func(action_ok_stream_configfile, ACTION_OK_DL_STREAM_CONFIGFILE) default_action_ok_func(action_ok_remap_file, ACTION_OK_DL_REMAP_FILE) default_action_ok_func(action_ok_shader_preset, ACTION_OK_DL_SHADER_PRESET) default_action_ok_func(action_ok_push_generic_list, ACTION_OK_DL_GENERIC) @@ -4846,6 +4865,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_RECORD_CONFIG: BIND_ACTION_OK(cbs, action_ok_record_configfile); break; + case MENU_ENUM_LABEL_STREAM_CONFIG: + BIND_ACTION_OK(cbs, action_ok_stream_configfile); + break; #ifdef HAVE_NETWORKING case MENU_ENUM_LABEL_DOWNLOAD_CORE_CONTENT: BIND_ACTION_OK(cbs, action_ok_core_content_list); @@ -5382,6 +5404,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case FILE_TYPE_RECORD_CONFIG: BIND_ACTION_OK(cbs, action_ok_record_configfile_load); break; + case FILE_TYPE_STREAM_CONFIG: + BIND_ACTION_OK(cbs, action_ok_stream_configfile_load); + break; case FILE_TYPE_REMAP: BIND_ACTION_OK(cbs, action_ok_remap_file_load); break; diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index fbddf0e4d9..76482efcb9 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -91,6 +91,7 @@ enum ACTION_OK_DL_CONTENT_LIST, ACTION_OK_DL_REMAP_FILE, ACTION_OK_DL_RECORD_CONFIGFILE, + ACTION_OK_DL_STREAM_CONFIGFILE, ACTION_OK_DL_DISK_IMAGE_APPEND_LIST, ACTION_OK_DL_SUBSYSTEM_ADD_LIST, ACTION_OK_DL_SUBSYSTEM_LOAD, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 556adcdf1b..9eca05ff91 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7690,8 +7690,17 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) free(info->exts); info->exts = strdup("cfg"); break; - case DISPLAYLIST_RECORD_CONFIG_FILES: case DISPLAYLIST_STREAM_CONFIG_FILES: + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + filebrowser_clear_type(); + info->type_default = FILE_TYPE_STREAM_CONFIG; + load_content = false; + use_filebrowser = true; + if (!string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("cfg"); + break; + case DISPLAYLIST_RECORD_CONFIG_FILES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); filebrowser_clear_type(); info->type_default = FILE_TYPE_RECORD_CONFIG; diff --git a/msg_hash.h b/msg_hash.h index 87a77e7865..f2a541a9e9 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -74,6 +74,7 @@ enum msg_file_type FILE_TYPE_BOOL_ON, FILE_TYPE_BOOL_OFF, FILE_TYPE_RECORD_CONFIG, + FILE_TYPE_STREAM_CONFIG, FILE_TYPE_PLAYLIST_COLLECTION, FILE_TYPE_PLAYLIST_ASSOCIATION, FILE_TYPE_MOVIE, From ad992d227b3a0d58778e61b8d874ea09f8c7bfec Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Wed, 26 Sep 2018 23:03:31 +0100 Subject: [PATCH 0074/1292] Guard against null settings; only test leaderboards if enabled --- cheevos/cheevos.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index e442957e77..6745c9c198 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -972,10 +972,16 @@ void cheevos_test(void) cheevos_test_cheevo_set(true); - if (settings->bools.cheevos_test_unofficial) - cheevos_test_cheevo_set(false); - - cheevos_test_leaderboards(); + if (settings) + { + if (settings->bools.cheevos_test_unofficial) + cheevos_test_cheevo_set(false); + + if (settings->bools.cheevos_hardcore_mode_enable && + settings->bools.cheevos_leaderboards_enable && + !cheevos_hardcore_paused) + cheevos_test_leaderboards(); + } } bool cheevos_set_cheats(void) From b328731fe577ebcd5ffad244392d6f8d9115d554 Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 26 Sep 2018 17:42:39 -0500 Subject: [PATCH 0075/1292] [record] refine the menu, make streaming actually follow the menu settings --- menu/menu_displaylist.c | 39 +++---- menu/menu_setting.c | 238 +++++++++++++++++++++++++--------------- record/record_driver.c | 3 +- record/record_driver.h | 3 +- 4 files changed, 167 insertions(+), 116 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 6cac82a78b..8d0bddd2b9 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7051,43 +7051,37 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->need_push = true; break; case DISPLAYLIST_RECORDING_SETTINGS_LIST: + { + settings_t *settings = config_get_ptr(); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_RECORD_ENABLE, - PARSE_ONLY_BOOL, false) == 0) + MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, + PARSE_ONLY_UINT, false) == 0) count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_RECORD_CONFIG, PARSE_ONLY_PATH, false) == 0) count++; if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_STREAM_CONFIG, - PARSE_ONLY_PATH, false) == 0) + MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, + PARSE_ONLY_UINT, false) == 0) count++; if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_RECORD_PATH, - PARSE_ONLY_STRING, false) == 0) + MENU_ENUM_LABEL_STREAM_CONFIG, + PARSE_ONLY_PATH, false) == 0) count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_STREAMING_MODE, PARSE_ONLY_UINT, false) == 0) count++; - if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_RECORD_USE_OUTPUT_DIRECTORY, - PARSE_ONLY_BOOL, false) == 0) - count++; - if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_UDP_STREAM_PORT, - PARSE_ONLY_UINT, false) == 0) - count++; - if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, - PARSE_ONLY_UINT, false) == 0) - count++; - if (menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, - PARSE_ONLY_UINT, false) == 0) - count++; + if (settings->uints.streaming_mode == STREAMING_MODE_LOCAL) + { + /* To-Do: Refresh on settings->uints.streaming_mode change to show this parameter */ + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_UDP_STREAM_PORT, + PARSE_ONLY_UINT, false) == 0) + count++; + } if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_STREAMING_URL, PARSE_ONLY_STRING, false) == 0) @@ -7109,6 +7103,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) 0, 0, 0); info->need_push = true; + } break; case DISPLAYLIST_MAIN_MENU: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 0981042b42..aa39151d05 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -305,8 +305,11 @@ static void setting_get_string_representation_streaming_mode( case STREAMING_MODE_YOUTUBE: strlcpy(s, "YouTube", len); break; - case STREAMING_MODE_UDP: - strlcpy(s, "UDP", len); + case STREAMING_MODE_LOCAL: + strlcpy(s, "Local", len); + break; + case STREAMING_MODE_CUSTOM: + strlcpy(s, "Custom", len); break; } } @@ -2950,6 +2953,58 @@ static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting) } #endif +#ifdef HAVE_FFMPEG +static void update_streaming_url_write_handler(rarch_setting_t *setting) +{ + settings_t *settings = config_get_ptr(); + const char* youtube_url = "rtmp://a.rtmp.youtube.com/live2/"; + const char* twitch_url = "rtmp://live.twitch.tv/app/"; + + if (!setting) + return; + + switch (settings->uints.streaming_mode) + { + case STREAMING_MODE_TWITCH: + { + if (!string_is_empty(settings->arrays.twitch_stream_key)) + snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), + "%s%s", twitch_url, settings->arrays.twitch_stream_key); + else + { + /* To-Do: Show input box for twitch_stream_key*/ + RARCH_LOG("[record] twitch streaming key empty"); + } + break; + } + case STREAMING_MODE_YOUTUBE: + { + if (!string_is_empty(settings->arrays.youtube_stream_key)) + { + snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), + "%s%s", youtube_url, settings->arrays.youtube_stream_key); + } + else + { + /* To-Do: Show input box for youtube_stream_key*/ + RARCH_LOG("[record] youtube streaming key empty"); + } + break; + } + case STREAMING_MODE_LOCAL: + /* To-Do: figure out default interface and bind to that instead */ + snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), + "udp://%s:%u", "127.0.0.1", settings->uints.video_stream_port); + break; + case STREAMING_MODE_CUSTOM: + default: + /* Do nothing, let the user input the URL */ + break; + } +} + +#endif + #ifdef HAVE_LAKKA static void systemd_service_toggle(const char *path, char *unit, bool enable) { @@ -6485,99 +6540,100 @@ static bool setting_append_list( parent_group = msg_hash_to_str(MENU_ENUM_LABEL_RECORDING_SETTINGS); START_SUB_GROUP(list, list_info, "State", &group_info, &subgroup_info, parent_group); - CONFIG_PATH( - list, list_info, - settings->paths.path_record_config, - sizeof(settings->paths.path_record_config), - MENU_ENUM_LABEL_RECORD_CONFIG, - MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, - "", - &group_info, - &subgroup_info, - parent_group, - general_write_handler, - general_read_handler); - menu_settings_list_current_add_values(list, list_info, "cfg"); + + CONFIG_UINT( + list, list_info, + &settings->uints.video_record_quality, + MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + 1, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_video_record_quality; + menu_settings_list_current_add_range(list, list_info, 0, 4, 1, true, true); CONFIG_PATH( - list, list_info, - settings->paths.path_stream_config, - sizeof(settings->paths.path_stream_config), - MENU_ENUM_LABEL_STREAM_CONFIG, - MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, - "", - &group_info, - &subgroup_info, - parent_group, - general_write_handler, - general_read_handler); + list, list_info, + settings->paths.path_record_config, + sizeof(settings->paths.path_record_config), + MENU_ENUM_LABEL_RECORD_CONFIG, + MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); menu_settings_list_current_add_values(list, list_info, "cfg"); - CONFIG_UINT( - list, list_info, - &settings->uints.streaming_mode, - MENU_ENUM_LABEL_STREAMING_MODE, - MENU_ENUM_LABEL_VALUE_STREAMING_MODE, - STREAMING_MODE_TWITCH, - &group_info, - &subgroup_info, - parent_group, - general_write_handler, - general_read_handler); - (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; - (*list)[list_info->index - 1].get_string_representation = - &setting_get_string_representation_streaming_mode; - menu_settings_list_current_add_range(list, list_info, 0, 2, 1, true, true); + CONFIG_UINT( + list, list_info, + &settings->uints.streaming_mode, + MENU_ENUM_LABEL_STREAMING_MODE, + MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + STREAMING_MODE_TWITCH, + &group_info, + &subgroup_info, + parent_group, + update_streaming_url_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_streaming_mode; + menu_settings_list_current_add_range(list, list_info, 0, STREAMING_MODE_CUSTOM, 1, true, true); - CONFIG_UINT( - list, list_info, - &settings->uints.video_stream_port, - MENU_ENUM_LABEL_UDP_STREAM_PORT, - MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, - 1, - &group_info, - &subgroup_info, - parent_group, - general_write_handler, - general_read_handler); - (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; - (*list)[list_info->index - 1].offset_by = 1; - menu_settings_list_current_add_range(list, list_info, 1, 65536, 1, true, true); + CONFIG_UINT( + list, list_info, + &settings->uints.video_stream_port, + MENU_ENUM_LABEL_UDP_STREAM_PORT, + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + 1, + &group_info, + &subgroup_info, + parent_group, + update_streaming_url_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].offset_by = 1; + menu_settings_list_current_add_range(list, list_info, 1, 65536, 1, true, true); - CONFIG_UINT( - list, list_info, - &settings->uints.video_record_quality, - MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, - MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, - 1, - &group_info, - &subgroup_info, - parent_group, - general_write_handler, - general_read_handler); - (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; - (*list)[list_info->index - 1].get_string_representation = - &setting_get_string_representation_video_record_quality; - menu_settings_list_current_add_range(list, list_info, 0, 4, 1, true, true); - - CONFIG_UINT( - list, list_info, - &settings->uints.video_stream_quality, - MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, - MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, - 1, - &group_info, - &subgroup_info, - parent_group, - general_write_handler, - general_read_handler); - (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; - (*list)[list_info->index - 1].get_string_representation = - &setting_get_string_representation_video_stream_quality; - (*list)[list_info->index - 1].offset_by = 5; - menu_settings_list_current_add_range(list, list_info, 5, 8, 1, true, true); + CONFIG_UINT( + list, list_info, + &settings->uints.video_stream_quality, + MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + 1, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_video_stream_quality; + (*list)[list_info->index - 1].offset_by = 5; + menu_settings_list_current_add_range(list, list_info, 5, 8, 1, true, true); - CONFIG_STRING( + CONFIG_PATH( + list, list_info, + settings->paths.path_stream_config, + sizeof(settings->paths.path_stream_config), + MENU_ENUM_LABEL_STREAM_CONFIG, + MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_values(list, list_info, "cfg"); + + CONFIG_STRING( list, list_info, settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), @@ -6589,9 +6645,9 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); - CONFIG_DIR( + CONFIG_DIR( list, list_info, global->record.output_dir, sizeof(global->record.output_dir), @@ -6604,7 +6660,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - (*list)[list_info->index - 1].action_start = directory_action_start_generic; + (*list)[list_info->index - 1].action_start = directory_action_start_generic; END_SUB_GROUP(list, list_info, parent_group); diff --git a/record/record_driver.c b/record/record_driver.c index 6f02833859..0d36edd0ce 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -37,7 +37,6 @@ #include "../list_special.h" #include "../paths.h" - static const record_driver_t *record_drivers[] = { #ifdef HAVE_FFMPEG &record_ffmpeg, @@ -362,7 +361,7 @@ bool recording_init(void) if (!string_is_empty(settings->paths.path_stream_url)) strlcpy(output, settings->paths.path_stream_url, sizeof(output)); else - /* to-do determine the local interface, this won't work for connecting over the internet*/ + /* Fallback, stream locally to 127.0.0.1 */ snprintf(output, sizeof(output), "udp://127.0.0.1:%u", settings->uints.video_stream_port); else { diff --git a/record/record_driver.h b/record/record_driver.h index cf1a4c112c..5e959ee08c 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -35,7 +35,8 @@ enum streaming_mode { STREAMING_MODE_TWITCH = 0, STREAMING_MODE_YOUTUBE, - STREAMING_MODE_UDP + STREAMING_MODE_LOCAL, + STREAMING_MODE_CUSTOM }; enum record_config_type From 72ed1c0b82da15c256087fe8ece0931651eb3d56 Mon Sep 17 00:00:00 2001 From: M4xw Date: Tue, 25 Sep 2018 23:50:37 +0200 Subject: [PATCH 0076/1292] [LIBNX] Threading; Use a ThreadCoreMask and let the system schedule it. --- libretro-common/rthreads/switch_pthread.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libretro-common/rthreads/switch_pthread.h b/libretro-common/rthreads/switch_pthread.h index 7dc32adfca..8e6374dc5f 100644 --- a/libretro-common/rthreads/switch_pthread.h +++ b/libretro-common/rthreads/switch_pthread.h @@ -66,18 +66,27 @@ static uint32_t threadCounter = 1; int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) { u32 prio = 0; + u64 core_mask = 0; + Thread new_switch_thread; svcGetThreadPriority(&prio, CUR_THREAD_HANDLE); + svcGetInfo(&core_mask, 0, CUR_PROCESS_HANDLE, 0); // Launch threads on Core 1 - int rc = threadCreate(&new_switch_thread, (void (*)(void *))start_routine, arg, STACKSIZE, prio - 1, 1); + int rc = threadCreate(&new_switch_thread, (void (*)(void *))start_routine, arg, STACKSIZE, prio - 1, -2); if (R_FAILED(rc)) { return EAGAIN; } + rc = svcSetThreadCoreMask(new_switch_thread.handle, -1, core_mask); + if (R_FAILED(rc)) + { + return -1; + } + printf("[Threading]: Starting Thread(#%i)\n", threadCounter); if (R_FAILED(threadStart(&new_switch_thread))) { From 7fc210a0c32593b10ea1d9f38dd6533e94500e6d Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 26 Sep 2018 17:55:47 -0500 Subject: [PATCH 0077/1292] [record] fix some defaults and value ranges --- menu/menu_setting.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index aa39151d05..7fd2ade963 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -6546,7 +6546,7 @@ static bool setting_append_list( &settings->uints.video_record_quality, MENU_ENUM_LABEL_VIDEO_RECORD_QUALITY, MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, - 1, + RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY, &group_info, &subgroup_info, parent_group, @@ -6555,7 +6555,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_record_quality; - menu_settings_list_current_add_range(list, list_info, 0, 4, 1, true, true); + menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_RECORDING_CUSTOM, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, 1, true, true); CONFIG_PATH( list, list_info, @@ -6607,7 +6607,7 @@ static bool setting_append_list( &settings->uints.video_stream_quality, MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, - 1, + RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY, &group_info, &subgroup_info, parent_group, @@ -6617,7 +6617,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_stream_quality; (*list)[list_info->index - 1].offset_by = 5; - menu_settings_list_current_add_range(list, list_info, 5, 8, 1, true, true); + menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_STREAMING_CUSTOM, RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY, 1, true, true); CONFIG_PATH( list, list_info, From ef3677633cdc81c669289bdb719973fb1c219f0d Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 26 Sep 2018 18:00:39 -0500 Subject: [PATCH 0078/1292] [record] fix logging --- menu/menu_setting.c | 4 ++-- record/drivers/record_ffmpeg.c | 4 ++-- record/record_driver.c | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 7fd2ade963..cf6a253cfc 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2973,7 +2973,7 @@ static void update_streaming_url_write_handler(rarch_setting_t *setting) else { /* To-Do: Show input box for twitch_stream_key*/ - RARCH_LOG("[record] twitch streaming key empty"); + RARCH_LOG("[recording] twitch streaming key empty"); } break; } @@ -2987,7 +2987,7 @@ static void update_streaming_url_write_handler(rarch_setting_t *setting) else { /* To-Do: Show input box for youtube_stream_key*/ - RARCH_LOG("[record] youtube streaming key empty"); + RARCH_LOG("[recording] youtube streaming key empty"); } break; } diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 6d2f4fb462..2ae537fee8 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -700,7 +700,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, params->conf = config_file_new(config); if (!params->conf) { - RARCH_ERR("Failed to load FFmpeg config \"%s\".\n", config); + RARCH_ERR("[FFmpeg] Failed to load FFmpeg config \"%s\".\n", config); return false; } @@ -735,7 +735,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, params->out_pix_fmt = av_get_pix_fmt(pix_fmt); if (params->out_pix_fmt == PIX_FMT_NONE) { - RARCH_ERR("Cannot find pix_fmt \"%s\".\n", pix_fmt); + RARCH_ERR("[FFmpeg] Cannot find pix_fmt \"%s\".\n", pix_fmt); return false; } } diff --git a/record/record_driver.c b/record/record_driver.c index 0d36edd0ce..aca643ab44 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -118,12 +118,12 @@ void find_record_driver(void) { unsigned d; - RARCH_ERR("Couldn't find any record driver named \"%s\"\n", + RARCH_ERR("[recording] Couldn't find any record driver named \"%s\"\n", settings->arrays.record_driver); RARCH_LOG_OUTPUT("Available record drivers are:\n"); for (d = 0; record_driver_find_handle(d); d++) RARCH_LOG_OUTPUT("\t%s\n", record_driver_find_ident(d)); - RARCH_WARN("Going to default to first record driver...\n"); + RARCH_WARN("[recording] Going to default to first record driver...\n"); } recording_driver = (const record_driver_t*)record_driver_find_handle(0); @@ -216,7 +216,7 @@ void recording_dump_frame(const void *data, unsigned width, if (!vp.width || !vp.height) { - RARCH_WARN("%s \n", + RARCH_WARN("[recording] %s \n", msg_hash_to_str(MSG_VIEWPORT_SIZE_CALCULATION_FAILED)); command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL); @@ -228,7 +228,7 @@ void recording_dump_frame(const void *data, unsigned width, if ( vp.width != recording_gpu_width || vp.height != recording_gpu_height) { - RARCH_WARN("%s\n", msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE)); + RARCH_WARN("[recording] %s\n", msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE)); runloop_msg_queue_push( msg_hash_to_str(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE), @@ -335,7 +335,7 @@ bool recording_init(void) if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) { - RARCH_WARN("%s\n", + RARCH_WARN("[recording] %s\n", msg_hash_to_str(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED)); return false; } @@ -343,12 +343,12 @@ bool recording_init(void) if (!settings->bools.video_gpu_record && video_driver_is_hw_context()) { - RARCH_WARN("%s.\n", + RARCH_WARN("[recording] %s.\n", msg_hash_to_str(MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING)); return false; } - RARCH_LOG("%s: FPS: %.4f, Sample rate: %.4f\n", + RARCH_LOG("[recording] %s: FPS: %.4f, Sample rate: %.4f\n", msg_hash_to_str(MSG_CUSTOM_TIMING_GIVEN), (float)av_info->timing.fps, (float)av_info->timing.sample_rate); @@ -417,7 +417,7 @@ bool recording_init(void) if (!vp.width || !vp.height) { - RARCH_ERR("Failed to get viewport information from video driver. " + RARCH_ERR("[recording] Failed to get viewport information from video driver. " "Cannot start recording ...\n"); return false; } @@ -437,7 +437,7 @@ bool recording_init(void) recording_gpu_width = vp.width; recording_gpu_height = vp.height; - RARCH_LOG("%s %u x %u\n", msg_hash_to_str(MSG_DETECTED_VIEWPORT_OF), + RARCH_LOG("[recording] %s %u x %u\n", msg_hash_to_str(MSG_DETECTED_VIEWPORT_OF), vp.width, vp.height); gpu_size = vp.width * vp.height * 3; @@ -477,7 +477,7 @@ bool recording_init(void) } } - RARCH_LOG("%s %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n", + RARCH_LOG("[recording] %s %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n", msg_hash_to_str(MSG_RECORDING_TO), output, params.out_width, params.out_height, @@ -486,7 +486,7 @@ bool recording_init(void) if (!record_driver_init_first(&recording_driver, &recording_data, ¶ms)) { - RARCH_ERR("%s\n", msg_hash_to_str(MSG_FAILED_TO_START_RECORDING)); + RARCH_ERR("[recording] %s\n", msg_hash_to_str(MSG_FAILED_TO_START_RECORDING)); command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL); return false; From cf097d7f42e4762b2925960caf29ea2ee1a74328 Mon Sep 17 00:00:00 2001 From: M4xw Date: Thu, 27 Sep 2018 00:52:06 +0200 Subject: [PATCH 0079/1292] [LIBNX] Implement OpenGL --- Makefile.common | 3 + Makefile.libnx | 38 +- frontend/drivers/platform_switch.c | 34 +- gfx/common/switch_common.h | 20 + gfx/drivers/gl.c | 14 +- gfx/drivers_context/switch_ctx.c | 288 ++++++ gfx/video_driver.c | 3 + gfx/video_driver.h | 1 + libretro-common/glsym/glsym_gl.c | 379 ++++++++ libretro-common/glsym/xglgen.py | 140 +++ libretro-common/include/glsym/glsym.h | 3 + .../include/glsym/rglgen_headers.h | 6 + libretro-common/include/glsym/switch/nx_gl.h | 848 ++++++++++++++++++ .../include/glsym/switch/nx_glsym.h | 779 ++++++++++++++++ 14 files changed, 2533 insertions(+), 23 deletions(-) create mode 100644 gfx/drivers_context/switch_ctx.c create mode 100644 libretro-common/glsym/xglgen.py create mode 100644 libretro-common/include/glsym/switch/nx_gl.h create mode 100644 libretro-common/include/glsym/switch/nx_glsym.h diff --git a/Makefile.common b/Makefile.common index e3222a890d..3d06874353 100644 --- a/Makefile.common +++ b/Makefile.common @@ -828,6 +828,9 @@ ifeq ($(TARGET), retroarch_switch) ifeq ($(HAVE_LIBNX), 1) OBJ += menu/drivers_display/menu_display_switch.o \ gfx/drivers/switch_nx_gfx.o + ifeq ($(HAVE_OPENGL), 1) + OBJ += gfx/drivers_context/switch_ctx.o + endif else OBJ += gfx/drivers/switch_gfx.o endif diff --git a/Makefile.libnx b/Makefile.libnx index ab43db7ce4..fc461a2b5d 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -20,7 +20,7 @@ OBJ := # For threading we need to overwrite some vars with global defines because devkitPro's includes # make it hard for us. This works for the pthread wrapper DEFINES_THREAD := -Dpthread_t=Thread -Dpthread_mutex_t=Mutex -Dpthread_mutexattr_t='void*' -Dpthread_attr_t=int -Dpthread_cond_t=CondVar -Dpthread_condattr_t='int' -D_SYS__PTHREADTYPES_H_ -DEFINES := -U__linux__ -U__linux -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' $(DEFINES_THREAD) +DEFINES := -D__SWITCH__=1 -U__linux__ -U__linux -DGLM_FORCE_PURE=1 -DRARCH_CONSOLE -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' $(DEFINES_THREAD) HAVE_CC_RESAMPLER = 1 HAVE_MENU_COMMON = 1 @@ -28,13 +28,9 @@ HAVE_RTGA = 1 HAVE_RPNG = 1 HAVE_RJPEG = 1 HAVE_RBMP = 1 -HAVE_RGUI = 1 HAVE_ZLIB = 1 HAVE_BUILTINZLIB = 1 HAVE_LIBRETRODB = 1 -HAVE_ZARCH = 0 -HAVE_MATERIALUI = 0 -HAVE_XMB = 0 HAVE_STATIC_VIDEO_FILTERS = 1 HAVE_STATIC_AUDIO_FILTERS = 1 HAVE_MENU = 1 @@ -47,6 +43,26 @@ HAVE_PTHREADS = 1 HAVE_FREETYPE = 0 HAVE_SWITCH = 1 HAVE_LIBNX = 1 +HAVE_OPENGL = 0 + +ifeq ($(HAVE_OPENGL), 1) + HAVE_EGL = 1 + HAVE_SHADERPIPELINE = 1 + + HAVE_RGUI = 1 + HAVE_MATERIALUI = 1 + + HAVE_ZARCH = 0 + HAVE_XMB = 0 + HAVE_STRIPES = 0 +else + HAVE_RGUI = 1 + + HAVE_ZARCH = 0 + HAVE_MATERIALUI = 0 + HAVE_XMB = 0 + HAVE_STRIPES = 0 +endif include Makefile.common BLACKLIST := @@ -94,16 +110,24 @@ NO_ICON := 1 ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd CFLAGS := -g -Wall -O3 -ffast-math -ffunction-sections \ - $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -include $(LIBNX)/include/switch.h #$(shell $(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags) + $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h $(shell $(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags) CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 +# The following line works around an issue in newlib that produces a compilation +# error in glm. It will be removed as soon as this issue is resolved. +CFLAGS += -D_GLIBCXX_USE_C99_MATH_TR1 -D_LDBL_EQ_DBL + CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs $(ARCH) -Wl,--allow-multiple-definition -Wl,-Map,$(notdir $*.map) -LIBS := -lnx -lm -lstdc++ -lbz2 -lpng -lz +LIBS := -lstdc++ -lbz2 -lpng -lz -lnx -lm + +ifeq ($(HAVE_OPENGL), 1) + LIBS := -lEGL -lglapi -ldrm_nouveau $(LIBS) +endif #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 953739aa88..08dd812bb9 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -44,6 +44,7 @@ #ifdef HAVE_LIBNX #define SD_PREFIX +#include "../../gfx/common/switch_common.h" #else #define SD_PREFIX "/sd" #endif @@ -58,9 +59,6 @@ static uint64_t frontend_switch_get_mem_used(void); // Splash static uint32_t *splashData = NULL; -// switch_gfx.c protypes, we really need a header -extern void gfx_slow_swizzling_blit(uint32_t *buffer, uint32_t *image, int w, int h, int tx, int ty, bool blend); - #endif // HAVE_LIBNX static void get_first_valid_core(char *path_return) @@ -148,6 +146,7 @@ static void frontend_switch_get_environment_settings(int *argc, char *argv[], vo file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); } +extern switch_ctx_data_t *nx_ctx_ptr; static void frontend_switch_deinit(void *data) { (void)data; @@ -164,8 +163,15 @@ static void frontend_switch_deinit(void *data) splashData = NULL; } +#ifdef HAVE_OPENGL + // Workaround for eglTerminate/re-init bug + egl_destroy(&nx_ctx_ptr->egl); + nx_ctx_ptr->resize = false; + free(nx_ctx_ptr); +#else gfxExit(); #endif +#endif } #ifdef HAVE_LIBNX @@ -563,7 +569,8 @@ static void frontend_switch_init(void *data) { (void)data; -#ifdef HAVE_LIBNX // splash +#ifdef HAVE_LIBNX +#ifndef HAVE_OPENGL // Init Resolution before initDefault gfxInitResolution(1280, 720); @@ -571,26 +578,24 @@ static void frontend_switch_init(void *data) gfxSetMode(GfxMode_TiledDouble); gfxConfigureTransform(0); - +#endif // HAVE_OPENGL #ifdef NXLINK socketInitializeDefault(); nxlinkStdio(); #ifndef IS_SALAMANDER verbosity_enable(); -#endif +#endif // IS_SALAMANDER #endif // NXLINK rarch_system_info_t *sys_info = runloop_get_system_info(); retro_get_system_info(sys_info); const char *core_name = NULL; - - printf("[Video]: Video initialized\n"); - uint32_t width, height; width = height = 0; // Load splash +#ifndef HAVE_OPENGL if (!splashData) { if (sys_info) @@ -631,6 +636,7 @@ static void frontend_switch_init(void *data) { frontend_switch_showsplash(); } +#endif #endif // HAVE_LIBNX (splash) } @@ -690,12 +696,16 @@ static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor) #ifdef HAVE_LIBNX // There is pretty sure a better way, but this will do just fine - if (kernelAbove500()) + if (kernelAbove600()) + { + *major = 6; + *minor = 0; + } + else if(kernelAbove500()) { *major = 5; *minor = 0; - } - else if (kernelAbove400()) + }else if (kernelAbove400()) { *major = 4; *minor = 0; diff --git a/gfx/common/switch_common.h b/gfx/common/switch_common.h index 205f8ab68d..aa1813bf4c 100644 --- a/gfx/common/switch_common.h +++ b/gfx/common/switch_common.h @@ -4,6 +4,10 @@ #include #include +#ifdef HAVE_EGL +#include "../common/egl_common.h" +#endif + typedef struct { bool vsync; @@ -54,6 +58,22 @@ typedef struct uint32_t o_width; } switch_video_t; +typedef struct +{ +#ifdef HAVE_EGL + egl_ctx_data_t egl; +#endif + + struct + { + unsigned short width; + unsigned short height; + } native_window; + bool resize; + unsigned width, height; + float refresh_rate; +} switch_ctx_data_t; + void gfx_slow_swizzling_blit(uint32_t *buffer, uint32_t *image, int w, int h, int tx, int ty, bool blend); #endif diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index fd9870b645..aec9114e96 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -952,6 +952,12 @@ static bool gl_frame(void *data, const void *frame, if (!gl) return false; +#ifdef HAVE_LIBNX + // Should be called once per frame + if(!appletMainLoop()) + return false; +#endif + context_bind_hw_render(false); if (gl->core_context_in_use && gl->renderchain_driver->bind_vao) @@ -1756,6 +1762,10 @@ static void *gl_init(const video_info_t *video, if (!video_context_driver_set_video_mode(&mode)) goto error; +#if !defined(RARCH_CONSOLE) || defined(HAVE_LIBNX) + rglgen_resolve_symbols(ctx_driver->get_proc_address); +#endif + /* Clear out potential error flags in case we use cached context. */ glGetError(); @@ -1769,10 +1779,6 @@ static void *gl_init(const video_info_t *video, if (!string_is_empty(version)) sscanf(version, "%d.%d", &gl->version_major, &gl->version_minor); -#ifndef RARCH_CONSOLE - rglgen_resolve_symbols(ctx_driver->get_proc_address); -#endif - hwr = video_driver_get_hw_context(); if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) diff --git a/gfx/drivers_context/switch_ctx.c b/gfx/drivers_context/switch_ctx.c new file mode 100644 index 0000000000..cb8ef1de52 --- /dev/null +++ b/gfx/drivers_context/switch_ctx.c @@ -0,0 +1,288 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2018 - M4xw + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#include + +#include "../common/switch_common.h" +#include "../../frontend/frontend_driver.h" + +static enum gfx_ctx_api ctx_nx_api = GFX_CTX_OPENGL_API; +switch_ctx_data_t *nx_ctx_ptr = NULL; + +void switch_ctx_destroy(void *data) +{ + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + + if (ctx_nx) + { +#ifdef HAVE_EGL + // Workaround for eglTerminate/re-init bug, other part in platform_switch.c + //egl_destroy(&ctx_nx->egl); +#endif + ctx_nx->resize = false; + //free(ctx_nx); + } +} + +static void switch_ctx_get_video_size(void *data, + unsigned *width, unsigned *height) +{ + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + + *width = 1280; + *height = 720; +} + +static void *switch_ctx_init(video_frame_info_t *video_info, void *video_driver) +{ +#ifdef HAVE_EGL + EGLint n; + EGLint major, minor; + static const EGLint attribs[] = { + EGL_BLUE_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_RED_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_NONE}; +#endif + + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)calloc(1, sizeof(*ctx_nx)); + + if (!ctx_nx) + return NULL; + + nx_ctx_ptr = ctx_nx; + + //setenv("MESA_NO_ERROR", "1", 1); + + // Uncomment below to enable Mesa logging: + //setenv("EGL_LOG_LEVEL", "debug", 1); + //setenv("MESA_VERBOSE", "all", 1); + //setenv("NOUVEAU_MESA_DEBUG", "1", 1); + + // Uncomment below to enable shader debugging in Nouveau: + //setenv("NV50_PROG_OPTIMIZE", "0", 1); + //setenv("NV50_PROG_DEBUG", "1", 1); + //setenv("NV50_PROG_CHIPSET", "0x120", 1); + +#ifdef HAVE_EGL + if (!egl_init_context(&ctx_nx->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, + &major, &minor, &n, attribs)) + { + egl_report_error(); + goto error; + } +#endif + + return ctx_nx; + +error: + printf("[NXGL]: EGL error: %d.\n", eglGetError()); + switch_ctx_destroy(video_driver); + return NULL; +} + +static void switch_ctx_check_window(void *data, bool *quit, + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) +{ + unsigned new_width, new_height; + + switch_ctx_get_video_size(data, &new_width, &new_height); + + if (new_width != *width || new_height != *height) + { + *width = new_width; + *height = new_height; + *resize = true; + } + + *quit = (bool)false; +} + +static bool switch_ctx_set_video_mode(void *data, + video_frame_info_t *video_info, + unsigned width, unsigned height, + bool fullscreen) +{ + // Create an EGL rendering context + static const EGLint contextAttributeList[] = + { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE}; + + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + + ctx_nx->width = 1280; + ctx_nx->height = 720; + + ctx_nx->native_window.width = ctx_nx->width; + ctx_nx->native_window.height = ctx_nx->height; + + ctx_nx->refresh_rate = 60; + +#ifdef HAVE_EGL + if (!egl_create_context(&ctx_nx->egl, contextAttributeList)) + { + egl_report_error(); + goto error; + } +#endif + +#ifdef HAVE_EGL + if (!egl_create_surface(&ctx_nx->egl, &ctx_nx->native_window)) + goto error; +#endif + + return true; + +error: + printf("[ctx_nx]: EGL error: %d.\n", eglGetError()); + switch_ctx_destroy(data); + + return false; +} + +static void switch_ctx_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) +{ + *input = NULL; + *input_data = NULL; +} + +static enum gfx_ctx_api switch_ctx_get_api(void *data) +{ + return ctx_nx_api; +} + +static bool switch_ctx_bind_api(void *data, + enum gfx_ctx_api api, unsigned major, unsigned minor) +{ + (void)data; + ctx_nx_api = api; + + if (api == GFX_CTX_OPENGL_API) + if (eglBindAPI(EGL_OPENGL_API) != EGL_FALSE) + return true; + + return false; +} + +static bool switch_ctx_has_focus(void *data) +{ + (void)data; + return true; +} + +static bool switch_ctx_suppress_screensaver(void *data, bool enable) +{ + (void)data; + (void)enable; + return false; +} + +static void switch_ctx_set_swap_interval(void *data, + int swap_interval) +{ + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + +#ifdef HAVE_EGL + egl_set_swap_interval(&ctx_nx->egl, swap_interval); +#endif +} + +static void switch_ctx_swap_buffers(void *data, void *data2) +{ + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + +#ifdef HAVE_EGL + egl_swap_buffers(&ctx_nx->egl); +#endif +} + +static gfx_ctx_proc_t switch_ctx_get_proc_address(const char *symbol) +{ +#ifdef HAVE_EGL + return egl_get_proc_address(symbol); +#endif +} + +static void switch_ctx_bind_hw_render(void *data, bool enable) +{ + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + +#ifdef HAVE_EGL + egl_bind_hw_render(&ctx_nx->egl, enable); +#endif +} + +static uint32_t switch_ctx_get_flags(void *data) +{ + uint32_t flags = 0; + BIT32_SET(flags, GFX_CTX_FLAGS_NONE); + + return flags; +} + +static void switch_ctx_set_flags(void *data, uint32_t flags) +{ + (void)data; +} + +static float switch_ctx_get_refresh_rate(void *data) +{ + switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; + + return ctx_nx->refresh_rate; +} + +const gfx_ctx_driver_t switch_ctx = { + switch_ctx_init, + switch_ctx_destroy, + switch_ctx_get_api, + switch_ctx_bind_api, + switch_ctx_set_swap_interval, + switch_ctx_set_video_mode, + switch_ctx_get_video_size, + switch_ctx_get_refresh_rate, + NULL, /* get_video_output_size */ + NULL, /* get_video_output_prev */ + NULL, /* get_video_output_next */ + NULL, /* get_metrics */ + NULL, + NULL, /* update_title */ + switch_ctx_check_window, + NULL, /* set_resize */ + switch_ctx_has_focus, + switch_ctx_suppress_screensaver, + NULL, /* has_windowed */ + switch_ctx_swap_buffers, + switch_ctx_input_driver, + switch_ctx_get_proc_address, + NULL, + NULL, + NULL, + "switch", + switch_ctx_get_flags, + switch_ctx_set_flags, + switch_ctx_bind_hw_render, + NULL, + NULL}; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 4192261490..2ad6904bb8 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -354,6 +354,9 @@ static const video_driver_t *video_drivers[] = { }; static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { +#if defined(HAVE_LIBNX) && defined(HAVE_OPENGL) + &switch_ctx, +#endif #if defined(__CELLOS_LV2__) &gfx_ctx_ps3, #endif diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 82d771d28c..9a1293b11b 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1298,6 +1298,7 @@ extern const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev; extern const gfx_ctx_driver_t gfx_ctx_khr_display; extern const gfx_ctx_driver_t gfx_ctx_gdi; extern const gfx_ctx_driver_t gfx_ctx_sixel; +extern const gfx_ctx_driver_t switch_ctx; extern const gfx_ctx_driver_t gfx_ctx_null; diff --git a/libretro-common/glsym/glsym_gl.c b/libretro-common/glsym/glsym_gl.c index d89992c919..8fa9697294 100644 --- a/libretro-common/glsym/glsym_gl.c +++ b/libretro-common/glsym/glsym_gl.c @@ -27,6 +27,385 @@ #define SYM(x) { "gl" #x, &(gl##x) } const struct rglgen_sym_map rglgen_symbol_map[] = { +#ifdef HAVE_LIBNX + // xglgen missing + SYM(ReadPixels), + SYM(TexImage2D), + SYM(Viewport), + SYM(TexParameteri), + SYM(TexSubImage2D), + SYM(TexParameteriv), + SYM(DrawElements), + + // xglgen generated + SYM(ClearIndex), + SYM(ClearColor), + SYM(Clear), + SYM(IndexMask), + SYM(ColorMask), + SYM(AlphaFunc), + SYM(BlendFunc), + SYM(LogicOp), + SYM(CullFace), + SYM(FrontFace), + SYM(PointSize), + SYM(LineWidth), + SYM(LineStipple), + SYM(PolygonMode), + SYM(PolygonOffset), + SYM(PolygonStipple), + SYM(GetPolygonStipple), + SYM(EdgeFlag), + SYM(EdgeFlagv), + SYM(Scissor), + SYM(ClipPlane), + SYM(GetClipPlane), + SYM(DrawBuffer), + SYM(ReadBuffer), + SYM(Enable), + SYM(Disable), + SYM(IsEnabled), + SYM(EnableClientState), + SYM(DisableClientState), + SYM(GetBooleanv), + SYM(GetDoublev), + SYM(GetFloatv), + SYM(GetIntegerv), + SYM(PushAttrib), + SYM(PopAttrib), + SYM(PushClientAttrib), + SYM(PopClientAttrib), + SYM(RenderMode), + SYM(GetError), + SYM(GetString), + SYM(Finish), + SYM(Flush), + SYM(Hint), + SYM(ClearDepth), + SYM(DepthFunc), + SYM(DepthMask), + SYM(DepthRange), + SYM(ClearAccum), + SYM(Accum), + SYM(MatrixMode), + SYM(PushMatrix), + SYM(PopMatrix), + SYM(LoadIdentity), + SYM(LoadMatrixd), + SYM(LoadMatrixf), + SYM(MultMatrixd), + SYM(MultMatrixf), + SYM(Scaled), + SYM(Scalef), + SYM(Translated), + SYM(Translatef), + SYM(IsList), + SYM(DeleteLists), + SYM(GenLists), + SYM(NewList), + SYM(EndList), + SYM(CallList), + SYM(ListBase), + SYM(Begin), + SYM(End), + SYM(Vertex2d), + SYM(Vertex2f), + SYM(Vertex2i), + SYM(Vertex2s), + SYM(Vertex3d), + SYM(Vertex3f), + SYM(Vertex3i), + SYM(Vertex3s), + SYM(Vertex4d), + SYM(Vertex4f), + SYM(Vertex4i), + SYM(Vertex4s), + SYM(Vertex2dv), + SYM(Vertex2fv), + SYM(Vertex2iv), + SYM(Vertex2sv), + SYM(Vertex3dv), + SYM(Vertex3fv), + SYM(Vertex3iv), + SYM(Vertex3sv), + SYM(Vertex4dv), + SYM(Vertex4fv), + SYM(Vertex4iv), + SYM(Vertex4sv), + SYM(Normal3b), + SYM(Normal3d), + SYM(Normal3f), + SYM(Normal3i), + SYM(Normal3s), + SYM(Normal3bv), + SYM(Normal3dv), + SYM(Normal3fv), + SYM(Normal3iv), + SYM(Normal3sv), + SYM(Indexd), + SYM(Indexf), + SYM(Indexi), + SYM(Indexs), + SYM(Indexub), + SYM(Indexdv), + SYM(Indexfv), + SYM(Indexiv), + SYM(Indexsv), + SYM(Indexubv), + SYM(Color3b), + SYM(Color3d), + SYM(Color3f), + SYM(Color3i), + SYM(Color3s), + SYM(Color3ub), + SYM(Color3ui), + SYM(Color3us), + SYM(Color3bv), + SYM(Color3dv), + SYM(Color3fv), + SYM(Color3iv), + SYM(Color3sv), + SYM(Color3ubv), + SYM(Color3uiv), + SYM(Color3usv), + SYM(Color4bv), + SYM(Color4dv), + SYM(Color4fv), + SYM(Color4iv), + SYM(Color4sv), + SYM(Color4ubv), + SYM(Color4uiv), + SYM(Color4usv), + SYM(TexCoord1d), + SYM(TexCoord1f), + SYM(TexCoord1i), + SYM(TexCoord1s), + SYM(TexCoord2d), + SYM(TexCoord2f), + SYM(TexCoord2i), + SYM(TexCoord2s), + SYM(TexCoord3d), + SYM(TexCoord3f), + SYM(TexCoord3i), + SYM(TexCoord3s), + SYM(TexCoord4d), + SYM(TexCoord4f), + SYM(TexCoord4i), + SYM(TexCoord4s), + SYM(TexCoord1dv), + SYM(TexCoord1fv), + SYM(TexCoord1iv), + SYM(TexCoord1sv), + SYM(TexCoord2dv), + SYM(TexCoord2fv), + SYM(TexCoord2iv), + SYM(TexCoord2sv), + SYM(TexCoord3dv), + SYM(TexCoord3fv), + SYM(TexCoord3iv), + SYM(TexCoord3sv), + SYM(TexCoord4dv), + SYM(TexCoord4fv), + SYM(TexCoord4iv), + SYM(TexCoord4sv), + SYM(RasterPos2d), + SYM(RasterPos2f), + SYM(RasterPos2i), + SYM(RasterPos2s), + SYM(RasterPos3d), + SYM(RasterPos3f), + SYM(RasterPos3i), + SYM(RasterPos3s), + SYM(RasterPos4d), + SYM(RasterPos4f), + SYM(RasterPos4i), + SYM(RasterPos4s), + SYM(RasterPos2dv), + SYM(RasterPos2fv), + SYM(RasterPos2iv), + SYM(RasterPos2sv), + SYM(RasterPos3dv), + SYM(RasterPos3fv), + SYM(RasterPos3iv), + SYM(RasterPos3sv), + SYM(RasterPos4dv), + SYM(RasterPos4fv), + SYM(RasterPos4iv), + SYM(RasterPos4sv), + SYM(Rectd), + SYM(Rectf), + SYM(Recti), + SYM(Rects), + SYM(Rectdv), + SYM(Rectfv), + SYM(Rectiv), + SYM(Rectsv), + SYM(EdgeFlagPointer), + SYM(GetPointerv), + SYM(ArrayElement), + SYM(DrawArrays), + SYM(ShadeModel), + SYM(Lightf), + SYM(Lighti), + SYM(LightModelf), + SYM(LightModeli), + SYM(LightModelfv), + SYM(LightModeliv), + SYM(Materialf), + SYM(Materiali), + SYM(Materialfv), + SYM(Materialiv), + SYM(GetMaterialfv), + SYM(GetMaterialiv), + SYM(ColorMaterial), + SYM(PixelZoom), + SYM(PixelStoref), + SYM(PixelStorei), + SYM(PixelTransferf), + SYM(PixelTransferi), + SYM(GetPixelMapfv), + SYM(GetPixelMapuiv), + SYM(GetPixelMapusv), + SYM(StencilFunc), + SYM(StencilMask), + SYM(StencilOp), + SYM(ClearStencil), + SYM(TexGend), + SYM(TexGenf), + SYM(TexGeni), + SYM(TexGendv), + SYM(TexGenfv), + SYM(TexGeniv), + SYM(GetTexGendv), + SYM(GetTexGenfv), + SYM(GetTexGeniv), + SYM(TexEnvf), + SYM(TexEnvi), + SYM(TexEnvfv), + SYM(TexEnviv), + SYM(GetTexEnvfv), + SYM(GetTexEnviv), + SYM(TexParameterf), + SYM(TexParameteri), + SYM(GenTextures), + SYM(DeleteTextures), + SYM(BindTexture), + SYM(IsTexture), + SYM(GetMapdv), + SYM(GetMapfv), + SYM(GetMapiv), + SYM(EvalCoord1d), + SYM(EvalCoord1f), + SYM(EvalCoord1dv), + SYM(EvalCoord1fv), + SYM(EvalCoord2d), + SYM(EvalCoord2f), + SYM(EvalCoord2dv), + SYM(EvalCoord2fv), + SYM(MapGrid1d), + SYM(MapGrid1f), + SYM(EvalPoint1), + SYM(EvalPoint2), + SYM(EvalMesh1), + SYM(EvalMesh2), + SYM(Fogf), + SYM(Fogi), + SYM(Fogfv), + SYM(Fogiv), + SYM(FeedbackBuffer), + SYM(PassThrough), + SYM(SelectBuffer), + SYM(InitNames), + SYM(LoadName), + SYM(PushName), + SYM(PopName), + SYM(BlendEquation), + SYM(ResetHistogram), + SYM(ResetMinmax), + SYM(ActiveTexture), + SYM(ClientActiveTexture), + SYM(CompressedTexImage1D), + SYM(CompressedTexImage2D), + SYM(CompressedTexImage3D), + SYM(CompressedTexSubImage1D), + SYM(CompressedTexSubImage2D), + SYM(CompressedTexSubImage3D), + SYM(GetCompressedTexImage), + SYM(MultiTexCoord1d), + SYM(MultiTexCoord1dv), + SYM(MultiTexCoord1f), + SYM(MultiTexCoord1fv), + SYM(MultiTexCoord1i), + SYM(MultiTexCoord1iv), + SYM(MultiTexCoord1s), + SYM(MultiTexCoord1sv), + SYM(MultiTexCoord2d), + SYM(MultiTexCoord2dv), + SYM(MultiTexCoord2f), + SYM(MultiTexCoord2fv), + SYM(MultiTexCoord2i), + SYM(MultiTexCoord2iv), + SYM(MultiTexCoord2s), + SYM(MultiTexCoord2sv), + SYM(MultiTexCoord3d), + SYM(MultiTexCoord3dv), + SYM(MultiTexCoord3f), + SYM(MultiTexCoord3fv), + SYM(MultiTexCoord3i), + SYM(MultiTexCoord3iv), + SYM(MultiTexCoord3s), + SYM(MultiTexCoord3sv), + SYM(MultiTexCoord4d), + SYM(MultiTexCoord4dv), + SYM(MultiTexCoord4f), + SYM(MultiTexCoord4fv), + SYM(MultiTexCoord4i), + SYM(MultiTexCoord4iv), + SYM(MultiTexCoord4s), + SYM(MultiTexCoord4sv), + SYM(LoadTransposeMatrixd), + SYM(LoadTransposeMatrixf), + SYM(MultTransposeMatrixd), + SYM(MultTransposeMatrixf), + SYM(SampleCoverage), + SYM(ActiveTextureARB), + SYM(ClientActiveTextureARB), + SYM(MultiTexCoord1dARB), + SYM(MultiTexCoord1dvARB), + SYM(MultiTexCoord1fARB), + SYM(MultiTexCoord1fvARB), + SYM(MultiTexCoord1iARB), + SYM(MultiTexCoord1ivARB), + SYM(MultiTexCoord1sARB), + SYM(MultiTexCoord1svARB), + SYM(MultiTexCoord2dARB), + SYM(MultiTexCoord2dvARB), + SYM(MultiTexCoord2fARB), + SYM(MultiTexCoord2fvARB), + SYM(MultiTexCoord2iARB), + SYM(MultiTexCoord2ivARB), + SYM(MultiTexCoord2sARB), + SYM(MultiTexCoord2svARB), + SYM(MultiTexCoord3dARB), + SYM(MultiTexCoord3dvARB), + SYM(MultiTexCoord3fARB), + SYM(MultiTexCoord3fvARB), + SYM(MultiTexCoord3iARB), + SYM(MultiTexCoord3ivARB), + SYM(MultiTexCoord3sARB), + SYM(MultiTexCoord3svARB), + SYM(MultiTexCoord4dARB), + SYM(MultiTexCoord4dvARB), + SYM(MultiTexCoord4fARB), + SYM(MultiTexCoord4fvARB), + SYM(MultiTexCoord4iARB), + SYM(MultiTexCoord4ivARB), + SYM(MultiTexCoord4sARB), + SYM(MultiTexCoord4svARB), + SYM(EGLImageTargetTexture2DOES), + SYM(EGLImageTargetRenderbufferStorageOES), +#endif + SYM(DrawRangeElements), SYM(TexImage3D), SYM(TexSubImage3D), diff --git a/libretro-common/glsym/xglgen.py b/libretro-common/glsym/xglgen.py new file mode 100644 index 0000000000..9fae01b119 --- /dev/null +++ b/libretro-common/glsym/xglgen.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python3 + +""" + License statement applies to this file (xglgen.py) only. +""" + +""" + Permission is hereby granted, free of charge, + to any person obtaining a copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" + +import sys +import os +import re + +banned_ext = [ 'AMD', 'APPLE', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ] + +def noext(sym): + for ext in banned_ext: + if sym.endswith(ext): + return False + return True + +def find_gl_symbols(lines): + typedefs = [] + syms = [] + for line in lines: + # Note this doesn't work automated; this script is designed as a helper + m = re.search(r'^typedef.+PFN(\S+)PROC.+$', line) + g = re.search(r'^GLAPI\s(.+)\s(.+)\s(gl\S+)\W*\((.+)\).*', line) + if g and noext(g.group(3)): + typedefs.append('typedef ' + g.group(1) + ' (APIENTRYP RGLSYM' + g.group(3).upper() + 'PROC) (' + g.group(4) + ');') + syms.append(g.group(3)) + + return (typedefs, syms) + +def generate_defines(gl_syms): + res = [] + for line in gl_syms: + res.append('#define {} __rglgen_{}'.format(line, line)) + return res + +def generate_declarations(gl_syms): + return ['RGLSYM' + x.upper() + 'PROC ' + x + ';' for x in gl_syms] + +def generate_macros(gl_syms): + return [' SYM(' + x.replace('gl', '') + '),' for x in gl_syms] + +def dump(f, lines): + f.write('\n'.join(lines)) + f.write('\n\n') + +if __name__ == '__main__': + + if len(sys.argv) > 4: + for banned in sys.argv[4:]: + banned_ext.append(banned) + + with open(sys.argv[1], 'r') as f: + lines = f.readlines() + typedefs, syms = find_gl_symbols(lines) + + overrides = generate_defines(syms) + declarations = generate_declarations(syms) + externs = ['extern ' + x for x in declarations] + + macros = generate_macros(syms) + + with open(sys.argv[2], 'w') as f: + f.write('#ifndef RGLGEN_DECL_H__\n') + f.write('#define RGLGEN_DECL_H__\n') + + f.write('#ifdef __cplusplus\n') + f.write('extern "C" {\n') + f.write('#endif\n') + + f.write('#ifdef GL_APIENTRY\n') + f.write('typedef void (GL_APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('typedef void (GL_APIENTRY *RGLGENGLDEBUGPROCKHR)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('#else\n') + f.write('#ifndef APIENTRY\n') + f.write('#define APIENTRY\n') + f.write('#endif\n') + f.write('#ifndef APIENTRYP\n') + f.write('#define APIENTRYP APIENTRY *\n') + f.write('#endif\n') + f.write('typedef void (APIENTRY *RGLGENGLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('typedef void (APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('#endif\n') + + f.write('#ifndef GL_OES_EGL_image\n') + f.write('typedef void *GLeglImageOES;\n') + f.write('#endif\n') + + f.write('#if !defined(GL_OES_fixed_point) && !defined(HAVE_OPENGLES2)\n') + f.write('typedef GLint GLfixed;\n') + f.write('#endif\n') + + f.write('#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_7)\n') + f.write('typedef long long int GLint64;\n') + f.write('typedef unsigned long long int GLuint64;\n') + f.write('typedef unsigned long long int GLuint64EXT;\n') + f.write('typedef struct __GLsync *GLsync;\n') + f.write('#endif\n') + + dump(f, typedefs) + dump(f, overrides) + dump(f, externs) + + f.write('struct rglgen_sym_map { const char *sym; void *ptr; };\n') + f.write('extern const struct rglgen_sym_map rglgen_symbol_map[];\n') + + f.write('#ifdef __cplusplus\n') + f.write('}\n') + f.write('#endif\n') + + f.write('#endif\n') + + with open(sys.argv[3], 'w') as f: + f.write('#include "glsym/glsym.h"\n') + f.write('#include \n') + f.write('#define SYM(x) { "gl" #x, &(gl##x) }\n') + f.write('const struct rglgen_sym_map rglgen_symbol_map[] = {\n') + dump(f, macros) + f.write(' { NULL, NULL },\n') + f.write('};\n') + dump(f, declarations) + diff --git a/libretro-common/include/glsym/glsym.h b/libretro-common/include/glsym/glsym.h index 24f4584bb6..36c9b49f7b 100644 --- a/libretro-common/include/glsym/glsym.h +++ b/libretro-common/include/glsym/glsym.h @@ -31,6 +31,9 @@ #elif defined(HAVE_OPENGLES3) #include "glsym_es3.h" #else +#ifdef HAVE_LIBNX +#include "switch/nx_glsym.h" +#endif #include "glsym_gl.h" #endif #endif diff --git a/libretro-common/include/glsym/rglgen_headers.h b/libretro-common/include/glsym/rglgen_headers.h index 766efb6361..cfd0746eeb 100644 --- a/libretro-common/include/glsym/rglgen_headers.h +++ b/libretro-common/include/glsym/rglgen_headers.h @@ -62,8 +62,14 @@ #define WIN32_LEAN_AND_MEAN #include #endif +#ifndef HAVE_LIBNX #include #include +#else +// We need to avoid including on this platform +#include "switch/nx_gl.h" +#include +#endif // SWITCH #endif #ifndef GL_MAP_WRITE_BIT diff --git a/libretro-common/include/glsym/switch/nx_gl.h b/libretro-common/include/glsym/switch/nx_gl.h new file mode 100644 index 0000000000..2c4b3e13d1 --- /dev/null +++ b/libretro-common/include/glsym/switch/nx_gl.h @@ -0,0 +1,848 @@ +/* Copyright (C) 2018 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (nx_gl.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __NX_GL_H__ +#define __NX_GL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif + +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +// GL.h types +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + +// GL.h defines +#define GL_ARB_imaging 1 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_NONE 0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_RESCALE_NORMAL 0x803A +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_BLEND_EQUATION 0x8009 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_COLOR 0x8005 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_ARB_multitexture 1 +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#define GL_MESA_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_MESA 0x8750 +#define GL_UNSIGNED_INT_24_8_MESA 0x8751 +#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 +#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 +#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 +#define GL_ATI_blend_equation_separate 1 +#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D +#define GL_OES_EGL_image 1 + +#ifdef __cplusplus +} +#endif + +#endif // __NX_GL_H__ diff --git a/libretro-common/include/glsym/switch/nx_glsym.h b/libretro-common/include/glsym/switch/nx_glsym.h new file mode 100644 index 0000000000..0b3d0c25c4 --- /dev/null +++ b/libretro-common/include/glsym/switch/nx_glsym.h @@ -0,0 +1,779 @@ +#ifndef __NX_GLSYM_H__ +#define __NX_GLSYM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +// xglgen missing typedef's / defines +typedef void *GLeglImageOES; +typedef void (APIENTRYP RGLSYMGLTEXIMAGE2DPROC) ( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); +typedef void (APIENTRYP RGLSYMGLVIEWPORTPROC)( GLint x, GLint y, + GLsizei width, GLsizei height ); +typedef void (APIENTRYP RGLSYMGLTEXSUBIMAGE2DPROC) ( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); +typedef void (APIENTRYP RGLSYMGLREADPIXELSPROC)( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); +typedef void (APIENTRYP RGLSYMGLTEXPARAMETERIVPROC)( GLenum target, GLenum pname, + const GLint *params ); +typedef void (APIENTRYP RGLSYMGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTS)( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +RGLSYMGLREADPIXELSPROC glReadPixels; +RGLSYMGLTEXIMAGE2DPROC glTexImage2D; +RGLSYMGLVIEWPORTPROC glViewport; +RGLSYMGLTEXSUBIMAGE2DPROC glTexSubImage2D; +RGLSYMGLTEXPARAMETERIVPROC glTexParameteriv; +RGLSYMGLDRAWELEMENTS glDrawElements; + +// xglgen generated +typedef void (APIENTRYP RGLSYMGLCLEARINDEXPROC) ( GLfloat c ); +typedef void (APIENTRYP RGLSYMGLCLEARCOLORPROC) ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); +typedef void (APIENTRYP RGLSYMGLCLEARPROC) ( GLbitfield mask ); +typedef void (APIENTRYP RGLSYMGLINDEXMASKPROC) ( GLuint mask ); +typedef void (APIENTRYP RGLSYMGLCOLORMASKPROC) ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); +typedef void (APIENTRYP RGLSYMGLALPHAFUNCPROC) ( GLenum func, GLclampf ref ); +typedef void (APIENTRYP RGLSYMGLBLENDFUNCPROC) ( GLenum sfactor, GLenum dfactor ); +typedef void (APIENTRYP RGLSYMGLLOGICOPPROC) ( GLenum opcode ); +typedef void (APIENTRYP RGLSYMGLCULLFACEPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLFRONTFACEPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLPOINTSIZEPROC) ( GLfloat size ); +typedef void (APIENTRYP RGLSYMGLLINEWIDTHPROC) ( GLfloat width ); +typedef void (APIENTRYP RGLSYMGLLINESTIPPLEPROC) ( GLint factor, GLushort pattern ); +typedef void (APIENTRYP RGLSYMGLPOLYGONMODEPROC) ( GLenum face, GLenum mode ); +typedef void (APIENTRYP RGLSYMGLPOLYGONOFFSETPROC) ( GLfloat factor, GLfloat units ); +typedef void (APIENTRYP RGLSYMGLPOLYGONSTIPPLEPROC) ( const GLubyte *mask ); +typedef void (APIENTRYP RGLSYMGLGETPOLYGONSTIPPLEPROC) ( GLubyte *mask ); +typedef void (APIENTRYP RGLSYMGLEDGEFLAGPROC) ( GLboolean flag ); +typedef void (APIENTRYP RGLSYMGLEDGEFLAGVPROC) ( const GLboolean *flag ); +typedef void (APIENTRYP RGLSYMGLSCISSORPROC) ( GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLCLIPPLANEPROC) ( GLenum plane, const GLdouble *equation ); +typedef void (APIENTRYP RGLSYMGLGETCLIPPLANEPROC) ( GLenum plane, GLdouble *equation ); +typedef void (APIENTRYP RGLSYMGLDRAWBUFFERPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLREADBUFFERPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLENABLEPROC) ( GLenum cap ); +typedef void (APIENTRYP RGLSYMGLDISABLEPROC) ( GLenum cap ); +typedef GLboolean (APIENTRYP RGLSYMGLISENABLEDPROC) ( GLenum cap ); +typedef void (APIENTRYP RGLSYMGLENABLECLIENTSTATEPROC) ( GLenum cap ); +typedef void (APIENTRYP RGLSYMGLDISABLECLIENTSTATEPROC) ( GLenum cap ); +typedef void (APIENTRYP RGLSYMGLGETBOOLEANVPROC) ( GLenum pname, GLboolean *params ); +typedef void (APIENTRYP RGLSYMGLGETDOUBLEVPROC) ( GLenum pname, GLdouble *params ); +typedef void (APIENTRYP RGLSYMGLGETFLOATVPROC) ( GLenum pname, GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLGETINTEGERVPROC) ( GLenum pname, GLint *params ); +typedef void (APIENTRYP RGLSYMGLPUSHATTRIBPROC) ( GLbitfield mask ); +typedef void (APIENTRYP RGLSYMGLPOPATTRIBPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLPUSHCLIENTATTRIBPROC) ( GLbitfield mask ); +typedef void (APIENTRYP RGLSYMGLPOPCLIENTATTRIBPROC) ( void ); +typedef GLint (APIENTRYP RGLSYMGLRENDERMODEPROC) ( GLenum mode ); +typedef GLenum (APIENTRYP RGLSYMGLGETERRORPROC) ( void ); +typedef const GLubyte * (APIENTRYP RGLSYMGLGETSTRINGPROC) ( GLenum name ); +typedef void (APIENTRYP RGLSYMGLFINISHPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLFLUSHPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLHINTPROC) ( GLenum target, GLenum mode ); +typedef void (APIENTRYP RGLSYMGLCLEARDEPTHPROC) ( GLclampd depth ); +typedef void (APIENTRYP RGLSYMGLDEPTHFUNCPROC) ( GLenum func ); +typedef void (APIENTRYP RGLSYMGLDEPTHMASKPROC) ( GLboolean flag ); +typedef void (APIENTRYP RGLSYMGLDEPTHRANGEPROC) ( GLclampd near_val, GLclampd far_val ); +typedef void (APIENTRYP RGLSYMGLCLEARACCUMPROC) ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); +typedef void (APIENTRYP RGLSYMGLACCUMPROC) ( GLenum op, GLfloat value ); +typedef void (APIENTRYP RGLSYMGLMATRIXMODEPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLPUSHMATRIXPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLPOPMATRIXPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLLOADIDENTITYPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLLOADMATRIXDPROC) ( const GLdouble *m ); +typedef void (APIENTRYP RGLSYMGLLOADMATRIXFPROC) ( const GLfloat *m ); +typedef void (APIENTRYP RGLSYMGLMULTMATRIXDPROC) ( const GLdouble *m ); +typedef void (APIENTRYP RGLSYMGLMULTMATRIXFPROC) ( const GLfloat *m ); +typedef void (APIENTRYP RGLSYMGLSCALEDPROC) ( GLdouble x, GLdouble y, GLdouble z ); +typedef void (APIENTRYP RGLSYMGLSCALEFPROC) ( GLfloat x, GLfloat y, GLfloat z ); +typedef void (APIENTRYP RGLSYMGLTRANSLATEDPROC) ( GLdouble x, GLdouble y, GLdouble z ); +typedef void (APIENTRYP RGLSYMGLTRANSLATEFPROC) ( GLfloat x, GLfloat y, GLfloat z ); +typedef GLboolean (APIENTRYP RGLSYMGLISLISTPROC) ( GLuint list ); +typedef void (APIENTRYP RGLSYMGLDELETELISTSPROC) ( GLuint list, GLsizei range ); +typedef GLuint (APIENTRYP RGLSYMGLGENLISTSPROC) ( GLsizei range ); +typedef void (APIENTRYP RGLSYMGLNEWLISTPROC) ( GLuint list, GLenum mode ); +typedef void (APIENTRYP RGLSYMGLENDLISTPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLCALLLISTPROC) ( GLuint list ); +typedef void (APIENTRYP RGLSYMGLLISTBASEPROC) ( GLuint base ); +typedef void (APIENTRYP RGLSYMGLBEGINPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLENDPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLVERTEX2DPROC) ( GLdouble x, GLdouble y ); +typedef void (APIENTRYP RGLSYMGLVERTEX2FPROC) ( GLfloat x, GLfloat y ); +typedef void (APIENTRYP RGLSYMGLVERTEX2IPROC) ( GLint x, GLint y ); +typedef void (APIENTRYP RGLSYMGLVERTEX2SPROC) ( GLshort x, GLshort y ); +typedef void (APIENTRYP RGLSYMGLVERTEX3DPROC) ( GLdouble x, GLdouble y, GLdouble z ); +typedef void (APIENTRYP RGLSYMGLVERTEX3FPROC) ( GLfloat x, GLfloat y, GLfloat z ); +typedef void (APIENTRYP RGLSYMGLVERTEX3IPROC) ( GLint x, GLint y, GLint z ); +typedef void (APIENTRYP RGLSYMGLVERTEX3SPROC) ( GLshort x, GLshort y, GLshort z ); +typedef void (APIENTRYP RGLSYMGLVERTEX4DPROC) ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +typedef void (APIENTRYP RGLSYMGLVERTEX4FPROC) ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +typedef void (APIENTRYP RGLSYMGLVERTEX4IPROC) ( GLint x, GLint y, GLint z, GLint w ); +typedef void (APIENTRYP RGLSYMGLVERTEX4SPROC) ( GLshort x, GLshort y, GLshort z, GLshort w ); +typedef void (APIENTRYP RGLSYMGLVERTEX2DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX2FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX2IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX2SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX3DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX3FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX3IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX3SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX4DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX4FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX4IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLVERTEX4SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLNORMAL3BPROC) ( GLbyte nx, GLbyte ny, GLbyte nz ); +typedef void (APIENTRYP RGLSYMGLNORMAL3DPROC) ( GLdouble nx, GLdouble ny, GLdouble nz ); +typedef void (APIENTRYP RGLSYMGLNORMAL3FPROC) ( GLfloat nx, GLfloat ny, GLfloat nz ); +typedef void (APIENTRYP RGLSYMGLNORMAL3IPROC) ( GLint nx, GLint ny, GLint nz ); +typedef void (APIENTRYP RGLSYMGLNORMAL3SPROC) ( GLshort nx, GLshort ny, GLshort nz ); +typedef void (APIENTRYP RGLSYMGLNORMAL3BVPROC) ( const GLbyte *v ); +typedef void (APIENTRYP RGLSYMGLNORMAL3DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLNORMAL3FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLNORMAL3IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLNORMAL3SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLINDEXDPROC) ( GLdouble c ); +typedef void (APIENTRYP RGLSYMGLINDEXFPROC) ( GLfloat c ); +typedef void (APIENTRYP RGLSYMGLINDEXIPROC) ( GLint c ); +typedef void (APIENTRYP RGLSYMGLINDEXSPROC) ( GLshort c ); +typedef void (APIENTRYP RGLSYMGLINDEXUBPROC) ( GLubyte c ); +typedef void (APIENTRYP RGLSYMGLINDEXDVPROC) ( const GLdouble *c ); +typedef void (APIENTRYP RGLSYMGLINDEXFVPROC) ( const GLfloat *c ); +typedef void (APIENTRYP RGLSYMGLINDEXIVPROC) ( const GLint *c ); +typedef void (APIENTRYP RGLSYMGLINDEXSVPROC) ( const GLshort *c ); +typedef void (APIENTRYP RGLSYMGLINDEXUBVPROC) ( const GLubyte *c ); +typedef void (APIENTRYP RGLSYMGLCOLOR3BPROC) ( GLbyte red, GLbyte green, GLbyte blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3DPROC) ( GLdouble red, GLdouble green, GLdouble blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3FPROC) ( GLfloat red, GLfloat green, GLfloat blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3IPROC) ( GLint red, GLint green, GLint blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3SPROC) ( GLshort red, GLshort green, GLshort blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3UBPROC) ( GLubyte red, GLubyte green, GLubyte blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3UIPROC) ( GLuint red, GLuint green, GLuint blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3USPROC) ( GLushort red, GLushort green, GLushort blue ); +typedef void (APIENTRYP RGLSYMGLCOLOR3BVPROC) ( const GLbyte *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR3DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR3FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR3IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR3SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR3UBVPROC) ( const GLubyte *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR3UIVPROC) ( const GLuint *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR3USVPROC) ( const GLushort *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4BVPROC) ( const GLbyte *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4UBVPROC) ( const GLubyte *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4UIVPROC) ( const GLuint *v ); +typedef void (APIENTRYP RGLSYMGLCOLOR4USVPROC) ( const GLushort *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1DPROC) ( GLdouble s ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1FPROC) ( GLfloat s ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1IPROC) ( GLint s ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1SPROC) ( GLshort s ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2DPROC) ( GLdouble s, GLdouble t ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2FPROC) ( GLfloat s, GLfloat t ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2IPROC) ( GLint s, GLint t ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2SPROC) ( GLshort s, GLshort t ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3DPROC) ( GLdouble s, GLdouble t, GLdouble r ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3FPROC) ( GLfloat s, GLfloat t, GLfloat r ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3IPROC) ( GLint s, GLint t, GLint r ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3SPROC) ( GLshort s, GLshort t, GLshort r ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4DPROC) ( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4FPROC) ( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4IPROC) ( GLint s, GLint t, GLint r, GLint q ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4SPROC) ( GLshort s, GLshort t, GLshort r, GLshort q ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2DPROC) ( GLdouble x, GLdouble y ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2FPROC) ( GLfloat x, GLfloat y ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2IPROC) ( GLint x, GLint y ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2SPROC) ( GLshort x, GLshort y ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3DPROC) ( GLdouble x, GLdouble y, GLdouble z ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3FPROC) ( GLfloat x, GLfloat y, GLfloat z ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3IPROC) ( GLint x, GLint y, GLint z ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3SPROC) ( GLshort x, GLshort y, GLshort z ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4DPROC) ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4FPROC) ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4IPROC) ( GLint x, GLint y, GLint z, GLint w ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4SPROC) ( GLshort x, GLshort y, GLshort z, GLshort w ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4DVPROC) ( const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4FVPROC) ( const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4IVPROC) ( const GLint *v ); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4SVPROC) ( const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLRECTDPROC) ( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +typedef void (APIENTRYP RGLSYMGLRECTFPROC) ( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +typedef void (APIENTRYP RGLSYMGLRECTIPROC) ( GLint x1, GLint y1, GLint x2, GLint y2 ); +typedef void (APIENTRYP RGLSYMGLRECTSPROC) ( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); +typedef void (APIENTRYP RGLSYMGLRECTDVPROC) ( const GLdouble *v1, const GLdouble *v2 ); +typedef void (APIENTRYP RGLSYMGLRECTFVPROC) ( const GLfloat *v1, const GLfloat *v2 ); +typedef void (APIENTRYP RGLSYMGLRECTIVPROC) ( const GLint *v1, const GLint *v2 ); +typedef void (APIENTRYP RGLSYMGLRECTSVPROC) ( const GLshort *v1, const GLshort *v2 ); +typedef void (APIENTRYP RGLSYMGLEDGEFLAGPOINTERPROC) ( GLsizei stride, const GLvoid *ptr ); +typedef void (APIENTRYP RGLSYMGLGETPOINTERVPROC) ( GLenum pname, GLvoid **params ); +typedef void (APIENTRYP RGLSYMGLARRAYELEMENTPROC) ( GLint i ); +typedef void (APIENTRYP RGLSYMGLDRAWARRAYSPROC) ( GLenum mode, GLint first, GLsizei count ); +typedef void (APIENTRYP RGLSYMGLSHADEMODELPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLLIGHTFPROC) ( GLenum light, GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLLIGHTIPROC) ( GLenum light, GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLLIGHTMODELFPROC) ( GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLLIGHTMODELIPROC) ( GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLLIGHTMODELFVPROC) ( GLenum pname, const GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLLIGHTMODELIVPROC) ( GLenum pname, const GLint *params ); +typedef void (APIENTRYP RGLSYMGLMATERIALFPROC) ( GLenum face, GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLMATERIALIPROC) ( GLenum face, GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLMATERIALFVPROC) ( GLenum face, GLenum pname, const GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLMATERIALIVPROC) ( GLenum face, GLenum pname, const GLint *params ); +typedef void (APIENTRYP RGLSYMGLGETMATERIALFVPROC) ( GLenum face, GLenum pname, GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLGETMATERIALIVPROC) ( GLenum face, GLenum pname, GLint *params ); +typedef void (APIENTRYP RGLSYMGLCOLORMATERIALPROC) ( GLenum face, GLenum mode ); +typedef void (APIENTRYP RGLSYMGLPIXELZOOMPROC) ( GLfloat xfactor, GLfloat yfactor ); +typedef void (APIENTRYP RGLSYMGLPIXELSTOREFPROC) ( GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLPIXELSTOREIPROC) ( GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLPIXELTRANSFERFPROC) ( GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLPIXELTRANSFERIPROC) ( GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLGETPIXELMAPFVPROC) ( GLenum map, GLfloat *values ); +typedef void (APIENTRYP RGLSYMGLGETPIXELMAPUIVPROC) ( GLenum map, GLuint *values ); +typedef void (APIENTRYP RGLSYMGLGETPIXELMAPUSVPROC) ( GLenum map, GLushort *values ); +typedef void (APIENTRYP RGLSYMGLSTENCILFUNCPROC) ( GLenum func, GLint ref, GLuint mask ); +typedef void (APIENTRYP RGLSYMGLSTENCILMASKPROC) ( GLuint mask ); +typedef void (APIENTRYP RGLSYMGLSTENCILOPPROC) ( GLenum fail, GLenum zfail, GLenum zpass ); +typedef void (APIENTRYP RGLSYMGLCLEARSTENCILPROC) ( GLint s ); +typedef void (APIENTRYP RGLSYMGLTEXGENDPROC) ( GLenum coord, GLenum pname, GLdouble param ); +typedef void (APIENTRYP RGLSYMGLTEXGENFPROC) ( GLenum coord, GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLTEXGENIPROC) ( GLenum coord, GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLTEXGENDVPROC) ( GLenum coord, GLenum pname, const GLdouble *params ); +typedef void (APIENTRYP RGLSYMGLTEXGENFVPROC) ( GLenum coord, GLenum pname, const GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLTEXGENIVPROC) ( GLenum coord, GLenum pname, const GLint *params ); +typedef void (APIENTRYP RGLSYMGLGETTEXGENDVPROC) ( GLenum coord, GLenum pname, GLdouble *params ); +typedef void (APIENTRYP RGLSYMGLGETTEXGENFVPROC) ( GLenum coord, GLenum pname, GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLGETTEXGENIVPROC) ( GLenum coord, GLenum pname, GLint *params ); +typedef void (APIENTRYP RGLSYMGLTEXENVFPROC) ( GLenum target, GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLTEXENVIPROC) ( GLenum target, GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLTEXENVFVPROC) ( GLenum target, GLenum pname, const GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLTEXENVIVPROC) ( GLenum target, GLenum pname, const GLint *params ); +typedef void (APIENTRYP RGLSYMGLGETTEXENVFVPROC) ( GLenum target, GLenum pname, GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLGETTEXENVIVPROC) ( GLenum target, GLenum pname, GLint *params ); +typedef void (APIENTRYP RGLSYMGLTEXPARAMETERFPROC) ( GLenum target, GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLTEXPARAMETERIPROC) ( GLenum target, GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLGENTEXTURESPROC) ( GLsizei n, GLuint *textures ); +typedef void (APIENTRYP RGLSYMGLDELETETEXTURESPROC) ( GLsizei n, const GLuint *textures); +typedef void (APIENTRYP RGLSYMGLBINDTEXTUREPROC) ( GLenum target, GLuint texture ); +typedef GLboolean (APIENTRYP RGLSYMGLISTEXTUREPROC) ( GLuint texture ); +typedef void (APIENTRYP RGLSYMGLGETMAPDVPROC) ( GLenum target, GLenum query, GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLGETMAPFVPROC) ( GLenum target, GLenum query, GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLGETMAPIVPROC) ( GLenum target, GLenum query, GLint *v ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD1DPROC) ( GLdouble u ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD1FPROC) ( GLfloat u ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD1DVPROC) ( const GLdouble *u ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD1FVPROC) ( const GLfloat *u ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD2DPROC) ( GLdouble u, GLdouble v ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD2FPROC) ( GLfloat u, GLfloat v ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD2DVPROC) ( const GLdouble *u ); +typedef void (APIENTRYP RGLSYMGLEVALCOORD2FVPROC) ( const GLfloat *u ); +typedef void (APIENTRYP RGLSYMGLMAPGRID1DPROC) ( GLint un, GLdouble u1, GLdouble u2 ); +typedef void (APIENTRYP RGLSYMGLMAPGRID1FPROC) ( GLint un, GLfloat u1, GLfloat u2 ); +typedef void (APIENTRYP RGLSYMGLEVALPOINT1PROC) ( GLint i ); +typedef void (APIENTRYP RGLSYMGLEVALPOINT2PROC) ( GLint i, GLint j ); +typedef void (APIENTRYP RGLSYMGLEVALMESH1PROC) ( GLenum mode, GLint i1, GLint i2 ); +typedef void (APIENTRYP RGLSYMGLEVALMESH2PROC) ( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); +typedef void (APIENTRYP RGLSYMGLFOGFPROC) ( GLenum pname, GLfloat param ); +typedef void (APIENTRYP RGLSYMGLFOGIPROC) ( GLenum pname, GLint param ); +typedef void (APIENTRYP RGLSYMGLFOGFVPROC) ( GLenum pname, const GLfloat *params ); +typedef void (APIENTRYP RGLSYMGLFOGIVPROC) ( GLenum pname, const GLint *params ); +typedef void (APIENTRYP RGLSYMGLFEEDBACKBUFFERPROC) ( GLsizei size, GLenum type, GLfloat *buffer ); +typedef void (APIENTRYP RGLSYMGLPASSTHROUGHPROC) ( GLfloat token ); +typedef void (APIENTRYP RGLSYMGLSELECTBUFFERPROC) ( GLsizei size, GLuint *buffer ); +typedef void (APIENTRYP RGLSYMGLINITNAMESPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLLOADNAMEPROC) ( GLuint name ); +typedef void (APIENTRYP RGLSYMGLPUSHNAMEPROC) ( GLuint name ); +typedef void (APIENTRYP RGLSYMGLPOPNAMEPROC) ( void ); +typedef void (APIENTRYP RGLSYMGLBLENDEQUATIONPROC) ( GLenum mode ); +typedef void (APIENTRYP RGLSYMGLRESETHISTOGRAMPROC) ( GLenum target ); +typedef void (APIENTRYP RGLSYMGLRESETMINMAXPROC) ( GLenum target ); +typedef void (APIENTRYP RGLSYMGLACTIVETEXTUREPROC) ( GLenum texture ); +typedef void (APIENTRYP RGLSYMGLCLIENTACTIVETEXTUREPROC) ( GLenum texture ); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE1DPROC) ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE2DPROC) ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE3DPROC) ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DPROC) ( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DPROC) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DPROC) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); +typedef void (APIENTRYP RGLSYMGLGETCOMPRESSEDTEXIMAGEPROC) ( GLenum target, GLint lod, GLvoid *img ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DPROC) ( GLenum target, GLdouble s ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DVPROC) ( GLenum target, const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FPROC) ( GLenum target, GLfloat s ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FVPROC) ( GLenum target, const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IPROC) ( GLenum target, GLint s ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IVPROC) ( GLenum target, const GLint *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SPROC) ( GLenum target, GLshort s ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SVPROC) ( GLenum target, const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DPROC) ( GLenum target, GLdouble s, GLdouble t ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DVPROC) ( GLenum target, const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FPROC) ( GLenum target, GLfloat s, GLfloat t ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FVPROC) ( GLenum target, const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IPROC) ( GLenum target, GLint s, GLint t ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IVPROC) ( GLenum target, const GLint *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SPROC) ( GLenum target, GLshort s, GLshort t ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SVPROC) ( GLenum target, const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DPROC) ( GLenum target, GLdouble s, GLdouble t, GLdouble r ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DVPROC) ( GLenum target, const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FPROC) ( GLenum target, GLfloat s, GLfloat t, GLfloat r ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FVPROC) ( GLenum target, const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IPROC) ( GLenum target, GLint s, GLint t, GLint r ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IVPROC) ( GLenum target, const GLint *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SPROC) ( GLenum target, GLshort s, GLshort t, GLshort r ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SVPROC) ( GLenum target, const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DPROC) ( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DVPROC) ( GLenum target, const GLdouble *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FPROC) ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FVPROC) ( GLenum target, const GLfloat *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IPROC) ( GLenum target, GLint s, GLint t, GLint r, GLint q ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IVPROC) ( GLenum target, const GLint *v ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SPROC) ( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SVPROC) ( GLenum target, const GLshort *v ); +typedef void (APIENTRYP RGLSYMGLLOADTRANSPOSEMATRIXDPROC) ( const GLdouble m[16] ); +typedef void (APIENTRYP RGLSYMGLLOADTRANSPOSEMATRIXFPROC) ( const GLfloat m[16] ); +typedef void (APIENTRYP RGLSYMGLMULTTRANSPOSEMATRIXDPROC) ( const GLdouble m[16] ); +typedef void (APIENTRYP RGLSYMGLMULTTRANSPOSEMATRIXFPROC) ( const GLfloat m[16] ); +typedef void (APIENTRYP RGLSYMGLSAMPLECOVERAGEPROC) ( GLclampf value, GLboolean invert ); +typedef void (APIENTRYP RGLSYMGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP RGLSYMGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (APIENTRYP RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); + +// xglgen generated +RGLSYMGLCLEARINDEXPROC glClearIndex; +RGLSYMGLCLEARCOLORPROC glClearColor; +RGLSYMGLCLEARPROC glClear; +RGLSYMGLINDEXMASKPROC glIndexMask; +RGLSYMGLCOLORMASKPROC glColorMask; +RGLSYMGLALPHAFUNCPROC glAlphaFunc; +RGLSYMGLBLENDFUNCPROC glBlendFunc; +RGLSYMGLLOGICOPPROC glLogicOp; +RGLSYMGLCULLFACEPROC glCullFace; +RGLSYMGLFRONTFACEPROC glFrontFace; +RGLSYMGLPOINTSIZEPROC glPointSize; +RGLSYMGLLINEWIDTHPROC glLineWidth; +RGLSYMGLLINESTIPPLEPROC glLineStipple; +RGLSYMGLPOLYGONMODEPROC glPolygonMode; +RGLSYMGLPOLYGONOFFSETPROC glPolygonOffset; +RGLSYMGLPOLYGONSTIPPLEPROC glPolygonStipple; +RGLSYMGLGETPOLYGONSTIPPLEPROC glGetPolygonStipple; +RGLSYMGLEDGEFLAGPROC glEdgeFlag; +RGLSYMGLEDGEFLAGVPROC glEdgeFlagv; +RGLSYMGLSCISSORPROC glScissor; +RGLSYMGLCLIPPLANEPROC glClipPlane; +RGLSYMGLGETCLIPPLANEPROC glGetClipPlane; +RGLSYMGLDRAWBUFFERPROC glDrawBuffer; +RGLSYMGLREADBUFFERPROC glReadBuffer; +RGLSYMGLENABLEPROC glEnable; +RGLSYMGLDISABLEPROC glDisable; +RGLSYMGLISENABLEDPROC glIsEnabled; +RGLSYMGLENABLECLIENTSTATEPROC glEnableClientState; +RGLSYMGLDISABLECLIENTSTATEPROC glDisableClientState; +RGLSYMGLGETBOOLEANVPROC glGetBooleanv; +RGLSYMGLGETDOUBLEVPROC glGetDoublev; +RGLSYMGLGETFLOATVPROC glGetFloatv; +RGLSYMGLGETINTEGERVPROC glGetIntegerv; +RGLSYMGLPUSHATTRIBPROC glPushAttrib; +RGLSYMGLPOPATTRIBPROC glPopAttrib; +RGLSYMGLPUSHCLIENTATTRIBPROC glPushClientAttrib; +RGLSYMGLPOPCLIENTATTRIBPROC glPopClientAttrib; +RGLSYMGLRENDERMODEPROC glRenderMode; +RGLSYMGLGETERRORPROC glGetError; +RGLSYMGLGETSTRINGPROC glGetString; +RGLSYMGLFINISHPROC glFinish; +RGLSYMGLFLUSHPROC glFlush; +RGLSYMGLHINTPROC glHint; +RGLSYMGLCLEARDEPTHPROC glClearDepth; +RGLSYMGLDEPTHFUNCPROC glDepthFunc; +RGLSYMGLDEPTHMASKPROC glDepthMask; +RGLSYMGLDEPTHRANGEPROC glDepthRange; +RGLSYMGLCLEARACCUMPROC glClearAccum; +RGLSYMGLACCUMPROC glAccum; +RGLSYMGLMATRIXMODEPROC glMatrixMode; +RGLSYMGLPUSHMATRIXPROC glPushMatrix; +RGLSYMGLPOPMATRIXPROC glPopMatrix; +RGLSYMGLLOADIDENTITYPROC glLoadIdentity; +RGLSYMGLLOADMATRIXDPROC glLoadMatrixd; +RGLSYMGLLOADMATRIXFPROC glLoadMatrixf; +RGLSYMGLMULTMATRIXDPROC glMultMatrixd; +RGLSYMGLMULTMATRIXFPROC glMultMatrixf; +RGLSYMGLSCALEDPROC glScaled; +RGLSYMGLSCALEFPROC glScalef; +RGLSYMGLTRANSLATEDPROC glTranslated; +RGLSYMGLTRANSLATEFPROC glTranslatef; +RGLSYMGLISLISTPROC glIsList; +RGLSYMGLDELETELISTSPROC glDeleteLists; +RGLSYMGLGENLISTSPROC glGenLists; +RGLSYMGLNEWLISTPROC glNewList; +RGLSYMGLENDLISTPROC glEndList; +RGLSYMGLCALLLISTPROC glCallList; +RGLSYMGLLISTBASEPROC glListBase; +RGLSYMGLBEGINPROC glBegin; +RGLSYMGLENDPROC glEnd; +RGLSYMGLVERTEX2DPROC glVertex2d; +RGLSYMGLVERTEX2FPROC glVertex2f; +RGLSYMGLVERTEX2IPROC glVertex2i; +RGLSYMGLVERTEX2SPROC glVertex2s; +RGLSYMGLVERTEX3DPROC glVertex3d; +RGLSYMGLVERTEX3FPROC glVertex3f; +RGLSYMGLVERTEX3IPROC glVertex3i; +RGLSYMGLVERTEX3SPROC glVertex3s; +RGLSYMGLVERTEX4DPROC glVertex4d; +RGLSYMGLVERTEX4FPROC glVertex4f; +RGLSYMGLVERTEX4IPROC glVertex4i; +RGLSYMGLVERTEX4SPROC glVertex4s; +RGLSYMGLVERTEX2DVPROC glVertex2dv; +RGLSYMGLVERTEX2FVPROC glVertex2fv; +RGLSYMGLVERTEX2IVPROC glVertex2iv; +RGLSYMGLVERTEX2SVPROC glVertex2sv; +RGLSYMGLVERTEX3DVPROC glVertex3dv; +RGLSYMGLVERTEX3FVPROC glVertex3fv; +RGLSYMGLVERTEX3IVPROC glVertex3iv; +RGLSYMGLVERTEX3SVPROC glVertex3sv; +RGLSYMGLVERTEX4DVPROC glVertex4dv; +RGLSYMGLVERTEX4FVPROC glVertex4fv; +RGLSYMGLVERTEX4IVPROC glVertex4iv; +RGLSYMGLVERTEX4SVPROC glVertex4sv; +RGLSYMGLNORMAL3BPROC glNormal3b; +RGLSYMGLNORMAL3DPROC glNormal3d; +RGLSYMGLNORMAL3FPROC glNormal3f; +RGLSYMGLNORMAL3IPROC glNormal3i; +RGLSYMGLNORMAL3SPROC glNormal3s; +RGLSYMGLNORMAL3BVPROC glNormal3bv; +RGLSYMGLNORMAL3DVPROC glNormal3dv; +RGLSYMGLNORMAL3FVPROC glNormal3fv; +RGLSYMGLNORMAL3IVPROC glNormal3iv; +RGLSYMGLNORMAL3SVPROC glNormal3sv; +RGLSYMGLINDEXDPROC glIndexd; +RGLSYMGLINDEXFPROC glIndexf; +RGLSYMGLINDEXIPROC glIndexi; +RGLSYMGLINDEXSPROC glIndexs; +RGLSYMGLINDEXUBPROC glIndexub; +RGLSYMGLINDEXDVPROC glIndexdv; +RGLSYMGLINDEXFVPROC glIndexfv; +RGLSYMGLINDEXIVPROC glIndexiv; +RGLSYMGLINDEXSVPROC glIndexsv; +RGLSYMGLINDEXUBVPROC glIndexubv; +RGLSYMGLCOLOR3BPROC glColor3b; +RGLSYMGLCOLOR3DPROC glColor3d; +RGLSYMGLCOLOR3FPROC glColor3f; +RGLSYMGLCOLOR3IPROC glColor3i; +RGLSYMGLCOLOR3SPROC glColor3s; +RGLSYMGLCOLOR3UBPROC glColor3ub; +RGLSYMGLCOLOR3UIPROC glColor3ui; +RGLSYMGLCOLOR3USPROC glColor3us; +RGLSYMGLCOLOR3BVPROC glColor3bv; +RGLSYMGLCOLOR3DVPROC glColor3dv; +RGLSYMGLCOLOR3FVPROC glColor3fv; +RGLSYMGLCOLOR3IVPROC glColor3iv; +RGLSYMGLCOLOR3SVPROC glColor3sv; +RGLSYMGLCOLOR3UBVPROC glColor3ubv; +RGLSYMGLCOLOR3UIVPROC glColor3uiv; +RGLSYMGLCOLOR3USVPROC glColor3usv; +RGLSYMGLCOLOR4BVPROC glColor4bv; +RGLSYMGLCOLOR4DVPROC glColor4dv; +RGLSYMGLCOLOR4FVPROC glColor4fv; +RGLSYMGLCOLOR4IVPROC glColor4iv; +RGLSYMGLCOLOR4SVPROC glColor4sv; +RGLSYMGLCOLOR4UBVPROC glColor4ubv; +RGLSYMGLCOLOR4UIVPROC glColor4uiv; +RGLSYMGLCOLOR4USVPROC glColor4usv; +RGLSYMGLTEXCOORD1DPROC glTexCoord1d; +RGLSYMGLTEXCOORD1FPROC glTexCoord1f; +RGLSYMGLTEXCOORD1IPROC glTexCoord1i; +RGLSYMGLTEXCOORD1SPROC glTexCoord1s; +RGLSYMGLTEXCOORD2DPROC glTexCoord2d; +RGLSYMGLTEXCOORD2FPROC glTexCoord2f; +RGLSYMGLTEXCOORD2IPROC glTexCoord2i; +RGLSYMGLTEXCOORD2SPROC glTexCoord2s; +RGLSYMGLTEXCOORD3DPROC glTexCoord3d; +RGLSYMGLTEXCOORD3FPROC glTexCoord3f; +RGLSYMGLTEXCOORD3IPROC glTexCoord3i; +RGLSYMGLTEXCOORD3SPROC glTexCoord3s; +RGLSYMGLTEXCOORD4DPROC glTexCoord4d; +RGLSYMGLTEXCOORD4FPROC glTexCoord4f; +RGLSYMGLTEXCOORD4IPROC glTexCoord4i; +RGLSYMGLTEXCOORD4SPROC glTexCoord4s; +RGLSYMGLTEXCOORD1DVPROC glTexCoord1dv; +RGLSYMGLTEXCOORD1FVPROC glTexCoord1fv; +RGLSYMGLTEXCOORD1IVPROC glTexCoord1iv; +RGLSYMGLTEXCOORD1SVPROC glTexCoord1sv; +RGLSYMGLTEXCOORD2DVPROC glTexCoord2dv; +RGLSYMGLTEXCOORD2FVPROC glTexCoord2fv; +RGLSYMGLTEXCOORD2IVPROC glTexCoord2iv; +RGLSYMGLTEXCOORD2SVPROC glTexCoord2sv; +RGLSYMGLTEXCOORD3DVPROC glTexCoord3dv; +RGLSYMGLTEXCOORD3FVPROC glTexCoord3fv; +RGLSYMGLTEXCOORD3IVPROC glTexCoord3iv; +RGLSYMGLTEXCOORD3SVPROC glTexCoord3sv; +RGLSYMGLTEXCOORD4DVPROC glTexCoord4dv; +RGLSYMGLTEXCOORD4FVPROC glTexCoord4fv; +RGLSYMGLTEXCOORD4IVPROC glTexCoord4iv; +RGLSYMGLTEXCOORD4SVPROC glTexCoord4sv; +RGLSYMGLRASTERPOS2DPROC glRasterPos2d; +RGLSYMGLRASTERPOS2FPROC glRasterPos2f; +RGLSYMGLRASTERPOS2IPROC glRasterPos2i; +RGLSYMGLRASTERPOS2SPROC glRasterPos2s; +RGLSYMGLRASTERPOS3DPROC glRasterPos3d; +RGLSYMGLRASTERPOS3FPROC glRasterPos3f; +RGLSYMGLRASTERPOS3IPROC glRasterPos3i; +RGLSYMGLRASTERPOS3SPROC glRasterPos3s; +RGLSYMGLRASTERPOS4DPROC glRasterPos4d; +RGLSYMGLRASTERPOS4FPROC glRasterPos4f; +RGLSYMGLRASTERPOS4IPROC glRasterPos4i; +RGLSYMGLRASTERPOS4SPROC glRasterPos4s; +RGLSYMGLRASTERPOS2DVPROC glRasterPos2dv; +RGLSYMGLRASTERPOS2FVPROC glRasterPos2fv; +RGLSYMGLRASTERPOS2IVPROC glRasterPos2iv; +RGLSYMGLRASTERPOS2SVPROC glRasterPos2sv; +RGLSYMGLRASTERPOS3DVPROC glRasterPos3dv; +RGLSYMGLRASTERPOS3FVPROC glRasterPos3fv; +RGLSYMGLRASTERPOS3IVPROC glRasterPos3iv; +RGLSYMGLRASTERPOS3SVPROC glRasterPos3sv; +RGLSYMGLRASTERPOS4DVPROC glRasterPos4dv; +RGLSYMGLRASTERPOS4FVPROC glRasterPos4fv; +RGLSYMGLRASTERPOS4IVPROC glRasterPos4iv; +RGLSYMGLRASTERPOS4SVPROC glRasterPos4sv; +RGLSYMGLRECTDPROC glRectd; +RGLSYMGLRECTFPROC glRectf; +RGLSYMGLRECTIPROC glRecti; +RGLSYMGLRECTSPROC glRects; +RGLSYMGLRECTDVPROC glRectdv; +RGLSYMGLRECTFVPROC glRectfv; +RGLSYMGLRECTIVPROC glRectiv; +RGLSYMGLRECTSVPROC glRectsv; +RGLSYMGLEDGEFLAGPOINTERPROC glEdgeFlagPointer; +RGLSYMGLGETPOINTERVPROC glGetPointerv; +RGLSYMGLARRAYELEMENTPROC glArrayElement; +RGLSYMGLDRAWARRAYSPROC glDrawArrays; +RGLSYMGLSHADEMODELPROC glShadeModel; +RGLSYMGLLIGHTFPROC glLightf; +RGLSYMGLLIGHTIPROC glLighti; +RGLSYMGLLIGHTMODELFPROC glLightModelf; +RGLSYMGLLIGHTMODELIPROC glLightModeli; +RGLSYMGLLIGHTMODELFVPROC glLightModelfv; +RGLSYMGLLIGHTMODELIVPROC glLightModeliv; +RGLSYMGLMATERIALFPROC glMaterialf; +RGLSYMGLMATERIALIPROC glMateriali; +RGLSYMGLMATERIALFVPROC glMaterialfv; +RGLSYMGLMATERIALIVPROC glMaterialiv; +RGLSYMGLGETMATERIALFVPROC glGetMaterialfv; +RGLSYMGLGETMATERIALIVPROC glGetMaterialiv; +RGLSYMGLCOLORMATERIALPROC glColorMaterial; +RGLSYMGLPIXELZOOMPROC glPixelZoom; +RGLSYMGLPIXELSTOREFPROC glPixelStoref; +RGLSYMGLPIXELSTOREIPROC glPixelStorei; +RGLSYMGLPIXELTRANSFERFPROC glPixelTransferf; +RGLSYMGLPIXELTRANSFERIPROC glPixelTransferi; +RGLSYMGLGETPIXELMAPFVPROC glGetPixelMapfv; +RGLSYMGLGETPIXELMAPUIVPROC glGetPixelMapuiv; +RGLSYMGLGETPIXELMAPUSVPROC glGetPixelMapusv; +RGLSYMGLSTENCILFUNCPROC glStencilFunc; +RGLSYMGLSTENCILMASKPROC glStencilMask; +RGLSYMGLSTENCILOPPROC glStencilOp; +RGLSYMGLCLEARSTENCILPROC glClearStencil; +RGLSYMGLTEXGENDPROC glTexGend; +RGLSYMGLTEXGENFPROC glTexGenf; +RGLSYMGLTEXGENIPROC glTexGeni; +RGLSYMGLTEXGENDVPROC glTexGendv; +RGLSYMGLTEXGENFVPROC glTexGenfv; +RGLSYMGLTEXGENIVPROC glTexGeniv; +RGLSYMGLGETTEXGENDVPROC glGetTexGendv; +RGLSYMGLGETTEXGENFVPROC glGetTexGenfv; +RGLSYMGLGETTEXGENIVPROC glGetTexGeniv; +RGLSYMGLTEXENVFPROC glTexEnvf; +RGLSYMGLTEXENVIPROC glTexEnvi; +RGLSYMGLTEXENVFVPROC glTexEnvfv; +RGLSYMGLTEXENVIVPROC glTexEnviv; +RGLSYMGLGETTEXENVFVPROC glGetTexEnvfv; +RGLSYMGLGETTEXENVIVPROC glGetTexEnviv; +RGLSYMGLTEXPARAMETERFPROC glTexParameterf; +RGLSYMGLTEXPARAMETERIPROC glTexParameteri; +RGLSYMGLGENTEXTURESPROC glGenTextures; +RGLSYMGLDELETETEXTURESPROC glDeleteTextures; +RGLSYMGLBINDTEXTUREPROC glBindTexture; +RGLSYMGLISTEXTUREPROC glIsTexture; +RGLSYMGLGETMAPDVPROC glGetMapdv; +RGLSYMGLGETMAPFVPROC glGetMapfv; +RGLSYMGLGETMAPIVPROC glGetMapiv; +RGLSYMGLEVALCOORD1DPROC glEvalCoord1d; +RGLSYMGLEVALCOORD1FPROC glEvalCoord1f; +RGLSYMGLEVALCOORD1DVPROC glEvalCoord1dv; +RGLSYMGLEVALCOORD1FVPROC glEvalCoord1fv; +RGLSYMGLEVALCOORD2DPROC glEvalCoord2d; +RGLSYMGLEVALCOORD2FPROC glEvalCoord2f; +RGLSYMGLEVALCOORD2DVPROC glEvalCoord2dv; +RGLSYMGLEVALCOORD2FVPROC glEvalCoord2fv; +RGLSYMGLMAPGRID1DPROC glMapGrid1d; +RGLSYMGLMAPGRID1FPROC glMapGrid1f; +RGLSYMGLEVALPOINT1PROC glEvalPoint1; +RGLSYMGLEVALPOINT2PROC glEvalPoint2; +RGLSYMGLEVALMESH1PROC glEvalMesh1; +RGLSYMGLEVALMESH2PROC glEvalMesh2; +RGLSYMGLFOGFPROC glFogf; +RGLSYMGLFOGIPROC glFogi; +RGLSYMGLFOGFVPROC glFogfv; +RGLSYMGLFOGIVPROC glFogiv; +RGLSYMGLFEEDBACKBUFFERPROC glFeedbackBuffer; +RGLSYMGLPASSTHROUGHPROC glPassThrough; +RGLSYMGLSELECTBUFFERPROC glSelectBuffer; +RGLSYMGLINITNAMESPROC glInitNames; +RGLSYMGLLOADNAMEPROC glLoadName; +RGLSYMGLPUSHNAMEPROC glPushName; +RGLSYMGLPOPNAMEPROC glPopName; +RGLSYMGLBLENDEQUATIONPROC glBlendEquation; +RGLSYMGLRESETHISTOGRAMPROC glResetHistogram; +RGLSYMGLRESETMINMAXPROC glResetMinmax; +RGLSYMGLACTIVETEXTUREPROC glActiveTexture; +RGLSYMGLCLIENTACTIVETEXTUREPROC glClientActiveTexture; +RGLSYMGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D; +RGLSYMGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D; +RGLSYMGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D; +RGLSYMGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage; +RGLSYMGLMULTITEXCOORD1DPROC glMultiTexCoord1d; +RGLSYMGLMULTITEXCOORD1DVPROC glMultiTexCoord1dv; +RGLSYMGLMULTITEXCOORD1FPROC glMultiTexCoord1f; +RGLSYMGLMULTITEXCOORD1FVPROC glMultiTexCoord1fv; +RGLSYMGLMULTITEXCOORD1IPROC glMultiTexCoord1i; +RGLSYMGLMULTITEXCOORD1IVPROC glMultiTexCoord1iv; +RGLSYMGLMULTITEXCOORD1SPROC glMultiTexCoord1s; +RGLSYMGLMULTITEXCOORD1SVPROC glMultiTexCoord1sv; +RGLSYMGLMULTITEXCOORD2DPROC glMultiTexCoord2d; +RGLSYMGLMULTITEXCOORD2DVPROC glMultiTexCoord2dv; +RGLSYMGLMULTITEXCOORD2FPROC glMultiTexCoord2f; +RGLSYMGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv; +RGLSYMGLMULTITEXCOORD2IPROC glMultiTexCoord2i; +RGLSYMGLMULTITEXCOORD2IVPROC glMultiTexCoord2iv; +RGLSYMGLMULTITEXCOORD2SPROC glMultiTexCoord2s; +RGLSYMGLMULTITEXCOORD2SVPROC glMultiTexCoord2sv; +RGLSYMGLMULTITEXCOORD3DPROC glMultiTexCoord3d; +RGLSYMGLMULTITEXCOORD3DVPROC glMultiTexCoord3dv; +RGLSYMGLMULTITEXCOORD3FPROC glMultiTexCoord3f; +RGLSYMGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv; +RGLSYMGLMULTITEXCOORD3IPROC glMultiTexCoord3i; +RGLSYMGLMULTITEXCOORD3IVPROC glMultiTexCoord3iv; +RGLSYMGLMULTITEXCOORD3SPROC glMultiTexCoord3s; +RGLSYMGLMULTITEXCOORD3SVPROC glMultiTexCoord3sv; +RGLSYMGLMULTITEXCOORD4DPROC glMultiTexCoord4d; +RGLSYMGLMULTITEXCOORD4DVPROC glMultiTexCoord4dv; +RGLSYMGLMULTITEXCOORD4FPROC glMultiTexCoord4f; +RGLSYMGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv; +RGLSYMGLMULTITEXCOORD4IPROC glMultiTexCoord4i; +RGLSYMGLMULTITEXCOORD4IVPROC glMultiTexCoord4iv; +RGLSYMGLMULTITEXCOORD4SPROC glMultiTexCoord4s; +RGLSYMGLMULTITEXCOORD4SVPROC glMultiTexCoord4sv; +RGLSYMGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd; +RGLSYMGLLOADTRANSPOSEMATRIXFPROC glLoadTransposeMatrixf; +RGLSYMGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd; +RGLSYMGLMULTTRANSPOSEMATRIXFPROC glMultTransposeMatrixf; +RGLSYMGLSAMPLECOVERAGEPROC glSampleCoverage; +RGLSYMGLACTIVETEXTUREARBPROC glActiveTextureARB; +RGLSYMGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB; +RGLSYMGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB; +RGLSYMGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB; +RGLSYMGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB; +RGLSYMGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB; +RGLSYMGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB; +RGLSYMGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB; +RGLSYMGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB; +RGLSYMGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB; +RGLSYMGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB; +RGLSYMGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB; +RGLSYMGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB; +RGLSYMGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB; +RGLSYMGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB; +RGLSYMGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB; +RGLSYMGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB; +RGLSYMGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB; +RGLSYMGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB; +RGLSYMGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB; +RGLSYMGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB; +RGLSYMGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB; +RGLSYMGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB; +RGLSYMGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB; +RGLSYMGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB; +RGLSYMGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB; +RGLSYMGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB; +RGLSYMGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB; +RGLSYMGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB; +RGLSYMGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB; +RGLSYMGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB; +RGLSYMGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB; +RGLSYMGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB; +RGLSYMGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB; +RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; +RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES; +RGLSYMGLBINDTEXTURESPROC glBindTextures; + +#ifdef __cplusplus +} +#endif +#endif // __NX_GLSYM_H__ From 870cd941e38e79c4706ff14a7aba4bde6eae32d0 Mon Sep 17 00:00:00 2001 From: M4xw Date: Thu, 27 Sep 2018 00:58:51 +0200 Subject: [PATCH 0080/1292] Build fix if HAVE_NETWORKING isn't defined --- configuration.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configuration.c b/configuration.c index 661573c666..aa24ff9612 100644 --- a/configuration.c +++ b/configuration.c @@ -1536,7 +1536,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, unsigned count = 0; struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting)); +#ifdef HAVE_NETWORKING SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false); +#endif SETTING_UINT("crt_switch_resolution", &settings->uints.crt_switch_resolution, true, crt_switch_resolution, false); SETTING_UINT("input_bind_timeout", &settings->uints.input_bind_timeout, true, input_bind_timeout, false); SETTING_UINT("input_bind_hold", &settings->uints.input_bind_hold, true, input_bind_hold, false); From fd155db9cca5696495440a35cc7fb9fc9b8831ff Mon Sep 17 00:00:00 2001 From: M4xw Date: Thu, 27 Sep 2018 01:18:07 +0200 Subject: [PATCH 0081/1292] [LIBNX] Fix font driver --- Makefile.libnx | 2 +- gfx/font_driver.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Makefile.libnx b/Makefile.libnx index fc461a2b5d..b8a6ba87a3 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -110,7 +110,7 @@ NO_ICON := 1 ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd CFLAGS := -g -Wall -O3 -ffast-math -ffunction-sections \ - $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h $(shell $(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags) + $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h #$(shell $(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags) CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 diff --git a/gfx/font_driver.c b/gfx/font_driver.c index e8af0dca9e..9081c721bb 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -524,6 +524,37 @@ static bool ctr_font_init_first( } #endif +#ifdef HAVE_LIBNX +static const font_renderer_t *switch_font_backends[] = { + &switch_font, + NULL +}; + +static bool switch_font_init_first( + const void **font_driver, void **font_handle, + void *video_data, const char *font_path, + float font_size, bool is_threaded) +{ + unsigned i; + + for (i = 0; switch_font_backends[i]; i++) + { + void *data = switch_font_backends[i]->init( + video_data, font_path, font_size, + is_threaded); + + if (!data) + continue; + + *font_driver = switch_font_backends[i]; + *font_handle = data; + return true; + } + + return false; +} +#endif + #ifdef WIIU static const font_renderer_t *wiiu_font_backends[] = { &wiiu_font, @@ -630,6 +661,11 @@ static bool font_init_first( return sixel_font_init_first(font_driver, font_handle, video_data, font_path, font_size, is_threaded); #endif +#ifdef HAVE_LIBNX + case FONT_DRIVER_RENDER_SWITCH: + return switch_font_init_first(font_driver, font_handle, + video_data, font_path, font_size, is_threaded); +#endif #if defined(_WIN32) && !defined(_XBOX) case FONT_DRIVER_RENDER_GDI: return gdi_font_init_first(font_driver, font_handle, From 2c59716e77580cf8e81b33286f2bb98e3126bf61 Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 26 Sep 2018 18:46:00 -0500 Subject: [PATCH 0082/1292] [record] refinements --- record/drivers/record_ffmpeg.c | 14 +- retroarch.cfg | 3810 ++++++++++++++++++++++++-------- 2 files changed, 2930 insertions(+), 894 deletions(-) diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 2ae537fee8..b07e2e09ba 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -640,7 +640,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p { if (!settings->bools.video_gpu_record) params->scale_factor = settings->uints.video_record_scale_factor > 0 ? - settings->uints.video_record_scale_factor : 1; + settings->uints.video_record_scale_factor : 2; else params->scale_factor = 1; strlcpy(params->format, "matroska", sizeof(params->format)); @@ -649,17 +649,16 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p { if (!settings->bools.video_gpu_record) params->scale_factor = settings->uints.video_stream_scale_factor > 0 ? - settings->uints.video_stream_scale_factor : 1; + settings->uints.video_stream_scale_factor : 2; else - params->scale_factor = 1; + params->scale_factor = 2; strlcpy(params->format, "flv", sizeof(params->format)); } - else + else if (preset == RECORD_CONFIG_TYPE_STREAMING_NETPLAY) { params->scale_factor = 1; - strlcpy(params->format, "flv", sizeof(params->format)); + strlcpy(params->format, "m2ts", sizeof(params->format)); } - return true; } @@ -698,6 +697,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, return true; params->conf = config_file_new(config); + RARCH_LOG("[FFmpeg] Loading FFmpeg config \"%s\".\n", config); if (!params->conf) { RARCH_ERR("[FFmpeg] Failed to load FFmpeg config \"%s\".\n", config); @@ -938,7 +938,7 @@ static void *ffmpeg_new(const struct record_params *params) handle->params = *params; - if (params->preset == RECORD_CONFIG_TYPE_RECORDING_CUSTOM) + if (params->preset == RECORD_CONFIG_TYPE_RECORDING_CUSTOM || params->preset == RECORD_CONFIG_TYPE_STREAMING_CUSTOM) { if (!ffmpeg_init_config(&handle->config, params->config)) goto error; diff --git a/retroarch.cfg b/retroarch.cfg index 671fa4a73c..761e9d811f 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -1,887 +1,2923 @@ -## Skeleton config file for RetroArch - -# If set to a directory, the content history playlist will be saved -# to this directory. -# content_history_dir = - -# Automatically saves a savestate at the end of RetroArch's lifetime. -# The path is $SRAM_PATH.auto. -# RetroArch will automatically load any savestate with this path on startup if savestate_auto_load is set. -# savestate_auto_save = false -# savestate_auto_load = true - -# Load libretro from a dynamic location for dynamically built RetroArch. -# This option is mandatory. - -# Path to a libretro implementation. -# libretro_path = "/path/to/libretro.so" - -# Sets log level for libretro cores (GET_LOG_INTERFACE). -# If a log level issued by a libretro core is below libretro_log_level, it is ignored. -# DEBUG logs are always ignored unless verbose mode is activated (--verbose). -# DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3. -# libretro_log_level = 0 - -# Enable or disable verbosity level of frontend. -# log_verbosity = false - -# If this option is enabled, every content file loaded in RetroArch will be -# automatically added to a history list. -# history_list_enable = true - -# Enable performance counters -# perfcnt_enable = false - -# Path to core options config file. -# This config file is used to expose core-specific options. -# It will be written to by RetroArch. -# A default path will be assigned if not set. -# core_options_path = - -# Path to content history file. -# RetroArch keeps track of all content loaded in the menu and from CLI directly for convenient quick loading. -# A default path will be assigned if not set. -# content_history_path = - -# Path to music content history file (optional). -# RetroArch keeps track of all music content loaded in the menu and from CLI directly for convenient quick loading. -# A default path will be assigned if not set. -# content_music_history_path = - -# Path to image content history file (optional). -# RetroArch keeps track of all image content loaded in the menu and from CLI directly for convenient quick loading. -# A default path will be assigned if not set. -# content_image_history_path = - -# Path to video content history file (optional). -# RetroArch keeps track of all video content loaded in the menu and from CLI directly for convenient quick loading. -# A default path will be assigned if not set. -# content_video_history_path = - -# Number of entries that will be kept in content history file. -# content_history_size = 100 - -# Content directory. Interacts with RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY. -# Usually set by developers who bundle libretro/RetroArch apps to point to assets. -# content_directory = - -# Sets start directory for menu config browser. -# rgui_config_directory = - -# Show startup screen in menu. -# Is automatically set to false when seen for the first time. -# This is only updated in config if config_save_on_exit is set to true, however. -# rgui_show_start_screen = true - -# Flushes config to disk on exit. Useful for menu as settings can be modified. -# Overwrites the config. #include's and comments are not preserved. -# config_save_on_exit = true - -# Shows hidden files and folders in directory listings. -# show_hidden_files = false - -#### Driver - -# Input driver. Depending on video driver, it might force a different input driver. -# input_driver = sdl - -# Joypad driver. ("udev", "linuxraw", "paraport", "sdl2", "hid", "dinput") -# input_joypad_driver = - -# Video driver to use. "gl", "xvideo", "sdl", "d3d" -# video_driver = "gl" - -# Which context implementation to use. -# Possible ones for desktop are: glx, x-egl, kms-egl, sdl-gl, wgl. -# By default, tries to use first suitable driver. -# video_context_driver = - -# Audio driver backend. Depending on configuration possible candidates are: alsa, pulse, oss, jack, rsound, roar, openal, sdl, xaudio. -# audio_driver = - -# Audio resampler driver backend. Which audio resampler to use. -# Default will use "sinc". -# audio_resampler = - -# Camera driver. -# camera_driver = - -# Location driver. -# location_driver = - -# Menu driver to use. ("rgui", "xmb", "glui") -# menu_driver = "rgui" - -# Record driver. Used when recording video. -# record_driver = - -#### Video - -# Suspends the screensaver if set to true. Is a hint that does not necessarily have to be honored -# by video driver. -# suspend_screensaver_enable = true - -# Display framerate. -# fps_show = false - -# Display total number of frames rendered. (only displays if fps_show is enabled) -# framecount_show = - -# Which monitor to prefer. 0 (default) means no particular monitor is preferred, 1 and up (1 being first monitor), -# suggests RetroArch to use that particular monitor. -# video_monitor_index = 0 - -# Start in fullscreen. Can be changed at runtime. -# video_fullscreen = false - -# If fullscreen, prefer using a windowed fullscreen mode. -# video_windowed_fullscreen = true - -# Fullscreen resolution. Resolution of 0 uses the resolution of the desktop. -# video_fullscreen_x = 0 -# video_fullscreen_y = 0 - -# Video refresh rate of your CRT monitor. -# Used to calculate a suitable audio input rate. -# crt_video_refresh_rate = 59.94 - -# Video refresh rate of your monitor. -# Used to calculate a suitable audio input rate. -# video_refresh_rate = 59.94 - -# Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows -# have video problems with sRGB FBO support enabled. -# video_force_srgb_disable = false - -# If this is true and video_aspect_ratio is not set, -# aspect ratio is decided by libretro implementation. -# If this is false, 1:1 PAR will always be assumed if video_aspect_ratio is not set. -# video_aspect_ratio_auto = false - -# A floating point value for video aspect ratio (width / height). -# If this is not set, aspect ratio is assumed to be automatic. -# Behavior then is defined by video_aspect_ratio_auto. -# video_aspect_ratio = - -# Windowed x resolution scale and y resolution scale -# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale) -# video_scale = 3.0 - -# Percentage of opacity to use for the window (100 is completely opaque). -# video_window_opacity = 100 - -# Whether to enable the default window decorations like border, titlebar etc. -# video_window_show_decorations = true - -# Forcibly disable composition. Only works in Windows Vista/7 for now. -# video_disable_composition = false - -# Video vsync. -# video_vsync = true - -# Interval at which a Vsync swap is performed. -# 1 is normal, 2 is doubled frames, 3 is tripled frames, etc. -# video_swap_interval = 1 - -# Max amount of swapchain images. -# Single buffering = 1, Double buffering = 2, 3 = Triple buffering -# video_max_swapchain_images = 3 - -# Attempts to hard-synchronize CPU and GPU. Can reduce latency at cost of performance. -# video_hard_sync = false - -# Sets how many frames CPU can run ahead of GPU when using video_hard_sync. -# Maximum is 3. -# video_hard_sync_frames = 0 - -# Sets how many milliseconds to delay after VSync before running the core. -# Can reduce latency at cost of higher risk of stuttering. -# Maximum is 15. -# video_frame_delay = 0 - -# Inserts a black frame inbetween frames. -# Useful for 120 Hz monitors who want to play 60 Hz material with eliminated ghosting. -# video_refresh_rate should still be configured as if it is a 60 Hz monitor (divide refresh rate by 2). -# video_black_frame_insertion = false - -# Use threaded video driver. Using this might improve performance at possible cost of latency and more video stuttering. -# video_threaded = false - -# Use a shared context for HW rendered libretro cores. -# Avoids having to assume HW state changes inbetween frames. -# video_shared_context = false - -# Smoothens picture with bilinear filtering. Should be disabled if using pixel shaders. -# video_smooth = true - -# Forces rendering area to stay equal to content aspect ratio or as defined in video_aspect_ratio. -# video_force_aspect = true - -# Only scales video in integer steps. -# The base size depends on system-reported geometry and aspect ratio. -# If video_force_aspect is not set, X/Y will be integer scaled independently. -# video_scale_integer = false - -# Index of the aspect ratio selection in the menu. -# 19 = Config, 20 = 1:1 PAR, 21 = Core Provided, 22 = Custom Aspect Ratio -# aspect_ratio_index = 19 - -# Forces cropping of overscanned frames. -# Exact behavior of this option is implementation specific. -# video_crop_overscan = true - -# Path to shader. Shader can be either Cg, CGP (Cg preset) or GLSL, GLSLP (GLSL preset) -# video_shader = "/path/to/shader.{cg,cgp,glsl,glslp}" - -# Load video_shader on startup. -# Other shaders can still be loaded later in runtime. -# video_shader_enable = false - -# CPU-based video filter. Path to a dynamic library. -# video_filter = - -# Path to a font used for rendering messages. This path must be defined to enable fonts. -# Do note that the _full_ path of the font is necessary! -# video_font_path = - -# Size of the font rendered in points. -# video_font_size = 32 - -# Enable usage of OSD messages. -# video_font_enable = true - -# Offset for where messages will be placed on screen. Values are in range 0.0 to 1.0 for both x and y values. -# [0.0, 0.0] maps to the lower left corner of the screen. -# video_message_pos_x = 0.05 -# video_message_pos_y = 0.05 - -# Color for message. The value is treated as a hexadecimal value. -# It is a regular RGB hex number, i.e. red is "ff0000". -# video_message_color = ffffff - -# Background color for OSD messages. Red/Green/Blue values are from 0 to 255 and opacity is 0.0 to 1.0. -# video_message_bgcolor_enable = false -# video_message_bgcolor_red = 0 -# video_message_bgcolor_green = 0 -# video_message_bgcolor_blue = 0 -# video_message_bgcolor_opacity = 1.0 - -# Allows libretro cores to set rotation modes. -# Setting this to false will honor, but ignore this request. -# This is useful for vertically oriented content where one manually rotates the monitor. -# video_allow_rotate = true - -# Forces a certain rotation of the screen. -# The rotation is added to rotations which the libretro core sets (see video_allow_rotate). -# The angle is * 90 degrees counter-clockwise. -# video_rotation = 0 - -#### Audio - -# Enable audio. -# audio_enable = true - -# Mutes audio. -# audio_mute_enable = false - -# Mutes audio mixer volume globally. -# audio_mixer_mute_enable = false - -# Audio output samplerate. -# audio_out_rate = 48000 - -# Override the default audio device the audio_driver uses. This is driver dependant. E.g. ALSA wants a PCM device, OSS wants a path (e.g. /dev/dsp), Jack wants portnames (e.g. system:playback1,system:playback_2), and so on ... -# audio_device = - -# Audio DSP plugin that processes audio before it's sent to the driver. Path to a dynamic library. -# audio_dsp_plugin = - -# Will sync (block) on audio. Recommended. -# audio_sync = true - -# Desired audio latency in milliseconds. Might not be honored if driver can't provide given latency. -# audio_latency = 64 - -# Enable audio rate control. -# audio_rate_control = true - -# Controls audio rate control delta. Defines how much input rate can be adjusted dynamically. -# Input rate = in_rate * (1.0 +/- audio_rate_control_delta) -# audio_rate_control_delta = 0.005 - -# Controls maximum audio timing skew. Defines the maximum change in input rate. -# Input rate = in_rate * (1.0 +/- max_timing_skew) -# audio_max_timing_skew = 0.05 - -# Audio volume. Volume is expressed in dB. -# 0 dB is normal volume. No gain will be applied. -# Gain can be controlled in runtime with input_volume_up/input_volume_down. -# audio_volume = 0.0 - -# Audio mixer volume. Volume is expressed in dB. -# 0 dB is normal volume. No gain will be applied. -# audio_mixer_volume = 0.0 - -#### Overlay - -# Enable the overlay. -# input_overlay_enable = true - -# Hide the current overlay from appearing inside the menu. -# input_overlay_hide_in_menu = true - -# Path to input overlay. -# input_overlay = - -# Opacity of all the UI elements of the overlay. -# input_overlay_opacity = 1.0 - -# Scale of all UI elements of the overlay. -# input_overlay_scale = 1.0 - -#### Input - -# Path to input remapping file. -# input_remapping_path = - -# Input bind timer timeout. -# Amount of seconds to wait until proceeding to the next bind. Default: 5, minimum: 1 -# input_bind_timeout = 1 - -# If enabled, overrides the input binds with the remapped binds set for the current core. -# input_remap_binds_enable = true - -# Maximum amount of users supported by RetroArch. -# input_max_users = 16 - -# Keyboard layout for input driver if applicable (udev/evdev for now). -# Syntax is either just layout (e.g. "no"), or a layout and variant separated with colon ("no:nodeadkeys"). -# input_keyboard_layout = - -# Defines axis threshold. Possible values are [0.0, 1.0] -# input_axis_threshold = 0.5 - -# Enable input auto-detection. Will attempt to autoconfigure -# joypads, Plug-and-Play style. -# input_autodetect_enable = true - -# Show the input descriptors set by the core instead of the -# default ones. -# input_descriptor_label_show = true - -# Hide input descriptors that were not set by the core. -# input_descriptor_hide_unbound = false - -# Influence how input polling is done inside RetroArch. -# 0 : Early - Input polling is performed before call to retro_run. -# 1 : Normal - Input polling is performed when retro_input_poll is -# requested. -# 2 : Late - Input polling is performed on first call to retro_input_state -# per frame -# -# Setting it to 0 or 2 can result in less latency depending on -# your configuration. -# -# When netplay is enabled, the default polling behavior (1) will -# be used regardless of the value set here. -# input_poll_type_behavior = 1 - -# Sets which libretro device is used for a user. -# Devices are indentified with a number. -# This is normally saved by the menu. -# Device IDs are found in libretro.h. -# These settings are overridden by explicit command-line arguments which refer to input devices. -# None: 0 -# Joypad (RetroPad): 1 -# Mouse: 2 -# Keyboard: 3 -# Generic Lightgun: 4 -# Joypad w/ Analog (RetroPad + Analog sticks): 5 -# Multitap (SNES specific): 257 -# Super Scope (SNES specific): 260 -# Justifier (SNES specific): 516 -# Justifiers (SNES specific): 772 - -# input_libretro_device_p1 = -# input_libretro_device_p2 = -# input_libretro_device_p3 = -# input_libretro_device_p4 = -# input_libretro_device_p5 = -# input_libretro_device_p6 = -# input_libretro_device_p7 = -# input_libretro_device_p8 = - -# Keyboard input. Will recognize letters ("a" to "z") and the following special keys (where "kp_" -# is for keypad keys): -# -# left, right, up, down, enter, kp_enter, tab, insert, del, end, home, -# rshift, shift, ctrl, alt, space, escape, add, subtract, kp_plus, kp_minus, -# f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, -# num0, num1, num2, num3, num4, num5, num6, num7, num8, num9, pageup, pagedown, -# keypad0, keypad1, keypad2, keypad3, keypad4, keypad5, keypad6, keypad7, keypad8, keypad9, -# period, capslock, numlock, backspace, multiply, divide, print_screen, scroll_lock, -# tilde, backquote, pause, quote, comma, minus, slash, semicolon, equals, leftbracket, -# backslash, rightbracket, kp_period, kp_equals, rctrl, ralt -# -# Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely, -# rather than relying on a default. -# input_player1_a = "x" -# input_player1_b = "z" -# input_player1_y = "a" -# input_player1_x = "s" -# input_player1_start = "enter" -# input_player1_select = "rshift" -# input_player1_l = "q" -# input_player1_r = "w" -# input_player1_left = "left" -# input_player1_right = "right" -# input_player1_up = "up" -# input_player1_down = "down" -# input_player1_l2 = -# input_player1_r2 = -# input_player1_l3 = -# input_player1_r3 = - -# Two analog sticks (DualShock-esque). -# Bound as usual, however, if a real analog axis is bound, -# it can be read as a true analog. -# Positive X axis is right, Positive Y axis is down. -# input_player1_l_x_plus = -# input_player1_l_x_minus = -# input_player1_l_y_plus = -# input_player1_l_y_minus = -# input_player1_r_x_plus = -# input_player1_r_x_minus = -# input_player1_r_y_plus = -# input_player1_r_y_minus = - -# If desired, it is possible to override which joypads are being used for user 1 through 8. -# First joypad available is 0. -# input_player1_joypad_index = 0 -# input_player2_joypad_index = 1 -# input_player3_joypad_index = 2 -# input_player4_joypad_index = 3 -# input_player5_joypad_index = 4 -# input_player6_joypad_index = 5 -# input_player7_joypad_index = 6 -# input_player8_joypad_index = 7 - -# Input device buttons. -# Figure these out by using RetroArch-Phoenix or retroarch-joyconfig. -# You can use joypad hats with hnxx, where n is the hat, and xx is a string representing direction. -# E.g. "h0up" -# input_player1_a_btn = -# input_player1_b_btn = -# input_player1_y_btn = -# input_player1_x_btn = -# input_player1_start_btn = -# input_player1_select_btn = -# input_player1_l_btn = -# input_player1_r_btn = -# input_player1_left_btn = -# input_player1_right_btn = -# input_player1_up_btn = -# input_player1_down_btn = -# input_player1_l2_btn = -# input_player1_r2_btn = -# input_player1_l3_btn = -# input_player1_r3_btn = - -# Menu buttons. -# menu_search_btn = -# menu_info_btn = -# menu_default_btn = -# menu_scroll_down_btn = -# menu_scroll_up_btn = - -# Swap buttons for OK/Cancel -# menu_swap_ok_cancel_buttons = false - -# Axis for RetroArch D-Pad. -# Needs to be either '+' or '-' in the first character signaling either positive or negative direction of the axis, then the axis number. -# Do note that every other input option has the corresponding _btn and _axis binds as well; they are omitted here for clarity. -# input_player1_left_axis = -# input_player1_right_axis = -# input_player1_up_axis = -# input_player1_down_axis = - -# Holding the turbo while pressing another button will let the button enter a turbo mode -# where the button state is modulated with a periodic signal. -# The modulation stops when the button itself (not turbo button) is released. -# input_player1_turbo = - -# Describes the period and how long of that period a turbo-enabled button should behave. -# Numbers are described in frames. -# input_turbo_period = 6 -# input_turbo_duty_cycle = 3 - -# This goes all the way to user 8 (*_player2_*, *_player3_*, etc), but omitted for clarity. -# All input binds have corresponding binds for keyboard (none), joykeys (_btn) and joyaxes (_axis) as well. - -# Toggles fullscreen. -# input_toggle_fullscreen = f - -# Saves state. -# input_save_state = f2 -# Loads state. -# input_load_state = f4 - -# State slots. With slot set to 0, save state name is *.state (or whatever defined on commandline). -# When slot is != 0, path will be $path%d, where %d is slot number. -# input_state_slot_increase = f7 -# input_state_slot_decrease = f6 - -# Toggles between fast-forwarding and normal speed. -# input_toggle_fast_forward = space - -# Hold for fast-forward. Releasing button disables fast-forward. -# input_hold_fast_forward = l - -# Key to exit RetroArch cleanly. -# Killing it in any hard way (SIGKILL, etc) will terminate RetroArch without saving RAM, etc. -# On Unix-likes, SIGINT/SIGTERM allows a clean deinitialization. -# input_exit_emulator = escape - - -# Applies next and previous shader in directory. -# input_shader_next = m -# input_shader_prev = n - -# Hold button down to rewind. Rewinding must be enabled. -# input_rewind = r - -# Toggle between recording and not. -# input_movie_record_toggle = o - -# Toggle between paused and non-paused state -# input_pause_toggle = p - -# Frame advance when content is paused -# input_frame_advance = k - -# Reset the content. -# input_reset = h - -# Cheats. -# input_cheat_index_plus = y -# input_cheat_index_minus = t -# input_cheat_toggle = u - -# Mute/unmute audio -# input_audio_mute = f9 - -# Take screenshot -# input_screenshot = f8 - -# Netplay flip users. -# input_netplay_flip_players = i - -# Hold for slowmotion. -# input_slowmotion = e - -# Enable other hotkeys. -# If this hotkey is bound to either keyboard, joybutton or joyaxis, -# all other hotkeys will be disabled unless this hotkey is also held at the same time. -# This is useful for RETRO_KEYBOARD centric implementations -# which query a large area of the keyboard, where it is not desirable -# that hotkeys get in the way. - -# Alternatively, all hotkeys for keyboard could be disabled by the user. -# input_enable_hotkey_btn = - -# Increases audio volume. -# input_volume_up = kp_plus -# Decreases audio volume. -# input_volume_down = kp_minus - -# Toggles to next overlay. Wraps around. -# input_overlay_next = - -# Toggles eject for disks. Used for multiple-disk content. -# input_disk_eject_toggle = - -# Cycles through disk images. Use after ejecting. -# Complete by toggling eject again. -# input_disk_next = - -# Toggles menu. -# input_menu_toggle = f1 - -# RetroPad button combination to toggle menu -# 0 = none, 1 = L + R + Y + D-Pad Down, 2 = L3 + R3, 3 = Start + Select -# input_menu_toggle_gamepad_combo = 0 - -# allow any RetroPad to control the menu -# all_users_control_menu = false - -# Toggles mouse grab. When mouse is grabbed, RetroArch hides the mouse, -# and keeps the mouse pointer inside the window to allow relative mouse input -# to work better. -# input_grab_mouse_toggle = f11 - -#### Menu - -# If disabled, will hide 'Online Updater' inside the menu. -# menu_show_online_updater = true - -# If disabled, will hide the ability to update cores (and core info files) inside the menu. -# menu_show_core_updater = true - -# If disabled, the libretro core will keep running in the background when we -# are in the menu. -# menu_pause_libretro = false - -# If disabled, we use separate controls for menu operation. -# menu_unified_controls = false - -# Enable mouse controls inside the menu. -# menu_mouse_enable = false - -# Enable touch controls inside the menu. -# menu_pointer_enable = false - -# Shows current date and/or time inside menu. -# menu_timedate_enable = true - -# Shows current battery level inside menu. -# menu_battery_level_enable = true - -# Shows current core inside menu. -# menu_core_enable = true - -# Path to an image to set as menu wallpaper. -# menu_wallpaper = - -# Dynamically load a new wallpaper depending on context. -# menu_dynamic_wallpaper_enable = false - -# Type of thumbnail to display. 0 = none, 1 = snaps, 2 = titles, 3 = boxarts -# menu_thumbnails = 0 -# menu_left_thumbnails = 0 - -# Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically. -# menu_navigation_wraparound_enable = false - -# Filter files being shown in filebrowser by supported extensions. -# menu_navigation_browser_filter_supported_extensions_enable = true - -# Collapse subgroup settings into main group to create one big listing of settings -# per category. -# menu_collapse_subgroups_enable = false - -#### Core -# -# Prevent libretro cores from closing RetroArch on exit by loading a dummy core. -# load_dummy_on_core_shutdown = "true" - -# Check for firmware requirement(s) before loading a content. -# check_firmware_before_loading = "false" - -#### User Interface - -# Start UI companion driver's interface on boot (if available). -# ui_companion_start_on_boot = true - -# Toggle companion UI on startup (currently only used to show the WIMP UI) -# ui_companion_toggle = false - -# Only init the WIMP UI for this session if this is enabled -# desktop_menu_enable = true - -#### Camera - -# Override the default camera device the camera driver uses. This is driver dependant. -# camera_device = - -# Override the default privacy permission for cores that want to access camera services. Is "false" by default. -# camera_allow = false - -#### Location - -# Override the default privacy permission for cores that want to access location services. Is "false" by default. -# location_allow = false - -#### Core Updater - -# URL to core update directory on buildbot. -# core_updater_buildbot_url = "http://buildbot.libretro.com" - -# URL to assets update directory on buildbot. -# core_updater_buildbot_assets_url = "http://buildbot.libretro.com/assets/" - -# After downloading, automatically extract archives that the downloads are contained inside. -# core_updater_auto_extract_archive = true - -#### Network - -# When being client over netplay, use keybinds for user 1. -# netplay_client_swap_input = false - -# The username of the person running RetroArch. This will be used for playing online, for instance. -# netplay_nickname = - -# The amount of delay frames to use for netplay. Increasing this value will increase -# performance, but introduce more latency. -# netplay_delay_frames = 0 - -# Netplay mode for the current user. -# false is Server, true is Client. -# netplay_mode = false - -# Enable or disable spectator mode for the user during netplay. -# netplay_spectator_mode_enable = false - -# The IP Address of the host to connect to. -# netplay_ip_address = - -# The port of the host IP Address. Can be either a TCP or UDP port. -# netplay_ip_port = 55435 - -# Force game hosting to go through a man-in-the-middle server to get around firewalls and NAT/UPnP problems. -# netplay_use_mitm_server = false - -# The requested MITM server to use. -# netplay_mitm_server = "nyc" - -#### Directory - -# Sets the System/BIOS directory. -# Implementations can query for this directory to load BIOSes, system-specific configs, etc. -# system_directory = - -# Save all downloaded files to this directory. -# core_assets_directory = - -# Assets directory. This location is queried by default when menu interfaces try to look for -# loadable assets, etc. -# assets_directory = - -# Dynamic wallpapers directory. The place to store the wallpapers dynamically -# loaded by the menu depending on context. -# dynamic_wallpapers_directory = - -# Thumbnails directory. To store thumbnail files. -# thumbnails_directory = - -# File browser directory. Sets start directory for menu file browser. -# rgui_browser_directory = - -# Core directory for libretro core implementations. -# libretro_directory = - -# Core info directory for libretro core information. -# libretro_info_path = - -# Path to content database directory. -# content_database_path = - -# Saved queries are stored to this directory. -# cursor_directory = - -# Path to cheat database directory. -# cheat_database_path = - -# Defines a directory where CPU-based video filters are kept. -# video_filter_dir = - -# Directory where DSP plugins are kept. -# audio_filter_dir = - -# Defines a directory where shaders (Cg, CGP, GLSL) are kept for easy access. -# video_shader_dir = - -# Recording output directory. Where recordings are saved. -# recording_output_directory = - -# Recording config directory. Where recording settings are kept. -# recording_config_directory = - -# Overlay directory. Where overlays are kept for easy access. -# overlay_directory = - -# Directory to dump screenshots to. -# screenshot_directory = - -# Directory for joypad autoconfigs. -# If a joypad is plugged in, that joypad will be autoconfigured if a config file -# corresponding to that joypad is present in joypad_autoconfig_dir. -# Input binds which are made explicit (input_playerN_*_btn/axis) will take priority over autoconfigs. -# Autoconfigs can be created with retroarch-joyconfig, manually, or with a frontend. -# Requires input_autodetect_enable to be enabled. -# joypad_autoconfig_dir = - -# Save all remapped controls to this directory. -# input_remapping_directory = - -# Save all playlists/collections to this directory. -# playlist_directory = - -# Save all save files (*.srm) to this directory. This includes related files like .bsv, .rtc, .psrm, etc ... -# This will be overridden by explicit command line options. -# savefile_directory = - -# Save all save states (*.state) to this directory. -# This will be overridden by explicit command line options. -# savestate_directory = - -# If set to a directory, content which is temporarily extracted -# will be extracted to this directory. -# cache_directory = - -#### Misc - -# Enable rewinding. This will take a performance hit when playing, so it is disabled by default. -# rewind_enable = false - -# Rewinding buffer size in megabytes. Bigger rewinding buffer means you can rewind longer. -# The buffer should be approx. 20MB per minute of buffer time. -# rewind_buffer_size = 20 - -# Rewind granularity. When rewinding defined number of frames, you can rewind several frames at a time, increasing the rewinding speed. -# rewind_granularity = 1 - -# Pause gameplay when window focus is lost. -# pause_nonactive = true - -# Autosaves the non-volatile SRAM at a regular interval. This is disabled by default unless set otherwise. -# The interval is measured in seconds. A value of 0 disables autosave. -# autosave_interval = - -# Records video after CPU video filter. -# video_post_filter_record = false - -# Records output of GPU shaded material if available. -# video_gpu_record = false - -# Screenshots output of GPU shaded material if available. -# video_gpu_screenshot = true - -# Watch content shader files for changes and auto-apply as necessary. -# video_shader_watch_files = false - -# Block SRAM from being overwritten when loading save states. -# Might potentially lead to buggy games. -# block_sram_overwrite = false - -# When saving a savestate, save state index is automatically increased before -# it is saved. -# Also, when loading content, the index will be set to the highest existing index. -# There is no upper bound on the index. -# savestate_auto_index = false - -# Slowmotion ratio. When slowmotion, content will slow down by factor. -# slowmotion_ratio = 3.0 - -# The maximum rate at which content will be run when using fast forward. (E.g. 5.0 for 60 fps content => 300 fps cap). -# RetroArch will go to sleep to ensure that the maximum rate will not be exceeded. -# Do not rely on this cap to be perfectly accurate. -# If this is set at 0, then fastforward ratio is unlimited (no FPS cap) -# fastforward_ratio = 0.0 - -# Enable stdin/network command interface. -# network_cmd_enable = false -# network_cmd_port = 55355 -# stdin_cmd_enable = false - -# Enable Sustained Performance Mode in Android 7.0+ -# sustained_performance_mode = true +all_users_control_menu = "false" +apply_cheats_after_load = "false" +apply_cheats_after_toggle = "false" +aspect_ratio_index = "22" +assets_directory = ":\assets" +audio_block_frames = "0" +audio_device = "" +audio_driver = "xaudio" +audio_dsp_plugin = "" +audio_enable = "true" +audio_enable_menu = "false" +audio_filter_dir = ":\filters\audio" +audio_latency = "64" +audio_max_timing_skew = "0.050000" +audio_mixer_mute_enable = "false" +audio_mixer_volume = "0.000000" +audio_mute_enable = "false" +audio_out_rate = "48000" +audio_rate_control = "true" +audio_rate_control_delta = "0.005000" +audio_resampler = "sinc" +audio_resampler_quality = "3" +audio_sync = "true" +audio_volume = "0.000000" +audio_wasapi_exclusive_mode = "true" +audio_wasapi_float_format = "false" +audio_wasapi_sh_buffer_length = "-16" +auto_overrides_enable = "true" +auto_remaps_enable = "true" +auto_screenshot_filename = "true" +auto_shaders_enable = "true" +automatically_add_content_to_playlist = "false" +autosave_interval = "0" +block_sram_overwrite = "false" +builtin_imageviewer_enable = "true" +builtin_mediaplayer_enable = "true" +bundle_assets_dst_path = "" +bundle_assets_dst_path_subdir = "" +bundle_assets_extract_enable = "false" +bundle_assets_extract_last_version = "0" +bundle_assets_extract_version_current = "0" +bundle_assets_src_path = "" +cache_directory = "" +camera_allow = "false" +camera_device = "" +camera_driver = "null" +cheat_database_path = ":\cheats" +check_firmware_before_loading = "false" +cheevos_auto_screenshot = "false" +cheevos_badges_enable = "false" +cheevos_enable = "false" +cheevos_hardcore_mode_enable = "false" +cheevos_leaderboards_enable = "false" +cheevos_password = "" +cheevos_test_unofficial = "false" +cheevos_token = "" +cheevos_username = "" +cheevos_verbose_enable = "false" +config_save_on_exit = "true" +content_database_path = ":\database\rdb" +content_favorites_path = ":\content_favorites.lpl" +content_history_dir = "" +content_history_path = ":\content_history.lpl" +content_history_size = "100" +content_image_history_path = ":\content_image_history.lpl" +content_music_history_path = ":\content_music_history.lpl" +content_show_add = "true" +content_show_favorites = "true" +content_show_history = "true" +content_show_images = "true" +content_show_music = "true" +content_show_netplay = "true" +content_show_playlists = "true" +content_show_settings = "true" +content_show_settings_password = "" +content_show_video = "true" +content_video_history_path = ":\content_video_history.lpl" +core_assets_directory = ":\downloads" +core_options_path = "" +core_set_supports_no_game_enable = "true" +core_updater_auto_extract_archive = "true" +core_updater_buildbot_assets_url = "http://buildbot.libretro.com/assets/" +core_updater_buildbot_url = "http://buildbot.libretro.com/nightly/windows/x86_64/latest/" +crt_switch_center_adjust = "0" +crt_switch_resolution = "0" +crt_switch_resolution_super = "2560" +crt_switch_resolution_use_custom_refresh_rate = "false" +crt_video_refresh_rate = "59.940060" +current_resolution_id = "0" +cursor_directory = ":\database\cursors" +custom_viewport_height = "432" +custom_viewport_width = "480" +custom_viewport_x = "0" +custom_viewport_y = "0" +desktop_menu_enable = "true" +discord_allow = "false" +dpi_override_enable = "false" +dpi_override_value = "200" +dynamic_wallpapers_directory = ":\assets\wallpapers" +fastforward_ratio = "0.000000" +filter_by_current_core = "false" +flicker_filter_enable = "false" +flicker_filter_index = "0" +fps_show = "false" +framecount_show = "true" +game_specific_options = "true" +gamma_correction = "false" +history_list_enable = "true" +input_audio_mute = "f9" +input_audio_mute_axis = "nul" +input_audio_mute_btn = "nul" +input_audio_mute_mbtn = "nul" +input_autodetect_enable = "true" +input_axis_threshold = "0.500000" +input_bind_hold = "2" +input_bind_timeout = "5" +input_cheat_index_minus = "t" +input_cheat_index_minus_axis = "nul" +input_cheat_index_minus_btn = "nul" +input_cheat_index_minus_mbtn = "nul" +input_cheat_index_plus = "y" +input_cheat_index_plus_axis = "nul" +input_cheat_index_plus_btn = "nul" +input_cheat_index_plus_mbtn = "nul" +input_cheat_toggle = "u" +input_cheat_toggle_axis = "nul" +input_cheat_toggle_btn = "nul" +input_cheat_toggle_mbtn = "nul" +input_descriptor_hide_unbound = "false" +input_descriptor_label_show = "true" +input_desktop_menu_toggle = "f5" +input_desktop_menu_toggle_axis = "nul" +input_desktop_menu_toggle_btn = "nul" +input_desktop_menu_toggle_mbtn = "nul" +input_device_p1 = "0" +input_device_p10 = "0" +input_device_p11 = "0" +input_device_p12 = "0" +input_device_p13 = "0" +input_device_p14 = "0" +input_device_p15 = "0" +input_device_p16 = "0" +input_device_p2 = "0" +input_device_p3 = "0" +input_device_p4 = "0" +input_device_p5 = "0" +input_device_p6 = "0" +input_device_p7 = "0" +input_device_p8 = "0" +input_device_p9 = "0" +input_disk_eject_toggle = "nul" +input_disk_eject_toggle_axis = "nul" +input_disk_eject_toggle_btn = "nul" +input_disk_eject_toggle_mbtn = "nul" +input_disk_next = "nul" +input_disk_next_axis = "nul" +input_disk_next_btn = "nul" +input_disk_next_mbtn = "nul" +input_disk_prev = "nul" +input_disk_prev_axis = "nul" +input_disk_prev_btn = "nul" +input_disk_prev_mbtn = "nul" +input_driver = "dinput" +input_duty_cycle = "3" +input_enable_hotkey = "nul" +input_enable_hotkey_axis = "nul" +input_enable_hotkey_btn = "nul" +input_enable_hotkey_mbtn = "nul" +input_exit_emulator = "escape" +input_exit_emulator_axis = "nul" +input_exit_emulator_btn = "nul" +input_exit_emulator_mbtn = "nul" +input_frame_advance = "k" +input_frame_advance_axis = "nul" +input_frame_advance_btn = "nul" +input_frame_advance_mbtn = "nul" +input_game_focus_toggle = "scroll_lock" +input_game_focus_toggle_axis = "nul" +input_game_focus_toggle_btn = "nul" +input_game_focus_toggle_mbtn = "nul" +input_grab_mouse_toggle = "f11" +input_grab_mouse_toggle_axis = "nul" +input_grab_mouse_toggle_btn = "nul" +input_grab_mouse_toggle_mbtn = "nul" +input_hold_fast_forward = "l" +input_hold_fast_forward_axis = "nul" +input_hold_fast_forward_btn = "nul" +input_hold_fast_forward_mbtn = "nul" +input_hold_slowmotion = "e" +input_hold_slowmotion_axis = "nul" +input_hold_slowmotion_btn = "nul" +input_hold_slowmotion_mbtn = "nul" +input_joypad_driver = "xinput" +input_keyboard_layout = "" +input_libretro_device_p1 = "1" +input_libretro_device_p10 = "1" +input_libretro_device_p11 = "1" +input_libretro_device_p12 = "1" +input_libretro_device_p13 = "1" +input_libretro_device_p14 = "1" +input_libretro_device_p15 = "1" +input_libretro_device_p16 = "1" +input_libretro_device_p2 = "1" +input_libretro_device_p3 = "1" +input_libretro_device_p4 = "1" +input_libretro_device_p5 = "1" +input_libretro_device_p6 = "1" +input_libretro_device_p7 = "1" +input_libretro_device_p8 = "1" +input_libretro_device_p9 = "1" +input_load_state = "f4" +input_load_state_axis = "nul" +input_load_state_btn = "nul" +input_load_state_mbtn = "nul" +input_max_users = "5" +input_menu_toggle = "f1" +input_menu_toggle_axis = "nul" +input_menu_toggle_btn = "nul" +input_menu_toggle_gamepad_combo = "0" +input_menu_toggle_mbtn = "nul" +input_movie_record_toggle = "o" +input_movie_record_toggle_axis = "nul" +input_movie_record_toggle_btn = "nul" +input_movie_record_toggle_mbtn = "nul" +input_netplay_game_watch = "i" +input_netplay_game_watch_axis = "nul" +input_netplay_game_watch_btn = "nul" +input_netplay_game_watch_mbtn = "nul" +input_osk_toggle = "f12" +input_osk_toggle_axis = "nul" +input_osk_toggle_btn = "nul" +input_osk_toggle_mbtn = "nul" +input_overlay = "" +input_overlay_enable = "true" +input_overlay_enable_autopreferred = "true" +input_overlay_hide_in_menu = "true" +input_overlay_next = "nul" +input_overlay_next_axis = "nul" +input_overlay_next_btn = "nul" +input_overlay_next_mbtn = "nul" +input_overlay_opacity = "0.700000" +input_overlay_scale = "1.000000" +input_overlay_show_physical_inputs = "false" +input_overlay_show_physical_inputs_port = "0" +input_pause_toggle = "p" +input_pause_toggle_axis = "nul" +input_pause_toggle_btn = "nul" +input_pause_toggle_mbtn = "nul" +input_player10_a = "nul" +input_player10_a_axis = "nul" +input_player10_a_btn = "nul" +input_player10_a_mbtn = "nul" +input_player10_analog_dpad_mode = "0" +input_player10_b = "nul" +input_player10_b_axis = "nul" +input_player10_b_btn = "nul" +input_player10_b_mbtn = "nul" +input_player10_down = "nul" +input_player10_down_axis = "nul" +input_player10_down_btn = "nul" +input_player10_down_mbtn = "nul" +input_player10_gun_aux_a = "nul" +input_player10_gun_aux_a_axis = "nul" +input_player10_gun_aux_a_btn = "nul" +input_player10_gun_aux_a_mbtn = "nul" +input_player10_gun_aux_b = "nul" +input_player10_gun_aux_b_axis = "nul" +input_player10_gun_aux_b_btn = "nul" +input_player10_gun_aux_b_mbtn = "nul" +input_player10_gun_aux_c = "nul" +input_player10_gun_aux_c_axis = "nul" +input_player10_gun_aux_c_btn = "nul" +input_player10_gun_aux_c_mbtn = "nul" +input_player10_gun_dpad_down = "nul" +input_player10_gun_dpad_down_axis = "nul" +input_player10_gun_dpad_down_btn = "nul" +input_player10_gun_dpad_down_mbtn = "nul" +input_player10_gun_dpad_left = "nul" +input_player10_gun_dpad_left_axis = "nul" +input_player10_gun_dpad_left_btn = "nul" +input_player10_gun_dpad_left_mbtn = "nul" +input_player10_gun_dpad_right = "nul" +input_player10_gun_dpad_right_axis = "nul" +input_player10_gun_dpad_right_btn = "nul" +input_player10_gun_dpad_right_mbtn = "nul" +input_player10_gun_dpad_up = "nul" +input_player10_gun_dpad_up_axis = "nul" +input_player10_gun_dpad_up_btn = "nul" +input_player10_gun_dpad_up_mbtn = "nul" +input_player10_gun_offscreen_shot = "nul" +input_player10_gun_offscreen_shot_axis = "nul" +input_player10_gun_offscreen_shot_btn = "nul" +input_player10_gun_offscreen_shot_mbtn = "nul" +input_player10_gun_select = "nul" +input_player10_gun_select_axis = "nul" +input_player10_gun_select_btn = "nul" +input_player10_gun_select_mbtn = "nul" +input_player10_gun_start = "nul" +input_player10_gun_start_axis = "nul" +input_player10_gun_start_btn = "nul" +input_player10_gun_start_mbtn = "nul" +input_player10_gun_trigger = "nul" +input_player10_gun_trigger_axis = "nul" +input_player10_gun_trigger_btn = "nul" +input_player10_gun_trigger_mbtn = "nul" +input_player10_joypad_index = "9" +input_player10_l = "nul" +input_player10_l2 = "nul" +input_player10_l2_axis = "nul" +input_player10_l2_btn = "nul" +input_player10_l2_mbtn = "nul" +input_player10_l3 = "nul" +input_player10_l3_axis = "nul" +input_player10_l3_btn = "nul" +input_player10_l3_mbtn = "nul" +input_player10_l_axis = "nul" +input_player10_l_btn = "nul" +input_player10_l_mbtn = "nul" +input_player10_l_x_minus = "nul" +input_player10_l_x_minus_axis = "nul" +input_player10_l_x_minus_btn = "nul" +input_player10_l_x_minus_mbtn = "nul" +input_player10_l_x_plus = "nul" +input_player10_l_x_plus_axis = "nul" +input_player10_l_x_plus_btn = "nul" +input_player10_l_x_plus_mbtn = "nul" +input_player10_l_y_minus = "nul" +input_player10_l_y_minus_axis = "nul" +input_player10_l_y_minus_btn = "nul" +input_player10_l_y_minus_mbtn = "nul" +input_player10_l_y_plus = "nul" +input_player10_l_y_plus_axis = "nul" +input_player10_l_y_plus_btn = "nul" +input_player10_l_y_plus_mbtn = "nul" +input_player10_left = "nul" +input_player10_left_axis = "nul" +input_player10_left_btn = "nul" +input_player10_left_mbtn = "nul" +input_player10_mouse_index = "0" +input_player10_r = "nul" +input_player10_r2 = "nul" +input_player10_r2_axis = "nul" +input_player10_r2_btn = "nul" +input_player10_r2_mbtn = "nul" +input_player10_r3 = "nul" +input_player10_r3_axis = "nul" +input_player10_r3_btn = "nul" +input_player10_r3_mbtn = "nul" +input_player10_r_axis = "nul" +input_player10_r_btn = "nul" +input_player10_r_mbtn = "nul" +input_player10_r_x_minus = "nul" +input_player10_r_x_minus_axis = "nul" +input_player10_r_x_minus_btn = "nul" +input_player10_r_x_minus_mbtn = "nul" +input_player10_r_x_plus = "nul" +input_player10_r_x_plus_axis = "nul" +input_player10_r_x_plus_btn = "nul" +input_player10_r_x_plus_mbtn = "nul" +input_player10_r_y_minus = "nul" +input_player10_r_y_minus_axis = "nul" +input_player10_r_y_minus_btn = "nul" +input_player10_r_y_minus_mbtn = "nul" +input_player10_r_y_plus = "nul" +input_player10_r_y_plus_axis = "nul" +input_player10_r_y_plus_btn = "nul" +input_player10_r_y_plus_mbtn = "nul" +input_player10_right = "nul" +input_player10_right_axis = "nul" +input_player10_right_btn = "nul" +input_player10_right_mbtn = "nul" +input_player10_select = "nul" +input_player10_select_axis = "nul" +input_player10_select_btn = "nul" +input_player10_select_mbtn = "nul" +input_player10_start = "nul" +input_player10_start_axis = "nul" +input_player10_start_btn = "nul" +input_player10_start_mbtn = "nul" +input_player10_turbo = "nul" +input_player10_turbo_axis = "nul" +input_player10_turbo_btn = "nul" +input_player10_turbo_mbtn = "nul" +input_player10_up = "nul" +input_player10_up_axis = "nul" +input_player10_up_btn = "nul" +input_player10_up_mbtn = "nul" +input_player10_x = "nul" +input_player10_x_axis = "nul" +input_player10_x_btn = "nul" +input_player10_x_mbtn = "nul" +input_player10_y = "nul" +input_player10_y_axis = "nul" +input_player10_y_btn = "nul" +input_player10_y_mbtn = "nul" +input_player11_a = "nul" +input_player11_a_axis = "nul" +input_player11_a_btn = "nul" +input_player11_a_mbtn = "nul" +input_player11_analog_dpad_mode = "0" +input_player11_b = "nul" +input_player11_b_axis = "nul" +input_player11_b_btn = "nul" +input_player11_b_mbtn = "nul" +input_player11_down = "nul" +input_player11_down_axis = "nul" +input_player11_down_btn = "nul" +input_player11_down_mbtn = "nul" +input_player11_gun_aux_a = "nul" +input_player11_gun_aux_a_axis = "nul" +input_player11_gun_aux_a_btn = "nul" +input_player11_gun_aux_a_mbtn = "nul" +input_player11_gun_aux_b = "nul" +input_player11_gun_aux_b_axis = "nul" +input_player11_gun_aux_b_btn = "nul" +input_player11_gun_aux_b_mbtn = "nul" +input_player11_gun_aux_c = "nul" +input_player11_gun_aux_c_axis = "nul" +input_player11_gun_aux_c_btn = "nul" +input_player11_gun_aux_c_mbtn = "nul" +input_player11_gun_dpad_down = "nul" +input_player11_gun_dpad_down_axis = "nul" +input_player11_gun_dpad_down_btn = "nul" +input_player11_gun_dpad_down_mbtn = "nul" +input_player11_gun_dpad_left = "nul" +input_player11_gun_dpad_left_axis = "nul" +input_player11_gun_dpad_left_btn = "nul" +input_player11_gun_dpad_left_mbtn = "nul" +input_player11_gun_dpad_right = "nul" +input_player11_gun_dpad_right_axis = "nul" +input_player11_gun_dpad_right_btn = "nul" +input_player11_gun_dpad_right_mbtn = "nul" +input_player11_gun_dpad_up = "nul" +input_player11_gun_dpad_up_axis = "nul" +input_player11_gun_dpad_up_btn = "nul" +input_player11_gun_dpad_up_mbtn = "nul" +input_player11_gun_offscreen_shot = "nul" +input_player11_gun_offscreen_shot_axis = "nul" +input_player11_gun_offscreen_shot_btn = "nul" +input_player11_gun_offscreen_shot_mbtn = "nul" +input_player11_gun_select = "nul" +input_player11_gun_select_axis = "nul" +input_player11_gun_select_btn = "nul" +input_player11_gun_select_mbtn = "nul" +input_player11_gun_start = "nul" +input_player11_gun_start_axis = "nul" +input_player11_gun_start_btn = "nul" +input_player11_gun_start_mbtn = "nul" +input_player11_gun_trigger = "nul" +input_player11_gun_trigger_axis = "nul" +input_player11_gun_trigger_btn = "nul" +input_player11_gun_trigger_mbtn = "nul" +input_player11_joypad_index = "10" +input_player11_l = "nul" +input_player11_l2 = "nul" +input_player11_l2_axis = "nul" +input_player11_l2_btn = "nul" +input_player11_l2_mbtn = "nul" +input_player11_l3 = "nul" +input_player11_l3_axis = "nul" +input_player11_l3_btn = "nul" +input_player11_l3_mbtn = "nul" +input_player11_l_axis = "nul" +input_player11_l_btn = "nul" +input_player11_l_mbtn = "nul" +input_player11_l_x_minus = "nul" +input_player11_l_x_minus_axis = "nul" +input_player11_l_x_minus_btn = "nul" +input_player11_l_x_minus_mbtn = "nul" +input_player11_l_x_plus = "nul" +input_player11_l_x_plus_axis = "nul" +input_player11_l_x_plus_btn = "nul" +input_player11_l_x_plus_mbtn = "nul" +input_player11_l_y_minus = "nul" +input_player11_l_y_minus_axis = "nul" +input_player11_l_y_minus_btn = "nul" +input_player11_l_y_minus_mbtn = "nul" +input_player11_l_y_plus = "nul" +input_player11_l_y_plus_axis = "nul" +input_player11_l_y_plus_btn = "nul" +input_player11_l_y_plus_mbtn = "nul" +input_player11_left = "nul" +input_player11_left_axis = "nul" +input_player11_left_btn = "nul" +input_player11_left_mbtn = "nul" +input_player11_mouse_index = "0" +input_player11_r = "nul" +input_player11_r2 = "nul" +input_player11_r2_axis = "nul" +input_player11_r2_btn = "nul" +input_player11_r2_mbtn = "nul" +input_player11_r3 = "nul" +input_player11_r3_axis = "nul" +input_player11_r3_btn = "nul" +input_player11_r3_mbtn = "nul" +input_player11_r_axis = "nul" +input_player11_r_btn = "nul" +input_player11_r_mbtn = "nul" +input_player11_r_x_minus = "nul" +input_player11_r_x_minus_axis = "nul" +input_player11_r_x_minus_btn = "nul" +input_player11_r_x_minus_mbtn = "nul" +input_player11_r_x_plus = "nul" +input_player11_r_x_plus_axis = "nul" +input_player11_r_x_plus_btn = "nul" +input_player11_r_x_plus_mbtn = "nul" +input_player11_r_y_minus = "nul" +input_player11_r_y_minus_axis = "nul" +input_player11_r_y_minus_btn = "nul" +input_player11_r_y_minus_mbtn = "nul" +input_player11_r_y_plus = "nul" +input_player11_r_y_plus_axis = "nul" +input_player11_r_y_plus_btn = "nul" +input_player11_r_y_plus_mbtn = "nul" +input_player11_right = "nul" +input_player11_right_axis = "nul" +input_player11_right_btn = "nul" +input_player11_right_mbtn = "nul" +input_player11_select = "nul" +input_player11_select_axis = "nul" +input_player11_select_btn = "nul" +input_player11_select_mbtn = "nul" +input_player11_start = "nul" +input_player11_start_axis = "nul" +input_player11_start_btn = "nul" +input_player11_start_mbtn = "nul" +input_player11_turbo = "nul" +input_player11_turbo_axis = "nul" +input_player11_turbo_btn = "nul" +input_player11_turbo_mbtn = "nul" +input_player11_up = "nul" +input_player11_up_axis = "nul" +input_player11_up_btn = "nul" +input_player11_up_mbtn = "nul" +input_player11_x = "nul" +input_player11_x_axis = "nul" +input_player11_x_btn = "nul" +input_player11_x_mbtn = "nul" +input_player11_y = "nul" +input_player11_y_axis = "nul" +input_player11_y_btn = "nul" +input_player11_y_mbtn = "nul" +input_player12_a = "nul" +input_player12_a_axis = "nul" +input_player12_a_btn = "nul" +input_player12_a_mbtn = "nul" +input_player12_analog_dpad_mode = "0" +input_player12_b = "nul" +input_player12_b_axis = "nul" +input_player12_b_btn = "nul" +input_player12_b_mbtn = "nul" +input_player12_down = "nul" +input_player12_down_axis = "nul" +input_player12_down_btn = "nul" +input_player12_down_mbtn = "nul" +input_player12_gun_aux_a = "nul" +input_player12_gun_aux_a_axis = "nul" +input_player12_gun_aux_a_btn = "nul" +input_player12_gun_aux_a_mbtn = "nul" +input_player12_gun_aux_b = "nul" +input_player12_gun_aux_b_axis = "nul" +input_player12_gun_aux_b_btn = "nul" +input_player12_gun_aux_b_mbtn = "nul" +input_player12_gun_aux_c = "nul" +input_player12_gun_aux_c_axis = "nul" +input_player12_gun_aux_c_btn = "nul" +input_player12_gun_aux_c_mbtn = "nul" +input_player12_gun_dpad_down = "nul" +input_player12_gun_dpad_down_axis = "nul" +input_player12_gun_dpad_down_btn = "nul" +input_player12_gun_dpad_down_mbtn = "nul" +input_player12_gun_dpad_left = "nul" +input_player12_gun_dpad_left_axis = "nul" +input_player12_gun_dpad_left_btn = "nul" +input_player12_gun_dpad_left_mbtn = "nul" +input_player12_gun_dpad_right = "nul" +input_player12_gun_dpad_right_axis = "nul" +input_player12_gun_dpad_right_btn = "nul" +input_player12_gun_dpad_right_mbtn = "nul" +input_player12_gun_dpad_up = "nul" +input_player12_gun_dpad_up_axis = "nul" +input_player12_gun_dpad_up_btn = "nul" +input_player12_gun_dpad_up_mbtn = "nul" +input_player12_gun_offscreen_shot = "nul" +input_player12_gun_offscreen_shot_axis = "nul" +input_player12_gun_offscreen_shot_btn = "nul" +input_player12_gun_offscreen_shot_mbtn = "nul" +input_player12_gun_select = "nul" +input_player12_gun_select_axis = "nul" +input_player12_gun_select_btn = "nul" +input_player12_gun_select_mbtn = "nul" +input_player12_gun_start = "nul" +input_player12_gun_start_axis = "nul" +input_player12_gun_start_btn = "nul" +input_player12_gun_start_mbtn = "nul" +input_player12_gun_trigger = "nul" +input_player12_gun_trigger_axis = "nul" +input_player12_gun_trigger_btn = "nul" +input_player12_gun_trigger_mbtn = "nul" +input_player12_joypad_index = "11" +input_player12_l = "nul" +input_player12_l2 = "nul" +input_player12_l2_axis = "nul" +input_player12_l2_btn = "nul" +input_player12_l2_mbtn = "nul" +input_player12_l3 = "nul" +input_player12_l3_axis = "nul" +input_player12_l3_btn = "nul" +input_player12_l3_mbtn = "nul" +input_player12_l_axis = "nul" +input_player12_l_btn = "nul" +input_player12_l_mbtn = "nul" +input_player12_l_x_minus = "nul" +input_player12_l_x_minus_axis = "nul" +input_player12_l_x_minus_btn = "nul" +input_player12_l_x_minus_mbtn = "nul" +input_player12_l_x_plus = "nul" +input_player12_l_x_plus_axis = "nul" +input_player12_l_x_plus_btn = "nul" +input_player12_l_x_plus_mbtn = "nul" +input_player12_l_y_minus = "nul" +input_player12_l_y_minus_axis = "nul" +input_player12_l_y_minus_btn = "nul" +input_player12_l_y_minus_mbtn = "nul" +input_player12_l_y_plus = "nul" +input_player12_l_y_plus_axis = "nul" +input_player12_l_y_plus_btn = "nul" +input_player12_l_y_plus_mbtn = "nul" +input_player12_left = "nul" +input_player12_left_axis = "nul" +input_player12_left_btn = "nul" +input_player12_left_mbtn = "nul" +input_player12_mouse_index = "0" +input_player12_r = "nul" +input_player12_r2 = "nul" +input_player12_r2_axis = "nul" +input_player12_r2_btn = "nul" +input_player12_r2_mbtn = "nul" +input_player12_r3 = "nul" +input_player12_r3_axis = "nul" +input_player12_r3_btn = "nul" +input_player12_r3_mbtn = "nul" +input_player12_r_axis = "nul" +input_player12_r_btn = "nul" +input_player12_r_mbtn = "nul" +input_player12_r_x_minus = "nul" +input_player12_r_x_minus_axis = "nul" +input_player12_r_x_minus_btn = "nul" +input_player12_r_x_minus_mbtn = "nul" +input_player12_r_x_plus = "nul" +input_player12_r_x_plus_axis = "nul" +input_player12_r_x_plus_btn = "nul" +input_player12_r_x_plus_mbtn = "nul" +input_player12_r_y_minus = "nul" +input_player12_r_y_minus_axis = "nul" +input_player12_r_y_minus_btn = "nul" +input_player12_r_y_minus_mbtn = "nul" +input_player12_r_y_plus = "nul" +input_player12_r_y_plus_axis = "nul" +input_player12_r_y_plus_btn = "nul" +input_player12_r_y_plus_mbtn = "nul" +input_player12_right = "nul" +input_player12_right_axis = "nul" +input_player12_right_btn = "nul" +input_player12_right_mbtn = "nul" +input_player12_select = "nul" +input_player12_select_axis = "nul" +input_player12_select_btn = "nul" +input_player12_select_mbtn = "nul" +input_player12_start = "nul" +input_player12_start_axis = "nul" +input_player12_start_btn = "nul" +input_player12_start_mbtn = "nul" +input_player12_turbo = "nul" +input_player12_turbo_axis = "nul" +input_player12_turbo_btn = "nul" +input_player12_turbo_mbtn = "nul" +input_player12_up = "nul" +input_player12_up_axis = "nul" +input_player12_up_btn = "nul" +input_player12_up_mbtn = "nul" +input_player12_x = "nul" +input_player12_x_axis = "nul" +input_player12_x_btn = "nul" +input_player12_x_mbtn = "nul" +input_player12_y = "nul" +input_player12_y_axis = "nul" +input_player12_y_btn = "nul" +input_player12_y_mbtn = "nul" +input_player13_a = "nul" +input_player13_a_axis = "nul" +input_player13_a_btn = "nul" +input_player13_a_mbtn = "nul" +input_player13_analog_dpad_mode = "0" +input_player13_b = "nul" +input_player13_b_axis = "nul" +input_player13_b_btn = "nul" +input_player13_b_mbtn = "nul" +input_player13_down = "nul" +input_player13_down_axis = "nul" +input_player13_down_btn = "nul" +input_player13_down_mbtn = "nul" +input_player13_gun_aux_a = "nul" +input_player13_gun_aux_a_axis = "nul" +input_player13_gun_aux_a_btn = "nul" +input_player13_gun_aux_a_mbtn = "nul" +input_player13_gun_aux_b = "nul" +input_player13_gun_aux_b_axis = "nul" +input_player13_gun_aux_b_btn = "nul" +input_player13_gun_aux_b_mbtn = "nul" +input_player13_gun_aux_c = "nul" +input_player13_gun_aux_c_axis = "nul" +input_player13_gun_aux_c_btn = "nul" +input_player13_gun_aux_c_mbtn = "nul" +input_player13_gun_dpad_down = "nul" +input_player13_gun_dpad_down_axis = "nul" +input_player13_gun_dpad_down_btn = "nul" +input_player13_gun_dpad_down_mbtn = "nul" +input_player13_gun_dpad_left = "nul" +input_player13_gun_dpad_left_axis = "nul" +input_player13_gun_dpad_left_btn = "nul" +input_player13_gun_dpad_left_mbtn = "nul" +input_player13_gun_dpad_right = "nul" +input_player13_gun_dpad_right_axis = "nul" +input_player13_gun_dpad_right_btn = "nul" +input_player13_gun_dpad_right_mbtn = "nul" +input_player13_gun_dpad_up = "nul" +input_player13_gun_dpad_up_axis = "nul" +input_player13_gun_dpad_up_btn = "nul" +input_player13_gun_dpad_up_mbtn = "nul" +input_player13_gun_offscreen_shot = "nul" +input_player13_gun_offscreen_shot_axis = "nul" +input_player13_gun_offscreen_shot_btn = "nul" +input_player13_gun_offscreen_shot_mbtn = "nul" +input_player13_gun_select = "nul" +input_player13_gun_select_axis = "nul" +input_player13_gun_select_btn = "nul" +input_player13_gun_select_mbtn = "nul" +input_player13_gun_start = "nul" +input_player13_gun_start_axis = "nul" +input_player13_gun_start_btn = "nul" +input_player13_gun_start_mbtn = "nul" +input_player13_gun_trigger = "nul" +input_player13_gun_trigger_axis = "nul" +input_player13_gun_trigger_btn = "nul" +input_player13_gun_trigger_mbtn = "nul" +input_player13_joypad_index = "12" +input_player13_l = "nul" +input_player13_l2 = "nul" +input_player13_l2_axis = "nul" +input_player13_l2_btn = "nul" +input_player13_l2_mbtn = "nul" +input_player13_l3 = "nul" +input_player13_l3_axis = "nul" +input_player13_l3_btn = "nul" +input_player13_l3_mbtn = "nul" +input_player13_l_axis = "nul" +input_player13_l_btn = "nul" +input_player13_l_mbtn = "nul" +input_player13_l_x_minus = "nul" +input_player13_l_x_minus_axis = "nul" +input_player13_l_x_minus_btn = "nul" +input_player13_l_x_minus_mbtn = "nul" +input_player13_l_x_plus = "nul" +input_player13_l_x_plus_axis = "nul" +input_player13_l_x_plus_btn = "nul" +input_player13_l_x_plus_mbtn = "nul" +input_player13_l_y_minus = "nul" +input_player13_l_y_minus_axis = "nul" +input_player13_l_y_minus_btn = "nul" +input_player13_l_y_minus_mbtn = "nul" +input_player13_l_y_plus = "nul" +input_player13_l_y_plus_axis = "nul" +input_player13_l_y_plus_btn = "nul" +input_player13_l_y_plus_mbtn = "nul" +input_player13_left = "nul" +input_player13_left_axis = "nul" +input_player13_left_btn = "nul" +input_player13_left_mbtn = "nul" +input_player13_mouse_index = "0" +input_player13_r = "nul" +input_player13_r2 = "nul" +input_player13_r2_axis = "nul" +input_player13_r2_btn = "nul" +input_player13_r2_mbtn = "nul" +input_player13_r3 = "nul" +input_player13_r3_axis = "nul" +input_player13_r3_btn = "nul" +input_player13_r3_mbtn = "nul" +input_player13_r_axis = "nul" +input_player13_r_btn = "nul" +input_player13_r_mbtn = "nul" +input_player13_r_x_minus = "nul" +input_player13_r_x_minus_axis = "nul" +input_player13_r_x_minus_btn = "nul" +input_player13_r_x_minus_mbtn = "nul" +input_player13_r_x_plus = "nul" +input_player13_r_x_plus_axis = "nul" +input_player13_r_x_plus_btn = "nul" +input_player13_r_x_plus_mbtn = "nul" +input_player13_r_y_minus = "nul" +input_player13_r_y_minus_axis = "nul" +input_player13_r_y_minus_btn = "nul" +input_player13_r_y_minus_mbtn = "nul" +input_player13_r_y_plus = "nul" +input_player13_r_y_plus_axis = "nul" +input_player13_r_y_plus_btn = "nul" +input_player13_r_y_plus_mbtn = "nul" +input_player13_right = "nul" +input_player13_right_axis = "nul" +input_player13_right_btn = "nul" +input_player13_right_mbtn = "nul" +input_player13_select = "nul" +input_player13_select_axis = "nul" +input_player13_select_btn = "nul" +input_player13_select_mbtn = "nul" +input_player13_start = "nul" +input_player13_start_axis = "nul" +input_player13_start_btn = "nul" +input_player13_start_mbtn = "nul" +input_player13_turbo = "nul" +input_player13_turbo_axis = "nul" +input_player13_turbo_btn = "nul" +input_player13_turbo_mbtn = "nul" +input_player13_up = "nul" +input_player13_up_axis = "nul" +input_player13_up_btn = "nul" +input_player13_up_mbtn = "nul" +input_player13_x = "nul" +input_player13_x_axis = "nul" +input_player13_x_btn = "nul" +input_player13_x_mbtn = "nul" +input_player13_y = "nul" +input_player13_y_axis = "nul" +input_player13_y_btn = "nul" +input_player13_y_mbtn = "nul" +input_player14_a = "nul" +input_player14_a_axis = "nul" +input_player14_a_btn = "nul" +input_player14_a_mbtn = "nul" +input_player14_analog_dpad_mode = "0" +input_player14_b = "nul" +input_player14_b_axis = "nul" +input_player14_b_btn = "nul" +input_player14_b_mbtn = "nul" +input_player14_down = "nul" +input_player14_down_axis = "nul" +input_player14_down_btn = "nul" +input_player14_down_mbtn = "nul" +input_player14_gun_aux_a = "nul" +input_player14_gun_aux_a_axis = "nul" +input_player14_gun_aux_a_btn = "nul" +input_player14_gun_aux_a_mbtn = "nul" +input_player14_gun_aux_b = "nul" +input_player14_gun_aux_b_axis = "nul" +input_player14_gun_aux_b_btn = "nul" +input_player14_gun_aux_b_mbtn = "nul" +input_player14_gun_aux_c = "nul" +input_player14_gun_aux_c_axis = "nul" +input_player14_gun_aux_c_btn = "nul" +input_player14_gun_aux_c_mbtn = "nul" +input_player14_gun_dpad_down = "nul" +input_player14_gun_dpad_down_axis = "nul" +input_player14_gun_dpad_down_btn = "nul" +input_player14_gun_dpad_down_mbtn = "nul" +input_player14_gun_dpad_left = "nul" +input_player14_gun_dpad_left_axis = "nul" +input_player14_gun_dpad_left_btn = "nul" +input_player14_gun_dpad_left_mbtn = "nul" +input_player14_gun_dpad_right = "nul" +input_player14_gun_dpad_right_axis = "nul" +input_player14_gun_dpad_right_btn = "nul" +input_player14_gun_dpad_right_mbtn = "nul" +input_player14_gun_dpad_up = "nul" +input_player14_gun_dpad_up_axis = "nul" +input_player14_gun_dpad_up_btn = "nul" +input_player14_gun_dpad_up_mbtn = "nul" +input_player14_gun_offscreen_shot = "nul" +input_player14_gun_offscreen_shot_axis = "nul" +input_player14_gun_offscreen_shot_btn = "nul" +input_player14_gun_offscreen_shot_mbtn = "nul" +input_player14_gun_select = "nul" +input_player14_gun_select_axis = "nul" +input_player14_gun_select_btn = "nul" +input_player14_gun_select_mbtn = "nul" +input_player14_gun_start = "nul" +input_player14_gun_start_axis = "nul" +input_player14_gun_start_btn = "nul" +input_player14_gun_start_mbtn = "nul" +input_player14_gun_trigger = "nul" +input_player14_gun_trigger_axis = "nul" +input_player14_gun_trigger_btn = "nul" +input_player14_gun_trigger_mbtn = "nul" +input_player14_joypad_index = "13" +input_player14_l = "nul" +input_player14_l2 = "nul" +input_player14_l2_axis = "nul" +input_player14_l2_btn = "nul" +input_player14_l2_mbtn = "nul" +input_player14_l3 = "nul" +input_player14_l3_axis = "nul" +input_player14_l3_btn = "nul" +input_player14_l3_mbtn = "nul" +input_player14_l_axis = "nul" +input_player14_l_btn = "nul" +input_player14_l_mbtn = "nul" +input_player14_l_x_minus = "nul" +input_player14_l_x_minus_axis = "nul" +input_player14_l_x_minus_btn = "nul" +input_player14_l_x_minus_mbtn = "nul" +input_player14_l_x_plus = "nul" +input_player14_l_x_plus_axis = "nul" +input_player14_l_x_plus_btn = "nul" +input_player14_l_x_plus_mbtn = "nul" +input_player14_l_y_minus = "nul" +input_player14_l_y_minus_axis = "nul" +input_player14_l_y_minus_btn = "nul" +input_player14_l_y_minus_mbtn = "nul" +input_player14_l_y_plus = "nul" +input_player14_l_y_plus_axis = "nul" +input_player14_l_y_plus_btn = "nul" +input_player14_l_y_plus_mbtn = "nul" +input_player14_left = "nul" +input_player14_left_axis = "nul" +input_player14_left_btn = "nul" +input_player14_left_mbtn = "nul" +input_player14_mouse_index = "0" +input_player14_r = "nul" +input_player14_r2 = "nul" +input_player14_r2_axis = "nul" +input_player14_r2_btn = "nul" +input_player14_r2_mbtn = "nul" +input_player14_r3 = "nul" +input_player14_r3_axis = "nul" +input_player14_r3_btn = "nul" +input_player14_r3_mbtn = "nul" +input_player14_r_axis = "nul" +input_player14_r_btn = "nul" +input_player14_r_mbtn = "nul" +input_player14_r_x_minus = "nul" +input_player14_r_x_minus_axis = "nul" +input_player14_r_x_minus_btn = "nul" +input_player14_r_x_minus_mbtn = "nul" +input_player14_r_x_plus = "nul" +input_player14_r_x_plus_axis = "nul" +input_player14_r_x_plus_btn = "nul" +input_player14_r_x_plus_mbtn = "nul" +input_player14_r_y_minus = "nul" +input_player14_r_y_minus_axis = "nul" +input_player14_r_y_minus_btn = "nul" +input_player14_r_y_minus_mbtn = "nul" +input_player14_r_y_plus = "nul" +input_player14_r_y_plus_axis = "nul" +input_player14_r_y_plus_btn = "nul" +input_player14_r_y_plus_mbtn = "nul" +input_player14_right = "nul" +input_player14_right_axis = "nul" +input_player14_right_btn = "nul" +input_player14_right_mbtn = "nul" +input_player14_select = "nul" +input_player14_select_axis = "nul" +input_player14_select_btn = "nul" +input_player14_select_mbtn = "nul" +input_player14_start = "nul" +input_player14_start_axis = "nul" +input_player14_start_btn = "nul" +input_player14_start_mbtn = "nul" +input_player14_turbo = "nul" +input_player14_turbo_axis = "nul" +input_player14_turbo_btn = "nul" +input_player14_turbo_mbtn = "nul" +input_player14_up = "nul" +input_player14_up_axis = "nul" +input_player14_up_btn = "nul" +input_player14_up_mbtn = "nul" +input_player14_x = "nul" +input_player14_x_axis = "nul" +input_player14_x_btn = "nul" +input_player14_x_mbtn = "nul" +input_player14_y = "nul" +input_player14_y_axis = "nul" +input_player14_y_btn = "nul" +input_player14_y_mbtn = "nul" +input_player15_a = "nul" +input_player15_a_axis = "nul" +input_player15_a_btn = "nul" +input_player15_a_mbtn = "nul" +input_player15_analog_dpad_mode = "0" +input_player15_b = "nul" +input_player15_b_axis = "nul" +input_player15_b_btn = "nul" +input_player15_b_mbtn = "nul" +input_player15_down = "nul" +input_player15_down_axis = "nul" +input_player15_down_btn = "nul" +input_player15_down_mbtn = "nul" +input_player15_gun_aux_a = "nul" +input_player15_gun_aux_a_axis = "nul" +input_player15_gun_aux_a_btn = "nul" +input_player15_gun_aux_a_mbtn = "nul" +input_player15_gun_aux_b = "nul" +input_player15_gun_aux_b_axis = "nul" +input_player15_gun_aux_b_btn = "nul" +input_player15_gun_aux_b_mbtn = "nul" +input_player15_gun_aux_c = "nul" +input_player15_gun_aux_c_axis = "nul" +input_player15_gun_aux_c_btn = "nul" +input_player15_gun_aux_c_mbtn = "nul" +input_player15_gun_dpad_down = "nul" +input_player15_gun_dpad_down_axis = "nul" +input_player15_gun_dpad_down_btn = "nul" +input_player15_gun_dpad_down_mbtn = "nul" +input_player15_gun_dpad_left = "nul" +input_player15_gun_dpad_left_axis = "nul" +input_player15_gun_dpad_left_btn = "nul" +input_player15_gun_dpad_left_mbtn = "nul" +input_player15_gun_dpad_right = "nul" +input_player15_gun_dpad_right_axis = "nul" +input_player15_gun_dpad_right_btn = "nul" +input_player15_gun_dpad_right_mbtn = "nul" +input_player15_gun_dpad_up = "nul" +input_player15_gun_dpad_up_axis = "nul" +input_player15_gun_dpad_up_btn = "nul" +input_player15_gun_dpad_up_mbtn = "nul" +input_player15_gun_offscreen_shot = "nul" +input_player15_gun_offscreen_shot_axis = "nul" +input_player15_gun_offscreen_shot_btn = "nul" +input_player15_gun_offscreen_shot_mbtn = "nul" +input_player15_gun_select = "nul" +input_player15_gun_select_axis = "nul" +input_player15_gun_select_btn = "nul" +input_player15_gun_select_mbtn = "nul" +input_player15_gun_start = "nul" +input_player15_gun_start_axis = "nul" +input_player15_gun_start_btn = "nul" +input_player15_gun_start_mbtn = "nul" +input_player15_gun_trigger = "nul" +input_player15_gun_trigger_axis = "nul" +input_player15_gun_trigger_btn = "nul" +input_player15_gun_trigger_mbtn = "nul" +input_player15_joypad_index = "14" +input_player15_l = "nul" +input_player15_l2 = "nul" +input_player15_l2_axis = "nul" +input_player15_l2_btn = "nul" +input_player15_l2_mbtn = "nul" +input_player15_l3 = "nul" +input_player15_l3_axis = "nul" +input_player15_l3_btn = "nul" +input_player15_l3_mbtn = "nul" +input_player15_l_axis = "nul" +input_player15_l_btn = "nul" +input_player15_l_mbtn = "nul" +input_player15_l_x_minus = "nul" +input_player15_l_x_minus_axis = "nul" +input_player15_l_x_minus_btn = "nul" +input_player15_l_x_minus_mbtn = "nul" +input_player15_l_x_plus = "nul" +input_player15_l_x_plus_axis = "nul" +input_player15_l_x_plus_btn = "nul" +input_player15_l_x_plus_mbtn = "nul" +input_player15_l_y_minus = "nul" +input_player15_l_y_minus_axis = "nul" +input_player15_l_y_minus_btn = "nul" +input_player15_l_y_minus_mbtn = "nul" +input_player15_l_y_plus = "nul" +input_player15_l_y_plus_axis = "nul" +input_player15_l_y_plus_btn = "nul" +input_player15_l_y_plus_mbtn = "nul" +input_player15_left = "nul" +input_player15_left_axis = "nul" +input_player15_left_btn = "nul" +input_player15_left_mbtn = "nul" +input_player15_mouse_index = "0" +input_player15_r = "nul" +input_player15_r2 = "nul" +input_player15_r2_axis = "nul" +input_player15_r2_btn = "nul" +input_player15_r2_mbtn = "nul" +input_player15_r3 = "nul" +input_player15_r3_axis = "nul" +input_player15_r3_btn = "nul" +input_player15_r3_mbtn = "nul" +input_player15_r_axis = "nul" +input_player15_r_btn = "nul" +input_player15_r_mbtn = "nul" +input_player15_r_x_minus = "nul" +input_player15_r_x_minus_axis = "nul" +input_player15_r_x_minus_btn = "nul" +input_player15_r_x_minus_mbtn = "nul" +input_player15_r_x_plus = "nul" +input_player15_r_x_plus_axis = "nul" +input_player15_r_x_plus_btn = "nul" +input_player15_r_x_plus_mbtn = "nul" +input_player15_r_y_minus = "nul" +input_player15_r_y_minus_axis = "nul" +input_player15_r_y_minus_btn = "nul" +input_player15_r_y_minus_mbtn = "nul" +input_player15_r_y_plus = "nul" +input_player15_r_y_plus_axis = "nul" +input_player15_r_y_plus_btn = "nul" +input_player15_r_y_plus_mbtn = "nul" +input_player15_right = "nul" +input_player15_right_axis = "nul" +input_player15_right_btn = "nul" +input_player15_right_mbtn = "nul" +input_player15_select = "nul" +input_player15_select_axis = "nul" +input_player15_select_btn = "nul" +input_player15_select_mbtn = "nul" +input_player15_start = "nul" +input_player15_start_axis = "nul" +input_player15_start_btn = "nul" +input_player15_start_mbtn = "nul" +input_player15_turbo = "nul" +input_player15_turbo_axis = "nul" +input_player15_turbo_btn = "nul" +input_player15_turbo_mbtn = "nul" +input_player15_up = "nul" +input_player15_up_axis = "nul" +input_player15_up_btn = "nul" +input_player15_up_mbtn = "nul" +input_player15_x = "nul" +input_player15_x_axis = "nul" +input_player15_x_btn = "nul" +input_player15_x_mbtn = "nul" +input_player15_y = "nul" +input_player15_y_axis = "nul" +input_player15_y_btn = "nul" +input_player15_y_mbtn = "nul" +input_player16_a = "nul" +input_player16_a_axis = "nul" +input_player16_a_btn = "nul" +input_player16_a_mbtn = "nul" +input_player16_analog_dpad_mode = "0" +input_player16_b = "nul" +input_player16_b_axis = "nul" +input_player16_b_btn = "nul" +input_player16_b_mbtn = "nul" +input_player16_down = "nul" +input_player16_down_axis = "nul" +input_player16_down_btn = "nul" +input_player16_down_mbtn = "nul" +input_player16_gun_aux_a = "nul" +input_player16_gun_aux_a_axis = "nul" +input_player16_gun_aux_a_btn = "nul" +input_player16_gun_aux_a_mbtn = "nul" +input_player16_gun_aux_b = "nul" +input_player16_gun_aux_b_axis = "nul" +input_player16_gun_aux_b_btn = "nul" +input_player16_gun_aux_b_mbtn = "nul" +input_player16_gun_aux_c = "nul" +input_player16_gun_aux_c_axis = "nul" +input_player16_gun_aux_c_btn = "nul" +input_player16_gun_aux_c_mbtn = "nul" +input_player16_gun_dpad_down = "nul" +input_player16_gun_dpad_down_axis = "nul" +input_player16_gun_dpad_down_btn = "nul" +input_player16_gun_dpad_down_mbtn = "nul" +input_player16_gun_dpad_left = "nul" +input_player16_gun_dpad_left_axis = "nul" +input_player16_gun_dpad_left_btn = "nul" +input_player16_gun_dpad_left_mbtn = "nul" +input_player16_gun_dpad_right = "nul" +input_player16_gun_dpad_right_axis = "nul" +input_player16_gun_dpad_right_btn = "nul" +input_player16_gun_dpad_right_mbtn = "nul" +input_player16_gun_dpad_up = "nul" +input_player16_gun_dpad_up_axis = "nul" +input_player16_gun_dpad_up_btn = "nul" +input_player16_gun_dpad_up_mbtn = "nul" +input_player16_gun_offscreen_shot = "nul" +input_player16_gun_offscreen_shot_axis = "nul" +input_player16_gun_offscreen_shot_btn = "nul" +input_player16_gun_offscreen_shot_mbtn = "nul" +input_player16_gun_select = "nul" +input_player16_gun_select_axis = "nul" +input_player16_gun_select_btn = "nul" +input_player16_gun_select_mbtn = "nul" +input_player16_gun_start = "nul" +input_player16_gun_start_axis = "nul" +input_player16_gun_start_btn = "nul" +input_player16_gun_start_mbtn = "nul" +input_player16_gun_trigger = "nul" +input_player16_gun_trigger_axis = "nul" +input_player16_gun_trigger_btn = "nul" +input_player16_gun_trigger_mbtn = "nul" +input_player16_joypad_index = "15" +input_player16_l = "nul" +input_player16_l2 = "nul" +input_player16_l2_axis = "nul" +input_player16_l2_btn = "nul" +input_player16_l2_mbtn = "nul" +input_player16_l3 = "nul" +input_player16_l3_axis = "nul" +input_player16_l3_btn = "nul" +input_player16_l3_mbtn = "nul" +input_player16_l_axis = "nul" +input_player16_l_btn = "nul" +input_player16_l_mbtn = "nul" +input_player16_l_x_minus = "nul" +input_player16_l_x_minus_axis = "nul" +input_player16_l_x_minus_btn = "nul" +input_player16_l_x_minus_mbtn = "nul" +input_player16_l_x_plus = "nul" +input_player16_l_x_plus_axis = "nul" +input_player16_l_x_plus_btn = "nul" +input_player16_l_x_plus_mbtn = "nul" +input_player16_l_y_minus = "nul" +input_player16_l_y_minus_axis = "nul" +input_player16_l_y_minus_btn = "nul" +input_player16_l_y_minus_mbtn = "nul" +input_player16_l_y_plus = "nul" +input_player16_l_y_plus_axis = "nul" +input_player16_l_y_plus_btn = "nul" +input_player16_l_y_plus_mbtn = "nul" +input_player16_left = "nul" +input_player16_left_axis = "nul" +input_player16_left_btn = "nul" +input_player16_left_mbtn = "nul" +input_player16_mouse_index = "0" +input_player16_r = "nul" +input_player16_r2 = "nul" +input_player16_r2_axis = "nul" +input_player16_r2_btn = "nul" +input_player16_r2_mbtn = "nul" +input_player16_r3 = "nul" +input_player16_r3_axis = "nul" +input_player16_r3_btn = "nul" +input_player16_r3_mbtn = "nul" +input_player16_r_axis = "nul" +input_player16_r_btn = "nul" +input_player16_r_mbtn = "nul" +input_player16_r_x_minus = "nul" +input_player16_r_x_minus_axis = "nul" +input_player16_r_x_minus_btn = "nul" +input_player16_r_x_minus_mbtn = "nul" +input_player16_r_x_plus = "nul" +input_player16_r_x_plus_axis = "nul" +input_player16_r_x_plus_btn = "nul" +input_player16_r_x_plus_mbtn = "nul" +input_player16_r_y_minus = "nul" +input_player16_r_y_minus_axis = "nul" +input_player16_r_y_minus_btn = "nul" +input_player16_r_y_minus_mbtn = "nul" +input_player16_r_y_plus = "nul" +input_player16_r_y_plus_axis = "nul" +input_player16_r_y_plus_btn = "nul" +input_player16_r_y_plus_mbtn = "nul" +input_player16_right = "nul" +input_player16_right_axis = "nul" +input_player16_right_btn = "nul" +input_player16_right_mbtn = "nul" +input_player16_select = "nul" +input_player16_select_axis = "nul" +input_player16_select_btn = "nul" +input_player16_select_mbtn = "nul" +input_player16_start = "nul" +input_player16_start_axis = "nul" +input_player16_start_btn = "nul" +input_player16_start_mbtn = "nul" +input_player16_turbo = "nul" +input_player16_turbo_axis = "nul" +input_player16_turbo_btn = "nul" +input_player16_turbo_mbtn = "nul" +input_player16_up = "nul" +input_player16_up_axis = "nul" +input_player16_up_btn = "nul" +input_player16_up_mbtn = "nul" +input_player16_x = "nul" +input_player16_x_axis = "nul" +input_player16_x_btn = "nul" +input_player16_x_mbtn = "nul" +input_player16_y = "nul" +input_player16_y_axis = "nul" +input_player16_y_btn = "nul" +input_player16_y_mbtn = "nul" +input_player1_a = "x" +input_player1_a_axis = "nul" +input_player1_a_btn = "nul" +input_player1_a_mbtn = "nul" +input_player1_analog_dpad_mode = "0" +input_player1_b = "z" +input_player1_b_axis = "nul" +input_player1_b_btn = "nul" +input_player1_b_mbtn = "nul" +input_player1_down = "down" +input_player1_down_axis = "nul" +input_player1_down_btn = "nul" +input_player1_down_mbtn = "nul" +input_player1_gun_aux_a = "nul" +input_player1_gun_aux_a_axis = "nul" +input_player1_gun_aux_a_btn = "nul" +input_player1_gun_aux_a_mbtn = "nul" +input_player1_gun_aux_b = "nul" +input_player1_gun_aux_b_axis = "nul" +input_player1_gun_aux_b_btn = "nul" +input_player1_gun_aux_b_mbtn = "nul" +input_player1_gun_aux_c = "nul" +input_player1_gun_aux_c_axis = "nul" +input_player1_gun_aux_c_btn = "nul" +input_player1_gun_aux_c_mbtn = "nul" +input_player1_gun_dpad_down = "nul" +input_player1_gun_dpad_down_axis = "nul" +input_player1_gun_dpad_down_btn = "nul" +input_player1_gun_dpad_down_mbtn = "nul" +input_player1_gun_dpad_left = "nul" +input_player1_gun_dpad_left_axis = "nul" +input_player1_gun_dpad_left_btn = "nul" +input_player1_gun_dpad_left_mbtn = "nul" +input_player1_gun_dpad_right = "nul" +input_player1_gun_dpad_right_axis = "nul" +input_player1_gun_dpad_right_btn = "nul" +input_player1_gun_dpad_right_mbtn = "nul" +input_player1_gun_dpad_up = "nul" +input_player1_gun_dpad_up_axis = "nul" +input_player1_gun_dpad_up_btn = "nul" +input_player1_gun_dpad_up_mbtn = "nul" +input_player1_gun_offscreen_shot = "nul" +input_player1_gun_offscreen_shot_axis = "nul" +input_player1_gun_offscreen_shot_btn = "nul" +input_player1_gun_offscreen_shot_mbtn = "nul" +input_player1_gun_select = "nul" +input_player1_gun_select_axis = "nul" +input_player1_gun_select_btn = "nul" +input_player1_gun_select_mbtn = "nul" +input_player1_gun_start = "nul" +input_player1_gun_start_axis = "nul" +input_player1_gun_start_btn = "nul" +input_player1_gun_start_mbtn = "nul" +input_player1_gun_trigger = "nul" +input_player1_gun_trigger_axis = "nul" +input_player1_gun_trigger_btn = "nul" +input_player1_gun_trigger_mbtn = "nul" +input_player1_joypad_index = "0" +input_player1_l = "q" +input_player1_l2 = "nul" +input_player1_l2_axis = "nul" +input_player1_l2_btn = "nul" +input_player1_l2_mbtn = "nul" +input_player1_l3 = "nul" +input_player1_l3_axis = "nul" +input_player1_l3_btn = "nul" +input_player1_l3_mbtn = "nul" +input_player1_l_axis = "nul" +input_player1_l_btn = "nul" +input_player1_l_mbtn = "nul" +input_player1_l_x_minus = "nul" +input_player1_l_x_minus_axis = "nul" +input_player1_l_x_minus_btn = "nul" +input_player1_l_x_minus_mbtn = "nul" +input_player1_l_x_plus = "nul" +input_player1_l_x_plus_axis = "nul" +input_player1_l_x_plus_btn = "nul" +input_player1_l_x_plus_mbtn = "nul" +input_player1_l_y_minus = "nul" +input_player1_l_y_minus_axis = "nul" +input_player1_l_y_minus_btn = "nul" +input_player1_l_y_minus_mbtn = "nul" +input_player1_l_y_plus = "nul" +input_player1_l_y_plus_axis = "nul" +input_player1_l_y_plus_btn = "nul" +input_player1_l_y_plus_mbtn = "nul" +input_player1_left = "left" +input_player1_left_axis = "nul" +input_player1_left_btn = "nul" +input_player1_left_mbtn = "nul" +input_player1_mouse_index = "0" +input_player1_r = "w" +input_player1_r2 = "nul" +input_player1_r2_axis = "nul" +input_player1_r2_btn = "nul" +input_player1_r2_mbtn = "nul" +input_player1_r3 = "nul" +input_player1_r3_axis = "nul" +input_player1_r3_btn = "nul" +input_player1_r3_mbtn = "nul" +input_player1_r_axis = "nul" +input_player1_r_btn = "nul" +input_player1_r_mbtn = "nul" +input_player1_r_x_minus = "nul" +input_player1_r_x_minus_axis = "nul" +input_player1_r_x_minus_btn = "nul" +input_player1_r_x_minus_mbtn = "nul" +input_player1_r_x_plus = "nul" +input_player1_r_x_plus_axis = "nul" +input_player1_r_x_plus_btn = "nul" +input_player1_r_x_plus_mbtn = "nul" +input_player1_r_y_minus = "nul" +input_player1_r_y_minus_axis = "nul" +input_player1_r_y_minus_btn = "nul" +input_player1_r_y_minus_mbtn = "nul" +input_player1_r_y_plus = "nul" +input_player1_r_y_plus_axis = "nul" +input_player1_r_y_plus_btn = "nul" +input_player1_r_y_plus_mbtn = "nul" +input_player1_right = "right" +input_player1_right_axis = "nul" +input_player1_right_btn = "nul" +input_player1_right_mbtn = "nul" +input_player1_select = "rshift" +input_player1_select_axis = "nul" +input_player1_select_btn = "nul" +input_player1_select_mbtn = "nul" +input_player1_start = "enter" +input_player1_start_axis = "nul" +input_player1_start_btn = "nul" +input_player1_start_mbtn = "nul" +input_player1_turbo = "nul" +input_player1_turbo_axis = "nul" +input_player1_turbo_btn = "nul" +input_player1_turbo_mbtn = "nul" +input_player1_up = "up" +input_player1_up_axis = "nul" +input_player1_up_btn = "nul" +input_player1_up_mbtn = "nul" +input_player1_x = "s" +input_player1_x_axis = "nul" +input_player1_x_btn = "nul" +input_player1_x_mbtn = "nul" +input_player1_y = "a" +input_player1_y_axis = "nul" +input_player1_y_btn = "nul" +input_player1_y_mbtn = "nul" +input_player2_a = "nul" +input_player2_a_axis = "nul" +input_player2_a_btn = "nul" +input_player2_a_mbtn = "nul" +input_player2_analog_dpad_mode = "0" +input_player2_b = "nul" +input_player2_b_axis = "nul" +input_player2_b_btn = "nul" +input_player2_b_mbtn = "nul" +input_player2_down = "nul" +input_player2_down_axis = "nul" +input_player2_down_btn = "nul" +input_player2_down_mbtn = "nul" +input_player2_gun_aux_a = "nul" +input_player2_gun_aux_a_axis = "nul" +input_player2_gun_aux_a_btn = "nul" +input_player2_gun_aux_a_mbtn = "nul" +input_player2_gun_aux_b = "nul" +input_player2_gun_aux_b_axis = "nul" +input_player2_gun_aux_b_btn = "nul" +input_player2_gun_aux_b_mbtn = "nul" +input_player2_gun_aux_c = "nul" +input_player2_gun_aux_c_axis = "nul" +input_player2_gun_aux_c_btn = "nul" +input_player2_gun_aux_c_mbtn = "nul" +input_player2_gun_dpad_down = "nul" +input_player2_gun_dpad_down_axis = "nul" +input_player2_gun_dpad_down_btn = "nul" +input_player2_gun_dpad_down_mbtn = "nul" +input_player2_gun_dpad_left = "nul" +input_player2_gun_dpad_left_axis = "nul" +input_player2_gun_dpad_left_btn = "nul" +input_player2_gun_dpad_left_mbtn = "nul" +input_player2_gun_dpad_right = "nul" +input_player2_gun_dpad_right_axis = "nul" +input_player2_gun_dpad_right_btn = "nul" +input_player2_gun_dpad_right_mbtn = "nul" +input_player2_gun_dpad_up = "nul" +input_player2_gun_dpad_up_axis = "nul" +input_player2_gun_dpad_up_btn = "nul" +input_player2_gun_dpad_up_mbtn = "nul" +input_player2_gun_offscreen_shot = "nul" +input_player2_gun_offscreen_shot_axis = "nul" +input_player2_gun_offscreen_shot_btn = "nul" +input_player2_gun_offscreen_shot_mbtn = "nul" +input_player2_gun_select = "nul" +input_player2_gun_select_axis = "nul" +input_player2_gun_select_btn = "nul" +input_player2_gun_select_mbtn = "nul" +input_player2_gun_start = "nul" +input_player2_gun_start_axis = "nul" +input_player2_gun_start_btn = "nul" +input_player2_gun_start_mbtn = "nul" +input_player2_gun_trigger = "nul" +input_player2_gun_trigger_axis = "nul" +input_player2_gun_trigger_btn = "nul" +input_player2_gun_trigger_mbtn = "nul" +input_player2_joypad_index = "1" +input_player2_l = "nul" +input_player2_l2 = "nul" +input_player2_l2_axis = "nul" +input_player2_l2_btn = "nul" +input_player2_l2_mbtn = "nul" +input_player2_l3 = "nul" +input_player2_l3_axis = "nul" +input_player2_l3_btn = "nul" +input_player2_l3_mbtn = "nul" +input_player2_l_axis = "nul" +input_player2_l_btn = "nul" +input_player2_l_mbtn = "nul" +input_player2_l_x_minus = "nul" +input_player2_l_x_minus_axis = "nul" +input_player2_l_x_minus_btn = "nul" +input_player2_l_x_minus_mbtn = "nul" +input_player2_l_x_plus = "nul" +input_player2_l_x_plus_axis = "nul" +input_player2_l_x_plus_btn = "nul" +input_player2_l_x_plus_mbtn = "nul" +input_player2_l_y_minus = "nul" +input_player2_l_y_minus_axis = "nul" +input_player2_l_y_minus_btn = "nul" +input_player2_l_y_minus_mbtn = "nul" +input_player2_l_y_plus = "nul" +input_player2_l_y_plus_axis = "nul" +input_player2_l_y_plus_btn = "nul" +input_player2_l_y_plus_mbtn = "nul" +input_player2_left = "nul" +input_player2_left_axis = "nul" +input_player2_left_btn = "nul" +input_player2_left_mbtn = "nul" +input_player2_mouse_index = "0" +input_player2_r = "nul" +input_player2_r2 = "nul" +input_player2_r2_axis = "nul" +input_player2_r2_btn = "nul" +input_player2_r2_mbtn = "nul" +input_player2_r3 = "nul" +input_player2_r3_axis = "nul" +input_player2_r3_btn = "nul" +input_player2_r3_mbtn = "nul" +input_player2_r_axis = "nul" +input_player2_r_btn = "nul" +input_player2_r_mbtn = "nul" +input_player2_r_x_minus = "nul" +input_player2_r_x_minus_axis = "nul" +input_player2_r_x_minus_btn = "nul" +input_player2_r_x_minus_mbtn = "nul" +input_player2_r_x_plus = "nul" +input_player2_r_x_plus_axis = "nul" +input_player2_r_x_plus_btn = "nul" +input_player2_r_x_plus_mbtn = "nul" +input_player2_r_y_minus = "nul" +input_player2_r_y_minus_axis = "nul" +input_player2_r_y_minus_btn = "nul" +input_player2_r_y_minus_mbtn = "nul" +input_player2_r_y_plus = "nul" +input_player2_r_y_plus_axis = "nul" +input_player2_r_y_plus_btn = "nul" +input_player2_r_y_plus_mbtn = "nul" +input_player2_right = "nul" +input_player2_right_axis = "nul" +input_player2_right_btn = "nul" +input_player2_right_mbtn = "nul" +input_player2_select = "nul" +input_player2_select_axis = "nul" +input_player2_select_btn = "nul" +input_player2_select_mbtn = "nul" +input_player2_start = "nul" +input_player2_start_axis = "nul" +input_player2_start_btn = "nul" +input_player2_start_mbtn = "nul" +input_player2_turbo = "nul" +input_player2_turbo_axis = "nul" +input_player2_turbo_btn = "nul" +input_player2_turbo_mbtn = "nul" +input_player2_up = "nul" +input_player2_up_axis = "nul" +input_player2_up_btn = "nul" +input_player2_up_mbtn = "nul" +input_player2_x = "nul" +input_player2_x_axis = "nul" +input_player2_x_btn = "nul" +input_player2_x_mbtn = "nul" +input_player2_y = "nul" +input_player2_y_axis = "nul" +input_player2_y_btn = "nul" +input_player2_y_mbtn = "nul" +input_player3_a = "nul" +input_player3_a_axis = "nul" +input_player3_a_btn = "nul" +input_player3_a_mbtn = "nul" +input_player3_analog_dpad_mode = "0" +input_player3_b = "nul" +input_player3_b_axis = "nul" +input_player3_b_btn = "nul" +input_player3_b_mbtn = "nul" +input_player3_down = "nul" +input_player3_down_axis = "nul" +input_player3_down_btn = "nul" +input_player3_down_mbtn = "nul" +input_player3_gun_aux_a = "nul" +input_player3_gun_aux_a_axis = "nul" +input_player3_gun_aux_a_btn = "nul" +input_player3_gun_aux_a_mbtn = "nul" +input_player3_gun_aux_b = "nul" +input_player3_gun_aux_b_axis = "nul" +input_player3_gun_aux_b_btn = "nul" +input_player3_gun_aux_b_mbtn = "nul" +input_player3_gun_aux_c = "nul" +input_player3_gun_aux_c_axis = "nul" +input_player3_gun_aux_c_btn = "nul" +input_player3_gun_aux_c_mbtn = "nul" +input_player3_gun_dpad_down = "nul" +input_player3_gun_dpad_down_axis = "nul" +input_player3_gun_dpad_down_btn = "nul" +input_player3_gun_dpad_down_mbtn = "nul" +input_player3_gun_dpad_left = "nul" +input_player3_gun_dpad_left_axis = "nul" +input_player3_gun_dpad_left_btn = "nul" +input_player3_gun_dpad_left_mbtn = "nul" +input_player3_gun_dpad_right = "nul" +input_player3_gun_dpad_right_axis = "nul" +input_player3_gun_dpad_right_btn = "nul" +input_player3_gun_dpad_right_mbtn = "nul" +input_player3_gun_dpad_up = "nul" +input_player3_gun_dpad_up_axis = "nul" +input_player3_gun_dpad_up_btn = "nul" +input_player3_gun_dpad_up_mbtn = "nul" +input_player3_gun_offscreen_shot = "nul" +input_player3_gun_offscreen_shot_axis = "nul" +input_player3_gun_offscreen_shot_btn = "nul" +input_player3_gun_offscreen_shot_mbtn = "nul" +input_player3_gun_select = "nul" +input_player3_gun_select_axis = "nul" +input_player3_gun_select_btn = "nul" +input_player3_gun_select_mbtn = "nul" +input_player3_gun_start = "nul" +input_player3_gun_start_axis = "nul" +input_player3_gun_start_btn = "nul" +input_player3_gun_start_mbtn = "nul" +input_player3_gun_trigger = "nul" +input_player3_gun_trigger_axis = "nul" +input_player3_gun_trigger_btn = "nul" +input_player3_gun_trigger_mbtn = "nul" +input_player3_joypad_index = "2" +input_player3_l = "nul" +input_player3_l2 = "nul" +input_player3_l2_axis = "nul" +input_player3_l2_btn = "nul" +input_player3_l2_mbtn = "nul" +input_player3_l3 = "nul" +input_player3_l3_axis = "nul" +input_player3_l3_btn = "nul" +input_player3_l3_mbtn = "nul" +input_player3_l_axis = "nul" +input_player3_l_btn = "nul" +input_player3_l_mbtn = "nul" +input_player3_l_x_minus = "nul" +input_player3_l_x_minus_axis = "nul" +input_player3_l_x_minus_btn = "nul" +input_player3_l_x_minus_mbtn = "nul" +input_player3_l_x_plus = "nul" +input_player3_l_x_plus_axis = "nul" +input_player3_l_x_plus_btn = "nul" +input_player3_l_x_plus_mbtn = "nul" +input_player3_l_y_minus = "nul" +input_player3_l_y_minus_axis = "nul" +input_player3_l_y_minus_btn = "nul" +input_player3_l_y_minus_mbtn = "nul" +input_player3_l_y_plus = "nul" +input_player3_l_y_plus_axis = "nul" +input_player3_l_y_plus_btn = "nul" +input_player3_l_y_plus_mbtn = "nul" +input_player3_left = "nul" +input_player3_left_axis = "nul" +input_player3_left_btn = "nul" +input_player3_left_mbtn = "nul" +input_player3_mouse_index = "0" +input_player3_r = "nul" +input_player3_r2 = "nul" +input_player3_r2_axis = "nul" +input_player3_r2_btn = "nul" +input_player3_r2_mbtn = "nul" +input_player3_r3 = "nul" +input_player3_r3_axis = "nul" +input_player3_r3_btn = "nul" +input_player3_r3_mbtn = "nul" +input_player3_r_axis = "nul" +input_player3_r_btn = "nul" +input_player3_r_mbtn = "nul" +input_player3_r_x_minus = "nul" +input_player3_r_x_minus_axis = "nul" +input_player3_r_x_minus_btn = "nul" +input_player3_r_x_minus_mbtn = "nul" +input_player3_r_x_plus = "nul" +input_player3_r_x_plus_axis = "nul" +input_player3_r_x_plus_btn = "nul" +input_player3_r_x_plus_mbtn = "nul" +input_player3_r_y_minus = "nul" +input_player3_r_y_minus_axis = "nul" +input_player3_r_y_minus_btn = "nul" +input_player3_r_y_minus_mbtn = "nul" +input_player3_r_y_plus = "nul" +input_player3_r_y_plus_axis = "nul" +input_player3_r_y_plus_btn = "nul" +input_player3_r_y_plus_mbtn = "nul" +input_player3_right = "nul" +input_player3_right_axis = "nul" +input_player3_right_btn = "nul" +input_player3_right_mbtn = "nul" +input_player3_select = "nul" +input_player3_select_axis = "nul" +input_player3_select_btn = "nul" +input_player3_select_mbtn = "nul" +input_player3_start = "nul" +input_player3_start_axis = "nul" +input_player3_start_btn = "nul" +input_player3_start_mbtn = "nul" +input_player3_turbo = "nul" +input_player3_turbo_axis = "nul" +input_player3_turbo_btn = "nul" +input_player3_turbo_mbtn = "nul" +input_player3_up = "nul" +input_player3_up_axis = "nul" +input_player3_up_btn = "nul" +input_player3_up_mbtn = "nul" +input_player3_x = "nul" +input_player3_x_axis = "nul" +input_player3_x_btn = "nul" +input_player3_x_mbtn = "nul" +input_player3_y = "nul" +input_player3_y_axis = "nul" +input_player3_y_btn = "nul" +input_player3_y_mbtn = "nul" +input_player4_a = "nul" +input_player4_a_axis = "nul" +input_player4_a_btn = "nul" +input_player4_a_mbtn = "nul" +input_player4_analog_dpad_mode = "0" +input_player4_b = "nul" +input_player4_b_axis = "nul" +input_player4_b_btn = "nul" +input_player4_b_mbtn = "nul" +input_player4_down = "nul" +input_player4_down_axis = "nul" +input_player4_down_btn = "nul" +input_player4_down_mbtn = "nul" +input_player4_gun_aux_a = "nul" +input_player4_gun_aux_a_axis = "nul" +input_player4_gun_aux_a_btn = "nul" +input_player4_gun_aux_a_mbtn = "nul" +input_player4_gun_aux_b = "nul" +input_player4_gun_aux_b_axis = "nul" +input_player4_gun_aux_b_btn = "nul" +input_player4_gun_aux_b_mbtn = "nul" +input_player4_gun_aux_c = "nul" +input_player4_gun_aux_c_axis = "nul" +input_player4_gun_aux_c_btn = "nul" +input_player4_gun_aux_c_mbtn = "nul" +input_player4_gun_dpad_down = "nul" +input_player4_gun_dpad_down_axis = "nul" +input_player4_gun_dpad_down_btn = "nul" +input_player4_gun_dpad_down_mbtn = "nul" +input_player4_gun_dpad_left = "nul" +input_player4_gun_dpad_left_axis = "nul" +input_player4_gun_dpad_left_btn = "nul" +input_player4_gun_dpad_left_mbtn = "nul" +input_player4_gun_dpad_right = "nul" +input_player4_gun_dpad_right_axis = "nul" +input_player4_gun_dpad_right_btn = "nul" +input_player4_gun_dpad_right_mbtn = "nul" +input_player4_gun_dpad_up = "nul" +input_player4_gun_dpad_up_axis = "nul" +input_player4_gun_dpad_up_btn = "nul" +input_player4_gun_dpad_up_mbtn = "nul" +input_player4_gun_offscreen_shot = "nul" +input_player4_gun_offscreen_shot_axis = "nul" +input_player4_gun_offscreen_shot_btn = "nul" +input_player4_gun_offscreen_shot_mbtn = "nul" +input_player4_gun_select = "nul" +input_player4_gun_select_axis = "nul" +input_player4_gun_select_btn = "nul" +input_player4_gun_select_mbtn = "nul" +input_player4_gun_start = "nul" +input_player4_gun_start_axis = "nul" +input_player4_gun_start_btn = "nul" +input_player4_gun_start_mbtn = "nul" +input_player4_gun_trigger = "nul" +input_player4_gun_trigger_axis = "nul" +input_player4_gun_trigger_btn = "nul" +input_player4_gun_trigger_mbtn = "nul" +input_player4_joypad_index = "3" +input_player4_l = "nul" +input_player4_l2 = "nul" +input_player4_l2_axis = "nul" +input_player4_l2_btn = "nul" +input_player4_l2_mbtn = "nul" +input_player4_l3 = "nul" +input_player4_l3_axis = "nul" +input_player4_l3_btn = "nul" +input_player4_l3_mbtn = "nul" +input_player4_l_axis = "nul" +input_player4_l_btn = "nul" +input_player4_l_mbtn = "nul" +input_player4_l_x_minus = "nul" +input_player4_l_x_minus_axis = "nul" +input_player4_l_x_minus_btn = "nul" +input_player4_l_x_minus_mbtn = "nul" +input_player4_l_x_plus = "nul" +input_player4_l_x_plus_axis = "nul" +input_player4_l_x_plus_btn = "nul" +input_player4_l_x_plus_mbtn = "nul" +input_player4_l_y_minus = "nul" +input_player4_l_y_minus_axis = "nul" +input_player4_l_y_minus_btn = "nul" +input_player4_l_y_minus_mbtn = "nul" +input_player4_l_y_plus = "nul" +input_player4_l_y_plus_axis = "nul" +input_player4_l_y_plus_btn = "nul" +input_player4_l_y_plus_mbtn = "nul" +input_player4_left = "nul" +input_player4_left_axis = "nul" +input_player4_left_btn = "nul" +input_player4_left_mbtn = "nul" +input_player4_mouse_index = "0" +input_player4_r = "nul" +input_player4_r2 = "nul" +input_player4_r2_axis = "nul" +input_player4_r2_btn = "nul" +input_player4_r2_mbtn = "nul" +input_player4_r3 = "nul" +input_player4_r3_axis = "nul" +input_player4_r3_btn = "nul" +input_player4_r3_mbtn = "nul" +input_player4_r_axis = "nul" +input_player4_r_btn = "nul" +input_player4_r_mbtn = "nul" +input_player4_r_x_minus = "nul" +input_player4_r_x_minus_axis = "nul" +input_player4_r_x_minus_btn = "nul" +input_player4_r_x_minus_mbtn = "nul" +input_player4_r_x_plus = "nul" +input_player4_r_x_plus_axis = "nul" +input_player4_r_x_plus_btn = "nul" +input_player4_r_x_plus_mbtn = "nul" +input_player4_r_y_minus = "nul" +input_player4_r_y_minus_axis = "nul" +input_player4_r_y_minus_btn = "nul" +input_player4_r_y_minus_mbtn = "nul" +input_player4_r_y_plus = "nul" +input_player4_r_y_plus_axis = "nul" +input_player4_r_y_plus_btn = "nul" +input_player4_r_y_plus_mbtn = "nul" +input_player4_right = "nul" +input_player4_right_axis = "nul" +input_player4_right_btn = "nul" +input_player4_right_mbtn = "nul" +input_player4_select = "nul" +input_player4_select_axis = "nul" +input_player4_select_btn = "nul" +input_player4_select_mbtn = "nul" +input_player4_start = "nul" +input_player4_start_axis = "nul" +input_player4_start_btn = "nul" +input_player4_start_mbtn = "nul" +input_player4_turbo = "nul" +input_player4_turbo_axis = "nul" +input_player4_turbo_btn = "nul" +input_player4_turbo_mbtn = "nul" +input_player4_up = "nul" +input_player4_up_axis = "nul" +input_player4_up_btn = "nul" +input_player4_up_mbtn = "nul" +input_player4_x = "nul" +input_player4_x_axis = "nul" +input_player4_x_btn = "nul" +input_player4_x_mbtn = "nul" +input_player4_y = "nul" +input_player4_y_axis = "nul" +input_player4_y_btn = "nul" +input_player4_y_mbtn = "nul" +input_player5_a = "nul" +input_player5_a_axis = "nul" +input_player5_a_btn = "nul" +input_player5_a_mbtn = "nul" +input_player5_analog_dpad_mode = "0" +input_player5_b = "nul" +input_player5_b_axis = "nul" +input_player5_b_btn = "nul" +input_player5_b_mbtn = "nul" +input_player5_down = "nul" +input_player5_down_axis = "nul" +input_player5_down_btn = "nul" +input_player5_down_mbtn = "nul" +input_player5_gun_aux_a = "nul" +input_player5_gun_aux_a_axis = "nul" +input_player5_gun_aux_a_btn = "nul" +input_player5_gun_aux_a_mbtn = "nul" +input_player5_gun_aux_b = "nul" +input_player5_gun_aux_b_axis = "nul" +input_player5_gun_aux_b_btn = "nul" +input_player5_gun_aux_b_mbtn = "nul" +input_player5_gun_aux_c = "nul" +input_player5_gun_aux_c_axis = "nul" +input_player5_gun_aux_c_btn = "nul" +input_player5_gun_aux_c_mbtn = "nul" +input_player5_gun_dpad_down = "nul" +input_player5_gun_dpad_down_axis = "nul" +input_player5_gun_dpad_down_btn = "nul" +input_player5_gun_dpad_down_mbtn = "nul" +input_player5_gun_dpad_left = "nul" +input_player5_gun_dpad_left_axis = "nul" +input_player5_gun_dpad_left_btn = "nul" +input_player5_gun_dpad_left_mbtn = "nul" +input_player5_gun_dpad_right = "nul" +input_player5_gun_dpad_right_axis = "nul" +input_player5_gun_dpad_right_btn = "nul" +input_player5_gun_dpad_right_mbtn = "nul" +input_player5_gun_dpad_up = "nul" +input_player5_gun_dpad_up_axis = "nul" +input_player5_gun_dpad_up_btn = "nul" +input_player5_gun_dpad_up_mbtn = "nul" +input_player5_gun_offscreen_shot = "nul" +input_player5_gun_offscreen_shot_axis = "nul" +input_player5_gun_offscreen_shot_btn = "nul" +input_player5_gun_offscreen_shot_mbtn = "nul" +input_player5_gun_select = "nul" +input_player5_gun_select_axis = "nul" +input_player5_gun_select_btn = "nul" +input_player5_gun_select_mbtn = "nul" +input_player5_gun_start = "nul" +input_player5_gun_start_axis = "nul" +input_player5_gun_start_btn = "nul" +input_player5_gun_start_mbtn = "nul" +input_player5_gun_trigger = "nul" +input_player5_gun_trigger_axis = "nul" +input_player5_gun_trigger_btn = "nul" +input_player5_gun_trigger_mbtn = "nul" +input_player5_joypad_index = "4" +input_player5_l = "nul" +input_player5_l2 = "nul" +input_player5_l2_axis = "nul" +input_player5_l2_btn = "nul" +input_player5_l2_mbtn = "nul" +input_player5_l3 = "nul" +input_player5_l3_axis = "nul" +input_player5_l3_btn = "nul" +input_player5_l3_mbtn = "nul" +input_player5_l_axis = "nul" +input_player5_l_btn = "nul" +input_player5_l_mbtn = "nul" +input_player5_l_x_minus = "nul" +input_player5_l_x_minus_axis = "nul" +input_player5_l_x_minus_btn = "nul" +input_player5_l_x_minus_mbtn = "nul" +input_player5_l_x_plus = "nul" +input_player5_l_x_plus_axis = "nul" +input_player5_l_x_plus_btn = "nul" +input_player5_l_x_plus_mbtn = "nul" +input_player5_l_y_minus = "nul" +input_player5_l_y_minus_axis = "nul" +input_player5_l_y_minus_btn = "nul" +input_player5_l_y_minus_mbtn = "nul" +input_player5_l_y_plus = "nul" +input_player5_l_y_plus_axis = "nul" +input_player5_l_y_plus_btn = "nul" +input_player5_l_y_plus_mbtn = "nul" +input_player5_left = "nul" +input_player5_left_axis = "nul" +input_player5_left_btn = "nul" +input_player5_left_mbtn = "nul" +input_player5_mouse_index = "0" +input_player5_r = "nul" +input_player5_r2 = "nul" +input_player5_r2_axis = "nul" +input_player5_r2_btn = "nul" +input_player5_r2_mbtn = "nul" +input_player5_r3 = "nul" +input_player5_r3_axis = "nul" +input_player5_r3_btn = "nul" +input_player5_r3_mbtn = "nul" +input_player5_r_axis = "nul" +input_player5_r_btn = "nul" +input_player5_r_mbtn = "nul" +input_player5_r_x_minus = "nul" +input_player5_r_x_minus_axis = "nul" +input_player5_r_x_minus_btn = "nul" +input_player5_r_x_minus_mbtn = "nul" +input_player5_r_x_plus = "nul" +input_player5_r_x_plus_axis = "nul" +input_player5_r_x_plus_btn = "nul" +input_player5_r_x_plus_mbtn = "nul" +input_player5_r_y_minus = "nul" +input_player5_r_y_minus_axis = "nul" +input_player5_r_y_minus_btn = "nul" +input_player5_r_y_minus_mbtn = "nul" +input_player5_r_y_plus = "nul" +input_player5_r_y_plus_axis = "nul" +input_player5_r_y_plus_btn = "nul" +input_player5_r_y_plus_mbtn = "nul" +input_player5_right = "nul" +input_player5_right_axis = "nul" +input_player5_right_btn = "nul" +input_player5_right_mbtn = "nul" +input_player5_select = "nul" +input_player5_select_axis = "nul" +input_player5_select_btn = "nul" +input_player5_select_mbtn = "nul" +input_player5_start = "nul" +input_player5_start_axis = "nul" +input_player5_start_btn = "nul" +input_player5_start_mbtn = "nul" +input_player5_turbo = "nul" +input_player5_turbo_axis = "nul" +input_player5_turbo_btn = "nul" +input_player5_turbo_mbtn = "nul" +input_player5_up = "nul" +input_player5_up_axis = "nul" +input_player5_up_btn = "nul" +input_player5_up_mbtn = "nul" +input_player5_x = "nul" +input_player5_x_axis = "nul" +input_player5_x_btn = "nul" +input_player5_x_mbtn = "nul" +input_player5_y = "nul" +input_player5_y_axis = "nul" +input_player5_y_btn = "nul" +input_player5_y_mbtn = "nul" +input_player6_a = "nul" +input_player6_a_axis = "nul" +input_player6_a_btn = "nul" +input_player6_a_mbtn = "nul" +input_player6_analog_dpad_mode = "0" +input_player6_b = "nul" +input_player6_b_axis = "nul" +input_player6_b_btn = "nul" +input_player6_b_mbtn = "nul" +input_player6_down = "nul" +input_player6_down_axis = "nul" +input_player6_down_btn = "nul" +input_player6_down_mbtn = "nul" +input_player6_gun_aux_a = "nul" +input_player6_gun_aux_a_axis = "nul" +input_player6_gun_aux_a_btn = "nul" +input_player6_gun_aux_a_mbtn = "nul" +input_player6_gun_aux_b = "nul" +input_player6_gun_aux_b_axis = "nul" +input_player6_gun_aux_b_btn = "nul" +input_player6_gun_aux_b_mbtn = "nul" +input_player6_gun_aux_c = "nul" +input_player6_gun_aux_c_axis = "nul" +input_player6_gun_aux_c_btn = "nul" +input_player6_gun_aux_c_mbtn = "nul" +input_player6_gun_dpad_down = "nul" +input_player6_gun_dpad_down_axis = "nul" +input_player6_gun_dpad_down_btn = "nul" +input_player6_gun_dpad_down_mbtn = "nul" +input_player6_gun_dpad_left = "nul" +input_player6_gun_dpad_left_axis = "nul" +input_player6_gun_dpad_left_btn = "nul" +input_player6_gun_dpad_left_mbtn = "nul" +input_player6_gun_dpad_right = "nul" +input_player6_gun_dpad_right_axis = "nul" +input_player6_gun_dpad_right_btn = "nul" +input_player6_gun_dpad_right_mbtn = "nul" +input_player6_gun_dpad_up = "nul" +input_player6_gun_dpad_up_axis = "nul" +input_player6_gun_dpad_up_btn = "nul" +input_player6_gun_dpad_up_mbtn = "nul" +input_player6_gun_offscreen_shot = "nul" +input_player6_gun_offscreen_shot_axis = "nul" +input_player6_gun_offscreen_shot_btn = "nul" +input_player6_gun_offscreen_shot_mbtn = "nul" +input_player6_gun_select = "nul" +input_player6_gun_select_axis = "nul" +input_player6_gun_select_btn = "nul" +input_player6_gun_select_mbtn = "nul" +input_player6_gun_start = "nul" +input_player6_gun_start_axis = "nul" +input_player6_gun_start_btn = "nul" +input_player6_gun_start_mbtn = "nul" +input_player6_gun_trigger = "nul" +input_player6_gun_trigger_axis = "nul" +input_player6_gun_trigger_btn = "nul" +input_player6_gun_trigger_mbtn = "nul" +input_player6_joypad_index = "5" +input_player6_l = "nul" +input_player6_l2 = "nul" +input_player6_l2_axis = "nul" +input_player6_l2_btn = "nul" +input_player6_l2_mbtn = "nul" +input_player6_l3 = "nul" +input_player6_l3_axis = "nul" +input_player6_l3_btn = "nul" +input_player6_l3_mbtn = "nul" +input_player6_l_axis = "nul" +input_player6_l_btn = "nul" +input_player6_l_mbtn = "nul" +input_player6_l_x_minus = "nul" +input_player6_l_x_minus_axis = "nul" +input_player6_l_x_minus_btn = "nul" +input_player6_l_x_minus_mbtn = "nul" +input_player6_l_x_plus = "nul" +input_player6_l_x_plus_axis = "nul" +input_player6_l_x_plus_btn = "nul" +input_player6_l_x_plus_mbtn = "nul" +input_player6_l_y_minus = "nul" +input_player6_l_y_minus_axis = "nul" +input_player6_l_y_minus_btn = "nul" +input_player6_l_y_minus_mbtn = "nul" +input_player6_l_y_plus = "nul" +input_player6_l_y_plus_axis = "nul" +input_player6_l_y_plus_btn = "nul" +input_player6_l_y_plus_mbtn = "nul" +input_player6_left = "nul" +input_player6_left_axis = "nul" +input_player6_left_btn = "nul" +input_player6_left_mbtn = "nul" +input_player6_mouse_index = "0" +input_player6_r = "nul" +input_player6_r2 = "nul" +input_player6_r2_axis = "nul" +input_player6_r2_btn = "nul" +input_player6_r2_mbtn = "nul" +input_player6_r3 = "nul" +input_player6_r3_axis = "nul" +input_player6_r3_btn = "nul" +input_player6_r3_mbtn = "nul" +input_player6_r_axis = "nul" +input_player6_r_btn = "nul" +input_player6_r_mbtn = "nul" +input_player6_r_x_minus = "nul" +input_player6_r_x_minus_axis = "nul" +input_player6_r_x_minus_btn = "nul" +input_player6_r_x_minus_mbtn = "nul" +input_player6_r_x_plus = "nul" +input_player6_r_x_plus_axis = "nul" +input_player6_r_x_plus_btn = "nul" +input_player6_r_x_plus_mbtn = "nul" +input_player6_r_y_minus = "nul" +input_player6_r_y_minus_axis = "nul" +input_player6_r_y_minus_btn = "nul" +input_player6_r_y_minus_mbtn = "nul" +input_player6_r_y_plus = "nul" +input_player6_r_y_plus_axis = "nul" +input_player6_r_y_plus_btn = "nul" +input_player6_r_y_plus_mbtn = "nul" +input_player6_right = "nul" +input_player6_right_axis = "nul" +input_player6_right_btn = "nul" +input_player6_right_mbtn = "nul" +input_player6_select = "nul" +input_player6_select_axis = "nul" +input_player6_select_btn = "nul" +input_player6_select_mbtn = "nul" +input_player6_start = "nul" +input_player6_start_axis = "nul" +input_player6_start_btn = "nul" +input_player6_start_mbtn = "nul" +input_player6_turbo = "nul" +input_player6_turbo_axis = "nul" +input_player6_turbo_btn = "nul" +input_player6_turbo_mbtn = "nul" +input_player6_up = "nul" +input_player6_up_axis = "nul" +input_player6_up_btn = "nul" +input_player6_up_mbtn = "nul" +input_player6_x = "nul" +input_player6_x_axis = "nul" +input_player6_x_btn = "nul" +input_player6_x_mbtn = "nul" +input_player6_y = "nul" +input_player6_y_axis = "nul" +input_player6_y_btn = "nul" +input_player6_y_mbtn = "nul" +input_player7_a = "nul" +input_player7_a_axis = "nul" +input_player7_a_btn = "nul" +input_player7_a_mbtn = "nul" +input_player7_analog_dpad_mode = "0" +input_player7_b = "nul" +input_player7_b_axis = "nul" +input_player7_b_btn = "nul" +input_player7_b_mbtn = "nul" +input_player7_down = "nul" +input_player7_down_axis = "nul" +input_player7_down_btn = "nul" +input_player7_down_mbtn = "nul" +input_player7_gun_aux_a = "nul" +input_player7_gun_aux_a_axis = "nul" +input_player7_gun_aux_a_btn = "nul" +input_player7_gun_aux_a_mbtn = "nul" +input_player7_gun_aux_b = "nul" +input_player7_gun_aux_b_axis = "nul" +input_player7_gun_aux_b_btn = "nul" +input_player7_gun_aux_b_mbtn = "nul" +input_player7_gun_aux_c = "nul" +input_player7_gun_aux_c_axis = "nul" +input_player7_gun_aux_c_btn = "nul" +input_player7_gun_aux_c_mbtn = "nul" +input_player7_gun_dpad_down = "nul" +input_player7_gun_dpad_down_axis = "nul" +input_player7_gun_dpad_down_btn = "nul" +input_player7_gun_dpad_down_mbtn = "nul" +input_player7_gun_dpad_left = "nul" +input_player7_gun_dpad_left_axis = "nul" +input_player7_gun_dpad_left_btn = "nul" +input_player7_gun_dpad_left_mbtn = "nul" +input_player7_gun_dpad_right = "nul" +input_player7_gun_dpad_right_axis = "nul" +input_player7_gun_dpad_right_btn = "nul" +input_player7_gun_dpad_right_mbtn = "nul" +input_player7_gun_dpad_up = "nul" +input_player7_gun_dpad_up_axis = "nul" +input_player7_gun_dpad_up_btn = "nul" +input_player7_gun_dpad_up_mbtn = "nul" +input_player7_gun_offscreen_shot = "nul" +input_player7_gun_offscreen_shot_axis = "nul" +input_player7_gun_offscreen_shot_btn = "nul" +input_player7_gun_offscreen_shot_mbtn = "nul" +input_player7_gun_select = "nul" +input_player7_gun_select_axis = "nul" +input_player7_gun_select_btn = "nul" +input_player7_gun_select_mbtn = "nul" +input_player7_gun_start = "nul" +input_player7_gun_start_axis = "nul" +input_player7_gun_start_btn = "nul" +input_player7_gun_start_mbtn = "nul" +input_player7_gun_trigger = "nul" +input_player7_gun_trigger_axis = "nul" +input_player7_gun_trigger_btn = "nul" +input_player7_gun_trigger_mbtn = "nul" +input_player7_joypad_index = "6" +input_player7_l = "nul" +input_player7_l2 = "nul" +input_player7_l2_axis = "nul" +input_player7_l2_btn = "nul" +input_player7_l2_mbtn = "nul" +input_player7_l3 = "nul" +input_player7_l3_axis = "nul" +input_player7_l3_btn = "nul" +input_player7_l3_mbtn = "nul" +input_player7_l_axis = "nul" +input_player7_l_btn = "nul" +input_player7_l_mbtn = "nul" +input_player7_l_x_minus = "nul" +input_player7_l_x_minus_axis = "nul" +input_player7_l_x_minus_btn = "nul" +input_player7_l_x_minus_mbtn = "nul" +input_player7_l_x_plus = "nul" +input_player7_l_x_plus_axis = "nul" +input_player7_l_x_plus_btn = "nul" +input_player7_l_x_plus_mbtn = "nul" +input_player7_l_y_minus = "nul" +input_player7_l_y_minus_axis = "nul" +input_player7_l_y_minus_btn = "nul" +input_player7_l_y_minus_mbtn = "nul" +input_player7_l_y_plus = "nul" +input_player7_l_y_plus_axis = "nul" +input_player7_l_y_plus_btn = "nul" +input_player7_l_y_plus_mbtn = "nul" +input_player7_left = "nul" +input_player7_left_axis = "nul" +input_player7_left_btn = "nul" +input_player7_left_mbtn = "nul" +input_player7_mouse_index = "0" +input_player7_r = "nul" +input_player7_r2 = "nul" +input_player7_r2_axis = "nul" +input_player7_r2_btn = "nul" +input_player7_r2_mbtn = "nul" +input_player7_r3 = "nul" +input_player7_r3_axis = "nul" +input_player7_r3_btn = "nul" +input_player7_r3_mbtn = "nul" +input_player7_r_axis = "nul" +input_player7_r_btn = "nul" +input_player7_r_mbtn = "nul" +input_player7_r_x_minus = "nul" +input_player7_r_x_minus_axis = "nul" +input_player7_r_x_minus_btn = "nul" +input_player7_r_x_minus_mbtn = "nul" +input_player7_r_x_plus = "nul" +input_player7_r_x_plus_axis = "nul" +input_player7_r_x_plus_btn = "nul" +input_player7_r_x_plus_mbtn = "nul" +input_player7_r_y_minus = "nul" +input_player7_r_y_minus_axis = "nul" +input_player7_r_y_minus_btn = "nul" +input_player7_r_y_minus_mbtn = "nul" +input_player7_r_y_plus = "nul" +input_player7_r_y_plus_axis = "nul" +input_player7_r_y_plus_btn = "nul" +input_player7_r_y_plus_mbtn = "nul" +input_player7_right = "nul" +input_player7_right_axis = "nul" +input_player7_right_btn = "nul" +input_player7_right_mbtn = "nul" +input_player7_select = "nul" +input_player7_select_axis = "nul" +input_player7_select_btn = "nul" +input_player7_select_mbtn = "nul" +input_player7_start = "nul" +input_player7_start_axis = "nul" +input_player7_start_btn = "nul" +input_player7_start_mbtn = "nul" +input_player7_turbo = "nul" +input_player7_turbo_axis = "nul" +input_player7_turbo_btn = "nul" +input_player7_turbo_mbtn = "nul" +input_player7_up = "nul" +input_player7_up_axis = "nul" +input_player7_up_btn = "nul" +input_player7_up_mbtn = "nul" +input_player7_x = "nul" +input_player7_x_axis = "nul" +input_player7_x_btn = "nul" +input_player7_x_mbtn = "nul" +input_player7_y = "nul" +input_player7_y_axis = "nul" +input_player7_y_btn = "nul" +input_player7_y_mbtn = "nul" +input_player8_a = "nul" +input_player8_a_axis = "nul" +input_player8_a_btn = "nul" +input_player8_a_mbtn = "nul" +input_player8_analog_dpad_mode = "0" +input_player8_b = "nul" +input_player8_b_axis = "nul" +input_player8_b_btn = "nul" +input_player8_b_mbtn = "nul" +input_player8_down = "nul" +input_player8_down_axis = "nul" +input_player8_down_btn = "nul" +input_player8_down_mbtn = "nul" +input_player8_gun_aux_a = "nul" +input_player8_gun_aux_a_axis = "nul" +input_player8_gun_aux_a_btn = "nul" +input_player8_gun_aux_a_mbtn = "nul" +input_player8_gun_aux_b = "nul" +input_player8_gun_aux_b_axis = "nul" +input_player8_gun_aux_b_btn = "nul" +input_player8_gun_aux_b_mbtn = "nul" +input_player8_gun_aux_c = "nul" +input_player8_gun_aux_c_axis = "nul" +input_player8_gun_aux_c_btn = "nul" +input_player8_gun_aux_c_mbtn = "nul" +input_player8_gun_dpad_down = "nul" +input_player8_gun_dpad_down_axis = "nul" +input_player8_gun_dpad_down_btn = "nul" +input_player8_gun_dpad_down_mbtn = "nul" +input_player8_gun_dpad_left = "nul" +input_player8_gun_dpad_left_axis = "nul" +input_player8_gun_dpad_left_btn = "nul" +input_player8_gun_dpad_left_mbtn = "nul" +input_player8_gun_dpad_right = "nul" +input_player8_gun_dpad_right_axis = "nul" +input_player8_gun_dpad_right_btn = "nul" +input_player8_gun_dpad_right_mbtn = "nul" +input_player8_gun_dpad_up = "nul" +input_player8_gun_dpad_up_axis = "nul" +input_player8_gun_dpad_up_btn = "nul" +input_player8_gun_dpad_up_mbtn = "nul" +input_player8_gun_offscreen_shot = "nul" +input_player8_gun_offscreen_shot_axis = "nul" +input_player8_gun_offscreen_shot_btn = "nul" +input_player8_gun_offscreen_shot_mbtn = "nul" +input_player8_gun_select = "nul" +input_player8_gun_select_axis = "nul" +input_player8_gun_select_btn = "nul" +input_player8_gun_select_mbtn = "nul" +input_player8_gun_start = "nul" +input_player8_gun_start_axis = "nul" +input_player8_gun_start_btn = "nul" +input_player8_gun_start_mbtn = "nul" +input_player8_gun_trigger = "nul" +input_player8_gun_trigger_axis = "nul" +input_player8_gun_trigger_btn = "nul" +input_player8_gun_trigger_mbtn = "nul" +input_player8_joypad_index = "7" +input_player8_l = "nul" +input_player8_l2 = "nul" +input_player8_l2_axis = "nul" +input_player8_l2_btn = "nul" +input_player8_l2_mbtn = "nul" +input_player8_l3 = "nul" +input_player8_l3_axis = "nul" +input_player8_l3_btn = "nul" +input_player8_l3_mbtn = "nul" +input_player8_l_axis = "nul" +input_player8_l_btn = "nul" +input_player8_l_mbtn = "nul" +input_player8_l_x_minus = "nul" +input_player8_l_x_minus_axis = "nul" +input_player8_l_x_minus_btn = "nul" +input_player8_l_x_minus_mbtn = "nul" +input_player8_l_x_plus = "nul" +input_player8_l_x_plus_axis = "nul" +input_player8_l_x_plus_btn = "nul" +input_player8_l_x_plus_mbtn = "nul" +input_player8_l_y_minus = "nul" +input_player8_l_y_minus_axis = "nul" +input_player8_l_y_minus_btn = "nul" +input_player8_l_y_minus_mbtn = "nul" +input_player8_l_y_plus = "nul" +input_player8_l_y_plus_axis = "nul" +input_player8_l_y_plus_btn = "nul" +input_player8_l_y_plus_mbtn = "nul" +input_player8_left = "nul" +input_player8_left_axis = "nul" +input_player8_left_btn = "nul" +input_player8_left_mbtn = "nul" +input_player8_mouse_index = "0" +input_player8_r = "nul" +input_player8_r2 = "nul" +input_player8_r2_axis = "nul" +input_player8_r2_btn = "nul" +input_player8_r2_mbtn = "nul" +input_player8_r3 = "nul" +input_player8_r3_axis = "nul" +input_player8_r3_btn = "nul" +input_player8_r3_mbtn = "nul" +input_player8_r_axis = "nul" +input_player8_r_btn = "nul" +input_player8_r_mbtn = "nul" +input_player8_r_x_minus = "nul" +input_player8_r_x_minus_axis = "nul" +input_player8_r_x_minus_btn = "nul" +input_player8_r_x_minus_mbtn = "nul" +input_player8_r_x_plus = "nul" +input_player8_r_x_plus_axis = "nul" +input_player8_r_x_plus_btn = "nul" +input_player8_r_x_plus_mbtn = "nul" +input_player8_r_y_minus = "nul" +input_player8_r_y_minus_axis = "nul" +input_player8_r_y_minus_btn = "nul" +input_player8_r_y_minus_mbtn = "nul" +input_player8_r_y_plus = "nul" +input_player8_r_y_plus_axis = "nul" +input_player8_r_y_plus_btn = "nul" +input_player8_r_y_plus_mbtn = "nul" +input_player8_right = "nul" +input_player8_right_axis = "nul" +input_player8_right_btn = "nul" +input_player8_right_mbtn = "nul" +input_player8_select = "nul" +input_player8_select_axis = "nul" +input_player8_select_btn = "nul" +input_player8_select_mbtn = "nul" +input_player8_start = "nul" +input_player8_start_axis = "nul" +input_player8_start_btn = "nul" +input_player8_start_mbtn = "nul" +input_player8_turbo = "nul" +input_player8_turbo_axis = "nul" +input_player8_turbo_btn = "nul" +input_player8_turbo_mbtn = "nul" +input_player8_up = "nul" +input_player8_up_axis = "nul" +input_player8_up_btn = "nul" +input_player8_up_mbtn = "nul" +input_player8_x = "nul" +input_player8_x_axis = "nul" +input_player8_x_btn = "nul" +input_player8_x_mbtn = "nul" +input_player8_y = "nul" +input_player8_y_axis = "nul" +input_player8_y_btn = "nul" +input_player8_y_mbtn = "nul" +input_player9_a = "nul" +input_player9_a_axis = "nul" +input_player9_a_btn = "nul" +input_player9_a_mbtn = "nul" +input_player9_analog_dpad_mode = "0" +input_player9_b = "nul" +input_player9_b_axis = "nul" +input_player9_b_btn = "nul" +input_player9_b_mbtn = "nul" +input_player9_down = "nul" +input_player9_down_axis = "nul" +input_player9_down_btn = "nul" +input_player9_down_mbtn = "nul" +input_player9_gun_aux_a = "nul" +input_player9_gun_aux_a_axis = "nul" +input_player9_gun_aux_a_btn = "nul" +input_player9_gun_aux_a_mbtn = "nul" +input_player9_gun_aux_b = "nul" +input_player9_gun_aux_b_axis = "nul" +input_player9_gun_aux_b_btn = "nul" +input_player9_gun_aux_b_mbtn = "nul" +input_player9_gun_aux_c = "nul" +input_player9_gun_aux_c_axis = "nul" +input_player9_gun_aux_c_btn = "nul" +input_player9_gun_aux_c_mbtn = "nul" +input_player9_gun_dpad_down = "nul" +input_player9_gun_dpad_down_axis = "nul" +input_player9_gun_dpad_down_btn = "nul" +input_player9_gun_dpad_down_mbtn = "nul" +input_player9_gun_dpad_left = "nul" +input_player9_gun_dpad_left_axis = "nul" +input_player9_gun_dpad_left_btn = "nul" +input_player9_gun_dpad_left_mbtn = "nul" +input_player9_gun_dpad_right = "nul" +input_player9_gun_dpad_right_axis = "nul" +input_player9_gun_dpad_right_btn = "nul" +input_player9_gun_dpad_right_mbtn = "nul" +input_player9_gun_dpad_up = "nul" +input_player9_gun_dpad_up_axis = "nul" +input_player9_gun_dpad_up_btn = "nul" +input_player9_gun_dpad_up_mbtn = "nul" +input_player9_gun_offscreen_shot = "nul" +input_player9_gun_offscreen_shot_axis = "nul" +input_player9_gun_offscreen_shot_btn = "nul" +input_player9_gun_offscreen_shot_mbtn = "nul" +input_player9_gun_select = "nul" +input_player9_gun_select_axis = "nul" +input_player9_gun_select_btn = "nul" +input_player9_gun_select_mbtn = "nul" +input_player9_gun_start = "nul" +input_player9_gun_start_axis = "nul" +input_player9_gun_start_btn = "nul" +input_player9_gun_start_mbtn = "nul" +input_player9_gun_trigger = "nul" +input_player9_gun_trigger_axis = "nul" +input_player9_gun_trigger_btn = "nul" +input_player9_gun_trigger_mbtn = "nul" +input_player9_joypad_index = "8" +input_player9_l = "nul" +input_player9_l2 = "nul" +input_player9_l2_axis = "nul" +input_player9_l2_btn = "nul" +input_player9_l2_mbtn = "nul" +input_player9_l3 = "nul" +input_player9_l3_axis = "nul" +input_player9_l3_btn = "nul" +input_player9_l3_mbtn = "nul" +input_player9_l_axis = "nul" +input_player9_l_btn = "nul" +input_player9_l_mbtn = "nul" +input_player9_l_x_minus = "nul" +input_player9_l_x_minus_axis = "nul" +input_player9_l_x_minus_btn = "nul" +input_player9_l_x_minus_mbtn = "nul" +input_player9_l_x_plus = "nul" +input_player9_l_x_plus_axis = "nul" +input_player9_l_x_plus_btn = "nul" +input_player9_l_x_plus_mbtn = "nul" +input_player9_l_y_minus = "nul" +input_player9_l_y_minus_axis = "nul" +input_player9_l_y_minus_btn = "nul" +input_player9_l_y_minus_mbtn = "nul" +input_player9_l_y_plus = "nul" +input_player9_l_y_plus_axis = "nul" +input_player9_l_y_plus_btn = "nul" +input_player9_l_y_plus_mbtn = "nul" +input_player9_left = "nul" +input_player9_left_axis = "nul" +input_player9_left_btn = "nul" +input_player9_left_mbtn = "nul" +input_player9_mouse_index = "0" +input_player9_r = "nul" +input_player9_r2 = "nul" +input_player9_r2_axis = "nul" +input_player9_r2_btn = "nul" +input_player9_r2_mbtn = "nul" +input_player9_r3 = "nul" +input_player9_r3_axis = "nul" +input_player9_r3_btn = "nul" +input_player9_r3_mbtn = "nul" +input_player9_r_axis = "nul" +input_player9_r_btn = "nul" +input_player9_r_mbtn = "nul" +input_player9_r_x_minus = "nul" +input_player9_r_x_minus_axis = "nul" +input_player9_r_x_minus_btn = "nul" +input_player9_r_x_minus_mbtn = "nul" +input_player9_r_x_plus = "nul" +input_player9_r_x_plus_axis = "nul" +input_player9_r_x_plus_btn = "nul" +input_player9_r_x_plus_mbtn = "nul" +input_player9_r_y_minus = "nul" +input_player9_r_y_minus_axis = "nul" +input_player9_r_y_minus_btn = "nul" +input_player9_r_y_minus_mbtn = "nul" +input_player9_r_y_plus = "nul" +input_player9_r_y_plus_axis = "nul" +input_player9_r_y_plus_btn = "nul" +input_player9_r_y_plus_mbtn = "nul" +input_player9_right = "nul" +input_player9_right_axis = "nul" +input_player9_right_btn = "nul" +input_player9_right_mbtn = "nul" +input_player9_select = "nul" +input_player9_select_axis = "nul" +input_player9_select_btn = "nul" +input_player9_select_mbtn = "nul" +input_player9_start = "nul" +input_player9_start_axis = "nul" +input_player9_start_btn = "nul" +input_player9_start_mbtn = "nul" +input_player9_turbo = "nul" +input_player9_turbo_axis = "nul" +input_player9_turbo_btn = "nul" +input_player9_turbo_mbtn = "nul" +input_player9_up = "nul" +input_player9_up_axis = "nul" +input_player9_up_btn = "nul" +input_player9_up_mbtn = "nul" +input_player9_x = "nul" +input_player9_x_axis = "nul" +input_player9_x_btn = "nul" +input_player9_x_mbtn = "nul" +input_player9_y = "nul" +input_player9_y_axis = "nul" +input_player9_y_btn = "nul" +input_player9_y_mbtn = "nul" +input_poll_type_behavior = "2" +input_recording_toggle = "nul" +input_recording_toggle_axis = "nul" +input_recording_toggle_btn = "nul" +input_recording_toggle_mbtn = "nul" +input_remap_binds_enable = "true" +input_remapping_directory = ":\config\remaps" +input_reset = "h" +input_reset_axis = "nul" +input_reset_btn = "nul" +input_reset_mbtn = "nul" +input_rewind = "r" +input_rewind_axis = "nul" +input_rewind_btn = "nul" +input_rewind_mbtn = "nul" +input_save_state = "f2" +input_save_state_axis = "nul" +input_save_state_btn = "nul" +input_save_state_mbtn = "nul" +input_screenshot = "f8" +input_screenshot_axis = "nul" +input_screenshot_btn = "nul" +input_screenshot_mbtn = "nul" +input_shader_next = "m" +input_shader_next_axis = "nul" +input_shader_next_btn = "nul" +input_shader_next_mbtn = "nul" +input_shader_prev = "n" +input_shader_prev_axis = "nul" +input_shader_prev_btn = "nul" +input_shader_prev_mbtn = "nul" +input_state_slot_decrease = "f6" +input_state_slot_decrease_axis = "nul" +input_state_slot_decrease_btn = "nul" +input_state_slot_decrease_mbtn = "nul" +input_state_slot_increase = "f7" +input_state_slot_increase_axis = "nul" +input_state_slot_increase_btn = "nul" +input_state_slot_increase_mbtn = "nul" +input_streaming_toggle = "nul" +input_streaming_toggle_axis = "nul" +input_streaming_toggle_btn = "nul" +input_streaming_toggle_mbtn = "nul" +input_toggle_fast_forward = "space" +input_toggle_fast_forward_axis = "nul" +input_toggle_fast_forward_btn = "nul" +input_toggle_fast_forward_mbtn = "nul" +input_toggle_fullscreen = "f" +input_toggle_fullscreen_axis = "nul" +input_toggle_fullscreen_btn = "nul" +input_toggle_fullscreen_mbtn = "nul" +input_toggle_slowmotion = "nul" +input_toggle_slowmotion_axis = "nul" +input_toggle_slowmotion_btn = "nul" +input_toggle_slowmotion_mbtn = "nul" +input_turbo_period = "6" +input_volume_down = "subtract" +input_volume_down_axis = "nul" +input_volume_down_btn = "nul" +input_volume_down_mbtn = "nul" +input_volume_up = "add" +input_volume_up_axis = "nul" +input_volume_up_btn = "nul" +input_volume_up_mbtn = "nul" +joypad_autoconfig_dir = ":\autoconfig" +keyboard_gamepad_enable = "true" +keyboard_gamepad_mapping_type = "1" +kiosk_mode_enable = "false" +kiosk_mode_password = "" +led_driver = "null" +libretro_directory = ":\cores" +libretro_info_path = ":\info" +libretro_log_level = "1" +load_dummy_on_core_shutdown = "true" +location_allow = "false" +location_driver = "null" +materialui_icons_enable = "true" +materialui_menu_color_theme = "0" +menu_battery_level_enable = "true" +menu_core_enable = "true" +menu_driver = "xmb" +menu_dynamic_wallpaper_enable = "false" +menu_entry_hover_color = "ff64ff64" +menu_entry_normal_color = "ffffffff" +menu_font_color_blue = "255" +menu_font_color_green = "255" +menu_font_color_red = "255" +menu_footer_opacity = "1.000000" +menu_framebuffer_opacity = "0.900000" +menu_header_opacity = "1.000000" +menu_horizontal_animation = "true" +menu_left_thumbnails = "0" +menu_linear_filter = "true" +menu_mouse_enable = "true" +menu_navigation_browser_filter_supported_extensions_enable = "true" +menu_navigation_wraparound_enable = "true" +menu_pause_libretro = "true" +menu_pointer_enable = "false" +menu_shader_pipeline = "2" +menu_show_advanced_settings = "false" +menu_show_configurations = "true" +menu_show_core_updater = "true" +menu_show_help = "true" +menu_show_information = "true" +menu_show_latency = "true" +menu_show_load_content = "true" +menu_show_load_core = "true" +menu_show_online_updater = "true" +menu_show_overlays = "true" +menu_show_quit_retroarch = "true" +menu_show_reboot = "true" +menu_show_rewind = "true" +menu_show_shutdown = "true" +menu_swap_ok_cancel_buttons = "true" +menu_throttle_framerate = "true" +menu_thumbnails = "3" +menu_timedate_enable = "true" +menu_title_color = "ff64ff64" +menu_unified_controls = "false" +menu_wallpaper = "" +menu_wallpaper_opacity = "0.300000" +midi_driver = "winmm" +midi_input = "Off" +midi_output = "Off" +midi_volume = "100" +netplay_allow_slaves = "true" +netplay_check_frames = "600" +netplay_input_latency_frames_min = "0" +netplay_input_latency_frames_range = "0" +netplay_ip_address = "" +netplay_ip_port = "55435" +netplay_mitm_server = "nyc" +netplay_nat_traversal = "true" +netplay_nickname = "" +netplay_password = "" +netplay_public_announce = "true" +netplay_request_device_p1 = "false" +netplay_request_device_p10 = "false" +netplay_request_device_p11 = "false" +netplay_request_device_p12 = "false" +netplay_request_device_p13 = "false" +netplay_request_device_p14 = "false" +netplay_request_device_p15 = "false" +netplay_request_device_p16 = "false" +netplay_request_device_p2 = "false" +netplay_request_device_p3 = "false" +netplay_request_device_p4 = "false" +netplay_request_device_p5 = "false" +netplay_request_device_p6 = "false" +netplay_request_device_p7 = "false" +netplay_request_device_p8 = "false" +netplay_request_device_p9 = "false" +netplay_require_slaves = "false" +netplay_share_analog = "1" +netplay_share_digital = "1" +netplay_spectate_password = "" +netplay_start_as_spectator = "false" +netplay_stateless_mode = "false" +netplay_use_mitm_server = "false" +network_cmd_enable = "false" +network_cmd_port = "55355" +network_remote_base_port = "55400" +network_remote_enable = "false" +network_remote_enable_user_p1 = "false" +network_remote_enable_user_p10 = "false" +network_remote_enable_user_p11 = "false" +network_remote_enable_user_p12 = "false" +network_remote_enable_user_p13 = "false" +network_remote_enable_user_p14 = "false" +network_remote_enable_user_p15 = "false" +network_remote_enable_user_p16 = "false" +network_remote_enable_user_p2 = "false" +network_remote_enable_user_p3 = "false" +network_remote_enable_user_p4 = "false" +network_remote_enable_user_p5 = "false" +network_remote_enable_user_p6 = "false" +network_remote_enable_user_p7 = "false" +network_remote_enable_user_p8 = "false" +network_remote_enable_user_p9 = "false" +overlay_directory = ":\overlays" +pause_nonactive = "true" +perfcnt_enable = "false" +playlist_cores = "" +playlist_directory = ":\playlists" +playlist_entry_remove = "true" +playlist_entry_rename = "true" +playlist_names = "" +quick_menu_show_add_to_favorites = "true" +quick_menu_show_cheats = "true" +quick_menu_show_controls = "true" +quick_menu_show_information = "true" +quick_menu_show_options = "true" +quick_menu_show_recording = "true" +quick_menu_show_save_content_dir_overrides = "true" +quick_menu_show_save_core_overrides = "true" +quick_menu_show_save_game_overrides = "true" +quick_menu_show_save_load_state = "true" +quick_menu_show_shaders = "true" +quick_menu_show_streaming = "true" +quick_menu_show_take_screenshot = "true" +quick_menu_show_undo_save_load_state = "true" +record_driver = "ffmpeg" +recording_config_directory = "" +recording_output_directory = "" +resampler_directory = "" +rewind_buffer_size = "20971520" +rewind_buffer_size_step = "10" +rewind_enable = "false" +rewind_granularity = "1" +rgui_background_filler_thickness_enable = "true" +rgui_border_filler_enable = "true" +rgui_border_filler_thickness_enable = "true" +rgui_browser_directory = "default" +rgui_config_directory = ":\config" +rgui_show_start_screen = "false" +run_ahead_enabled = "false" +run_ahead_frames = "1" +run_ahead_hide_warnings = "false" +run_ahead_secondary_instance = "false" +savefile_directory = ":\saves" +savefiles_in_content_dir = "false" +savestate_auto_index = "false" +savestate_auto_load = "false" +savestate_auto_save = "false" +savestate_directory = ":\states" +savestate_thumbnail_enable = "false" +savestates_in_content_dir = "false" +screenshot_directory = "default" +screenshots_in_content_dir = "false" +show_hidden_files = "false" +slowmotion_ratio = "3.000000" +soft_filter_enable = "false" +soft_filter_index = "0" +sort_savefiles_enable = "false" +sort_savestates_enable = "false" +state_slot = "0" +statistics_show = "false" +stdin_cmd_enable = "false" +streaming_mode = "0" +suspend_screensaver_enable = "true" +sustained_performance_mode = "false" +system_directory = ":\system" +systemfiles_in_content_dir = "false" +threaded_data_runloop_enable = "true" +thumbnails_directory = ":\thumbnails" +twitch_stream_key = "" +ui_companion_enable = "false" +ui_companion_start_on_boot = "true" +ui_companion_toggle = "false" +ui_menubar_enable = "true" +user_language = "0" +video_adaptive_vsync = "false" +video_allow_rotate = "true" +video_aspect_ratio = "-1.000000" +video_aspect_ratio_auto = "false" +video_black_frame_insertion = "false" +video_context_driver = "" +video_crop_overscan = "true" +video_disable_composition = "false" +video_driver = "gl" +video_filter = "" +video_filter_dir = ":\filters\video" +video_font_enable = "true" +video_font_path = "" +video_font_size = "32.000000" +video_force_aspect = "true" +video_force_srgb_disable = "false" +video_frame_delay = "0" +video_fullscreen = "false" +video_fullscreen_x = "0" +video_fullscreen_y = "0" +video_gpu_record = "false" +video_gpu_screenshot = "true" +video_hard_sync = "false" +video_hard_sync_frames = "0" +video_max_swapchain_images = "3" +video_message_color = "ffff00" +video_message_pos_x = "0.050000" +video_message_pos_y = "0.050000" +video_monitor_index = "0" +video_msg_bgcolor_blue = "0" +video_msg_bgcolor_enable = "false" +video_msg_bgcolor_green = "0" +video_msg_bgcolor_opacity = "1.000000" +video_msg_bgcolor_red = "0" +video_post_filter_record = "false" +video_record_config = "" +video_record_quality = "4" +video_record_scale_factor = "1" +video_refresh_rate = "59.940060" +video_rotation = "0" +video_scale = "3.000000" +video_scale_integer = "false" +video_shader = "" +video_shader_dir = ":\shaders" +video_shader_enable = "false" +video_shader_watch_files = "false" +video_shared_context = "false" +video_smooth = "true" +video_stream_config = "" +video_stream_port = "56400" +video_stream_quality = "6" +video_stream_scale_factor = "1" +video_stream_url = "" +video_swap_interval = "1" +video_threaded = "false" +video_vsync = "true" +video_window_opacity = "100" +video_window_show_decorations = "true" +video_window_x = "0" +video_window_y = "0" +video_windowed_fullscreen = "true" +vrr_runloop_enable = "false" +wifi_driver = "null" +xmb_alpha_factor = "75" +xmb_font = "" +xmb_layout = "0" +xmb_menu_color_theme = "4" +xmb_scale_factor = "100" +xmb_shadows_enable = "true" +xmb_theme = "0" +xmb_vertical_thumbnails = "false" +youtube_stream_key = "" From 70dcdc7cf00aca1558c5648083289b6e769be8f1 Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 26 Sep 2018 20:03:43 -0500 Subject: [PATCH 0083/1292] [record] fixes --- record/drivers/record_ffmpeg.c | 14 +- retroarch.cfg | 3810 ++++++++------------------------ 2 files changed, 896 insertions(+), 2928 deletions(-) diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index b07e2e09ba..a4c332ac45 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -640,7 +640,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p { if (!settings->bools.video_gpu_record) params->scale_factor = settings->uints.video_record_scale_factor > 0 ? - settings->uints.video_record_scale_factor : 2; + settings->uints.video_record_scale_factor : 1; else params->scale_factor = 1; strlcpy(params->format, "matroska", sizeof(params->format)); @@ -649,16 +649,20 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p { if (!settings->bools.video_gpu_record) params->scale_factor = settings->uints.video_stream_scale_factor > 0 ? - settings->uints.video_stream_scale_factor : 2; + settings->uints.video_stream_scale_factor : 1; else - params->scale_factor = 2; - strlcpy(params->format, "flv", sizeof(params->format)); + params->scale_factor = 1; + if (settings->uints.streaming_mode == STREAMING_MODE_YOUTUBE || settings->uints.streaming_mode == STREAMING_MODE_TWITCH) + strlcpy(params->format, "flv", sizeof(params->format)); + else + strlcpy(params->format, "mpegts", sizeof(params->format)); } else if (preset == RECORD_CONFIG_TYPE_STREAMING_NETPLAY) { params->scale_factor = 1; - strlcpy(params->format, "m2ts", sizeof(params->format)); + strlcpy(params->format, "mpegts", sizeof(params->format)); } + return true; } diff --git a/retroarch.cfg b/retroarch.cfg index 761e9d811f..671fa4a73c 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -1,2923 +1,887 @@ -all_users_control_menu = "false" -apply_cheats_after_load = "false" -apply_cheats_after_toggle = "false" -aspect_ratio_index = "22" -assets_directory = ":\assets" -audio_block_frames = "0" -audio_device = "" -audio_driver = "xaudio" -audio_dsp_plugin = "" -audio_enable = "true" -audio_enable_menu = "false" -audio_filter_dir = ":\filters\audio" -audio_latency = "64" -audio_max_timing_skew = "0.050000" -audio_mixer_mute_enable = "false" -audio_mixer_volume = "0.000000" -audio_mute_enable = "false" -audio_out_rate = "48000" -audio_rate_control = "true" -audio_rate_control_delta = "0.005000" -audio_resampler = "sinc" -audio_resampler_quality = "3" -audio_sync = "true" -audio_volume = "0.000000" -audio_wasapi_exclusive_mode = "true" -audio_wasapi_float_format = "false" -audio_wasapi_sh_buffer_length = "-16" -auto_overrides_enable = "true" -auto_remaps_enable = "true" -auto_screenshot_filename = "true" -auto_shaders_enable = "true" -automatically_add_content_to_playlist = "false" -autosave_interval = "0" -block_sram_overwrite = "false" -builtin_imageviewer_enable = "true" -builtin_mediaplayer_enable = "true" -bundle_assets_dst_path = "" -bundle_assets_dst_path_subdir = "" -bundle_assets_extract_enable = "false" -bundle_assets_extract_last_version = "0" -bundle_assets_extract_version_current = "0" -bundle_assets_src_path = "" -cache_directory = "" -camera_allow = "false" -camera_device = "" -camera_driver = "null" -cheat_database_path = ":\cheats" -check_firmware_before_loading = "false" -cheevos_auto_screenshot = "false" -cheevos_badges_enable = "false" -cheevos_enable = "false" -cheevos_hardcore_mode_enable = "false" -cheevos_leaderboards_enable = "false" -cheevos_password = "" -cheevos_test_unofficial = "false" -cheevos_token = "" -cheevos_username = "" -cheevos_verbose_enable = "false" -config_save_on_exit = "true" -content_database_path = ":\database\rdb" -content_favorites_path = ":\content_favorites.lpl" -content_history_dir = "" -content_history_path = ":\content_history.lpl" -content_history_size = "100" -content_image_history_path = ":\content_image_history.lpl" -content_music_history_path = ":\content_music_history.lpl" -content_show_add = "true" -content_show_favorites = "true" -content_show_history = "true" -content_show_images = "true" -content_show_music = "true" -content_show_netplay = "true" -content_show_playlists = "true" -content_show_settings = "true" -content_show_settings_password = "" -content_show_video = "true" -content_video_history_path = ":\content_video_history.lpl" -core_assets_directory = ":\downloads" -core_options_path = "" -core_set_supports_no_game_enable = "true" -core_updater_auto_extract_archive = "true" -core_updater_buildbot_assets_url = "http://buildbot.libretro.com/assets/" -core_updater_buildbot_url = "http://buildbot.libretro.com/nightly/windows/x86_64/latest/" -crt_switch_center_adjust = "0" -crt_switch_resolution = "0" -crt_switch_resolution_super = "2560" -crt_switch_resolution_use_custom_refresh_rate = "false" -crt_video_refresh_rate = "59.940060" -current_resolution_id = "0" -cursor_directory = ":\database\cursors" -custom_viewport_height = "432" -custom_viewport_width = "480" -custom_viewport_x = "0" -custom_viewport_y = "0" -desktop_menu_enable = "true" -discord_allow = "false" -dpi_override_enable = "false" -dpi_override_value = "200" -dynamic_wallpapers_directory = ":\assets\wallpapers" -fastforward_ratio = "0.000000" -filter_by_current_core = "false" -flicker_filter_enable = "false" -flicker_filter_index = "0" -fps_show = "false" -framecount_show = "true" -game_specific_options = "true" -gamma_correction = "false" -history_list_enable = "true" -input_audio_mute = "f9" -input_audio_mute_axis = "nul" -input_audio_mute_btn = "nul" -input_audio_mute_mbtn = "nul" -input_autodetect_enable = "true" -input_axis_threshold = "0.500000" -input_bind_hold = "2" -input_bind_timeout = "5" -input_cheat_index_minus = "t" -input_cheat_index_minus_axis = "nul" -input_cheat_index_minus_btn = "nul" -input_cheat_index_minus_mbtn = "nul" -input_cheat_index_plus = "y" -input_cheat_index_plus_axis = "nul" -input_cheat_index_plus_btn = "nul" -input_cheat_index_plus_mbtn = "nul" -input_cheat_toggle = "u" -input_cheat_toggle_axis = "nul" -input_cheat_toggle_btn = "nul" -input_cheat_toggle_mbtn = "nul" -input_descriptor_hide_unbound = "false" -input_descriptor_label_show = "true" -input_desktop_menu_toggle = "f5" -input_desktop_menu_toggle_axis = "nul" -input_desktop_menu_toggle_btn = "nul" -input_desktop_menu_toggle_mbtn = "nul" -input_device_p1 = "0" -input_device_p10 = "0" -input_device_p11 = "0" -input_device_p12 = "0" -input_device_p13 = "0" -input_device_p14 = "0" -input_device_p15 = "0" -input_device_p16 = "0" -input_device_p2 = "0" -input_device_p3 = "0" -input_device_p4 = "0" -input_device_p5 = "0" -input_device_p6 = "0" -input_device_p7 = "0" -input_device_p8 = "0" -input_device_p9 = "0" -input_disk_eject_toggle = "nul" -input_disk_eject_toggle_axis = "nul" -input_disk_eject_toggle_btn = "nul" -input_disk_eject_toggle_mbtn = "nul" -input_disk_next = "nul" -input_disk_next_axis = "nul" -input_disk_next_btn = "nul" -input_disk_next_mbtn = "nul" -input_disk_prev = "nul" -input_disk_prev_axis = "nul" -input_disk_prev_btn = "nul" -input_disk_prev_mbtn = "nul" -input_driver = "dinput" -input_duty_cycle = "3" -input_enable_hotkey = "nul" -input_enable_hotkey_axis = "nul" -input_enable_hotkey_btn = "nul" -input_enable_hotkey_mbtn = "nul" -input_exit_emulator = "escape" -input_exit_emulator_axis = "nul" -input_exit_emulator_btn = "nul" -input_exit_emulator_mbtn = "nul" -input_frame_advance = "k" -input_frame_advance_axis = "nul" -input_frame_advance_btn = "nul" -input_frame_advance_mbtn = "nul" -input_game_focus_toggle = "scroll_lock" -input_game_focus_toggle_axis = "nul" -input_game_focus_toggle_btn = "nul" -input_game_focus_toggle_mbtn = "nul" -input_grab_mouse_toggle = "f11" -input_grab_mouse_toggle_axis = "nul" -input_grab_mouse_toggle_btn = "nul" -input_grab_mouse_toggle_mbtn = "nul" -input_hold_fast_forward = "l" -input_hold_fast_forward_axis = "nul" -input_hold_fast_forward_btn = "nul" -input_hold_fast_forward_mbtn = "nul" -input_hold_slowmotion = "e" -input_hold_slowmotion_axis = "nul" -input_hold_slowmotion_btn = "nul" -input_hold_slowmotion_mbtn = "nul" -input_joypad_driver = "xinput" -input_keyboard_layout = "" -input_libretro_device_p1 = "1" -input_libretro_device_p10 = "1" -input_libretro_device_p11 = "1" -input_libretro_device_p12 = "1" -input_libretro_device_p13 = "1" -input_libretro_device_p14 = "1" -input_libretro_device_p15 = "1" -input_libretro_device_p16 = "1" -input_libretro_device_p2 = "1" -input_libretro_device_p3 = "1" -input_libretro_device_p4 = "1" -input_libretro_device_p5 = "1" -input_libretro_device_p6 = "1" -input_libretro_device_p7 = "1" -input_libretro_device_p8 = "1" -input_libretro_device_p9 = "1" -input_load_state = "f4" -input_load_state_axis = "nul" -input_load_state_btn = "nul" -input_load_state_mbtn = "nul" -input_max_users = "5" -input_menu_toggle = "f1" -input_menu_toggle_axis = "nul" -input_menu_toggle_btn = "nul" -input_menu_toggle_gamepad_combo = "0" -input_menu_toggle_mbtn = "nul" -input_movie_record_toggle = "o" -input_movie_record_toggle_axis = "nul" -input_movie_record_toggle_btn = "nul" -input_movie_record_toggle_mbtn = "nul" -input_netplay_game_watch = "i" -input_netplay_game_watch_axis = "nul" -input_netplay_game_watch_btn = "nul" -input_netplay_game_watch_mbtn = "nul" -input_osk_toggle = "f12" -input_osk_toggle_axis = "nul" -input_osk_toggle_btn = "nul" -input_osk_toggle_mbtn = "nul" -input_overlay = "" -input_overlay_enable = "true" -input_overlay_enable_autopreferred = "true" -input_overlay_hide_in_menu = "true" -input_overlay_next = "nul" -input_overlay_next_axis = "nul" -input_overlay_next_btn = "nul" -input_overlay_next_mbtn = "nul" -input_overlay_opacity = "0.700000" -input_overlay_scale = "1.000000" -input_overlay_show_physical_inputs = "false" -input_overlay_show_physical_inputs_port = "0" -input_pause_toggle = "p" -input_pause_toggle_axis = "nul" -input_pause_toggle_btn = "nul" -input_pause_toggle_mbtn = "nul" -input_player10_a = "nul" -input_player10_a_axis = "nul" -input_player10_a_btn = "nul" -input_player10_a_mbtn = "nul" -input_player10_analog_dpad_mode = "0" -input_player10_b = "nul" -input_player10_b_axis = "nul" -input_player10_b_btn = "nul" -input_player10_b_mbtn = "nul" -input_player10_down = "nul" -input_player10_down_axis = "nul" -input_player10_down_btn = "nul" -input_player10_down_mbtn = "nul" -input_player10_gun_aux_a = "nul" -input_player10_gun_aux_a_axis = "nul" -input_player10_gun_aux_a_btn = "nul" -input_player10_gun_aux_a_mbtn = "nul" -input_player10_gun_aux_b = "nul" -input_player10_gun_aux_b_axis = "nul" -input_player10_gun_aux_b_btn = "nul" -input_player10_gun_aux_b_mbtn = "nul" -input_player10_gun_aux_c = "nul" -input_player10_gun_aux_c_axis = "nul" -input_player10_gun_aux_c_btn = "nul" -input_player10_gun_aux_c_mbtn = "nul" -input_player10_gun_dpad_down = "nul" -input_player10_gun_dpad_down_axis = "nul" -input_player10_gun_dpad_down_btn = "nul" -input_player10_gun_dpad_down_mbtn = "nul" -input_player10_gun_dpad_left = "nul" -input_player10_gun_dpad_left_axis = "nul" -input_player10_gun_dpad_left_btn = "nul" -input_player10_gun_dpad_left_mbtn = "nul" -input_player10_gun_dpad_right = "nul" -input_player10_gun_dpad_right_axis = "nul" -input_player10_gun_dpad_right_btn = "nul" -input_player10_gun_dpad_right_mbtn = "nul" -input_player10_gun_dpad_up = "nul" -input_player10_gun_dpad_up_axis = "nul" -input_player10_gun_dpad_up_btn = "nul" -input_player10_gun_dpad_up_mbtn = "nul" -input_player10_gun_offscreen_shot = "nul" -input_player10_gun_offscreen_shot_axis = "nul" -input_player10_gun_offscreen_shot_btn = "nul" -input_player10_gun_offscreen_shot_mbtn = "nul" -input_player10_gun_select = "nul" -input_player10_gun_select_axis = "nul" -input_player10_gun_select_btn = "nul" -input_player10_gun_select_mbtn = "nul" -input_player10_gun_start = "nul" -input_player10_gun_start_axis = "nul" -input_player10_gun_start_btn = "nul" -input_player10_gun_start_mbtn = "nul" -input_player10_gun_trigger = "nul" -input_player10_gun_trigger_axis = "nul" -input_player10_gun_trigger_btn = "nul" -input_player10_gun_trigger_mbtn = "nul" -input_player10_joypad_index = "9" -input_player10_l = "nul" -input_player10_l2 = "nul" -input_player10_l2_axis = "nul" -input_player10_l2_btn = "nul" -input_player10_l2_mbtn = "nul" -input_player10_l3 = "nul" -input_player10_l3_axis = "nul" -input_player10_l3_btn = "nul" -input_player10_l3_mbtn = "nul" -input_player10_l_axis = "nul" -input_player10_l_btn = "nul" -input_player10_l_mbtn = "nul" -input_player10_l_x_minus = "nul" -input_player10_l_x_minus_axis = "nul" -input_player10_l_x_minus_btn = "nul" -input_player10_l_x_minus_mbtn = "nul" -input_player10_l_x_plus = "nul" -input_player10_l_x_plus_axis = "nul" -input_player10_l_x_plus_btn = "nul" -input_player10_l_x_plus_mbtn = "nul" -input_player10_l_y_minus = "nul" -input_player10_l_y_minus_axis = "nul" -input_player10_l_y_minus_btn = "nul" -input_player10_l_y_minus_mbtn = "nul" -input_player10_l_y_plus = "nul" -input_player10_l_y_plus_axis = "nul" -input_player10_l_y_plus_btn = "nul" -input_player10_l_y_plus_mbtn = "nul" -input_player10_left = "nul" -input_player10_left_axis = "nul" -input_player10_left_btn = "nul" -input_player10_left_mbtn = "nul" -input_player10_mouse_index = "0" -input_player10_r = "nul" -input_player10_r2 = "nul" -input_player10_r2_axis = "nul" -input_player10_r2_btn = "nul" -input_player10_r2_mbtn = "nul" -input_player10_r3 = "nul" -input_player10_r3_axis = "nul" -input_player10_r3_btn = "nul" -input_player10_r3_mbtn = "nul" -input_player10_r_axis = "nul" -input_player10_r_btn = "nul" -input_player10_r_mbtn = "nul" -input_player10_r_x_minus = "nul" -input_player10_r_x_minus_axis = "nul" -input_player10_r_x_minus_btn = "nul" -input_player10_r_x_minus_mbtn = "nul" -input_player10_r_x_plus = "nul" -input_player10_r_x_plus_axis = "nul" -input_player10_r_x_plus_btn = "nul" -input_player10_r_x_plus_mbtn = "nul" -input_player10_r_y_minus = "nul" -input_player10_r_y_minus_axis = "nul" -input_player10_r_y_minus_btn = "nul" -input_player10_r_y_minus_mbtn = "nul" -input_player10_r_y_plus = "nul" -input_player10_r_y_plus_axis = "nul" -input_player10_r_y_plus_btn = "nul" -input_player10_r_y_plus_mbtn = "nul" -input_player10_right = "nul" -input_player10_right_axis = "nul" -input_player10_right_btn = "nul" -input_player10_right_mbtn = "nul" -input_player10_select = "nul" -input_player10_select_axis = "nul" -input_player10_select_btn = "nul" -input_player10_select_mbtn = "nul" -input_player10_start = "nul" -input_player10_start_axis = "nul" -input_player10_start_btn = "nul" -input_player10_start_mbtn = "nul" -input_player10_turbo = "nul" -input_player10_turbo_axis = "nul" -input_player10_turbo_btn = "nul" -input_player10_turbo_mbtn = "nul" -input_player10_up = "nul" -input_player10_up_axis = "nul" -input_player10_up_btn = "nul" -input_player10_up_mbtn = "nul" -input_player10_x = "nul" -input_player10_x_axis = "nul" -input_player10_x_btn = "nul" -input_player10_x_mbtn = "nul" -input_player10_y = "nul" -input_player10_y_axis = "nul" -input_player10_y_btn = "nul" -input_player10_y_mbtn = "nul" -input_player11_a = "nul" -input_player11_a_axis = "nul" -input_player11_a_btn = "nul" -input_player11_a_mbtn = "nul" -input_player11_analog_dpad_mode = "0" -input_player11_b = "nul" -input_player11_b_axis = "nul" -input_player11_b_btn = "nul" -input_player11_b_mbtn = "nul" -input_player11_down = "nul" -input_player11_down_axis = "nul" -input_player11_down_btn = "nul" -input_player11_down_mbtn = "nul" -input_player11_gun_aux_a = "nul" -input_player11_gun_aux_a_axis = "nul" -input_player11_gun_aux_a_btn = "nul" -input_player11_gun_aux_a_mbtn = "nul" -input_player11_gun_aux_b = "nul" -input_player11_gun_aux_b_axis = "nul" -input_player11_gun_aux_b_btn = "nul" -input_player11_gun_aux_b_mbtn = "nul" -input_player11_gun_aux_c = "nul" -input_player11_gun_aux_c_axis = "nul" -input_player11_gun_aux_c_btn = "nul" -input_player11_gun_aux_c_mbtn = "nul" -input_player11_gun_dpad_down = "nul" -input_player11_gun_dpad_down_axis = "nul" -input_player11_gun_dpad_down_btn = "nul" -input_player11_gun_dpad_down_mbtn = "nul" -input_player11_gun_dpad_left = "nul" -input_player11_gun_dpad_left_axis = "nul" -input_player11_gun_dpad_left_btn = "nul" -input_player11_gun_dpad_left_mbtn = "nul" -input_player11_gun_dpad_right = "nul" -input_player11_gun_dpad_right_axis = "nul" -input_player11_gun_dpad_right_btn = "nul" -input_player11_gun_dpad_right_mbtn = "nul" -input_player11_gun_dpad_up = "nul" -input_player11_gun_dpad_up_axis = "nul" -input_player11_gun_dpad_up_btn = "nul" -input_player11_gun_dpad_up_mbtn = "nul" -input_player11_gun_offscreen_shot = "nul" -input_player11_gun_offscreen_shot_axis = "nul" -input_player11_gun_offscreen_shot_btn = "nul" -input_player11_gun_offscreen_shot_mbtn = "nul" -input_player11_gun_select = "nul" -input_player11_gun_select_axis = "nul" -input_player11_gun_select_btn = "nul" -input_player11_gun_select_mbtn = "nul" -input_player11_gun_start = "nul" -input_player11_gun_start_axis = "nul" -input_player11_gun_start_btn = "nul" -input_player11_gun_start_mbtn = "nul" -input_player11_gun_trigger = "nul" -input_player11_gun_trigger_axis = "nul" -input_player11_gun_trigger_btn = "nul" -input_player11_gun_trigger_mbtn = "nul" -input_player11_joypad_index = "10" -input_player11_l = "nul" -input_player11_l2 = "nul" -input_player11_l2_axis = "nul" -input_player11_l2_btn = "nul" -input_player11_l2_mbtn = "nul" -input_player11_l3 = "nul" -input_player11_l3_axis = "nul" -input_player11_l3_btn = "nul" -input_player11_l3_mbtn = "nul" -input_player11_l_axis = "nul" -input_player11_l_btn = "nul" -input_player11_l_mbtn = "nul" -input_player11_l_x_minus = "nul" -input_player11_l_x_minus_axis = "nul" -input_player11_l_x_minus_btn = "nul" -input_player11_l_x_minus_mbtn = "nul" -input_player11_l_x_plus = "nul" -input_player11_l_x_plus_axis = "nul" -input_player11_l_x_plus_btn = "nul" -input_player11_l_x_plus_mbtn = "nul" -input_player11_l_y_minus = "nul" -input_player11_l_y_minus_axis = "nul" -input_player11_l_y_minus_btn = "nul" -input_player11_l_y_minus_mbtn = "nul" -input_player11_l_y_plus = "nul" -input_player11_l_y_plus_axis = "nul" -input_player11_l_y_plus_btn = "nul" -input_player11_l_y_plus_mbtn = "nul" -input_player11_left = "nul" -input_player11_left_axis = "nul" -input_player11_left_btn = "nul" -input_player11_left_mbtn = "nul" -input_player11_mouse_index = "0" -input_player11_r = "nul" -input_player11_r2 = "nul" -input_player11_r2_axis = "nul" -input_player11_r2_btn = "nul" -input_player11_r2_mbtn = "nul" -input_player11_r3 = "nul" -input_player11_r3_axis = "nul" -input_player11_r3_btn = "nul" -input_player11_r3_mbtn = "nul" -input_player11_r_axis = "nul" -input_player11_r_btn = "nul" -input_player11_r_mbtn = "nul" -input_player11_r_x_minus = "nul" -input_player11_r_x_minus_axis = "nul" -input_player11_r_x_minus_btn = "nul" -input_player11_r_x_minus_mbtn = "nul" -input_player11_r_x_plus = "nul" -input_player11_r_x_plus_axis = "nul" -input_player11_r_x_plus_btn = "nul" -input_player11_r_x_plus_mbtn = "nul" -input_player11_r_y_minus = "nul" -input_player11_r_y_minus_axis = "nul" -input_player11_r_y_minus_btn = "nul" -input_player11_r_y_minus_mbtn = "nul" -input_player11_r_y_plus = "nul" -input_player11_r_y_plus_axis = "nul" -input_player11_r_y_plus_btn = "nul" -input_player11_r_y_plus_mbtn = "nul" -input_player11_right = "nul" -input_player11_right_axis = "nul" -input_player11_right_btn = "nul" -input_player11_right_mbtn = "nul" -input_player11_select = "nul" -input_player11_select_axis = "nul" -input_player11_select_btn = "nul" -input_player11_select_mbtn = "nul" -input_player11_start = "nul" -input_player11_start_axis = "nul" -input_player11_start_btn = "nul" -input_player11_start_mbtn = "nul" -input_player11_turbo = "nul" -input_player11_turbo_axis = "nul" -input_player11_turbo_btn = "nul" -input_player11_turbo_mbtn = "nul" -input_player11_up = "nul" -input_player11_up_axis = "nul" -input_player11_up_btn = "nul" -input_player11_up_mbtn = "nul" -input_player11_x = "nul" -input_player11_x_axis = "nul" -input_player11_x_btn = "nul" -input_player11_x_mbtn = "nul" -input_player11_y = "nul" -input_player11_y_axis = "nul" -input_player11_y_btn = "nul" -input_player11_y_mbtn = "nul" -input_player12_a = "nul" -input_player12_a_axis = "nul" -input_player12_a_btn = "nul" -input_player12_a_mbtn = "nul" -input_player12_analog_dpad_mode = "0" -input_player12_b = "nul" -input_player12_b_axis = "nul" -input_player12_b_btn = "nul" -input_player12_b_mbtn = "nul" -input_player12_down = "nul" -input_player12_down_axis = "nul" -input_player12_down_btn = "nul" -input_player12_down_mbtn = "nul" -input_player12_gun_aux_a = "nul" -input_player12_gun_aux_a_axis = "nul" -input_player12_gun_aux_a_btn = "nul" -input_player12_gun_aux_a_mbtn = "nul" -input_player12_gun_aux_b = "nul" -input_player12_gun_aux_b_axis = "nul" -input_player12_gun_aux_b_btn = "nul" -input_player12_gun_aux_b_mbtn = "nul" -input_player12_gun_aux_c = "nul" -input_player12_gun_aux_c_axis = "nul" -input_player12_gun_aux_c_btn = "nul" -input_player12_gun_aux_c_mbtn = "nul" -input_player12_gun_dpad_down = "nul" -input_player12_gun_dpad_down_axis = "nul" -input_player12_gun_dpad_down_btn = "nul" -input_player12_gun_dpad_down_mbtn = "nul" -input_player12_gun_dpad_left = "nul" -input_player12_gun_dpad_left_axis = "nul" -input_player12_gun_dpad_left_btn = "nul" -input_player12_gun_dpad_left_mbtn = "nul" -input_player12_gun_dpad_right = "nul" -input_player12_gun_dpad_right_axis = "nul" -input_player12_gun_dpad_right_btn = "nul" -input_player12_gun_dpad_right_mbtn = "nul" -input_player12_gun_dpad_up = "nul" -input_player12_gun_dpad_up_axis = "nul" -input_player12_gun_dpad_up_btn = "nul" -input_player12_gun_dpad_up_mbtn = "nul" -input_player12_gun_offscreen_shot = "nul" -input_player12_gun_offscreen_shot_axis = "nul" -input_player12_gun_offscreen_shot_btn = "nul" -input_player12_gun_offscreen_shot_mbtn = "nul" -input_player12_gun_select = "nul" -input_player12_gun_select_axis = "nul" -input_player12_gun_select_btn = "nul" -input_player12_gun_select_mbtn = "nul" -input_player12_gun_start = "nul" -input_player12_gun_start_axis = "nul" -input_player12_gun_start_btn = "nul" -input_player12_gun_start_mbtn = "nul" -input_player12_gun_trigger = "nul" -input_player12_gun_trigger_axis = "nul" -input_player12_gun_trigger_btn = "nul" -input_player12_gun_trigger_mbtn = "nul" -input_player12_joypad_index = "11" -input_player12_l = "nul" -input_player12_l2 = "nul" -input_player12_l2_axis = "nul" -input_player12_l2_btn = "nul" -input_player12_l2_mbtn = "nul" -input_player12_l3 = "nul" -input_player12_l3_axis = "nul" -input_player12_l3_btn = "nul" -input_player12_l3_mbtn = "nul" -input_player12_l_axis = "nul" -input_player12_l_btn = "nul" -input_player12_l_mbtn = "nul" -input_player12_l_x_minus = "nul" -input_player12_l_x_minus_axis = "nul" -input_player12_l_x_minus_btn = "nul" -input_player12_l_x_minus_mbtn = "nul" -input_player12_l_x_plus = "nul" -input_player12_l_x_plus_axis = "nul" -input_player12_l_x_plus_btn = "nul" -input_player12_l_x_plus_mbtn = "nul" -input_player12_l_y_minus = "nul" -input_player12_l_y_minus_axis = "nul" -input_player12_l_y_minus_btn = "nul" -input_player12_l_y_minus_mbtn = "nul" -input_player12_l_y_plus = "nul" -input_player12_l_y_plus_axis = "nul" -input_player12_l_y_plus_btn = "nul" -input_player12_l_y_plus_mbtn = "nul" -input_player12_left = "nul" -input_player12_left_axis = "nul" -input_player12_left_btn = "nul" -input_player12_left_mbtn = "nul" -input_player12_mouse_index = "0" -input_player12_r = "nul" -input_player12_r2 = "nul" -input_player12_r2_axis = "nul" -input_player12_r2_btn = "nul" -input_player12_r2_mbtn = "nul" -input_player12_r3 = "nul" -input_player12_r3_axis = "nul" -input_player12_r3_btn = "nul" -input_player12_r3_mbtn = "nul" -input_player12_r_axis = "nul" -input_player12_r_btn = "nul" -input_player12_r_mbtn = "nul" -input_player12_r_x_minus = "nul" -input_player12_r_x_minus_axis = "nul" -input_player12_r_x_minus_btn = "nul" -input_player12_r_x_minus_mbtn = "nul" -input_player12_r_x_plus = "nul" -input_player12_r_x_plus_axis = "nul" -input_player12_r_x_plus_btn = "nul" -input_player12_r_x_plus_mbtn = "nul" -input_player12_r_y_minus = "nul" -input_player12_r_y_minus_axis = "nul" -input_player12_r_y_minus_btn = "nul" -input_player12_r_y_minus_mbtn = "nul" -input_player12_r_y_plus = "nul" -input_player12_r_y_plus_axis = "nul" -input_player12_r_y_plus_btn = "nul" -input_player12_r_y_plus_mbtn = "nul" -input_player12_right = "nul" -input_player12_right_axis = "nul" -input_player12_right_btn = "nul" -input_player12_right_mbtn = "nul" -input_player12_select = "nul" -input_player12_select_axis = "nul" -input_player12_select_btn = "nul" -input_player12_select_mbtn = "nul" -input_player12_start = "nul" -input_player12_start_axis = "nul" -input_player12_start_btn = "nul" -input_player12_start_mbtn = "nul" -input_player12_turbo = "nul" -input_player12_turbo_axis = "nul" -input_player12_turbo_btn = "nul" -input_player12_turbo_mbtn = "nul" -input_player12_up = "nul" -input_player12_up_axis = "nul" -input_player12_up_btn = "nul" -input_player12_up_mbtn = "nul" -input_player12_x = "nul" -input_player12_x_axis = "nul" -input_player12_x_btn = "nul" -input_player12_x_mbtn = "nul" -input_player12_y = "nul" -input_player12_y_axis = "nul" -input_player12_y_btn = "nul" -input_player12_y_mbtn = "nul" -input_player13_a = "nul" -input_player13_a_axis = "nul" -input_player13_a_btn = "nul" -input_player13_a_mbtn = "nul" -input_player13_analog_dpad_mode = "0" -input_player13_b = "nul" -input_player13_b_axis = "nul" -input_player13_b_btn = "nul" -input_player13_b_mbtn = "nul" -input_player13_down = "nul" -input_player13_down_axis = "nul" -input_player13_down_btn = "nul" -input_player13_down_mbtn = "nul" -input_player13_gun_aux_a = "nul" -input_player13_gun_aux_a_axis = "nul" -input_player13_gun_aux_a_btn = "nul" -input_player13_gun_aux_a_mbtn = "nul" -input_player13_gun_aux_b = "nul" -input_player13_gun_aux_b_axis = "nul" -input_player13_gun_aux_b_btn = "nul" -input_player13_gun_aux_b_mbtn = "nul" -input_player13_gun_aux_c = "nul" -input_player13_gun_aux_c_axis = "nul" -input_player13_gun_aux_c_btn = "nul" -input_player13_gun_aux_c_mbtn = "nul" -input_player13_gun_dpad_down = "nul" -input_player13_gun_dpad_down_axis = "nul" -input_player13_gun_dpad_down_btn = "nul" -input_player13_gun_dpad_down_mbtn = "nul" -input_player13_gun_dpad_left = "nul" -input_player13_gun_dpad_left_axis = "nul" -input_player13_gun_dpad_left_btn = "nul" -input_player13_gun_dpad_left_mbtn = "nul" -input_player13_gun_dpad_right = "nul" -input_player13_gun_dpad_right_axis = "nul" -input_player13_gun_dpad_right_btn = "nul" -input_player13_gun_dpad_right_mbtn = "nul" -input_player13_gun_dpad_up = "nul" -input_player13_gun_dpad_up_axis = "nul" -input_player13_gun_dpad_up_btn = "nul" -input_player13_gun_dpad_up_mbtn = "nul" -input_player13_gun_offscreen_shot = "nul" -input_player13_gun_offscreen_shot_axis = "nul" -input_player13_gun_offscreen_shot_btn = "nul" -input_player13_gun_offscreen_shot_mbtn = "nul" -input_player13_gun_select = "nul" -input_player13_gun_select_axis = "nul" -input_player13_gun_select_btn = "nul" -input_player13_gun_select_mbtn = "nul" -input_player13_gun_start = "nul" -input_player13_gun_start_axis = "nul" -input_player13_gun_start_btn = "nul" -input_player13_gun_start_mbtn = "nul" -input_player13_gun_trigger = "nul" -input_player13_gun_trigger_axis = "nul" -input_player13_gun_trigger_btn = "nul" -input_player13_gun_trigger_mbtn = "nul" -input_player13_joypad_index = "12" -input_player13_l = "nul" -input_player13_l2 = "nul" -input_player13_l2_axis = "nul" -input_player13_l2_btn = "nul" -input_player13_l2_mbtn = "nul" -input_player13_l3 = "nul" -input_player13_l3_axis = "nul" -input_player13_l3_btn = "nul" -input_player13_l3_mbtn = "nul" -input_player13_l_axis = "nul" -input_player13_l_btn = "nul" -input_player13_l_mbtn = "nul" -input_player13_l_x_minus = "nul" -input_player13_l_x_minus_axis = "nul" -input_player13_l_x_minus_btn = "nul" -input_player13_l_x_minus_mbtn = "nul" -input_player13_l_x_plus = "nul" -input_player13_l_x_plus_axis = "nul" -input_player13_l_x_plus_btn = "nul" -input_player13_l_x_plus_mbtn = "nul" -input_player13_l_y_minus = "nul" -input_player13_l_y_minus_axis = "nul" -input_player13_l_y_minus_btn = "nul" -input_player13_l_y_minus_mbtn = "nul" -input_player13_l_y_plus = "nul" -input_player13_l_y_plus_axis = "nul" -input_player13_l_y_plus_btn = "nul" -input_player13_l_y_plus_mbtn = "nul" -input_player13_left = "nul" -input_player13_left_axis = "nul" -input_player13_left_btn = "nul" -input_player13_left_mbtn = "nul" -input_player13_mouse_index = "0" -input_player13_r = "nul" -input_player13_r2 = "nul" -input_player13_r2_axis = "nul" -input_player13_r2_btn = "nul" -input_player13_r2_mbtn = "nul" -input_player13_r3 = "nul" -input_player13_r3_axis = "nul" -input_player13_r3_btn = "nul" -input_player13_r3_mbtn = "nul" -input_player13_r_axis = "nul" -input_player13_r_btn = "nul" -input_player13_r_mbtn = "nul" -input_player13_r_x_minus = "nul" -input_player13_r_x_minus_axis = "nul" -input_player13_r_x_minus_btn = "nul" -input_player13_r_x_minus_mbtn = "nul" -input_player13_r_x_plus = "nul" -input_player13_r_x_plus_axis = "nul" -input_player13_r_x_plus_btn = "nul" -input_player13_r_x_plus_mbtn = "nul" -input_player13_r_y_minus = "nul" -input_player13_r_y_minus_axis = "nul" -input_player13_r_y_minus_btn = "nul" -input_player13_r_y_minus_mbtn = "nul" -input_player13_r_y_plus = "nul" -input_player13_r_y_plus_axis = "nul" -input_player13_r_y_plus_btn = "nul" -input_player13_r_y_plus_mbtn = "nul" -input_player13_right = "nul" -input_player13_right_axis = "nul" -input_player13_right_btn = "nul" -input_player13_right_mbtn = "nul" -input_player13_select = "nul" -input_player13_select_axis = "nul" -input_player13_select_btn = "nul" -input_player13_select_mbtn = "nul" -input_player13_start = "nul" -input_player13_start_axis = "nul" -input_player13_start_btn = "nul" -input_player13_start_mbtn = "nul" -input_player13_turbo = "nul" -input_player13_turbo_axis = "nul" -input_player13_turbo_btn = "nul" -input_player13_turbo_mbtn = "nul" -input_player13_up = "nul" -input_player13_up_axis = "nul" -input_player13_up_btn = "nul" -input_player13_up_mbtn = "nul" -input_player13_x = "nul" -input_player13_x_axis = "nul" -input_player13_x_btn = "nul" -input_player13_x_mbtn = "nul" -input_player13_y = "nul" -input_player13_y_axis = "nul" -input_player13_y_btn = "nul" -input_player13_y_mbtn = "nul" -input_player14_a = "nul" -input_player14_a_axis = "nul" -input_player14_a_btn = "nul" -input_player14_a_mbtn = "nul" -input_player14_analog_dpad_mode = "0" -input_player14_b = "nul" -input_player14_b_axis = "nul" -input_player14_b_btn = "nul" -input_player14_b_mbtn = "nul" -input_player14_down = "nul" -input_player14_down_axis = "nul" -input_player14_down_btn = "nul" -input_player14_down_mbtn = "nul" -input_player14_gun_aux_a = "nul" -input_player14_gun_aux_a_axis = "nul" -input_player14_gun_aux_a_btn = "nul" -input_player14_gun_aux_a_mbtn = "nul" -input_player14_gun_aux_b = "nul" -input_player14_gun_aux_b_axis = "nul" -input_player14_gun_aux_b_btn = "nul" -input_player14_gun_aux_b_mbtn = "nul" -input_player14_gun_aux_c = "nul" -input_player14_gun_aux_c_axis = "nul" -input_player14_gun_aux_c_btn = "nul" -input_player14_gun_aux_c_mbtn = "nul" -input_player14_gun_dpad_down = "nul" -input_player14_gun_dpad_down_axis = "nul" -input_player14_gun_dpad_down_btn = "nul" -input_player14_gun_dpad_down_mbtn = "nul" -input_player14_gun_dpad_left = "nul" -input_player14_gun_dpad_left_axis = "nul" -input_player14_gun_dpad_left_btn = "nul" -input_player14_gun_dpad_left_mbtn = "nul" -input_player14_gun_dpad_right = "nul" -input_player14_gun_dpad_right_axis = "nul" -input_player14_gun_dpad_right_btn = "nul" -input_player14_gun_dpad_right_mbtn = "nul" -input_player14_gun_dpad_up = "nul" -input_player14_gun_dpad_up_axis = "nul" -input_player14_gun_dpad_up_btn = "nul" -input_player14_gun_dpad_up_mbtn = "nul" -input_player14_gun_offscreen_shot = "nul" -input_player14_gun_offscreen_shot_axis = "nul" -input_player14_gun_offscreen_shot_btn = "nul" -input_player14_gun_offscreen_shot_mbtn = "nul" -input_player14_gun_select = "nul" -input_player14_gun_select_axis = "nul" -input_player14_gun_select_btn = "nul" -input_player14_gun_select_mbtn = "nul" -input_player14_gun_start = "nul" -input_player14_gun_start_axis = "nul" -input_player14_gun_start_btn = "nul" -input_player14_gun_start_mbtn = "nul" -input_player14_gun_trigger = "nul" -input_player14_gun_trigger_axis = "nul" -input_player14_gun_trigger_btn = "nul" -input_player14_gun_trigger_mbtn = "nul" -input_player14_joypad_index = "13" -input_player14_l = "nul" -input_player14_l2 = "nul" -input_player14_l2_axis = "nul" -input_player14_l2_btn = "nul" -input_player14_l2_mbtn = "nul" -input_player14_l3 = "nul" -input_player14_l3_axis = "nul" -input_player14_l3_btn = "nul" -input_player14_l3_mbtn = "nul" -input_player14_l_axis = "nul" -input_player14_l_btn = "nul" -input_player14_l_mbtn = "nul" -input_player14_l_x_minus = "nul" -input_player14_l_x_minus_axis = "nul" -input_player14_l_x_minus_btn = "nul" -input_player14_l_x_minus_mbtn = "nul" -input_player14_l_x_plus = "nul" -input_player14_l_x_plus_axis = "nul" -input_player14_l_x_plus_btn = "nul" -input_player14_l_x_plus_mbtn = "nul" -input_player14_l_y_minus = "nul" -input_player14_l_y_minus_axis = "nul" -input_player14_l_y_minus_btn = "nul" -input_player14_l_y_minus_mbtn = "nul" -input_player14_l_y_plus = "nul" -input_player14_l_y_plus_axis = "nul" -input_player14_l_y_plus_btn = "nul" -input_player14_l_y_plus_mbtn = "nul" -input_player14_left = "nul" -input_player14_left_axis = "nul" -input_player14_left_btn = "nul" -input_player14_left_mbtn = "nul" -input_player14_mouse_index = "0" -input_player14_r = "nul" -input_player14_r2 = "nul" -input_player14_r2_axis = "nul" -input_player14_r2_btn = "nul" -input_player14_r2_mbtn = "nul" -input_player14_r3 = "nul" -input_player14_r3_axis = "nul" -input_player14_r3_btn = "nul" -input_player14_r3_mbtn = "nul" -input_player14_r_axis = "nul" -input_player14_r_btn = "nul" -input_player14_r_mbtn = "nul" -input_player14_r_x_minus = "nul" -input_player14_r_x_minus_axis = "nul" -input_player14_r_x_minus_btn = "nul" -input_player14_r_x_minus_mbtn = "nul" -input_player14_r_x_plus = "nul" -input_player14_r_x_plus_axis = "nul" -input_player14_r_x_plus_btn = "nul" -input_player14_r_x_plus_mbtn = "nul" -input_player14_r_y_minus = "nul" -input_player14_r_y_minus_axis = "nul" -input_player14_r_y_minus_btn = "nul" -input_player14_r_y_minus_mbtn = "nul" -input_player14_r_y_plus = "nul" -input_player14_r_y_plus_axis = "nul" -input_player14_r_y_plus_btn = "nul" -input_player14_r_y_plus_mbtn = "nul" -input_player14_right = "nul" -input_player14_right_axis = "nul" -input_player14_right_btn = "nul" -input_player14_right_mbtn = "nul" -input_player14_select = "nul" -input_player14_select_axis = "nul" -input_player14_select_btn = "nul" -input_player14_select_mbtn = "nul" -input_player14_start = "nul" -input_player14_start_axis = "nul" -input_player14_start_btn = "nul" -input_player14_start_mbtn = "nul" -input_player14_turbo = "nul" -input_player14_turbo_axis = "nul" -input_player14_turbo_btn = "nul" -input_player14_turbo_mbtn = "nul" -input_player14_up = "nul" -input_player14_up_axis = "nul" -input_player14_up_btn = "nul" -input_player14_up_mbtn = "nul" -input_player14_x = "nul" -input_player14_x_axis = "nul" -input_player14_x_btn = "nul" -input_player14_x_mbtn = "nul" -input_player14_y = "nul" -input_player14_y_axis = "nul" -input_player14_y_btn = "nul" -input_player14_y_mbtn = "nul" -input_player15_a = "nul" -input_player15_a_axis = "nul" -input_player15_a_btn = "nul" -input_player15_a_mbtn = "nul" -input_player15_analog_dpad_mode = "0" -input_player15_b = "nul" -input_player15_b_axis = "nul" -input_player15_b_btn = "nul" -input_player15_b_mbtn = "nul" -input_player15_down = "nul" -input_player15_down_axis = "nul" -input_player15_down_btn = "nul" -input_player15_down_mbtn = "nul" -input_player15_gun_aux_a = "nul" -input_player15_gun_aux_a_axis = "nul" -input_player15_gun_aux_a_btn = "nul" -input_player15_gun_aux_a_mbtn = "nul" -input_player15_gun_aux_b = "nul" -input_player15_gun_aux_b_axis = "nul" -input_player15_gun_aux_b_btn = "nul" -input_player15_gun_aux_b_mbtn = "nul" -input_player15_gun_aux_c = "nul" -input_player15_gun_aux_c_axis = "nul" -input_player15_gun_aux_c_btn = "nul" -input_player15_gun_aux_c_mbtn = "nul" -input_player15_gun_dpad_down = "nul" -input_player15_gun_dpad_down_axis = "nul" -input_player15_gun_dpad_down_btn = "nul" -input_player15_gun_dpad_down_mbtn = "nul" -input_player15_gun_dpad_left = "nul" -input_player15_gun_dpad_left_axis = "nul" -input_player15_gun_dpad_left_btn = "nul" -input_player15_gun_dpad_left_mbtn = "nul" -input_player15_gun_dpad_right = "nul" -input_player15_gun_dpad_right_axis = "nul" -input_player15_gun_dpad_right_btn = "nul" -input_player15_gun_dpad_right_mbtn = "nul" -input_player15_gun_dpad_up = "nul" -input_player15_gun_dpad_up_axis = "nul" -input_player15_gun_dpad_up_btn = "nul" -input_player15_gun_dpad_up_mbtn = "nul" -input_player15_gun_offscreen_shot = "nul" -input_player15_gun_offscreen_shot_axis = "nul" -input_player15_gun_offscreen_shot_btn = "nul" -input_player15_gun_offscreen_shot_mbtn = "nul" -input_player15_gun_select = "nul" -input_player15_gun_select_axis = "nul" -input_player15_gun_select_btn = "nul" -input_player15_gun_select_mbtn = "nul" -input_player15_gun_start = "nul" -input_player15_gun_start_axis = "nul" -input_player15_gun_start_btn = "nul" -input_player15_gun_start_mbtn = "nul" -input_player15_gun_trigger = "nul" -input_player15_gun_trigger_axis = "nul" -input_player15_gun_trigger_btn = "nul" -input_player15_gun_trigger_mbtn = "nul" -input_player15_joypad_index = "14" -input_player15_l = "nul" -input_player15_l2 = "nul" -input_player15_l2_axis = "nul" -input_player15_l2_btn = "nul" -input_player15_l2_mbtn = "nul" -input_player15_l3 = "nul" -input_player15_l3_axis = "nul" -input_player15_l3_btn = "nul" -input_player15_l3_mbtn = "nul" -input_player15_l_axis = "nul" -input_player15_l_btn = "nul" -input_player15_l_mbtn = "nul" -input_player15_l_x_minus = "nul" -input_player15_l_x_minus_axis = "nul" -input_player15_l_x_minus_btn = "nul" -input_player15_l_x_minus_mbtn = "nul" -input_player15_l_x_plus = "nul" -input_player15_l_x_plus_axis = "nul" -input_player15_l_x_plus_btn = "nul" -input_player15_l_x_plus_mbtn = "nul" -input_player15_l_y_minus = "nul" -input_player15_l_y_minus_axis = "nul" -input_player15_l_y_minus_btn = "nul" -input_player15_l_y_minus_mbtn = "nul" -input_player15_l_y_plus = "nul" -input_player15_l_y_plus_axis = "nul" -input_player15_l_y_plus_btn = "nul" -input_player15_l_y_plus_mbtn = "nul" -input_player15_left = "nul" -input_player15_left_axis = "nul" -input_player15_left_btn = "nul" -input_player15_left_mbtn = "nul" -input_player15_mouse_index = "0" -input_player15_r = "nul" -input_player15_r2 = "nul" -input_player15_r2_axis = "nul" -input_player15_r2_btn = "nul" -input_player15_r2_mbtn = "nul" -input_player15_r3 = "nul" -input_player15_r3_axis = "nul" -input_player15_r3_btn = "nul" -input_player15_r3_mbtn = "nul" -input_player15_r_axis = "nul" -input_player15_r_btn = "nul" -input_player15_r_mbtn = "nul" -input_player15_r_x_minus = "nul" -input_player15_r_x_minus_axis = "nul" -input_player15_r_x_minus_btn = "nul" -input_player15_r_x_minus_mbtn = "nul" -input_player15_r_x_plus = "nul" -input_player15_r_x_plus_axis = "nul" -input_player15_r_x_plus_btn = "nul" -input_player15_r_x_plus_mbtn = "nul" -input_player15_r_y_minus = "nul" -input_player15_r_y_minus_axis = "nul" -input_player15_r_y_minus_btn = "nul" -input_player15_r_y_minus_mbtn = "nul" -input_player15_r_y_plus = "nul" -input_player15_r_y_plus_axis = "nul" -input_player15_r_y_plus_btn = "nul" -input_player15_r_y_plus_mbtn = "nul" -input_player15_right = "nul" -input_player15_right_axis = "nul" -input_player15_right_btn = "nul" -input_player15_right_mbtn = "nul" -input_player15_select = "nul" -input_player15_select_axis = "nul" -input_player15_select_btn = "nul" -input_player15_select_mbtn = "nul" -input_player15_start = "nul" -input_player15_start_axis = "nul" -input_player15_start_btn = "nul" -input_player15_start_mbtn = "nul" -input_player15_turbo = "nul" -input_player15_turbo_axis = "nul" -input_player15_turbo_btn = "nul" -input_player15_turbo_mbtn = "nul" -input_player15_up = "nul" -input_player15_up_axis = "nul" -input_player15_up_btn = "nul" -input_player15_up_mbtn = "nul" -input_player15_x = "nul" -input_player15_x_axis = "nul" -input_player15_x_btn = "nul" -input_player15_x_mbtn = "nul" -input_player15_y = "nul" -input_player15_y_axis = "nul" -input_player15_y_btn = "nul" -input_player15_y_mbtn = "nul" -input_player16_a = "nul" -input_player16_a_axis = "nul" -input_player16_a_btn = "nul" -input_player16_a_mbtn = "nul" -input_player16_analog_dpad_mode = "0" -input_player16_b = "nul" -input_player16_b_axis = "nul" -input_player16_b_btn = "nul" -input_player16_b_mbtn = "nul" -input_player16_down = "nul" -input_player16_down_axis = "nul" -input_player16_down_btn = "nul" -input_player16_down_mbtn = "nul" -input_player16_gun_aux_a = "nul" -input_player16_gun_aux_a_axis = "nul" -input_player16_gun_aux_a_btn = "nul" -input_player16_gun_aux_a_mbtn = "nul" -input_player16_gun_aux_b = "nul" -input_player16_gun_aux_b_axis = "nul" -input_player16_gun_aux_b_btn = "nul" -input_player16_gun_aux_b_mbtn = "nul" -input_player16_gun_aux_c = "nul" -input_player16_gun_aux_c_axis = "nul" -input_player16_gun_aux_c_btn = "nul" -input_player16_gun_aux_c_mbtn = "nul" -input_player16_gun_dpad_down = "nul" -input_player16_gun_dpad_down_axis = "nul" -input_player16_gun_dpad_down_btn = "nul" -input_player16_gun_dpad_down_mbtn = "nul" -input_player16_gun_dpad_left = "nul" -input_player16_gun_dpad_left_axis = "nul" -input_player16_gun_dpad_left_btn = "nul" -input_player16_gun_dpad_left_mbtn = "nul" -input_player16_gun_dpad_right = "nul" -input_player16_gun_dpad_right_axis = "nul" -input_player16_gun_dpad_right_btn = "nul" -input_player16_gun_dpad_right_mbtn = "nul" -input_player16_gun_dpad_up = "nul" -input_player16_gun_dpad_up_axis = "nul" -input_player16_gun_dpad_up_btn = "nul" -input_player16_gun_dpad_up_mbtn = "nul" -input_player16_gun_offscreen_shot = "nul" -input_player16_gun_offscreen_shot_axis = "nul" -input_player16_gun_offscreen_shot_btn = "nul" -input_player16_gun_offscreen_shot_mbtn = "nul" -input_player16_gun_select = "nul" -input_player16_gun_select_axis = "nul" -input_player16_gun_select_btn = "nul" -input_player16_gun_select_mbtn = "nul" -input_player16_gun_start = "nul" -input_player16_gun_start_axis = "nul" -input_player16_gun_start_btn = "nul" -input_player16_gun_start_mbtn = "nul" -input_player16_gun_trigger = "nul" -input_player16_gun_trigger_axis = "nul" -input_player16_gun_trigger_btn = "nul" -input_player16_gun_trigger_mbtn = "nul" -input_player16_joypad_index = "15" -input_player16_l = "nul" -input_player16_l2 = "nul" -input_player16_l2_axis = "nul" -input_player16_l2_btn = "nul" -input_player16_l2_mbtn = "nul" -input_player16_l3 = "nul" -input_player16_l3_axis = "nul" -input_player16_l3_btn = "nul" -input_player16_l3_mbtn = "nul" -input_player16_l_axis = "nul" -input_player16_l_btn = "nul" -input_player16_l_mbtn = "nul" -input_player16_l_x_minus = "nul" -input_player16_l_x_minus_axis = "nul" -input_player16_l_x_minus_btn = "nul" -input_player16_l_x_minus_mbtn = "nul" -input_player16_l_x_plus = "nul" -input_player16_l_x_plus_axis = "nul" -input_player16_l_x_plus_btn = "nul" -input_player16_l_x_plus_mbtn = "nul" -input_player16_l_y_minus = "nul" -input_player16_l_y_minus_axis = "nul" -input_player16_l_y_minus_btn = "nul" -input_player16_l_y_minus_mbtn = "nul" -input_player16_l_y_plus = "nul" -input_player16_l_y_plus_axis = "nul" -input_player16_l_y_plus_btn = "nul" -input_player16_l_y_plus_mbtn = "nul" -input_player16_left = "nul" -input_player16_left_axis = "nul" -input_player16_left_btn = "nul" -input_player16_left_mbtn = "nul" -input_player16_mouse_index = "0" -input_player16_r = "nul" -input_player16_r2 = "nul" -input_player16_r2_axis = "nul" -input_player16_r2_btn = "nul" -input_player16_r2_mbtn = "nul" -input_player16_r3 = "nul" -input_player16_r3_axis = "nul" -input_player16_r3_btn = "nul" -input_player16_r3_mbtn = "nul" -input_player16_r_axis = "nul" -input_player16_r_btn = "nul" -input_player16_r_mbtn = "nul" -input_player16_r_x_minus = "nul" -input_player16_r_x_minus_axis = "nul" -input_player16_r_x_minus_btn = "nul" -input_player16_r_x_minus_mbtn = "nul" -input_player16_r_x_plus = "nul" -input_player16_r_x_plus_axis = "nul" -input_player16_r_x_plus_btn = "nul" -input_player16_r_x_plus_mbtn = "nul" -input_player16_r_y_minus = "nul" -input_player16_r_y_minus_axis = "nul" -input_player16_r_y_minus_btn = "nul" -input_player16_r_y_minus_mbtn = "nul" -input_player16_r_y_plus = "nul" -input_player16_r_y_plus_axis = "nul" -input_player16_r_y_plus_btn = "nul" -input_player16_r_y_plus_mbtn = "nul" -input_player16_right = "nul" -input_player16_right_axis = "nul" -input_player16_right_btn = "nul" -input_player16_right_mbtn = "nul" -input_player16_select = "nul" -input_player16_select_axis = "nul" -input_player16_select_btn = "nul" -input_player16_select_mbtn = "nul" -input_player16_start = "nul" -input_player16_start_axis = "nul" -input_player16_start_btn = "nul" -input_player16_start_mbtn = "nul" -input_player16_turbo = "nul" -input_player16_turbo_axis = "nul" -input_player16_turbo_btn = "nul" -input_player16_turbo_mbtn = "nul" -input_player16_up = "nul" -input_player16_up_axis = "nul" -input_player16_up_btn = "nul" -input_player16_up_mbtn = "nul" -input_player16_x = "nul" -input_player16_x_axis = "nul" -input_player16_x_btn = "nul" -input_player16_x_mbtn = "nul" -input_player16_y = "nul" -input_player16_y_axis = "nul" -input_player16_y_btn = "nul" -input_player16_y_mbtn = "nul" -input_player1_a = "x" -input_player1_a_axis = "nul" -input_player1_a_btn = "nul" -input_player1_a_mbtn = "nul" -input_player1_analog_dpad_mode = "0" -input_player1_b = "z" -input_player1_b_axis = "nul" -input_player1_b_btn = "nul" -input_player1_b_mbtn = "nul" -input_player1_down = "down" -input_player1_down_axis = "nul" -input_player1_down_btn = "nul" -input_player1_down_mbtn = "nul" -input_player1_gun_aux_a = "nul" -input_player1_gun_aux_a_axis = "nul" -input_player1_gun_aux_a_btn = "nul" -input_player1_gun_aux_a_mbtn = "nul" -input_player1_gun_aux_b = "nul" -input_player1_gun_aux_b_axis = "nul" -input_player1_gun_aux_b_btn = "nul" -input_player1_gun_aux_b_mbtn = "nul" -input_player1_gun_aux_c = "nul" -input_player1_gun_aux_c_axis = "nul" -input_player1_gun_aux_c_btn = "nul" -input_player1_gun_aux_c_mbtn = "nul" -input_player1_gun_dpad_down = "nul" -input_player1_gun_dpad_down_axis = "nul" -input_player1_gun_dpad_down_btn = "nul" -input_player1_gun_dpad_down_mbtn = "nul" -input_player1_gun_dpad_left = "nul" -input_player1_gun_dpad_left_axis = "nul" -input_player1_gun_dpad_left_btn = "nul" -input_player1_gun_dpad_left_mbtn = "nul" -input_player1_gun_dpad_right = "nul" -input_player1_gun_dpad_right_axis = "nul" -input_player1_gun_dpad_right_btn = "nul" -input_player1_gun_dpad_right_mbtn = "nul" -input_player1_gun_dpad_up = "nul" -input_player1_gun_dpad_up_axis = "nul" -input_player1_gun_dpad_up_btn = "nul" -input_player1_gun_dpad_up_mbtn = "nul" -input_player1_gun_offscreen_shot = "nul" -input_player1_gun_offscreen_shot_axis = "nul" -input_player1_gun_offscreen_shot_btn = "nul" -input_player1_gun_offscreen_shot_mbtn = "nul" -input_player1_gun_select = "nul" -input_player1_gun_select_axis = "nul" -input_player1_gun_select_btn = "nul" -input_player1_gun_select_mbtn = "nul" -input_player1_gun_start = "nul" -input_player1_gun_start_axis = "nul" -input_player1_gun_start_btn = "nul" -input_player1_gun_start_mbtn = "nul" -input_player1_gun_trigger = "nul" -input_player1_gun_trigger_axis = "nul" -input_player1_gun_trigger_btn = "nul" -input_player1_gun_trigger_mbtn = "nul" -input_player1_joypad_index = "0" -input_player1_l = "q" -input_player1_l2 = "nul" -input_player1_l2_axis = "nul" -input_player1_l2_btn = "nul" -input_player1_l2_mbtn = "nul" -input_player1_l3 = "nul" -input_player1_l3_axis = "nul" -input_player1_l3_btn = "nul" -input_player1_l3_mbtn = "nul" -input_player1_l_axis = "nul" -input_player1_l_btn = "nul" -input_player1_l_mbtn = "nul" -input_player1_l_x_minus = "nul" -input_player1_l_x_minus_axis = "nul" -input_player1_l_x_minus_btn = "nul" -input_player1_l_x_minus_mbtn = "nul" -input_player1_l_x_plus = "nul" -input_player1_l_x_plus_axis = "nul" -input_player1_l_x_plus_btn = "nul" -input_player1_l_x_plus_mbtn = "nul" -input_player1_l_y_minus = "nul" -input_player1_l_y_minus_axis = "nul" -input_player1_l_y_minus_btn = "nul" -input_player1_l_y_minus_mbtn = "nul" -input_player1_l_y_plus = "nul" -input_player1_l_y_plus_axis = "nul" -input_player1_l_y_plus_btn = "nul" -input_player1_l_y_plus_mbtn = "nul" -input_player1_left = "left" -input_player1_left_axis = "nul" -input_player1_left_btn = "nul" -input_player1_left_mbtn = "nul" -input_player1_mouse_index = "0" -input_player1_r = "w" -input_player1_r2 = "nul" -input_player1_r2_axis = "nul" -input_player1_r2_btn = "nul" -input_player1_r2_mbtn = "nul" -input_player1_r3 = "nul" -input_player1_r3_axis = "nul" -input_player1_r3_btn = "nul" -input_player1_r3_mbtn = "nul" -input_player1_r_axis = "nul" -input_player1_r_btn = "nul" -input_player1_r_mbtn = "nul" -input_player1_r_x_minus = "nul" -input_player1_r_x_minus_axis = "nul" -input_player1_r_x_minus_btn = "nul" -input_player1_r_x_minus_mbtn = "nul" -input_player1_r_x_plus = "nul" -input_player1_r_x_plus_axis = "nul" -input_player1_r_x_plus_btn = "nul" -input_player1_r_x_plus_mbtn = "nul" -input_player1_r_y_minus = "nul" -input_player1_r_y_minus_axis = "nul" -input_player1_r_y_minus_btn = "nul" -input_player1_r_y_minus_mbtn = "nul" -input_player1_r_y_plus = "nul" -input_player1_r_y_plus_axis = "nul" -input_player1_r_y_plus_btn = "nul" -input_player1_r_y_plus_mbtn = "nul" -input_player1_right = "right" -input_player1_right_axis = "nul" -input_player1_right_btn = "nul" -input_player1_right_mbtn = "nul" -input_player1_select = "rshift" -input_player1_select_axis = "nul" -input_player1_select_btn = "nul" -input_player1_select_mbtn = "nul" -input_player1_start = "enter" -input_player1_start_axis = "nul" -input_player1_start_btn = "nul" -input_player1_start_mbtn = "nul" -input_player1_turbo = "nul" -input_player1_turbo_axis = "nul" -input_player1_turbo_btn = "nul" -input_player1_turbo_mbtn = "nul" -input_player1_up = "up" -input_player1_up_axis = "nul" -input_player1_up_btn = "nul" -input_player1_up_mbtn = "nul" -input_player1_x = "s" -input_player1_x_axis = "nul" -input_player1_x_btn = "nul" -input_player1_x_mbtn = "nul" -input_player1_y = "a" -input_player1_y_axis = "nul" -input_player1_y_btn = "nul" -input_player1_y_mbtn = "nul" -input_player2_a = "nul" -input_player2_a_axis = "nul" -input_player2_a_btn = "nul" -input_player2_a_mbtn = "nul" -input_player2_analog_dpad_mode = "0" -input_player2_b = "nul" -input_player2_b_axis = "nul" -input_player2_b_btn = "nul" -input_player2_b_mbtn = "nul" -input_player2_down = "nul" -input_player2_down_axis = "nul" -input_player2_down_btn = "nul" -input_player2_down_mbtn = "nul" -input_player2_gun_aux_a = "nul" -input_player2_gun_aux_a_axis = "nul" -input_player2_gun_aux_a_btn = "nul" -input_player2_gun_aux_a_mbtn = "nul" -input_player2_gun_aux_b = "nul" -input_player2_gun_aux_b_axis = "nul" -input_player2_gun_aux_b_btn = "nul" -input_player2_gun_aux_b_mbtn = "nul" -input_player2_gun_aux_c = "nul" -input_player2_gun_aux_c_axis = "nul" -input_player2_gun_aux_c_btn = "nul" -input_player2_gun_aux_c_mbtn = "nul" -input_player2_gun_dpad_down = "nul" -input_player2_gun_dpad_down_axis = "nul" -input_player2_gun_dpad_down_btn = "nul" -input_player2_gun_dpad_down_mbtn = "nul" -input_player2_gun_dpad_left = "nul" -input_player2_gun_dpad_left_axis = "nul" -input_player2_gun_dpad_left_btn = "nul" -input_player2_gun_dpad_left_mbtn = "nul" -input_player2_gun_dpad_right = "nul" -input_player2_gun_dpad_right_axis = "nul" -input_player2_gun_dpad_right_btn = "nul" -input_player2_gun_dpad_right_mbtn = "nul" -input_player2_gun_dpad_up = "nul" -input_player2_gun_dpad_up_axis = "nul" -input_player2_gun_dpad_up_btn = "nul" -input_player2_gun_dpad_up_mbtn = "nul" -input_player2_gun_offscreen_shot = "nul" -input_player2_gun_offscreen_shot_axis = "nul" -input_player2_gun_offscreen_shot_btn = "nul" -input_player2_gun_offscreen_shot_mbtn = "nul" -input_player2_gun_select = "nul" -input_player2_gun_select_axis = "nul" -input_player2_gun_select_btn = "nul" -input_player2_gun_select_mbtn = "nul" -input_player2_gun_start = "nul" -input_player2_gun_start_axis = "nul" -input_player2_gun_start_btn = "nul" -input_player2_gun_start_mbtn = "nul" -input_player2_gun_trigger = "nul" -input_player2_gun_trigger_axis = "nul" -input_player2_gun_trigger_btn = "nul" -input_player2_gun_trigger_mbtn = "nul" -input_player2_joypad_index = "1" -input_player2_l = "nul" -input_player2_l2 = "nul" -input_player2_l2_axis = "nul" -input_player2_l2_btn = "nul" -input_player2_l2_mbtn = "nul" -input_player2_l3 = "nul" -input_player2_l3_axis = "nul" -input_player2_l3_btn = "nul" -input_player2_l3_mbtn = "nul" -input_player2_l_axis = "nul" -input_player2_l_btn = "nul" -input_player2_l_mbtn = "nul" -input_player2_l_x_minus = "nul" -input_player2_l_x_minus_axis = "nul" -input_player2_l_x_minus_btn = "nul" -input_player2_l_x_minus_mbtn = "nul" -input_player2_l_x_plus = "nul" -input_player2_l_x_plus_axis = "nul" -input_player2_l_x_plus_btn = "nul" -input_player2_l_x_plus_mbtn = "nul" -input_player2_l_y_minus = "nul" -input_player2_l_y_minus_axis = "nul" -input_player2_l_y_minus_btn = "nul" -input_player2_l_y_minus_mbtn = "nul" -input_player2_l_y_plus = "nul" -input_player2_l_y_plus_axis = "nul" -input_player2_l_y_plus_btn = "nul" -input_player2_l_y_plus_mbtn = "nul" -input_player2_left = "nul" -input_player2_left_axis = "nul" -input_player2_left_btn = "nul" -input_player2_left_mbtn = "nul" -input_player2_mouse_index = "0" -input_player2_r = "nul" -input_player2_r2 = "nul" -input_player2_r2_axis = "nul" -input_player2_r2_btn = "nul" -input_player2_r2_mbtn = "nul" -input_player2_r3 = "nul" -input_player2_r3_axis = "nul" -input_player2_r3_btn = "nul" -input_player2_r3_mbtn = "nul" -input_player2_r_axis = "nul" -input_player2_r_btn = "nul" -input_player2_r_mbtn = "nul" -input_player2_r_x_minus = "nul" -input_player2_r_x_minus_axis = "nul" -input_player2_r_x_minus_btn = "nul" -input_player2_r_x_minus_mbtn = "nul" -input_player2_r_x_plus = "nul" -input_player2_r_x_plus_axis = "nul" -input_player2_r_x_plus_btn = "nul" -input_player2_r_x_plus_mbtn = "nul" -input_player2_r_y_minus = "nul" -input_player2_r_y_minus_axis = "nul" -input_player2_r_y_minus_btn = "nul" -input_player2_r_y_minus_mbtn = "nul" -input_player2_r_y_plus = "nul" -input_player2_r_y_plus_axis = "nul" -input_player2_r_y_plus_btn = "nul" -input_player2_r_y_plus_mbtn = "nul" -input_player2_right = "nul" -input_player2_right_axis = "nul" -input_player2_right_btn = "nul" -input_player2_right_mbtn = "nul" -input_player2_select = "nul" -input_player2_select_axis = "nul" -input_player2_select_btn = "nul" -input_player2_select_mbtn = "nul" -input_player2_start = "nul" -input_player2_start_axis = "nul" -input_player2_start_btn = "nul" -input_player2_start_mbtn = "nul" -input_player2_turbo = "nul" -input_player2_turbo_axis = "nul" -input_player2_turbo_btn = "nul" -input_player2_turbo_mbtn = "nul" -input_player2_up = "nul" -input_player2_up_axis = "nul" -input_player2_up_btn = "nul" -input_player2_up_mbtn = "nul" -input_player2_x = "nul" -input_player2_x_axis = "nul" -input_player2_x_btn = "nul" -input_player2_x_mbtn = "nul" -input_player2_y = "nul" -input_player2_y_axis = "nul" -input_player2_y_btn = "nul" -input_player2_y_mbtn = "nul" -input_player3_a = "nul" -input_player3_a_axis = "nul" -input_player3_a_btn = "nul" -input_player3_a_mbtn = "nul" -input_player3_analog_dpad_mode = "0" -input_player3_b = "nul" -input_player3_b_axis = "nul" -input_player3_b_btn = "nul" -input_player3_b_mbtn = "nul" -input_player3_down = "nul" -input_player3_down_axis = "nul" -input_player3_down_btn = "nul" -input_player3_down_mbtn = "nul" -input_player3_gun_aux_a = "nul" -input_player3_gun_aux_a_axis = "nul" -input_player3_gun_aux_a_btn = "nul" -input_player3_gun_aux_a_mbtn = "nul" -input_player3_gun_aux_b = "nul" -input_player3_gun_aux_b_axis = "nul" -input_player3_gun_aux_b_btn = "nul" -input_player3_gun_aux_b_mbtn = "nul" -input_player3_gun_aux_c = "nul" -input_player3_gun_aux_c_axis = "nul" -input_player3_gun_aux_c_btn = "nul" -input_player3_gun_aux_c_mbtn = "nul" -input_player3_gun_dpad_down = "nul" -input_player3_gun_dpad_down_axis = "nul" -input_player3_gun_dpad_down_btn = "nul" -input_player3_gun_dpad_down_mbtn = "nul" -input_player3_gun_dpad_left = "nul" -input_player3_gun_dpad_left_axis = "nul" -input_player3_gun_dpad_left_btn = "nul" -input_player3_gun_dpad_left_mbtn = "nul" -input_player3_gun_dpad_right = "nul" -input_player3_gun_dpad_right_axis = "nul" -input_player3_gun_dpad_right_btn = "nul" -input_player3_gun_dpad_right_mbtn = "nul" -input_player3_gun_dpad_up = "nul" -input_player3_gun_dpad_up_axis = "nul" -input_player3_gun_dpad_up_btn = "nul" -input_player3_gun_dpad_up_mbtn = "nul" -input_player3_gun_offscreen_shot = "nul" -input_player3_gun_offscreen_shot_axis = "nul" -input_player3_gun_offscreen_shot_btn = "nul" -input_player3_gun_offscreen_shot_mbtn = "nul" -input_player3_gun_select = "nul" -input_player3_gun_select_axis = "nul" -input_player3_gun_select_btn = "nul" -input_player3_gun_select_mbtn = "nul" -input_player3_gun_start = "nul" -input_player3_gun_start_axis = "nul" -input_player3_gun_start_btn = "nul" -input_player3_gun_start_mbtn = "nul" -input_player3_gun_trigger = "nul" -input_player3_gun_trigger_axis = "nul" -input_player3_gun_trigger_btn = "nul" -input_player3_gun_trigger_mbtn = "nul" -input_player3_joypad_index = "2" -input_player3_l = "nul" -input_player3_l2 = "nul" -input_player3_l2_axis = "nul" -input_player3_l2_btn = "nul" -input_player3_l2_mbtn = "nul" -input_player3_l3 = "nul" -input_player3_l3_axis = "nul" -input_player3_l3_btn = "nul" -input_player3_l3_mbtn = "nul" -input_player3_l_axis = "nul" -input_player3_l_btn = "nul" -input_player3_l_mbtn = "nul" -input_player3_l_x_minus = "nul" -input_player3_l_x_minus_axis = "nul" -input_player3_l_x_minus_btn = "nul" -input_player3_l_x_minus_mbtn = "nul" -input_player3_l_x_plus = "nul" -input_player3_l_x_plus_axis = "nul" -input_player3_l_x_plus_btn = "nul" -input_player3_l_x_plus_mbtn = "nul" -input_player3_l_y_minus = "nul" -input_player3_l_y_minus_axis = "nul" -input_player3_l_y_minus_btn = "nul" -input_player3_l_y_minus_mbtn = "nul" -input_player3_l_y_plus = "nul" -input_player3_l_y_plus_axis = "nul" -input_player3_l_y_plus_btn = "nul" -input_player3_l_y_plus_mbtn = "nul" -input_player3_left = "nul" -input_player3_left_axis = "nul" -input_player3_left_btn = "nul" -input_player3_left_mbtn = "nul" -input_player3_mouse_index = "0" -input_player3_r = "nul" -input_player3_r2 = "nul" -input_player3_r2_axis = "nul" -input_player3_r2_btn = "nul" -input_player3_r2_mbtn = "nul" -input_player3_r3 = "nul" -input_player3_r3_axis = "nul" -input_player3_r3_btn = "nul" -input_player3_r3_mbtn = "nul" -input_player3_r_axis = "nul" -input_player3_r_btn = "nul" -input_player3_r_mbtn = "nul" -input_player3_r_x_minus = "nul" -input_player3_r_x_minus_axis = "nul" -input_player3_r_x_minus_btn = "nul" -input_player3_r_x_minus_mbtn = "nul" -input_player3_r_x_plus = "nul" -input_player3_r_x_plus_axis = "nul" -input_player3_r_x_plus_btn = "nul" -input_player3_r_x_plus_mbtn = "nul" -input_player3_r_y_minus = "nul" -input_player3_r_y_minus_axis = "nul" -input_player3_r_y_minus_btn = "nul" -input_player3_r_y_minus_mbtn = "nul" -input_player3_r_y_plus = "nul" -input_player3_r_y_plus_axis = "nul" -input_player3_r_y_plus_btn = "nul" -input_player3_r_y_plus_mbtn = "nul" -input_player3_right = "nul" -input_player3_right_axis = "nul" -input_player3_right_btn = "nul" -input_player3_right_mbtn = "nul" -input_player3_select = "nul" -input_player3_select_axis = "nul" -input_player3_select_btn = "nul" -input_player3_select_mbtn = "nul" -input_player3_start = "nul" -input_player3_start_axis = "nul" -input_player3_start_btn = "nul" -input_player3_start_mbtn = "nul" -input_player3_turbo = "nul" -input_player3_turbo_axis = "nul" -input_player3_turbo_btn = "nul" -input_player3_turbo_mbtn = "nul" -input_player3_up = "nul" -input_player3_up_axis = "nul" -input_player3_up_btn = "nul" -input_player3_up_mbtn = "nul" -input_player3_x = "nul" -input_player3_x_axis = "nul" -input_player3_x_btn = "nul" -input_player3_x_mbtn = "nul" -input_player3_y = "nul" -input_player3_y_axis = "nul" -input_player3_y_btn = "nul" -input_player3_y_mbtn = "nul" -input_player4_a = "nul" -input_player4_a_axis = "nul" -input_player4_a_btn = "nul" -input_player4_a_mbtn = "nul" -input_player4_analog_dpad_mode = "0" -input_player4_b = "nul" -input_player4_b_axis = "nul" -input_player4_b_btn = "nul" -input_player4_b_mbtn = "nul" -input_player4_down = "nul" -input_player4_down_axis = "nul" -input_player4_down_btn = "nul" -input_player4_down_mbtn = "nul" -input_player4_gun_aux_a = "nul" -input_player4_gun_aux_a_axis = "nul" -input_player4_gun_aux_a_btn = "nul" -input_player4_gun_aux_a_mbtn = "nul" -input_player4_gun_aux_b = "nul" -input_player4_gun_aux_b_axis = "nul" -input_player4_gun_aux_b_btn = "nul" -input_player4_gun_aux_b_mbtn = "nul" -input_player4_gun_aux_c = "nul" -input_player4_gun_aux_c_axis = "nul" -input_player4_gun_aux_c_btn = "nul" -input_player4_gun_aux_c_mbtn = "nul" -input_player4_gun_dpad_down = "nul" -input_player4_gun_dpad_down_axis = "nul" -input_player4_gun_dpad_down_btn = "nul" -input_player4_gun_dpad_down_mbtn = "nul" -input_player4_gun_dpad_left = "nul" -input_player4_gun_dpad_left_axis = "nul" -input_player4_gun_dpad_left_btn = "nul" -input_player4_gun_dpad_left_mbtn = "nul" -input_player4_gun_dpad_right = "nul" -input_player4_gun_dpad_right_axis = "nul" -input_player4_gun_dpad_right_btn = "nul" -input_player4_gun_dpad_right_mbtn = "nul" -input_player4_gun_dpad_up = "nul" -input_player4_gun_dpad_up_axis = "nul" -input_player4_gun_dpad_up_btn = "nul" -input_player4_gun_dpad_up_mbtn = "nul" -input_player4_gun_offscreen_shot = "nul" -input_player4_gun_offscreen_shot_axis = "nul" -input_player4_gun_offscreen_shot_btn = "nul" -input_player4_gun_offscreen_shot_mbtn = "nul" -input_player4_gun_select = "nul" -input_player4_gun_select_axis = "nul" -input_player4_gun_select_btn = "nul" -input_player4_gun_select_mbtn = "nul" -input_player4_gun_start = "nul" -input_player4_gun_start_axis = "nul" -input_player4_gun_start_btn = "nul" -input_player4_gun_start_mbtn = "nul" -input_player4_gun_trigger = "nul" -input_player4_gun_trigger_axis = "nul" -input_player4_gun_trigger_btn = "nul" -input_player4_gun_trigger_mbtn = "nul" -input_player4_joypad_index = "3" -input_player4_l = "nul" -input_player4_l2 = "nul" -input_player4_l2_axis = "nul" -input_player4_l2_btn = "nul" -input_player4_l2_mbtn = "nul" -input_player4_l3 = "nul" -input_player4_l3_axis = "nul" -input_player4_l3_btn = "nul" -input_player4_l3_mbtn = "nul" -input_player4_l_axis = "nul" -input_player4_l_btn = "nul" -input_player4_l_mbtn = "nul" -input_player4_l_x_minus = "nul" -input_player4_l_x_minus_axis = "nul" -input_player4_l_x_minus_btn = "nul" -input_player4_l_x_minus_mbtn = "nul" -input_player4_l_x_plus = "nul" -input_player4_l_x_plus_axis = "nul" -input_player4_l_x_plus_btn = "nul" -input_player4_l_x_plus_mbtn = "nul" -input_player4_l_y_minus = "nul" -input_player4_l_y_minus_axis = "nul" -input_player4_l_y_minus_btn = "nul" -input_player4_l_y_minus_mbtn = "nul" -input_player4_l_y_plus = "nul" -input_player4_l_y_plus_axis = "nul" -input_player4_l_y_plus_btn = "nul" -input_player4_l_y_plus_mbtn = "nul" -input_player4_left = "nul" -input_player4_left_axis = "nul" -input_player4_left_btn = "nul" -input_player4_left_mbtn = "nul" -input_player4_mouse_index = "0" -input_player4_r = "nul" -input_player4_r2 = "nul" -input_player4_r2_axis = "nul" -input_player4_r2_btn = "nul" -input_player4_r2_mbtn = "nul" -input_player4_r3 = "nul" -input_player4_r3_axis = "nul" -input_player4_r3_btn = "nul" -input_player4_r3_mbtn = "nul" -input_player4_r_axis = "nul" -input_player4_r_btn = "nul" -input_player4_r_mbtn = "nul" -input_player4_r_x_minus = "nul" -input_player4_r_x_minus_axis = "nul" -input_player4_r_x_minus_btn = "nul" -input_player4_r_x_minus_mbtn = "nul" -input_player4_r_x_plus = "nul" -input_player4_r_x_plus_axis = "nul" -input_player4_r_x_plus_btn = "nul" -input_player4_r_x_plus_mbtn = "nul" -input_player4_r_y_minus = "nul" -input_player4_r_y_minus_axis = "nul" -input_player4_r_y_minus_btn = "nul" -input_player4_r_y_minus_mbtn = "nul" -input_player4_r_y_plus = "nul" -input_player4_r_y_plus_axis = "nul" -input_player4_r_y_plus_btn = "nul" -input_player4_r_y_plus_mbtn = "nul" -input_player4_right = "nul" -input_player4_right_axis = "nul" -input_player4_right_btn = "nul" -input_player4_right_mbtn = "nul" -input_player4_select = "nul" -input_player4_select_axis = "nul" -input_player4_select_btn = "nul" -input_player4_select_mbtn = "nul" -input_player4_start = "nul" -input_player4_start_axis = "nul" -input_player4_start_btn = "nul" -input_player4_start_mbtn = "nul" -input_player4_turbo = "nul" -input_player4_turbo_axis = "nul" -input_player4_turbo_btn = "nul" -input_player4_turbo_mbtn = "nul" -input_player4_up = "nul" -input_player4_up_axis = "nul" -input_player4_up_btn = "nul" -input_player4_up_mbtn = "nul" -input_player4_x = "nul" -input_player4_x_axis = "nul" -input_player4_x_btn = "nul" -input_player4_x_mbtn = "nul" -input_player4_y = "nul" -input_player4_y_axis = "nul" -input_player4_y_btn = "nul" -input_player4_y_mbtn = "nul" -input_player5_a = "nul" -input_player5_a_axis = "nul" -input_player5_a_btn = "nul" -input_player5_a_mbtn = "nul" -input_player5_analog_dpad_mode = "0" -input_player5_b = "nul" -input_player5_b_axis = "nul" -input_player5_b_btn = "nul" -input_player5_b_mbtn = "nul" -input_player5_down = "nul" -input_player5_down_axis = "nul" -input_player5_down_btn = "nul" -input_player5_down_mbtn = "nul" -input_player5_gun_aux_a = "nul" -input_player5_gun_aux_a_axis = "nul" -input_player5_gun_aux_a_btn = "nul" -input_player5_gun_aux_a_mbtn = "nul" -input_player5_gun_aux_b = "nul" -input_player5_gun_aux_b_axis = "nul" -input_player5_gun_aux_b_btn = "nul" -input_player5_gun_aux_b_mbtn = "nul" -input_player5_gun_aux_c = "nul" -input_player5_gun_aux_c_axis = "nul" -input_player5_gun_aux_c_btn = "nul" -input_player5_gun_aux_c_mbtn = "nul" -input_player5_gun_dpad_down = "nul" -input_player5_gun_dpad_down_axis = "nul" -input_player5_gun_dpad_down_btn = "nul" -input_player5_gun_dpad_down_mbtn = "nul" -input_player5_gun_dpad_left = "nul" -input_player5_gun_dpad_left_axis = "nul" -input_player5_gun_dpad_left_btn = "nul" -input_player5_gun_dpad_left_mbtn = "nul" -input_player5_gun_dpad_right = "nul" -input_player5_gun_dpad_right_axis = "nul" -input_player5_gun_dpad_right_btn = "nul" -input_player5_gun_dpad_right_mbtn = "nul" -input_player5_gun_dpad_up = "nul" -input_player5_gun_dpad_up_axis = "nul" -input_player5_gun_dpad_up_btn = "nul" -input_player5_gun_dpad_up_mbtn = "nul" -input_player5_gun_offscreen_shot = "nul" -input_player5_gun_offscreen_shot_axis = "nul" -input_player5_gun_offscreen_shot_btn = "nul" -input_player5_gun_offscreen_shot_mbtn = "nul" -input_player5_gun_select = "nul" -input_player5_gun_select_axis = "nul" -input_player5_gun_select_btn = "nul" -input_player5_gun_select_mbtn = "nul" -input_player5_gun_start = "nul" -input_player5_gun_start_axis = "nul" -input_player5_gun_start_btn = "nul" -input_player5_gun_start_mbtn = "nul" -input_player5_gun_trigger = "nul" -input_player5_gun_trigger_axis = "nul" -input_player5_gun_trigger_btn = "nul" -input_player5_gun_trigger_mbtn = "nul" -input_player5_joypad_index = "4" -input_player5_l = "nul" -input_player5_l2 = "nul" -input_player5_l2_axis = "nul" -input_player5_l2_btn = "nul" -input_player5_l2_mbtn = "nul" -input_player5_l3 = "nul" -input_player5_l3_axis = "nul" -input_player5_l3_btn = "nul" -input_player5_l3_mbtn = "nul" -input_player5_l_axis = "nul" -input_player5_l_btn = "nul" -input_player5_l_mbtn = "nul" -input_player5_l_x_minus = "nul" -input_player5_l_x_minus_axis = "nul" -input_player5_l_x_minus_btn = "nul" -input_player5_l_x_minus_mbtn = "nul" -input_player5_l_x_plus = "nul" -input_player5_l_x_plus_axis = "nul" -input_player5_l_x_plus_btn = "nul" -input_player5_l_x_plus_mbtn = "nul" -input_player5_l_y_minus = "nul" -input_player5_l_y_minus_axis = "nul" -input_player5_l_y_minus_btn = "nul" -input_player5_l_y_minus_mbtn = "nul" -input_player5_l_y_plus = "nul" -input_player5_l_y_plus_axis = "nul" -input_player5_l_y_plus_btn = "nul" -input_player5_l_y_plus_mbtn = "nul" -input_player5_left = "nul" -input_player5_left_axis = "nul" -input_player5_left_btn = "nul" -input_player5_left_mbtn = "nul" -input_player5_mouse_index = "0" -input_player5_r = "nul" -input_player5_r2 = "nul" -input_player5_r2_axis = "nul" -input_player5_r2_btn = "nul" -input_player5_r2_mbtn = "nul" -input_player5_r3 = "nul" -input_player5_r3_axis = "nul" -input_player5_r3_btn = "nul" -input_player5_r3_mbtn = "nul" -input_player5_r_axis = "nul" -input_player5_r_btn = "nul" -input_player5_r_mbtn = "nul" -input_player5_r_x_minus = "nul" -input_player5_r_x_minus_axis = "nul" -input_player5_r_x_minus_btn = "nul" -input_player5_r_x_minus_mbtn = "nul" -input_player5_r_x_plus = "nul" -input_player5_r_x_plus_axis = "nul" -input_player5_r_x_plus_btn = "nul" -input_player5_r_x_plus_mbtn = "nul" -input_player5_r_y_minus = "nul" -input_player5_r_y_minus_axis = "nul" -input_player5_r_y_minus_btn = "nul" -input_player5_r_y_minus_mbtn = "nul" -input_player5_r_y_plus = "nul" -input_player5_r_y_plus_axis = "nul" -input_player5_r_y_plus_btn = "nul" -input_player5_r_y_plus_mbtn = "nul" -input_player5_right = "nul" -input_player5_right_axis = "nul" -input_player5_right_btn = "nul" -input_player5_right_mbtn = "nul" -input_player5_select = "nul" -input_player5_select_axis = "nul" -input_player5_select_btn = "nul" -input_player5_select_mbtn = "nul" -input_player5_start = "nul" -input_player5_start_axis = "nul" -input_player5_start_btn = "nul" -input_player5_start_mbtn = "nul" -input_player5_turbo = "nul" -input_player5_turbo_axis = "nul" -input_player5_turbo_btn = "nul" -input_player5_turbo_mbtn = "nul" -input_player5_up = "nul" -input_player5_up_axis = "nul" -input_player5_up_btn = "nul" -input_player5_up_mbtn = "nul" -input_player5_x = "nul" -input_player5_x_axis = "nul" -input_player5_x_btn = "nul" -input_player5_x_mbtn = "nul" -input_player5_y = "nul" -input_player5_y_axis = "nul" -input_player5_y_btn = "nul" -input_player5_y_mbtn = "nul" -input_player6_a = "nul" -input_player6_a_axis = "nul" -input_player6_a_btn = "nul" -input_player6_a_mbtn = "nul" -input_player6_analog_dpad_mode = "0" -input_player6_b = "nul" -input_player6_b_axis = "nul" -input_player6_b_btn = "nul" -input_player6_b_mbtn = "nul" -input_player6_down = "nul" -input_player6_down_axis = "nul" -input_player6_down_btn = "nul" -input_player6_down_mbtn = "nul" -input_player6_gun_aux_a = "nul" -input_player6_gun_aux_a_axis = "nul" -input_player6_gun_aux_a_btn = "nul" -input_player6_gun_aux_a_mbtn = "nul" -input_player6_gun_aux_b = "nul" -input_player6_gun_aux_b_axis = "nul" -input_player6_gun_aux_b_btn = "nul" -input_player6_gun_aux_b_mbtn = "nul" -input_player6_gun_aux_c = "nul" -input_player6_gun_aux_c_axis = "nul" -input_player6_gun_aux_c_btn = "nul" -input_player6_gun_aux_c_mbtn = "nul" -input_player6_gun_dpad_down = "nul" -input_player6_gun_dpad_down_axis = "nul" -input_player6_gun_dpad_down_btn = "nul" -input_player6_gun_dpad_down_mbtn = "nul" -input_player6_gun_dpad_left = "nul" -input_player6_gun_dpad_left_axis = "nul" -input_player6_gun_dpad_left_btn = "nul" -input_player6_gun_dpad_left_mbtn = "nul" -input_player6_gun_dpad_right = "nul" -input_player6_gun_dpad_right_axis = "nul" -input_player6_gun_dpad_right_btn = "nul" -input_player6_gun_dpad_right_mbtn = "nul" -input_player6_gun_dpad_up = "nul" -input_player6_gun_dpad_up_axis = "nul" -input_player6_gun_dpad_up_btn = "nul" -input_player6_gun_dpad_up_mbtn = "nul" -input_player6_gun_offscreen_shot = "nul" -input_player6_gun_offscreen_shot_axis = "nul" -input_player6_gun_offscreen_shot_btn = "nul" -input_player6_gun_offscreen_shot_mbtn = "nul" -input_player6_gun_select = "nul" -input_player6_gun_select_axis = "nul" -input_player6_gun_select_btn = "nul" -input_player6_gun_select_mbtn = "nul" -input_player6_gun_start = "nul" -input_player6_gun_start_axis = "nul" -input_player6_gun_start_btn = "nul" -input_player6_gun_start_mbtn = "nul" -input_player6_gun_trigger = "nul" -input_player6_gun_trigger_axis = "nul" -input_player6_gun_trigger_btn = "nul" -input_player6_gun_trigger_mbtn = "nul" -input_player6_joypad_index = "5" -input_player6_l = "nul" -input_player6_l2 = "nul" -input_player6_l2_axis = "nul" -input_player6_l2_btn = "nul" -input_player6_l2_mbtn = "nul" -input_player6_l3 = "nul" -input_player6_l3_axis = "nul" -input_player6_l3_btn = "nul" -input_player6_l3_mbtn = "nul" -input_player6_l_axis = "nul" -input_player6_l_btn = "nul" -input_player6_l_mbtn = "nul" -input_player6_l_x_minus = "nul" -input_player6_l_x_minus_axis = "nul" -input_player6_l_x_minus_btn = "nul" -input_player6_l_x_minus_mbtn = "nul" -input_player6_l_x_plus = "nul" -input_player6_l_x_plus_axis = "nul" -input_player6_l_x_plus_btn = "nul" -input_player6_l_x_plus_mbtn = "nul" -input_player6_l_y_minus = "nul" -input_player6_l_y_minus_axis = "nul" -input_player6_l_y_minus_btn = "nul" -input_player6_l_y_minus_mbtn = "nul" -input_player6_l_y_plus = "nul" -input_player6_l_y_plus_axis = "nul" -input_player6_l_y_plus_btn = "nul" -input_player6_l_y_plus_mbtn = "nul" -input_player6_left = "nul" -input_player6_left_axis = "nul" -input_player6_left_btn = "nul" -input_player6_left_mbtn = "nul" -input_player6_mouse_index = "0" -input_player6_r = "nul" -input_player6_r2 = "nul" -input_player6_r2_axis = "nul" -input_player6_r2_btn = "nul" -input_player6_r2_mbtn = "nul" -input_player6_r3 = "nul" -input_player6_r3_axis = "nul" -input_player6_r3_btn = "nul" -input_player6_r3_mbtn = "nul" -input_player6_r_axis = "nul" -input_player6_r_btn = "nul" -input_player6_r_mbtn = "nul" -input_player6_r_x_minus = "nul" -input_player6_r_x_minus_axis = "nul" -input_player6_r_x_minus_btn = "nul" -input_player6_r_x_minus_mbtn = "nul" -input_player6_r_x_plus = "nul" -input_player6_r_x_plus_axis = "nul" -input_player6_r_x_plus_btn = "nul" -input_player6_r_x_plus_mbtn = "nul" -input_player6_r_y_minus = "nul" -input_player6_r_y_minus_axis = "nul" -input_player6_r_y_minus_btn = "nul" -input_player6_r_y_minus_mbtn = "nul" -input_player6_r_y_plus = "nul" -input_player6_r_y_plus_axis = "nul" -input_player6_r_y_plus_btn = "nul" -input_player6_r_y_plus_mbtn = "nul" -input_player6_right = "nul" -input_player6_right_axis = "nul" -input_player6_right_btn = "nul" -input_player6_right_mbtn = "nul" -input_player6_select = "nul" -input_player6_select_axis = "nul" -input_player6_select_btn = "nul" -input_player6_select_mbtn = "nul" -input_player6_start = "nul" -input_player6_start_axis = "nul" -input_player6_start_btn = "nul" -input_player6_start_mbtn = "nul" -input_player6_turbo = "nul" -input_player6_turbo_axis = "nul" -input_player6_turbo_btn = "nul" -input_player6_turbo_mbtn = "nul" -input_player6_up = "nul" -input_player6_up_axis = "nul" -input_player6_up_btn = "nul" -input_player6_up_mbtn = "nul" -input_player6_x = "nul" -input_player6_x_axis = "nul" -input_player6_x_btn = "nul" -input_player6_x_mbtn = "nul" -input_player6_y = "nul" -input_player6_y_axis = "nul" -input_player6_y_btn = "nul" -input_player6_y_mbtn = "nul" -input_player7_a = "nul" -input_player7_a_axis = "nul" -input_player7_a_btn = "nul" -input_player7_a_mbtn = "nul" -input_player7_analog_dpad_mode = "0" -input_player7_b = "nul" -input_player7_b_axis = "nul" -input_player7_b_btn = "nul" -input_player7_b_mbtn = "nul" -input_player7_down = "nul" -input_player7_down_axis = "nul" -input_player7_down_btn = "nul" -input_player7_down_mbtn = "nul" -input_player7_gun_aux_a = "nul" -input_player7_gun_aux_a_axis = "nul" -input_player7_gun_aux_a_btn = "nul" -input_player7_gun_aux_a_mbtn = "nul" -input_player7_gun_aux_b = "nul" -input_player7_gun_aux_b_axis = "nul" -input_player7_gun_aux_b_btn = "nul" -input_player7_gun_aux_b_mbtn = "nul" -input_player7_gun_aux_c = "nul" -input_player7_gun_aux_c_axis = "nul" -input_player7_gun_aux_c_btn = "nul" -input_player7_gun_aux_c_mbtn = "nul" -input_player7_gun_dpad_down = "nul" -input_player7_gun_dpad_down_axis = "nul" -input_player7_gun_dpad_down_btn = "nul" -input_player7_gun_dpad_down_mbtn = "nul" -input_player7_gun_dpad_left = "nul" -input_player7_gun_dpad_left_axis = "nul" -input_player7_gun_dpad_left_btn = "nul" -input_player7_gun_dpad_left_mbtn = "nul" -input_player7_gun_dpad_right = "nul" -input_player7_gun_dpad_right_axis = "nul" -input_player7_gun_dpad_right_btn = "nul" -input_player7_gun_dpad_right_mbtn = "nul" -input_player7_gun_dpad_up = "nul" -input_player7_gun_dpad_up_axis = "nul" -input_player7_gun_dpad_up_btn = "nul" -input_player7_gun_dpad_up_mbtn = "nul" -input_player7_gun_offscreen_shot = "nul" -input_player7_gun_offscreen_shot_axis = "nul" -input_player7_gun_offscreen_shot_btn = "nul" -input_player7_gun_offscreen_shot_mbtn = "nul" -input_player7_gun_select = "nul" -input_player7_gun_select_axis = "nul" -input_player7_gun_select_btn = "nul" -input_player7_gun_select_mbtn = "nul" -input_player7_gun_start = "nul" -input_player7_gun_start_axis = "nul" -input_player7_gun_start_btn = "nul" -input_player7_gun_start_mbtn = "nul" -input_player7_gun_trigger = "nul" -input_player7_gun_trigger_axis = "nul" -input_player7_gun_trigger_btn = "nul" -input_player7_gun_trigger_mbtn = "nul" -input_player7_joypad_index = "6" -input_player7_l = "nul" -input_player7_l2 = "nul" -input_player7_l2_axis = "nul" -input_player7_l2_btn = "nul" -input_player7_l2_mbtn = "nul" -input_player7_l3 = "nul" -input_player7_l3_axis = "nul" -input_player7_l3_btn = "nul" -input_player7_l3_mbtn = "nul" -input_player7_l_axis = "nul" -input_player7_l_btn = "nul" -input_player7_l_mbtn = "nul" -input_player7_l_x_minus = "nul" -input_player7_l_x_minus_axis = "nul" -input_player7_l_x_minus_btn = "nul" -input_player7_l_x_minus_mbtn = "nul" -input_player7_l_x_plus = "nul" -input_player7_l_x_plus_axis = "nul" -input_player7_l_x_plus_btn = "nul" -input_player7_l_x_plus_mbtn = "nul" -input_player7_l_y_minus = "nul" -input_player7_l_y_minus_axis = "nul" -input_player7_l_y_minus_btn = "nul" -input_player7_l_y_minus_mbtn = "nul" -input_player7_l_y_plus = "nul" -input_player7_l_y_plus_axis = "nul" -input_player7_l_y_plus_btn = "nul" -input_player7_l_y_plus_mbtn = "nul" -input_player7_left = "nul" -input_player7_left_axis = "nul" -input_player7_left_btn = "nul" -input_player7_left_mbtn = "nul" -input_player7_mouse_index = "0" -input_player7_r = "nul" -input_player7_r2 = "nul" -input_player7_r2_axis = "nul" -input_player7_r2_btn = "nul" -input_player7_r2_mbtn = "nul" -input_player7_r3 = "nul" -input_player7_r3_axis = "nul" -input_player7_r3_btn = "nul" -input_player7_r3_mbtn = "nul" -input_player7_r_axis = "nul" -input_player7_r_btn = "nul" -input_player7_r_mbtn = "nul" -input_player7_r_x_minus = "nul" -input_player7_r_x_minus_axis = "nul" -input_player7_r_x_minus_btn = "nul" -input_player7_r_x_minus_mbtn = "nul" -input_player7_r_x_plus = "nul" -input_player7_r_x_plus_axis = "nul" -input_player7_r_x_plus_btn = "nul" -input_player7_r_x_plus_mbtn = "nul" -input_player7_r_y_minus = "nul" -input_player7_r_y_minus_axis = "nul" -input_player7_r_y_minus_btn = "nul" -input_player7_r_y_minus_mbtn = "nul" -input_player7_r_y_plus = "nul" -input_player7_r_y_plus_axis = "nul" -input_player7_r_y_plus_btn = "nul" -input_player7_r_y_plus_mbtn = "nul" -input_player7_right = "nul" -input_player7_right_axis = "nul" -input_player7_right_btn = "nul" -input_player7_right_mbtn = "nul" -input_player7_select = "nul" -input_player7_select_axis = "nul" -input_player7_select_btn = "nul" -input_player7_select_mbtn = "nul" -input_player7_start = "nul" -input_player7_start_axis = "nul" -input_player7_start_btn = "nul" -input_player7_start_mbtn = "nul" -input_player7_turbo = "nul" -input_player7_turbo_axis = "nul" -input_player7_turbo_btn = "nul" -input_player7_turbo_mbtn = "nul" -input_player7_up = "nul" -input_player7_up_axis = "nul" -input_player7_up_btn = "nul" -input_player7_up_mbtn = "nul" -input_player7_x = "nul" -input_player7_x_axis = "nul" -input_player7_x_btn = "nul" -input_player7_x_mbtn = "nul" -input_player7_y = "nul" -input_player7_y_axis = "nul" -input_player7_y_btn = "nul" -input_player7_y_mbtn = "nul" -input_player8_a = "nul" -input_player8_a_axis = "nul" -input_player8_a_btn = "nul" -input_player8_a_mbtn = "nul" -input_player8_analog_dpad_mode = "0" -input_player8_b = "nul" -input_player8_b_axis = "nul" -input_player8_b_btn = "nul" -input_player8_b_mbtn = "nul" -input_player8_down = "nul" -input_player8_down_axis = "nul" -input_player8_down_btn = "nul" -input_player8_down_mbtn = "nul" -input_player8_gun_aux_a = "nul" -input_player8_gun_aux_a_axis = "nul" -input_player8_gun_aux_a_btn = "nul" -input_player8_gun_aux_a_mbtn = "nul" -input_player8_gun_aux_b = "nul" -input_player8_gun_aux_b_axis = "nul" -input_player8_gun_aux_b_btn = "nul" -input_player8_gun_aux_b_mbtn = "nul" -input_player8_gun_aux_c = "nul" -input_player8_gun_aux_c_axis = "nul" -input_player8_gun_aux_c_btn = "nul" -input_player8_gun_aux_c_mbtn = "nul" -input_player8_gun_dpad_down = "nul" -input_player8_gun_dpad_down_axis = "nul" -input_player8_gun_dpad_down_btn = "nul" -input_player8_gun_dpad_down_mbtn = "nul" -input_player8_gun_dpad_left = "nul" -input_player8_gun_dpad_left_axis = "nul" -input_player8_gun_dpad_left_btn = "nul" -input_player8_gun_dpad_left_mbtn = "nul" -input_player8_gun_dpad_right = "nul" -input_player8_gun_dpad_right_axis = "nul" -input_player8_gun_dpad_right_btn = "nul" -input_player8_gun_dpad_right_mbtn = "nul" -input_player8_gun_dpad_up = "nul" -input_player8_gun_dpad_up_axis = "nul" -input_player8_gun_dpad_up_btn = "nul" -input_player8_gun_dpad_up_mbtn = "nul" -input_player8_gun_offscreen_shot = "nul" -input_player8_gun_offscreen_shot_axis = "nul" -input_player8_gun_offscreen_shot_btn = "nul" -input_player8_gun_offscreen_shot_mbtn = "nul" -input_player8_gun_select = "nul" -input_player8_gun_select_axis = "nul" -input_player8_gun_select_btn = "nul" -input_player8_gun_select_mbtn = "nul" -input_player8_gun_start = "nul" -input_player8_gun_start_axis = "nul" -input_player8_gun_start_btn = "nul" -input_player8_gun_start_mbtn = "nul" -input_player8_gun_trigger = "nul" -input_player8_gun_trigger_axis = "nul" -input_player8_gun_trigger_btn = "nul" -input_player8_gun_trigger_mbtn = "nul" -input_player8_joypad_index = "7" -input_player8_l = "nul" -input_player8_l2 = "nul" -input_player8_l2_axis = "nul" -input_player8_l2_btn = "nul" -input_player8_l2_mbtn = "nul" -input_player8_l3 = "nul" -input_player8_l3_axis = "nul" -input_player8_l3_btn = "nul" -input_player8_l3_mbtn = "nul" -input_player8_l_axis = "nul" -input_player8_l_btn = "nul" -input_player8_l_mbtn = "nul" -input_player8_l_x_minus = "nul" -input_player8_l_x_minus_axis = "nul" -input_player8_l_x_minus_btn = "nul" -input_player8_l_x_minus_mbtn = "nul" -input_player8_l_x_plus = "nul" -input_player8_l_x_plus_axis = "nul" -input_player8_l_x_plus_btn = "nul" -input_player8_l_x_plus_mbtn = "nul" -input_player8_l_y_minus = "nul" -input_player8_l_y_minus_axis = "nul" -input_player8_l_y_minus_btn = "nul" -input_player8_l_y_minus_mbtn = "nul" -input_player8_l_y_plus = "nul" -input_player8_l_y_plus_axis = "nul" -input_player8_l_y_plus_btn = "nul" -input_player8_l_y_plus_mbtn = "nul" -input_player8_left = "nul" -input_player8_left_axis = "nul" -input_player8_left_btn = "nul" -input_player8_left_mbtn = "nul" -input_player8_mouse_index = "0" -input_player8_r = "nul" -input_player8_r2 = "nul" -input_player8_r2_axis = "nul" -input_player8_r2_btn = "nul" -input_player8_r2_mbtn = "nul" -input_player8_r3 = "nul" -input_player8_r3_axis = "nul" -input_player8_r3_btn = "nul" -input_player8_r3_mbtn = "nul" -input_player8_r_axis = "nul" -input_player8_r_btn = "nul" -input_player8_r_mbtn = "nul" -input_player8_r_x_minus = "nul" -input_player8_r_x_minus_axis = "nul" -input_player8_r_x_minus_btn = "nul" -input_player8_r_x_minus_mbtn = "nul" -input_player8_r_x_plus = "nul" -input_player8_r_x_plus_axis = "nul" -input_player8_r_x_plus_btn = "nul" -input_player8_r_x_plus_mbtn = "nul" -input_player8_r_y_minus = "nul" -input_player8_r_y_minus_axis = "nul" -input_player8_r_y_minus_btn = "nul" -input_player8_r_y_minus_mbtn = "nul" -input_player8_r_y_plus = "nul" -input_player8_r_y_plus_axis = "nul" -input_player8_r_y_plus_btn = "nul" -input_player8_r_y_plus_mbtn = "nul" -input_player8_right = "nul" -input_player8_right_axis = "nul" -input_player8_right_btn = "nul" -input_player8_right_mbtn = "nul" -input_player8_select = "nul" -input_player8_select_axis = "nul" -input_player8_select_btn = "nul" -input_player8_select_mbtn = "nul" -input_player8_start = "nul" -input_player8_start_axis = "nul" -input_player8_start_btn = "nul" -input_player8_start_mbtn = "nul" -input_player8_turbo = "nul" -input_player8_turbo_axis = "nul" -input_player8_turbo_btn = "nul" -input_player8_turbo_mbtn = "nul" -input_player8_up = "nul" -input_player8_up_axis = "nul" -input_player8_up_btn = "nul" -input_player8_up_mbtn = "nul" -input_player8_x = "nul" -input_player8_x_axis = "nul" -input_player8_x_btn = "nul" -input_player8_x_mbtn = "nul" -input_player8_y = "nul" -input_player8_y_axis = "nul" -input_player8_y_btn = "nul" -input_player8_y_mbtn = "nul" -input_player9_a = "nul" -input_player9_a_axis = "nul" -input_player9_a_btn = "nul" -input_player9_a_mbtn = "nul" -input_player9_analog_dpad_mode = "0" -input_player9_b = "nul" -input_player9_b_axis = "nul" -input_player9_b_btn = "nul" -input_player9_b_mbtn = "nul" -input_player9_down = "nul" -input_player9_down_axis = "nul" -input_player9_down_btn = "nul" -input_player9_down_mbtn = "nul" -input_player9_gun_aux_a = "nul" -input_player9_gun_aux_a_axis = "nul" -input_player9_gun_aux_a_btn = "nul" -input_player9_gun_aux_a_mbtn = "nul" -input_player9_gun_aux_b = "nul" -input_player9_gun_aux_b_axis = "nul" -input_player9_gun_aux_b_btn = "nul" -input_player9_gun_aux_b_mbtn = "nul" -input_player9_gun_aux_c = "nul" -input_player9_gun_aux_c_axis = "nul" -input_player9_gun_aux_c_btn = "nul" -input_player9_gun_aux_c_mbtn = "nul" -input_player9_gun_dpad_down = "nul" -input_player9_gun_dpad_down_axis = "nul" -input_player9_gun_dpad_down_btn = "nul" -input_player9_gun_dpad_down_mbtn = "nul" -input_player9_gun_dpad_left = "nul" -input_player9_gun_dpad_left_axis = "nul" -input_player9_gun_dpad_left_btn = "nul" -input_player9_gun_dpad_left_mbtn = "nul" -input_player9_gun_dpad_right = "nul" -input_player9_gun_dpad_right_axis = "nul" -input_player9_gun_dpad_right_btn = "nul" -input_player9_gun_dpad_right_mbtn = "nul" -input_player9_gun_dpad_up = "nul" -input_player9_gun_dpad_up_axis = "nul" -input_player9_gun_dpad_up_btn = "nul" -input_player9_gun_dpad_up_mbtn = "nul" -input_player9_gun_offscreen_shot = "nul" -input_player9_gun_offscreen_shot_axis = "nul" -input_player9_gun_offscreen_shot_btn = "nul" -input_player9_gun_offscreen_shot_mbtn = "nul" -input_player9_gun_select = "nul" -input_player9_gun_select_axis = "nul" -input_player9_gun_select_btn = "nul" -input_player9_gun_select_mbtn = "nul" -input_player9_gun_start = "nul" -input_player9_gun_start_axis = "nul" -input_player9_gun_start_btn = "nul" -input_player9_gun_start_mbtn = "nul" -input_player9_gun_trigger = "nul" -input_player9_gun_trigger_axis = "nul" -input_player9_gun_trigger_btn = "nul" -input_player9_gun_trigger_mbtn = "nul" -input_player9_joypad_index = "8" -input_player9_l = "nul" -input_player9_l2 = "nul" -input_player9_l2_axis = "nul" -input_player9_l2_btn = "nul" -input_player9_l2_mbtn = "nul" -input_player9_l3 = "nul" -input_player9_l3_axis = "nul" -input_player9_l3_btn = "nul" -input_player9_l3_mbtn = "nul" -input_player9_l_axis = "nul" -input_player9_l_btn = "nul" -input_player9_l_mbtn = "nul" -input_player9_l_x_minus = "nul" -input_player9_l_x_minus_axis = "nul" -input_player9_l_x_minus_btn = "nul" -input_player9_l_x_minus_mbtn = "nul" -input_player9_l_x_plus = "nul" -input_player9_l_x_plus_axis = "nul" -input_player9_l_x_plus_btn = "nul" -input_player9_l_x_plus_mbtn = "nul" -input_player9_l_y_minus = "nul" -input_player9_l_y_minus_axis = "nul" -input_player9_l_y_minus_btn = "nul" -input_player9_l_y_minus_mbtn = "nul" -input_player9_l_y_plus = "nul" -input_player9_l_y_plus_axis = "nul" -input_player9_l_y_plus_btn = "nul" -input_player9_l_y_plus_mbtn = "nul" -input_player9_left = "nul" -input_player9_left_axis = "nul" -input_player9_left_btn = "nul" -input_player9_left_mbtn = "nul" -input_player9_mouse_index = "0" -input_player9_r = "nul" -input_player9_r2 = "nul" -input_player9_r2_axis = "nul" -input_player9_r2_btn = "nul" -input_player9_r2_mbtn = "nul" -input_player9_r3 = "nul" -input_player9_r3_axis = "nul" -input_player9_r3_btn = "nul" -input_player9_r3_mbtn = "nul" -input_player9_r_axis = "nul" -input_player9_r_btn = "nul" -input_player9_r_mbtn = "nul" -input_player9_r_x_minus = "nul" -input_player9_r_x_minus_axis = "nul" -input_player9_r_x_minus_btn = "nul" -input_player9_r_x_minus_mbtn = "nul" -input_player9_r_x_plus = "nul" -input_player9_r_x_plus_axis = "nul" -input_player9_r_x_plus_btn = "nul" -input_player9_r_x_plus_mbtn = "nul" -input_player9_r_y_minus = "nul" -input_player9_r_y_minus_axis = "nul" -input_player9_r_y_minus_btn = "nul" -input_player9_r_y_minus_mbtn = "nul" -input_player9_r_y_plus = "nul" -input_player9_r_y_plus_axis = "nul" -input_player9_r_y_plus_btn = "nul" -input_player9_r_y_plus_mbtn = "nul" -input_player9_right = "nul" -input_player9_right_axis = "nul" -input_player9_right_btn = "nul" -input_player9_right_mbtn = "nul" -input_player9_select = "nul" -input_player9_select_axis = "nul" -input_player9_select_btn = "nul" -input_player9_select_mbtn = "nul" -input_player9_start = "nul" -input_player9_start_axis = "nul" -input_player9_start_btn = "nul" -input_player9_start_mbtn = "nul" -input_player9_turbo = "nul" -input_player9_turbo_axis = "nul" -input_player9_turbo_btn = "nul" -input_player9_turbo_mbtn = "nul" -input_player9_up = "nul" -input_player9_up_axis = "nul" -input_player9_up_btn = "nul" -input_player9_up_mbtn = "nul" -input_player9_x = "nul" -input_player9_x_axis = "nul" -input_player9_x_btn = "nul" -input_player9_x_mbtn = "nul" -input_player9_y = "nul" -input_player9_y_axis = "nul" -input_player9_y_btn = "nul" -input_player9_y_mbtn = "nul" -input_poll_type_behavior = "2" -input_recording_toggle = "nul" -input_recording_toggle_axis = "nul" -input_recording_toggle_btn = "nul" -input_recording_toggle_mbtn = "nul" -input_remap_binds_enable = "true" -input_remapping_directory = ":\config\remaps" -input_reset = "h" -input_reset_axis = "nul" -input_reset_btn = "nul" -input_reset_mbtn = "nul" -input_rewind = "r" -input_rewind_axis = "nul" -input_rewind_btn = "nul" -input_rewind_mbtn = "nul" -input_save_state = "f2" -input_save_state_axis = "nul" -input_save_state_btn = "nul" -input_save_state_mbtn = "nul" -input_screenshot = "f8" -input_screenshot_axis = "nul" -input_screenshot_btn = "nul" -input_screenshot_mbtn = "nul" -input_shader_next = "m" -input_shader_next_axis = "nul" -input_shader_next_btn = "nul" -input_shader_next_mbtn = "nul" -input_shader_prev = "n" -input_shader_prev_axis = "nul" -input_shader_prev_btn = "nul" -input_shader_prev_mbtn = "nul" -input_state_slot_decrease = "f6" -input_state_slot_decrease_axis = "nul" -input_state_slot_decrease_btn = "nul" -input_state_slot_decrease_mbtn = "nul" -input_state_slot_increase = "f7" -input_state_slot_increase_axis = "nul" -input_state_slot_increase_btn = "nul" -input_state_slot_increase_mbtn = "nul" -input_streaming_toggle = "nul" -input_streaming_toggle_axis = "nul" -input_streaming_toggle_btn = "nul" -input_streaming_toggle_mbtn = "nul" -input_toggle_fast_forward = "space" -input_toggle_fast_forward_axis = "nul" -input_toggle_fast_forward_btn = "nul" -input_toggle_fast_forward_mbtn = "nul" -input_toggle_fullscreen = "f" -input_toggle_fullscreen_axis = "nul" -input_toggle_fullscreen_btn = "nul" -input_toggle_fullscreen_mbtn = "nul" -input_toggle_slowmotion = "nul" -input_toggle_slowmotion_axis = "nul" -input_toggle_slowmotion_btn = "nul" -input_toggle_slowmotion_mbtn = "nul" -input_turbo_period = "6" -input_volume_down = "subtract" -input_volume_down_axis = "nul" -input_volume_down_btn = "nul" -input_volume_down_mbtn = "nul" -input_volume_up = "add" -input_volume_up_axis = "nul" -input_volume_up_btn = "nul" -input_volume_up_mbtn = "nul" -joypad_autoconfig_dir = ":\autoconfig" -keyboard_gamepad_enable = "true" -keyboard_gamepad_mapping_type = "1" -kiosk_mode_enable = "false" -kiosk_mode_password = "" -led_driver = "null" -libretro_directory = ":\cores" -libretro_info_path = ":\info" -libretro_log_level = "1" -load_dummy_on_core_shutdown = "true" -location_allow = "false" -location_driver = "null" -materialui_icons_enable = "true" -materialui_menu_color_theme = "0" -menu_battery_level_enable = "true" -menu_core_enable = "true" -menu_driver = "xmb" -menu_dynamic_wallpaper_enable = "false" -menu_entry_hover_color = "ff64ff64" -menu_entry_normal_color = "ffffffff" -menu_font_color_blue = "255" -menu_font_color_green = "255" -menu_font_color_red = "255" -menu_footer_opacity = "1.000000" -menu_framebuffer_opacity = "0.900000" -menu_header_opacity = "1.000000" -menu_horizontal_animation = "true" -menu_left_thumbnails = "0" -menu_linear_filter = "true" -menu_mouse_enable = "true" -menu_navigation_browser_filter_supported_extensions_enable = "true" -menu_navigation_wraparound_enable = "true" -menu_pause_libretro = "true" -menu_pointer_enable = "false" -menu_shader_pipeline = "2" -menu_show_advanced_settings = "false" -menu_show_configurations = "true" -menu_show_core_updater = "true" -menu_show_help = "true" -menu_show_information = "true" -menu_show_latency = "true" -menu_show_load_content = "true" -menu_show_load_core = "true" -menu_show_online_updater = "true" -menu_show_overlays = "true" -menu_show_quit_retroarch = "true" -menu_show_reboot = "true" -menu_show_rewind = "true" -menu_show_shutdown = "true" -menu_swap_ok_cancel_buttons = "true" -menu_throttle_framerate = "true" -menu_thumbnails = "3" -menu_timedate_enable = "true" -menu_title_color = "ff64ff64" -menu_unified_controls = "false" -menu_wallpaper = "" -menu_wallpaper_opacity = "0.300000" -midi_driver = "winmm" -midi_input = "Off" -midi_output = "Off" -midi_volume = "100" -netplay_allow_slaves = "true" -netplay_check_frames = "600" -netplay_input_latency_frames_min = "0" -netplay_input_latency_frames_range = "0" -netplay_ip_address = "" -netplay_ip_port = "55435" -netplay_mitm_server = "nyc" -netplay_nat_traversal = "true" -netplay_nickname = "" -netplay_password = "" -netplay_public_announce = "true" -netplay_request_device_p1 = "false" -netplay_request_device_p10 = "false" -netplay_request_device_p11 = "false" -netplay_request_device_p12 = "false" -netplay_request_device_p13 = "false" -netplay_request_device_p14 = "false" -netplay_request_device_p15 = "false" -netplay_request_device_p16 = "false" -netplay_request_device_p2 = "false" -netplay_request_device_p3 = "false" -netplay_request_device_p4 = "false" -netplay_request_device_p5 = "false" -netplay_request_device_p6 = "false" -netplay_request_device_p7 = "false" -netplay_request_device_p8 = "false" -netplay_request_device_p9 = "false" -netplay_require_slaves = "false" -netplay_share_analog = "1" -netplay_share_digital = "1" -netplay_spectate_password = "" -netplay_start_as_spectator = "false" -netplay_stateless_mode = "false" -netplay_use_mitm_server = "false" -network_cmd_enable = "false" -network_cmd_port = "55355" -network_remote_base_port = "55400" -network_remote_enable = "false" -network_remote_enable_user_p1 = "false" -network_remote_enable_user_p10 = "false" -network_remote_enable_user_p11 = "false" -network_remote_enable_user_p12 = "false" -network_remote_enable_user_p13 = "false" -network_remote_enable_user_p14 = "false" -network_remote_enable_user_p15 = "false" -network_remote_enable_user_p16 = "false" -network_remote_enable_user_p2 = "false" -network_remote_enable_user_p3 = "false" -network_remote_enable_user_p4 = "false" -network_remote_enable_user_p5 = "false" -network_remote_enable_user_p6 = "false" -network_remote_enable_user_p7 = "false" -network_remote_enable_user_p8 = "false" -network_remote_enable_user_p9 = "false" -overlay_directory = ":\overlays" -pause_nonactive = "true" -perfcnt_enable = "false" -playlist_cores = "" -playlist_directory = ":\playlists" -playlist_entry_remove = "true" -playlist_entry_rename = "true" -playlist_names = "" -quick_menu_show_add_to_favorites = "true" -quick_menu_show_cheats = "true" -quick_menu_show_controls = "true" -quick_menu_show_information = "true" -quick_menu_show_options = "true" -quick_menu_show_recording = "true" -quick_menu_show_save_content_dir_overrides = "true" -quick_menu_show_save_core_overrides = "true" -quick_menu_show_save_game_overrides = "true" -quick_menu_show_save_load_state = "true" -quick_menu_show_shaders = "true" -quick_menu_show_streaming = "true" -quick_menu_show_take_screenshot = "true" -quick_menu_show_undo_save_load_state = "true" -record_driver = "ffmpeg" -recording_config_directory = "" -recording_output_directory = "" -resampler_directory = "" -rewind_buffer_size = "20971520" -rewind_buffer_size_step = "10" -rewind_enable = "false" -rewind_granularity = "1" -rgui_background_filler_thickness_enable = "true" -rgui_border_filler_enable = "true" -rgui_border_filler_thickness_enable = "true" -rgui_browser_directory = "default" -rgui_config_directory = ":\config" -rgui_show_start_screen = "false" -run_ahead_enabled = "false" -run_ahead_frames = "1" -run_ahead_hide_warnings = "false" -run_ahead_secondary_instance = "false" -savefile_directory = ":\saves" -savefiles_in_content_dir = "false" -savestate_auto_index = "false" -savestate_auto_load = "false" -savestate_auto_save = "false" -savestate_directory = ":\states" -savestate_thumbnail_enable = "false" -savestates_in_content_dir = "false" -screenshot_directory = "default" -screenshots_in_content_dir = "false" -show_hidden_files = "false" -slowmotion_ratio = "3.000000" -soft_filter_enable = "false" -soft_filter_index = "0" -sort_savefiles_enable = "false" -sort_savestates_enable = "false" -state_slot = "0" -statistics_show = "false" -stdin_cmd_enable = "false" -streaming_mode = "0" -suspend_screensaver_enable = "true" -sustained_performance_mode = "false" -system_directory = ":\system" -systemfiles_in_content_dir = "false" -threaded_data_runloop_enable = "true" -thumbnails_directory = ":\thumbnails" -twitch_stream_key = "" -ui_companion_enable = "false" -ui_companion_start_on_boot = "true" -ui_companion_toggle = "false" -ui_menubar_enable = "true" -user_language = "0" -video_adaptive_vsync = "false" -video_allow_rotate = "true" -video_aspect_ratio = "-1.000000" -video_aspect_ratio_auto = "false" -video_black_frame_insertion = "false" -video_context_driver = "" -video_crop_overscan = "true" -video_disable_composition = "false" -video_driver = "gl" -video_filter = "" -video_filter_dir = ":\filters\video" -video_font_enable = "true" -video_font_path = "" -video_font_size = "32.000000" -video_force_aspect = "true" -video_force_srgb_disable = "false" -video_frame_delay = "0" -video_fullscreen = "false" -video_fullscreen_x = "0" -video_fullscreen_y = "0" -video_gpu_record = "false" -video_gpu_screenshot = "true" -video_hard_sync = "false" -video_hard_sync_frames = "0" -video_max_swapchain_images = "3" -video_message_color = "ffff00" -video_message_pos_x = "0.050000" -video_message_pos_y = "0.050000" -video_monitor_index = "0" -video_msg_bgcolor_blue = "0" -video_msg_bgcolor_enable = "false" -video_msg_bgcolor_green = "0" -video_msg_bgcolor_opacity = "1.000000" -video_msg_bgcolor_red = "0" -video_post_filter_record = "false" -video_record_config = "" -video_record_quality = "4" -video_record_scale_factor = "1" -video_refresh_rate = "59.940060" -video_rotation = "0" -video_scale = "3.000000" -video_scale_integer = "false" -video_shader = "" -video_shader_dir = ":\shaders" -video_shader_enable = "false" -video_shader_watch_files = "false" -video_shared_context = "false" -video_smooth = "true" -video_stream_config = "" -video_stream_port = "56400" -video_stream_quality = "6" -video_stream_scale_factor = "1" -video_stream_url = "" -video_swap_interval = "1" -video_threaded = "false" -video_vsync = "true" -video_window_opacity = "100" -video_window_show_decorations = "true" -video_window_x = "0" -video_window_y = "0" -video_windowed_fullscreen = "true" -vrr_runloop_enable = "false" -wifi_driver = "null" -xmb_alpha_factor = "75" -xmb_font = "" -xmb_layout = "0" -xmb_menu_color_theme = "4" -xmb_scale_factor = "100" -xmb_shadows_enable = "true" -xmb_theme = "0" -xmb_vertical_thumbnails = "false" -youtube_stream_key = "" +## Skeleton config file for RetroArch + +# If set to a directory, the content history playlist will be saved +# to this directory. +# content_history_dir = + +# Automatically saves a savestate at the end of RetroArch's lifetime. +# The path is $SRAM_PATH.auto. +# RetroArch will automatically load any savestate with this path on startup if savestate_auto_load is set. +# savestate_auto_save = false +# savestate_auto_load = true + +# Load libretro from a dynamic location for dynamically built RetroArch. +# This option is mandatory. + +# Path to a libretro implementation. +# libretro_path = "/path/to/libretro.so" + +# Sets log level for libretro cores (GET_LOG_INTERFACE). +# If a log level issued by a libretro core is below libretro_log_level, it is ignored. +# DEBUG logs are always ignored unless verbose mode is activated (--verbose). +# DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3. +# libretro_log_level = 0 + +# Enable or disable verbosity level of frontend. +# log_verbosity = false + +# If this option is enabled, every content file loaded in RetroArch will be +# automatically added to a history list. +# history_list_enable = true + +# Enable performance counters +# perfcnt_enable = false + +# Path to core options config file. +# This config file is used to expose core-specific options. +# It will be written to by RetroArch. +# A default path will be assigned if not set. +# core_options_path = + +# Path to content history file. +# RetroArch keeps track of all content loaded in the menu and from CLI directly for convenient quick loading. +# A default path will be assigned if not set. +# content_history_path = + +# Path to music content history file (optional). +# RetroArch keeps track of all music content loaded in the menu and from CLI directly for convenient quick loading. +# A default path will be assigned if not set. +# content_music_history_path = + +# Path to image content history file (optional). +# RetroArch keeps track of all image content loaded in the menu and from CLI directly for convenient quick loading. +# A default path will be assigned if not set. +# content_image_history_path = + +# Path to video content history file (optional). +# RetroArch keeps track of all video content loaded in the menu and from CLI directly for convenient quick loading. +# A default path will be assigned if not set. +# content_video_history_path = + +# Number of entries that will be kept in content history file. +# content_history_size = 100 + +# Content directory. Interacts with RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY. +# Usually set by developers who bundle libretro/RetroArch apps to point to assets. +# content_directory = + +# Sets start directory for menu config browser. +# rgui_config_directory = + +# Show startup screen in menu. +# Is automatically set to false when seen for the first time. +# This is only updated in config if config_save_on_exit is set to true, however. +# rgui_show_start_screen = true + +# Flushes config to disk on exit. Useful for menu as settings can be modified. +# Overwrites the config. #include's and comments are not preserved. +# config_save_on_exit = true + +# Shows hidden files and folders in directory listings. +# show_hidden_files = false + +#### Driver + +# Input driver. Depending on video driver, it might force a different input driver. +# input_driver = sdl + +# Joypad driver. ("udev", "linuxraw", "paraport", "sdl2", "hid", "dinput") +# input_joypad_driver = + +# Video driver to use. "gl", "xvideo", "sdl", "d3d" +# video_driver = "gl" + +# Which context implementation to use. +# Possible ones for desktop are: glx, x-egl, kms-egl, sdl-gl, wgl. +# By default, tries to use first suitable driver. +# video_context_driver = + +# Audio driver backend. Depending on configuration possible candidates are: alsa, pulse, oss, jack, rsound, roar, openal, sdl, xaudio. +# audio_driver = + +# Audio resampler driver backend. Which audio resampler to use. +# Default will use "sinc". +# audio_resampler = + +# Camera driver. +# camera_driver = + +# Location driver. +# location_driver = + +# Menu driver to use. ("rgui", "xmb", "glui") +# menu_driver = "rgui" + +# Record driver. Used when recording video. +# record_driver = + +#### Video + +# Suspends the screensaver if set to true. Is a hint that does not necessarily have to be honored +# by video driver. +# suspend_screensaver_enable = true + +# Display framerate. +# fps_show = false + +# Display total number of frames rendered. (only displays if fps_show is enabled) +# framecount_show = + +# Which monitor to prefer. 0 (default) means no particular monitor is preferred, 1 and up (1 being first monitor), +# suggests RetroArch to use that particular monitor. +# video_monitor_index = 0 + +# Start in fullscreen. Can be changed at runtime. +# video_fullscreen = false + +# If fullscreen, prefer using a windowed fullscreen mode. +# video_windowed_fullscreen = true + +# Fullscreen resolution. Resolution of 0 uses the resolution of the desktop. +# video_fullscreen_x = 0 +# video_fullscreen_y = 0 + +# Video refresh rate of your CRT monitor. +# Used to calculate a suitable audio input rate. +# crt_video_refresh_rate = 59.94 + +# Video refresh rate of your monitor. +# Used to calculate a suitable audio input rate. +# video_refresh_rate = 59.94 + +# Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows +# have video problems with sRGB FBO support enabled. +# video_force_srgb_disable = false + +# If this is true and video_aspect_ratio is not set, +# aspect ratio is decided by libretro implementation. +# If this is false, 1:1 PAR will always be assumed if video_aspect_ratio is not set. +# video_aspect_ratio_auto = false + +# A floating point value for video aspect ratio (width / height). +# If this is not set, aspect ratio is assumed to be automatic. +# Behavior then is defined by video_aspect_ratio_auto. +# video_aspect_ratio = + +# Windowed x resolution scale and y resolution scale +# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale) +# video_scale = 3.0 + +# Percentage of opacity to use for the window (100 is completely opaque). +# video_window_opacity = 100 + +# Whether to enable the default window decorations like border, titlebar etc. +# video_window_show_decorations = true + +# Forcibly disable composition. Only works in Windows Vista/7 for now. +# video_disable_composition = false + +# Video vsync. +# video_vsync = true + +# Interval at which a Vsync swap is performed. +# 1 is normal, 2 is doubled frames, 3 is tripled frames, etc. +# video_swap_interval = 1 + +# Max amount of swapchain images. +# Single buffering = 1, Double buffering = 2, 3 = Triple buffering +# video_max_swapchain_images = 3 + +# Attempts to hard-synchronize CPU and GPU. Can reduce latency at cost of performance. +# video_hard_sync = false + +# Sets how many frames CPU can run ahead of GPU when using video_hard_sync. +# Maximum is 3. +# video_hard_sync_frames = 0 + +# Sets how many milliseconds to delay after VSync before running the core. +# Can reduce latency at cost of higher risk of stuttering. +# Maximum is 15. +# video_frame_delay = 0 + +# Inserts a black frame inbetween frames. +# Useful for 120 Hz monitors who want to play 60 Hz material with eliminated ghosting. +# video_refresh_rate should still be configured as if it is a 60 Hz monitor (divide refresh rate by 2). +# video_black_frame_insertion = false + +# Use threaded video driver. Using this might improve performance at possible cost of latency and more video stuttering. +# video_threaded = false + +# Use a shared context for HW rendered libretro cores. +# Avoids having to assume HW state changes inbetween frames. +# video_shared_context = false + +# Smoothens picture with bilinear filtering. Should be disabled if using pixel shaders. +# video_smooth = true + +# Forces rendering area to stay equal to content aspect ratio or as defined in video_aspect_ratio. +# video_force_aspect = true + +# Only scales video in integer steps. +# The base size depends on system-reported geometry and aspect ratio. +# If video_force_aspect is not set, X/Y will be integer scaled independently. +# video_scale_integer = false + +# Index of the aspect ratio selection in the menu. +# 19 = Config, 20 = 1:1 PAR, 21 = Core Provided, 22 = Custom Aspect Ratio +# aspect_ratio_index = 19 + +# Forces cropping of overscanned frames. +# Exact behavior of this option is implementation specific. +# video_crop_overscan = true + +# Path to shader. Shader can be either Cg, CGP (Cg preset) or GLSL, GLSLP (GLSL preset) +# video_shader = "/path/to/shader.{cg,cgp,glsl,glslp}" + +# Load video_shader on startup. +# Other shaders can still be loaded later in runtime. +# video_shader_enable = false + +# CPU-based video filter. Path to a dynamic library. +# video_filter = + +# Path to a font used for rendering messages. This path must be defined to enable fonts. +# Do note that the _full_ path of the font is necessary! +# video_font_path = + +# Size of the font rendered in points. +# video_font_size = 32 + +# Enable usage of OSD messages. +# video_font_enable = true + +# Offset for where messages will be placed on screen. Values are in range 0.0 to 1.0 for both x and y values. +# [0.0, 0.0] maps to the lower left corner of the screen. +# video_message_pos_x = 0.05 +# video_message_pos_y = 0.05 + +# Color for message. The value is treated as a hexadecimal value. +# It is a regular RGB hex number, i.e. red is "ff0000". +# video_message_color = ffffff + +# Background color for OSD messages. Red/Green/Blue values are from 0 to 255 and opacity is 0.0 to 1.0. +# video_message_bgcolor_enable = false +# video_message_bgcolor_red = 0 +# video_message_bgcolor_green = 0 +# video_message_bgcolor_blue = 0 +# video_message_bgcolor_opacity = 1.0 + +# Allows libretro cores to set rotation modes. +# Setting this to false will honor, but ignore this request. +# This is useful for vertically oriented content where one manually rotates the monitor. +# video_allow_rotate = true + +# Forces a certain rotation of the screen. +# The rotation is added to rotations which the libretro core sets (see video_allow_rotate). +# The angle is * 90 degrees counter-clockwise. +# video_rotation = 0 + +#### Audio + +# Enable audio. +# audio_enable = true + +# Mutes audio. +# audio_mute_enable = false + +# Mutes audio mixer volume globally. +# audio_mixer_mute_enable = false + +# Audio output samplerate. +# audio_out_rate = 48000 + +# Override the default audio device the audio_driver uses. This is driver dependant. E.g. ALSA wants a PCM device, OSS wants a path (e.g. /dev/dsp), Jack wants portnames (e.g. system:playback1,system:playback_2), and so on ... +# audio_device = + +# Audio DSP plugin that processes audio before it's sent to the driver. Path to a dynamic library. +# audio_dsp_plugin = + +# Will sync (block) on audio. Recommended. +# audio_sync = true + +# Desired audio latency in milliseconds. Might not be honored if driver can't provide given latency. +# audio_latency = 64 + +# Enable audio rate control. +# audio_rate_control = true + +# Controls audio rate control delta. Defines how much input rate can be adjusted dynamically. +# Input rate = in_rate * (1.0 +/- audio_rate_control_delta) +# audio_rate_control_delta = 0.005 + +# Controls maximum audio timing skew. Defines the maximum change in input rate. +# Input rate = in_rate * (1.0 +/- max_timing_skew) +# audio_max_timing_skew = 0.05 + +# Audio volume. Volume is expressed in dB. +# 0 dB is normal volume. No gain will be applied. +# Gain can be controlled in runtime with input_volume_up/input_volume_down. +# audio_volume = 0.0 + +# Audio mixer volume. Volume is expressed in dB. +# 0 dB is normal volume. No gain will be applied. +# audio_mixer_volume = 0.0 + +#### Overlay + +# Enable the overlay. +# input_overlay_enable = true + +# Hide the current overlay from appearing inside the menu. +# input_overlay_hide_in_menu = true + +# Path to input overlay. +# input_overlay = + +# Opacity of all the UI elements of the overlay. +# input_overlay_opacity = 1.0 + +# Scale of all UI elements of the overlay. +# input_overlay_scale = 1.0 + +#### Input + +# Path to input remapping file. +# input_remapping_path = + +# Input bind timer timeout. +# Amount of seconds to wait until proceeding to the next bind. Default: 5, minimum: 1 +# input_bind_timeout = 1 + +# If enabled, overrides the input binds with the remapped binds set for the current core. +# input_remap_binds_enable = true + +# Maximum amount of users supported by RetroArch. +# input_max_users = 16 + +# Keyboard layout for input driver if applicable (udev/evdev for now). +# Syntax is either just layout (e.g. "no"), or a layout and variant separated with colon ("no:nodeadkeys"). +# input_keyboard_layout = + +# Defines axis threshold. Possible values are [0.0, 1.0] +# input_axis_threshold = 0.5 + +# Enable input auto-detection. Will attempt to autoconfigure +# joypads, Plug-and-Play style. +# input_autodetect_enable = true + +# Show the input descriptors set by the core instead of the +# default ones. +# input_descriptor_label_show = true + +# Hide input descriptors that were not set by the core. +# input_descriptor_hide_unbound = false + +# Influence how input polling is done inside RetroArch. +# 0 : Early - Input polling is performed before call to retro_run. +# 1 : Normal - Input polling is performed when retro_input_poll is +# requested. +# 2 : Late - Input polling is performed on first call to retro_input_state +# per frame +# +# Setting it to 0 or 2 can result in less latency depending on +# your configuration. +# +# When netplay is enabled, the default polling behavior (1) will +# be used regardless of the value set here. +# input_poll_type_behavior = 1 + +# Sets which libretro device is used for a user. +# Devices are indentified with a number. +# This is normally saved by the menu. +# Device IDs are found in libretro.h. +# These settings are overridden by explicit command-line arguments which refer to input devices. +# None: 0 +# Joypad (RetroPad): 1 +# Mouse: 2 +# Keyboard: 3 +# Generic Lightgun: 4 +# Joypad w/ Analog (RetroPad + Analog sticks): 5 +# Multitap (SNES specific): 257 +# Super Scope (SNES specific): 260 +# Justifier (SNES specific): 516 +# Justifiers (SNES specific): 772 + +# input_libretro_device_p1 = +# input_libretro_device_p2 = +# input_libretro_device_p3 = +# input_libretro_device_p4 = +# input_libretro_device_p5 = +# input_libretro_device_p6 = +# input_libretro_device_p7 = +# input_libretro_device_p8 = + +# Keyboard input. Will recognize letters ("a" to "z") and the following special keys (where "kp_" +# is for keypad keys): +# +# left, right, up, down, enter, kp_enter, tab, insert, del, end, home, +# rshift, shift, ctrl, alt, space, escape, add, subtract, kp_plus, kp_minus, +# f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, +# num0, num1, num2, num3, num4, num5, num6, num7, num8, num9, pageup, pagedown, +# keypad0, keypad1, keypad2, keypad3, keypad4, keypad5, keypad6, keypad7, keypad8, keypad9, +# period, capslock, numlock, backspace, multiply, divide, print_screen, scroll_lock, +# tilde, backquote, pause, quote, comma, minus, slash, semicolon, equals, leftbracket, +# backslash, rightbracket, kp_period, kp_equals, rctrl, ralt +# +# Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely, +# rather than relying on a default. +# input_player1_a = "x" +# input_player1_b = "z" +# input_player1_y = "a" +# input_player1_x = "s" +# input_player1_start = "enter" +# input_player1_select = "rshift" +# input_player1_l = "q" +# input_player1_r = "w" +# input_player1_left = "left" +# input_player1_right = "right" +# input_player1_up = "up" +# input_player1_down = "down" +# input_player1_l2 = +# input_player1_r2 = +# input_player1_l3 = +# input_player1_r3 = + +# Two analog sticks (DualShock-esque). +# Bound as usual, however, if a real analog axis is bound, +# it can be read as a true analog. +# Positive X axis is right, Positive Y axis is down. +# input_player1_l_x_plus = +# input_player1_l_x_minus = +# input_player1_l_y_plus = +# input_player1_l_y_minus = +# input_player1_r_x_plus = +# input_player1_r_x_minus = +# input_player1_r_y_plus = +# input_player1_r_y_minus = + +# If desired, it is possible to override which joypads are being used for user 1 through 8. +# First joypad available is 0. +# input_player1_joypad_index = 0 +# input_player2_joypad_index = 1 +# input_player3_joypad_index = 2 +# input_player4_joypad_index = 3 +# input_player5_joypad_index = 4 +# input_player6_joypad_index = 5 +# input_player7_joypad_index = 6 +# input_player8_joypad_index = 7 + +# Input device buttons. +# Figure these out by using RetroArch-Phoenix or retroarch-joyconfig. +# You can use joypad hats with hnxx, where n is the hat, and xx is a string representing direction. +# E.g. "h0up" +# input_player1_a_btn = +# input_player1_b_btn = +# input_player1_y_btn = +# input_player1_x_btn = +# input_player1_start_btn = +# input_player1_select_btn = +# input_player1_l_btn = +# input_player1_r_btn = +# input_player1_left_btn = +# input_player1_right_btn = +# input_player1_up_btn = +# input_player1_down_btn = +# input_player1_l2_btn = +# input_player1_r2_btn = +# input_player1_l3_btn = +# input_player1_r3_btn = + +# Menu buttons. +# menu_search_btn = +# menu_info_btn = +# menu_default_btn = +# menu_scroll_down_btn = +# menu_scroll_up_btn = + +# Swap buttons for OK/Cancel +# menu_swap_ok_cancel_buttons = false + +# Axis for RetroArch D-Pad. +# Needs to be either '+' or '-' in the first character signaling either positive or negative direction of the axis, then the axis number. +# Do note that every other input option has the corresponding _btn and _axis binds as well; they are omitted here for clarity. +# input_player1_left_axis = +# input_player1_right_axis = +# input_player1_up_axis = +# input_player1_down_axis = + +# Holding the turbo while pressing another button will let the button enter a turbo mode +# where the button state is modulated with a periodic signal. +# The modulation stops when the button itself (not turbo button) is released. +# input_player1_turbo = + +# Describes the period and how long of that period a turbo-enabled button should behave. +# Numbers are described in frames. +# input_turbo_period = 6 +# input_turbo_duty_cycle = 3 + +# This goes all the way to user 8 (*_player2_*, *_player3_*, etc), but omitted for clarity. +# All input binds have corresponding binds for keyboard (none), joykeys (_btn) and joyaxes (_axis) as well. + +# Toggles fullscreen. +# input_toggle_fullscreen = f + +# Saves state. +# input_save_state = f2 +# Loads state. +# input_load_state = f4 + +# State slots. With slot set to 0, save state name is *.state (or whatever defined on commandline). +# When slot is != 0, path will be $path%d, where %d is slot number. +# input_state_slot_increase = f7 +# input_state_slot_decrease = f6 + +# Toggles between fast-forwarding and normal speed. +# input_toggle_fast_forward = space + +# Hold for fast-forward. Releasing button disables fast-forward. +# input_hold_fast_forward = l + +# Key to exit RetroArch cleanly. +# Killing it in any hard way (SIGKILL, etc) will terminate RetroArch without saving RAM, etc. +# On Unix-likes, SIGINT/SIGTERM allows a clean deinitialization. +# input_exit_emulator = escape + + +# Applies next and previous shader in directory. +# input_shader_next = m +# input_shader_prev = n + +# Hold button down to rewind. Rewinding must be enabled. +# input_rewind = r + +# Toggle between recording and not. +# input_movie_record_toggle = o + +# Toggle between paused and non-paused state +# input_pause_toggle = p + +# Frame advance when content is paused +# input_frame_advance = k + +# Reset the content. +# input_reset = h + +# Cheats. +# input_cheat_index_plus = y +# input_cheat_index_minus = t +# input_cheat_toggle = u + +# Mute/unmute audio +# input_audio_mute = f9 + +# Take screenshot +# input_screenshot = f8 + +# Netplay flip users. +# input_netplay_flip_players = i + +# Hold for slowmotion. +# input_slowmotion = e + +# Enable other hotkeys. +# If this hotkey is bound to either keyboard, joybutton or joyaxis, +# all other hotkeys will be disabled unless this hotkey is also held at the same time. +# This is useful for RETRO_KEYBOARD centric implementations +# which query a large area of the keyboard, where it is not desirable +# that hotkeys get in the way. + +# Alternatively, all hotkeys for keyboard could be disabled by the user. +# input_enable_hotkey_btn = + +# Increases audio volume. +# input_volume_up = kp_plus +# Decreases audio volume. +# input_volume_down = kp_minus + +# Toggles to next overlay. Wraps around. +# input_overlay_next = + +# Toggles eject for disks. Used for multiple-disk content. +# input_disk_eject_toggle = + +# Cycles through disk images. Use after ejecting. +# Complete by toggling eject again. +# input_disk_next = + +# Toggles menu. +# input_menu_toggle = f1 + +# RetroPad button combination to toggle menu +# 0 = none, 1 = L + R + Y + D-Pad Down, 2 = L3 + R3, 3 = Start + Select +# input_menu_toggle_gamepad_combo = 0 + +# allow any RetroPad to control the menu +# all_users_control_menu = false + +# Toggles mouse grab. When mouse is grabbed, RetroArch hides the mouse, +# and keeps the mouse pointer inside the window to allow relative mouse input +# to work better. +# input_grab_mouse_toggle = f11 + +#### Menu + +# If disabled, will hide 'Online Updater' inside the menu. +# menu_show_online_updater = true + +# If disabled, will hide the ability to update cores (and core info files) inside the menu. +# menu_show_core_updater = true + +# If disabled, the libretro core will keep running in the background when we +# are in the menu. +# menu_pause_libretro = false + +# If disabled, we use separate controls for menu operation. +# menu_unified_controls = false + +# Enable mouse controls inside the menu. +# menu_mouse_enable = false + +# Enable touch controls inside the menu. +# menu_pointer_enable = false + +# Shows current date and/or time inside menu. +# menu_timedate_enable = true + +# Shows current battery level inside menu. +# menu_battery_level_enable = true + +# Shows current core inside menu. +# menu_core_enable = true + +# Path to an image to set as menu wallpaper. +# menu_wallpaper = + +# Dynamically load a new wallpaper depending on context. +# menu_dynamic_wallpaper_enable = false + +# Type of thumbnail to display. 0 = none, 1 = snaps, 2 = titles, 3 = boxarts +# menu_thumbnails = 0 +# menu_left_thumbnails = 0 + +# Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically. +# menu_navigation_wraparound_enable = false + +# Filter files being shown in filebrowser by supported extensions. +# menu_navigation_browser_filter_supported_extensions_enable = true + +# Collapse subgroup settings into main group to create one big listing of settings +# per category. +# menu_collapse_subgroups_enable = false + +#### Core +# +# Prevent libretro cores from closing RetroArch on exit by loading a dummy core. +# load_dummy_on_core_shutdown = "true" + +# Check for firmware requirement(s) before loading a content. +# check_firmware_before_loading = "false" + +#### User Interface + +# Start UI companion driver's interface on boot (if available). +# ui_companion_start_on_boot = true + +# Toggle companion UI on startup (currently only used to show the WIMP UI) +# ui_companion_toggle = false + +# Only init the WIMP UI for this session if this is enabled +# desktop_menu_enable = true + +#### Camera + +# Override the default camera device the camera driver uses. This is driver dependant. +# camera_device = + +# Override the default privacy permission for cores that want to access camera services. Is "false" by default. +# camera_allow = false + +#### Location + +# Override the default privacy permission for cores that want to access location services. Is "false" by default. +# location_allow = false + +#### Core Updater + +# URL to core update directory on buildbot. +# core_updater_buildbot_url = "http://buildbot.libretro.com" + +# URL to assets update directory on buildbot. +# core_updater_buildbot_assets_url = "http://buildbot.libretro.com/assets/" + +# After downloading, automatically extract archives that the downloads are contained inside. +# core_updater_auto_extract_archive = true + +#### Network + +# When being client over netplay, use keybinds for user 1. +# netplay_client_swap_input = false + +# The username of the person running RetroArch. This will be used for playing online, for instance. +# netplay_nickname = + +# The amount of delay frames to use for netplay. Increasing this value will increase +# performance, but introduce more latency. +# netplay_delay_frames = 0 + +# Netplay mode for the current user. +# false is Server, true is Client. +# netplay_mode = false + +# Enable or disable spectator mode for the user during netplay. +# netplay_spectator_mode_enable = false + +# The IP Address of the host to connect to. +# netplay_ip_address = + +# The port of the host IP Address. Can be either a TCP or UDP port. +# netplay_ip_port = 55435 + +# Force game hosting to go through a man-in-the-middle server to get around firewalls and NAT/UPnP problems. +# netplay_use_mitm_server = false + +# The requested MITM server to use. +# netplay_mitm_server = "nyc" + +#### Directory + +# Sets the System/BIOS directory. +# Implementations can query for this directory to load BIOSes, system-specific configs, etc. +# system_directory = + +# Save all downloaded files to this directory. +# core_assets_directory = + +# Assets directory. This location is queried by default when menu interfaces try to look for +# loadable assets, etc. +# assets_directory = + +# Dynamic wallpapers directory. The place to store the wallpapers dynamically +# loaded by the menu depending on context. +# dynamic_wallpapers_directory = + +# Thumbnails directory. To store thumbnail files. +# thumbnails_directory = + +# File browser directory. Sets start directory for menu file browser. +# rgui_browser_directory = + +# Core directory for libretro core implementations. +# libretro_directory = + +# Core info directory for libretro core information. +# libretro_info_path = + +# Path to content database directory. +# content_database_path = + +# Saved queries are stored to this directory. +# cursor_directory = + +# Path to cheat database directory. +# cheat_database_path = + +# Defines a directory where CPU-based video filters are kept. +# video_filter_dir = + +# Directory where DSP plugins are kept. +# audio_filter_dir = + +# Defines a directory where shaders (Cg, CGP, GLSL) are kept for easy access. +# video_shader_dir = + +# Recording output directory. Where recordings are saved. +# recording_output_directory = + +# Recording config directory. Where recording settings are kept. +# recording_config_directory = + +# Overlay directory. Where overlays are kept for easy access. +# overlay_directory = + +# Directory to dump screenshots to. +# screenshot_directory = + +# Directory for joypad autoconfigs. +# If a joypad is plugged in, that joypad will be autoconfigured if a config file +# corresponding to that joypad is present in joypad_autoconfig_dir. +# Input binds which are made explicit (input_playerN_*_btn/axis) will take priority over autoconfigs. +# Autoconfigs can be created with retroarch-joyconfig, manually, or with a frontend. +# Requires input_autodetect_enable to be enabled. +# joypad_autoconfig_dir = + +# Save all remapped controls to this directory. +# input_remapping_directory = + +# Save all playlists/collections to this directory. +# playlist_directory = + +# Save all save files (*.srm) to this directory. This includes related files like .bsv, .rtc, .psrm, etc ... +# This will be overridden by explicit command line options. +# savefile_directory = + +# Save all save states (*.state) to this directory. +# This will be overridden by explicit command line options. +# savestate_directory = + +# If set to a directory, content which is temporarily extracted +# will be extracted to this directory. +# cache_directory = + +#### Misc + +# Enable rewinding. This will take a performance hit when playing, so it is disabled by default. +# rewind_enable = false + +# Rewinding buffer size in megabytes. Bigger rewinding buffer means you can rewind longer. +# The buffer should be approx. 20MB per minute of buffer time. +# rewind_buffer_size = 20 + +# Rewind granularity. When rewinding defined number of frames, you can rewind several frames at a time, increasing the rewinding speed. +# rewind_granularity = 1 + +# Pause gameplay when window focus is lost. +# pause_nonactive = true + +# Autosaves the non-volatile SRAM at a regular interval. This is disabled by default unless set otherwise. +# The interval is measured in seconds. A value of 0 disables autosave. +# autosave_interval = + +# Records video after CPU video filter. +# video_post_filter_record = false + +# Records output of GPU shaded material if available. +# video_gpu_record = false + +# Screenshots output of GPU shaded material if available. +# video_gpu_screenshot = true + +# Watch content shader files for changes and auto-apply as necessary. +# video_shader_watch_files = false + +# Block SRAM from being overwritten when loading save states. +# Might potentially lead to buggy games. +# block_sram_overwrite = false + +# When saving a savestate, save state index is automatically increased before +# it is saved. +# Also, when loading content, the index will be set to the highest existing index. +# There is no upper bound on the index. +# savestate_auto_index = false + +# Slowmotion ratio. When slowmotion, content will slow down by factor. +# slowmotion_ratio = 3.0 + +# The maximum rate at which content will be run when using fast forward. (E.g. 5.0 for 60 fps content => 300 fps cap). +# RetroArch will go to sleep to ensure that the maximum rate will not be exceeded. +# Do not rely on this cap to be perfectly accurate. +# If this is set at 0, then fastforward ratio is unlimited (no FPS cap) +# fastforward_ratio = 0.0 + +# Enable stdin/network command interface. +# network_cmd_enable = false +# network_cmd_port = 55355 +# stdin_cmd_enable = false + +# Enable Sustained Performance Mode in Android 7.0+ +# sustained_performance_mode = true From c0f9f7b9a91d8aedcc0cd81157cfa375893bf58f Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 26 Sep 2018 21:40:57 -0500 Subject: [PATCH 0084/1292] [recording] update streaming url at startup and whenever the stream keys are updated --- configuration.c | 1 + menu/menu_setting.c | 51 +++--------------------------------------- record/record_driver.c | 49 ++++++++++++++++++++++++++++++++++++++++ record/record_driver.h | 2 ++ 4 files changed, 55 insertions(+), 48 deletions(-) diff --git a/configuration.c b/configuration.c index 661573c666..8674a06240 100644 --- a/configuration.c +++ b/configuration.c @@ -3041,6 +3041,7 @@ static bool config_load_file(const char *path, bool set_defaults, } frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode); + recording_driver_update_streaming_url(); ret = true; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index cf6a253cfc..6557d98bf6 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2956,53 +2956,8 @@ static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting) #ifdef HAVE_FFMPEG static void update_streaming_url_write_handler(rarch_setting_t *setting) { - settings_t *settings = config_get_ptr(); - const char* youtube_url = "rtmp://a.rtmp.youtube.com/live2/"; - const char* twitch_url = "rtmp://live.twitch.tv/app/"; - - if (!setting) - return; - - switch (settings->uints.streaming_mode) - { - case STREAMING_MODE_TWITCH: - { - if (!string_is_empty(settings->arrays.twitch_stream_key)) - snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), - "%s%s", twitch_url, settings->arrays.twitch_stream_key); - else - { - /* To-Do: Show input box for twitch_stream_key*/ - RARCH_LOG("[recording] twitch streaming key empty"); - } - break; - } - case STREAMING_MODE_YOUTUBE: - { - if (!string_is_empty(settings->arrays.youtube_stream_key)) - { - snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), - "%s%s", youtube_url, settings->arrays.youtube_stream_key); - } - else - { - /* To-Do: Show input box for youtube_stream_key*/ - RARCH_LOG("[recording] youtube streaming key empty"); - } - break; - } - case STREAMING_MODE_LOCAL: - /* To-Do: figure out default interface and bind to that instead */ - snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), - "udp://%s:%u", "127.0.0.1", settings->uints.video_stream_port); - break; - case STREAMING_MODE_CUSTOM: - default: - /* Do nothing, let the user input the URL */ - break; - } + recording_driver_update_streaming_url(); } - #endif #ifdef HAVE_LAKKA @@ -9702,7 +9657,7 @@ static bool setting_append_list( &group_info, &subgroup_info, parent_group, - general_write_handler, + update_streaming_url_write_handler, general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); @@ -9728,7 +9683,7 @@ static bool setting_append_list( &group_info, &subgroup_info, parent_group, - general_write_handler, + update_streaming_url_write_handler, general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); diff --git a/record/record_driver.c b/record/record_driver.c index aca643ab44..32896df950 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -520,6 +520,55 @@ unsigned *recording_driver_get_height(void) return &recording_height; } +void recording_driver_update_streaming_url() +{ + settings_t *settings = config_get_ptr(); + const char* youtube_url = "rtmp://a.rtmp.youtube.com/live2/"; + const char* twitch_url = "rtmp://live.twitch.tv/app/"; + + if (!settings) + return; + + switch (settings->uints.streaming_mode) + { + case STREAMING_MODE_TWITCH: + { + if (!string_is_empty(settings->arrays.twitch_stream_key)) + snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), + "%s%s", twitch_url, settings->arrays.twitch_stream_key); + else + { + /* To-Do: Show input box for twitch_stream_key*/ + RARCH_LOG("[recording] twitch streaming key empty"); + } + break; + } + case STREAMING_MODE_YOUTUBE: + { + if (!string_is_empty(settings->arrays.youtube_stream_key)) + { + snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), + "%s%s", youtube_url, settings->arrays.youtube_stream_key); + } + else + { + /* To-Do: Show input box for youtube_stream_key*/ + RARCH_LOG("[recording] youtube streaming key empty"); + } + break; + } + case STREAMING_MODE_LOCAL: + /* To-Do: figure out default interface and bind to that instead */ + snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url), + "udp://%s:%u", "127.0.0.1", settings->uints.video_stream_port); + break; + case STREAMING_MODE_CUSTOM: + default: + /* Do nothing, let the user input the URL */ + break; + } +} + void recording_driver_free_state(void) { recording_gpu_width = 0; diff --git a/record/record_driver.h b/record/record_driver.h index 5e959ee08c..539cb50698 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -208,6 +208,8 @@ bool recording_is_enabled(void); bool streaming_is_enabled(void); +void recording_driver_update_streaming_url(); + extern void *recording_data; RETRO_END_DECLS From f588ea8d768c98fadbd273b62626be9370e65eb8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 10:44:58 +0200 Subject: [PATCH 0085/1292] Take out this ifdef --- configuration.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/configuration.c b/configuration.c index aa24ff9612..7abcbc70e4 100644 --- a/configuration.c +++ b/configuration.c @@ -54,9 +54,7 @@ #include "../list_special.h" -#ifdef HAVE_FFMPEG #include "record/record_driver.h" -#endif static const char* invalid_filename_chars[] = { /* https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names--fo */ From ebcf4c5a9592b9ad771df8d12bc3f6a034c624e1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 11:50:26 +0200 Subject: [PATCH 0086/1292] Only show this if recording driver is not NULL --- menu/menu_displaylist.c | 45 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index bab44cb644..fceea6f21c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2656,33 +2656,34 @@ static int menu_displaylist_parse_load_content_settings( MENU_ENUM_LABEL_ADD_TO_FAVORITES, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); } -#ifdef HAVE_FFMPEG - if (!recording_is_enabled()) + if (string_is_not_equal(settings->arrays.record_driver, "null")) { - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING), - msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING), - MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING, MENU_SETTING_ACTION, 0, 0); + if (!recording_is_enabled()) + { + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING), + msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING), + MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING, MENU_SETTING_ACTION, 0, 0); - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING), - msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING), - MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING, MENU_SETTING_ACTION, 0, 0); - } - else - { - if (streaming_is_enabled()) menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING), - msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING), - MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING, MENU_SETTING_ACTION, 0, 0); + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING), + msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING), + MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING, MENU_SETTING_ACTION, 0, 0); + } else - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING), - msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING), - MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING, MENU_SETTING_ACTION, 0, 0); + { + if (streaming_is_enabled()) + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING), + msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING), + MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING, MENU_SETTING_ACTION, 0, 0); + else + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING), + msg_hash_to_str(MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING), + MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING, MENU_SETTING_ACTION, 0, 0); + } } -#endif if (settings->bools.quick_menu_show_options && !settings->bools.kiosk_mode_enable) { From ddc256e410ef91d0ff134f8ffad2729eba54f5eb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 11:53:27 +0200 Subject: [PATCH 0087/1292] Take out the HAVE_FFMPEG ifdefs --- configuration.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/configuration.c b/configuration.c index 2b619bbff2..fae1a05383 100644 --- a/configuration.c +++ b/configuration.c @@ -1164,14 +1164,12 @@ static struct config_path_setting *populate_settings_path(settings_t *settings, SETTING_PATH("input_overlay", settings->paths.path_overlay, false, NULL, true); #endif -#ifdef HAVE_FFMPEG SETTING_PATH("video_record_config", settings->paths.path_record_config, false, NULL, true); SETTING_PATH("video_stream_config", settings->paths.path_stream_config, false, NULL, true); SETTING_PATH("video_stream_url", settings->paths.path_stream_url, false, NULL, true); -#endif SETTING_PATH("video_font_path", settings->paths.path_font, false, NULL, true); SETTING_PATH("cursor_directory", @@ -1620,13 +1618,11 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("midi_volume", &settings->uints.midi_volume, true, midi_volume, false); -#ifdef HAVE_FFMPEG SETTING_UINT("video_stream_port", &settings->uints.video_stream_port, true, RARCH_STREAM_DEFAULT_PORT, false); SETTING_UINT("video_record_quality", &settings->uints.video_record_quality, true, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, false); SETTING_UINT("video_stream_quality", &settings->uints.video_stream_quality, true, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, false); SETTING_UINT("video_record_scale_factor", &settings->uints.video_record_scale_factor, true, 1, false); SETTING_UINT("video_stream_scale_factor", &settings->uints.video_stream_scale_factor, true, 1, false); -#endif *size = count; From 3dc303f929f62c9bd10335d5a09dacfc149f5478 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 11:55:36 +0200 Subject: [PATCH 0088/1292] Take out this ifdef --- menu/menu_setting.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 6557d98bf6..55cedce577 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2953,12 +2953,10 @@ static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting) } #endif -#ifdef HAVE_FFMPEG static void update_streaming_url_write_handler(rarch_setting_t *setting) { recording_driver_update_streaming_url(); } -#endif #ifdef HAVE_LAKKA static void systemd_service_toggle(const char *path, char *unit, bool enable) From 0a9c78c26dfd49d37fb4f77a2909a19eb246ebf2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 13:14:32 +0200 Subject: [PATCH 0089/1292] Cleanup --- record/record_driver.c | 6 +++--- record/record_driver.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/record/record_driver.c b/record/record_driver.c index 32896df950..9b2f4afe37 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -520,11 +520,11 @@ unsigned *recording_driver_get_height(void) return &recording_height; } -void recording_driver_update_streaming_url() +void recording_driver_update_streaming_url(void) { - settings_t *settings = config_get_ptr(); + settings_t *settings = config_get_ptr(); const char* youtube_url = "rtmp://a.rtmp.youtube.com/live2/"; - const char* twitch_url = "rtmp://live.twitch.tv/app/"; + const char* twitch_url = "rtmp://live.twitch.tv/app/"; if (!settings) return; diff --git a/record/record_driver.h b/record/record_driver.h index 539cb50698..6f29831549 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -208,7 +208,7 @@ bool recording_is_enabled(void); bool streaming_is_enabled(void); -void recording_driver_update_streaming_url(); +void recording_driver_update_streaming_url(void); extern void *recording_data; From a52b6a2c16b36b3ec3e4c2ebc99592d838d0a3b3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 13:38:32 +0200 Subject: [PATCH 0090/1292] Add Streaming Title setting --- configuration.h | 1 + intl/msg_hash_ar.h | 2 ++ intl/msg_hash_chs.h | 2 ++ intl/msg_hash_cht.h | 2 ++ intl/msg_hash_de.h | 2 ++ intl/msg_hash_eo.h | 2 ++ intl/msg_hash_es.h | 2 ++ intl/msg_hash_fr.h | 2 ++ intl/msg_hash_it.h | 2 ++ intl/msg_hash_ja.h | 2 ++ intl/msg_hash_ko.h | 2 ++ intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_nl.h | 2 ++ intl/msg_hash_pl.h | 2 ++ intl/msg_hash_pt_br.h | 2 ++ intl/msg_hash_pt_pt.h | 2 ++ intl/msg_hash_ru.h | 2 ++ intl/msg_hash_us.h | 2 ++ intl/msg_hash_vn.h | 2 ++ menu/menu_displaylist.c | 4 ++++ menu/menu_setting.c | 14 ++++++++++++++ msg_hash.h | 1 + 22 files changed, 56 insertions(+) diff --git a/configuration.h b/configuration.h index c873a8d094..8bee9de4a6 100644 --- a/configuration.h +++ b/configuration.h @@ -538,6 +538,7 @@ typedef struct settings char directory_thumbnails[PATH_MAX_LENGTH]; char directory_menu_config[PATH_MAX_LENGTH]; char directory_menu_content[PATH_MAX_LENGTH]; + char streaming_title[PATH_MAX_LENGTH]; } paths; bool modified; diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 5d4d0ffc6c..4113ed4570 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3653,3 +3653,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 80f308ad6a..876ab7be56 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3437,3 +3437,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 50e3d17f4c..38c91a467e 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3429,3 +3429,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 62984378c9..8a98713d73 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3539,3 +3539,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index a4f265f648..21982658f2 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3304,3 +3304,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index cdf9ab8eaa..d9382293dc 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7559,3 +7559,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index ac1b1555b5..f070b737dd 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3463,3 +3463,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index bca6a4bf45..f11e822530 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3523,3 +3523,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 0b3dc7027b..a4bd01113b 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3926,3 +3926,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 2cb15c3ec6..bd5e94c9d6 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3424,3 +3424,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 3dc2422412..a66314de60 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1701,3 +1701,5 @@ MSG_HASH(MENU_ENUM_LABEL_YOUTUBE_STREAM_KEY, "youtube_stream_key") MSG_HASH(MENU_ENUM_LABEL_STREAMING_MODE, "streaming_mode") +MSG_HASH(MENU_ENUM_LABEL_STREAMING_TITLE, + "streaming_title") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 832ce22ca4..7e5e4a3a28 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3298,3 +3298,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index d00b566130..c7666db3b4 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3726,3 +3726,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 799a453ae8..f39fa8e5cf 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7542,3 +7542,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index c2e7238914..d43afc0ca5 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3390,3 +3390,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 4be91f3cb5..ae068b3fd1 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3593,3 +3593,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 9d843ed4aa..e45e0e8ddc 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7580,3 +7580,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 1c14c1f9aa..8e9923f913 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3461,3 +3461,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Title of Stream") diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index fceea6f21c..4e5566b464 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7075,6 +7075,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_STREAMING_MODE, PARSE_ONLY_UINT, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_STREAMING_TITLE, + PARSE_ONLY_STRING, false) == 0) + count++; if (settings->uints.streaming_mode == STREAMING_MODE_LOCAL) { /* To-Do: Refresh on settings->uints.streaming_mode change to show this parameter */ diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 55cedce577..e9d3f94e5d 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -6524,6 +6524,20 @@ static bool setting_append_list( general_read_handler); menu_settings_list_current_add_values(list, list_info, "cfg"); + CONFIG_STRING( + list, list_info, + settings->paths.streaming_title, + sizeof(settings->paths.streaming_title), + MENU_ENUM_LABEL_STREAMING_TITLE, + MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + CONFIG_UINT( list, list_info, &settings->uints.streaming_mode, diff --git a/msg_hash.h b/msg_hash.h index f2a541a9e9..3987382c32 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -416,6 +416,7 @@ enum msg_hash_enums MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, MSG_RUNAHEAD_FAILED_TO_LOAD_STATE, MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, + MENU_LABEL(STREAMING_TITLE), MENU_LABEL(STREAMING_MODE), MENU_LABEL(VIDEO_RECORD_QUALITY), MENU_LABEL(VIDEO_STREAM_QUALITY), From 9dde33b5c13ebfbfdef84cf4533e87b833f5c48c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 14:02:11 +0200 Subject: [PATCH 0091/1292] Cleanups --- retroarch.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/retroarch.c b/retroarch.c index 110d29298a..e80350e718 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3080,37 +3080,32 @@ static enum runloop_state runloop_check_state( current_input, RARCH_STATE_SLOT_PLUS); bool should_slot_decrease = BIT256_GET( current_input, RARCH_STATE_SLOT_MINUS); + bool should_set = false; /* Checks if the state increase/decrease keys have been pressed * for this frame. */ if (should_slot_increase && !old_should_slot_increase) { - char msg[128]; int new_state_slot = settings->ints.state_slot + 1; - msg[0] = '\0'; - configuration_set_int(settings, settings->ints.state_slot, new_state_slot); - snprintf(msg, sizeof(msg), "%s: %d", - msg_hash_to_str(MSG_STATE_SLOT), - settings->ints.state_slot); - - runloop_msg_queue_push(msg, 2, 180, true); - - RARCH_LOG("%s\n", msg); + should_set = true; } else if (should_slot_decrease && !old_should_slot_decrease) { - char msg[128]; int new_state_slot = settings->ints.state_slot - 1; - msg[0] = '\0'; - if (settings->ints.state_slot > 0) - { configuration_set_int(settings, settings->ints.state_slot, new_state_slot); - } + + should_set = true; + } + + if (should_set) + { + char msg[128]; + msg[0] = '\0'; snprintf(msg, sizeof(msg), "%s: %d", msg_hash_to_str(MSG_STATE_SLOT), @@ -3326,7 +3321,7 @@ static enum runloop_state runloop_check_state( /* rarch_timer_begin */ timer.timeout_end = cpu_features_get_time_usec() + SHADER_FILE_WATCH_DELAY_MSEC * 1000; timer.timer_begin = true; - timer.timer_end = false; + timer.timer_end = false; } } @@ -3338,7 +3333,7 @@ static enum runloop_state runloop_check_state( if (need_to_apply) { /* rarch_timer_tick */ - timer.current = cpu_features_get_time_usec(); + timer.current = cpu_features_get_time_usec(); timer.timeout_us = (timer.timeout_end - timer.current); if (!timer.timer_end && rarch_timer_has_expired(&timer)) From c9b6df10f25cd75703ed2ea841b2dbac6357e8cf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 27 Sep 2018 14:17:34 +0200 Subject: [PATCH 0092/1292] Add HAVE_NETWORKING ifdef around these menu entries --- menu/menu_displaylist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 4e5566b464..78c493a066 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7295,6 +7295,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) PARSE_ACTION, false) == 0) count++; +#ifdef HAVE_NETWORKING if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_ACCOUNTS_YOUTUBE, PARSE_ACTION, false) == 0) @@ -7304,6 +7305,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_ACCOUNTS_TWITCH, PARSE_ACTION, false) == 0) count++; +#endif if (count == 0) menu_entries_append_enum(info->list, From acd40ff899781003e110e4ba7aab5f3cc23a0101 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Thu, 27 Sep 2018 10:10:56 -0400 Subject: [PATCH 0093/1292] add doxygen file --- Doxyfile | 2482 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2482 insertions(+) create mode 100644 Doxyfile diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000000..414bc2e6b1 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,2482 @@ +# Doxyfile 1.8.14 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "RetroArch" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = YES + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = YES + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/ + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /

" }, { "WRITE_CORE_RAM", command_write_ram, "
..." }, #endif @@ -198,41 +239,9 @@ static const struct cmd_map map[] = { { "MENU_B", RETRO_DEVICE_ID_JOYPAD_B }, { "MENU_B", RETRO_DEVICE_ID_JOYPAD_B }, }; - -static enum cmd_source_t lastcmd_source; -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) -static int lastcmd_net_fd; -static struct sockaddr_storage lastcmd_net_source; -static socklen_t lastcmd_net_source_len; #endif -#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)) -static bool command_reply(const char * data, size_t len) -{ - switch (lastcmd_source) - { - case CMD_NONE: - break; - case CMD_STDIN: -#ifdef HAVE_STDIN_CMD - fwrite(data, 1,len, stdout); - return true; -#else - break; -#endif - case CMD_NETWORK: -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) - sendto(lastcmd_net_fd, data, len, 0, - (struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len); - return true; -#else - break; -#endif - } - return false; -} -#endif bool command_set_shader(const char *arg) { @@ -261,17 +270,6 @@ bool command_set_shader(const char *arg) #endif } -static bool command_version(const char* arg) -{ - char reply[256] = {0}; - - sprintf(reply, "%s\n", PACKAGE_VERSION); -#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)) - command_reply(reply, strlen(reply)); -#endif - - return true; -} #if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS) #define SMY_CMD_STR "READ_CORE_RAM" @@ -646,7 +644,7 @@ bool command_network_new( return true; -#if (defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)) || defined(HAVE_STDIN_CMD) +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND) || defined(HAVE_STDIN_CMD) error: command_free(handle); return false; @@ -1670,7 +1668,7 @@ static bool command_event_main_state(unsigned cmd) { retro_ctx_size_info_t info; char msg[128]; - size_t state_path_size = 8192 * sizeof(char); + size_t state_path_size = 16384 * sizeof(char); char *state_path = (char*)malloc(state_path_size); global_t *global = global_get_ptr(); bool ret = false; diff --git a/tasks/task_content.c b/tasks/task_content.c index 18d4aee449..c2df099419 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -147,7 +147,9 @@ static int pending_subsystem_id = 0; static unsigned pending_subsystem_rom_id = 0; static char pending_subsystem_ident[255]; +#if 0 static char pending_subsystem_extensions[PATH_MAX_LENGTH]; +#endif static char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS]; diff --git a/tasks/task_save.c b/tasks/task_save.c index bf0783ff32..66bc264055 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -597,7 +597,8 @@ static void task_save_handler(retro_task_t *task) if (!state->file) { - state->file = intfstream_open_file(state->path, RETRO_VFS_FILE_ACCESS_WRITE, + state->file = intfstream_open_file( + state->path, RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE); if (!state->file) @@ -605,21 +606,15 @@ static void task_save_handler(retro_task_t *task) } if (!state->data) - { - state->data = get_serialized_data(state->path, state->size) ; - } + state->data = get_serialized_data(state->path, state->size) ; remaining = MIN(state->size - state->written, SAVE_STATE_CHUNK); if ( state->data ) - { written = (int)intfstream_write(state->file, (uint8_t*)state->data + state->written, remaining); - } else - { - written = 0 ; - } + written = 0; state->written += written; @@ -627,7 +622,7 @@ static void task_save_handler(retro_task_t *task) if (task_get_cancelled(task) || written != remaining) { - char err[256]; + char err[8192]; err[0] = '\0'; @@ -642,7 +637,9 @@ static void task_save_handler(retro_task_t *task) "RAM"); } else - snprintf(err, sizeof(err), "%s %s", msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO), state->path); + snprintf(err, sizeof(err), + "%s %s", + msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO), state->path); task_set_error(task, strdup(err)); task_save_handler_finished(task, state); @@ -845,30 +842,26 @@ static void task_load_handler(retro_task_t *task) if (state->bytes_read == state->size) { - char *msg = (char*)malloc(1024 * sizeof(char)); + size_t sizeof_msg = 8192; + char *msg = (char*)malloc(sizeof_msg * sizeof(char)); - msg[0] = '\0'; + msg[0] = '\0'; task_free_title(task); if (state->autoload) - { - snprintf(msg, - 1024 * sizeof(char), + snprintf(msg, sizeof_msg, "%s \"%s\" %s.", msg_hash_to_str(MSG_AUTOLOADING_SAVESTATE_FROM), state->path, msg_hash_to_str(MSG_SUCCEEDED)); - } else { if (state->state_slot < 0) strlcpy(msg, msg_hash_to_str(MSG_LOADED_STATE_FROM_SLOT_AUTO), - 1024 * sizeof(char) - ); + sizeof_msg); else - snprintf(msg, - 1024 * sizeof(char), + snprintf(msg, sizeof_msg, msg_hash_to_str(MSG_LOADED_STATE_FROM_SLOT), state->state_slot); From 57c77a9a281ccf5cd39c10685842e04445de1bf1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 4 Oct 2018 16:32:40 +0200 Subject: [PATCH 0232/1292] Silence more warnings --- menu/drivers/materialui.c | 4 ++-- menu/drivers/xmb.c | 4 ++-- movie.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index c6eb0a901e..5d09674ade 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1558,11 +1558,11 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) { int ticker_limit, value_len; char title_buf_msg_tmp[255]; - char title_buf_msg[255]; + char title_buf_msg[640]; title_buf_msg_tmp[0] = title_buf_msg[0] = '\0'; - snprintf(title_buf_msg, sizeof(title_buf), "%s (%s)", + snprintf(title_buf_msg, sizeof(title_buf_msg), "%s (%s)", title_buf, title_msg); value_len = (int)utf8len(title_buf); ticker_limit = (int)((usable_width / mui->glyph_width) - (value_len + 2)); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 6977578495..e1028bfd98 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1086,8 +1086,8 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) || (string_is_equal(entry.label, "loadstate")) || (string_is_equal(entry.label, "savestate")))) { - size_t path_size = 8024 * sizeof(char); - char *path = (char*)malloc(8204 * sizeof(char)); + size_t path_size = 8204 * sizeof(char); + char *path = (char*)malloc(path_size); global_t *global = global_get_ptr(); path[0] = '\0'; diff --git a/movie.c b/movie.c index 691e5e4d74..acc0e7554c 100644 --- a/movie.c +++ b/movie.c @@ -531,7 +531,7 @@ static bool runloop_check_movie_record(void) static bool runloop_check_movie_init(void) { - char msg[8192], path[8192]; + char msg[16384], path[8192]; settings_t *settings = config_get_ptr(); msg[0] = path[0] = '\0'; From 4206d7ac8ae545e99baea0c780d7ac6a539bbf76 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 4 Oct 2018 16:40:47 +0200 Subject: [PATCH 0233/1292] Silence warnings --- menu/cbs/menu_cbs_ok.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 97c5885fcb..a05fd0943c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3869,9 +3869,11 @@ int lan_room_count; void netplay_refresh_rooms_menu(file_list_t *list) { - char s[4115]; + char s[8300]; int i = 0; + s[0] = '\0'; + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) && From cdea2a0ba62923e82f1b1a00454d5468f81c1116 Mon Sep 17 00:00:00 2001 From: waitingmoon Date: Fri, 5 Oct 2018 02:34:04 +0900 Subject: [PATCH 0234/1292] Update msg_hash_ja.h (#7363) --- intl/msg_hash_ja.h | 120 ++++++++++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 940f9dfb73..a0c8816535 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -154,6 +154,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, "メニューの外観に関係する設定を変更する。" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LATENCY_SETTINGS, + "ビデオやオーディオ、入力遅延に関係する設定を変更します。" + ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, "CPUとGPUを強制に同期する。遅延が減る代わりに性能が低下する。" @@ -248,7 +252,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, - "ネットプレイのロビー一覧" + "ネットプレイのルーム一覧" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ASK_ARCHIVE, @@ -256,7 +260,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY, - "資産" + "アセット" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_BLOCK_FRAMES, @@ -332,7 +336,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_SH_BUFFER_LENGTH, - "WASAPIの共有バッファーサイズ" + "WASAPI共有バッファーサイズ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, @@ -428,7 +432,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BUILDBOT_ASSETS_URL, - "Buildbotの資産URL" + "BuildbotのアセットURL" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, @@ -570,13 +574,16 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, - "履歴一覧のサイズ" + "履歴の保存件数" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, "エントリーの削除を許可") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, "クイックメニュー" ) +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, + "ゲーム中のすべての設定に素早くアクセスできます。" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIR, "ダウンロード" ) @@ -662,7 +669,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, "ディレクトリ") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, - "ディスクトレイの開閉") + "ディスクトレイを開閉") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, "ディスクイメージを挿入") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_INDEX, @@ -736,7 +743,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT, MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_WHAT_IS_A_CORE, "コアとは?") MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_LIST_ENABLE, - "履歴一覧を有効") + "履歴を有効") MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_TAB, "履歴") MSG_HASH(MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU, @@ -952,7 +959,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, "前のシェーダー") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_HOLD_KEY, - "ホルドでスローモーション") + "ホールドでスローモーション") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_KEY, "スローモーションに切り替え") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, @@ -964,7 +971,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, "音量を上げる") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, - "ディスプレイのオーバーレイ") + "オーバーレイを表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, "メニュー表示中にオーバーレイを隠す") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, @@ -1128,7 +1135,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NEAREST, MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY, "ネットプレイ") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ALLOW_SLAVES, - "スレーブモードのクライアントを許す") + "スレーブモードのクライアントを許可") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, "ネットプレイのチェックフレーム") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, @@ -1257,8 +1264,12 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, "OSDディスプレイ") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, "OSDオーバーレイ") +MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS, + "OSDコントロールとベゼルを調整します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, "OSD通知") +MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, + "OSD通知を調整します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, "フォルダでアーカイブを開く") MSG_HASH(MENU_ENUM_LABEL_VALUE_OPTIONAL, @@ -1303,6 +1314,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, "プライバシー") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, "MIDI") +MSG_HASH(MENU_ENUM_SUBLABEL_MIDI_SETTINGS, + "MIDIの設定を変更します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, "終了") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, @@ -1746,7 +1759,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UNKNOWN, MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATER_SETTINGS, "アップデーター") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_ASSETS, - "資産をアップデート") + "アセットをアップデート") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES, "自動設定プロファイルをアップデート") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, @@ -1792,7 +1805,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, "オーバースキャンをクロップ(再起動が必要)") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, - "デスクトップのコンポジットを無効") + "デスクトップコンポジションを無効") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER, "ビデオのドライバ") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER, @@ -2647,13 +2660,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, "コンポジションを有効または無効にする。") MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, - "最近使ったファイルの履歴を有効または無効にする。") + "最近使ったファイル履歴を有効または無効にする。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, - "最近使ったファイルの履歴一覧の最大保存件数を設定する。") + "最近使ったファイル履歴の最大保存件数を設定する。") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, - "統一的なメニューコントロール") + "メニューコントロールを統一") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, - "Use the same controls for both the menu and the game. Applies to the keyboard.") + "メニューとゲームの両方に同じコントロールを使用します。キーボードに適用されます。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, "OSDメッセージを表示する。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_USER_REMOTE_ENABLE, @@ -2721,9 +2734,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "アプリを終了する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, - "ディスプレイのカスタムビデオ横幅を設定する。ゼロを設定すると出来るだけウィンドーをスケールする。") + "ディスプレイのカスタムビデオ横幅を指定します。ゼロを指定すると可能な限りウィンドウをスケールします。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, - "ディスプレイのカスタムビデオ縦幅を設定する。ゼロを設定すると出来るだけウィンドーをスケールする。") + "ディスプレイのカスタムビデオ縦幅を指定します。ゼロを指定すると可能な限りウィンドウをスケールします。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "OSDのカスタムX軸を指定する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -2868,6 +2881,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_WIFI_DRIVER, "使用するWi-Fiドライバ" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_DRIVER, + "使用するMIDIドライバ" + ) MSG_HASH( MENU_ENUM_SUBLABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, "ファイルブラウザーに表示されるファイルを対応する拡張子で絞り込む。" @@ -2922,7 +2939,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, - "ゲームのネットプレイを公開にアナウンスする。設定しないと、クライアントは手動で接続が必要です。" + "ゲームのネットプレイを一般公開します。設定しない場合、クライアントは手動接続が必要です。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, @@ -3202,9 +3219,9 @@ MSG_HASH( "Increase or decrease the amount of shader pipeline passes. You can bind a separate shader to each pipeline pass and configure its scale and filtering." ) MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, - "MITMサーバーを使用") + "中継サーバーを使用") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, - "MITMサーバーの設置場所") + "中継サーバーの設置場所") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, "中継サーバーにネットプレイ接続を転送する。ファイアウォールやNAT/UPnPに問題がある時に効果的。") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, @@ -3248,7 +3265,7 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER, "コアのアップデーターを表示") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER, - "Show/hide the ability to update cores (and core info files).") + "コア(とコアの情報ファイル)をアップデートする機能を表示/非表示にする。") MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN, "コンテンツをスキャンするための準備中") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, @@ -3257,6 +3274,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, "コアをハードディスクから削除する。") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, "エントリーの名前を変更する") +MSG_HASH(MENU_ENUM_SUBLABEL_RENAME_ENTRY, + "このエントリーのタイトルを変更します。") MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY, "Rename") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, @@ -3300,7 +3319,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, "コレクションのエントリーの名前変更をユーザーに許可する。") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, - "エントリーの名前変更を許す") + "エントリーの名前変更を許可") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, "「コアをロード」を表示") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE, @@ -3395,6 +3414,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, "お気に入りに追加") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, "お気に入りに追加") +MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES, + "このエントリーをお気に入りに追加します。") +MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST, + "このエントリーをお気に入りに追加します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION, "コアの関連付けをリセット") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, @@ -3412,9 +3435,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD, "パスワードを入力して下さい") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, - "パスワード正解。") + "パスワードが一致しました") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, - "パスワード不正解。") + "パスワードが一致しません") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED, "OSDメッセージの赤色値") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, @@ -3426,9 +3449,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, MSG_HASH(MSG_CONFIG_OVERRIDE_LOADED, "優先ファイルをロードしました。") MSG_HASH(MSG_GAME_REMAP_FILE_LOADED, - "ゲームの優先ファイルをロードしました。") + "ゲームのリマップファイルをロードしました。") MSG_HASH(MSG_CORE_REMAP_FILE_LOADED, - "コアの優先ファイルをロードしました。") + "コアのリマップファイルをロードしました。") MSG_HASH(MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES, "このコアはステートセーブを対応されていないために先読みが無効になりました。") MSG_HASH(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, @@ -3463,13 +3486,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, "Enable border filler thickness") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, "Enable background filler thickness") -MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "For CRT displays only. Attempts to use exact core/game resolution and refresh rate.") -MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, "CRT SwitchRes") -MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, - "Switch among native and ultrawide super resolutions." - ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, "CRT Super Resolution") +MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, + "For CRT displays only. Attempts to use exact core/game resolution and refresh rate.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, + "CRT SwitchRes") +MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, + "Switch among native and ultrawide super resolutions.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, + "CRT Super Resolution") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, "「巻き戻し」を表示") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, @@ -3592,6 +3616,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_SCAN_FINISHED, "
  • 上記タスクの後にRetroArchを再起動してください。
  • \n" "コンテンツが
    存在データベースの一致が必要です。まだちゃんと動けないとバグを報告できます。") #endif +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_WIMP, + "デスクトップメニューを表示") +MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_WIMP, + "デスクトップメニューを開きます。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN, "今後表示しない") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_STOP, @@ -3635,23 +3663,23 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST, MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, "オーバーライド") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, - "Options for overriding the global configuration.") + "グローバル設定をオーバーライドするための設定です。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, - "Will start playback of the audio stream. Once finished, it will remove the current audio stream from memory.") + "オーディオストリームの再生を開始します。再生が終わると、現在のオーディオストリームはメモリから取り除かれます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, - "Will start playback of the audio stream. Once finished, it will loop and play the track again from the beginning.") + "オーディオストリームの再生を開始します。再生が終わると、トラックは最初から繰り返して再生されます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, - "Will start playback of the audio stream. Once finished, it will jump to the next audio stream in sequential order and repeat this behavior. Useful as an album playback mode.") + "オーディオストリームの再生を開始します。再生が終わると、順番に次のオーディオストリームに移り、それを繰り返します。アルバム再生モードとして便利です。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, - "This will stop playback of the audio stream, but not remove it from memory. You can start playing it again by selecting 'Play'.") + "オーディオストリームの再生を停止しますが、メモリからは取り除きません。「再生」を選択することで再び再生を開始できます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, - "This will stop playback of the audio stream and remove it entirely from memory.") + "オーディオストリームの再生を停止してメモリから完全に取り除きます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, - "Adjust the volume of the audio stream.") + "オーディオストリームの音量を調整します。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER, - "Add this audio track to an available audio stream slot. If no slots are currently available, it will be ignored.") + "このオーディオトラックを使用可能なオーディオストリームスロットに追加します。空きスロットが存在しない場合は無視されます。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, - "Add this audio track to an available audio stream slot and play it. If no slots are currently available, it will be ignored.") + "このオーディオトラックを使用可能なオーディオストリームスロットに追加して再生します。空きスロットが存在しない場合は無視されます。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, "再生") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, @@ -3721,7 +3749,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST, MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_QUESTION, "質問") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_DELETE_FILE, - "ファイル削除に失敗しました。") + "ファイルの削除に失敗しました。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE, "ファイルの名前変更に失敗しました。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_GATHERING_LIST_OF_FILES, @@ -3936,9 +3964,9 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, - "Reset To Defaults" + "デフォルトに戻す" ) MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, - "Reset the current configuration to default values." + "現在の設定をデフォルトの値に戻します。" ) From c1662ded34792b3e8746292ad573640b2191c8e9 Mon Sep 17 00:00:00 2001 From: Zoran Vuckovic Date: Fri, 28 Sep 2018 16:07:51 +0200 Subject: [PATCH 0235/1292] Add ALSA MIDI driver --- Makefile.common | 1 + configuration.c | 5 + midi/drivers/alsa_midi.c | 484 +++++++++++++++++++++++++++++++++++++++ midi/midi_driver.c | 4 + 4 files changed, 494 insertions(+) create mode 100644 midi/drivers/alsa_midi.c diff --git a/Makefile.common b/Makefile.common index 2622c46af0..71fd4d0b10 100644 --- a/Makefile.common +++ b/Makefile.common @@ -542,6 +542,7 @@ endif ifeq ($(HAVE_ALSA), 1) OBJ += audio/drivers/alsa.o + OBJ += midi/drivers/alsa_midi.o ifeq ($(HAVE_THREADS), 1) OBJ += audio/drivers/alsathread.o diff --git a/configuration.c b/configuration.c index 0914c19c03..b238f37c32 100644 --- a/configuration.c +++ b/configuration.c @@ -298,6 +298,7 @@ enum record_driver_enum enum midi_driver_enum { MIDI_WINMM = RECORD_NULL + 1, + MIDI_ALSA, MIDI_NULL }; @@ -409,6 +410,8 @@ static enum record_driver_enum RECORD_DEFAULT_DRIVER = RECORD_NULL; #ifdef HAVE_WINMM static enum midi_driver_enum MIDI_DEFAULT_DRIVER = MIDI_WINMM; +#elif defined HAVE_ALSA +static enum midi_driver_enum MIDI_DEFAULT_DRIVER = MIDI_ALSA; #else static enum midi_driver_enum MIDI_DEFAULT_DRIVER = MIDI_NULL; #endif @@ -1047,6 +1050,8 @@ const char *config_get_default_midi(void) { case MIDI_WINMM: return "winmm"; + case MIDI_ALSA: + return "alsa"; case MIDI_NULL: break; } diff --git a/midi/drivers/alsa_midi.c b/midi/drivers/alsa_midi.c new file mode 100644 index 0000000000..671434967e --- /dev/null +++ b/midi/drivers/alsa_midi.c @@ -0,0 +1,484 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 The RetroArch team + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include + +#include +#include +#include +#include + +#include "../midi_driver.h" + +typedef struct +{ + snd_seq_t *seq; + snd_seq_addr_t in; + snd_seq_addr_t in_dest; + snd_seq_addr_t out; + snd_seq_addr_t out_src; + int out_queue; + snd_seq_real_time_t out_ev_time; /* time of the last output event */ +} alsa_midi_t; + +static const snd_seq_event_type_t alsa_midi_ev_map[8] = +{ + SND_SEQ_EVENT_NOTEOFF, + SND_SEQ_EVENT_NOTEON, + SND_SEQ_EVENT_KEYPRESS, + SND_SEQ_EVENT_CONTROLLER, + SND_SEQ_EVENT_PGMCHANGE, + SND_SEQ_EVENT_CHANPRESS, + SND_SEQ_EVENT_PITCHBEND, + SND_SEQ_EVENT_SYSEX +}; + +static bool alsa_midi_get_avail_ports(struct string_list *ports, unsigned caps) +{ + int r; + snd_seq_t *seq; + snd_seq_client_info_t *client_info; + snd_seq_port_info_t *port_info; + union string_list_elem_attr attr = {0}; + + snd_seq_client_info_alloca(&client_info); + snd_seq_port_info_alloca(&port_info); + + r = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK); + if (r < 0) + { + RARCH_ERR("[MIDI]: snd_seq_open failed with error %d.\n", r); + return false; + } + + snd_seq_client_info_set_client(client_info, -1); + + while (snd_seq_query_next_client(seq, client_info) == 0) + { + int client = snd_seq_client_info_get_client(client_info); + + snd_seq_port_info_set_client(port_info, client); + snd_seq_port_info_set_port(port_info, -1); + + while (snd_seq_query_next_port(seq, port_info) == 0) + { + unsigned port_caps = snd_seq_port_info_get_capability(port_info); + unsigned port_type = snd_seq_port_info_get_type(port_info); + + if ((port_type & SND_SEQ_PORT_TYPE_MIDI_GENERIC) && + (port_caps & caps) == caps) + { + const char *port_name = snd_seq_port_info_get_name(port_info); + + if (!string_list_append(ports, port_name, attr)) + { + RARCH_ERR("[MIDI]: string_list_append failed.\n"); + snd_seq_close(seq); + + return false; + } + } + } + } + + snd_seq_close(seq); + + return true; +} + +static bool alsa_midi_get_port(snd_seq_t *seq, const char *name, unsigned caps, + snd_seq_addr_t *addr) +{ + snd_seq_client_info_t *client_info; + snd_seq_port_info_t *port_info; + + snd_seq_client_info_alloca(&client_info); + snd_seq_port_info_alloca(&port_info); + + snd_seq_client_info_set_client(client_info, -1); + while (snd_seq_query_next_client(seq, client_info) == 0) + { + int client_id = snd_seq_client_info_get_client(client_info); + + snd_seq_port_info_set_client(port_info, client_id); + snd_seq_port_info_set_port(port_info, -1); + + while (snd_seq_query_next_port(seq, port_info) == 0) + { + unsigned port_caps = snd_seq_port_info_get_capability(port_info); + unsigned type = snd_seq_port_info_get_type(port_info); + + if ((type & SND_SEQ_PORT_TYPE_MIDI_GENERIC) && (port_caps & caps) == caps) + { + const char *port_name = snd_seq_port_info_get_name(port_info); + + if (string_is_equal(port_name, name)) + { + addr->client = client_id; + addr->port = snd_seq_port_info_get_port(port_info); + + return true; + } + } + } + } + + return false; +} + +static bool alsa_midi_get_avail_inputs(struct string_list *inputs) +{ + return alsa_midi_get_avail_ports(inputs, SND_SEQ_PORT_CAP_READ | + SND_SEQ_PORT_CAP_SUBS_READ); +} + +static bool alsa_midi_get_avail_outputs(struct string_list *outputs) +{ + return alsa_midi_get_avail_ports(outputs, SND_SEQ_PORT_CAP_WRITE | + SND_SEQ_PORT_CAP_SUBS_WRITE); +} + +static void alsa_midi_free(void *p) +{ + alsa_midi_t *d = (alsa_midi_t*)p; + + if (d) + { + if (d->seq) + snd_seq_close(d->seq); + free(d); + } +} + +static bool alsa_midi_set_input(void *p, const char *input) +{ + int r; + snd_seq_port_subscribe_t *sub; + alsa_midi_t *d = (alsa_midi_t*)p; + + if (!input) + { + if (d->in_dest.port >= 0) + { + snd_seq_delete_simple_port(d->seq, d->in_dest.port); + d->in_dest.port = -1; + } + + return true; + } + + if (!alsa_midi_get_port(d->seq, input, SND_SEQ_PORT_CAP_READ | + SND_SEQ_PORT_CAP_SUBS_READ, &d->in)) + return false; + + r = snd_seq_create_simple_port(d->seq, "in", SND_SEQ_PORT_CAP_WRITE | + SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_TYPE_APPLICATION); + if (r < 0) + { + RARCH_ERR("[MIDI]: snd_seq_create_simple_port failed with error %d.\n", r); + return false; + } + + d->in_dest.client = snd_seq_client_id(d->seq); + d->in_dest.port = r; + + snd_seq_port_subscribe_alloca(&sub); + snd_seq_port_subscribe_set_sender(sub, &d->in); + snd_seq_port_subscribe_set_dest(sub, &d->in_dest); + r = snd_seq_subscribe_port(d->seq, sub); + if (r < 0) + RARCH_ERR("[MIDI]: snd_seq_subscribe_port failed with error %d.\n", r); + + return r >= 0; +} + +static bool alsa_midi_set_output(void *p, const char *output) +{ + int r; + alsa_midi_t *d = (alsa_midi_t*)p; + + if (!output) + { + if (d->out_queue >= 0) + { + snd_seq_stop_queue(d->seq, d->out_queue, NULL); + snd_seq_free_queue(d->seq, d->out_queue); + d->out_queue = -1; + } + if (d->out_src.port >= 0) + { + snd_seq_delete_simple_port(d->seq, d->out_src.port); + d->out_src.port = -1; + } + + return true; + } + + if (!alsa_midi_get_port(d->seq, output, SND_SEQ_PORT_CAP_WRITE | + SND_SEQ_PORT_CAP_SUBS_WRITE, &d->out)) + return false; + + r = snd_seq_create_simple_port(d->seq, "out", SND_SEQ_PORT_CAP_READ | + SND_SEQ_PORT_CAP_SUBS_READ, SND_SEQ_PORT_TYPE_APPLICATION); + if (r < 0) + { + RARCH_ERR("[MIDI]: snd_seq_create_simple_port failed with error %d.\n", r); + return false; + } + + d->out_src.client = snd_seq_client_id(d->seq); + d->out_src.port = r; + + r = snd_seq_connect_to(d->seq, d->out_src.port, d->out.client, d->out.port); + if (r < 0) + { + RARCH_ERR("[MIDI]: snd_seq_connect_to failed with error %d.\n", r); + return false; + } + + d->out_queue = snd_seq_alloc_queue(d->seq); + if (d->out_queue < 0) + { + RARCH_ERR("[MIDI]: snd_seq_alloc_queue failed with error %d.\n", d->out_queue); + return false; + } + + r = snd_seq_start_queue(d->seq, d->out_queue, NULL); + if (r < 0) + { + RARCH_ERR("[MIDI]: snd_seq_start_queue failed with error %d.\n", r); + return false; + } + + return true; +} + +static void *alsa_midi_init(const char *input, const char *output) +{ + int r; + bool err = false; + alsa_midi_t *d = (alsa_midi_t*)calloc(sizeof(alsa_midi_t), 1); + + if (!d) + { + RARCH_ERR("[MIDI]: Out of memory.\n"); + return NULL; + } + + d->in_dest.port = -1; + d->out_src.port = -1; + d->out_queue = -1; + + r = snd_seq_open(&d->seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK); + if (r < 0) + { + RARCH_ERR("[MIDI]: snd_seq_open failed with error %d.\n", r); + err = true; + } + else if (!alsa_midi_set_input(d, input)) + err = true; + else if (!alsa_midi_set_output(d, output)) + err = true; + + if (err) + { + alsa_midi_free(d); + d = NULL; + } + + return d; +} + +static bool alsa_midi_read(void *p, midi_event_t *event) +{ + int r; + snd_seq_event_t *ev; + alsa_midi_t *d = (alsa_midi_t*)p; + + r = snd_seq_event_input(d->seq, &ev); + if (r < 0) + { +#ifdef DEBUG + if (r != -EAGAIN) + RARCH_ERR("[MIDI]: snd_seq_event_input failed with error %d.\n", r); +#endif + return false; + } + + if (ev->type == SND_SEQ_EVENT_NOTEOFF) + { + event->data[0] = 0x80 | ev->data.note.channel; + event->data[1] = ev->data.note.note; + event->data[2] = ev->data.note.velocity; + event->data_size = 3; + } + else if (ev->type == SND_SEQ_EVENT_NOTEON) + { + event->data[0] = 0x90 | ev->data.note.channel; + event->data[1] = ev->data.note.note; + event->data[2] = ev->data.note.velocity; + event->data_size = 3; + } + else if (ev->type == SND_SEQ_EVENT_KEYPRESS) + { + event->data[0] = 0xA0 | ev->data.note.channel; + event->data[1] = ev->data.note.note; + event->data[2] = ev->data.note.velocity; + event->data_size = 3; + } + else if (ev->type == SND_SEQ_EVENT_CONTROLLER) + { + event->data[0] = 0xB0 | ev->data.control.channel; + event->data[1] = ev->data.control.param; + event->data[2] = ev->data.control.value; + event->data_size = 3; + } + else if (ev->type == SND_SEQ_EVENT_PGMCHANGE) + { + event->data[0] = 0xC0 | ev->data.control.channel; + event->data[1] = ev->data.control.value; + event->data_size = 2; + } + else if (ev->type == SND_SEQ_EVENT_CHANPRESS) + { + event->data[0] = 0xD0 | ev->data.control.channel; + event->data[1] = ev->data.control.value; + event->data_size = 2; + } + else if (ev->type == SND_SEQ_EVENT_PITCHBEND) + { + event->data[0] = 0xE0 | ev->data.control.channel; + event->data[1] = ev->data.control.value & 127; + event->data[2] = ev->data.control.value >> 7; + event->data_size = 3; + } + else if (ev->type == SND_SEQ_EVENT_SYSEX) + { + if (ev->data.ext.len <= event->data_size) + { + size_t i; + uint8_t *ev_data = (uint8_t*)ev->data.ext.ptr; + + for (i = 0; i < ev->data.ext.len; ++i) + event->data[i] = ev_data[i]; + + event->data_size = ev->data.ext.len; + } +#ifdef DEBUG + else + { + RARCH_ERR("[MIDI]: SysEx event too big.\n"); + r = -1; + } +#endif + } + else + r = -1; + + event->delta_time = 0; + snd_seq_free_event(ev); + + return r >= 0; +} + +static bool alsa_midi_write(void *p, const midi_event_t *event) +{ + int r; + snd_seq_event_t ev; + alsa_midi_t *d = (alsa_midi_t*)p; + + ev.type = alsa_midi_ev_map[(event->data[0] >> 4) & 7]; + ev.flags = SND_SEQ_TIME_STAMP_REAL | SND_SEQ_TIME_MODE_ABS; + ev.queue = d->out_queue; + ev.time.time.tv_sec = d->out_ev_time.tv_sec + event->delta_time / 1000000; + ev.time.time.tv_nsec = d->out_ev_time.tv_nsec + + (event->delta_time % 1000000) * 1000; + if(ev.time.time.tv_nsec >= 1000000000) + { + ev.time.time.tv_sec += 1; + ev.time.time.tv_nsec -= 1000000000; + } + ev.source.port = d->out_src.port; + ev.dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS; + + if (ev.type == SND_SEQ_EVENT_NOTEOFF || ev.type == SND_SEQ_EVENT_NOTEON || + ev.type == SND_SEQ_EVENT_KEYPRESS) + { + ev.data.note.channel = event->data[0] & 0x0F; + ev.data.note.note = event->data[1]; + ev.data.note.velocity = event->data[2]; + } + else if (ev.type == SND_SEQ_EVENT_CONTROLLER) + { + ev.data.control.channel = event->data[0] & 0x0F; + ev.data.control.param = event->data[1]; + ev.data.control.value = event->data[2]; + } + else if (ev.type == SND_SEQ_EVENT_PGMCHANGE || + ev.type == SND_SEQ_EVENT_CHANPRESS) + { + ev.data.control.channel = event->data[0] & 0x0F; + ev.data.control.value = event->data[1]; + } + else if (ev.type == SND_SEQ_EVENT_PITCHBEND) + { + ev.data.control.channel = event->data[0] & 0x0F; + ev.data.control.value = event->data[1] | (event->data[2] << 7); + } + else if (ev.type == SND_SEQ_EVENT_SYSEX) + { + ev.flags |= SND_SEQ_EVENT_LENGTH_VARIABLE; + ev.data.ext.ptr = event->data; + ev.data.ext.len = event->data_size; + } + + r = snd_seq_event_output(d->seq, &ev); +#ifdef DEBUG + if (r < 0) + RARCH_ERR("[MIDI]: snd_seq_event_output failed with error %d.\n", r); +#endif + + d->out_ev_time.tv_sec = ev.time.time.tv_sec; + d->out_ev_time.tv_nsec = ev.time.time.tv_nsec; + + return r >= 0; +} + +static bool alsa_midi_flush(void *p) +{ + int r; + alsa_midi_t *d = (alsa_midi_t*)p; + + r = snd_seq_drain_output(d->seq); +#ifdef DEBUG + if (r < 0) + RARCH_ERR("[MIDI]: snd_seq_drain_output failed with error %d.\n", r); +#endif + + return r == 0; +} + +midi_driver_t midi_alsa = { + "alsa", + alsa_midi_get_avail_inputs, + alsa_midi_get_avail_outputs, + alsa_midi_init, + alsa_midi_free, + alsa_midi_set_input, + alsa_midi_set_output, + alsa_midi_read, + alsa_midi_write, + alsa_midi_flush +}; diff --git a/midi/midi_driver.c b/midi/midi_driver.c index d4f651f810..012a62d39a 100644 --- a/midi/midi_driver.c +++ b/midi/midi_driver.c @@ -27,8 +27,12 @@ extern midi_driver_t midi_null; extern midi_driver_t midi_winmm; +extern midi_driver_t midi_alsa; static midi_driver_t *midi_drivers[] = { +#ifdef HAVE_ALSA + &midi_alsa, +#endif #ifdef HAVE_WINMM &midi_winmm, #endif From 75a1ea749ba1d33d3ec754a36eb8dce3a470bb6a Mon Sep 17 00:00:00 2001 From: Dan Weiss Date: Thu, 4 Oct 2018 18:42:41 -0500 Subject: [PATCH 0236/1292] Fix missing BOM markers (#7367) --- intl/msg_hash_ar.h | 2 +- intl/msg_hash_chs.h | 2 +- intl/msg_hash_cht.h | 2 +- intl/msg_hash_ja.h | 2 +- intl/msg_hash_ko.h | 2 +- intl/msg_hash_pl.h | 2 +- intl/msg_hash_ru.h | 2 +- intl/msg_hash_vn.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 978563158f..632d6d533b 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "Compiler" ) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 3cb9488b9d..4ba192324b 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "编译器" ) diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 37e330beeb..85308f9526 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "編譯器" ) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index a0c8816535..429fb7a2e5 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) +#if defined(_MSC_VER) && !defined(_XBOX) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") #endif diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index abcd7f1c0b..e472924b91 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "컴파일러" ) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index aa786ee33c..ff951e0057 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "Kompilator" ) diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 2174e4627a..4e158378ab 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) +#if defined(_MSC_VER) && !defined(_XBOX) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") #endif diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index bfb8c8b93b..152b301709 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "Compiler" ) From 017d1b710e6c3864518adbdbba6ddcaf273b4f52 Mon Sep 17 00:00:00 2001 From: =Christian Murphy Date: Fri, 5 Oct 2018 23:11:38 +0100 Subject: [PATCH 0237/1292] Restore default time mode, replace non-sensical time date formats with more commonly used ones --- config.def.h | 2 +- intl/msg_hash_us.h | 6 +++--- menu/menu_driver.c | 6 +++--- menu/menu_setting.c | 2 +- msg_hash.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.def.h b/config.def.h index de7e1dd4fe..3a73c9044b 100644 --- a/config.def.h +++ b/config.def.h @@ -697,7 +697,7 @@ static const unsigned menu_thumbnails_default = 3; static const unsigned menu_left_thumbnails_default = 0; -static const unsigned menu_timedate_style = 4; +static const unsigned menu_timedate_style = 5; static const bool xmb_vertical_thumbnails = false; diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index fee3011d21..8e12aa6fe3 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2886,8 +2886,8 @@ MSG_HASH( "YYYY-MM-DD HH:MM" ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, - "YY-MM-DD" + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, + "MM-DD-YYYY HH:MM" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, @@ -2907,7 +2907,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, - "HH:MM (AM/PM)" + "HH:MM:SS (AM/PM)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TITLE_COLOR, diff --git a/menu/menu_driver.c b/menu/menu_driver.c index ebdfa229a6..38303dcb68 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -358,9 +358,9 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) strftime(datetime->s, datetime->len, "%Y-%m-%d %H:%M", localtime(&time_)); break; - case 2: /* Date */ + case 2: /* MM-DD-YYYY HH:MM */ strftime(datetime->s, datetime->len, - "%y-%m-%d", localtime(&time_)); + "%m-%d-%Y %H:%M", localtime(&time_)); break; case 3: /* Time */ strftime(datetime->s, datetime->len, @@ -384,7 +384,7 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) "%r", localtime(&time_)); #else strftime(datetime->s, datetime->len, - "%I:%M %p", localtime(&time_)); + "%I:%M:%S %p", localtime(&time_)); #endif } } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 853dd69f66..23812b4e9b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -525,7 +525,7 @@ static void setting_get_string_representation_uint_menu_timedate_style( case 2: strlcpy(s, msg_hash_to_str( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD), len); + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY), len); break; case 3: strlcpy(s, diff --git a/msg_hash.h b/msg_hash.h index 0eda40602e..f35b4502de 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2129,7 +2129,7 @@ enum msg_hash_enums MSG_CHEEVOS_HARDCORE_MODE_DISABLED, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD, + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, From 7366a46bc2881048ec20d2a0f6e2bd1bb1884725 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Fri, 5 Oct 2018 19:02:50 -0400 Subject: [PATCH 0238/1292] convert AM/PM string from local encoding to utf8 --- menu/menu_driver.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 38303dcb68..51d1674395 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef WIIU #include @@ -383,8 +384,20 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) strftime(datetime->s, datetime->len, "%r", localtime(&time_)); #else - strftime(datetime->s, datetime->len, - "%I:%M:%S %p", localtime(&time_)); + { + char *local; + + strftime(datetime->s, datetime->len, + + "%I:%M:%S %p", localtime(&time_)); + local = local_to_utf8_string_alloc(datetime->s); + + if (local) + { + strlcpy(datetime->s, local, datetime->len); + free(local); + } + } #endif } } From 41de006be61c6da1147b722a1199571a2aa2911d Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 6 Oct 2018 02:58:03 +0200 Subject: [PATCH 0239/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 4fca5db7a5..81ecc3dc6d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,5 @@ # 1.7.6 (future) +- MIDI: Add a Linux ALSA driver for MIDI. - LOCALIZATION: Update Italian translation. - LOCALIZATION: Update Japanese translation. - SCANNER: Fix GDI disc scanning. From 944ca22d76bc7f12d368dd38ea26978aad9202fc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 04:11:01 +0200 Subject: [PATCH 0240/1292] Localize some strings --- menu/cbs/menu_cbs_sublabel.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 21235de14e..d86ecd4ed3 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -528,7 +528,8 @@ static int action_bind_sublabel_remap_kbd_sublabel( input_config_get_device_display_name(user_idx) ? input_config_get_device_display_name(user_idx) : (input_config_get_device_name(user_idx) ? - input_config_get_device_name(user_idx) : "N/A")); + input_config_get_device_name(user_idx) : + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); return 0; } @@ -548,7 +549,9 @@ static int action_bind_sublabel_audio_mixer_stream( switch (stream->state) { case AUDIO_STREAM_STATE_NONE: - strlcpy(msg, "N/A", sizeof(msg)); + strlcpy(msg, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), + sizeof(msg)); break; case AUDIO_STREAM_STATE_STOPPED: strlcpy(msg, "Stopped", sizeof(msg)); @@ -564,7 +567,8 @@ static int action_bind_sublabel_audio_mixer_stream( break; } - snprintf(s, len, "State : %s | Volume: %.2f dB", msg, + snprintf(s, len, "State : %s | %s: %.2f dB", msg, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME), stream->volume); return 0; } @@ -582,7 +586,8 @@ static int action_bind_sublabel_remap_sublabel( input_config_get_device_display_name(offset) ? input_config_get_device_display_name(offset) : (input_config_get_device_name(offset) ? - input_config_get_device_name(offset) : "N/A")); + input_config_get_device_name(offset) : + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); return 0; } @@ -618,6 +623,7 @@ static int action_bind_sublabel_netplay_room( const char *gamename = NULL; const char *core_ver = NULL; const char *frontend = NULL; + const char *na = NULL; /* This offset may cause issues if any entries are added to this menu */ unsigned offset = i - 3; @@ -631,13 +637,14 @@ static int action_bind_sublabel_netplay_room( core_ver = netplay_room_list[offset].coreversion; gamecrc = netplay_room_list[offset].gamecrc; frontend = netplay_room_list[offset].frontend; + na = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE); snprintf(s, len, "RetroArch: %s (%s)\nCore: %s (%s)\nGame: %s (%08x)", - string_is_empty(ra_version) ? "n/a" : ra_version, - string_is_empty(frontend) ? "n/a" : frontend, + string_is_empty(ra_version) ? na : ra_version, + string_is_empty(frontend) ? na : frontend, corename, core_ver, - !string_is_equal(gamename, "N/A") ? gamename : "n/a", + !string_is_equal(gamename, na) ? gamename : na, gamecrc); #if 0 strlcpy(s, corename, len); From 653544d4c372d1261c01f9c81798cac0c4ae8217 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 04:13:58 +0200 Subject: [PATCH 0241/1292] Cleanups --- menu/menu_displaylist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index f684739444..b782a12504 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -291,7 +291,6 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) core_info_ctx_firmware_t firmware_info; bool update_missing_firmware = false; bool set_missing_firmware = false; - settings_t *settings = config_get_ptr(); firmware_info.path = core_info->path; firmware_info.directory.system = settings->paths.directory_system; From f94d7e07af75e52701cb5dc24aa5a5608c4016cc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 04:20:54 +0200 Subject: [PATCH 0242/1292] Cleanups --- menu/menu_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/menu_shader.c b/menu/menu_shader.c index 379be3709e..1dbb2aaf71 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -80,7 +80,6 @@ bool menu_shader_manager_init(void) { bool is_preset = false; config_file_t *conf = NULL; - settings_t *settings = config_get_ptr(); char *new_path = NULL; const char *path_shader = retroarch_get_shader_preset(); enum rarch_shader_type type = RARCH_SHADER_NONE; @@ -112,6 +111,7 @@ bool menu_shader_manager_init(void) else { char preset_path[PATH_MAX_LENGTH]; + settings_t *settings = config_get_ptr(); const char *shader_dir = *settings->paths.directory_video_shader ? settings->paths.directory_video_shader : From 09c8e5238738b28fa7382254330bd23da19c2f34 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 04:23:57 +0200 Subject: [PATCH 0243/1292] Cleanups --- menu/widgets/menu_dialog.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/menu/widgets/menu_dialog.c b/menu/widgets/menu_dialog.c index 4157e31502..6b52a313f8 100644 --- a/menu/widgets/menu_dialog.c +++ b/menu/widgets/menu_dialog.c @@ -48,7 +48,6 @@ int menu_dialog_iterate(char *s, size_t len, const char *label) cheevos_ctx_desc_t desc_info; #endif bool do_exit = false; - settings_t *settings = config_get_ptr(); switch (menu_dialog_current_type) { @@ -204,13 +203,16 @@ int menu_dialog_iterate(char *s, size_t len, const char *label) s, len); break; case MENU_DIALOG_HELP_EXTRACT: - menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT, - s, len); - - if (settings->bools.bundle_finished) { - settings->bools.bundle_finished = false; - do_exit = true; + settings_t *settings = config_get_ptr(); + menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT, + s, len); + + if (settings->bools.bundle_finished) + { + settings->bools.bundle_finished = false; + do_exit = true; + } } break; case MENU_DIALOG_QUIT_CONFIRM: From f11bb03825659ccc26465f4c67995facd62abbbd Mon Sep 17 00:00:00 2001 From: gvbr <41351562+gvbr@users.noreply.github.com> Date: Sat, 6 Oct 2018 04:37:37 -0700 Subject: [PATCH 0244/1292] Fix error when compiling without cheevos --- command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/command.c b/command.c index c7d4155e09..f52fcee785 100644 --- a/command.c +++ b/command.c @@ -140,12 +140,14 @@ struct command }; #if defined(HAVE_COMMAND) -#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)) static enum cmd_source_t lastcmd_source; +#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING) static int lastcmd_net_fd; static struct sockaddr_storage lastcmd_net_source; static socklen_t lastcmd_net_source_len; +#endif +#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)) static void command_reply(const char * data, size_t len) { switch (lastcmd_source) From 1cb4a0a34f9668b855b734d93d75b709694ce704 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 15:15:37 +0200 Subject: [PATCH 0245/1292] Update --- libretro-common/glsm/glsm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libretro-common/glsm/glsm.c b/libretro-common/glsm/glsm.c index ee7d1af7a7..f04fbd7dca 100644 --- a/libretro-common/glsm/glsm.c +++ b/libretro-common/glsm/glsm.c @@ -216,6 +216,20 @@ GLenum rglGetError(void) return glGetError(); } +/* + * + * Core in: + * OpenGL : 3.2 + * OpenGLES : N/A + */ + +void rglProvokingVertex( GLenum provokeMode) +{ +#if defined(HAVE_OPENGL) + glProvokingVertex(provokeMode); +#endif +} + /* * * Core in: From 22424fce0fcb1cb603a9ffb5c0d37eba8ee0d156 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 15:16:33 +0200 Subject: [PATCH 0246/1292] Update libretro-common --- libretro-common/include/glsm/glsmsym.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libretro-common/include/glsm/glsmsym.h b/libretro-common/include/glsm/glsmsym.h index 137f3cb5e4..a6184c1c74 100644 --- a/libretro-common/include/glsm/glsmsym.h +++ b/libretro-common/include/glsm/glsmsym.h @@ -33,6 +33,7 @@ RETRO_BEGIN_DECLS #define glTexCoord2f rglTexCoord2f /* more forward-compatible GL subset symbols */ +#define glProvokingVertex rglProvokingVertex #define glGetInteger64v rglGetInteger64v #define glGenSamplers rglGenSamplers #define glBindSampler rglBindSampler @@ -469,6 +470,7 @@ void rglGetInteger64v( GLenum pname, void rglUniform2iv( GLint location, GLsizei count, const GLint *value); +void rglProvokingVertex( GLenum provokeMode); RETRO_END_DECLS From f1e7e0c5f7b57076f4b2f41592adf93b2e7785dc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 15:40:48 +0200 Subject: [PATCH 0247/1292] Update GLSM --- libretro-common/glsm/glsm.c | 19 +++++++++---------- libretro-common/include/glsm/glsm.h | 1 + 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libretro-common/glsm/glsm.c b/libretro-common/glsm/glsm.c index f04fbd7dca..616ded620e 100644 --- a/libretro-common/glsm/glsm.c +++ b/libretro-common/glsm/glsm.c @@ -2800,10 +2800,8 @@ static bool glsm_state_ctx_destroy(void *data) return true; } -static bool glsm_state_ctx_init(void *data) +static bool glsm_state_ctx_init(glsm_ctx_params_t *params) { - glsm_ctx_params_t *params = (glsm_ctx_params_t*)data; - if (!params || !params->environ_cb) return false; @@ -2817,15 +2815,16 @@ static bool glsm_state_ctx_init(void *data) #else hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES2; #endif -#else -#ifdef CORE - hw_render.context_type = RETRO_HW_CONTEXT_OPENGL_CORE; - hw_render.version_major = 3; - hw_render.version_minor = 3; #else hw_render.context_type = RETRO_HW_CONTEXT_OPENGL; + if (params->context_type != RETRO_HW_CONTEXT_NONE) + hw_render.context_type = params->context_type; + if (params->major != 0) + hw_render.version_major = params->major; + if (params->minor != 0) + hw_render.version_minor = params->minor; #endif -#endif + hw_render.context_reset = params->context_reset; hw_render.context_destroy = params->context_destroy; hw_render.stencil = params->stencil; @@ -2873,7 +2872,7 @@ bool glsm_ctl(enum glsm_state_ctl state, void *data) glsm_state_ctx_destroy(data); break; case GLSM_CTL_STATE_CONTEXT_INIT: - return glsm_state_ctx_init(data); + return glsm_state_ctx_init((glsm_ctx_params_t*)data); case GLSM_CTL_STATE_SETUP: glsm_state_setup(); break; diff --git a/libretro-common/include/glsm/glsm.h b/libretro-common/include/glsm/glsm.h index d422267d11..9113bdc9a1 100644 --- a/libretro-common/include/glsm/glsm.h +++ b/libretro-common/include/glsm/glsm.h @@ -146,6 +146,7 @@ typedef struct glsm_ctx_params bool stencil; unsigned major; unsigned minor; + enum retro_hw_context_type context_type; } glsm_ctx_params_t; GLuint glsm_get_current_framebuffer(void); From 8250007b8e1d74ce09a80cc18aa3e5d2dc31dea8 Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 6 Oct 2018 14:52:44 +0200 Subject: [PATCH 0248/1292] Added Lakka Switch menu entries --- Makefile.common | 4 + config.def.h | 4 + intl/msg_hash_ar.h | 5 ++ intl/msg_hash_chs.h | 5 ++ intl/msg_hash_cht.h | 5 ++ intl/msg_hash_de.h | 5 ++ intl/msg_hash_eo.h | 5 ++ intl/msg_hash_es.h | 7 ++ intl/msg_hash_fr.h | 5 ++ intl/msg_hash_it.h | 5 ++ intl/msg_hash_ja.h | 5 ++ intl/msg_hash_ko.h | 5 ++ intl/msg_hash_lbl.h | 8 ++ intl/msg_hash_nl.h | 5 ++ intl/msg_hash_pl.h | 5 ++ intl/msg_hash_pt_br.h | 7 ++ intl/msg_hash_pt_pt.h | 5 ++ intl/msg_hash_ru.h | 5 ++ intl/msg_hash_us.h | 33 ++++++++ intl/msg_hash_vn.h | 5 ++ lakka.h | 63 ++++++++++++++ menu/cbs/menu_cbs_deferred_push.c | 23 ++++++ menu/cbs/menu_cbs_ok.c | 74 +++++++++++++++++ menu/cbs/menu_cbs_sublabel.c | 17 ++++ menu/cbs/menu_cbs_title.c | 28 +++++++ menu/drivers/xmb.c | 19 +++++ menu/menu_displaylist.c | 131 ++++++++++++++++++++++++++++++ menu/menu_displaylist.h | 8 +- menu/menu_driver.h | 7 ++ menu/menu_setting.c | 25 ++++++ msg_hash.h | 14 ++++ 31 files changed, 541 insertions(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index 043f8ce0e8..dbd0cac7e0 100644 --- a/Makefile.common +++ b/Makefile.common @@ -721,6 +721,10 @@ ifeq ($(HAVE_LAKKA), 1) DEFINES += -DHAVE_LAKKA endif +ifeq ($(HAVE_LAKKA_SWITCH), 1) + DEFINES += -DHAVE_LAKKA_SWITCH +endif + ifeq ($(HAVE_MENU_COMMON), 1) OBJ += menu/menu_driver.o \ menu/menu_content.o \ diff --git a/config.def.h b/config.def.h index 4607c2eb7b..8a651582f9 100644 --- a/config.def.h +++ b/config.def.h @@ -288,7 +288,11 @@ static bool menu_show_configurations = true; static bool menu_show_help = true; static bool menu_show_quit_retroarch = true; static bool menu_show_reboot = true; +#ifdef HAVE_LAKKA_SWITCH +static bool menu_show_shutdown = false; +#else static bool menu_show_shutdown = true; +#endif #if defined(HAVE_LAKKA) || defined(VITA) || defined(_3DS) static bool menu_show_core_updater = false; #else diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 632d6d533b..e47f4ba0c0 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -1308,8 +1308,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Start Content") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB Rating") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Reboot into RCM") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Reboot") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Recording Config") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 4ba192324b..3e945b01a3 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1209,8 +1209,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "启动游戏内容") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB 评分") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "重启 (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "重启") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "录像配置目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 85308f9526..41a56ad911 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -1209,8 +1209,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "啟動遊戲內容") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB 評分") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "重啟 (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "重啟") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "錄影設定目錄") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index a93a7e7037..bb337900ad 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -1232,8 +1232,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Starte Inhalt") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB-Bewertung") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Neustart (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Neustart") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Aufnahme-Konfigurationen") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 936dfae9e4..763b4cf48e 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -1113,8 +1113,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Start Content") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB Rating") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Reboot into RCM") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Reboot") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Recording Config") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index be712090e1..6c40ffa0c1 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -2133,10 +2133,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB Rating" ) +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REBOOT, + "Reiniciar (RCM)" + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_REBOOT, "Reiniciar" ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Carpeta de configuración de grabación" diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 2c178f0bd5..772a6a0c57 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -1220,8 +1220,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Démarrer le contenu") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "Classification TGDB") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Redémarrer en RCM") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Redémarrer") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Configurations d'enregistrement vidéo") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index a69f718ecd..6cad54ff30 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -1234,8 +1234,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Avvia il contenuto") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "Valutazione TGDB ") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Riavvia (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Riavvia") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Configurazione per la registrazione") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 429fb7a2e5..a7a9d19081 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -1374,8 +1374,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "コンテンツをスタート") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB評価") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "再起動 (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "再起動") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "録画設定") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index e472924b91..dab570bc6b 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -1206,8 +1206,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "컨텐츠 시작") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB 등급") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "재시작 (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "재시작") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "녹화 설정") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index f4cba8bbb1..2dcb447fa8 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1,3 +1,11 @@ +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, + "switch_gpu_profile") +MSG_HASH(MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, + "switch_backlight_control") +MSG_HASH(MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, + "switch_cpu_profile") +#endif MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_CHEEVOS_USERNAME, "accounts_cheevos_username") MSG_HASH(MENU_ENUM_LABEL_ACCOUNTS_LIST, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index ccb61b3e60..d33ee6965c 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -1111,8 +1111,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Content Opstarten") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB Rating") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Herstart (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Herstart") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Opname Config Map") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index ff951e0057..26ed0fd143 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -1314,8 +1314,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Rozpocznij zawartość") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "Ocena TGDB") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Restart (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Restart") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Konfig. Nagrywania") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index bc0fc9e36e..ec0cb6b929 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -2133,10 +2133,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "Classificação TGDB" ) +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REBOOT, + "Reiniciar (RCM)" + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_REBOOT, "Reiniciar" ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Configuração de Gravação" diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index df756e59bc..63b4a10704 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -1200,8 +1200,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Iniciar conteúdo") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "Classificação TGDB") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Reinicializar (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Reinicializar") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Pasta de armazenamento das configuração de gravação") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 4e158378ab..40e25890a3 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -1229,8 +1229,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Запустить игру") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "Рейтинг TGDB") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Перезагрузка (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Перезагрузка") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Конфигурация записи") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 5e67a80758..08a8b5b0a5 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1,3 +1,29 @@ +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE, + "GPU Overclock" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, + "Overclock or underclock the Switch GPU" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, + "Screen brightness" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, + "Increase or decrease the Switch screen brightness" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, + "CPU Overclock" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE, + "Overclock the Switch CPU" + ) +#endif MSG_HASH( MSG_COMPILER, "Compiler" @@ -2133,10 +2159,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB Rating" ) +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REBOOT, + "Reboot into RCM" + ) +#else MSG_HASH( MENU_ENUM_LABEL_VALUE_REBOOT, "Reboot" ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Recording Config" diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 152b301709..d03dd162d4 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -1222,8 +1222,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, "Start Content") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, "TGDB Rating") +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, + "Khởi động lại (RCM)") +#else MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "Khởi động lại") +#endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, "Recording Config") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, diff --git a/lakka.h b/lakka.h index 60d117cbdb..0447aa6ed5 100644 --- a/lakka.h +++ b/lakka.h @@ -24,4 +24,67 @@ #define LAKKA_UPDATE_DIR "/storage/.update/" #define LAKKA_CONNMAN_DIR "/storage/.cache/connman/" +#ifdef HAVE_LAKKA_SWITCH +static char* SWITCH_GPU_PROFILES[] = { + "docked-overclock-3", + "docked-overclock-2", + "docked-overclock-1", + "docked", + "non-docked-overclock-5", + "non-docked-overclock-4", + "non-docked-overclock-3", + "non-docked-overclock-2", + "non-docked-overclock-1", + "non-docked", + "non-docked-underclock-1", + "non-docked-underclock-2", + "non-docked-underclock-3", +}; + +static char* SWITCH_GPU_SPEEDS[] = { + "998 Mhz", + "921 Mhz", + "844 Mhz", + "768 Mhz", + "691 Mhz", + "614 Mhz", + "537 Mhz", + "460 Mhz", + "384 Mhz", + "307 Mhz", + "230 Mhz", + "153 Mhz", + "76 Mhz" +}; + +static int SWITCH_BRIGHTNESS[] = { + 10, + 20, + 30, + 40, + 50, + 60, + 70, + 80, + 90, + 100 +}; + +static char* SWITCH_CPU_PROFILES[] = { + "overclock-4", + "overclock-3", + "overclock-2", + "overclock-1", + "default", +}; + +static char* SWITCH_CPU_SPEEDS[] = { + "1912 MHz", + "1734 MHz", + "1530 MHz", + "1224 MHz", + "1020 MHz" +}; +#endif + #endif diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 9b76a19b6f..c7258c52cf 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -187,6 +187,12 @@ generic_deferred_push(deferred_push_core_content_dirs_subdir_list, DISPLAYLIST_ generic_deferred_push(deferred_push_lakka_list, DISPLAYLIST_LAKKA) #endif +#ifdef HAVE_LAKKA_SWITCH +generic_deferred_push(deferred_push_switch_gpu_profile, DISPLAYLIST_SWITCH_GPU_PROFILE) +generic_deferred_push(deferred_push_switch_backlight_control, DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL) +generic_deferred_push(deferred_push_switch_cpu_profile, DISPLAYLIST_SWITCH_CPU_PROFILE) +#endif + static int deferred_push_cursor_manager_list_deferred( menu_displaylist_info_t *info) { @@ -875,6 +881,23 @@ static int menu_cbs_init_bind_deferred_push_compare_label( { BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_information); } +#ifdef HAVE_LAKKA_SWITCH + else if (strstr(label, + msg_hash_to_str(MENU_ENUM_LABEL_SWITCH_GPU_PROFILE))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_switch_gpu_profile); + } + else if (strstr(label, + msg_hash_to_str(MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_switch_backlight_control); + } + else if (strstr(label, + msg_hash_to_str(MENU_ENUM_LABEL_SWITCH_CPU_PROFILE))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_switch_cpu_profile); + } +#endif else if (strstr(label, msg_hash_to_str(MENU_ENUM_LABEL_SYSTEM_INFORMATION))) { diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index a05fd0943c..e98fcf249c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2503,6 +2503,64 @@ static int action_ok_deferred_list_stub(const char *path, return 0; } +#ifdef HAVE_LAKKA_SWITCH + +static int action_ok_set_switch_cpu_profile(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + char* profile_name = SWITCH_CPU_PROFILES[entry_idx]; + + char command[PATH_MAX_LENGTH] = {0}; + + snprintf(command, sizeof(command), "cpu-profile set %s", profile_name); + + system(command); + + snprintf(command, sizeof(command), "Current profile set to %s", profile_name); + + runloop_msg_queue_push(command, 1, 90, true); + + return menu_cbs_exit(); +} + +static int action_ok_set_switch_gpu_profile(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + char* profile_name = SWITCH_GPU_PROFILES[entry_idx]; + + char command[PATH_MAX_LENGTH] = {0}; + + snprintf(command, sizeof(command), "gpu-profile set %s", profile_name); + + system(command); + + snprintf(command, sizeof(command), "Current profile set to %s", profile_name); + + runloop_msg_queue_push(command, 1, 90, true); + + return menu_cbs_exit(); +} + +static int action_ok_set_switch_backlight(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + int brightness = SWITCH_BRIGHTNESS[entry_idx]; + + char command[PATH_MAX_LENGTH] = {0}; + + snprintf(command, sizeof(command), "echo %d > /sys/class/backlight/backlight/brightness", brightness); + + system(command); + + snprintf(command, sizeof(command), "Brightness set to %d%%", brightness); + + runloop_msg_queue_push(command, 1, 90, true); + + return 0; +} + +#endif + static int action_ok_load_core_deferred(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -4961,6 +5019,11 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_HELP_LIST: case MENU_ENUM_LABEL_INFORMATION_LIST: case MENU_ENUM_LABEL_CONTENT_SETTINGS: +#ifdef HAVE_LAKKA_SWITCH + case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: + case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL: + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: +#endif BIND_ACTION_OK(cbs, action_ok_push_default); break; case MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL: @@ -5384,6 +5447,17 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, BIND_ACTION_OK(cbs, action_ok_playlist_entry); } break; +#ifdef HAVE_LAKKA_SWITCH + case MENU_SET_SWITCH_GPU_PROFILE: + BIND_ACTION_OK(cbs, action_ok_set_switch_gpu_profile); + break; + case MENU_SET_SWITCH_BRIGHTNESS: + BIND_ACTION_OK(cbs, action_ok_set_switch_backlight); + break; + case MENU_SET_SWITCH_CPU_PROFILE: + BIND_ACTION_OK(cbs, action_ok_set_switch_cpu_profile); + break; +#endif case FILE_TYPE_RPL_ENTRY: BIND_ACTION_OK(cbs, action_ok_rpl_entry); break; diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 21235de14e..af3166c673 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -478,6 +478,12 @@ default_sublabel_macro(action_bind_sublabel_show_wimp, #endif default_sublabel_macro(action_bind_sublabel_discord_allow, MENU_ENUM_SUBLABEL_DISCORD_ALLOW) +#ifdef HAVE_LAKKA_SWITCH +default_sublabel_macro(action_bind_sublabel_switch_gpu_profile, MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE) +default_sublabel_macro(action_bind_sublabel_switch_cpu_profile, MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE) +default_sublabel_macro(action_bind_sublabel_switch_backlight_control, MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL) +#endif + static int action_bind_sublabel_cheevos_entry( file_list_t *list, unsigned type, unsigned i, @@ -1993,6 +1999,17 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_SHOW_WIMP: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_show_wimp); break; +#endif +#ifdef HAVE_LAKKA_SWITCH + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_cpu_profile); + break; + case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_gpu_profile); + break; + case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_backlight_control); + break; #endif case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_LOAD: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheat_apply_after_load); diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index cf974172f4..e9d53a9b41 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -210,6 +210,12 @@ default_title_copy_macro(action_get_title_cheevos_list, MENU_ENUM_LABE default_title_copy_macro(action_get_title_video_shader_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS) default_title_copy_macro(action_get_title_video_shader_preset_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS) +#ifdef HAVE_LAKKA_SWITCH +default_title_macro(action_get_title_switch_gpu_profile, MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE) +default_title_macro(action_get_title_switch_cpu_profile, MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE) +default_title_macro(action_get_title_switch_backlight_control, MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL) +#endif + static int action_get_title_generic(char *s, size_t len, const char *path, const char *text) { @@ -873,6 +879,17 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: BIND_ACTION_GET_TITLE(cbs, action_get_title_core_info_directory); break; +#ifdef HAVE_LAKKA_SWITCH + case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_gpu_profile); + break; + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile); + break; + case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_backlight_control); + break; +#endif default: return -1; } @@ -1159,6 +1176,17 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_LIBRETRO_INFO_PATH: BIND_ACTION_GET_TITLE(cbs, action_get_title_core_info_directory); break; +#ifdef HAVE_LAKKA_SWITCH + case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_gpu_profile); + break; + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile); + break; + case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_backlight_control); + break; +#endif default: return -1; } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index e1028bfd98..3619e86139 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2391,6 +2391,10 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_SHOW_WIMP: case MENU_ENUM_LABEL_USER_INTERFACE_SETTINGS: return xmb->textures.list[XMB_TEXTURE_UI]; +#ifdef HAVE_LAKKA_SWITCH + case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: +#endif case MENU_ENUM_LABEL_POWER_MANAGEMENT_SETTINGS: return xmb->textures.list[XMB_TEXTURE_POWER]; case MENU_ENUM_LABEL_RETRO_ACHIEVEMENTS_SETTINGS: @@ -2520,6 +2524,9 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, return xmb->textures.list[XMB_TEXTURE_SUBSETTING]; return xmb->textures.list[XMB_TEXTURE_SETTING]; case MENU_SETTING_GROUP: +#ifdef HAVE_LAKKA_SWITCH + case MENU_SET_SWITCH_BRIGHTNESS: +#endif return xmb->textures.list[XMB_TEXTURE_SETTING]; case MENU_INFO_MESSAGE: return xmb->textures.list[XMB_TEXTURE_CORE_INFO]; @@ -5327,6 +5334,17 @@ static int xmb_list_push(void *data, void *userdata, menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); } +#ifdef HAVE_LAKKA_SWITCH + entry.enum_idx = MENU_ENUM_LABEL_SWITCH_CPU_PROFILE; + menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + + entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE; + menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + + entry.enum_idx = MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL; + menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); +#endif + #ifndef HAVE_DYNAMIC entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH; menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); @@ -5343,6 +5361,7 @@ static int xmb_list_push(void *data, void *userdata, entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST; menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); } + #if !defined(IOS) if (settings->bools.menu_show_quit_retroarch) { diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index f684739444..1145df1fe5 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -47,6 +47,10 @@ #include "../network/netplay/netplay_discovery.h" #endif +#ifdef HAVE_LAKKA_SWITCH +#include "../../lakka.h" +#endif + #if defined(__linux__) || (defined(BSD) && !defined(__MACH__)) #include "../frontend/drivers/platform_unix.h" #endif @@ -4274,6 +4278,124 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) switch (type) { +#ifdef HAVE_LAKKA_SWITCH + case DISPLAYLIST_SWITCH_CPU_PROFILE: + { + runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true); + + char current_profile[PATH_MAX_LENGTH]; + + FILE* profile = popen("cpu-profile get", "r"); + fgets(current_profile, PATH_MAX_LENGTH, profile); + pclose(profile); + + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + char text[PATH_MAX_LENGTH]; + + snprintf(text, sizeof(text), "Current profile : %s", current_profile); + + menu_entries_append_enum(info->list, + text, + "", + 0, + MENU_INFO_MESSAGE, 0, 0); + + const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]); + + + for (int i = 0; i < profiles_count; i++) + { + char* profile = SWITCH_CPU_PROFILES[i]; + char* speed = SWITCH_CPU_SPEEDS[i]; + + char title[PATH_MAX_LENGTH] = {0}; + + snprintf(title, sizeof(title), "%s (%s)", profile, speed); + + menu_entries_append_enum(info->list, + title, + "", + 0, MENU_SET_SWITCH_CPU_PROFILE, 0, i); + + } + + info->need_push = true; + info->need_refresh = true; + info->need_clear = true; + + break; + } + case DISPLAYLIST_SWITCH_GPU_PROFILE: + { + runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true); + + char current_profile[PATH_MAX_LENGTH]; + + FILE* profile = popen("gpu-profile get", "r"); + fgets(current_profile, PATH_MAX_LENGTH, profile); + pclose(profile); + + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + char text[PATH_MAX_LENGTH]; + + snprintf(text, sizeof(text), "Current profile : %s", current_profile); + + menu_entries_append_enum(info->list, + text, + "", + 0, + MENU_INFO_MESSAGE, 0, 0); + + const size_t profiles_count = sizeof(SWITCH_GPU_PROFILES)/sizeof(SWITCH_GPU_PROFILES[1]); + + for (int i = 0; i < profiles_count; i++) + { + char* profile = SWITCH_GPU_PROFILES[i]; + char* speed = SWITCH_GPU_SPEEDS[i]; + + char title[PATH_MAX_LENGTH] = {0}; + + snprintf(title, sizeof(title), "%s (%s)", profile, speed); + + menu_entries_append_enum(info->list, + title, + "", + 0, MENU_SET_SWITCH_GPU_PROFILE, 0, i); + } + + info->need_push = true; + info->need_refresh = true; + info->need_clear = true; + + break; + } + case DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL: + { + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + const size_t brightness_count = sizeof(SWITCH_BRIGHTNESS)/sizeof(SWITCH_BRIGHTNESS[1]); + + for (int i = 0; i < brightness_count; i++) + { + char title[PATH_MAX_LENGTH] = {0}; + + snprintf(title, sizeof(title), "Set to %d%%", SWITCH_BRIGHTNESS[i]); + + menu_entries_append_enum(info->list, + title, + "", + 0, MENU_SET_SWITCH_BRIGHTNESS, 0, i); + } + + info->need_push = true; + info->need_refresh = true; + info->need_clear = true; + + break; + } +#endif case DISPLAYLIST_MUSIC_LIST: { char combined_path[PATH_MAX_LENGTH]; @@ -7245,6 +7367,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_QUIT_RETROARCH, PARSE_ACTION, false); +#ifdef HAVE_LAKKA_SWITCH + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, + PARSE_ACTION, false); + + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, + PARSE_ACTION, false); +#endif if (settings->bools.menu_show_reboot) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_REBOOT, diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index d87c804527..37d79a3d99 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -179,7 +179,13 @@ enum menu_displaylist_ctl_state DISPLAYLIST_CORE_CONTENT, DISPLAYLIST_CORE_CONTENT_DIRS, DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR, - DISPLAYLIST_PENDING_CLEAR + DISPLAYLIST_PENDING_CLEAR, + +#ifdef HAVE_LAKKA_SWITCH + DISPLAYLIST_SWITCH_GPU_PROFILE, + DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL, + DISPLAYLIST_SWITCH_CPU_PROFILE, +#endif }; typedef struct menu_displaylist_info diff --git a/menu/menu_driver.h b/menu/menu_driver.h index a48402c62b..7a509d81ae 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -233,6 +233,13 @@ enum menu_settings_type MENU_SETTINGS_SUBSYSTEM_ADD, MENU_SETTINGS_SUBSYSTEM_LAST = MENU_SETTINGS_SUBSYSTEM_ADD + RARCH_MAX_SUBSYSTEMS, MENU_SETTINGS_CHEAT_MATCH, + +#ifdef HAVE_LAKKA_SWITCH + MENU_SET_SWITCH_GPU_PROFILE, + MENU_SET_SWITCH_BRIGHTNESS, + MENU_SET_SWITCH_CPU_PROFILE, +#endif + MENU_SETTINGS_LAST }; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1a4d06d20f..947f284381 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3641,6 +3641,31 @@ static bool setting_append_list( #endif #if defined(HAVE_LAKKA) +#ifdef HAVE_LAKKA_SWITCH + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, + MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, + &group_info, + &subgroup_info, + parent_group); + + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, + MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE, + &group_info, + &subgroup_info, + parent_group); + + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, + MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, + &group_info, + &subgroup_info, + parent_group); +#endif CONFIG_ACTION( list, list_info, MENU_ENUM_LABEL_REBOOT, diff --git a/msg_hash.h b/msg_hash.h index 7cfc71ca35..60d5dce122 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2130,6 +2130,20 @@ enum msg_hash_enums MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS, MSG_CHEEVOS_HARDCORE_MODE_DISABLED, +#ifdef HAVE_LAKKA_SWITCH + MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, + MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE, + MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, + + MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, + MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, + MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, + + MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, + MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, + MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE, +#endif + MSG_LAST }; From 9b68aa23a926ab915676b39f331a1afc71d6e082 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 16:30:25 +0200 Subject: [PATCH 0249/1292] (libnx) Add HAVE_LANGEXTRA --- Makefile.libnx | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.libnx b/Makefile.libnx index 36b614de5e..00343d6b1c 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -46,6 +46,7 @@ HAVE_FREETYPE = 0 HAVE_SWITCH = 1 HAVE_LIBNX = 1 HAVE_OPENGL = 1 +HAVE_LANGEXTRA = 1 ifeq ($(HAVE_OPENGL), 1) HAVE_EGL = 1 From 31ba215c944fb873ef97841f6af6f0ef97206612 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 17:05:06 +0200 Subject: [PATCH 0250/1292] Update GLSM --- libretro-common/glsm/glsm.c | 18 ++++++++++++++++-- libretro-common/include/glsm/glsmsym.h | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libretro-common/glsm/glsm.c b/libretro-common/glsm/glsm.c index 616ded620e..70fed4ba3f 100644 --- a/libretro-common/glsm/glsm.c +++ b/libretro-common/glsm/glsm.c @@ -200,6 +200,7 @@ struct gl_cached_state int cap_translate[SGL_CAP_MAX]; }; +static GLuint default_framebuffer; static GLint glsm_max_textures; struct retro_hw_render_callback hw_render; static struct gl_cached_state gl_state; @@ -2094,6 +2095,18 @@ void rglTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, glTexStorage2D(target, levels, internalFormat, width, height); #endif } +/* + * + * Core in: + * OpenGL : 3.2 + * OpenGLES : 3.2 + */ +void rglDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid *indices, GLint basevertex) +{ +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) && defined(HAVE_OPENGLES_3_2) + glDrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex); +#endif +} /* * @@ -2585,7 +2598,8 @@ static void glsm_state_setup(void) gl_state.bind_textures.ids = (GLuint*)calloc(glsm_max_textures, sizeof(GLuint)); - gl_state.framebuf = hw_render.get_current_framebuffer(); + default_framebuffer = glsm_get_current_framebuffer(); + gl_state.framebuf = default_framebuffer; gl_state.cullface.mode = GL_BACK; gl_state.frontface.mode = GL_CCW; @@ -2643,7 +2657,7 @@ static void glsm_state_bind(void) } } - glBindFramebuffer(RARCH_GL_FRAMEBUFFER, hw_render.get_current_framebuffer()); + glBindFramebuffer(RARCH_GL_FRAMEBUFFER, default_framebuffer); if (gl_state.blendfunc.used) glBlendFunc( diff --git a/libretro-common/include/glsm/glsmsym.h b/libretro-common/include/glsm/glsmsym.h index a6184c1c74..d32cab28d8 100644 --- a/libretro-common/include/glsm/glsmsym.h +++ b/libretro-common/include/glsm/glsmsym.h @@ -33,6 +33,7 @@ RETRO_BEGIN_DECLS #define glTexCoord2f rglTexCoord2f /* more forward-compatible GL subset symbols */ +#define glDrawRangeElementsBaseVertex rglDrawRangeElementsBaseVertex #define glProvokingVertex rglProvokingVertex #define glGetInteger64v rglGetInteger64v #define glGenSamplers rglGenSamplers @@ -471,6 +472,7 @@ void rglUniform2iv( GLint location, GLsizei count, const GLint *value); void rglProvokingVertex( GLenum provokeMode); +void rglDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid *indices, GLint basevertex); RETRO_END_DECLS From cf5b8a5fca93d81bc702f0a8a64dd63ba1c68d34 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 17:34:35 +0200 Subject: [PATCH 0251/1292] (libnx) Enable threaded video by default --- config.def.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.def.h b/config.def.h index 8a651582f9..3a45ee23c5 100644 --- a/config.def.h +++ b/config.def.h @@ -181,7 +181,11 @@ static unsigned swap_interval = 1; /* Threaded video. Will possibly increase performance significantly * at the cost of worse synchronization and latency. */ +#if defined(HAVE_LIBNX) +static const bool video_threaded = true; +#else static const bool video_threaded = false; +#endif #if defined(HAVE_THREADS) #if defined(GEKKO) || defined(PSP) From 50eb4adc4ba56f166edde77151fd68bd87f7e0b5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 17:35:52 +0200 Subject: [PATCH 0252/1292] (libnx) Use audio_switch_thread by default --- audio/audio_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio_driver.c b/audio/audio_driver.c index 9e083a54f4..d0cc9d6497 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -124,8 +124,8 @@ static const audio_driver_t *audio_drivers[] = { &audio_ctr_dsp, #endif #ifdef SWITCH - &audio_switch, &audio_switch_thread, + &audio_switch, #endif &audio_null, NULL, From 7260e52a23ff4d64d160947ef04b72f96e32f070 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 17:48:12 +0200 Subject: [PATCH 0253/1292] Make improved version of this - https://github.com/libretro/RetroArch/pull/7350/commits/873d60151fb7ff88fca5353a02b498dff7fc964b --- configuration.c | 23 +++++++++++++++++++++++ menu/menu_driver.c | 12 ++++++++++++ menu/menu_driver.h | 2 ++ 3 files changed, 37 insertions(+) diff --git a/configuration.c b/configuration.c index 35f3185c6c..0282ca2acc 100644 --- a/configuration.c +++ b/configuration.c @@ -2340,6 +2340,24 @@ error: return NULL; } +#if defined(HAVE_MENU) && defined(HAVE_RGUI) +static bool check_menu_driver_compatibility(void) +{ + settings_t *settings = config_get_ptr(); + char *video_driver = settings->arrays.video_driver; + char *menu_driver = settings->arrays.menu_driver; + + if (string_is_equal (menu_driver, "rgui") || + string_is_equal(menu_driver, "null")) + return true; + + if (menu_display_driver_exists(video_driver)) + return true; + + return false; +} +#endif + static void read_keybinds_keyboard(config_file_t *conf, unsigned user, unsigned idx, struct retro_keybind *bind) { @@ -3045,6 +3063,11 @@ static bool config_load_file(const char *path, bool set_defaults, } } +#if defined(HAVE_MENU) && defined(HAVE_RGUI) + if (!check_menu_driver_compatibility()) + strlcpy(settings->arrays.menu_driver, "rgui", sizeof(settings->arrays.menu_driver)); +#endif + frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode); recording_driver_update_streaming_url(); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 4bae4f41b1..6075c63c2c 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -634,6 +634,18 @@ float menu_display_get_dpi(void) return dpi; } +bool menu_display_driver_exists(const char *s) +{ + unsigned i; + for (i = 0; i < ARRAY_SIZE(menu_display_ctx_drivers); i++) + { + if (string_is_equal(s, menu_display_ctx_drivers[i]->ident)) + return true; + } + + return false; +} + bool menu_display_init_first_driver(bool video_is_threaded) { unsigned i; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 7a509d81ae..7546482f5b 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -824,6 +824,8 @@ void menu_display_reset_textures_list( int menu_display_osk_ptr_at_pos(void *data, int x, int y, unsigned width, unsigned height); +bool menu_display_driver_exists(const char *s); + void menu_driver_destroy(void); extern uintptr_t menu_display_white_texture; From c4966575567ed383666767d75e6bace620d8c7f3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Oct 2018 17:52:03 +0200 Subject: [PATCH 0254/1292] Fix issue with GL --- menu/drivers_display/menu_display_gl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/drivers_display/menu_display_gl.c b/menu/drivers_display/menu_display_gl.c index 6cf546f5e1..3c5664bae6 100644 --- a/menu/drivers_display/menu_display_gl.c +++ b/menu/drivers_display/menu_display_gl.c @@ -275,7 +275,7 @@ menu_display_ctx_driver_t menu_display_ctx_gl = { menu_display_gl_get_default_tex_coords, menu_display_gl_font_init_first, MENU_VIDEO_DRIVER_OPENGL, - "menu_display_gl", + "gl", false, menu_display_gl_scissor_begin, menu_display_gl_scissor_end From 4240c895bf358fd93411a4791783a82657134498 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Sat, 6 Oct 2018 09:27:53 -0700 Subject: [PATCH 0255/1292] =?UTF-8?q?fix(macOS/Qt):=20Rename=20produce=20R?= =?UTF-8?q?etroArchQT=20=E2=86=92=20RetroArch=20(#7374)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RetroArch_Metal.xcodeproj/project.pbxproj | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index 2122da3cc2..2cfc05036c 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -142,7 +142,7 @@ 053FC25521433F1700D98D46 /* QtConcurrent.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QtConcurrent.framework; path = /usr/local/opt/qt/lib/QtConcurrent.framework; sourceTree = ""; }; 053FC25621433F1800D98D46 /* QtNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QtNetwork.framework; path = /usr/local/opt/qt/lib/QtNetwork.framework; sourceTree = ""; }; 053FC25721433F1800D98D46 /* QtWidgets.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QtWidgets.framework; path = /usr/local/opt/qt/lib/QtWidgets.framework; sourceTree = ""; }; - 05422E592140C8DB00F09961 /* RetroArchQT.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArchQT.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 05422E592140C8DB00F09961 /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; }; 05422E5B2140CE3500F09961 /* VulkanConfig.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = VulkanConfig.xcconfig; sourceTree = ""; }; 05422E5C2140CFC500F09961 /* Metal.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Metal.xcconfig; sourceTree = ""; }; 0548E2B220F976E10094A083 /* driver.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = driver.c; path = ../../driver.c; sourceTree = ""; }; @@ -1426,7 +1426,7 @@ isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* RetroArch.app */, - 05422E592140C8DB00F09961 /* RetroArchQT.app */, + 05422E592140C8DB00F09961 /* RetroArch.app */, ); name = Products; sourceTree = ""; @@ -1502,9 +1502,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 05422E3C2140C8DB00F09961 /* RetroArchQT */ = { + 05422E3C2140C8DB00F09961 /* RetroArchQt */ = { isa = PBXNativeTarget; - buildConfigurationList = 05422E562140C8DB00F09961 /* Build configuration list for PBXNativeTarget "RetroArchQT" */; + buildConfigurationList = 05422E562140C8DB00F09961 /* Build configuration list for PBXNativeTarget "RetroArchQt" */; buildPhases = ( 053FC2782143764B00D98D46 /* ShellScript */, 05422E3D2140C8DB00F09961 /* Resources */, @@ -1518,10 +1518,10 @@ ); dependencies = ( ); - name = RetroArchQT; + name = RetroArchQt; productInstallPath = "$(HOME)/Applications"; productName = RetroArch; - productReference = 05422E592140C8DB00F09961 /* RetroArchQT.app */; + productReference = 05422E592140C8DB00F09961 /* RetroArch.app */; productType = "com.apple.product-type.application"; }; 8D1107260486CEB800E47090 /* RetroArch */ = { @@ -1563,7 +1563,7 @@ projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* RetroArch */, - 05422E3C2140C8DB00F09961 /* RetroArchQT */, + 05422E3C2140C8DB00F09961 /* RetroArchQt */, ); }; /* End PBXProject section */ @@ -1690,7 +1690,7 @@ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_BUNDLE_IDENTIFIER = libretro.RetroArch; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = RetroArch; }; name = Debug; }; @@ -1711,7 +1711,7 @@ ); PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_BUNDLE_IDENTIFIER = libretro.RetroArch; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_NAME = RetroArch; }; name = Release; }; @@ -1986,7 +1986,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 05422E562140C8DB00F09961 /* Build configuration list for PBXNativeTarget "RetroArchQT" */ = { + 05422E562140C8DB00F09961 /* Build configuration list for PBXNativeTarget "RetroArchQt" */ = { isa = XCConfigurationList; buildConfigurations = ( 05422E572140C8DB00F09961 /* Debug */, From 8269d6837c975b0faa554a58db13c339918d0af4 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Sun, 7 Oct 2018 01:33:42 +0800 Subject: [PATCH 0256/1292] Update Simplified Chinese Localization --- intl/msg_hash_chs.c | 371 ++++++++++++++++++++------------------------ 1 file changed, 172 insertions(+), 199 deletions(-) diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index 82a5da215b..b375d8d8a3 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -59,19 +59,19 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case RARCH_PAUSE_TOGGLE: snprintf(s, len, - "在暂停和不暂停状态间切换。"); + "在暂停和非暂停状态间切换。"); break; case RARCH_FRAMEADVANCE: snprintf(s, len, - "Frame advance when content is paused."); + "在暂停时,运行一帧。"); break; case RARCH_SHADER_NEXT: snprintf(s, len, - "应用文件夹中的下一个Shader特效。"); + "应用文件夹中的下一个渲染器特效。"); break; case RARCH_SHADER_PREV: snprintf(s, len, - "应用文件夹中的上一个Shader特效。"); + "应用文件夹中的上一个渲染器特效。"); break; case RARCH_CHEAT_INDEX_PLUS: case RARCH_CHEAT_INDEX_MINUS: @@ -81,7 +81,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case RARCH_RESET: snprintf(s, len, - "重置游戏内容。"); + "重启游戏。"); break; case RARCH_SCREENSHOT: snprintf(s, len, @@ -97,7 +97,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case RARCH_ENABLE_HOTKEY: snprintf(s, len, - "启用其他热键. \n" + "启用其他热键。 \n" " \n" "If this hotkey is bound to either\n" "a keyboard, joybutton or joyaxis, \n" @@ -122,20 +122,20 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case RARCH_OVERLAY_NEXT: snprintf(s, len, - "切换到下一个屏幕覆层。将会循环选择。"); + "切换到下一个屏幕图层。将会循环选择。"); break; case RARCH_DISK_EJECT_TOGGLE: snprintf(s, len, - "切换弹出光盘。 \n" + "切换光盘弹出状态。 \n" " \n" - "用于多光盘内容。 "); + "用于多光盘游戏。 "); break; case RARCH_DISK_NEXT: case RARCH_DISK_PREV: snprintf(s, len, - "磁盘镜像周期。弹出后使用。 \n" + "切换下一张光盘。弹出光盘后才能使用。 \n" " \n" - "再次开关弹出完成。"); + "再次切换光盘弹出状态完成换盘。"); break; case RARCH_GRAB_MOUSE_TOGGLE: snprintf(s, len, @@ -150,7 +150,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case RARCH_LOAD_STATE_KEY: snprintf(s, len, - "加载游戏状态。"); + "加载即时存档。"); break; case RARCH_FULLSCREEN_TOGGLE_KEY: snprintf(s, len, @@ -171,23 +171,23 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) case RARCH_STATE_SLOT_PLUS: case RARCH_STATE_SLOT_MINUS: snprintf(s, len, - "状态存储槽 \n" - " \n" - "当槽位选择为0时,状态存档将以*.state命名(或其他 \n" + "即时存档栏位 \n" + "\n" + "当栏位选择为0时,即时存档将以*.state命名(或其他 \n" "在命令行中定义的名称)。 \n" - " \n" - "当状态槽不为0时,路径将会设为,其中 \n" - "是状态槽的索引。"); + "\n" + "当栏位不为0时,路径将会设为,其中 \n" + "是栏位的编号。"); break; case RARCH_SAVE_STATE_KEY: snprintf(s, len, - "保存游戏状态。"); + "保存即时存档。"); break; case RARCH_REWIND: snprintf(s, len, "按住按钮来回溯 \n" " \n" - "回溯功能必须被启用。"); + "必须先启用回溯功能。"); break; case RARCH_BSV_RECORD_TOGGLE: snprintf(s, len, @@ -206,67 +206,66 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) { case MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS: snprintf(s, len, "你的登陆信息 \n" - "Retro Achievements 账号. \n" + "Retro成就账号。 \n" " \n" "访问 retroachievements.org 并注册 \n" - "以获取一个免费账号. \n" + "以获取一个免费账号。 \n" " \n" "在你注册以后, 你需要 \n" "在RetroArch输入你的 \n" - "账号以及密码."); + "账号以及密码。"); break; case MENU_ENUM_LABEL_CHEEVOS_USERNAME: - snprintf(s, len, "你的Retro Achievements账号的用户名。"); + snprintf(s, len, "你的Retro成就账号的用户名。"); break; case MENU_ENUM_LABEL_CHEEVOS_PASSWORD: - snprintf(s, len, "你的Retro Achievements账号的密码。"); + snprintf(s, len, "你的Retro成就账号的密码。"); break; case MENU_ENUM_LABEL_USER_LANGUAGE: - snprintf(s, len, "依据选择的语言来本地化菜单和其他屏显消息。 \n" + snprintf(s, len, "变更菜单和提示消息的语言设定, \n" " \n" - "需要重新启动来使之生效。 \n" + "需要重新启动才能生效。 \n" " \n" - "注意:可能不是所有的语言都已完成翻译工作。 \n" + "注意:部分语言的翻译并不完全。 \n" " \n" - "若一个语言没有被翻译,则会退回到英语显示。"); + "若一个语言尚未翻译,则会恢复英文显示。"); break; case MENU_ENUM_LABEL_VIDEO_FONT_PATH: snprintf(s, len, "改变屏显文字的字体。"); break; case MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS: - snprintf(s, len, "自动加载游戏内容指定的核心选项."); + snprintf(s, len, "自动加载各游戏单独设定的选项。"); break; case MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE: snprintf(s, len, "自动加载覆盖配置。"); break; case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE: - snprintf(s, len, "自动加载输入重映射文件."); + snprintf(s, len, "自动加载自定义键位文件。"); break; case MENU_ENUM_LABEL_SORT_SAVESTATES_ENABLE: - snprintf(s, len, "Sort save states in folders \n" - "named after the libretro core used."); + snprintf(s, len, "在即时存档的文件名前面加上核心名称 \n" + "来进行排序。"); break; case MENU_ENUM_LABEL_SORT_SAVEFILES_ENABLE: - snprintf(s, len, "Sort save files in folders \n" - "named after the libretro core used."); + snprintf(s, len, "在游戏存档的文件名前面加上核心名称 \n" + "来进行排序。"); break; case MENU_ENUM_LABEL_RESUME_CONTENT: - snprintf(s, len, "Exits from the menu and returns back \n" - "to the content."); + snprintf(s, len, "关闭菜单,返回游戏。"); break; case MENU_ENUM_LABEL_RESTART_CONTENT: - snprintf(s, len, "Restarts the content from the beginning."); + snprintf(s, len, "从头开始游戏。"); break; case MENU_ENUM_LABEL_CLOSE_CONTENT: - snprintf(s, len, "关闭内容并从内存中卸载。"); + snprintf(s, len, "完全关闭游戏。"); break; case MENU_ENUM_LABEL_UNDO_LOAD_STATE: - snprintf(s, len, "If a state was loaded, content will \n" - "go back to the state prior to loading."); + snprintf(s, len, "如果你不慎读错了即时存档,\n" + "使用此命令来撤销。"); break; case MENU_ENUM_LABEL_UNDO_SAVE_STATE: - snprintf(s, len, "如果状态被覆盖,它将 \n" - "它将回滚到上一保存的状态。"); + snprintf(s, len, "如果你不慎覆盖了即时存档,\n" + "使用此命令来撤销。"); break; case MENU_ENUM_LABEL_TAKE_SCREENSHOT: snprintf(s, len, "创建一份截图. \n" @@ -278,10 +277,10 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "添加到收藏夹."); break; case MENU_ENUM_LABEL_RUN: - snprintf(s, len, "启动内容."); + snprintf(s, len, "启动游戏."); break; case MENU_ENUM_LABEL_INFORMATION: - snprintf(s, len, "显示本内容的额外 \n" + snprintf(s, len, "显示本游戏的额外 \n" "元数据信息."); break; case MENU_ENUM_LABEL_FILE_BROWSER_CONFIG: @@ -302,7 +301,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY: snprintf(s, len, "选择本项以扫描当前 \n" - "目录中的内容."); + "目录中的游戏。"); break; case MENU_ENUM_LABEL_USE_THIS_DIRECTORY: snprintf(s, len, @@ -310,20 +309,20 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY: snprintf(s, len, - "内容数据库目录。 \n" + "游戏数据库目录。 \n" " \n" - "到内容数据库目录的 \n" + "到游戏数据库目录的 \n" "路径。"); break; case MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY: snprintf(s, len, - "缩略图目录. \n" + "缩略图目录。 \n" " \n" - "用以存放缩略图."); + "用以存放缩略图。"); break; case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: snprintf(s, len, - "核心Core信息目录. \n" + "模拟器核心信息目录。 \n" " \n" "用于搜索libretro核心信息 \n" "的目录。"); @@ -366,11 +365,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET: snprintf(s, len, - "Shader预设文件。"); + "渲染器预设文件。"); break; case MENU_ENUM_LABEL_FILE_BROWSER_SHADER: snprintf(s, len, - "Shader文件。"); + "渲染器文件。"); break; case MENU_ENUM_LABEL_FILE_BROWSER_REMAP: snprintf(s, len, @@ -382,7 +381,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_FILE_BROWSER_OVERLAY: snprintf(s, len, - "覆层文件。"); + "图层文件。"); break; case MENU_ENUM_LABEL_FILE_BROWSER_RDB: snprintf(s, len, @@ -420,13 +419,13 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION: snprintf(s, len, - "Libretro核心 \n" + "Libretro 核心 \n" " \n" "选中核心将会使其关联至游戏。"); break; case MENU_ENUM_LABEL_FILE_BROWSER_CORE: snprintf(s, len, - "Libretro核心 \n" + "Libretro 核心 \n" " \n" "选择该文件使 RetroArch 加载该核心。"); break; @@ -440,12 +439,12 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "缓存目录 \n" " \n" - "被RetroArch解压的游戏内容会临时存放到这个文 \n" + "被 RetroArch 解压的游戏内容会临时存放到这个文 \n" "件夹。"); break; case MENU_ENUM_LABEL_HISTORY_LIST_ENABLE: snprintf(s, len, - "若开启,所有在RetroArch中加载过的文件 \n" + "若开启,所有在 RetroArch 中加载过的文件 \n" "都会自动的放入最近使用历史列表中。"); break; case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY: @@ -456,14 +455,14 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR: snprintf(s, len, - "影响输入轮询过程在RetroArch中的执行方式。 \n" + "影响输入轮询过程在 RetroArch 中的执行方式。 \n" " \n" "稍早 - 输入轮询过程将在帧生成之前执行。 \n" "正常 - 输入轮询过程将在被请求时执行。 \n" "稍晚 - 输入轮询过程将在每一帧的首次请求时执行。 \n" " \n" "依据设置的不同,设置为“稍早”或“稍晚”可以获得较低 \n" - "的时延。 \n" + "的延迟。 \n" "当在进行在线游戏时,不管设置的值如何,都只会启用 \n" "正常模式进行输入轮询过程。" ); @@ -479,10 +478,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE: snprintf(s, len, - "强制关闭sRGB帧缓冲支持。\n" + "禁用 sRGB 帧缓冲支持。\n" "\n" - "某些在Windows上的Intel的OpenGL驱动会对sRGB帧缓 \n" - "冲支持产生问题,需要启用以强制关闭程序对其的使用。"); + "某些在 Windows 上的 Intel OpenGL 驱动 \n" + "对 sRGB 帧缓冲支持存在问题, \n" + "需要启用此选项以禁用帧缓冲。"); break; case MENU_ENUM_LABEL_AUDIO_ENABLE: snprintf(s, len, @@ -494,16 +494,15 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_AUDIO_LATENCY: snprintf(s, len, - "Desired audio latency in milliseconds. \n" - "Might not be honored if the audio driver \n" - "can't provide given latency."); + "音频延迟(单位:毫秒) \n" + "如果设置太低,音频驱动可能 \n" + "并不支持,从而不会生效。"); break; case MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE: snprintf(s, len, - "Allow cores to set rotation. If false, \n" - "rotation requests are honored, but ignored.\n\n" - "Used for setups where one manually rotates \n" - "the monitor."); + "允许核心自行设置屏幕旋转角度,\n" + "若关闭,旋转请求将不会得到执行。\n" + "需要旋转显示器的用户请设置此选项。\n"); break; case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW: snprintf(s, len, @@ -512,29 +511,26 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: snprintf(s, len, - "Number of entries that will be kept in \n" - "content history playlist."); + "在历史记录中最多保存的游戏个数。"); break; case MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN: snprintf(s, len, - "To use windowed mode or not when going \n" - "fullscreen."); + "使用无边框全屏替代普通全屏模式。"); break; case MENU_ENUM_LABEL_VIDEO_FONT_SIZE: snprintf(s, len, - "屏显信息的字体大小."); + "屏显信息的字体大小。"); break; case MENU_ENUM_LABEL_SAVESTATE_AUTO_INDEX: snprintf(s, len, - "Automatically increment slot index on each save, \n" - "generating multiple savestate files. \n" - "When the content is loaded, state slot will be \n" - "set to the highest existing value (last savestate)."); + "每次储存即时存档时,都在新的栏位储存, \n" + "以避免覆盖原有的即时存档。 \n" + "每次运行游戏时,都会定位到最新的 \n" + "即时存档栏位。"); break; case MENU_ENUM_LABEL_FPS_SHOW: snprintf(s, len, - "Enables displaying the current frames \n" - "per second."); + "显示/隐藏帧数"); break; case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE: snprintf(s, len, @@ -543,17 +539,16 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X: case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y: snprintf(s, len, - "Offset for where messages will be placed \n" - "onscreen. Values are in range [0.0, 1.0]."); + "提示消息在屏幕上显示的位置,\n" + "数值范围为0.0至1.0。"); break; case MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE: snprintf(s, len, - "Enable or disable the current overlay."); + "显示/隐藏当前按下的键位。"); break; case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU: snprintf(s, len, - "Hide the current overlay from appearing \n" - "inside the menu."); + "在进入菜单时,不显示当前按下的键位。"); break; case MENU_ENUM_LABEL_OVERLAY_PRESET: snprintf(s, len, @@ -561,26 +556,23 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_OVERLAY_OPACITY: snprintf(s, len, - "Overlay opacity."); + "图层透明度。"); break; case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT: snprintf(s, len, - "Input bind timer timeout (in seconds). \n" - "Amount of seconds to wait until proceeding \n" - "to the next bind."); + "绑定键位时的等待时间(单位:秒)"); break; case MENU_ENUM_LABEL_INPUT_BIND_HOLD: snprintf(s, len, - "Input bind hold time (in seconds). \n" - "Amount of seconds to hold an input to bind it."); + "绑定键位所需要按下的时间(单位:秒)"); break; case MENU_ENUM_LABEL_OVERLAY_SCALE: snprintf(s, len, - "Overlay scale."); + "图层放大比例。"); break; case MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE: snprintf(s, len, - "音频输出采样率."); + "音频输出采样率。"); break; case MENU_ENUM_LABEL_VIDEO_SHARED_CONTEXT: snprintf(s, len, @@ -670,7 +662,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT: snprintf(s, len, - "欢迎使用RetroArch\n" + "欢迎使用 RetroArch\n" "\n" "正在解压必要文件, 请稍等。\n" "这可能需要一点时间……\n" @@ -851,7 +843,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: snprintf(s, len, - "载入预设 Shader. \n" + "载入预设渲染器. \n" " \n" " Load a " #ifdef HAVE_CG @@ -997,38 +989,38 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL: snprintf(s, len, - "设置libretro核心的log等级 \n" + "设置日志输出级别 \n" "(GET_LOG_INTERFACE). \n" - " \n" - " If a log level issued by a libretro \n" - " core is below libretro_log level, it \n" - " is ignored.\n" - " \n" - " DEBUG logs are always ignored unless \n" - " verbose mode is activated (--verbose).\n" - " \n" - " DEBUG = 0\n" - " INFO = 1\n" - " WARN = 2\n" - " ERROR = 3" + "\n" + "If a log level issued by a libretro \n" + "core is below libretro_log level, it \n" + "is ignored.\n" + "\n" + "DEBUG logs are always ignored unless \n" + "verbose mode is activated (--verbose).\n" + "\n" + "调试 = 0\n" + "提示 = 1\n" + "警告 = 2\n" + "错误 = 3" ); break; case MENU_ENUM_LABEL_STATE_SLOT_INCREASE: case MENU_ENUM_LABEL_STATE_SLOT_DECREASE: snprintf(s, len, - "即时存档栏位.\n" - " \n" - " With slot set to 0, save state name is *.state \n" - " (or whatever defined on commandline).\n" + "即时存档栏位\n" + "\n" + "With slot set to 0, save state name is *.state \n" + "(or whatever defined on commandline).\n" "When slot is != 0, path will be (path)(d), \n" "where (d) is slot number."); break; case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: snprintf(s, len, - "应用Shader更改. \n" + "应用渲染器更改. \n" " \n" - "After changing shader settings, use this to \n" - "apply changes. \n" + "当你修改渲染器设置后,执行此选项 \n" + "以应用更改。 \n" " \n" "Changing shader settings is a somewhat \n" "expensive operation so it has to be \n" @@ -1258,11 +1250,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VOLUME_UP: snprintf(s, len, - "调高音量."); + "调高音量。"); break; case MENU_ENUM_LABEL_VOLUME_DOWN: snprintf(s, len, - "降低音量."); + "降低音量。"); break; case MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION: snprintf(s, len, @@ -1272,11 +1264,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_PERFCNT_ENABLE: snprintf(s, len, "启用或关闭前端 \n" - "性能计数."); + "性能计数。"); break; case MENU_ENUM_LABEL_SYSTEM_DIRECTORY: snprintf(s, len, - "系统目录. \n" + "系统目录。 \n" " \n" "Sets the 'system' directory.\n" "Cores can query for this\n" @@ -1286,20 +1278,18 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_SAVESTATE_AUTO_SAVE: case MENU_ENUM_LABEL_SAVESTATE_AUTO_LOAD: snprintf(s, len, - "Automatically saves a savestate at the \n" - "end of RetroArch's lifetime.\n" + "在 RetroArch 退出时 \n" + "自动保存即时存档。\n" " \n" - "RetroArch will automatically load any savestate\n" - "with this path on startup if 'Auto Load State\n" - "is enabled."); + "如果自动读档选项已打开,\n" + "每次运行游戏时还会读取该存档。"); break; case MENU_ENUM_LABEL_VIDEO_THREADED: snprintf(s, len, - "Use threaded video driver.\n" + "使用独立线程来处理视频。\n" " \n" - "Using this might improve performance at the \n" - "possible cost of latency and more video \n" - "stuttering."); + "虽然可能提升游戏速度,但也可能" + "增加延迟或导致图像卡顿。"); break; case MENU_ENUM_LABEL_VIDEO_VSYNC: snprintf(s, len, @@ -1307,24 +1297,19 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_HARD_SYNC: snprintf(s, len, - "尝试硬件同步 \n" - "CPU和GPU.\n" + "尝试硬件同步CPU和GPU。\n" " \n" - "可以降低潜在的性能 \n" - "开销."); + "可以减少潜在的性能开销。"); break; case MENU_ENUM_LABEL_REWIND_GRANULARITY: snprintf(s, len, - "Rewind granularity.\n" + "每次回溯的帧数\n" " \n" - " When rewinding defined number of \n" - "frames, you can rewind several frames \n" - "at a time, increasing the rewinding \n" - "speed."); + "通过一次回溯多帧来提升回溯的速度。"); break; case MENU_ENUM_LABEL_SCREENSHOT: snprintf(s, len, - "Take screenshot."); + "截图。"); break; case MENU_ENUM_LABEL_VIDEO_FRAME_DELAY: snprintf(s, len, @@ -1350,16 +1335,13 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION: snprintf(s, len, - "Inserts a black frame inbetween \n" - "frames.\n" + "在每帧之间插入一帧黑屏。\n" " \n" - "Useful for 120 Hz monitors who want to \n" - "play 60 Hz material with eliminated \n" - "ghosting.\n" + "120 Hz 显示器开启此选项运行 \n" + "60 Hz 游戏可以避免重影。 \n" " \n" - "Video refresh rate should still be \n" - "configured as if it is a 60 Hz monitor \n" - "(divide refresh rate by 2)."); + "图像刷新率仍应按照 60 Hz 显示器 \n" + "来进行设置。(除以 2) \n"); break; case MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN: snprintf(s, len, @@ -1382,13 +1364,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_PAUSE_NONACTIVE: snprintf(s, len, - "Pause gameplay when window focus \n" - "is lost."); + "切换窗口时暂停游戏。"); break; case MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT: snprintf(s, len, - "Screenshots output of GPU shaded \n" - "material if available."); + "使用 GPU 输出来进行截图(如果可能的话)。"); break; case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY: snprintf(s, len, @@ -1406,30 +1386,28 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_SAVEFILE_DIRECTORY: snprintf(s, len, - "游戏存盘目录. \n" + "游戏存档目录。 \n" " \n" - "Save all save files (*.srm) to this \n" - "directory. This includes related files like \n" - ".bsv, .rt, .psrm, etc...\n" + "所有游戏存档都保存在此文件夹。 \n" + "常见的游戏存档格式有 \n" + ".srm, .bsv, .rt, .psrm 等\n" " \n" - "This will be overridden by explicit command line\n" - "options."); + "此选项可能被特定命令行选项覆盖。"); break; case MENU_ENUM_LABEL_SAVESTATE_DIRECTORY: snprintf(s, len, "即时存档目录. \n" " \n" - "Save all save states (*.state) to this \n" - "directory.\n" + "所有即时存档 (.state 文件) 都 \n" + "保存在此文件夹。 \n" " \n" - "This will be overridden by explicit command line\n" - "options."); + "此选项可能被特定命令行选项覆盖。"); break; case MENU_ENUM_LABEL_ASSETS_DIRECTORY: snprintf(s, len, "Assets Directory. \n" " \n" - " This location is queried by default when \n" + "This location is queried by default when \n" "menu interfaces try to look for loadable \n" "assets, etc."); break; @@ -1441,18 +1419,16 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_SLOWMOTION_RATIO: snprintf(s, len, - "Slowmotion ratio." + "减速比例" " \n" - "When slowmotion, content will slow\n" - "down by factor."); + "减速游戏时,速度将被降低的倍数。"); break; case MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD: snprintf(s, len, - "Defines axis threshold.\n" + "摇杆灵敏度\n" " \n" - "How far an axis must be tilted to result\n" - "in a button press.\n" - " Possible values are [0.0, 1.0]."); + "必须把摇杆推到多大幅度才算按下按键。\n" + "数值范围为0.0至1.0。"); break; case MENU_ENUM_LABEL_INPUT_TURBO_PERIOD: snprintf(s, len, @@ -1475,19 +1451,19 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) ); break; case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: - snprintf(s, len, "Enable touch support."); + snprintf(s, len, "启用触摸屏支持。"); break; case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: - snprintf(s, len, "Use front instead of back touch."); + snprintf(s, len, "使用前触摸屏,而非后触摸屏。"); break; case MENU_ENUM_LABEL_MOUSE_ENABLE: - snprintf(s, len, "Enable mouse input inside the menu."); + snprintf(s, len, "在菜单中,启用鼠标。"); break; case MENU_ENUM_LABEL_POINTER_ENABLE: - snprintf(s, len, "Enable touch input inside the menu."); + snprintf(s, len, "在菜单中,启用触摸屏。"); break; case MENU_ENUM_LABEL_MENU_WALLPAPER: - snprintf(s, len, "Path to an image to set as menu wallpaper."); + snprintf(s, len, "菜单壁纸图片的路径。"); break; case MENU_ENUM_LABEL_NAVIGATION_WRAPAROUND: snprintf(s, len, @@ -1497,9 +1473,8 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_PAUSE_LIBRETRO: snprintf(s, len, - "If disabled, the libretro core will keep \n" - "running in the background when we are in the \n" - "menu."); + "如果关闭此选项,打开菜单时 \n" + "游戏就不会暂停。"); break; case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE: snprintf(s, len, @@ -1509,15 +1484,15 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_NETPLAY_MODE: snprintf(s, len, - "Netplay client mode for the current user. \n" - "Will be 'Server' mode if disabled."); + "开启:联网时为客户端模式。\n" + "关闭:联网时为服务器模式。"); break; case MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES: snprintf(s, len, - "The amount of delay frames to use for netplay. \n" + "联网时延迟的帧数。The amount of delay frames to use for netplay. \n" " \n" - "Increasing this value will increase \n" - "performance, but introduce more latency."); + "提升数值将改善游戏表现, \n" + "但延迟也会增加。"); break; case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES: snprintf(s, len, @@ -1550,8 +1525,8 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_SMOOTH: snprintf(s, len, - "Smoothens picture with bilinear filtering. \n" - "Should be disabled if using shaders."); + "用双线性过滤使图像平滑。 \n" + "如果你使用了渲染器,请关闭它。"); break; case MENU_ENUM_LABEL_TIMEDATE_ENABLE: snprintf(s, len, @@ -1726,11 +1701,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_LOAD_STATE: snprintf(s, len, - "Loads state."); + "读取即时存档。"); break; case MENU_ENUM_LABEL_SAVE_STATE: snprintf(s, len, - "Saves state."); + "保存即时存档。"); break; case MENU_ENUM_LABEL_CHEAT_INDEX_PLUS: snprintf(s, len, @@ -1750,7 +1725,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_RESET: snprintf(s, len, - "Reset the content.\n"); + "重启游戏。\n"); break; case MENU_ENUM_LABEL_PAUSE_TOGGLE: snprintf(s, len, @@ -1758,24 +1733,23 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_CHEAT_TOGGLE: snprintf(s, len, - "打开金手指索引.\n"); + "切换金手指启用状态。\n"); break; case MENU_ENUM_LABEL_HOLD_FAST_FORWARD: snprintf(s, len, - "Hold for fast-forward. Releasing button \n" - "disables fast-forward."); + "按下按键快进,松开按键恢复正常。"); break; case MENU_ENUM_LABEL_SLOWMOTION_HOLD: snprintf(s, len, - "Hold for slowmotion."); + "按下按键减速,松开按键恢复正常。"); break; case MENU_ENUM_LABEL_FRAME_ADVANCE: snprintf(s, len, - "Frame advance when content is paused."); + "游戏暂停时,运行一帧。"); break; case MENU_ENUM_LABEL_BSV_RECORD_TOGGLE: snprintf(s, len, - "Toggle between recording and not."); + "切换是否处于录像状态。"); break; case MENU_ENUM_LABEL_L_X_PLUS: case MENU_ENUM_LABEL_L_X_MINUS: @@ -1798,11 +1772,10 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "RetroArch本身并不能做什么事情。 \n" " \n" - "如果想在上面干点什么,你需要向它加载一个程 \n" - "序。 \n" + "如果想在上面干点什么,你需要向它加载一个程序。 \n" "\n" - "我们把这样的程序叫做“Libretro核心”,简单 \n" - "的称呼其为“核心”。 \n" + "我们把这样的程序叫做“Libretro 核心”, \n" + "简称“核心”。 \n" " \n" "你可以从“加载核心”菜单中选择一个核心。 \n" " \n" @@ -1816,8 +1789,8 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) #else - "你可以通过手动将核心移入目录中来添加他 \n" - "们,访问目录设置找到你的“%s”。", + "你可以通过手动将核心移入目录中来添加它们, \n" + "访问目录设置找到你的“%s”。", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) #endif ); From 4d8a3db02f60b1470e115b073b90a447874c2f33 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 7 Oct 2018 04:32:32 +0200 Subject: [PATCH 0257/1292] (iOS) Fix issue https://github.com/libretro/RetroArch/issues/7298#issuecomment-427618317 --- ui/drivers/ui_cocoatouch.m | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/drivers/ui_cocoatouch.m b/ui/drivers/ui_cocoatouch.m index 19f676dea1..4e637feb21 100644 --- a/ui/drivers/ui_cocoatouch.m +++ b/ui/drivers/ui_cocoatouch.m @@ -79,7 +79,6 @@ static void ui_companion_cocoatouch_event_command( void *data, enum event_command cmd) { (void)data; - command_event(cmd, NULL); } static void rarch_draw_observer(CFRunLoopObserverRef observer, From cb9ff15cc44a8696d3084a23da8c12c28b199b5e Mon Sep 17 00:00:00 2001 From: Ayssia Date: Sun, 7 Oct 2018 10:47:31 +0800 Subject: [PATCH 0258/1292] Update Simplified Chinese Localization --- intl/msg_hash_chs.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 3e945b01a3..1443158e63 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1,4 +1,30 @@ -MSG_HASH( +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE, + "GPU 超频" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, + "对 Switch 的 GPU 超频或降频" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, + "屏幕亮度" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, + "调整 Switch 的屏幕亮度" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, + "CPU 超频" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE, + "对 Switch 的 CPU 超频" + ) +#endif +MSG_HASH( MSG_COMPILER, "编译器" ) From 5b92570f509a9c3781ec86e24077a2864774f9a5 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Sun, 7 Oct 2018 12:00:09 +0800 Subject: [PATCH 0259/1292] Update Simplified Chinese Localization --- intl/msg_hash_chs.c | 292 ++++++++++++++++++++------------------------ 1 file changed, 132 insertions(+), 160 deletions(-) diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index b375d8d8a3..f2f9719006 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -67,11 +67,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case RARCH_SHADER_NEXT: snprintf(s, len, - "应用文件夹中的下一个渲染器特效。"); + "应用文件夹中的后一个渲染器特效。"); break; case RARCH_SHADER_PREV: snprintf(s, len, - "应用文件夹中的上一个渲染器特效。"); + "应用文件夹中的前一个渲染器特效。"); break; case RARCH_CHEAT_INDEX_PLUS: case RARCH_CHEAT_INDEX_MINUS: @@ -173,7 +173,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "即时存档栏位 \n" "\n" - "当栏位选择为0时,即时存档将以*.state命名(或其他 \n" + "当选择0号栏位时,即时存档将以*.state命名(或其他 \n" "在命令行中定义的名称)。 \n" "\n" "当栏位不为0时,路径将会设为,其中 \n" @@ -187,7 +187,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "按住按钮来回溯 \n" " \n" - "必须先启用回溯功能。"); + "必须先启用回溯倒带功能。"); break; case RARCH_BSV_RECORD_TOGGLE: snprintf(s, len, @@ -271,7 +271,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "创建一份截图. \n" " \n" "截图文件将会存放在 \n" - "截图目录之中."); + "截图文件夹之中."); break; case MENU_ENUM_LABEL_ADD_TO_FAVORITES: snprintf(s, len, "添加到收藏夹."); @@ -301,43 +301,42 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY: snprintf(s, len, "选择本项以扫描当前 \n" - "目录中的游戏。"); + "文件夹中的游戏。"); break; case MENU_ENUM_LABEL_USE_THIS_DIRECTORY: snprintf(s, len, - "选择本目录作为指定目录."); + "选择本文件夹作为指定文件夹。"); break; case MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY: snprintf(s, len, - "游戏数据库目录。 \n" + "游戏数据库文件夹。 \n" " \n" - "到游戏数据库目录的 \n" - "路径。"); + "到游戏数据库文件夹的路径。"); break; case MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY: snprintf(s, len, - "缩略图目录。 \n" + "缩略图文件夹。 \n" " \n" "用以存放缩略图。"); break; case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: snprintf(s, len, - "模拟器核心信息目录。 \n" + "模拟器核心信息文件夹。 \n" " \n" "用于搜索libretro核心信息 \n" - "的目录。"); + "的文件夹。"); break; case MENU_ENUM_LABEL_PLAYLIST_DIRECTORY: snprintf(s, len, - "运行列表目录. \n" + "运行列表文件夹. \n" " \n" "保存所有播放列表到 \n" - "此目录。"); + "此文件夹。"); break; case MENU_ENUM_LABEL_DUMMY_ON_CORE_SHUTDOWN: snprintf(s, len, "某些libretro核心可能会 \n" - "支持关机特性. \n" + "支持关机特性。 \n" " \n" "If this option is left disabled, \n" "selecting the shutdown procedure \n" @@ -351,17 +350,14 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE: snprintf(s, len, - "Some cores might need \n" - "firmware or bios files. \n" + "某些核心可能需要固件或 BIOS 文件。 \n" " \n" - "If this option is disabled, \n" - "it will try to load even if such \n" - "firmware is missing. \n" - "down. \n"); + "如果禁用此选项,即使没有固件或 BIOS" + "也会尝试强行加载。 \n"); break; case MENU_ENUM_LABEL_PARENT_DIRECTORY: snprintf(s, len, - "回到上级目录。"); + "回到上级文件夹。"); break; case MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET: snprintf(s, len, @@ -389,7 +385,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_FILE_BROWSER_FONT: snprintf(s, len, - "TrueType字体文件。"); + "TrueType 字体文件。"); break; case MENU_ENUM_LABEL_FILE_BROWSER_PLAIN_FILE: snprintf(s, len, @@ -431,13 +427,13 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY: snprintf(s, len, - "目录 \n" + "文件夹 \n" " \n" "选择并打开该文件夹。"); break; case MENU_ENUM_LABEL_CACHE_DIRECTORY: snprintf(s, len, - "缓存目录 \n" + "缓存文件夹 \n" " \n" "被 RetroArch 解压的游戏内容会临时存放到这个文 \n" "件夹。"); @@ -449,9 +445,9 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY: snprintf(s, len, - "文件浏览器目录 \n" + "文件浏览器文件夹 \n" " \n" - "设置文件浏览器的初始目录。"); + "设置文件浏览器的初始文件夹。"); break; case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR: snprintf(s, len, @@ -461,8 +457,8 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) "正常 - 输入轮询过程将在被请求时执行。 \n" "稍晚 - 输入轮询过程将在每一帧的首次请求时执行。 \n" " \n" - "依据设置的不同,设置为“稍早”或“稍晚”可以获得较低 \n" - "的延迟。 \n" + "依据设置的不同,设置为「稍早」或「稍晚」可以获得 \n" + "较低的延迟。 \n" "当在进行在线游戏时,不管设置的值如何,都只会启用 \n" "正常模式进行输入轮询过程。" ); @@ -506,8 +502,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW: snprintf(s, len, - "Show the input descriptors set by the core \n" - "instead of the default ones."); + "显示由核心设置的设备硬件信息,而非默认。"); break; case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: snprintf(s, len, @@ -714,30 +709,28 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) "加载游戏内容 \n" "通过浏览来加载游戏内容。 \n" " \n" - "你需要同时提供一个“核心”和游戏内容文 \n" - "件才能启动并加载游戏内容。 \n" + "你需要同时提供一个「核心」和游戏内容 \n" + "文件才能启动并加载游戏内容。 \n" " \n" - "设置“文件浏览器目录”可以指定以哪个位 \n" - "置为文件浏览器的默认目录以方便加载。 \n" + "设置「文件浏览器文件夹」可以指定以哪个 \n" + "位置为文件浏览器的默认文件夹以方便加载。 \n" "若没有设置,默认以根目录为基准。 \n" " \n" "文件浏览器会以上次加载的核心所支持的 \n" - "扩展名进行过滤,并使用该核心来加载游 \n" - "戏内容。" + "扩展名进行过滤,并使用该核心来加载 \n" + "游戏内容。" ); break; case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY: snprintf(s, len, - "从历史记录中加载内容. \n" + "从历史记录中加载游戏内容。 \n" " \n" - "As content is loaded, content and libretro \n" - "core combinations are saved to history. \n" + "每当你加载一个游戏时,它和所使用的核心 \n" + "将被保存到历史记录中。 \n" " \n" - "The history is saved to a file in the same \n" - "directory as the RetroArch config file. If \n" - "no config file was loaded in startup, history \n" - "will not be saved or loaded, and will not exist \n" - "in the main menu." + "历史记录文件和 RetroArch 设置文件在同一个 \n" + "文件夹中。如果 RetroArch 启动时没有找到 \n" + "历史记录文件,主菜单中将不会显示历史记录。" ); break; case MENU_ENUM_LABEL_VIDEO_DRIVER: @@ -861,7 +854,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) #endif "HLSL" #endif - " 预设目录. \n" + " 预设文件夹. \n" "The menu shader menu is updated accordingly. \n" " \n" "If the CGP uses scaling methods which are not \n" @@ -989,7 +982,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL: snprintf(s, len, - "设置日志输出级别 \n" + "设置Libretro核心的日志输出级别 \n" "(GET_LOG_INTERFACE). \n" "\n" "If a log level issued by a libretro \n" @@ -1010,36 +1003,35 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "即时存档栏位\n" "\n" - "With slot set to 0, save state name is *.state \n" - "(or whatever defined on commandline).\n" - "When slot is != 0, path will be (path)(d), \n" - "where (d) is slot number."); + "当选择0号栏位时,即时存档将以*.state命名(或其他 \n" + "在命令行中定义的名称)。 \n" + "\n" + "当栏位不为0时,路径将会设为,其中 \n" + "是栏位的编号。"); break; case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: snprintf(s, len, - "应用渲染器更改. \n" + "应用渲染器更改。 \n" " \n" "当你修改渲染器设置后,执行此选项 \n" "以应用更改。 \n" " \n" - "Changing shader settings is a somewhat \n" - "expensive operation so it has to be \n" - "done explicitly. \n" + "渲染器可能非常耗费资源, \n" + "因此必须单独进行设置。 \n" " \n" - "When you apply shaders, the menu shader \n" - "settings are saved to a temporary file (either \n" - "menu.cgp or menu.glslp) and loaded. The file \n" - "persists after RetroArch exits. The file is \n" - "saved to Shader Directory." + "应用渲染器更改后,渲染器设置将被 \n" + "保存到 Shader 文件夹下的文件中 \n" + "(扩展名为 .cgp 或 .glslp)。 \n" + "即使退出 RetroArch,该文件也会被保留。" ); break; case MENU_ENUM_LABEL_MENU_TOGGLE: snprintf(s, len, - "切换菜单."); + "切换菜单。"); break; case MENU_ENUM_LABEL_GRAB_MOUSE_TOGGLE: snprintf(s, len, - "切换鼠标抓取.\n" + "切换鼠标抓取。\n" " \n" "When mouse is grabbed, RetroArch hides the \n" "mouse, and keeps the mouse pointer inside \n" @@ -1048,10 +1040,9 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_DISK_NEXT: snprintf(s, len, - "Cycles through disk images. Use after \n" - "ejecting. \n" + "切换下一张光盘。弹出光盘后才能使用。 \n" " \n" - " Complete by toggling eject again."); + "再次切换光盘弹出状态完成换盘。"); break; case MENU_ENUM_LABEL_VIDEO_FILTER: #ifdef HAVE_FILTERS_BUILTIN @@ -1084,20 +1075,19 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) #endif #ifdef HAVE_RSOUND " \n" - "RSound wants an IP address to an RSound \n" - "server." + "RSound 需要 RSound 服务器的 IP 地址。 \n" #endif ); break; case MENU_ENUM_LABEL_DISK_EJECT_TOGGLE: snprintf(s, len, - "Toggles eject for disks.\n" + "切换光盘弹出状态。\n" " \n" - "Used for multiple-disk content."); + "用于多光盘游戏。"); break; case MENU_ENUM_LABEL_ENABLE_HOTKEY: snprintf(s, len, - "启用其他热键.\n" + "启用其他热键。\n" " \n" " If this hotkey is bound to either keyboard, \n" "joybutton or joyaxis, all other hotkeys will \n" @@ -1111,21 +1101,20 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_REWIND_ENABLE: snprintf(s, len, - "启用回溯倒带功能.\n" + "启用回溯倒带功能。\n" " \n" "这可能会严重影响性能, \n" - "所以缺省设置为关闭."); + "所以默认设置为关闭。"); break; case MENU_ENUM_LABEL_LIBRETRO_DIR_PATH: snprintf(s, len, - "核心目录. \n" + "核心文件夹。 \n" " \n" - "A directory for where to search for \n" - "libretro core implementations."); + "放置 Libretro 核心的文件夹。"); break; case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO: snprintf(s, len, - "自动匹配刷新率.\n" + "自动匹配刷新率。\n" " \n" "The accurate refresh rate of our monitor (Hz).\n" "This is used to calculate audio input rate with \n" @@ -1154,34 +1143,27 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_SCALE: snprintf(s, len, - "全屏分辨率.\n" + "全屏分辨率。\n" " \n" - "Resolution of 0 uses the \n" - "resolution of the environment.\n"); + "如果设置为 0,则使用设备默认分辨率。\n"); break; case MENU_ENUM_LABEL_FASTFORWARD_RATIO: snprintf(s, len, - "快进比率." + "快进速度。\n" " \n" - "The maximum rate at which content will\n" - "be run when using fast forward.\n" + "开启快进模式时的最大运行速度倍数。\n" " \n" - " (E.g. 5.0 for 60 fps content => 300 fps \n" - "cap).\n" + "例如 60fps 的游戏开启 5 倍速 就是 300 fps。\n" " \n" - "RetroArch will go to sleep to ensure that \n" - "the maximum rate will not be exceeded.\n" - "Do not rely on this cap to be perfectly \n" - "accurate."); + "RetroArch 会尽可能保证快进时不超过该速度,\n" + "但不会特别精确。"); break; case MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX: snprintf(s, len, - "指定输出显示器.\n" + "指定输出显示器。\n" " \n" - "0 (default) means no particular monitor \n" - "is preferred, 1 and up (1 being first \n" - "monitor), suggests RetroArch to use that \n" - "particular monitor."); + "(默认 0)表示不指定显示器,\n" + "1 表示使用 1 号显示器,以此类推。"); break; case MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN: snprintf(s, len, @@ -1193,8 +1175,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER: snprintf(s, len, - "Only scales video in integer \n" - "steps.\n" + "只放大整数倍。 \n" " \n" "The base size depends on system-reported \n" "geometry and aspect ratio.\n" @@ -1204,9 +1185,9 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_AUDIO_VOLUME: snprintf(s, len, - "Audio volume, expressed in dB.\n" + "音量(分贝)。\n" " \n" - " 0 dB is normal volume. No gain will be applied.\n" + "0 表示正常音量。\n" "Gain can be controlled in runtime with Input\n" "Volume Up / Input Volume Down."); break; @@ -1268,7 +1249,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_SYSTEM_DIRECTORY: snprintf(s, len, - "系统目录。 \n" + "系统文件夹。 \n" " \n" "Sets the 'system' directory.\n" "Cores can query for this\n" @@ -1372,7 +1353,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY: snprintf(s, len, - "截图目录 \n" + "截图文件夹 \n" " \n" "用于保存截图的文件夹。" ); @@ -1386,7 +1367,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_SAVEFILE_DIRECTORY: snprintf(s, len, - "游戏存档目录。 \n" + "游戏存档文件夹。 \n" " \n" "所有游戏存档都保存在此文件夹。 \n" "常见的游戏存档格式有 \n" @@ -1396,7 +1377,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_SAVESTATE_DIRECTORY: snprintf(s, len, - "即时存档目录. \n" + "即时存档文件夹. \n" " \n" "所有即时存档 (.state 文件) 都 \n" "保存在此文件夹。 \n" @@ -1413,7 +1394,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_DYNAMIC_WALLPAPERS_DIRECTORY: snprintf(s, len, - "动态壁纸目录 \n" + "动态壁纸文件夹 \n" " \n" "保存用于主界面的、依据游戏内容变化的动态壁纸。"); break; @@ -1489,7 +1470,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES: snprintf(s, len, - "联网时延迟的帧数。The amount of delay frames to use for netplay. \n" + "联网时延迟的帧数。 \n" " \n" "提升数值将改善游戏表现, \n" "但延迟也会增加。"); @@ -1530,36 +1511,35 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_TIMEDATE_ENABLE: snprintf(s, len, - "Shows current date and/or time inside menu."); + "在菜单中显示当前日期和时间。"); break; case MENU_ENUM_LABEL_CORE_ENABLE: snprintf(s, len, - "Shows current core inside menu."); + "在菜单中显示当前运行的核心名称。"); break; case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST: snprintf(s, len, - "Enables Netplay in host (server) mode."); + "启用联机游戏(服务器模式)。"); break; case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT: snprintf(s, len, - "Enables Netplay in client mode."); + "启用联机游戏(客户端模式)。"); break; case MENU_ENUM_LABEL_NETPLAY_DISCONNECT: snprintf(s, len, - "Disconnects an active Netplay connection."); + "断开当前正在联机的游戏。"); break; case MENU_ENUM_LABEL_NETPLAY_SETTINGS: snprintf(s, len, - "Setting related to Netplay."); + "联机游戏设置。"); break; case MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS: snprintf(s, len, - "Search for and connect to netplay hosts on the local network."); + "在局域网中搜索并加入联机游戏服务器。"); break; case MENU_ENUM_LABEL_DYNAMIC_WALLPAPER: snprintf(s, len, - "Dynamically load a new wallpaper \n" - "depending on context."); + "在不同的环境下加载不同的壁纸。"); break; case MENU_ENUM_LABEL_CORE_UPDATER_BUILDBOT_URL: snprintf(s, len, @@ -1586,14 +1566,11 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_INPUT_MAX_USERS: snprintf(s, len, - "Maximum amount of users supported by \n" - "RetroArch."); + "RetroArch 支持的最大用户数量。"); break; case MENU_ENUM_LABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE: snprintf(s, len, - "After downloading, automatically extract \n" - "archives that the downloads are contained \n" - "inside."); + "下载后自动解压。"); break; case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE: snprintf(s, len, @@ -1602,26 +1579,24 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_NETPLAY_NICKNAME: snprintf(s, len, - "The username of the person running RetroArch. \n" - "This will be used for playing online games."); + "你的 RetroArch 用户名,用于联机游戏。"); break; case MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT: snprintf(s, len, - "The port of the host IP address. \n" - "Can be either a TCP or UDP port."); + "服务器的端口。 \n" + "TCP 或 UDP 端口均可。"); break; case MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE: snprintf(s, len, - "Enable or disable spectator mode for \n" - "the user during netplay."); + "启用或禁用网络对战的观战模式。"); break; case MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS: snprintf(s, len, - "The address of the host to connect to."); + "服务器的地址。"); break; case MENU_ENUM_LABEL_STDIN_CMD_ENABLE: snprintf(s, len, - "Enable stdin command interface."); + "启用标准命令行输入。"); break; case MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT: snprintf(s, len, @@ -1633,33 +1608,30 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO: snprintf(s, len, - "Gamepad button combination to toggle menu. \n" + "切换菜单的按键。 \n" " \n" - "0 - None \n" - "1 - Press L + R + Y + D-Pad Down \n" - "simultaneously. \n" - "2 - Press L3 + R3 simultaneously. \n" - "3 - Press Start + Select simultaneously."); + "0 - 无 \n" + "1 - 同时按下 L + R + Y + D-Pad \n" + "2 - 同时按下 L3 + R3 \n" + "3 - 同时按下 Start + Select "); break; case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU: - snprintf(s, len, "Allow any RetroPad to control the menu."); + snprintf(s, len, "允许任何玩家打开菜单。"); break; case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE: snprintf(s, len, - "Enable input auto-detection.\n" + "启用自动配置按键。\n" " \n" - "Will attempt to auto-configure \n" - "joypads, Plug-and-Play style."); + "RetroArch 将尝试自动配置手柄按键, \n" + "和即插即用模式。"); break; case MENU_ENUM_LABEL_CAMERA_ALLOW: snprintf(s, len, - "Allow or disallow camera access by \n" - "cores."); + "允许或禁止核心调用摄像头。"); break; case MENU_ENUM_LABEL_LOCATION_ALLOW: snprintf(s, len, - "Allow or disallow location services \n" - "access by cores."); + "允许或禁止核心调用定位系统(GPS)。"); break; case MENU_ENUM_LABEL_TURBO: snprintf(s, len, @@ -1675,21 +1647,21 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_OSK_ENABLE: snprintf(s, len, - "Enable/disable on-screen keyboard."); + "启用或禁用屏幕软键盘。"); break; case MENU_ENUM_LABEL_AUDIO_MUTE: snprintf(s, len, - "Mute/unmute audio."); + "静音或恢复声音。"); break; case MENU_ENUM_LABEL_REWIND: snprintf(s, len, - "Hold button down to rewind.\n" + "按住按钮来回溯 \n" " \n" - "Rewind must be enabled."); + "必须先启用回溯倒带功能。"); break; case MENU_ENUM_LABEL_EXIT_EMULATOR: snprintf(s, len, - "Key to exit RetroArch cleanly." + "正常退出 RetroArch。" #if !defined(RARCH_MOBILE) && !defined(RARCH_CONSOLE) "\nKilling it in any hard way (SIGKILL, \n" "etc) will terminate without saving\n" @@ -1709,31 +1681,31 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_CHEAT_INDEX_PLUS: snprintf(s, len, - "Increment cheat index.\n"); + "下一个金手指。"); break; case MENU_ENUM_LABEL_CHEAT_INDEX_MINUS: snprintf(s, len, - "Decrement cheat index.\n"); + "前一个金手指。"); break; case MENU_ENUM_LABEL_SHADER_PREV: snprintf(s, len, - "Applies previous shader in directory."); + "应用文件夹中的前一个渲染器特效。"); break; case MENU_ENUM_LABEL_SHADER_NEXT: snprintf(s, len, - "Applies next shader in directory."); + "应用文件夹中的后一个渲染器特效。"); break; case MENU_ENUM_LABEL_RESET: snprintf(s, len, - "重启游戏。\n"); + "重启游戏。"); break; case MENU_ENUM_LABEL_PAUSE_TOGGLE: snprintf(s, len, - "Toggle between paused and non-paused state."); + "在暂停和非暂停状态间切换。"); break; case MENU_ENUM_LABEL_CHEAT_TOGGLE: snprintf(s, len, - "切换金手指启用状态。\n"); + "切换金手指启用状态。"); break; case MENU_ENUM_LABEL_HOLD_FAST_FORWARD: snprintf(s, len, @@ -1770,27 +1742,27 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC: snprintf(s, len, - "RetroArch本身并不能做什么事情。 \n" + "RetroArch 本身并不能做什么事情。 \n" " \n" "如果想在上面干点什么,你需要向它加载一个程序。 \n" "\n" - "我们把这样的程序叫做“Libretro 核心”, \n" - "简称“核心”。 \n" + "我们把这样的程序叫做「Libretro 核心」, \n" + "简称「核心」。 \n" " \n" - "你可以从“加载核心”菜单中选择一个核心。 \n" + "你可以从「加载核心」菜单中选择一个核心。 \n" " \n" #ifdef HAVE_NETWORKING "你可以通过以下几种方法来获取核心: \n" "一、通过访问菜单项「%s」 \n" " -> 「%s」来下载;\n" - "二、手动将其移入核心目录中,访问目录设置 \n" - "找到你的“%s”。", + "二、手动将其移入核心文件夹中,访问文件夹设置 \n" + "找到你的「%s」。", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) #else - "你可以通过手动将核心移入目录中来添加它们, \n" - "访问目录设置找到你的“%s”。", + "你可以通过手动将核心移入文件夹中来添加它们, \n" + "访问文件夹设置找到你的「%s」。", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) #endif ); From 7771b0db102babae30eaea7a04eef952a9cc1493 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Sun, 7 Oct 2018 14:00:27 +0800 Subject: [PATCH 0260/1292] Fix typo --- intl/msg_hash_chs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index f2f9719006..94c0de0047 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -502,7 +502,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW: snprintf(s, len, - "显示由核心设置的设备硬件信息,而非默认。"); + "显示由核心设置的输入设备硬件信息,而非默认。"); break; case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: snprintf(s, len, From f35ee6c0c1b754c5477b26edb6770eacc1f6682c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 7 Oct 2018 00:49:58 +0200 Subject: [PATCH 0261/1292] Updated German translation --- intl/msg_hash_de.h | 180 ++++++++++++++++++++++++++------------------- 1 file changed, 103 insertions(+), 77 deletions(-) diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index bb337900ad..a9eccfa635 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -1,3 +1,29 @@ +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE, + "GPU Übertakten" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, + "Über- oder Untertakten der Switch GPU" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, + "Bildschirmhelligkeit" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, + "Anpassen der Switch Bildschirmhelligkeit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, + "CPU Übertakten" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE, + "Übertakten der Switch CPU" + ) +#endif MSG_HASH( MSG_COMPILER, "Compiler" @@ -3332,121 +3358,121 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, "Zeige die aktuelle Anzahl an Einzelbildern an") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, - "Automatically add content to playlist") + "Inhalt automatisch zur Playlist hinzufügen") MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, - "Automatically scans loaded content so they appear inside playlists.") + "Scant automatisch den geladenen Inhalt, so dass er in Playlisten angezeigt wird.") MSG_HASH(MSG_SCANNING_OF_FILE_FINISHED, - "Scanning of file finished") + "Scannen von Datei beendet") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, - "Audio Resampler Quality") + "Audio Resampler Qualität") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, - "Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.") + "Verkleinere diesen Wert um Performance/kleinere Latenz gegenüber Audio Qualität zu bevorzugen, erhöhe ihn wenn du bessere Audioqualität bevorzugst auf kosten der Performance/kleinerer Latenz.") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, - "Display Statistics") + "Statistiken anzeigen") MSG_HASH(MENU_ENUM_SUBLABEL_STATISTICS_SHOW, - "Show onscreen technical statistics.") + "Technische Onscreen-Statistiken anzeigen.") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_ENABLE, - "Enable border filler") + "Rahmenfüller aktivieren.") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, - "Enable border filler thickness") + "Rahmenfüllerdicke aktivieren") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, - "Enable background filler thickness") -MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "For CRT displays only. Attempts to use exact core/game resolution and refresh rate.") + "Hintergrundfüllerdicke aktivieren") +MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "Nur für CRT Bildschirme. Versuche die exakte Core-/Spielauflösung und refresh Rate zu verwenden.") MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, "CRT SwitchRes") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, - "Switch among native and ultrawide super resolutions." + "Umschalten zwischen Nativer- und ultraweiter Superauflösungen." ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, "CRT Super Resolution") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, "CRT Superauflösung") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, - "Show Rewind Settings") + "Rückspuleinstellungen anzeigen") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, - "Show/hide the Rewind options.") + "Rückspuleinstellungsoption anzeigen/verstecken ") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_LATENCY, - "Show/hide the Latency options.") + "Latenzoptionen anzeigen/verstecken") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_LATENCY, - "Show Latency Settings") + "Latenzeinstellungen anzeigen") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS, - "Show/hide the Overlay options.") + "Overlayoptionen anzeigen/verstecken") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, - "Show Overlay Settings") + "Overlayeinstellungen anzeigen") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, - "Enable menu audio") + "Menuaudio aktivieren") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, - "Enable or disable menu sound.") + "Menuton aktivieren oder deaktivieren") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, - "Mixer Settings") + "Mixer-Einstellungen") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, - "View and/or modify audio mixer settings.") + "Anzeigen und/oder anzeigen von Audiomixer-Einstellungen.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, - "Overrides") + "Überschreibungen") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, - "Options for overriding the global configuration.") + "Optionen zum überschreiben der globalen Konfiguration.") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, - "Will start playback of the audio stream. Once finished, it will remove the current audio stream from memory.") + "Wird die Wiedergabe des Audiostreams starten. Sobald dieser fertig ist, wird der jetzige Audiostream aus dem Speicher entfernt werden.") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, - "Will start playback of the audio stream. Once finished, it will loop and play the track again from the beginning.") + "Wird die Wiedergabe des Audiostreams starten. Sobald dieser fertig ist, wird dieser erneut von vorne gestartet") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, - "Will start playback of the audio stream. Once finished, it will jump to the next audio stream in sequential order and repeat this behavior. Useful as an album playback mode.") + "Wird die Wiedergabe des Audiostreams starten. Sobald dieser fertig ist, springt er zum nächsten Audiostream in sequenzieller Reihenfolge und wiederholt dieses verhalten. Nützlich als Albumwiedergabemodus.") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, - "This will stop playback of the audio stream, but not remove it from memory. You can start playing it again by selecting 'Play'.") + "Dies wird die Wiedergabe des Audiostreams stoppen, aber ihn nicht aus dem Speicher entfernen. Du kannst die Wiedergabe fortsetzen in dem du erneut auf 'Abspielen' klickst.") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, - "This will stop playback of the audio stream and remove it entirely from memory.") + "Dies wird die Wiedergabe stoppen und den Audiostream komplett aus dem Speicher entfernen.") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, - "Adjust the volume of the audio stream.") + "Anpassen der Lautstärke des Audiostreams.") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER, - "Add this audio track to an available audio stream slot. If no slots are currently available, it will be ignored.") + "Diese Audiospur einem verfügbaren Audiostreamslot hinzufügen. Wenn momentan kein Slot verfügbar ist, wird dies ignoriert.") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, - "Add this audio track to an available audio stream slot and play it. If no slots are currently available, it will be ignored.") + "Diese Audiospur einem verfügbaren Audiostreamslot hinzufügen und sie wiedergeben. Wenn momentan kein Slot verfügbar ist, wird dies ignoriert.") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, - "Play") + "Abspielen") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, - "Play (Looped)") + "Abspielen (Schleife)") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL, - "Play (Sequential)") + "Abspielen (Sequenziell)") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, - "Stop") + "Stopp") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, - "Remove") + "Entfernen") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, - "Volume") + "Lautstärke") MSG_HASH(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, - "Current core") + "Aktueller Core") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_SEARCH_CLEAR, - "Clear") + "Leeren") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, - "In-Menu") + "Im Menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME, - "In-Game") + "Im Spiel") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED, - "In-Game (Paused)") + "Im Spiel (Pausiert)") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING, - "Playing") + "Wiedergebend") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, - "Paused") + "Pausiert") MSG_HASH( MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, - "Enable Discord" + "Discord aktivieren" ) MSG_HASH( MENU_ENUM_SUBLABEL_DISCORD_ALLOW, - "Enable or disable Discord support. Will not work with the browser version, only native desktop client." + "Discordunterstützung aktivieren oder deaktivieren. Funktioniert nicht in der Browserversion, nur im nativen Desktop Client." ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, - "Power Management") + "Energieverwaltung") MSG_HASH(MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, - "Change power management settings.") + "Ändere die Energieverwaltungs-Einstellungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, - "Sustained Performance Mode") + "Dauerleistungsmodus") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MPV_SUPPORT, - "mpv support") + "mpv unterstützung") MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ADAPTIVE_VSYNC, - "Adaptive Vsync" + "Adaptiver Vsync" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, - "V-Sync is enabled until performance falls below the target refresh rate. Can minimize stuttering when performance falls below realtime, and can be more energy efficient." + "V-Sync ist aktiviert bis die Leistung unter die Zielaktualisierungsrate fällt. Kann Ruckler vermeiden, wenn die Leistung unter realtime fällt, und kann energieeffizienter sein." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, @@ -3454,75 +3480,75 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, - "Output native, low-resolution signals for use with CRT displays." + "Native Signale mit niedgriger Auflösung ausgeben, welche mit CRT Bildschirmen benutzt werden können." ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, - "Cycle through these options if the image is not centered properly on the display." + "Versuche eine dieser Optionen, wenn das Bild nicht richtig zentriert auf dem Bildschirm erscheint." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, - "X-Axis Centering" + "X-Achsenzentrierung" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use a custom refresh rate specified in the config file if needed.") + "Benutze eine, in der Konfiguration definierte, Aktualisierungsrate wenn notwendig.") MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use Custom Refresh Rate") + "Benutze eine benutzerdefinierte Aktualisierungsrate.") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Select the output port connected to the CRT display.") + "Wähle den Ausgangsport aus, welcher mit dem CRT Bildschirm verbunden ist.") MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Output Display ID") + "Ausgangs Bildschirm ID") MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, - "Start Recording" + "Aufnahme starten" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, - "Starts recording." + "Startet die Aufnahme" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, - "Stop Recording" + "Aufnahme beenden" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, - "Stops recording." + "Beendet die Aufnahme" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, - "Start Streaming" + "Streamen starten" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_STREAMING, - "Starts streaming." + "Startet das Streamen" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, - "Stop Streaming" + "Streamen beenden" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, - "Stops streaming." + "Beendet das Streamen" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_RECORDING_TOGGLE, - "Recording toggle" + "Aufnahme starten/stoppen" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, - "Streaming toggle" + "Streamen starten/stoppen" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, - "Record Quality" + "Aufnahmequalität" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, - "Stream Quality" + "Streamingqualität" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_STREAMING_URL, @@ -3545,18 +3571,18 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, - "Streaming Mode") + "Streamingmodus") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, - "Title of Stream") + "Streamtitel") MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, "Split Joy-Con" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, - "Reset To Defaults" + "Auf Standardwerte zurücksetzen" ) MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, - "Reset the current configuration to default values." + "Setzt die momentane Konfiguration auf die Standardwerte zurück." ) From 247b21b151918e6b33ec3946369b9c37b77f5f8d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 8 Oct 2018 04:20:07 +0200 Subject: [PATCH 0262/1292] (platform_switch.c) Set retro_rating level to 11 - some minor cleanups --- frontend/drivers/platform_switch.c | 82 +++++++++++++++--------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 6bdea42936..39cb228a47 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -57,7 +57,7 @@ static uint64_t frontend_switch_get_mem_used(void); #ifdef HAVE_LIBNX -// Splash +/* Splash */ static uint32_t *splashData = NULL; static bool psmInitialized = false; @@ -66,7 +66,7 @@ static bool psmInitialized = false; extern bool nxlink_connected; #endif -#endif // HAVE_LIBNX +#endif /* HAVE_LIBNX */ static void get_first_valid_core(char *path_return) { @@ -195,7 +195,7 @@ static void frontend_switch_deinit(void *data) socketExit(); #endif - // Splash + /* Splash */ if (splashData) { free(splashData); @@ -325,33 +325,33 @@ static void frontend_switch_exitspawn(char *s, size_t len) void argb_to_rgba8(uint32_t *buff, uint32_t height, uint32_t width) { - // Convert - for (uint32_t h = 0; h < height; h++) + uint32_t h, w; + /* Convert */ + for (h = 0; h < height; h++) { - for (uint32_t w = 0; w < width; w++) + for (w = 0; w < width; w++) { uint32_t offset = (h * width) + w; - uint32_t c = buff[offset]; + uint32_t c = buff[offset]; - uint32_t a = (uint32_t)((c & 0xff000000) >> 24); - uint32_t r = (uint32_t)((c & 0x00ff0000) >> 16); - uint32_t g = (uint32_t)((c & 0x0000ff00) >> 8); - uint32_t b = (uint32_t)(c & 0x000000ff); + uint32_t a = (uint32_t)((c & 0xff000000) >> 24); + uint32_t r = (uint32_t)((c & 0x00ff0000) >> 16); + uint32_t g = (uint32_t)((c & 0x0000ff00) >> 8); + uint32_t b = (uint32_t)(c & 0x000000ff); - buff[offset] = RGBA8(r, g, b, a); + buff[offset] = RGBA8(r, g, b, a); } } } -void frontend_switch_showsplash() +void frontend_switch_showsplash(void) { printf("[Splash] Showing splashScreen\n"); if (splashData) { - uint32_t width, height; - width = height = 0; - + uint32_t width = 0; + uint32_t height = 0; uint32_t *frambuffer = (uint32_t *)gfxGetFramebuffer(&width, &height); gfx_slow_swizzling_blit(frambuffer, splashData, width, height, 0, 0, false); @@ -362,15 +362,15 @@ void frontend_switch_showsplash() } } -// From rpng_test.c -bool rpng_load_image_argb(const char *path, uint32_t **data, unsigned *width, unsigned *height) +/* From rpng_test.c */ +bool rpng_load_image_argb(const char *path, + uint32_t **data, unsigned *width, unsigned *height) { int retval; size_t file_len; - bool ret = true; - rpng_t *rpng = NULL; - void *ptr = NULL; - + bool ret = true; + rpng_t *rpng = NULL; + void *ptr = NULL; struct nbio_t *handle = (struct nbio_t *)nbio_open(path, NBIO_READ); if (!handle) @@ -463,7 +463,7 @@ ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize) return -1; } -// Taken from glibc +/* Taken from glibc */ char *realpath(const char *name, char *resolved) { char *rpath, *dest, *extra_buf = NULL; @@ -592,14 +592,14 @@ error: return NULL; } -#endif // HAVE_LIBNX +#endif /* HAVE_LIBNX */ static void frontend_switch_shutdown(bool unused) { (void)unused; } -// runloop_get_system_info isnt initialized that early.. +/* runloop_get_system_info isnt initialized that early.. */ extern void retro_get_system_info(struct retro_system_info *info); static void frontend_switch_init(void *data) @@ -608,21 +608,21 @@ static void frontend_switch_init(void *data) #ifdef HAVE_LIBNX #ifndef HAVE_OPENGL - // Init Resolution before initDefault + /* Init Resolution before initDefault */ gfxInitResolution(1280, 720); gfxInitDefault(); gfxSetMode(GfxMode_TiledDouble); gfxConfigureTransform(0); -#endif // HAVE_OPENGL +#endif /* HAVE_OPENGL */ #ifdef NXLINK socketInitializeDefault(); nxlink_connected = nxlinkStdio() != -1; #ifndef IS_SALAMANDER verbosity_enable(); -#endif // IS_SALAMANDER -#endif // NXLINK +#endif /* IS_SALAMANDER */ +#endif /* NXLINK */ Result rc; rc = psmInitialize(); @@ -642,8 +642,8 @@ static void frontend_switch_init(void *data) uint32_t width, height; width = height = 0; - // Load splash #ifndef HAVE_OPENGL + /* Load splash */ if (!splashData) { if (sys_info) @@ -685,12 +685,12 @@ static void frontend_switch_init(void *data) frontend_switch_showsplash(); } #endif -#endif // HAVE_LIBNX (splash) +#endif /* HAVE_LIBNX (splash) */ } static int frontend_switch_get_rating(void) { - return 1000; + return 11; } enum frontend_architecture frontend_switch_get_architecture(void) @@ -718,7 +718,7 @@ static int frontend_switch_parse_drive_list(void *data, bool load_content) static uint64_t frontend_switch_get_mem_total(void) { uint64_t memoryTotal = 0; - svcGetInfo(&memoryTotal, 6, 0xffff8001, 0); // avaiable + svcGetInfo(&memoryTotal, 6, 0xffff8001, 0); memoryTotal += frontend_switch_get_mem_used(); return memoryTotal; @@ -727,7 +727,7 @@ static uint64_t frontend_switch_get_mem_total(void) static uint64_t frontend_switch_get_mem_used(void) { uint64_t memoryUsed = 0; - svcGetInfo(&memoryUsed, 7, 0xffff8001, 0); // used + svcGetInfo(&memoryUsed, 7, 0xffff8001, 0); return memoryUsed; } @@ -769,7 +769,7 @@ static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor) strlcpy(s, "Horizon OS", len); #ifdef HAVE_LIBNX - // There is pretty sure a better way, but this will do just fine + /* There is pretty sure a better way, but this will do just fine */ if (kernelAbove600()) { *major = 6; @@ -796,18 +796,18 @@ static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor) } else { - // either 1.0 or > 5.x + /* either 1.0 or > 5.x */ *major = 1; *minor = 0; } #else - // defaults in case we error out + /* defaults in case we error out */ *major = 0; *minor = 0; char firmware_version[0x100]; - result_t r; // used by LIB_ASSERT_OK macros + result_t r; /* used by LIB_ASSERT_OK macros */ LIB_ASSERT_OK(fail, sm_init()); ipc_object_t set_sys; @@ -835,7 +835,7 @@ fail: static void frontend_switch_get_name(char *s, size_t len) { - // TODO: Add Mariko at some point + /* TODO: Add Mariko at some point */ strlcpy(s, "Nintendo Switch", len); } @@ -853,12 +853,12 @@ frontend_ctx_driver_t frontend_ctx_switch = #else frontend_switch_set_fork, #endif -#else // HAVE_LIBNX +#else /* HAVE_LIBNX */ NULL, NULL, NULL, NULL, -#endif // HAVE_LIBNX +#endif /* HAVE_LIBNX */ frontend_switch_shutdown, frontend_switch_get_name, frontend_switch_get_os, From 4abc718f052d5b86e1b46d2583b2631e89a9cfd1 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Mon, 8 Oct 2018 11:17:48 +0800 Subject: [PATCH 0263/1292] Update Simp. Chinese Localization --- intl/msg_hash_chs.c | 2 +- intl/msg_hash_chs.h | 280 +++++++++++++++++++++++++------------------- 2 files changed, 158 insertions(+), 124 deletions(-) diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index 94c0de0047..ba95d0a781 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -369,7 +369,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_FILE_BROWSER_REMAP: snprintf(s, len, - "控制重映射文件。"); + "控制自定义键位文件。"); break; case MENU_ENUM_LABEL_FILE_BROWSER_CHEAT: snprintf(s, len, diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 1443158e63..892d7731c7 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -7,7 +7,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, "对 Switch 的 GPU 超频或降频" ) - MSG_HASH( +MSG_HASH( MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, "屏幕亮度" ) @@ -49,11 +49,11 @@ MSG_HASH( ) MSG_HASH( MSG_GOT_CONNECTION_FROM, - "连接来自: \"%s\"" + "连接来自:「%s」" ) MSG_HASH( MSG_GOT_CONNECTION_FROM_NAME, - "连接来自: \"%s (%s)\"" + "连接来自:「%s (%s)」" ) MSG_HASH( MSG_PUBLIC_ADDRESS, @@ -121,11 +121,11 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_PEER_PAUSED, - "联机游戏对方 \"%s\" 暂停" + "联机游戏对方「%s」暂停" ) MSG_HASH( MSG_NETPLAY_CHANGED_NICK, - "你的昵称已修改为 \"%s\"" + "你的昵称已修改为「%s」" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, @@ -306,15 +306,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, - "自动加载覆写文件" + "自动加载独立配置文件" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTO_REMAPS_ENABLE, - "自动加载重映射文件" + "自动加载自定义键位文件" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE, - "自动加载Shader预设" + "自动加载渲染器预设" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, @@ -386,7 +386,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BLOCK_SRAM_OVERWRITE, - "加载保存状态时不覆盖SaveRAM" + "加载即时存档时不覆盖游戏自带存档" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BLUETOOTH_ENABLE, @@ -546,11 +546,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_MANUFACTURER, MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_NAME, "系统名称") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS, - "控制") + "键位设置") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_LIST, "加载核心") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_OPTIONS, - "选项") + "核心选项") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_SETTINGS, "核心") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_SET_SUPPORTS_NO_CONTENT_ENABLE, @@ -652,7 +652,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP, MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING, "音频/视频故障排除") MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD, - "变更虚拟游戏控制器覆层") + "变更虚拟游戏控制器图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_CONTROLS, "基本菜单控制") MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_LIST, @@ -850,7 +850,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, "切换屏幕键盘") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, - "下一个覆层") + "下一个图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, "切换暂停") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, @@ -860,13 +860,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, "回溯") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, - "保存状态") + "即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, "屏幕截图") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, - "下一个Shader") + "下一个渲染器") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, - "上一个Shader") + "上一个渲染器") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_HOLD_KEY, "慢动作") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, @@ -878,11 +878,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, "音量 +") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OSK_OVERLAY_ENABLE, - "显示键盘覆层") + "显示键盘图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, - "显示覆层") + "显示图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, - "在菜单中隐藏覆层") + "在菜单中隐藏图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, "轮询类型行为") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, @@ -894,9 +894,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_PREFER_FRONT_TOUCH, "优先前置触摸") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, - "输入重映射目录") + "自定义键位目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, - "启用绑定重映射") + "启用绑定自定义键位") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG, "保存自动设置") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS, @@ -911,6 +911,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, "Turbo区间") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS, "输入用户 %u 的绑定") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LATENCY_SETTINGS, + "延迟") MSG_HASH(MENU_ENUM_LABEL_VALUE_INTERNAL_STORAGE_STATUS, "内部存储状态") MSG_HASH(MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, @@ -1120,17 +1122,25 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, "没有找到设置。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, - "没有Shader参数.") + "没有渲染器参数.") MSG_HASH(MENU_ENUM_LABEL_VALUE_OFF, "关") MSG_HASH(MENU_ENUM_LABEL_VALUE_ON, "开") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONLINE, + "在线") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER, "在线更新器") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, "屏幕显示") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, - "屏幕覆层") + "屏幕图层") +MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS, + "Adjust Bezels and Onscreen controls") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, + "屏幕提示") +MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, + "调整屏幕提示") MSG_HASH(MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, "以文件夹形式打开压缩包") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, @@ -1138,21 +1148,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_OPTIONAL, "任意") MSG_HASH(MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, - "OSK覆层目录") + "OSK图层目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY, - "覆层") + "图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, - "自动加载最佳的覆层") + "自动加载最佳的图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, - "覆层目录") + "图层目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, - "覆层不透明度") + "图层不透明度") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_PRESET, - "覆层预设") + "图层预设") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE, - "覆层缩放比例") + "图层缩放比例") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, - "屏幕覆层") + "屏幕图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, "使用PAL60模式") MSG_HASH(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, @@ -1259,13 +1269,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_PATH, MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, "使用输出目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE, - "重映射文件") + "自定义键位文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_LOAD, - "加载重映射文件") + "加载自定义键位文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CORE, - "保存核心重映射文件") + "保存核心自定义键位文件") +MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CONTENT_DIR, + "保存游戏文件夹自定义键位文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_GAME, - "保存游戏重映射文件") + "保存游戏自定义键位文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_REQUIRED, "必须") MSG_HASH(MENU_ENUM_LABEL_VALUE_RESTART_CONTENT, @@ -1277,9 +1289,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME, MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT, "继续") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROKEYBOARD, - "Retro键盘") + "Retro 键盘") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROPAD, - "Retro触摸板") + "Retro 触摸板") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROPAD_WITH_ANALOG, "RetroPad w/ Analog") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, @@ -1298,32 +1310,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, "显示开始屏幕") MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, "右侧摇杆") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, + "添加到收藏") +MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, + "添加到收藏") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION, + "重置核心关联") MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN, "运行") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC, + "运行") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE, "启用SAMBA文件共享服务") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, "存档文件目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_INDEX, - "自动索引保存状态") + "自动索引即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, - "自动加载状态") + "自动加载即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, - "自动保存状态") + "自动保存即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, - "状态存储目录") + "即时存档目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, "Savestate Thumbnails") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, "保存当前配置") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, - "保存核心覆写") + "保存核心独立配置") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, + "保存游戏文件夹独立配置") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, - "保存游戏覆写") + "保存游戏独立配置") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_NEW_CONFIG, "保存新配置") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_STATE, - "保存状态") + "即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, "存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY, @@ -1345,11 +1367,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, "设置") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER, - "Shader") + "渲染器") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES, - "应用Shader修改") + "应用渲染器修改") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS, - "Shader效果") + "渲染器效果") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, "Ribbon") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, @@ -1367,9 +1389,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHUTDOWN, MSG_HASH(MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO, "慢动作倍率") MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE, - "排序文件夹中的存档") + "排序文件夹中的游戏存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE, - "排序文件夹中的状态存储") + "排序文件夹中的即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SSH_ENABLE, "启用SSH远程终端服务") MSG_HASH(MENU_ENUM_LABEL_VALUE_START_CORE, @@ -1379,7 +1401,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, MSG_HASH(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, "启动视频处理") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATE_SLOT, - "状态存储槽") + "即时存档栏位") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATUS, "状态") MSG_HASH(MENU_ENUM_LABEL_VALUE_STDIN_CMD_ENABLE, @@ -1427,7 +1449,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT, "EGL 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FBO_SUPPORT, - "OpenGL/Direct3D 渲染至纹理 (多渲染批次Shader) 支持") + "OpenGL/Direct3D 渲染至纹理 (多渲染批次渲染器) 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FFMPEG_SUPPORT, "FFmpeg 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FREETYPE_SUPPORT, @@ -1475,7 +1497,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENVG_SUPPORT, MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OSS_SUPPORT, "OSS 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OVERLAY_SUPPORT, - "覆层支持") + "图层支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE, "电源") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED, @@ -1489,7 +1511,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_NO_SOURCE, MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PULSEAUDIO_SUPPORT, "PulseAudio 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PYTHON_SUPPORT, - "Python (Shader中脚本支持) 支持") + "Python (渲染器中脚本支持) 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RBMP_SUPPORT, "BMP 支持 (RBMP)") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETRORATING_LEVEL, @@ -1533,7 +1555,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XVIDEO_SUPPORT, MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT, "Zlib 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT, - "截取屏幕") + "截图") MSG_HASH(MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, /* TODO/FIXME - update */ "启用多线程数据执行循环") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS, @@ -1563,9 +1585,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, "无法读取压缩的文件。") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, - "撤销加载状态") + "撤销即时读档") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE, - "撤销保存状态") + "撤销即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNKNOWN, "未知") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATER_SETTINGS, @@ -1575,7 +1597,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_ASSETS, MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES, "更新自动配置档案") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, - "更新CG Shader效果文件") + "更新CG 渲染器效果文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS, "更新金手指") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, @@ -1583,13 +1605,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES, "更新数据库") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_GLSL_SHADERS, - "更新GLSL Shader效果文件") + "更新GLSL 渲染器效果文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_LAKKA, "更新 Lakka") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_OVERLAYS, - "更新覆层") + "更新图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_SLANG_SHADERS, - "更新Slang Shader效果文件") + "更新Slang 渲染器效果文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER, "用户") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS, @@ -1673,17 +1695,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, "视频") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, - "视频Shader目录") + "视频渲染器目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, - "Shader渲染遍数") + "渲染器渲染次数") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, - "预览Shader参数") + "预览渲染器参数") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, - "加载Shader预设") + "加载渲染器预设") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS, - "菜单Shader参数") + "菜单渲染器参数") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, - "保存Shader预设为") + "保存渲染器预设为") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, "保存核心预设") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, @@ -1777,7 +1799,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED, "火山红") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, - "菜单Shader管线") + "菜单渲染器管线") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR, "菜单缩放因子") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, @@ -1801,7 +1823,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, MSG_HASH(MENU_ENUM_LABEL_VALUE_YES, "是") MSG_HASH(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO, - "Shader预设") + "渲染器预设") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, "打开或关闭成就。更多内容请访问 http://retroachievements.org") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, @@ -1860,6 +1882,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_SETTINGS, "调整游戏控制器、键盘和鼠标的设置。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, "配置该用户的控制选项。") +MSG_HASH(MENU_ENUM_SUBLABEL_LATENCY_SETTINGS, + "更改关于视频、音频和输入延迟的设置。") MSG_HASH(MENU_ENUM_SUBLABEL_LOG_VERBOSITY, "启用或禁止向控制台打印日志。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY, @@ -1922,7 +1946,7 @@ MSG_HASH(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY, MSG_HASH(MSG_AUTOSAVE_FAILED, "无法初始化自动保存。") MSG_HASH(MSG_AUTO_SAVE_STATE_TO, - "自动保存状态至") + "自动保存即时存档至") MSG_HASH(MSG_BLOCKING_SRAM_OVERWRITE, "阻止 SRAM 覆盖") MSG_HASH(MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, @@ -1946,9 +1970,9 @@ MSG_HASH(MSG_CONTENT_CRC32S_DIFFER, MSG_HASH(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, "跳过内容加载。实现将自行加载。") MSG_HASH(MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, - "核心不支持保存状态。") + "核心不支持即时存档。") MSG_HASH(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, - "Core options file created successfully.") + "已创建核心选项文件。") MSG_HASH(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, "Could not find any next driver") MSG_HASH(MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM, @@ -1988,17 +2012,17 @@ MSG_HASH(MSG_DOWNLOAD_FAILED, MSG_HASH(MSG_ERROR, "错误") MSG_HASH(MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT, - "Libretro core requires content, but nothing was provided.") + "Libretro 核心需要加载游戏才能运行。") MSG_HASH(MSG_ERROR_LIBRETRO_CORE_REQUIRES_SPECIAL_CONTENT, - "Libretro core requires special content, but none were provided.") + "Libretro 核心需要加载特定游戏内容才能运行。") MSG_HASH(MSG_ERROR_PARSING_ARGUMENTS, - "Error parsing arguments.") + "解析命令行时出现错误。") MSG_HASH(MSG_ERROR_SAVING_CORE_OPTIONS_FILE, - "Error saving core options file.") + "保存核心选项文件时出现错误。") MSG_HASH(MSG_ERROR_SAVING_REMAP_FILE, - "Error saving remap file.") + "保存自定义键位文件时出现错误。") MSG_HASH(MSG_ERROR_SAVING_SHADER_PRESET, - "Error saving shader preset.") + "保存预设渲染器文件时出现错误。") MSG_HASH(MSG_EXTERNAL_APPLICATION_DIR, "外部应用程序目录") MSG_HASH(MSG_EXTRACTING, @@ -2136,9 +2160,9 @@ MSG_HASH(MSG_LIBRETRO_ABI_BREAK, MSG_HASH(MSG_LIBRETRO_FRONTEND, "为libretro而设计的前端") MSG_HASH(MSG_LOADED_STATE_FROM_SLOT, - "加载状态从槽 #%d.") + "读取 #%d 号即时存档。") MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO, - "加载状态从槽 #-1 (auto).") + "读取 #-1 号即时存档(自动)。") MSG_HASH(MSG_LOADING, "正在加载") MSG_HASH(MSG_FIRMWARE, @@ -2168,9 +2192,9 @@ MSG_HASH(MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET, MSG_HASH(MSG_NO_STATE_HAS_BEEN_LOADED_YET, "没有加载任何存档。") MSG_HASH(MSG_OVERRIDES_ERROR_SAVING, - "保存覆盖错误。") + "保存独立配置时出现错误。") MSG_HASH(MSG_OVERRIDES_SAVED_SUCCESSFULLY, - "覆盖保存成功。") + "独立配置保存成功。") MSG_HASH(MSG_PAUSED, "暂停。") MSG_HASH(MSG_PROGRAM, @@ -2186,11 +2210,11 @@ MSG_HASH(MSG_RECORDING_TO, MSG_HASH(MSG_REDIRECTING_CHEATFILE_TO, "重定向金手指文件至") MSG_HASH(MSG_REDIRECTING_SAVEFILE_TO, - "Redirecting save file to") + "重定向游戏存档文件至") MSG_HASH(MSG_REDIRECTING_SAVESTATE_TO, - "Redirecting savestate to") + "重定向即时存档文件至") MSG_HASH(MSG_REMAP_FILE_SAVED_SUCCESSFULLY, - "Remap file saved successfully.") + "自定义键位文件已保存。") MSG_HASH(MSG_REMOVED_DISK_FROM_TRAY, "Removed disk from tray.") MSG_HASH(MSG_REMOVING_TEMPORARY_CONTENT_FILE, @@ -2202,7 +2226,7 @@ MSG_HASH(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, MSG_HASH(MSG_RESTORED_OLD_SAVE_STATE, "重载旧的存档。") MSG_HASH(MSG_RESTORING_DEFAULT_SHADER_PRESET_TO, - "Shaders: restoring default shader preset to") + "重置渲染器预设到") MSG_HASH(MSG_REVERTING_SAVEFILE_DIRECTORY_TO, "Reverting savefile directory to") MSG_HASH(MSG_REVERTING_SAVESTATE_DIRECTORY_TO, @@ -2220,9 +2244,9 @@ MSG_HASH(MSG_REWIND_REACHED_END, MSG_HASH(MSG_SAVED_NEW_CONFIG_TO, "已保存新配置到") MSG_HASH(MSG_SAVED_STATE_TO_SLOT, - "保存状态至槽 #%d.") + "保存 #%d 号即时存档。") MSG_HASH(MSG_SAVED_STATE_TO_SLOT_AUTO, - "保存状态至槽 #-1 (auto).") + "保存 #-1 号即时存档(自动)。") MSG_HASH(MSG_SAVED_SUCCESSFULLY_TO, "成功保存至") MSG_HASH(MSG_SAVING_RAM_TYPE, @@ -2238,9 +2262,9 @@ MSG_HASH(MSG_SENDING_COMMAND, MSG_HASH(MSG_SEVERAL_PATCHES_ARE_EXPLICITLY_DEFINED, "Several patches are explicitly defined, ignoring all...") MSG_HASH(MSG_SHADER, - "Shader") + "渲染器") MSG_HASH(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, - "Shader preset saved successfully.") + "预设渲染器已加载。") MSG_HASH(MSG_SKIPPING_SRAM_LOAD, "跳过 SRAM 加载。") MSG_HASH(MSG_SLOW_MOTION, @@ -2517,9 +2541,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_LIST, - "Select which core to use.") + "选择使用的模拟器核心。") MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, - "Select which content to start.") + "选择需要加载的游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, "Show network interface(s) and associated IP addresses.") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, @@ -2624,7 +2648,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, - "If enabled, overrides the input binds with the remapped binds set for the current core." + "如果开启,则当前核心改为使用自定义键位设置。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, @@ -2848,22 +2872,22 @@ MSG_HASH(MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, "Captures an image of the screen.") MSG_HASH( MENU_ENUM_SUBLABEL_CLOSE_CONTENT, - "Closes the current content. Any unsaved changes might be lost." + "关闭当前游戏。未保存的进度可能会丢失。" ) MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_STATE, - "Load a saved state from the currently selected slot.") + "读取当前栏位的即时存档。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_STATE, - "Save a state to the currently selected slot.") + "在当前栏位保存即时存档。") MSG_HASH(MENU_ENUM_SUBLABEL_RESUME, - "Resume the currently running content and leave the Quick Menu.") + "退出菜单,继续进行游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_RESUME_CONTENT, - "Resume the currently running content and leave the Quick Menu.") + "退出菜单,继续进行游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_STATE_SLOT, - "Changes the currently selected state slot.") + "更改即时存档使用的栏位序号。") MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, - "If a state was loaded, content will go back to the state prior to loading.") + "如果你不慎读错了即时存档,使用此命令来撤销。") MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, - "If a state was overwritten, it will roll back to the previous save state.") + "如果你不慎覆盖了即时存档,使用此命令来撤销。") MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, "Retro Achievements service. For more information, visit http://retroachievements.org" @@ -2875,19 +2899,21 @@ MSG_HASH( MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_REWIND, "Manages rewind settings.") MSG_HASH(MENU_ENUM_SUBLABEL_RESTART_CONTENT, - "Restarts the content from the beginning.") + "重新开始游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, - "Saves an override configuration file which will apply for all content loaded with this core. Will take precedence over the main configuration.") + "保存一个独立配置文件,该配置对此核心运行的所有游戏生效。") +MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, + "保存一个独立配置文件,该配置对此游戏文件夹下的所有游戏生效。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, - "Saves an override configuration file which will apply for the current content only. Will take precedence over the main configuration.") + "保存一个独立配置文件,该配置对此游戏生效。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, "Set up cheat codes.") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_OPTIONS, "Set up shaders to visually augment the image.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS, - "Change the controls for the currently running content.") + "更改当前游戏的键位设置。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_OPTIONS, - "Change the options for the currently running content.") + "更改当前游戏的核心选项设置。") MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, "Show advanced settings for power users (hidden by default).") MSG_HASH(MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, @@ -3222,17 +3248,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS, MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS, "Show/hide the 'Cheats' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS, - "Show Shaders") + "显示渲染器") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS, - "Show/hide the 'Shaders' option.") + "显示或隐藏「渲染器」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, - "Show Save Core Overrides") + "显示保存核心独立配置") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, - "Show/hide the 'Save Core Overrides' option.") + "显示或隐藏「核心独立配置」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, - "Show Save Game Overrides") + "显示保存游戏独立配置") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, - "Show/hide the 'Save Game Overrides' option.") + "显示或隐藏「游戏独立配置」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, "Show Information") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, @@ -3303,9 +3329,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, "View and/or modify audio mixer settings.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, - "Overrides") + "独立配置") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, - "Options for overriding the global configuration.") + "关于独立配置的选项。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, "Will start playback of the audio stream. Once finished, it will remove the current audio stream from memory.") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, @@ -3348,18 +3374,26 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING, "Playing") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, "Paused") -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, - "Enable Discord" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DISCORD_ALLOW, - "Enable or disable Discord support. Will not work with the browser version, only native desktop client." - ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, + "Enable Discord") +MSG_HASH(MENU_ENUM_SUBLABEL_DISCORD_ALLOW, + "Enable or disable Discord support. Will not work with the browser version, only native desktop client.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_INPUT, + "Input") +MSG_HASH(MENU_ENUM_SUBLABEL_MIDI_INPUT, + "Select input device.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_OUTPUT, + "Output") +MSG_HASH(MENU_ENUM_SUBLABEL_MIDI_OUTPUT, + "Select output device.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_VOLUME, + "Volume") +MSG_HASH(MENU_ENUM_SUBLABEL_MIDI_VOLUME, + "Set output volume (%).") MSG_HASH(MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, - "Power Management") + "电源管理") MSG_HASH(MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, - "Change power management settings.") + "更改电源管理设置。") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, "Sustained Performance Mode") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MPV_SUPPORT, From ec793c7955a6950645bc9e206da0599ed56fc4f5 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Mon, 8 Oct 2018 11:40:22 +0800 Subject: [PATCH 0264/1292] Update Simp. Chinese Localization --- intl/msg_hash_chs.h | 153 +++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 72 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 892d7731c7..d00b383b80 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -113,7 +113,7 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS, - "已无空闲插槽" /*FIXME:"There are no free player slots"*/ + "玩家数量已满" ) MSG_HASH( MSG_NETPLAY_CANNOT_PLAY, @@ -185,7 +185,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_SETTINGS, - "Cheevos账户" /*FIXME:"Accounts Cheevos"*/ + "Cheevos 账户设置" /*FIXME:"Accounts Cheevos"*/ /*Should be fixed now, not sure though*/ ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME, @@ -234,7 +234,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY, - "资源目录" + "资源文件夹" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_BLOCK_FRAMES, @@ -258,7 +258,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR, - "音频过滤器目录" + "音频过滤器文件夹" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TURBO_DEADZONE_LIST, @@ -398,7 +398,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, - "缓存目录" + "缓存文件夹" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CAMERA_ALLOW, @@ -418,7 +418,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH, - "金手指文件目录" + "金手指文件文件夹" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_FILE, @@ -434,7 +434,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_NUM_PASSES, - "金手指通过" /*FIXME: "Cheat Passes"*/ + "金手指列表" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_DESCRIPTION, @@ -442,7 +442,6 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_HARDCORE_MODE_ENABLE, -/* FIXME? Translate 'Hardcore Mode' */ "专家模式" ) MSG_HASH( @@ -459,8 +458,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_TEST_UNOFFICIAL, -/* FIXME? Translate 'Test Unofficial Achievements' */ - "非官方测试" + "非官方成就测试" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS, @@ -500,11 +498,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY, - "游戏内容数据库目录" + "游戏内容数据库文件夹" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_DIR, - "游戏内容目录" + "游戏内容文件夹" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, @@ -514,9 +512,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, "快捷菜单") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIR, - "下载目录") + "下载文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY, - "下载目录") + "下载文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS, "金手指") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_COUNTERS, @@ -568,7 +566,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CPU_ARCHITECTURE, MSG_HASH(MENU_ENUM_LABEL_VALUE_CPU_CORES, "CPU核心:") MSG_HASH(MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY, - "指针目录") + "指针文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_CURSOR_MANAGER, "光标管理器") MSG_HASH(MENU_ENUM_LABEL_VALUE_CUSTOM_RATIO, @@ -582,7 +580,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DELETE_ENTRY, MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES, "选择文件并探测核心") /* TODO/FIXME - update */ MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, - "<游戏内容目录>") + "<游戏内容文件夹>") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, "<默认>") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, @@ -590,7 +588,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, "没有找到文件夹。") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, - "目录") + "文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, "Disk Cycle Tray Status") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, @@ -602,7 +600,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, MSG_HASH(MENU_ENUM_LABEL_VALUE_DONT_CARE, "不关心") MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST, - "下载目录") + "下载文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE, "下载核心……") MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT, @@ -617,14 +615,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN, /* FIXME? Translate 'Load Dummy on Core Shutdown' */ "核心关闭时加载虚拟程序") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHECK_FOR_MISSING_FIRMWARE, - "加载前检查丢失的固件") /*FIXME: "Check for Missing Firmware Before Loading"*/ + "加载前检查固件完整性") MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, "动态壁纸") MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, - "动态壁纸目录") + "动态壁纸文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEEVOS_ENABLE, -/* FIXME? Translate 'Enable Achievements' */ - "启用") + "启用成就系统") MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, "菜单项悬停颜色") MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, @@ -730,7 +727,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, "输入轴阈值") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, - "菜单切换 确定/取消 按钮") /*FIXME:"Menu Swap OK & Cancel Buttons"*/ + "互换确定键和取消键") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, "绑定全部") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL, @@ -786,7 +783,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_X, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_Y, "Y键(左侧)") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_KEY, - "(键: %s)") /*FIXME:"(Key: %s)"*/ + "(%s 键)") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_LEFT, "Mouse 1") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_RIGHT, @@ -894,7 +891,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_PREFER_FRONT_TOUCH, "优先前置触摸") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, - "自定义键位目录") + "自定义键位文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, "启用绑定自定义键位") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG, @@ -916,7 +913,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LATENCY_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_INTERNAL_STORAGE_STATUS, "内部存储状态") MSG_HASH(MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, - "输入设备自动配置目录") + "输入设备自动配置文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_JOYPAD_DRIVER, "手柄驱动") MSG_HASH(MENU_ENUM_LABEL_VALUE_LAKKA_SERVICES, @@ -958,9 +955,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "左侧摇杆") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, - "核心目录") + "核心文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, - "核心信息目录") + "核心信息文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_LOG_LEVEL, "核心日志级别") MSG_HASH(MENU_ENUM_LABEL_VALUE_LINEAR, @@ -1148,13 +1145,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_OPTIONAL, "任意") MSG_HASH(MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, - "OSK图层目录") + "OSK图层文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY, "图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, "自动加载最佳的图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, - "图层目录") + "图层文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, "图层不透明度") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_PRESET, @@ -1166,7 +1163,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, "使用PAL60模式") MSG_HASH(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, - "上一级目录") + "上一级文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO, "当菜单激活时暂停") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAUSE_NONACTIVE, @@ -1176,7 +1173,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PERFCNT_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB, "游戏列表") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, - "游戏列表目录") + "游戏列表文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "游戏列表") MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, @@ -1253,21 +1250,23 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_REBOOT, "重启") #endif MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, - "录像配置目录") + "录像配置文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, - "录像输出目录") + "录像输出文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORDING_SETTINGS, "录像") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, "录像配置") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, "录像驱动") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_DRIVER, + "MIDI 驱动") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_ENABLE, "启用录像") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_PATH, "输出文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, - "使用输出目录") + "使用输出文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE, "自定义键位文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_LOAD, @@ -1303,9 +1302,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, "回溯") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, - "文件浏览器目录") + "文件浏览器文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, - "配置目录") + "配置文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, "显示开始屏幕") MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, @@ -1323,7 +1322,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC, MSG_HASH(MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE, "启用SAMBA文件共享服务") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, - "存档文件目录") + "存档文件文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_INDEX, "自动索引即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, @@ -1331,7 +1330,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, "自动保存即时存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, - "即时存档目录") + "即时存档文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, "Savestate Thumbnails") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, @@ -1353,9 +1352,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_FILE, "扫描文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY, - "<扫描当前目录>") + "<扫描当前文件夹>") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, - "屏幕截图目录") + "屏幕截图文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, "屏幕分辨率") MSG_HASH(MENU_ENUM_LABEL_VALUE_SEARCH, @@ -1413,7 +1412,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_BGM_ENABLE, "启用系统背景音乐") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY, - "系统/BIOS目录") + "系统/BIOS文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION, "系统信息") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_7ZIP_SUPPORT, @@ -1561,7 +1560,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, /* TODO/FIXME - upd MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS, "缩略图") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, - "缩略图目录") + "缩略图文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST, "缩略图更新程序") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, @@ -1625,17 +1624,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER, MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_BUILTIN_PLAYER, "使用内建媒体播放器") MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, - "<使用当前目录>") + "<使用当前文件夹>") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, "允许旋转") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, - "自动选择视口比例") + "自动选择视窗比例") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, - "视口比例选项") + "视窗比例选项") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, "黑色帧补间") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, - "Crop Overscan (Reload)") + "裁剪过扫描部分(需重启)") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, "禁用桌面元素") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER, @@ -1643,7 +1642,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER, "视频滤镜") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR, - "视频滤镜目录") + "视频滤镜文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_FLICKER, "闪烁过滤器") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_ENABLE, @@ -1653,7 +1652,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE, "屏显消息(OSD)大小") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_ASPECT, - "强制视口比例") + "强制视窗比例") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, "强制禁止sRGB帧缓冲") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, @@ -1691,11 +1690,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, "窗口缩放量") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, - "整数化缩放量") + "放大整数倍") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, "视频") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, - "视频渲染器目录") + "视频渲染器文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, "渲染器渲染次数") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, @@ -1725,13 +1724,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER, "降低闪烁") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "自定义视口高度") + "自定义视窗高度") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "自定义视口宽度") + "自定义视窗宽度") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, - "自定义视口X") + "自定义视窗X") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, - "自定义视口Y") + "自定义视窗Y") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, "设置 VI 屏幕宽度") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, @@ -1853,7 +1852,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_USER_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, "修改你的隐私设置。") MSG_HASH(MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, - "修改此系统的默认目录。") + "修改此系统的默认文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, "修改游戏列表设置。") MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, @@ -1909,7 +1908,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, "在帧与帧之间插入黑色的中间帧,通常用于消除在\n" "120Hz刷新率的显示器上运行60Hz的游戏内容带来\n" - "的鬼影。") + "的重影。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, "以增加画面卡顿的风险换取低延时,在垂直同步后增加\n" "时延(毫秒)。") @@ -1932,7 +1931,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST, MSG_HASH(MSG_APPENDED_DISK, "Appended disk") MSG_HASH(MSG_APPLICATION_DIR, - "应用程序目录") + "应用程序文件夹") MSG_HASH(MSG_APPLYING_SHADER, "Applying shader") MSG_HASH(MSG_AUDIO_MUTED, @@ -1962,7 +1961,7 @@ MSG_HASH(MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, MSG_HASH(MSG_COMPILED_AGAINST_API, "Compiled against API") MSG_HASH(MSG_CONFIG_DIRECTORY_NOT_SET, - "未设置配置目录,无法保存新的配置。") + "未设置配置文件夹,无法保存新的配置。") MSG_HASH(MSG_CONNECTED_TO, "连接至") MSG_HASH(MSG_CONTENT_CRC32S_DIFFER, @@ -2024,7 +2023,7 @@ MSG_HASH(MSG_ERROR_SAVING_REMAP_FILE, MSG_HASH(MSG_ERROR_SAVING_SHADER_PRESET, "保存预设渲染器文件时出现错误。") MSG_HASH(MSG_EXTERNAL_APPLICATION_DIR, - "外部应用程序目录") + "外部应用程序文件夹") MSG_HASH(MSG_EXTRACTING, "正在解压") MSG_HASH(MSG_EXTRACTING_FILE, @@ -2042,7 +2041,7 @@ MSG_HASH(MSG_FAILED_TO_APPLY_SHADER, MSG_HASH(MSG_FAILED_TO_BIND_SOCKET, "Failed to bind socket.") MSG_HASH(MSG_FAILED_TO_CREATE_THE_DIRECTORY, - "创建目录失败。") + "创建文件夹失败。") MSG_HASH(MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE, "从压缩文件中提取内容失败") MSG_HASH(MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT, @@ -2680,7 +2679,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_DRIVER, - "Audio resampler driver to use." + "使用的音频重采样驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CAMERA_DRIVER, @@ -2698,6 +2697,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RECORD_DRIVER, "Record driver to use." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_DRIVER, + "MIDI driver to use." + ) MSG_HASH( MENU_ENUM_SUBLABEL_WIFI_DRIVER, "WiFi driver to use." @@ -3078,7 +3081,7 @@ MSG_HASH( "Save current cheats as a save file." ) MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, - "Quickly access all relevant in-game settings.") + "快速配置游戏内设置。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INFORMATION, "View information pertaining to the application/core.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, @@ -3286,11 +3289,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, "Automatically scans loaded content so they appear inside playlists.") MSG_HASH(MSG_SCANNING_OF_FILE_FINISHED, - "Scanning of file finished") + "文件扫描完成") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, - "Audio Resampler Quality") + "音频重采样质量") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, "Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, + "Watch shader files for changes") +MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, + "Auto-apply changes made to shader files on disk.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, + "显示视窗装饰") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, "Display Statistics") MSG_HASH(MENU_ENUM_SUBLABEL_STATISTICS_SHOW, @@ -3302,7 +3311,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, "Enable background filler thickness") MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "For CRT displays only. Attempts to use exact core/game resolution and refresh rate.") -MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, "CRT SwitchRes") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, "CRT 原生输出") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, "Switch among native and ultrawide super resolutions." @@ -3321,13 +3330,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS, MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, "Show Overlay Settings") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, - "Enable menu audio") + "启用菜单声音") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, - "Enable or disable menu sound.") + "开启或关闭菜单声音。") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, - "Mixer Settings") + "混音器设置") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, - "View and/or modify audio mixer settings.") + "查看或调整混音器设置。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, "独立配置") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, @@ -3408,11 +3417,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, - "CRT SwitchRes" + "CRT 原生输出" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, - "Output native, low-resolution signals for use with CRT displays." + "在 CRT 显示器上输出原汁原味的低清晰度信号。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, From 6748efe02098de169fb4268a09e05a78152c0dfa Mon Sep 17 00:00:00 2001 From: Ayssia Date: Mon, 8 Oct 2018 11:44:49 +0800 Subject: [PATCH 0265/1292] Fix duplicate line --- intl/msg_hash_chs.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index d00b383b80..59e3759368 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1140,8 +1140,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, "调整屏幕提示") MSG_HASH(MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, "以文件夹形式打开压缩包") -MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, - "屏幕通知") MSG_HASH(MENU_ENUM_LABEL_VALUE_OPTIONAL, "任意") MSG_HASH(MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, From a2548288b38e7efd5ba9e6799d2837d30be2cf91 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Mon, 8 Oct 2018 17:15:22 +0800 Subject: [PATCH 0266/1292] Update Simplified Chinese Localization --- intl/msg_hash_chs.c | 21 +++-- intl/msg_hash_chs.h | 212 ++++++++++++++++++++++---------------------- 2 files changed, 115 insertions(+), 118 deletions(-) diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index ba95d0a781..021e02d314 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -268,7 +268,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) "使用此命令来撤销。"); break; case MENU_ENUM_LABEL_TAKE_SCREENSHOT: - snprintf(s, len, "创建一份截图. \n" + snprintf(s, len, "创建一份截图。\n" " \n" "截图文件将会存放在 \n" "截图文件夹之中."); @@ -1175,17 +1175,16 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER: snprintf(s, len, - "只放大整数倍。 \n" - " \n" - "The base size depends on system-reported \n" - "geometry and aspect ratio.\n" - " \n" - "If Force Aspect is not set, X/Y will be \n" - "integer scaled independently."); + "只放大整数倍。\n" + "\n" + "基础分辨率与游戏、宽高比有关。\n" + "\n" + "如果「保持宽高比」选项未开启,\n" + "不保证宽高放大倍数相同。"); break; case MENU_ENUM_LABEL_AUDIO_VOLUME: snprintf(s, len, - "音量(分贝)。\n" + "音量增益(分贝)。\n" " \n" "0 表示正常音量。\n" "Gain can be controlled in runtime with Input\n" @@ -1455,7 +1454,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_PAUSE_LIBRETRO: snprintf(s, len, "如果关闭此选项,打开菜单时 \n" - "游戏就不会暂停。"); + "游戏仍会后台运行。"); break; case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE: snprintf(s, len, @@ -1527,7 +1526,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_NETPLAY_DISCONNECT: snprintf(s, len, - "断开当前正在联机的游戏。"); + "断开当前网络连接。"); break; case MENU_ENUM_LABEL_NETPLAY_SETTINGS: snprintf(s, len, diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 59e3759368..43716e8263 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -612,8 +612,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE, MSG_HASH(MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS, "驱动") MSG_HASH(MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN, -/* FIXME? Translate 'Load Dummy on Core Shutdown' */ - "核心关闭时加载虚拟程序") + "核心关闭时不彻底关机") MSG_HASH(MENU_ENUM_LABEL_VALUE_CHECK_FOR_MISSING_FIRMWARE, "加载前检查固件完整性") MSG_HASH(MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, @@ -725,7 +724,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_RIGHT, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, "启用自动配置") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, - "输入轴阈值") + "摇杆灵敏度") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, "互换确定键和取消键") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, @@ -2338,11 +2337,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, - "Allows any user to control the menu. If disabled, only User 1 can control the menu." + "允许任何用户打开菜单。如果禁用,则只有用户1能打开菜单。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_VOLUME, - "Audio volume (in dB). 0 dB is normal volume, no gain applied." + "音量增益(单位:分贝)。0 为正常音量。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_SYNC, @@ -2350,7 +2349,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, - "How far an axis must be tilted to result in a button press." + "必须把摇杆推到多大幅度才算按下按键。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, @@ -2374,15 +2373,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, - "Allow cores to set rotation. When disabled, rotation requests are ignored. Useful for setups where one manually rotates the screen." + "允许核心自行设置屏幕旋转角度,若关闭,旋转请求将被忽略。需要旋转显示器的用户请设置此选项。" ) MSG_HASH( MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, - "Some cores might have a shutdown feature. If enabled, it will prevent the core from shutting RetroArch down. Instead, it loads a dummy core." + "某些核心关闭时可能会直接关闭 RetroArch。启用此选项可以避免这种情况发生。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, - "Check if all the required firmware is present before attempting to load content." + "在加载游戏之前,先检查固件或 BIOS 的完整性。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, @@ -2410,7 +2409,7 @@ MSG_HASH( ) MSG_HASH( MSG_DEVICE_NOT_CONFIGURED_FALLBACK, - "not configured, using fallback" + "用户未设置,使用备用设置。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST, @@ -2442,15 +2441,15 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_FRANCHISE, "数据库 - 过滤器 : Franchise") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ESRB_RATING, - "数据库 - 过滤器 : ESRB Rating") + "数据库 - 过滤器 : ESRB 分级") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ELSPA_RATING, - "数据库 - 过滤器 : ELSPA Rating") + "数据库 - 过滤器 : ELSPA 分级") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PEGI_RATING, - "数据库 - 过滤器 : PEGI Rating") + "数据库 - 过滤器 : PEGI 分级") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_CERO_RATING, - "数据库 - 过滤器 : CERO Rating") + "数据库 - 过滤器 : CERO 分级") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_BBFC_RATING, - "数据库 - 过滤器 : BBFC Rating") + "数据库 - 过滤器 : BBFC 分级") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_MAX_USERS, "数据库 - 过滤器 : 最大用户数") MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_MONTH, @@ -2516,25 +2515,25 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, "Bokeh") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, - "Refresh Room List") + "刷新房间列表") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME, - "Nickname: %s") + "昵称:%s") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, - "Nickname (lan): %s") + "昵称(局域网):%s") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, "Compatible content found") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, - "Cuts off a few pixels around the edges of the image customarily left blank by developers which sometimes also contain garbage pixels.") + "不显示图像周围可能存在的黑边。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, - "Adds a slight blur to the image to take the edge off of the hard pixel edges. This option has very little impact on performance.") + "轻微模糊像素点边缘以减少像素颗粒感。对运行速度影响很小。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "Apply a CPU-powered video filter. NOTE: Might come at a high performance cost. Some video filters might only work for cores that use 32bit or 16bit color.") + "加载一个由 CPU 控制的视频过滤器。注意:这可能显著降低游戏运行速度。某些视频过滤器仅对32位色(或16位色)核心生效。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, - "Input the username of your Retro Achievements account.") + "输入您的 Retro 成就账号的用户名。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, - "Input the password of your Retro Achievements account.") + "输入您的 Retro 成就账号的密码。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, - "Input your user name here. This will be used for netplay sessions, among other things.") + "在这里输入您的昵称,用于联网和一些其他服务。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_LIST, @@ -2544,36 +2543,36 @@ MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, "Show network interface(s) and associated IP addresses.") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, - "Show information specific to the device.") + "显示此设备的信息。") MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, - "Quit the program.") + "退出程序。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, - "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") + "设置视窗的宽度,0 表示尽可能地放大。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, - "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") + "设置视窗的高度,0 表示尽可能地放大。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution.") + "设置全屏模式的分辨率宽度,0 表示使用桌面分辨率。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution") + "设置全屏模式的分辨率高度,0 表示使用桌面分辨率。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, - "Specify custom X axis position for onscreen text.") + "设置屏显文字的 X 坐标。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, - "Specify custom Y axis position for onscreen text.") + "设置屏显文字的 Y 坐标。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, - "Specify the font size in points.") + "设置字体大小(单位:像素)。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, - "Hide the overlay while inside the menu, and show it again when exiting the menu.") + "在菜单中隐藏图层,退出菜单后重新显示。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, - "Scanned content will appear here." + "扫描到的游戏内容将在此处显示。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, - "Only scales video in integer steps. The base size depends on system-reported geometry and aspect ratio. If 'Force Aspect' is not set, X/Y will be integer scaled independently." + "只放大整数倍显示。基础分辨率与游戏、宽高比有关。如果「保持宽高比」选项未开启,不保证宽高放大倍数相同。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, - "Screenshots output of GPU shaded material if available." + "使用 GPU 输出来进行截图(如果可能的话)。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ROTATION, @@ -2585,39 +2584,38 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, - "Start in fullscreen. Can be changed at runtime." + "以全屏模式开始。运行时可以切换到窗口模式。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, - "If fullscreen, prefer using a windowed fullscreen mode." + "使用无边框全屏模式来替代普通的全屏模式。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD, - "Records output of GPU shaded material if available." + "使用 GPU 输出来进行录像(如果可能的话)。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX, - "When making a savestate, save state index is automatically increased before it is saved. When loading content, the index will be set to the highest existing index." - ) + "每次储存即时存档时,都在新的栏位储存,以避免覆盖原有的即时存档。每次运行游戏时,都会定位到最新的即时存档栏位。") MSG_HASH( MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE, - "Block Save RAM from being overwritten when loading save states. Might potentially lead to buggy games." + "读取即时存档时不覆盖游戏存档。可能会导致某些游戏产生 BUG。" ) MSG_HASH( MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO, - "The maximum rate at which content will be run when using fast forward (e.g., 5.0x for 60 fps content = 300 fps cap). If set to 0.0x, fastforward ratio is unlimited (no FPS cap)." + "快进时最多以几倍速运行。设置为 0 代表不限速。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, - "When in slow motion, content will slow down by the factor specified/set." + "减速时最少以几分之一速度运行。" ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, - "Enable rewinding. This will take a performance hit when playing." + "启用回溯倒带功能。对游戏运行速度有一定影响。" ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, - "When rewinding a defined number of frames, you can rewind several frames at a time, increasing the rewind speed." + "每次回溯时回退的帧数。数值越高,回溯越快。" ) MSG_HASH( MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, @@ -2629,19 +2627,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, - "Automatically makes a savestate at the end of RetroArch's runtime. RetroArch will automatically load this savestate if 'Auto Load State' is enabled." + "在 RetroArch 关闭时自动保存即时存档。如果开启了「自动加载即时存档」功能,下次开始游戏时会加载该存档。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_LOAD, - "Automatically load the auto save state on startup." + "开始游戏时,自动加载最新的即时存档。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_THUMBNAIL_ENABLE, - "Show thumbnails of save states inside the menu." + "在菜单中显示即时存档缩略图。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUTOSAVE_INTERVAL, - "Autosaves the non-volatile Save RAM at a regular interval. This is disabled by default unless set otherwise. The interval is measured in seconds. A value of 0 disables autosave." + "每隔一段时间(单位:秒)自动保存游戏存档,此选项默认关闭(0 表示关闭)。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, @@ -2649,31 +2647,31 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, - "Enable input auto-detection. Will attempt to autoconfigure joypads, Plug-and-Play style." + "启用自动配置按键。RetroArch 将尝试自动配置手柄按键和即插即用模式。" ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, - "Swap buttons for OK/Cancel. Disabled is the Japanese button orientation, enabled is the western orientation." + "交换确认键和取消键的键位,默认(关闭)为日版键位,开启则为美版键位。" ) MSG_HASH( MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO, - "If disabled, the content will keep running in the background when RetroArch's menu is toggled." + "如果关闭此选项,打开菜单时游戏仍会后台运行。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_DRIVER, - "Video driver to use." + "使用的视频驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_DRIVER, - "Audio driver to use." + "使用的音频驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_DRIVER, - "Input driver to use. Depending on the video driver, it might force a different input driver." + "使用的输入驱动。不同的视频驱动可能需要使用不同的输入驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_JOYPAD_DRIVER, - "Joypad driver to use." + "使用的手柄驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_DRIVER, @@ -2681,39 +2679,39 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CAMERA_DRIVER, - "Camera driver to use." + "使用的摄像头驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_LOCATION_DRIVER, - "Location driver to use." + "使用的定位(GPS)驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_DRIVER, - "Menu driver to use." + "使用的菜单驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_RECORD_DRIVER, - "Record driver to use." + "使用的录像驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_MIDI_DRIVER, - "MIDI driver to use." + "使用的 MIDI 驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_WIFI_DRIVER, - "WiFi driver to use." + "使用的 WiFi 驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, - "Filter files being shown in filebrowser by supported extensions." + "在文件管理器中,只显示当前核心支持的游戏(根据扩展名)。" ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_WALLPAPER, - "Select an image to set as menu wallpaper." + "选择一张图片来将它设为菜单壁纸。" ) MSG_HASH( MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPER, - "Dynamically load a new wallpaper depending on context." + "根据核心或游戏的不同,使用不同的壁纸。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_DEVICE, @@ -2725,23 +2723,23 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_OUTPUT_RATE, - "Audio output sample rate." + "音频输出的采样率。" ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_OPACITY, - "Opacity of all UI elements of the overlay." + "图层的 UI 透明度。" ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_SCALE, - "Scale of all UI elements of the overlay." + "图层的 UI 缩放倍数。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE, - "Enable the overlay." + "开启此图层。" ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_PRESET, - "Select an overlay from the file browser." + "从文件管理器中选择图层。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, @@ -2789,27 +2787,27 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_STDIN_CMD_ENABLE, - "Enable stdin command interface." + "启用标准命令行输入。" ) MSG_HASH( MENU_ENUM_SUBLABEL_MOUSE_ENABLE, - "Enable mouse controls inside the menu." + "允许在菜单中使用鼠标输入。" ) MSG_HASH( MENU_ENUM_SUBLABEL_POINTER_ENABLE, - "Enable touch controls inside the menu." + "允许在菜单中使用触摸屏输入。" ) MSG_HASH( MENU_ENUM_SUBLABEL_THUMBNAILS, - "Type of thumbnail to display." + "缩略图的显示类型。" ) MSG_HASH( MENU_ENUM_SUBLABEL_TIMEDATE_ENABLE, - "Shows current date and/or time inside the menu." + "在菜单中显示当前的日期和时间。" ) MSG_HASH( MENU_ENUM_SUBLABEL_BATTERY_LEVEL_ENABLE, - "Shows current battery level inside the menu." + "在菜单中显示电量。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND, @@ -2817,12 +2815,12 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, - "Enables netplay in host (server) mode." + "启用联机游戏(服务器模式)。" ) MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, - "Enables netplay in client mode.") + "启用联机游戏(客户端模式)。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, - "Disconnects an active Netplay connection.") + "断开当前网络连接。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, "Scans a directory for compatible files and add them to the collection.") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_FILE, @@ -2831,17 +2829,17 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, "Uses a custom swap interval for Vsync. Set this to effectively halve monitor refresh rate." ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, - "Sort save files in folders named after the core used." + "在游戏存档的文件名前面加上核心名称来进行排序。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, - "Sort save states in folders named after the core used." + "在即时存档的文件名前面加上核心名称来进行排序。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, "URL to core updater directory on the Libretro buildbot.") MSG_HASH(MENU_ENUM_SUBLABEL_BUILDBOT_ASSETS_URL, "URL to assets updater directory on the Libretro buildbot.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, - "After downloading, automatically extract files contained in the downloaded archives." + "下载后自动解压。" ) MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, "Scan for new rooms.") @@ -2850,9 +2848,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DELETE_ENTRY, MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION, "View more information about the content.") MSG_HASH(MENU_ENUM_SUBLABEL_RUN, - "Start the content.") + "开始游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS, - "Adjusts filebrowser settings.") + "调整文件管理器设置。") MSG_HASH( MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE, "Enable customized controls by default at startup." @@ -2898,7 +2896,7 @@ MSG_HASH( "Manages currently configured accounts." ) MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_REWIND, - "Manages rewind settings.") + "调整游戏回溯功能设置。") MSG_HASH(MENU_ENUM_SUBLABEL_RESTART_CONTENT, "重新开始游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, @@ -2908,23 +2906,23 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, "保存一个独立配置文件,该配置对此游戏生效。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, - "Set up cheat codes.") + "设置金手指。") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_OPTIONS, - "Set up shaders to visually augment the image.") + "设置图像渲染器。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS, "更改当前游戏的键位设置。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_OPTIONS, "更改当前游戏的核心选项设置。") MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, - "Show advanced settings for power users (hidden by default).") + "为高级用户显示更多设置项(默认关闭)。") MSG_HASH(MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, "Perform tasks on a separate thread.") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, - "Allow the user to remove entries from collections.") + "允许用户从收藏夹中删除游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, - "Sets the System directory. Cores can query for this directory to load BIOSes, system-specific configs, etc.") + "设置系统文件夹。固件和 BIOS 存放在这里。") MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_BROWSER_DIRECTORY, - "Sets start directory for the filebrowser.") + "设置文件管理器的起始文件夹。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_DIR, "Usually set by developers who bundle libretro/RetroArch apps to point to assets." @@ -3237,29 +3235,29 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, - "Show Options") + "显示「核心选项」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, - "Show/hide the 'Options' option.") + "显示或隐藏「核心选项」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CONTROLS, - "Show Controls") + "显示「键位设置」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS, - "Show/hide the 'Controls' option.") + "显示或隐藏「键位设置」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS, - "Show Cheats") + "显示「金手指」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS, - "Show/hide the 'Cheats' option.") + "显示或隐藏「金手指」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS, - "显示渲染器") + "显示「渲染器」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS, "显示或隐藏「渲染器」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, - "显示保存核心独立配置") + "显示「保存核心独立配置」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, - "显示或隐藏「核心独立配置」选项。") + "显示或隐藏「保存核心独立配置」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, - "显示保存游戏独立配置") + "显示「保存游戏独立配置」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, - "显示或隐藏「游戏独立配置」选项。") + "显示或隐藏「保存游戏独立配置」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, "Show Information") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, @@ -3515,13 +3513,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, "Title of Stream") MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, - "Split Joy-Con" + "拆下 Joy-Con" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, - "Reset To Defaults" + "恢复默认设置" ) MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, - "Reset the current configuration to default values." + "将当前配置文件的所有设置恢复为默认。" ) From 57db04b389958bdd575bd4907eda2115313177ff Mon Sep 17 00:00:00 2001 From: natinusala Date: Mon, 8 Oct 2018 14:34:12 +0200 Subject: [PATCH 0267/1292] switch_input: add pointer capabilities --- input/drivers/switch_input.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/input/drivers/switch_input.c b/input/drivers/switch_input.c index 50e669faa6..26cfd510d5 100644 --- a/input/drivers/switch_input.c +++ b/input/drivers/switch_input.c @@ -159,7 +159,13 @@ static uint64_t switch_input_get_capabilities(void *data) { (void) data; - return (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG); + uint64_t caps = (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG); + +#ifdef HAVE_LIBNX + caps |= (1 << RETRO_DEVICE_POINTER); +#endif + + return caps; } static const input_device_driver_t *switch_input_get_joypad_driver(void *data) From 509ecab3fe75f286881270a5d4c1ba4d3e75ba66 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 8 Oct 2018 15:38:25 +0200 Subject: [PATCH 0268/1292] Should hopefully fix Reicast issues --- gfx/drivers/gl.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 66f45482d5..80fdd822d9 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1780,26 +1780,32 @@ static void *gl_init(const video_info_t *video, hwr = video_driver_get_hw_context(); - if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + if (hwr) { - gfx_ctx_flags_t flags; + hwr->version_major = gl->version_major; + hwr->version_minor = gl->version_minor; - gl_query_core_context_set(true); - gl->core_context_in_use = true; - - /** - * Ensure that the rest of the frontend knows we have a core context - */ - flags.flags = 0; - BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); - - video_context_driver_set_flags(&flags); - - RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); - if (!gl_check_capability(GL_CAPS_VAO)) + if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) { - RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); - goto error; + gfx_ctx_flags_t flags; + + gl_query_core_context_set(true); + gl->core_context_in_use = true; + + /** + * Ensure that the rest of the frontend knows we have a core context + */ + flags.flags = 0; + BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); + + video_context_driver_set_flags(&flags); + + RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); + if (!gl_check_capability(GL_CAPS_VAO)) + { + RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); + goto error; + } } } @@ -1813,7 +1819,7 @@ static void *gl_init(const video_info_t *video, if (gl->renderchain_driver->restore_default_state) gl->renderchain_driver->restore_default_state(gl, gl->renderchain_data); - if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) if (gl->renderchain_driver->new_vao) gl->renderchain_driver->new_vao(gl, gl->renderchain_data); @@ -1823,7 +1829,7 @@ static void *gl_init(const video_info_t *video, gl->hw_render_use = false; gl->has_fbo = gl_check_capability(GL_CAPS_FBO); - if (gl->has_fbo && hwr->context_type != RETRO_HW_CONTEXT_NONE) + if (gl->has_fbo && hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE) gl->hw_render_use = true; if (!resolve_extensions(gl, ctx_driver->ident, video)) @@ -1855,7 +1861,7 @@ static void *gl_init(const video_info_t *video, RARCH_LOG("[GL]: Using resolution %ux%u\n", temp_width, temp_height); - gl->vertex_ptr = hwr->bottom_left_origin + gl->vertex_ptr = (hwr && hwr->bottom_left_origin) ? vertexes : vertexes_flipped; /* Better pipelining with GPU due to synchronous glSubTexImage. From 508e5efdd772fce232affc884f2bc759eb00fab8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 8 Oct 2018 18:54:26 +0200 Subject: [PATCH 0269/1292] Revert "Should hopefully fix Reicast issues" This reverts commit 509ecab3fe75f286881270a5d4c1ba4d3e75ba66. --- gfx/drivers/gl.c | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 80fdd822d9..66f45482d5 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1780,32 +1780,26 @@ static void *gl_init(const video_info_t *video, hwr = video_driver_get_hw_context(); - if (hwr) + if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) { - hwr->version_major = gl->version_major; - hwr->version_minor = gl->version_minor; + gfx_ctx_flags_t flags; - if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + gl_query_core_context_set(true); + gl->core_context_in_use = true; + + /** + * Ensure that the rest of the frontend knows we have a core context + */ + flags.flags = 0; + BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); + + video_context_driver_set_flags(&flags); + + RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); + if (!gl_check_capability(GL_CAPS_VAO)) { - gfx_ctx_flags_t flags; - - gl_query_core_context_set(true); - gl->core_context_in_use = true; - - /** - * Ensure that the rest of the frontend knows we have a core context - */ - flags.flags = 0; - BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); - - video_context_driver_set_flags(&flags); - - RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); - if (!gl_check_capability(GL_CAPS_VAO)) - { - RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); - goto error; - } + RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); + goto error; } } @@ -1819,7 +1813,7 @@ static void *gl_init(const video_info_t *video, if (gl->renderchain_driver->restore_default_state) gl->renderchain_driver->restore_default_state(gl, gl->renderchain_data); - if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) if (gl->renderchain_driver->new_vao) gl->renderchain_driver->new_vao(gl, gl->renderchain_data); @@ -1829,7 +1823,7 @@ static void *gl_init(const video_info_t *video, gl->hw_render_use = false; gl->has_fbo = gl_check_capability(GL_CAPS_FBO); - if (gl->has_fbo && hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE) + if (gl->has_fbo && hwr->context_type != RETRO_HW_CONTEXT_NONE) gl->hw_render_use = true; if (!resolve_extensions(gl, ctx_driver->ident, video)) @@ -1861,7 +1855,7 @@ static void *gl_init(const video_info_t *video, RARCH_LOG("[GL]: Using resolution %ux%u\n", temp_width, temp_height); - gl->vertex_ptr = (hwr && hwr->bottom_left_origin) + gl->vertex_ptr = hwr->bottom_left_origin ? vertexes : vertexes_flipped; /* Better pipelining with GPU due to synchronous glSubTexImage. From 2ef314e27da30e9067cacecf883ea030560ae419 Mon Sep 17 00:00:00 2001 From: Alfrix Date: Mon, 8 Oct 2018 16:39:04 -0300 Subject: [PATCH 0270/1292] Update PS3 icon --- pkg/ps3/SSNE10000/ICON0.PNG | Bin 19467 -> 20179 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/pkg/ps3/SSNE10000/ICON0.PNG b/pkg/ps3/SSNE10000/ICON0.PNG index 56a1bf78558ccf3de52db6d539b6b754c25b7ba8..4a1fc52964aa07e4d609a5fff48e4e2c9c81e38a 100644 GIT binary patch literal 20179 zcmeI4c{r5o`@r8ZvSo=jvJWZ8GWKP%n;43+6q02yF$9=!VgUev z%>aco1ptT^C_iLk0Dp)26f=TPz=MGHm-6ry z*$DDi93;lu5s&pGU~wKo@%nyW?w&sqd3b+k2U3LlqdnoW(lYSh zIXOB0@bUD)yRBcElOr7ChH=Mu5WGP@+28tky5I;nZx`IZr2H}buZh7qF*5p*`?uHY z?*7}<-h}MoyvcrEN6w=jQUsXbTEwCO=I6rT3HTbVC zKj-^rGz=0=z-WN$QAJ8tMoLD-TviDotAHTO@(39jiXa=7zr--YIblx({4RzPLQ$47 z28HFXF~It9LKD#crzn)R6mgs!5hrkXcQio*>yCEDz&$;j)!;vs6qY|$6+##1hQouG zh0%~#ga1xV;kCZf5C$IJ1hj`E#sH}SDx|SkCxnWVoUAGujgfM|V3ees-7k(d!V6j40jz5gLhe^dVQv_s~xNVQ32Xe}q1S$AX;>?M7ikzWV<( z#c#s=BNYnk4X)1siggRF-t}H)hVlBl_OAgq?0Qe~MB}|N={Z(>5n%IvXMfO>* zTm;&Y+|4u`$pwLNQiK0Z`}4AXcz$=o{(mQMBR+-uzvu9C!Fc>{1+@`s-Rj?ic;ikG z{LpxewllaU{x7w@5%uqGzlK+Xle@ng_U{w1q5b>({Iz2LIiG6eriK950(f2M^*NAL zga1SKGxLVMC3#NWeAeyd zHH8GjN-L(NI!Ulvh-P|Em7g<1p4A<7SD(f)(sdUYGK6;GL~I{W|hnPphAv zvdT)7o)jbBJvXL{;*q{Sn;Tki!vOA8;6FAif1l_d#qeJie%{i5IWT27S`tbcRAm}2 zs)#5JXt*e8P?c%8s3M{?py8sVK~<*VqKb&pfQE~b2347ciz*^Y0~#($8dPN(E~wg#z@H>Bg;FtT%81CtUUkns-M41`^ zK;Uiw2tN$~izM*x5CHhd0Kl+403eb9U?(oo?u8xz?AUF9)He6;_;w@6bNi9hy2|?( zUAed}`JGi^ck^}B3Z5j2a_^2QlXKbfkk6#%*vU_cIxHr|Crx-5U0sjvb3uy;=Q&7pvT$Ufo+LA`;&;D8i*ye*at*{ zC0CZ6EKF4LOh57Ejsq+saF|@2$)a{l?v8{V2OMV35+@i91wRWdTi8P(PuZ%977Ggt zKhF%c=*1}q&bX+=WxX2W4wt)Y4i$kCQQCHHp)jo;-z{TkL$RxPu2a z71RloPdwYK=fHUmd8e%Gm|unf=ha3Q;i1F+@k4*0SC?k>&Nq7TeJI45Ws5Bs?yCE; zyR*ve<6|Q^Ik}h`htZCr{GN%u5~uH&O_txzI=er52aovE>(}`*b8_zLPek?R%`T00 zSK2YKa@&hCMDK*hDX!(^!%$`0?H?1L_6}PN4JTq-?(v9M-O`ORw6U>~Z2E8-t1##7 zV_TW7AKyUa6p4um2?!`9`1%glu7wl(9>P!vrE0-*FWWsXdrkEjh)YT;m=e#NIWzS} zx%*DJzRZ>OywXyu^XJdU#4Ki*q~FQRG*JE;3&X2QMBMS-D*0}EU-fCm-O9@CDD5kk zE}>jqvvP%+h%bwT1xB)veT5%i6c-g4SXo__9r{ug0WHh-*qKnD4LlQD7#+39b?bU+ zb;(qZrQp#c)4;$$Le%mxWGLS=SpjjFU5O0=hs%3?Rle>ex5Qni=V#gS36*v-)69z` zy4Bd+W2u3|;vz53DaNO9ooNylD9$kL3Z{I?rJ-^xXi7TLPUKB9I1b@ia5wXwYV@%9dm4`!E+9655X zS4FS3u%yKD*s;Rmtzpuz=gC8nB|EcyIjYOb5IhPlThvcY#@@x*R)PQygoLQi&xzD% zeQD%Muq`(1$ajp&-?#1AFy~Cm$bd?mTX%(e8+X_9*J7e;bhfv$GLB>&mcGQ-9zl6oS;_e$0&H^ikv{`0$PL-&&SBC>`~L{*PXMBtAsv$m6%_;sj8_{<5MAa z>sa}`?eP-N>X+4RIo4580)b!!t^uDlr5bL?8)kO%Jcv$##2EbPqac3wafg~&{kDVx z@!;gw>1T6$O*>;=9X&WIOk7Yu)n;a9Ci3CKhuYfy1bqSK9vQ+pRO+n`%WKa@R77Ar zO3GFB;_Nd%XLB9(gbJQ!9k^$F<7D>xC^p_5uRggd`uO( z_GItUHaq=u^{JSpfyMLN=DN)QcAll&Ozl>ASOU|72M=UUw(b?__5%yyb+Rn<&6_t7 zywUgWiILyjH@+b^6#`a~-jO5QVF{?i{nBQttDNC2;!oMr)ob$!7cQdnOova!p8mGy zc@#$-c<-|IRR9=mX3*sIb=9q-qoWZ#ryoC7BELxsUCK-tfA!|g3$mS?^r|g+m1}|7c9jB#R~KVPZuoUoKMk0UStWkn zU0zkcaIqZLtq|6jx$1n!y5^Ra zmT_obe?Pj0$mttc!OoS1<|&Z`mq#u*x|tWCyWiU)oLCJ&Zz;l$?c}zu3szPXF&99QrcTvZ$5eQ@ipXLnKWtM zKZgYN&CQYY5#>SiOShnHqL%5*e|C1phAhtoefp3xY<3SefvI+jL6&rogl`MuWYsk%_S#%ZD?p9KwS+< zPwI_G@;>~L{;^^f@{ohFKFKb)6VA@PXL&s)mJrfVnXY>b+&(8eJ37wKcZYSqhWv5d zdHg;k_*=hRMSeb~ejFbflc43fFo9N3Q1CAgUJ)0+V2@22Y@Ha2> ztn1DoZqBpG44YpA)tOP`H)Mkyy8O-Q45-!kEz7sq2Rm8Gx+|dW33$~kMxZ+ACi|cb z^v;?-3IHWzQ|q3QR1(@y`Bh^h``xvql$7Wf(L3*FbK3?E?Y_RxFV04oCFwYxSs>_J z{w4mf&N3gBkd75-``ot=r%SyD^p;%`iGAXCj~VeXRM~Wg6=Y|#T3J~Qe*30?=P&N` zwJwbJ*pa|`*E|m%@m8HwTv*upUfxpiIM{QJr;)79&HL(o`@x1K9+EM<-Qsw)d#{Zx zl#%@)*6n;oz?BT%TPp;b2NnAW zq_ZD$ch3=AvMU1TeXR3|m7=H(p$cm|5`J%&Ju8268bii3>FT4{nh6q*D$$sfzIrB- zE%u&zy{o1@>%NrCk-dj%Ig($qURcxAp<`GLAKQs@T68rfwMd2?s&-t>yLC(W@=|vi zKuAtTLQAe;aF-4Ng**$XOyRDp8jD~rNC#(ML_dyTt+5s#@qC4|`{a!7ZK>0WuO>=L zGoW9;el4@9gXHnrw-!A%Af@TaGd)@JD>i-5ST(ga4g}YxVlD+3W^%CAhzVAmGnYDT z^G!xCl*z= zN&v6@TU2P(nzB|G=>RJHOGveW5_wtC3l4{C9$&6I@L;ymF8U=4G^*b7iHDLFm#@QM zxLq{y9NQ+?pIuKgpw}Kgclop{Y1YWIOTH6GH%#4BZrD&7eg|UA-Q2WOg(Czlt`#XLJfUlQ_A2fxeOT}NlmR& z%C&1@sn7f220Kl!j_jOgobgu`oDZpektvKGfDsLIqp!cru=#i?(uk`)RC|hWt^Uok&z)?&kLo#$oH?o z-Gr?F#OF(V%QejM#X5B*@De(&PdoVvAWQiqL4XfIV2WbrcR0b-1HE_DBlBKaSw{}! zO5ODJ3;tKCQkO|g!lFD&L3W;MAkt$UV4*Mx*Eieo%cL?4F0NLByKC0fa=7J3V6}vl zv_)r0H*9Qk+^on;`opB@i(xwwPC&cmBXzOY!?+T{6eiRI_zVkbO5px#3LpFGPKKKZ zUe#Z1l284-#qt#wd&CWJs6?k7aKwhUf{Bl|2=X@?n5BB>34$rEYn@Q zMv#l#$tCcGeMnI=WFuM^SOJZhLoBERh=06L&NQAkFDLrwyOobK}lBKyL6 zM`B{$JUJX5rcUloOw5}=IqqY}0*p*XTf~;X*~^;OE)u+TQJ0!5C}KU*0#Tpwsmg}K z_Q}EUt7ZLg;FEWgda|PH(VL97Gc%c8+p^JmTe$WdQk$ed%ONN*=t@Mw%HkyezLzUm zVaWc;Izf(L8N0AmpA!ng%rag*$WMOVA?S*lOyKCgvH{ZBGvFgfE}hvRT%mal$Cbd! zSVdo=Mp9-g1awe=ZLcvv?Y^>p9Jh;$ixyZS^4BiVXJlpRIyySOhZn$R*gWUQI$xjA zQP~_*+j@nyIR!MM|m+SZHgwh?-y$UUd!M4de1(KF)n2Tp2(*#aWZXj_wa~z$Y~8SWMW;U6(egPrI<~e69eZo z*qXuOA>YB>kl!Rr`ggR8B|bS&M#q+%lhd>VNnsfzv1%W@bJ`(N@;1S>{7=c1~1}$i&X-q z>i2}4tABQ8^K&Iaae;0?H(+sgw>7xGA3bpE$kC%`-5-Au2RCf^I)1+et`tSrwn*$? zs$@)N7oRtqGZk$Xm40tuv*C%vz92*W7*V>c~iQ6=h-GAST zTtET&=Gb%akt%f**3UslbHe)L)%&3zODyl1$%?+qze5BSu7bTh7EQS1*1 zi9bJn92qiTmevdGLl$4Z^pu@}4 zO`3uud9(5{@BO^2Z}E~(I*VKd&z|Y1g5{IV)0Pv%ou5z4W`HVw!Xsw98!Nr-QKe)C$KEK;{_wLSh)@GeX_K6g0yW-Z5M|KYW12_B(4;_k^J_|nG;&~Ju zbic4}OW<&ySn3}bcm-~U3HR}a$hA}x@7R79POLBQQ}7gZKwCRPN}xI(*(awLd*_io z3^sLz&9)LH3VZkNT}O&B(g~5iL;haz;B|(gqN2phmod@$6Goi%POYd1=lgft_#QoS zWU&W4k-4_##s;)7i|p__F4)4>w=_Evat?c4pxT04Ht{?xKriX?^89!b1j?{rx|e*M zKO$O*so{znmnehS6uKn9^WQW!Ub%Mdn&o83HBOPx9d#ive6I=8?$QWXHc>Pm=MXp}(Q-Fpq&!c=~D}-PiawluzpCzA+ZpXD| zn7nOmy(1CBz*&0TgjQ$pM6U*S zYT>$`en?WM*Nzu5FoBT4yG<+!SCp^X+PB6GRN)BFwN|r3i#x&s>CdH|OT$LDbA%sE z(@<|?{Tw#LHZ95_w-oG`D-qt%VAwqsE}-3G(PP~^Df!IQg_lT)(@iZ11IoBwK6`KsF+PKmiK^y;T-JRQL7(D}In z)k6+r!X@_Ablp>t0@@C+%$&)kh@j<7!gkpobhm(DLd6P>*lLcA?o57~e}Y3B43~JY zhm~`&TxwlgvhtS}W$*el^mA9J_8Z}iB%;+dMYSVQ3v+Wpu_gsdN!jn$1FCFo+m$C+ zQf$XPRex}>3sJUiMye11~+Lg7TRiV{?Zlt z<+bjpz^N-=(Sz!zj9*?HyAOo&KD;_sV3_&Gl&U_9cAx+plzaQlmNj~-`xi_5u~}pn1&ASV8bWo>xl$ShJde?!CanuYS9#4k}d^TCx<=B{P3^3O8QH10;UE zc>9c9_Gw{Qk?=_fVpIUov@qny1ff#I7B+=1FF6Qq%Y{tXp{JS7o@ADUeE?YKd^>I! zX7;*m#+LF`@M$&s&SMW7`b6$#FpLb`CoHP&r2>91tE8pFWFWtW16;gHFSiEYG$#Ms OIfMP+C#pL3r~U_`YqMbh literal 19467 zcmb5WcRbboA3uD^9vMlJ5JH)ktZXu(%YUGeyw-D^cs(5rS}Im51Oh>;d0W*0fgn+R9qWcY3slNr>pXR3hHJxtcbe>N@Pjh6_ZxbV#q8 zqAsG+rC(*;T>tF(`ljC@+hqqPSrHLG9cDgjMpQ3yzt{a|C65_M?drb zqj~UgBPr+L4?#{iS7+iRqbg*E$!TLO?y7b*A>=PN2Lng&Qq2K5Ir%jla;n+w)5fHVN0gMiIoi%n2Olv`bYidqq_1dmcv0*K&aytFkgO z;}Y`n+PtI8A!|=K4t4YQf0eZBmm2B`XW6olx!~L=UQWy&*EcO6o#2~SB)aCLb>8Ya zW~+13chZILc862NsN^sI`)9f`KW|1yLc9>VGp4a0V;bR4mW;n$R>qs~#qOVX{=w*t z?(Xg?j5zI9P}`L#SbDLOC=KSN4^6j=Q@jha(tYt;1@zPF(%UOziS6y}D4l$Tque`L z!fn2ej<>J2c_fujnkXDj(VZNBNxa~>wP5t2s_K?L)33#?*yj=!li1+3-RU{%{F58n z7#lO@Pd4%jRM#`87Pf-A%Wy7xuGSlF%!(*a z8=N2BU!{OPt(T{{rKKFUBu=G3?{=pB9i}f{qAZ5Y7cSI)`lOt*Nx{&G%kzJ zFEp<>IA;G|`K7S?Du3_d!sGh~**iHMdpXpv?vnB8yzcbwmye5yAr%x6k;<&-qkCEL zp=0rAsY8tBOsuV5sUd74JmG`X+tGar@0`Q|C8iM)Sl>i8 zRD~!_-4D;vH?Fw_;^qP;rO&4EOeML8;Q7L~9l|pQeUC6{Jg@xC z4;1(Rz5Ru4->(0ce>|Vh9GHh19c4@AP)r^kHWL&UMsC&}9{aG7r|}fj)uk`b&rbyh z1&!wAu?x{tu#}Z$lb>bt_g zvieJGr=U7UCMK#v z2ssn24@QoICl1E*MB3I?=%{Ia`f`$Oa7g$ zt-hV@?c)gBm!w$Vs;7mfJU5~s&e#Y9!WV9h-cD%^!=&z@a5u?K}3Y75@U8*cGmrMsCdOJq}HTt4&lE^I$aOjb6hWiBuHk&LWt zOn{v5FtRT&PwIL9+!w!)@uE9foC$>@QNMouV)~Jch{Rc;0OedAt^0B?F-@S7ZiQhr`5jy_+jVg$2`}cuhC=~i~nf-gh#XM?_Zvk zra5*t8K3v<;U~w0(9qC+swj_9&(}AY)P(LaseMkN;Iw^E`q67^VTfaUYm1aIKKgI7 z@LZs^Zj+^36NPhjEMczy7Sop=2{Eyajb&^!MK5$Zqb&E1|i$)bYArBi1ow5gfk79^AMJdRh z1dJ_O`>!r7xy;ZVPtqkHt*jnb2Df}%&OaK?uUKf->HG0x8us;Nem)BF$p}}Nxb}mP z5H<`3^D-~bucxP{as}70+GHcT+a1&v)+OFI$DMjR_gMf}M6~vY%E}-sE2}bFmU>e` zUQwEJk63s=ECzMfe#lI;X|s;AWr3VJi zr>3Tx3#Si|lhX}1XQUQ?2O}OE7Z=)*FC{67loJ>Ckz-Cg>Lj$985xOu!Fwh>^MTJ^ zeBSpccV)%xizgd56BVT(I`&!u)nc=7eNf4uua!7Q2VVLtGEyAX#?+y zQG7qt3hUr&rKp?CF`iA&F)7qDI{MmgZSvDSM6``4%fEmBp0lBDRwI$TIgcLGxk)EK z5iqHQV5Epbp`tnK&UJpU`Hw_o&r-HR7XcA@1dC_Jq_8D zQbVm;*I?1~UWy8&4IAncpFCgnRey-N?<&^^#`Gyo_RS!L6Vl)mfH@nif0Rd3rJw@~hC3 zP(&$d>*%c9W10yrD;vK=6=Qv#`FqRwR^|PZNpi*A&-0j)|D>d_^c`A7gPHvh=Z%Y% zEgo?D+2jJMCFSH=|6s8@ubr~J>&=(%!YN+A*sF@5l=@8gqAzQccY=-d8&W<8P;4`OeYG@1l z(;4oPJg?SC zWOW>BWEY2u(o>9jU194W$adV)zI(U&=;-LaV1|~o?*bESsmJz`**lEW$9-jGeWtD{ z(b(A7)1!bp(WoFMR{IN!_5Wa9#UZ6lh_+=(eE7FrhO?!!idgK`-FSQ>oWrbHChZNH zb7b_J5BAJmDfe?oX}Y03o*WNe&D~Gz*rlFZJ%;cZdHZLZ^ej&Obzs( z9QIe~F{${Eq(n;q3NbY z@_axGy1+<$qZSV%LttKt9@BXrE2)9xT;B2s#&}!s{5d|IH#bL%hGb_usWnFT4-WqO@4v{F)pndrz}n>g*RNka zvy1a3v(vW>M{q$U7l>s z&CMQ@okY)4Qe>e&I}O1)n(ps^kn;D+hkn4NIJeGC91yCo*Q=|}4sE`diHQk%0!NUm z7EFXl+JW5+MGN6j9N~vsx^nBE8`Shiht8rOib;p=i$8kwNK{IS9P2w}lJU5n!n!T! zd?7y<3ylhsnjX^^Utiyfhjqh3)TGNiv9?M^M$n-%-nen&G$~I{a~T@BCQgVj#=j{k zA%_9rQ+wzEU?ZX$cDbkmZc{#;etemn~_pU6Q*I`o3JWn68*po zxn75t9uTKZW1%H*%cbeoIktv68dJevPjR*t13GN~tFUli9? z1N(y~n}r3@&W4S+GMC4M`oMO#t+At~{k{J1CK_uGQD z#-Ooq5Ai>7%oZ`t={VR@^&oV(GJop3fUZpnC&fA>Y5z7m72J8H`wzvnZ%O8Sfge|mB`M36jorzIqCNIpv*5AU4a@YS8*8dFu7+@6sUR<9;Y+{#2lw2_gTWDY61mOl&q+BxN*|-}2RqJQT$n8lP z@MW72sfU-B*!#sGf0z~JR=>g+&I)&SS4x}0@cQ}pWeInA&uFHxN+ceIPkbY8O(p+ie6FKOC}he# zOc94HSd@XW^)AMxd{<(kW3lu=MzGS|Zs%;CYYsXKEg9BV*MV$qPVk=lG4;1MT~yl} z{ZSR0BPt^CRR|q57x-^=)dBFH`<(Q8Pd-hOCKM8<@zmhh4hv2vN_Got>z-4b02+Xo z#eripzXfvFq?{SVFWlbAV#d{cbelaGMjq8BALq24EPw3N8EtXOhS`KaL(9f&JDW0$ zd!lLxUuY@ZEv^k$ADSP37%(-_wUqPT7YRQ(;V z+&MWSHxYZKs-c0B&$Q3=W}6F)wH-vb-65h`9&7Qpb9JQ^5D=g(aV{roIr%&zot$ZJ zb~Z-Ej+1^Z>kf`es{*^|#Yz9t)XeM?Txq-$5|ci3;f+P^7<0MbM2<*o%b0L7-X=8k za(Q|Ad&BEjx<$9mGKU1vUVp^3Gw1elSOw>Piy23TkpYVo1p`*;M ze8`zRq8cwP8#MT4nfPn1%fB-myPW|rYnGJ>g@-H3YG`PX102*f<#CgVs-mUR!po`w znY;7b*NTdS_{5^gQoX|X@f{&bVq00ma--8tE;qWK-n)ri+-h8Gj$CdR=@zxu#{9O# z%3nzQ(&|TP1AnE+pupEk7r-&;hymBD5t;T^(|X@6Rqa>^anW>(f9O!_#;gAvy%Vq{S25{k!5L!$mV zM}YJ7RMVG{?@u&fs;{tLJ3MS9d-E`RHmJtbC+d?8x}#+-5W?X!fSIU{%F2qRlM?|9 zzHC9(V1ziYmI`B}M#2}ad%{_`+9#|uWU04#p5NuYg7&(`82_QUGUuL=uf@75O*aWg z*zVLPm4XQ8dM&?j$_AdwMHM5X397rLW!c2^={%+96N>&Ib3LtgUft#yWL`HmIzQue zF>g*yT>H+T_+>vUlabQx$K{Aw!XBrZ{_6Ib+c*XkbCUYe+68VFnpydNG=iTZs#=KX zqpK_v4cQ*-E_~8qc(es`IQQpTL6+FmH%>CMf#XP0J^E-?l&5_%9;{0q}Tt3w0axtEbgU`{4O z{;CwL{f0Fel&X?E_dpjqu|k4}Q#Lj+K_z~%BR8*pMNbuDm^YWmq*kP+FMd?lU-8bk zTtep$w4!ZL^uCCGPj-#|sEyE2S7$-g+Op&>kEjCX0*F?;Dsin~d4V239bEQlWY_)E zLk#ov-5P`bbUj~(=Qza!JuR)%oi!V1ZK(f32k~=jYs=Nl0DvwD9?k1bl`ZNRABgD8 z@Ey2q&h-f)3Uuh&pz9f0S*|#JE37{cd$lX^ZOq3;fZud;iYe9fM+{z={|~-?XK+o5 z?X1Z|vmXe4_lBrfcjYa|?|efp zCzO>fez9BE;{O%Y{avxoK#&=VB&^!ERuGqV^{|ra&0Ju?PRGfSe2hwg5Nd)yAxaSa z6orSYtj^DLo#?AO#Uv~j4vahX>w)BS`O__p#u*`K*=wdMr{M7+D_usq#x)#_7du@S z*ScR)KO~-%u304yXHz%D3MG3)7`)?kP5g`pE6Lz zP$9G`7u{rYJ_8Ci_Tyw^*$8C83<~oiD%lE z=grLo<~1A%PFB3T$*!mW;$^WDWp=UuXSzSkL~|7Z%4#- z+umTIFv64*giUSKTl?|@_qY~#E ztu#Y`uP&U8%QeQnaoRqUiMB7c6!s^6dV>bzr)XnA^1Sf^X)-l&d4?IMHr zlPa1wj@h%wqwwZR@||Uz{~yJcyJDU6)zwBJ+&!76=e8=ALXhLEe5U-fIpKZ(X8Se?* z2w<}i<*!|F_6dc^47b_#gB3hri!DH&jAXRMDmh-rv@b9yeWS;(gx$Ig?>HN%U@n~1 zQ2!!i_LTz-a1D8L75|#ukOJ)0&_m?+cYCs#84bB*7vp1XKWER_!stOKUiY*#b_Q_B+N+bOt!6tx`#uXU1Z>NXKDIQyi7kKN%TpD z7L}Wk$G;%ojHAJV&vAQV=OXMcEw?wNnR#oXvmX10oBhN7980RhC*ybHNg;K-TMQzP zU{TY*g22_P%Jr8!XJ?jT7bl=ZC=M?O{tPpSOKQSel@Fbk09V1OB$FgWP#)jT<|f;9 zCMrn#t~XB>Il=)r+VYToP5vCV`{ivOXWVNVWwXpxGb^i@LVnlYsFw4!g51oBFp4Ut zy}NLJEbto9sHNT*$4j83hO1OEH!SGmRiEGHp-)o3k}xe%AJ=f*c?DZPRu)ovGO%7D z8h))geR<`8NJ^~xX?F2d66L2(+04Y%6=~@--TX{y=dUGv(@Z0YwKbP%$RV6@&h9BI zV}*+aod`l{%7{Cna`D?wNAcFy*3rzXJldF~$QI9IDR-RTxaaFZzX=PYA#1EJ-{D$T zE=y}6e_>tSIf!~_b2Ye9Blr_&ui(mlFFhg}m18)njv5*=0-mJH*9!W9!T@cOC(1BH z1Gq{7NYc|Uc59&)eZDSI4F`{iHqlMQC;Ey3(0V2&CL$s%g&W@P6fMde(#$R{E}k|- zHIz9W;BY$J^{!{gh-)X36GtL@&L9mDDQq{pjIU?B zFLnw(w0~GGr6isF*!1pCM?=8BoDgbxa}DRK{ZEc|>Y&5qr64|JGL`it=3${JEH9^i z@ZiDA*RNIY-{*h<$28OR?&m(^Nm!BPn-Ni(hhi6B%LgMF*p&_TJN_(;*E!IgWtV#j zFn?h~!-X^+3BjgCvq%fG@Z*hPaqYieH-V~{VoiL+m(?9>`v$JNr7%R6O@(nHP=3$L z%7F1}p1+ZcO1@mT(!5w1Rk`>$Z!S00KCpIZr6Qc_@7*`>_q; zf6bMjMZcfSU{4(5=!BT40C44GPQ00V`<)h)DeM*?>Nqhe3GH)d*`!5{OAY;go$w`a zF~*ae;#CR?$*HLf(cM#h%Omd)*{6GSJO3vbDr=5(;MC|^~qlg8jwgH&8O;b0m}|Z-Q80` zd9nrM#c@(3CE^<|XsaM51KG#M#=_D}*W^-+QEqJ`wr0$b*4JA`{(JEMX#v=P3iz`S zeWqI!nuI7$B__3}g%ry4odh}4%uxN7I>E&8acf8?s&Dmgr+pMyUa^SCF4i}xvX-9= zw7!eo(xdKi{^I%iby=AMR6<kpk@aj`U8envuhqmhCbIDTr0(%w-TgBT8s|87iLp^{j>yt@+8j+@t=Ta! zkq}kLjen^XC{9%uT=JPees^Ock|?yj zQevucq{@x;q%{5$Abd{F9Jp!0Ob!V>eeoNSPxrG^wN z$5s{mbUri{02IZE6$BVC*MKNR3FCvGIP^&EOAjNIQYzX6bpKM9$%WVWI?X_zLbEZ| zgEkzy#Y7UgAUilCpjy28ABa;65-no$781KwLWo2>ibw?`sMgYk6u|mzDvo7ThFJS^p&n#J7w#52gZn8X!Mx(zz6l*a@ zlxAd7)ExR%g-Y@j|Dk0=Da+)>@+S=VUN)(;ROV+QMtNe{>RiUFosN(D$ZiqxkLrFr ze*D-JptL(5$=6imY=pC(6!O0=`h8AGnSMG$>*}mK*T?c(b;E*!XcgXc zCz4lg$YVDiPo+8v^Gs50%o{+;WYRqxYKFZ=gd(MA&SZ()SBF9B>BOCjG*}BVDUSNh z3G9Tuo5|px*WD&^PGa=SI!ha_G5n#wJxjj?)lx42`>=+|A0szSboLVkz( zA#$;NSo^+NUDf-H-ztRK{I$Vl%!1@d>);=40jwy^uSH*oxSrQeUqaR^zWT-N?erS#QOJqaqj8Mm2t=n$>#4hz; zs*P%Ox)M3$mK`}V?JwoHw)nEG4C#26_G=Y&0a&YpphO5+ku?;~JxRU&@PpM{_$o=b zzAUd@-NYkrBnz?i3yqo~;(v*pfxDw}35B~F)9*tR6b%KLTOeu8H%+>3{QyF{i2vIs zQ$clSM;8pElg@|X>qMi1QPGb{2i)HpQ@@#5X{TUxJBzM8RDl#AWL9Au%%6||**4R@ z>d)^F^lJZY0+dLw`eMg$%=ps7JM(s(NOi_)3$7*Af10uJrU|FhP7X?U7BZnNi@G7^ zqYlCof;Lk!eth=A3t3rN6dXDXGG@o)e^ob~G}zwUM@5-(i7=P?EkE3M)v=_*xodP( zCY6=7RxWxf(-%5U!GlwRs>L?ewi%a!*wP6aoNpc<H2PmmRIVsm6VixY_-iAC&O`JlUyavkLNmm zl|biPWDq|UBXb3J_G$aDbf=!b|Bh0rA(xIdab)!aVpHKPSR47{dhWB9jhKE508TYcw;p1eyLay%zOrRW!jJ*9HlTCp z{b?_ReFpmQ3gZ@psugzZcjd(Vf4Z#9&n73V(}X7?j*jDzz1d3d9N|eA z@u{@)4<&pi1RsnoJ8-td^yA4KYv(E7l$Awl6>S(N6vBQ!JxPJLW67ISHZo$OBCQrg z8(z;~I(}>IaX<=lduPkU(Mqrs6>~b?{q)(cWucGNDXd@xa{YItlf5zMN%-W-#aM)# zo*;Al|K2Q{)Krl9Naji#uJoK&H}US|6S`V}jNoag1v~9KZ99*|F2abzh|uPw_hVC>cYz4CW%&fiv$npWO4_@e z1oBo}q7T@`R8v98w7y56Akf@611Bc1dwOJ~YWiu2X}SK17aVJ`Bx}b9t0hK8NdU?o z0Sez_nY?+rKR~*lvW88TKzWTQfoz1BzQ*<7JW66>K!iVm>t^yfPb;Z;zEmE1is&(} z{C@77zAoRfN`um0cxfG)P62DO2|X1()sC0NnjaL2BR$X*FjJj_L8-ysOcU$d zjj+}a_(p3M0prDL07|w;D!JhKZ$5g87Oe_n;3d@x^lS``mak`_gKs7$J`#InVu(1f z7wU{-4}#MdIs`Rfw+9 zAo${G`2yeADNsXv-xz^km)6xcRKk2bK>(&0{h3eVs zPRBFSXMx*gB8SJaNTfv9!W<%qw&sq=NmOwSbCt-M@F(P7oFzSzf|tIX_V>iM(|3#| z!h@eF&HQ>qt>6uWCA6^U+K(R6mZebQgW7%|0`xuq^$qo!yAJOu9^}^;8HsnOKZfTl zHFRbw<^9bWxn{RcP4)yhEqDQ8W@CoD5)@|kdv+ljQCX^g?oF=6gNod)Ik zf4DDI2M0bL%?;^fye0O$baJp-JcG3{qNTYR(7ZAxwTi&Joz}(XE7`?Dv9=FmZ2?*M zmy{O4u8m=j=uy)*Y;kdPzeV3h`;(9@g7uZ}7JaW$pj1^=MSd-z&;`dkbA>Wm8xpJG z^%zi;Zf4gXsq?WVme?YMUf$eZ)g|QZ?lIMRyCJM#ZQh*zCA-^u7Z3^d zX4hG0xL)0r0cDSbW|~*!BD0ZE{awr^>`=U_N;=QAxxn#2WqM+ucjWqa2y*$8(mL;) zvWxk@5#;*U<@$%|`LF~z|63GO^_|vk8`|R0zW5>1Ndu-Ccp*HrF{<_EGjjcjh?hVb zz##kZ<2j0){{t$6x`u_7wN^$(#*3!=p%D7IMW%g#h|)c#FS}I%wuBeXjPfTMWkv!W zyah!>dX&SqVVZE|7h`Er-{o`)6Iu@n)u^nin)aI)7wN7G%+ zqd7<%*_ptfkSmB*zZg5^l)VkTCt{cQAHqY5^~V_fHTO%jH5prTZjJ?aFdxr!!h*Kt z`aRiDfJYeuxG>|@bPyaITvBD-HnQdlf%KS`I@A6NS`5&)p`SlJVNSY<5$}Il{7OO_ zL)-~kzCrOmVw-CTc5o_E!p?R3ZNKt5X{k6u9%Fp1f^K?g1!6q?4`I>y@aXWF}F z7e6j`dURgRY&tM(NL;(Vh?oM=aft3%BIXa9lbt9v&Gd!gn6q0n&6edOe}Z+J^$x56 zUh@6kQi2Np>FW)y3@%<@gDw@_-^NftPK*l#j+Z{U`QRI|8?h)!Lh`5$e?Bp!qIo30sGP1UO zK)jeJq>T~3g%R)bWRvSBXceWw`jTu}WT83AbQ%Y`QGL#{fWj)>lvNT&;pp`h9G({^|mU;SN;HG>_Xlx z6DNJYNqZ^;!w}VtjnY9_D}Tzc6%{)oMhXj{bB^q8K~gzS74y#Uy4nQgP8e?duk84G zvOJJc+jQFJD55K%ZGoN~mU;tN)oTfZ-GmUi^xn~J**N&anOa3(q08X&Zejxkg4r=6g~*fpKBMB=mTf`4 zrfKgQ`4eopBC1qibXQ#KJo7W@UHn6zbMS|t%Ts+z)9pii8wjGdvDE|QxlT|uO0++PdP1UqHxe5j}x`<-*8VXO~q0CZ>19%~6_an~nO zMw>upSLIDtF3|f2eFxU_HB+}}!pl7*geODLQMBFdv>oB;G9Uv@EskpSCuu4dyTr9$7GD(8zCp(MS2`K^rEh{>78KCl zyl};__Y-*4^oO7#6*$RMF3K$WUk3rvMsC=({zs8PP09;&UuP$rn44xd-W&%X%-qz* zL>KbEA9B_+^2L%h+*dGUQUi<_aJcN^s%yS~4#z5Y2o-|7IR{@?$xn`5aKJIcRc&Ft z3eE^seN|~TV7WjvXJhu8aM0;%^-Y9yzS-@qJF;vj_$}SXN0F|=67$k$U2w5;f%Iw& z0QiM9X;ur~A)-f+sOs}DPgdM+vu<$3RgyjV0$ZH#2MsIC4f^M5hZ9*`)M z=y!>$;!_&fbISuwD#71aK#}P1KI0;a(rBD_VISo!upmb z8N6ux8MblKrg{5lr-TjV)GF0aFa*^X2o`f6ikShCrIw6$4k*~*(k5ABe(2}-8vt&> zSe1fAcxa#?7HS0@u4-ygMbX2Fj??pX_!MjCzo`39eRTGl_NBrAdFt*e4Vr|)QQjJF zSTjp(&Ba(x{sgbfsC7f5A`z=*ad|m8Hu>=5khj}iZV%ssHt1CN2h%hNvIoY-DgcFI zRMWQyc?J%-oJ4#Np>$wRxz164-`#AAfPS}sG)q09KIYhQS3nS5XlOJ8Qutf7f~bJJ z6k!n&^75gDWNJ>7=X3juaD*)E?CPL6BT){prjM3GjQLuDsBy%TZG<2PVuT)o9K3?? zh1L3bwetnOeGV=|4t@20QqeE`*y8-GvH}a{9cAb#0@eds#{s}fR^`gNRWNWKk@ zsfuv#MYYeJ$IO591)bUNmX;PQ7>|M;nkB~<^4AJN36+PYCA%2PpA`ZGRpaVMb}ss# z#~x?v<(+83U8(&5uWr$2XhN$HMN}XBm{6#O`G{|>Y(pY@6bRpM1Wz2!N_7N+<`|&9 zNohBeOe-d}g12wafR4HmJPM*>Vg_KX3R7UB%6-5x3)>dhPw+w4hEPWizvRzZ>}Yo^ z9E`d<2oDCE+%JZoz7Yhpu zy$f!<#eJf^Lx(s0PNdSC>E_DEX3P(=c^_xmL}Fl|zGDk+;vp~i><c5*e_c}s0-*O~{&fmEo`2I{EqgOzD z2Wf$8u%qMGoZQ@^Q;qiQ_lsbiS`CN-o13Vp=wxEP1PIj!u~;b${a>#ao2jEXE&nYn zG;`x^bY4rRvR}R|57r?rFnj3~8AREeeQs;{OA!G{1W&tV&IIE6YqnJ2wXa_nEA`n z9-IyStK;|BP<_M5P(b0)Ae>4*OZ?7he*uI9bif1HL4zf!eeXSXaXojF{CYwZY_+(` z3+ZHFK>{{<`A#$aLZKwY%AX>}2SsUa-Au-Z;xA3?Vgc=zIyDP`Q$srJP#Sza zDfRXBm(MFE6rS>0l9I7t-g)-y8520Re)QJLJuv$Xvbj86-t?Z_arYA4d?Zj7c_Pe- z6JRU*86d}A>zZR>WtDN%xs?kP-UCn18ipz@eJ1EYp#FIA>E_*KmkW6Q%hwS*dR2RX zHU9@50HpAaQ#~@SH=WOO^PfJOd=OKKPHq=8XvwHoYFrE;-F^@h#0tv&g@J*A7|=+s zT4YKnj9=NqDR@mX(B`J(J+$C1eAU0G%OG{4Q zjMs^SD9fQcDush@SpF$#z~c>*@GX;*nW;FAFf53FJ(m9bcL?^)F7Pn;k8YenXr_tE z$vr#Wgp?F4IT=~y_U7jI#>$pAi~Bd#^o=!Btk8ReId8b5<^XDfILIF53C4jSfNC4= z*#b3RU|ul|R*W~N?#)PBmIZJy1)LmAoJeu(ebpF8LIa<($qb>B(9phBv3iM>b$|8L zZ@7*}dBU>*hsq34ne4F@j2@Gdod1_Yl>sXGF_ey14_F@k7JYUj884Xh?Ai0~4vUum zj0fj8ynY{3D-cEo}S*g+I|2x zB=aH*i!{VvICK}3IOM6d7!*oX){GRzN$b7{)p zxaaFscifKL-rw|{u&wg@M>+jqtl}BE$@)bqK5uS{^YZdi-MV$l0h-O7$Mqv1qnHEEE!AiEPC7V=9*UKMxG1{Y7Mv6> z7n{8R`tWPk^|gvCc1nuN;ZN9&&) zs};E`du(VBi?9yezKj0EQvGwqH{*;rUGk2~b z{GdTVt{(#_;bm^_m%~Fjuqp>G{UuqajO%8(e0l4OE(aT1NSKYy^8K=paobe$ zH6}f9XA|*wd8?D|JvAmd^W#f;~zB3~d-lP@ujKaoZ@5}weFLZ}sA74NndSroZ z6#uLA9%vS2R~u~1;9lb)c#n%UVC!w*ypIM%pP3=%NR>Hb^pU;az9poCNTqUdKZlDU zq41$L=5wyxwdq8gdh?jY<|OS@$W^B^XYi?f!94_Qazd%>z*{os1uc}eOSP{jO_+ho z8617L4mb7=D?{=F|p!`Pc{{g`$yWE`ww*ZT>^ zqAWDPvkw2cIO{L-s~73|zKja%tBer`>mwLJLZGs?gAsyovRb0BbuE4KkAOJu?Q^Z- zbn=^eE^v*U0b=axA_g-Hl)+b40&N%1#$9SU0^MnF8W`80p%JT#odSX~V}fFsXftp}qh@fq*=6lqa;( zAqV+~z4=cwv}UX>1zx69MKtv1K%19J7czNfP7vL7`VbBdp5T`P@?qs$aup{9Ku29* zI6dukI9OSmo1qxu3;BNljdcT&saaJY2fj=&M&~WBtR(MpnO0$gffZ`N&~*U;al_$< zC3lp25GE&VIz9jJZ~kKQaU+lB=bbww9=L&yo#2k02}7e(hc1-#$aFs474t@FZOosJ za79Qf9&3}z4gmoH6;)NM(Sm3V32j+>+;+zCaab*hGk2ttjlGl8{4m&ws`C}l$YmWh zeLuMeehT@h;W~#)SHueWr*CoW4}|CC=ZA}>_r6|QTKaf9g@LGbzUH{&YWT4;6SBvYd~+C261G1n>Ss<3M;Rv|H}?Kd9(eGuOJ*8?Cho& zAZd4iiaid$9^irh?lCIrr_f?5lMCjOB+mJyvhe;RaN;#O1O^6%t&X?x=xwS`+392ePPy#kkXCbxkO-)VRgZi?k5P=8bJ1q(E z-QTy~(R*y^jwA?Oj}!KH#ONz?`WGfC)x?2j~i?5)%rf>nW242{nyJ znVtk(z7zna0GToa!eEtTWk%|?o&d=2ihEzVQ$m)&PAu)W#Byp8#gyp2H66WtMu3IJ z&c%fW%(18b%KyOPdk7DkSLC$M5|N(9V|AqsDGL%MAr>0eG@hSqs2Hd0Wb@3cmtt%1 zU%IWZYNduz5aLYcmoHz=eRX#>^#nm=)R zdz+OrhO8@w6wS=dm&!+ z(Orz3efF%K9J@*HK%0bg;KsvHC^H5{277KGll)@$U#WGKH*l7zV^3K?I{-lgvp zaFU>o=vZ_=*>=|juz|dgKdt5#$r`Du{@ro-R)m{*bEgf2K1j#9;hP?w>#UB?nn|;{ z{oTHF`SSnFuzo&1Y)2mo=E zfz3Qe|J!i(TxY}Ap!Xl%TsP7rb$RxH@2vD0zh@j>0dkoYCWN@*v`=sJ#493-r%Cl9H0`LRo12`~byElc1;j1Gjh>TC`)( zz_*a5G&MDylTb7=0(>u;PRukdy&Jmxh;*&(_)b8^`6#M>e?a)?z2`%0*$#YbO%Y(kx?t_RkY$ z`*K`Sp4N1o}6bmiuv#N zj#U3nF41_iZ{iqyZ-La1^A>h0G|YC^pD~qnQc*1>KAy7CZk~Lk+)+^5{x`(xXj8Xh=>7|UCfpxesHxeFb*v&egRdeX;P-`1Hc&!7M2(9qB<04#Mnop-TVEGl}OGG4uUwSW2YlSHIynl`+%vtt|{ z9DAi*s;4l3_s*R2ZY7wApw()j>$(c(d;kEd`}_MJbX`BF)oPtWp+J!Vo^d*z z4#wkglu{~+qHx!BU0v53sZ>h$eP2gJ!59P1IS3&@2+=jW@CMUfp$5nFC9#GB09a_U zLI{Y(Vvx`0p;D>H@$vD4k&%&irBZ3ub=?KWaaJ@`fZQHKvnuw?p5h7w&Q~!;gj%x}4SZId6?*kEm=Xv1!K6swj4dkk-LMD@ed_E7R zX);aI;<~P9g%BBC*UeU|wGRO8$NkE;EltzbIOnPmqOGcGN>x>z zbB>&I;G9cDB*vJ}7$X26#+VEQNaUwdGPNzo`iNts^nH<)2y<`|hLRD2YSPl~+dPL*{fCK<9n15n`fmrG1 zB6WCU=tA=6NLWr!QC_3jHg9jb?fnH=d|564R{%-?aVHi}22&I$=06drl0C2__ zDvH8lv6z=ir5f36b~BMkyfsbp?~Ji``}_Ml7cN|IA_MFb?%lhmPEAc^ip65VvaDPx zm9kV-)m2qR#+V-%o`;A&BD#Sv!)&l?g2#e1As+R?_wLUG0);Rdd!B~?fB=B1s>(zn z;iXckW~b9>DvI(0V{E5TC`4^;XN<>>A8V77lLa9}-ZV|q^E_P$!4Q$8lrqqj4?V&{ zMEZro2|IclgD~SGBIf%(_kEuek&seyDW!r(!W5dOQ9K@ZW3gD>vaF9pwBx$&Zn<3U z+aeq5XHl-NudBZA$2jMz=Xo3vfr!ZWeP0F;QFruclfJN5L%ruWSYm|7A&7{KF~&Nb zjt>Ct#Kc6@t9izG|NgxI0LAk>5$fbfW+a1*?z6%53;)%wwnB*=`6ptaGvwiVn=w>X z)%QHlX*3$`YPH&qu1Z8iL_|bHL_|bHL_|cyndjeb4&!1^%9>pO0000 Date: Tue, 9 Oct 2018 01:03:29 +0200 Subject: [PATCH 0271/1292] (WIIU) menu_display_wiiu.c should have the same ident name as the video driver --- menu/drivers_display/menu_display_wiiu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/drivers_display/menu_display_wiiu.c b/menu/drivers_display/menu_display_wiiu.c index 9d6ce0794b..42f0c300cf 100644 --- a/menu/drivers_display/menu_display_wiiu.c +++ b/menu/drivers_display/menu_display_wiiu.c @@ -352,7 +352,7 @@ menu_display_ctx_driver_t menu_display_ctx_wiiu = { menu_display_wiiu_get_default_tex_coords, menu_display_wiiu_font_init_first, MENU_VIDEO_DRIVER_WIIU, - "menu_display_wiiu", + "gx2", true, menu_display_wiiu_scissor_begin, menu_display_wiiu_scissor_end From 1bd91193fd5c1497b324c2614e72ce73fe1b6a7e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 01:05:46 +0200 Subject: [PATCH 0272/1292] (Menu) All the ident names should be identical to the video driver ident names --- menu/drivers_display/menu_display_caca.c | 2 +- menu/drivers_display/menu_display_ctr.c | 2 +- menu/drivers_display/menu_display_d3d10.c | 2 +- menu/drivers_display/menu_display_d3d11.c | 2 +- menu/drivers_display/menu_display_d3d12.c | 2 +- menu/drivers_display/menu_display_d3d8.c | 2 +- menu/drivers_display/menu_display_d3d9.c | 2 +- menu/drivers_display/menu_display_gdi.c | 2 +- menu/drivers_display/menu_display_null.c | 2 +- menu/drivers_display/menu_display_sixel.c | 2 +- menu/drivers_display/menu_display_switch.c | 2 +- menu/drivers_display/menu_display_vulkan.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/menu/drivers_display/menu_display_caca.c b/menu/drivers_display/menu_display_caca.c index c880c34b33..f70047878b 100644 --- a/menu/drivers_display/menu_display_caca.c +++ b/menu/drivers_display/menu_display_caca.c @@ -100,7 +100,7 @@ menu_display_ctx_driver_t menu_display_ctx_caca = { menu_display_caca_get_default_tex_coords, menu_display_caca_font_init_first, MENU_VIDEO_DRIVER_CACA, - "menu_display_caca", + "caca", false, NULL, NULL diff --git a/menu/drivers_display/menu_display_ctr.c b/menu/drivers_display/menu_display_ctr.c index 693706e0f7..4ce9adc381 100644 --- a/menu/drivers_display/menu_display_ctr.c +++ b/menu/drivers_display/menu_display_ctr.c @@ -210,7 +210,7 @@ menu_display_ctx_driver_t menu_display_ctx_ctr = { menu_display_ctr_get_default_tex_coords, menu_display_ctr_font_init_first, MENU_VIDEO_DRIVER_CTR, - "menu_display_ctr", + "ctr", true, NULL, NULL diff --git a/menu/drivers_display/menu_display_d3d10.c b/menu/drivers_display/menu_display_d3d10.c index 03a18eecc2..1fcf63f0ca 100644 --- a/menu/drivers_display/menu_display_d3d10.c +++ b/menu/drivers_display/menu_display_d3d10.c @@ -288,7 +288,7 @@ menu_display_ctx_driver_t menu_display_ctx_d3d10 = { menu_display_d3d10_get_default_tex_coords, menu_display_d3d10_font_init_first, MENU_VIDEO_DRIVER_DIRECT3D10, - "menu_display_d3d10", + "d3d10", true, NULL, NULL diff --git a/menu/drivers_display/menu_display_d3d11.c b/menu/drivers_display/menu_display_d3d11.c index 95369fe9cb..8d8ceb5f2d 100644 --- a/menu/drivers_display/menu_display_d3d11.c +++ b/menu/drivers_display/menu_display_d3d11.c @@ -287,7 +287,7 @@ menu_display_ctx_driver_t menu_display_ctx_d3d11 = { menu_display_d3d11_get_default_tex_coords, menu_display_d3d11_font_init_first, MENU_VIDEO_DRIVER_DIRECT3D11, - "menu_display_d3d11", + "d3d11", true, NULL, NULL diff --git a/menu/drivers_display/menu_display_d3d12.c b/menu/drivers_display/menu_display_d3d12.c index 7225089c56..75c0650e75 100644 --- a/menu/drivers_display/menu_display_d3d12.c +++ b/menu/drivers_display/menu_display_d3d12.c @@ -308,7 +308,7 @@ menu_display_ctx_driver_t menu_display_ctx_d3d12 = { menu_display_d3d12_get_default_tex_coords, menu_display_d3d12_font_init_first, MENU_VIDEO_DRIVER_DIRECT3D12, - "menu_display_d3d12", + "d3d12", true, NULL, NULL diff --git a/menu/drivers_display/menu_display_d3d8.c b/menu/drivers_display/menu_display_d3d8.c index a18907f443..c2268c5111 100644 --- a/menu/drivers_display/menu_display_d3d8.c +++ b/menu/drivers_display/menu_display_d3d8.c @@ -285,7 +285,7 @@ menu_display_ctx_driver_t menu_display_ctx_d3d8 = { menu_display_d3d8_get_default_tex_coords, menu_display_d3d8_font_init_first, MENU_VIDEO_DRIVER_DIRECT3D8, - "menu_display_d3d8", + "d3d8", false, NULL, NULL diff --git a/menu/drivers_display/menu_display_d3d9.c b/menu/drivers_display/menu_display_d3d9.c index e6e3aa7b76..4fe2155e61 100644 --- a/menu/drivers_display/menu_display_d3d9.c +++ b/menu/drivers_display/menu_display_d3d9.c @@ -322,7 +322,7 @@ menu_display_ctx_driver_t menu_display_ctx_d3d9 = { menu_display_d3d9_get_default_tex_coords, menu_display_d3d9_font_init_first, MENU_VIDEO_DRIVER_DIRECT3D9, - "menu_display_d3d9", + "d3d9", false, NULL, NULL diff --git a/menu/drivers_display/menu_display_gdi.c b/menu/drivers_display/menu_display_gdi.c index 95e41b7b28..5fa746fb06 100644 --- a/menu/drivers_display/menu_display_gdi.c +++ b/menu/drivers_display/menu_display_gdi.c @@ -109,7 +109,7 @@ menu_display_ctx_driver_t menu_display_ctx_gdi = { menu_display_gdi_get_default_tex_coords, menu_display_gdi_font_init_first, MENU_VIDEO_DRIVER_GDI, - "menu_display_gdi", + "gdi", false, NULL, NULL diff --git a/menu/drivers_display/menu_display_null.c b/menu/drivers_display/menu_display_null.c index 8bda4a3eef..e8e3ad8faa 100644 --- a/menu/drivers_display/menu_display_null.c +++ b/menu/drivers_display/menu_display_null.c @@ -95,7 +95,7 @@ menu_display_ctx_driver_t menu_display_ctx_null = { menu_display_null_get_default_tex_coords, menu_display_null_font_init_first, MENU_VIDEO_DRIVER_GENERIC, - "menu_display_null", + "null", false, NULL, NULL diff --git a/menu/drivers_display/menu_display_sixel.c b/menu/drivers_display/menu_display_sixel.c index 734b36e972..023365b048 100644 --- a/menu/drivers_display/menu_display_sixel.c +++ b/menu/drivers_display/menu_display_sixel.c @@ -102,7 +102,7 @@ menu_display_ctx_driver_t menu_display_ctx_sixel = { menu_display_sixel_get_default_tex_coords, menu_display_sixel_font_init_first, MENU_VIDEO_DRIVER_SIXEL, - "menu_display_sixel", + "sixel", false, NULL, NULL diff --git a/menu/drivers_display/menu_display_switch.c b/menu/drivers_display/menu_display_switch.c index b2fb6ca805..8c21577eac 100644 --- a/menu/drivers_display/menu_display_switch.c +++ b/menu/drivers_display/menu_display_switch.c @@ -99,7 +99,7 @@ menu_display_ctx_driver_t menu_display_ctx_switch = { menu_display_switch_get_default_tex_coords, menu_display_switch_font_init_first, MENU_VIDEO_DRIVER_SWITCH, - "menu_display_switch", + "switch", false, NULL, NULL diff --git a/menu/drivers_display/menu_display_vulkan.c b/menu/drivers_display/menu_display_vulkan.c index dd060dd2a1..261037aa2c 100644 --- a/menu/drivers_display/menu_display_vulkan.c +++ b/menu/drivers_display/menu_display_vulkan.c @@ -386,7 +386,7 @@ menu_display_ctx_driver_t menu_display_ctx_vulkan = { menu_display_vk_get_default_tex_coords, menu_display_vk_font_init_first, MENU_VIDEO_DRIVER_VULKAN, - "menu_display_vulkan", + "vulkan", false, menu_display_vk_scissor_begin, menu_display_vk_scissor_end From 4468671cef1fe0948465b28ebfb5e78ebda26cd8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 01:15:47 +0200 Subject: [PATCH 0273/1292] Go back to this version by radius - the other one didn't work --- configuration.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/configuration.c b/configuration.c index 654f193923..4759929212 100644 --- a/configuration.c +++ b/configuration.c @@ -2352,8 +2352,17 @@ static bool check_menu_driver_compatibility(void) string_is_equal(menu_driver, "null")) return true; - if (menu_display_driver_exists(video_driver)) - return true; + /* TODO/FIXME - maintenance hazard */ + if (string_is_equal(video_driver, "d3d9") || + string_is_equal(video_driver, "d3d10") || + string_is_equal(video_driver, "d3d11") || + string_is_equal(video_driver, "d3d12") || + string_is_equal(video_driver, "gl") || + string_is_equal(video_driver, "gx2") || + string_is_equal(video_driver, "vulkan") || + string_is_equal(video_driver, "metal") || + string_is_equal(video_driver, "vita")) + return true; return false; } From 6cf0f1b08c4847773d028cb789dec2cee3e26efd Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Tue, 9 Oct 2018 01:27:20 +0200 Subject: [PATCH 0274/1292] Update CHANGES.md --- CHANGES.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 81ecc3dc6d..6f3b4b4f55 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ # 1.7.6 (future) -- MIDI: Add a Linux ALSA driver for MIDI. +- MIDI: Add a Linux ALSA driver for MIDI. +- LOCALIZATION: Update German translation. - LOCALIZATION: Update Italian translation. +- LOCALIZATION: Update Simplified Chinese translation. - LOCALIZATION: Update Japanese translation. - SCANNER: Fix GDI disc scanning. - SWITCH/LIBNX: Improve touch scaling calculation. From dc36691f2c6930fa9502151d3539cf0ee3e22d46 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Tue, 9 Oct 2018 01:31:30 +0200 Subject: [PATCH 0275/1292] Update CHANGES.md --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 6f3b4b4f55..6aaebd3bde 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ # 1.7.6 (future) -- MIDI: Add a Linux ALSA driver for MIDI. +- DATE: Add Date / Time style options. +- MIDI: Add a Linux ALSA driver for MIDI. - LOCALIZATION: Update German translation. - LOCALIZATION: Update Italian translation. - LOCALIZATION: Update Simplified Chinese translation. From 521b978d3105e9c8a70517a4e076282e009977ed Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 03:43:34 +0200 Subject: [PATCH 0276/1292] Add sthread_create_with_priority - missing functionality from desmume rthreads implementation --- libretro-common/include/rthreads/rthreads.h | 17 ++++++ libretro-common/rthreads/rthreads.c | 64 ++++++++++++++++----- 2 files changed, 68 insertions(+), 13 deletions(-) diff --git a/libretro-common/include/rthreads/rthreads.h b/libretro-common/include/rthreads/rthreads.h index 6e248f3d94..93fc16195d 100644 --- a/libretro-common/include/rthreads/rthreads.h +++ b/libretro-common/include/rthreads/rthreads.h @@ -52,6 +52,23 @@ typedef unsigned sthread_tls_t; */ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata); +/** + * sthread_create_with_priority: + * @start_routine : thread entry callback function + * @userdata : pointer to userdata that will be made + * available in thread entry callback function + * @thread_priority : thread priority hint value from [1-100] + * + * Create a new thread. It is possible for the caller to give a hint + * for the thread's priority from [1-100]. Any passed in @thread_priority + * values that are outside of this range will cause sthread_create() to + * create a new thread using the operating system's default thread + * priority. + * + * Returns: pointer to new thread if successful, otherwise NULL. + */ +sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userdata, int thread_priority); + /** * sthread_detach: * @thread : pointer to thread object diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index b8f04f106c..ec3ff012bd 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -161,7 +161,31 @@ static void *thread_wrap(void *data_) */ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata) { + return sthread_create_with_priority(thread_func, userdata, 0); +} + +/** + * sthread_create_with_priority: + * @start_routine : thread entry callback function + * @userdata : pointer to userdata that will be made + * available in thread entry callback function + * @thread_priority : thread priority hint value from [1-100] + * + * Create a new thread. It is possible for the caller to give a hint + * for the thread's priority from [1-100]. Any passed in @thread_priority + * values that are outside of this range will cause sthread_create() to + * create a new thread using the operating system's default thread + * priority. + * + * Returns: pointer to new thread if successful, otherwise NULL. + */ +sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userdata, int thread_priority) +{ +#ifndef USE_WIN32_THREADS + pthread_attr_t thread_attr; +#endif bool thread_created = false; + bool thread_attr_needed = false; struct thread_data *data = NULL; sthread_t *thread = (sthread_t*)calloc(1, sizeof(*thread)); @@ -172,27 +196,41 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata) if (!data) goto error; - data->func = thread_func; - data->userdata = userdata; + data->func = thread_func; + data->userdata = userdata; #ifdef USE_WIN32_THREADS - thread->thread = CreateThread(NULL, 0, thread_wrap, data, 0, &thread->id); - thread_created = !!thread->thread; + thread->thread = CreateThread(NULL, 0, thread_wrap, data, 0, &thread->id); + thread_created = !!thread->thread; #else -#if defined(VITA) - pthread_attr_t thread_attr; pthread_attr_init(&thread_attr); + + if ( (thread_priority >= 1) && (thread_priority <= 100) ) + { + struct sched_param sp; + memset(&sp, 0, sizeof(struct sched_param)); + sp.sched_priority = thread_priority; + pthread_attr_setschedpolicy(&thread_attr, SCHED_RR); + pthread_attr_setschedparam(&thread_attr, &sp); + + thread_attr_needed = true; + } + +#if defined(VITA) pthread_attr_setstacksize(&thread_attr , 0x10000 ); - thread_created = pthread_create(&thread->id, &thread_attr, thread_wrap, data) == 0; -#else - thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0; -#endif + thread_attr_needed = true; #endif - if (!thread_created) - goto error; + if (thread_attr_needed) + thread_created = pthread_create(&thread->id, &thread_attr, thread_wrap, data) == 0; + else + thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0; - return thread; + pthread_attr_destroy(&thread_attr); +#endif + + if (thread_created) + return thread; error: if (data) From 0d699208d37edc8b29cebcf9ce779f897b371c06 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 03:55:34 +0200 Subject: [PATCH 0277/1292] Update rthreads --- libretro-common/rthreads/rthreads.c | 17 ++++++++++++-- libretro-common/rthreads/switch_pthread.h | 27 +++++++++++------------ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index ec3ff012bd..5d651dd003 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -27,6 +27,7 @@ #endif #include +#include #include #include @@ -164,6 +165,11 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata) return sthread_create_with_priority(thread_func, userdata, 0); } +/* TODO/FIXME - this needs to be implemented for Switch */ +#if !defined(SWITCH) && !defined(USE_WIN32_THREADS) +#define HAVE_THREAD_ATTR +#endif + /** * sthread_create_with_priority: * @start_routine : thread entry callback function @@ -181,11 +187,11 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata) */ sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userdata, int thread_priority) { -#ifndef USE_WIN32_THREADS +#ifdef HAVE_THREAD_ATTR pthread_attr_t thread_attr; + bool thread_attr_needed = false; #endif bool thread_created = false; - bool thread_attr_needed = false; struct thread_data *data = NULL; sthread_t *thread = (sthread_t*)calloc(1, sizeof(*thread)); @@ -203,6 +209,8 @@ sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userda thread->thread = CreateThread(NULL, 0, thread_wrap, data, 0, &thread->id); thread_created = !!thread->thread; #else + +#ifdef HAVE_THREAD_ATTR pthread_attr_init(&thread_attr); if ( (thread_priority >= 1) && (thread_priority <= 100) ) @@ -215,18 +223,23 @@ sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userda thread_attr_needed = true; } +#endif #if defined(VITA) pthread_attr_setstacksize(&thread_attr , 0x10000 ); thread_attr_needed = true; #endif +#ifdef HAVE_THREAD_ATTR if (thread_attr_needed) thread_created = pthread_create(&thread->id, &thread_attr, thread_wrap, data) == 0; else +#endif thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0; +#ifdef HAVE_THREAD_ATTR pthread_attr_destroy(&thread_attr); +#endif #endif if (thread_created) diff --git a/libretro-common/rthreads/switch_pthread.h b/libretro-common/rthreads/switch_pthread.h index a9ea9be1a3..0fa582b299 100644 --- a/libretro-common/rthreads/switch_pthread.h +++ b/libretro-common/rthreads/switch_pthread.h @@ -28,30 +28,29 @@ #include #include -#include "../include/retro_inline.h" -#include "../../verbosity.h" +#include -#define THREADVARS_MAGIC 0x21545624 // !TV$ +#define THREADVARS_MAGIC 0x21545624 /* !TV$ */ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); void pthread_exit(void *retval); -// This structure is exactly 0x20 bytes, if more is needed modify getThreadVars() below +/* This structure is exactly 0x20 bytes, if more is needed modify getThreadVars() below */ typedef struct { - // Magic value used to check if the struct is initialized + /* Magic value used to check if the struct is initialized */ u32 magic; - // Thread handle, for mutexes + /* Thread handle, for mutexes */ Handle handle; - // Pointer to the current thread (if exists) + /* Pointer to the current thread (if exists) */ Thread *thread_ptr; - // Pointer to this thread's newlib state + /* Pointer to this thread's newlib state */ struct _reent *reent; - // Pointer to this thread's thread-local segment - void *tls_tp; // !! Offset needs to be TLS+0x1F8 for __aarch64_read_tp !! + /* Pointer to this thread's thread-local segment */ + void *tls_tp; /* !! Offset needs to be TLS+0x1F8 for __aarch64_read_tp !! */ } ThreadVars; static INLINE ThreadVars *getThreadVars(void) @@ -77,9 +76,9 @@ static INLINE int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutex return 0; } -INLINE int pthread_mutex_destroy(pthread_mutex_t *mutex) +static INLINE int pthread_mutex_destroy(pthread_mutex_t *mutex) { - // Nothing + /* Nothing */ *mutex = 0; return 0; @@ -101,7 +100,7 @@ static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex) INLINE int pthread_detach(pthread_t thread) { (void)thread; - // Nothing for now + /* Nothing for now */ return 0; } @@ -154,7 +153,7 @@ static INLINE int pthread_cond_broadcast(pthread_cond_t *cond) INLINE int pthread_cond_destroy(pthread_cond_t *cond) { - // Nothing + /* Nothing */ return 0; } From 262634739cd3f190ff8ff08ed014dfbe2e195754 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 8 Oct 2018 23:29:17 -0400 Subject: [PATCH 0278/1292] xmb: increase sublabel size limit to handle longer strings (especially CJK languages) --- menu/drivers/xmb.c | 2 +- menu/widgets/menu_entry.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 7cfa999fcf..7b273e72d0 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2748,7 +2748,7 @@ static int xmb_draw_item( if (i == current && width > 320 && height > 240 && !string_is_empty(entry->sublabel)) { - char entry_sublabel[255] = {0}; + char entry_sublabel[512] = {0}; label_offset = - xmb->margins_label_top; diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index a5e83ab32f..276c37139e 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -364,7 +364,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (cbs->action_sublabel) { - char tmp[255]; + char tmp[512]; tmp[0] = '\0'; cbs->action_sublabel(list, From a49253cb6eb0f6a319a5770692bdd956e6185e9e Mon Sep 17 00:00:00 2001 From: waitingmoon Date: Tue, 9 Oct 2018 12:30:01 +0900 Subject: [PATCH 0279/1292] Update JP translation (#7371) * Update JP translation * Update msg_hash_ja.h --- intl/msg_hash_ja.h | 184 +++++++++++++++++++++++---------------------- 1 file changed, 96 insertions(+), 88 deletions(-) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index a7a9d19081..cd9030d9ce 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -96,11 +96,11 @@ MSG_HASH( ) MSG_HASH( MSG_NETPLAY_ENDIAN_DEPENDENT, - "This core does not support inter-architecture netplay between these systems" + "このコアはこれらのシステム間のアーキテクチャ間ネットプレイに対応していません" ) MSG_HASH( MSG_NETPLAY_PLATFORM_DEPENDENT, - "This core does not support inter-architecture netplay" + "このコアはアーキテクチャ間ネットプレイに対応していません" ) MSG_HASH( MSG_NETPLAY_ENTER_PASSWORD, @@ -156,7 +156,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_LATENCY_SETTINGS, - "ビデオやオーディオ、入力遅延に関係する設定を変更します。" + "ビデオやオーディオ、入力の遅延に関係する設定を変更します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, @@ -715,9 +715,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_SHOW, "フレームレートを表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, - "フレームの減速度") + "フレーム制御") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS, - "フレームの減速度") + "フレーム制御") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, "Frontend Counters") MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS, @@ -1103,7 +1103,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DRIVER, "メニューのドライバ") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE, - "メニューのフレームレートを減速") + "メニューのフレームレートを制限") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, "設定") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, @@ -1894,17 +1894,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SWAP_INTERVAL, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_TAB, "ビデオ") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, - "スレッドされているビデオ") + "ビデオをスレッド化") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER, "非フリッカー") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "カスタムのビューポートの縦幅") + "カスタムビューポートの縦幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "カスタムのビューポートの横幅") + "カスタムビューポートの横幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, - "カスタムのビューポートのX") + "カスタムビューポートのX位置") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, - "カスタムのビューポートのY") + "カスタムビューポートのY位置") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, "Set VI Screen Width") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, @@ -1912,13 +1912,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, "ウィンドウフルスクリーンモード") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, - "ウィンドウの幅") + "ウィンドウの横幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, - "ウィンドウの縦") + "ウィンドウの縦幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_X, - "フルスクリーンの幅") + "フルスクリーンの横幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y, - "フルスクリーンの縦") + "フルスクリーンの縦幅") +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, + "非ウィンドウフルスクリーンモードの横幅サイズを指定します。0を指定すると、デスクトップ解像度を使用します。" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, + "非ウィンドウフルスクリーンモードの縦幅サイズを指定します。0を指定すると、デスクトップ解像度を使用します。" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, "Wi-Fiのドライバ") MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, @@ -1984,7 +1992,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR, "メニューの倍率") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, - "アイコンの影を有効") + "アイコンに影を表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY, "履歴タブを表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD, @@ -2012,7 +2020,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YES, MSG_HASH(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO, "シェーダーのプリセット") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, - "実績を有効または無効にする。詳細については、http://retroachievements.orgを参照。") + "実績を有効または無効にします。詳細については、http://retroachievements.orgを参照してください。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, "非公式実績/ベータ機能をテスト目的で有効または無効にする。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, @@ -2090,7 +2098,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SSH_ENABLE, MSG_HASH(MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, "システムのスクリーンセーバーをアクティブになることを予防する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, - "Sets the window size relative to the core viewport size. Alternatively you can set a window width and height below for a fixed window size") + "コアのビューポートサイズを基準にしたウィンドウサイズを指定します。横幅と縦幅が一定の固定ウィンドウサイズを指定することもできます(下の項目)。") MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE, "インタフェースの言語を変更する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, @@ -2140,7 +2148,7 @@ MSG_HASH(MSG_AUTOSAVE_FAILED, MSG_HASH(MSG_AUTO_SAVE_STATE_TO, "自動ステートセーブ to") MSG_HASH(MSG_BLOCKING_SRAM_OVERWRITE, - "Blocking SRAM Overwrite") + "SRAMの上書きをブロックしています") MSG_HASH(MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, "Bringing up command interface on port") MSG_HASH(MSG_BYTES, @@ -2166,9 +2174,9 @@ MSG_HASH(MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, MSG_HASH(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, "コア設定ファイルの作成に成功しました") MSG_HASH(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, - "Could not find any next driver") + "次のドライバを見つけることができませんでした") MSG_HASH(MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM, - "Could not find compatible system.") + "対応システムを見つけることができませんでした") MSG_HASH(MSG_COULD_NOT_FIND_VALID_DATA_TRACK, "有効なデータトラックを見つけることができませんでした") MSG_HASH(MSG_COULD_NOT_OPEN_DATA_TRACK, @@ -2176,9 +2184,9 @@ MSG_HASH(MSG_COULD_NOT_OPEN_DATA_TRACK, MSG_HASH(MSG_COULD_NOT_READ_CONTENT_FILE, "コンテンツファイルを読み込むことができませんでした") MSG_HASH(MSG_COULD_NOT_READ_MOVIE_HEADER, - "Could not read movie header.") + "動画ヘッダーを読み込むことができませんでした") MSG_HASH(MSG_COULD_NOT_READ_STATE_FROM_MOVIE, - "Could not read state from movie.") + "動画から状態を読み込むことができませんでした") MSG_HASH(MSG_CRC32_CHECKSUM_MISMATCH, "CRC32 checksum mismatch between content file and saved content checksum in replay file header) replay highly likely to desync on playback.") MSG_HASH(MSG_CUSTOM_TIMING_GIVEN, @@ -2188,7 +2196,7 @@ MSG_HASH(MSG_DECOMPRESSION_ALREADY_IN_PROGRESS, MSG_HASH(MSG_DECOMPRESSION_FAILED, "解凍に失敗しました") MSG_HASH(MSG_DETECTED_VIEWPORT_OF, - "Detected viewport of") + "ビューポートを検出しました of") MSG_HASH(MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, "有効なコンテンツパッチが見つかりませんでした") MSG_HASH(MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, @@ -2286,7 +2294,7 @@ MSG_HASH(MSG_FAILED_TO_SEND_SRAM_DATA_TO_CLIENT, MSG_HASH(MSG_FAILED_TO_START_AUDIO_DRIVER, "オーディオドライバーの開始に失敗しました。オーディオなしで続行します") MSG_HASH(MSG_FAILED_TO_START_MOVIE_RECORD, - "映像の録画の開始に失敗しました") + "動画の録画の開始に失敗しました") MSG_HASH(MSG_FAILED_TO_START_RECORDING, "録画の開始に失敗しました") MSG_HASH(MSG_FAILED_TO_TAKE_SCREENSHOT, @@ -2374,9 +2382,9 @@ MSG_HASH(MSG_MOVIE_FILE_IS_NOT_A_VALID_BSV1_FILE, MSG_HASH(MSG_MOVIE_FORMAT_DIFFERENT_SERIALIZER_VERSION, "Movie format seems to have a different serializer version. Will most likely fail.") MSG_HASH(MSG_MOVIE_PLAYBACK_ENDED, - "Movie playback ended.") + "動画の再生を終了しました") MSG_HASH(MSG_MOVIE_RECORD_STOPPED, - "Stopping movie record.") + "動画の録画を停止しました") MSG_HASH(MSG_NETPLAY_FAILED, "ネットプレイの初期化に失敗しました") MSG_HASH(MSG_NO_CONTENT_STARTING_DUMMY_CORE, @@ -2386,7 +2394,7 @@ MSG_HASH(MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET, MSG_HASH(MSG_NO_STATE_HAS_BEEN_LOADED_YET, "ステートはまだロードされていません") MSG_HASH(MSG_OVERRIDES_ERROR_SAVING, - "Error saving overrides.") + "優先ファイルの保存でエラーが発生しました") MSG_HASH(MSG_OVERRIDES_SAVED_SUCCESSFULLY, "優先ファイルを保存しました") MSG_HASH(MSG_PAUSED, @@ -2394,7 +2402,7 @@ MSG_HASH(MSG_PAUSED, MSG_HASH(MSG_PROGRAM, "RetroArch") MSG_HASH(MSG_READING_FIRST_DATA_TRACK, - "Reading first data track...") + "最初のデータトラックを読み込んでいます...") MSG_HASH(MSG_RECEIVED, "received") MSG_HASH(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, @@ -2402,11 +2410,11 @@ MSG_HASH(MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, MSG_HASH(MSG_RECORDING_TO, "Recording to") MSG_HASH(MSG_REDIRECTING_CHEATFILE_TO, - "Redirecting cheat file to") + "チートファイルの出力先を変更しています to") MSG_HASH(MSG_REDIRECTING_SAVEFILE_TO, - "Redirecting save file to") + "セーブファイルの出力先を変更しています to") MSG_HASH(MSG_REDIRECTING_SAVESTATE_TO, - "Redirecting savestate to") + "ステートセーブの出力先を変更しています to") MSG_HASH(MSG_REMAP_FILE_SAVED_SUCCESSFULLY, "リマップファイルを保存しました") MSG_HASH(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY, @@ -2420,7 +2428,7 @@ MSG_HASH(MSG_RESET, MSG_HASH(MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, "Restarting recording due to driver reinit.") MSG_HASH(MSG_RESTORED_OLD_SAVE_STATE, - "Restored old save state.") + "以前のステートセーブを復元しました") MSG_HASH(MSG_RESTORING_DEFAULT_SHADER_PRESET_TO, "Shaders: restoring default shader preset to") MSG_HASH(MSG_REVERTING_SAVEFILE_DIRECTORY_TO, @@ -2539,15 +2547,15 @@ MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_SYNC, "オーディオを同期する。推奨。") MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, - "How far an axis must be tilted to result in a button press." + "入力を確定するために要するスティックの傾き量です。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, - "Amount of seconds to wait until proceeding to the next bind." + "次のバインドに移るまでの待機秒数です。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_BIND_HOLD, - "Amount of seconds to hold an input to bind it." + "入力をバインドするために要するホールド秒数です。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, @@ -2559,19 +2567,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_VSYNC, - "Synchronizes the output video of the graphics card to the refresh rate of the screen. Recommended." + "グラフィックカードから出力されるビデオと画面のリフレッシュレートを同期します(推奨)。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, - "Allow cores to set rotation. When disabled, rotation requests are ignored. Useful for setups where one manually rotates the screen." + "コアに回転を許可します。無効にすると、回転リクエストは無視されます。手動で画面を回転したいときに便利です。" ) MSG_HASH( MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, - "Some cores might have a shutdown feature. If enabled, it will prevent the core from shutting RetroArch down. Instead, it loads a dummy core." + "一部のコアはシャットダウン機能を有している場合があります。有効にすると、コアがRetroArchをシャットダウンすることを防止し、代わりにダミーのコアをロードします。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, - "Check if all the required firmware is present before attempting to load content." + "コンテンツをロードする前に必要なファームウェアがすべて存在するかどうかを確認します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, @@ -2715,11 +2723,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, "対応するコンテンツが見つかりました") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, - "Cuts off a few pixels around the edges of the image that were customarily left blank by developers and sometimes contain garbage pixels.") + "開発者によって慣例的に空白にされていたイメージの端にあるいくつかのピクセルを切り取ります。 不正確なピクセルを含むこともあります。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, - "Add a slight blur to the image to take the edge off of the hard pixel edges. This option has very little impact on performance.") + "画像にわずかなぼかしを加えて、ピクセルのエッジを柔らかくします。このオプションは、パフォーマンスにはほとんど影響しません。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "Apply a CPU-powered video filter. NOTE: Might come at a high performance cost. Some video filters might only work for cores that use 32bit or 16bit color.") + "CPUベースのビデオフィルターを適用します。備考: パフォーマンスを多く消費するかもしれません。一部のビデオフィルターは、32bitまたは16bitカラーを使用するコアでのみ動作する可能性があります。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, "RetroAchievementsアカウントのユーザー名") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, @@ -2739,9 +2747,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "アプリを終了する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, - "ディスプレイのカスタムビデオ横幅を指定します。ゼロを指定すると可能な限りウィンドウをスケールします。") + "ディスプレイのカスタムビデオ横幅を指定します。0を指定すると可能な限りウィンドウをスケールします。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, - "ディスプレイのカスタムビデオ縦幅を指定します。ゼロを指定すると可能な限りウィンドウをスケールします。") + "ディスプレイのカスタムビデオ縦幅を指定します。0を指定すると可能な限りウィンドウをスケールします。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "OSDのカスタムX軸を指定する。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -2756,7 +2764,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, - "Only scales video in integer steps. The base size depends on system-reported geometry and aspect ratio. If 'Force Aspect' is not set, X/Y will be integer scaled independently." + "ビデオのスケールを整数に限定します。基礎サイズはシステムによって報告されたジオメトリとアスペクト比に依存します。「強制アスペクト比」が指定されていない場合、横幅と縦幅はそれぞれ独立して整数でスケールされます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, @@ -2764,11 +2772,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ROTATION, - "Forces a certain rotation of the screen. The rotation is added to rotations which the core sets." + "指定した角度で画面を強制的に回転させます。この回転はコアが指定する回転に追加されます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FORCE_SRGB_DISABLE, - "Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows have video problems with sRGB FBO support if this is enabled. Enabling this can work around it." + "sRGB FBOの対応を強制的に無効にします。sRGB FBOの対応が有効になっている一部のWindows用Intel Open GLドライバはビデオ問題を有します。この機能を有効にすることで問題を回避できます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, @@ -2792,11 +2800,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO, - "The maximum rate at which content will be run when using fast forward (E.g. 5x for 60 fps content => 300 fps cap). If this is set at 0x, then fastforward ratio is unlimited (no FPS cap)." + "早送り中のコンテンツの最大フレームレートです。例えば、60FPSコンテンツに5xを指定すると、最大フレームレートは300FPSになります。0xを指定した場合は無制限になります(フレームレート制限なし)。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, - "When slowmotion, content will slow down by a factor." + "スローモーション時、コンテンツは設定した比率に応じて減速します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, @@ -2808,11 +2816,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, - "Sets log level for cores. If a log level issued by a core is below this value, it is ignored." + "コアのログレベルを設定します。コアによって発行されたログレベルがこの値を下回る場合、無視されます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_PERFCNT_ENABLE, - "Enable performance counters for RetroArch (and cores)." + "RetroArch(およびコア)のパフォーマンスカウンターを有効にします。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, @@ -2932,15 +2940,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, - "The address of the host to connect to." + "ホストのIPアドレス" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT, - "The port of the host IP address. Can be either a TCP or UDP port." + "ホストのIPアドレスのポート番号(TCPまたはUDPポート)" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_PASSWORD, - "The password for connecting to the netplay host. Used only in host mode." + "ネットプレイのホストに接続するためのパスワードです。ホストモードでのみ使用されます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, @@ -2948,7 +2956,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, - "The password for connecting to the netplay host with only spectator privileges. Used only in host mode." + "観戦者のみに適用されるネットプレイのホストに接続するためのパスワードです。ホストモードでのみ使用されます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_STATELESS_MODE, @@ -2992,34 +3000,34 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, - "ネットプレイをホスト(サーバー)モードで有効にする。" + "ネットプレイをホスト(サーバー)モードで有効にします。" ) MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, - "ネットプレイをクライアントモードで有効にする。") + "ネットプレイをクライアントモードで有効にします。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, "アクティブなネットプレイ接続を切断する。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, - "フォルダの対応ファイルをスキャンしてコレクションに追加する。") + "対応ファイルをフォルダからスキャンしてコレクションに追加します。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_FILE, - "対応ファイルをスキャンしてコレクションに追加する。") + "対応ファイルをスキャンしてコレクションに追加します。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, "Uses a custom swap interval for Vsync. Set this to effectively halve monitor refresh rate." ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, - "使用したコアの名前に基づいてフォルダーのステートセーブを分類する。" + "使用したコアの名前に基づいてセーブファイルをフォルダごとに分類します。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, - "使用したコアの名前に基づいてフォルダーのステートセーブを分類する。" + "使用したコアの名前に基づいてステートセーブをフォルダごとに分類します。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, "URL to core updater directory on the Libretro buildbot.") MSG_HASH(MENU_ENUM_SUBLABEL_BUILDBOT_ASSETS_URL, "URL to assets updater directory on the Libretro buildbot.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, - "After downloading, automatically extract archives that the downloads are contained inside." + "ダウンロード後、ダウンロードしたコンテンツが含まれるアーカイブを自動的に展開します。" ) MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, - "新しいネットプレイルームをスキャンする。") + "新しいネットプレイルームをスキャンします。") MSG_HASH(MENU_ENUM_SUBLABEL_DELETE_ENTRY, "このエントリーをコレクションから削除する。") MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION, @@ -3045,7 +3053,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DATABASE_MANAGER, MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_MANAGER, "以前の検索を表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, - "画面の画像をキャプチャーする。") + "画面をキャプチャーする。") MSG_HASH( MENU_ENUM_SUBLABEL_CLOSE_CONTENT, "現在動作中のゲームを終了する。すべての保存されていない変更は失われる可能性がある。" @@ -3066,7 +3074,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, "ステートが上書きされていた場合、以前のステートセーブにロールバックする。") MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, - "Retro Achievements service. For more information, visit http://retroachievements.org" + "RetroAchievementサービスです。詳細については、http://retroachievements.orgを参照してください。" ) MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, @@ -3095,7 +3103,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, "ユーザーがコレクションからエントリーを削除できるようにする。") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, - "Sets the System directory. Cores can query for this directory to load BIOSes, system-specific configs, etc.") + "システムフォルダを指定します。コアはBIOSや特定システムの設定などをロードするため、このフォルダを探索することができます。") MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_BROWSER_DIRECTORY, "ファイルブラウザーの開始ディレクトリを指定する。") MSG_HASH( @@ -3103,12 +3111,12 @@ MSG_HASH( "Usually set by developers who bundle libretro/RetroArch apps to point to assets." ) MSG_HASH(MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPERS_DIRECTORY, - "The place to store the wallpapers dynamically loaded by the menu depending on context.") + "表示内容に応じて動的にロードされる壁紙が存在するフォルダを指定します。") MSG_HASH(MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, "サムネイルファイルの保存フォルダ" ) MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, - "設定ファイルブラウザーの初期ディレクトリーを指定する。") + "設定ファイルブラウザーの初期ディレクトリを指定する。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, "The number of frames of input latency for netplay to use to hide network latency. This reduces jitter and makes netplay less CPU-intensive, at the expense of noticeable input lag.") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, @@ -3128,7 +3136,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_LAYOUT, MSG_HASH(MENU_ENUM_SUBLABEL_XMB_THEME, "アイコンに異なるテーマを選択する。変更はプログラムの再起動後に反映される。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, - "すべてのアイコンにドロップシャドウを有効にする。この設定はわずかにパフォーマンスに影響を及ぼす。") + "すべてのアイコンにドロップシャドウを適用します。この設定はわずかにパフォーマンスに影響を及ぼします。") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "異なる背景色グラデーションテーマを選択する。") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, @@ -3136,7 +3144,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "異なる背景色グラデーションテーマを選択する。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, - "Select an animated background effect. Can be GPU-intensive depending on the effect. If performance is unsatisfactory, either turn this off or revert to a simpler effect.") + "背景アニメーション効果を選択します。効果によってはGPUに大きな負荷をかけます。パフォーマンスが不足する場合、効果をオフにするか、より単純な効果を選択してください。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_FONT, "メニューの使用するフォントを選択する。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, @@ -3160,9 +3168,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY, MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_FOOTER_OPACITY, "フッターの不透明度を調整する。") MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_ENABLE, - "The menu normally scales itself dynamically. If you want to set a specific scaling size instead, enable this.") + "通常、メニューは動的にスケールされます。特定のスケールサイズを指定したい場合に有効にしてください。") MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, - "Set the custom scaling size here. NOTE: You have to enable 'DPI Override' for this scaling size to take effect.") + "カスタムスケールサイズを指定します。備考: このスケールサイズを反映するには、「優先DPI」を有効にする必要があります。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, "すべてのダウンロードしたファイルをこのフォルダに保存する。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_REMAPPING_DIRECTORY, @@ -3172,12 +3180,12 @@ MSG_HASH(MENU_ENUM_SUBLABEL_LIBRETRO_DIR_PATH, MSG_HASH(MENU_ENUM_SUBLABEL_LIBRETRO_INFO_PATH, "コアやアプリの情報ファイルをこのフォルダに存在する。") MSG_HASH(MENU_ENUM_SUBLABEL_JOYPAD_AUTOCONFIG_DIR, - "If a joypad is plugged in, that joypad will be autoconfigured if a config file corresponding to it is present inside this directory.") + "ジョイパッドを接続したとき、そのジョイパッドに対応した設定ファイルが指定したフォルダに存在していれば、そのジョイパッドは自動的に設定されます。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_DIRECTORY, "すべてのプレイリストをこのフォルダに保存する。") MSG_HASH( MENU_ENUM_SUBLABEL_CACHE_DIRECTORY, - "If set to a directory, content which is temporarily extracted (e.g. from archives) will be extracted to this directory." + "フォルダを指定すると、アーカイブなどから一時的に展開されるコンテンツが指定先に展開されるようになります。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_DIRECTORY, "保存したクエリをこのフォルダに保存する。") @@ -3218,10 +3226,10 @@ MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_CONFIG_DIRECTORY, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_PATH, "OSDの使用するフォントを選択する。") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_APPLY_CHANGES, - "Changes to the shader configuration will take effect immediately. Use this if you changed the amount of shader passes, filtering, FBO scale, etc.") + "シェーダーの設定の変更を直ちに反映します。シェーダーのパス数やフィルタリング、FBOスケールなどを変更したときに使用します。") MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHADER_NUM_PASSES, - "Increase or decrease the amount of shader pipeline passes. You can bind a separate shader to each pipeline pass and configure its scale and filtering." + "シェーダーパイプラインのパス数を増加または減少させます。各パイプラインに別々のシェーダーをバインドし、フィルタリングとスケールを設定することができます。" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, "中継サーバーを使用") @@ -3310,7 +3318,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, "設定タブを有効") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS_PASSWORD, - "設定タブを有効するパスワード") + "設定タブを有効にするパスワード") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, "パスワードを入力してください") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, @@ -3320,7 +3328,7 @@ MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, "設定タブを有効にする。タブを表示するには再起動が必要。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") + "設定タブを隠す際にあらかじめパスワードを設定しておくことで、そのパスワードを使用してメニューから設定タブを復元することができます。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, "コレクションのエントリーの名前変更をユーザーに許可する。") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, @@ -3432,13 +3440,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, "キオスクモードを有効") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, - "Protects the setup by hiding all configuration related settings.") + "コンフィグに関係するあらゆる設定を隠すことでセットアップを保護します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, - "キオスクモードを無効するパスワードを設定") + "キオスクモードを無効にするパスワードを設定") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, - "Supplying a password when enabling kiosk mode makes it possible to later disable it from the menu, by going to the Main Menu, selecting Disable Kiosk Mode and entering the password.") + "キオスクモードを有効にする際にあらかじめパスワードを設定しておくことで、そのパスワードを使用してメニューからキオスクモードを無効にすることができます。") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD, - "パスワードを入力して下さい") + "パスワードを入力してください") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "パスワードが一致しました") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, @@ -3476,7 +3484,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, "オーディオリサンプラーの音質") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, - "Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.") + "オーディオ品質よりもパフォーマンス/遅延を優先する場合は低い設定を、パフォーマンス/遅延よりもオーディオ品質を優先する場合は高い設定を選択します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, "シェーダーファイルの変更を監視") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, @@ -3674,9 +3682,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, "オーディオストリームの再生を開始します。再生が終わると、トラックは最初から繰り返して再生されます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, - "オーディオストリームの再生を開始します。再生が終わると、順番に次のオーディオストリームに移り、それを繰り返します。アルバム再生モードとして便利です。") + "オーディオストリームの再生を開始します。再生が終わると、順番に次のオーディオストリームに\n移り、それを繰り返します。アルバム再生モードとして便利です。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, - "オーディオストリームの再生を停止しますが、メモリからは取り除きません。「再生」を選択することで再び再生を開始できます。") + "オーディオストリームの再生を停止します。メモリからは取り除かれず、「再生」を選択することで再び再生を開始できます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, "オーディオストリームの再生を停止してメモリから完全に取り除きます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, @@ -3881,10 +3889,10 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use a custom refresh rate specified in the config file if needed.") + "設定ファイルで指定されたカスタムリフレッシュレートを使用します。") MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use Custom Refresh Rate") + "カスタムリフレッシュレートを使用") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, "Select the output port connected to the CRT display.") From 7f0c73f67adb79e0a25608b86289107fe26df3bb Mon Sep 17 00:00:00 2001 From: Ayssia Date: Tue, 9 Oct 2018 14:57:24 +0800 Subject: [PATCH 0280/1292] Update Simplified Chinese localization --- intl/msg_hash_chs.c | 5 +++-- intl/msg_hash_chs.h | 40 ++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index 021e02d314..7a07249434 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -1743,8 +1743,9 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "RetroArch 本身并不能做什么事情。 \n" " \n" - "如果想在上面干点什么,你需要向它加载一个程序。 \n" - "\n" + "如果想在上面干点什么,你需要向它加载 \n" + "一个程序。\n" + " \n" "我们把这样的程序叫做「Libretro 核心」, \n" "简称「核心」。 \n" " \n" diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 43716e8263..50f28c66e5 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -834,7 +834,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, "Game focus toggle") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, - "加载状态") + "即时读档") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, "切换菜单") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_BSV_RECORD_TOGGLE, @@ -968,7 +968,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST, "载入游戏内容") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOAD_STATE, - "加载状态") + "即时读档") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_ALLOW, "允许使用位置") MSG_HASH(MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER, @@ -1679,7 +1679,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, "刷新率") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, - "估算的显示器帧率") + "预估刷新率") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_POLLED, "Set Display-Reported Refresh Rate") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, @@ -2278,13 +2278,13 @@ MSG_HASH(MSG_STARTING_MOVIE_RECORD_TO, MSG_HASH(MSG_STATE_SIZE, "State size") MSG_HASH(MSG_STATE_SLOT, - "状态存档槽") + "即时存档栏位") MSG_HASH(MSG_TAKING_SCREENSHOT, "截屏。") MSG_HASH(MSG_TO, "到") MSG_HASH(MSG_UNDID_LOAD_STATE, - "已撤销加载状态。") + "已撤销即时读档。") MSG_HASH(MSG_UNDOING_SAVE_STATE, "撤销即时存档") MSG_HASH(MSG_UNKNOWN, @@ -2385,7 +2385,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, - "Vertical refresh rate of your screen. Used to calculate a suitable audio input rate. NOTE: This will be ignored if 'Threaded Video' is enabled." + "屏幕的刷新率。注意:如果视频独立线程已启用,此选项将被忽略。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_ENABLE, @@ -2607,7 +2607,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, - "减速时最少以几分之一速度运行。" + "减速时以几分之一速度运行。" ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, @@ -2811,7 +2811,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND, - "Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically." + "如果开启此选项,在列表的最上端继续向上翻页会回到最下端,向下翻页时也一样。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, @@ -2844,9 +2844,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, "Scan for new rooms.") MSG_HASH(MENU_ENUM_SUBLABEL_DELETE_ENTRY, - "Remove this entry from the collection.") + "删除此条目。") MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION, "View more information about the content.") +MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES, + "将此游戏加入你的收藏夹。") +MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST, + "将此游戏加入你的收藏夹。") MSG_HASH(MENU_ENUM_SUBLABEL_RUN, "开始游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS, @@ -2868,7 +2872,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DATABASE_MANAGER, MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_MANAGER, "View previous searches.") MSG_HASH(MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, - "Captures an image of the screen.") + "截取当前屏幕。") MSG_HASH( MENU_ENUM_SUBLABEL_CLOSE_CONTENT, "关闭当前游戏。未保存的进度可能会丢失。" @@ -3137,7 +3141,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, "Remove this core from disk.") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, - "Rename the title of the entry.") + "重命名此条目。") MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY, "Rename") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, @@ -3267,19 +3271,19 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, "Disables kiosk mode. A restart is required for the change to take full effect.") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, - "Enable Kiosk Mode") + "开启懒人模式") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, - "Protects the setup by hiding all configuration related settings.") + "隐藏所有与配置文件相关的选项,以防止误改选项导致麻烦。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, - "Set Password For Disabling Kiosk Mode") + "设置退出懒人模式的密码") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, - "Supplying a password when enabling kiosk mode makes it possible to later disable it from the menu, by going to the Main Menu, selecting Disable Kiosk Mode and entering the password.") + "设置密码后,在主菜单选择「退出懒人模式」并输入密码才能退出懒人模式。") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD, - "Enter Password") + "请输入密码") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, - "Password correct.") + "密码正确。") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, - "Password incorrect.") + "密码错误。") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, "Automatically add content to playlist") MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, From 1fab4cfd2bc335a9abe630e96141ca077173b9d6 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Tue, 9 Oct 2018 21:17:13 +0800 Subject: [PATCH 0281/1292] Fix typo --- intl/msg_hash_chs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 50f28c66e5..27e26619c4 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3141,7 +3141,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, "Remove this core from disk.") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, - "重命名此条目。") + "重命名此条目") MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY, "Rename") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, From 0b3ac4e39d845537c82bcf04ad7b85865b9ef8bd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 15:28:09 +0200 Subject: [PATCH 0282/1292] Fix C++ comment --- gfx/drivers/gl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 66f45482d5..2c446e088a 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -953,7 +953,7 @@ static bool gl_frame(void *data, const void *frame, return false; #ifdef HAVE_LIBNX - // Should be called once per frame + /* Should be called once per frame */ if(!appletMainLoop()) return false; #endif From f277489efc81c3ba3929748da5afd52bf143ef37 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 15:35:39 +0200 Subject: [PATCH 0283/1292] Comment out pthread attr for 3DS --- libretro-common/rthreads/rthreads.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index 5d651dd003..e38ffb4249 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -165,8 +165,8 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata) return sthread_create_with_priority(thread_func, userdata, 0); } -/* TODO/FIXME - this needs to be implemented for Switch */ -#if !defined(SWITCH) && !defined(USE_WIN32_THREADS) +/* TODO/FIXME - this needs to be implemented for Switch/3DS */ +#if !defined(SWITCH) && !defined(USE_WIN32_THREADS) && !defined(_3DS) #define HAVE_THREAD_ATTR #endif From a27bce38cdc705cf940e7df49c4f090f0eed9e88 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 16:46:40 +0200 Subject: [PATCH 0284/1292] Simplify gl_get_context --- gfx/drivers/gl.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 2c446e088a..aa0f52dba7 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1506,31 +1506,38 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl) struct retro_hw_render_callback *hwr = video_driver_get_hw_context(); unsigned major = hwr->version_major; unsigned minor = hwr->version_minor; + enum retro_hw_context_type ctx_type = hwr->context_type; + bool hw_context_in_use = ctx_type != RETRO_HW_CONTEXT_NONE; #ifdef HAVE_OPENGLES api = GFX_CTX_OPENGL_ES_API; api_name = "OpenGL ES 2.0"; - if (hwr->context_type == RETRO_HW_CONTEXT_OPENGLES3) + switch (ctx_type) { - major = 3; - minor = 0; - api_name = "OpenGL ES 3.0"; + case RETRO_HW_CONTEXT_OPENGLES3: + major = 3; + minor = 0; + api_name = "OpenGL ES 3.0"; + break; + case RETRO_HW_CONTEXT_OPENGLES_VERSION: + api_name = "OpenGL ES 3.1+"; + break; + case RETRO_HW_CONTEXT_NONE: + default: + break; } - else if (hwr->context_type == RETRO_HW_CONTEXT_OPENGLES_VERSION) - api_name = "OpenGL ES 3.1+"; #else - api = GFX_CTX_OPENGL_API; - api_name = "OpenGL"; + api = GFX_CTX_OPENGL_API; + api_name = "OpenGL"; #endif (void)api_name; gl_shared_context_use = settings->bools.video_shared_context - && hwr->context_type != RETRO_HW_CONTEXT_NONE; + && hw_context_in_use; - if ( (libretro_get_shared_context()) - && (hwr->context_type != RETRO_HW_CONTEXT_NONE)) + if (libretro_get_shared_context() && hw_context_in_use) gl_shared_context_use = true; return video_context_driver_init_first(gl, From d4815084ec0116ffd748e85cdaae2b23c28ddf94 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Tue, 9 Oct 2018 17:58:36 +0200 Subject: [PATCH 0285/1292] Update the rendering context with the GL version whether it is a core context --- gfx/drivers/gl.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index aa0f52dba7..e20b01af24 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1787,13 +1787,26 @@ static void *gl_init(const video_info_t *video, hwr = video_driver_get_hw_context(); - if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + if (hwr) + { + hwr->version_major = gl->version_major; + hwr->version_minor = gl->version_minor; + hwr->context_type = RETRO_HW_CONTEXT_OPENGL; + } + + /* Check if we have a core context */ + GLint glflags = 0; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &glflags); + + if (glflags & GL_CONTEXT_CORE_PROFILE_BIT) { gfx_ctx_flags_t flags; gl_query_core_context_set(true); gl->core_context_in_use = true; + if (hwr) + hwr->context_type = RETRO_HW_CONTEXT_OPENGL_CORE; /** * Ensure that the rest of the frontend knows we have a core context */ @@ -1820,7 +1833,7 @@ static void *gl_init(const video_info_t *video, if (gl->renderchain_driver->restore_default_state) gl->renderchain_driver->restore_default_state(gl, gl->renderchain_data); - if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) if (gl->renderchain_driver->new_vao) gl->renderchain_driver->new_vao(gl, gl->renderchain_data); @@ -1830,7 +1843,7 @@ static void *gl_init(const video_info_t *video, gl->hw_render_use = false; gl->has_fbo = gl_check_capability(GL_CAPS_FBO); - if (gl->has_fbo && hwr->context_type != RETRO_HW_CONTEXT_NONE) + if (gl->has_fbo && hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE) gl->hw_render_use = true; if (!resolve_extensions(gl, ctx_driver->ident, video)) @@ -1862,7 +1875,7 @@ static void *gl_init(const video_info_t *video, RARCH_LOG("[GL]: Using resolution %ux%u\n", temp_width, temp_height); - gl->vertex_ptr = hwr->bottom_left_origin + gl->vertex_ptr = (hwr && hwr->bottom_left_origin) ? vertexes : vertexes_flipped; /* Better pipelining with GPU due to synchronous glSubTexImage. From c11e47b08a9ab9440690a68c442ba0bf4b874979 Mon Sep 17 00:00:00 2001 From: flyinghead Date: Tue, 9 Oct 2018 19:27:55 +0200 Subject: [PATCH 0286/1292] Checking for core context returns an error in GL3 This error should be ignored. Mac build fix --- gfx/drivers/gl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index e20b01af24..50e6bd4095 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1794,9 +1794,11 @@ static void *gl_init(const video_info_t *video, hwr->context_type = RETRO_HW_CONTEXT_OPENGL; } +#ifdef GL_CONTEXT_PROFILE_MASK /* Check if we have a core context */ GLint glflags = 0; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &glflags); + while (glGetError() != GL_NO_ERROR); if (glflags & GL_CONTEXT_CORE_PROFILE_BIT) { @@ -1822,6 +1824,7 @@ static void *gl_init(const video_info_t *video, goto error; } } +#endif if (!renderchain_gl_init_first(&gl->renderchain_driver, &gl->renderchain_data)) From 8d586e1a0c30e929e51f0c75d353cc945d0fd32c Mon Sep 17 00:00:00 2001 From: flyinghead Date: Tue, 9 Oct 2018 20:31:40 +0200 Subject: [PATCH 0287/1292] Do not force the requested hw context to be Open GL --- gfx/drivers/gl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 50e6bd4095..cfcd81440f 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1791,7 +1791,6 @@ static void *gl_init(const video_info_t *video, { hwr->version_major = gl->version_major; hwr->version_minor = gl->version_minor; - hwr->context_type = RETRO_HW_CONTEXT_OPENGL; } #ifdef GL_CONTEXT_PROFILE_MASK @@ -1807,8 +1806,6 @@ static void *gl_init(const video_info_t *video, gl_query_core_context_set(true); gl->core_context_in_use = true; - if (hwr) - hwr->context_type = RETRO_HW_CONTEXT_OPENGL_CORE; /** * Ensure that the rest of the frontend knows we have a core context */ @@ -1824,7 +1821,11 @@ static void *gl_init(const video_info_t *video, goto error; } } + else #endif + if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + hwr->context_type = RETRO_HW_CONTEXT_OPENGL; + if (!renderchain_gl_init_first(&gl->renderchain_driver, &gl->renderchain_data)) From c02536af088f75b4c9ac06ed7366ecf8791c8238 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Oct 2018 20:42:47 +0200 Subject: [PATCH 0288/1292] Roll all this back --- gfx/drivers/gl.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index cfcd81440f..aa0f52dba7 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1787,19 +1787,7 @@ static void *gl_init(const video_info_t *video, hwr = video_driver_get_hw_context(); - if (hwr) - { - hwr->version_major = gl->version_major; - hwr->version_minor = gl->version_minor; - } - -#ifdef GL_CONTEXT_PROFILE_MASK - /* Check if we have a core context */ - GLint glflags = 0; - glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &glflags); - while (glGetError() != GL_NO_ERROR); - - if (glflags & GL_CONTEXT_CORE_PROFILE_BIT) + if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) { gfx_ctx_flags_t flags; @@ -1821,11 +1809,6 @@ static void *gl_init(const video_info_t *video, goto error; } } - else -#endif - if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) - hwr->context_type = RETRO_HW_CONTEXT_OPENGL; - if (!renderchain_gl_init_first(&gl->renderchain_driver, &gl->renderchain_data)) @@ -1837,7 +1820,7 @@ static void *gl_init(const video_info_t *video, if (gl->renderchain_driver->restore_default_state) gl->renderchain_driver->restore_default_state(gl, gl->renderchain_data); - if (hwr && hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) if (gl->renderchain_driver->new_vao) gl->renderchain_driver->new_vao(gl, gl->renderchain_data); @@ -1847,7 +1830,7 @@ static void *gl_init(const video_info_t *video, gl->hw_render_use = false; gl->has_fbo = gl_check_capability(GL_CAPS_FBO); - if (gl->has_fbo && hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE) + if (gl->has_fbo && hwr->context_type != RETRO_HW_CONTEXT_NONE) gl->hw_render_use = true; if (!resolve_extensions(gl, ctx_driver->ident, video)) @@ -1879,7 +1862,7 @@ static void *gl_init(const video_info_t *video, RARCH_LOG("[GL]: Using resolution %ux%u\n", temp_width, temp_height); - gl->vertex_ptr = (hwr && hwr->bottom_left_origin) + gl->vertex_ptr = hwr->bottom_left_origin ? vertexes : vertexes_flipped; /* Better pipelining with GPU due to synchronous glSubTexImage. From 96b80990154f4d5950df5b6e9de17ebf044ed58d Mon Sep 17 00:00:00 2001 From: meepingsnesroms Date: Tue, 9 Oct 2018 15:44:03 -0700 Subject: [PATCH 0289/1292] Disable all the non working defines for 3DS The network stuff I started implementing and never finished and the threads are broken for an unknown reason. This basicly just disabled the menu options associated with these things as none of them are currently working --- Makefile.ctr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.ctr b/Makefile.ctr index e72f8313d4..2427e235cc 100644 --- a/Makefile.ctr +++ b/Makefile.ctr @@ -52,7 +52,7 @@ ifeq ($(GRIFFIN_BUILD), 1) OBJ += griffin/griffin.o DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB - DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DRC_DISABLE_LUA -DHAVE_SOCKET_LEGACY -DHAVE_THREADS + #DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DRC_DISABLE_LUA -DHAVE_SOCKET_LEGACY -DHAVE_THREADS #-DHAVE_SSL -DMBEDTLS_SSL_DEBUG_ALL #ssl is currently incompatible with griffin due to use of the "static" flag on repeating functions that will conflict when included in one file else @@ -72,11 +72,11 @@ else HAVE_XMB = 1 HAVE_STATIC_VIDEO_FILTERS = 1 HAVE_STATIC_AUDIO_FILTERS = 1 - HAVE_NETWORKING = 1 - HAVE_CHEEVOS = 1 - HAVE_SOCKET_LEGACY = 1 - HAVE_THREADS = 1 - HAVE_SSL = 1 + #HAVE_NETWORKING = 1 + #HAVE_CHEEVOS = 1 + #HAVE_SOCKET_LEGACY = 1 + #HAVE_THREADS = 1 + #HAVE_SSL = 1 include Makefile.common BLACKLIST := From fa03a634d0e59cbf1f8c1bfde398046e24884788 Mon Sep 17 00:00:00 2001 From: Alfrix Date: Tue, 9 Oct 2018 19:52:04 -0300 Subject: [PATCH 0290/1292] New Netplay icons --- intl/msg_hash_us.h | 2 +- menu/cbs/menu_cbs_ok.c | 7 +++++-- menu/drivers/xmb.c | 43 ++++++++++++++---------------------------- menu/menu_driver.h | 4 +--- 4 files changed, 21 insertions(+), 35 deletions(-) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index ae8017977e..a3a118a1d1 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -5319,7 +5319,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, - "Enables netplay in client mode." + "Enter netplay server address and connect in client mode." ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e98fcf249c..d6fe477c11 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3929,6 +3929,7 @@ void netplay_refresh_rooms_menu(file_list_t *list) { char s[8300]; int i = 0; + int room_type = 0; s[0] = '\0'; @@ -4008,14 +4009,16 @@ void netplay_refresh_rooms_menu(file_list_t *list) snprintf(s, sizeof(s), "%s: %s%s", netplay_room_list[i].lan ? "Local" : (netplay_room_list[i].host_method == NETPLAY_HOST_METHOD_MITM ? - "Internet (relay)" : "Internet (direct)"), + "Internet (Relay)" : "Internet"), netplay_room_list[i].nickname, country); + room_type = netplay_room_list[i].lan ? MENU_ROOM_LAN : (netplay_room_list[i].host_method == NETPLAY_HOST_METHOD_MITM ? MENU_ROOM_RELAY : MENU_ROOM); + menu_entries_append_enum(list, s, msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, - MENU_SETTINGS_NETPLAY_ROOMS_START + i, 0, 0); + room_type, 0, 0); } netplay_rooms_free(); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 7b273e72d0..080d3761a7 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -105,13 +105,8 @@ enum #ifdef HAVE_NETWORKING XMB_TEXTURE_NETPLAY, XMB_TEXTURE_ROOM, - XMB_TEXTURE_IROOM, - XMB_TEXTURE_LANROOM, -#if 0 - /* stub these out until we have the icons */ XMB_TEXTURE_ROOM_LAN, - XMB_TEXTURE_ROOM_MITM, -#endif + XMB_TEXTURE_ROOM_RELAY, #endif #ifdef HAVE_IMAGEVIEWER XMB_TEXTURE_IMAGES, @@ -2426,9 +2421,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT: return xmb->textures.list[XMB_TEXTURE_ROOM]; case MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS: - return xmb->textures.list[XMB_TEXTURE_IROOM]; - case MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS: - return xmb->textures.list[XMB_TEXTURE_LANROOM]; + return xmb->textures.list[XMB_TEXTURE_RELOAD]; #endif default: break; @@ -2519,10 +2512,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, return xmb->textures.list[XMB_TEXTURE_RESUME]; case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: return xmb->textures.list[XMB_TEXTURE_RUN]; - case MENU_SETTING_ACTION: - if (xmb->depth == 3) - return xmb->textures.list[XMB_TEXTURE_SUBSETTING]; - return xmb->textures.list[XMB_TEXTURE_SETTING]; + case MENU_SETTING_GROUP: #ifdef HAVE_LAKKA_SWITCH case MENU_SET_SWITCH_BRIGHTNESS: @@ -2535,14 +2525,16 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, #ifdef HAVE_NETWORKING case MENU_ROOM: return xmb->textures.list[XMB_TEXTURE_ROOM]; -#if 0 - /* stub these out until we have the icons */ case MENU_ROOM_LAN: return xmb->textures.list[XMB_TEXTURE_ROOM_LAN]; - case MENU_ROOM_MITM: - return xmb->textures.list[XMB_TEXTURE_ROOM_MITM]; -#endif + case MENU_ROOM_RELAY: + return xmb->textures.list[XMB_TEXTURE_ROOM_RELAY]; #endif + case MENU_SETTING_ACTION: + if (xmb->depth <= 3) + return xmb->textures.list[XMB_TEXTURE_SETTING]; + default: + return xmb->textures.list[XMB_TEXTURE_SUBSETTING]; } #ifdef HAVE_CHEEVOS @@ -4547,18 +4539,11 @@ static const char *xmb_texture_path(unsigned id) case XMB_TEXTURE_NETPLAY: return "netplay.png"; case XMB_TEXTURE_ROOM: - return "room.png"; - case XMB_TEXTURE_LANROOM: - return "netplay - LAN Room.png"; - case XMB_TEXTURE_IROOM: - return "netplay - iRoom.png"; -#if 0 - /* stub these out until we have the icons */ + return "menu_room.png"; case XMB_TEXTURE_ROOM_LAN: - return "room_lan.png"; - case XMB_TEXTURE_ROOM_MITM: - return "room_mitm.png"; -#endif + return "menu_room_lan.png"; + case XMB_TEXTURE_ROOM_RELAY: + return "menu_room_relay.png"; #endif case XMB_TEXTURE_KEY: return "key.png"; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 7546482f5b..dee87c546a 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -171,10 +171,8 @@ enum menu_settings_type MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS, MENU_WIFI, MENU_ROOM, -/* MENU_ROOM_LAN, - MENU_ROOM_MITM, -*/ + MENU_ROOM_RELAY, MENU_NETPLAY_LAN_SCAN, MENU_INFO_MESSAGE, MENU_SETTINGS_SHADER_PARAMETER_0, From 304b4f3f57f31b6c5bdd0037ee0ef11d5acbec6b Mon Sep 17 00:00:00 2001 From: Alfrix Date: Tue, 9 Oct 2018 20:30:20 -0300 Subject: [PATCH 0291/1292] Use subsetting as placeholder until themes are updated --- menu/drivers/xmb.c | 268 +++++++++++++++++++++++++++++++-------------- 1 file changed, 186 insertions(+), 82 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 080d3761a7..1f0b9a92d3 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -4435,181 +4435,285 @@ static bool xmb_load_image(void *userdata, void *data, enum menu_image_type type static const char *xmb_texture_path(unsigned id) { + char *iconpath = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); + char *icon_name = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); + char *icon_fullpath = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); + + iconpath[0] = icon_name[0] = icon_fullpath[0] = '\0'; + switch (id) { case XMB_TEXTURE_MAIN_MENU: #if defined(HAVE_LAKKA) - return "lakka.png"; + icon_name = "lakka.png"; + break; #else - return "retroarch.png"; + icon_name = "retroarch.png"; + break; #endif case XMB_TEXTURE_SETTINGS: - return "settings.png"; + icon_name = "settings.png"; + break; case XMB_TEXTURE_HISTORY: - return "history.png"; + icon_name = "history.png"; + break; case XMB_TEXTURE_FAVORITES: - return "favorites.png"; + icon_name = "favorites.png"; + break; case XMB_TEXTURE_ADD_FAVORITE: - return "add-favorite.png"; + icon_name = "add-favorite.png"; + break; case XMB_TEXTURE_MUSICS: - return "musics.png"; + icon_name = "musics.png"; + break; #if defined(HAVE_FFMPEG) || defined(HAVE_MPV) case XMB_TEXTURE_MOVIES: - return "movies.png"; + icon_name = "movies.png"; + break; #endif #ifdef HAVE_IMAGEVIEWER case XMB_TEXTURE_IMAGES: - return "images.png"; + icon_name = "images.png"; + break; #endif case XMB_TEXTURE_SETTING: - return "setting.png"; + icon_name = "setting.png"; + break; case XMB_TEXTURE_SUBSETTING: - return "subsetting.png"; + icon_name = "subsetting.png"; + break; case XMB_TEXTURE_ARROW: - return "arrow.png"; + icon_name = "arrow.png"; + break; case XMB_TEXTURE_RUN: - return "run.png"; + icon_name = "run.png"; + break; case XMB_TEXTURE_CLOSE: - return "close.png"; + icon_name = "close.png"; + break; case XMB_TEXTURE_RESUME: - return "resume.png"; + icon_name = "resume.png"; + break; case XMB_TEXTURE_CLOCK: - return "clock.png"; + icon_name = "clock.png"; + break; case XMB_TEXTURE_BATTERY_FULL: - return "battery-full.png"; + icon_name = "battery-full.png"; + break; case XMB_TEXTURE_BATTERY_CHARGING: - return "battery-charging.png"; + icon_name = "battery-charging.png"; + break; case XMB_TEXTURE_POINTER: - return "pointer.png"; + icon_name = "pointer.png"; + break; case XMB_TEXTURE_SAVESTATE: - return "savestate.png"; + icon_name = "savestate.png"; + break; case XMB_TEXTURE_LOADSTATE: - return "loadstate.png"; + icon_name = "loadstate.png"; + break; case XMB_TEXTURE_UNDO: - return "undo.png"; + icon_name = "undo.png"; + break; case XMB_TEXTURE_CORE_INFO: - return "core-infos.png"; + icon_name = "core-infos.png"; + break; case XMB_TEXTURE_WIFI: - return "wifi.png"; + icon_name = "wifi.png"; + break; case XMB_TEXTURE_CORE_OPTIONS: - return "core-options.png"; + icon_name = "core-options.png"; + break; case XMB_TEXTURE_INPUT_REMAPPING_OPTIONS: - return "core-input-remapping-options.png"; + icon_name = "core-input-remapping-options.png"; + break; case XMB_TEXTURE_CHEAT_OPTIONS: - return "core-cheat-options.png"; + icon_name = "core-cheat-options.png"; + break; case XMB_TEXTURE_DISK_OPTIONS: - return "core-disk-options.png"; + icon_name = "core-disk-options.png"; + break; case XMB_TEXTURE_SHADER_OPTIONS: - return "core-shader-options.png"; + icon_name = "core-shader-options.png"; + break; case XMB_TEXTURE_ACHIEVEMENT_LIST: - return "achievement-list.png"; + icon_name = "achievement-list.png"; + break; case XMB_TEXTURE_SCREENSHOT: - return "screenshot.png"; + icon_name = "screenshot.png"; + break; case XMB_TEXTURE_RELOAD: - return "reload.png"; + icon_name = "reload.png"; + break; case XMB_TEXTURE_RENAME: - return "rename.png"; + icon_name = "rename.png"; + break; case XMB_TEXTURE_FILE: - return "file.png"; + icon_name = "file.png"; + break; case XMB_TEXTURE_FOLDER: - return "folder.png"; + icon_name = "folder.png"; + break; case XMB_TEXTURE_ZIP: - return "zip.png"; + icon_name = "zip.png"; + break; case XMB_TEXTURE_MUSIC: - return "music.png"; + icon_name = "music.png"; + break; case XMB_TEXTURE_FAVORITE: - return "favorites-content.png"; + icon_name = "favorites-content.png"; + break; case XMB_TEXTURE_IMAGE: - return "image.png"; + icon_name = "image.png"; + break; case XMB_TEXTURE_MOVIE: - return "movie.png"; + icon_name = "movie.png"; + break; case XMB_TEXTURE_CORE: - return "core.png"; + icon_name = "core.png"; + break; case XMB_TEXTURE_RDB: - return "database.png"; + icon_name = "database.png"; + break; case XMB_TEXTURE_CURSOR: - return "cursor.png"; + icon_name = "cursor.png"; + break; case XMB_TEXTURE_SWITCH_ON: - return "on.png"; + icon_name = "on.png"; + break; case XMB_TEXTURE_SWITCH_OFF: - return "off.png"; + icon_name = "off.png"; + break; case XMB_TEXTURE_ADD: - return "add.png"; + icon_name = "add.png"; + break; #ifdef HAVE_NETWORKING case XMB_TEXTURE_NETPLAY: - return "netplay.png"; + icon_name = "netplay.png"; + break; case XMB_TEXTURE_ROOM: - return "menu_room.png"; + icon_name = "menu_room.png"; + break; case XMB_TEXTURE_ROOM_LAN: - return "menu_room_lan.png"; + icon_name = "menu_room_lan.png"; + break; case XMB_TEXTURE_ROOM_RELAY: - return "menu_room_relay.png"; + icon_name = "menu_room_relay.png"; + break; #endif case XMB_TEXTURE_KEY: - return "key.png"; + icon_name = "key.png"; + break; case XMB_TEXTURE_KEY_HOVER: - return "key-hover.png"; + icon_name = "key-hover.png"; + break; case XMB_TEXTURE_DIALOG_SLICE: - return "dialog-slice.png"; + icon_name = "dialog-slice.png"; + break; case XMB_TEXTURE_ACHIEVEMENTS: - return "menu_achievements.png"; + icon_name = "menu_achievements.png"; + break; case XMB_TEXTURE_AUDIO: - return "menu_audio.png"; + icon_name = "menu_audio.png"; + break; case XMB_TEXTURE_DRIVERS: - return "menu_drivers.png"; + icon_name = "menu_drivers.png"; + break; case XMB_TEXTURE_EXIT: - return "menu_exit.png"; + icon_name = "menu_exit.png"; + break; case XMB_TEXTURE_FRAMESKIP: - return "menu_frameskip.png"; + icon_name = "menu_frameskip.png"; + break; case XMB_TEXTURE_HELP: - return "menu_help.png"; + icon_name = "menu_help.png"; + break; case XMB_TEXTURE_INFO: - return "menu_info.png"; + icon_name = "menu_info.png"; + break; case XMB_TEXTURE_INPUT: - return "Libretro - Pad.png"; + icon_name = "Libretro - Pad.png"; + break; case XMB_TEXTURE_LATENCY: - return "menu_latency.png"; + icon_name = "menu_latency.png"; + break; case XMB_TEXTURE_NETWORK: - return "menu_network.png"; + icon_name = "menu_network.png"; + break; case XMB_TEXTURE_POWER: - return "menu_power.png"; + icon_name = "menu_power.png"; + break; case XMB_TEXTURE_RECORD: - return "menu_record.png"; + icon_name = "menu_record.png"; + break; case XMB_TEXTURE_SAVING: - return "menu_saving.png"; + icon_name = "menu_saving.png"; + break; case XMB_TEXTURE_UPDATER: - return "menu_updater.png"; + icon_name = "menu_updater.png"; + break; case XMB_TEXTURE_VIDEO: - return "menu_video.png"; + icon_name = "menu_video.png"; + break; case XMB_TEXTURE_MIXER: - return "menu_mixer.png"; + icon_name = "menu_mixer.png"; + break; case XMB_TEXTURE_LOG: - return "menu_log.png"; + icon_name = "menu_log.png"; + break; case XMB_TEXTURE_OSD: - return "menu_osd.png"; + icon_name = "menu_osd.png"; + break; case XMB_TEXTURE_UI: - return "menu_ui.png"; + icon_name = "menu_ui.png"; + break; case XMB_TEXTURE_USER: - return "menu_user.png"; + icon_name = "menu_user.png"; + break; case XMB_TEXTURE_PRIVACY: - return "menu_privacy.png"; + icon_name = "menu_privacy.png"; + break; case XMB_TEXTURE_PLAYLIST: - return "menu_playlist.png"; + icon_name = "menu_playlist.png"; + break; case XMB_TEXTURE_QUICKMENU: - return "menu_quickmenu.png"; + icon_name = "menu_quickmenu.png"; + break; case XMB_TEXTURE_REWIND: - return "menu_rewind.png"; + icon_name = "menu_rewind.png"; + break; case XMB_TEXTURE_OVERLAY: - return "menu_overlay.png"; + icon_name = "menu_overlay.png"; + break; case XMB_TEXTURE_OVERRIDE: - return "menu_override.png"; + icon_name = "menu_override.png"; + break; case XMB_TEXTURE_NOTIFICATIONS: - return "menu_notifications.png"; + icon_name = "menu_notifications.png"; + break; case XMB_TEXTURE_STREAM: - return "menu_stream.png"; + icon_name = "menu_stream.png"; + break; } - return NULL; + fill_pathname_application_special(iconpath, + PATH_MAX_LENGTH * sizeof(char), + APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); + + icon_fullpath = iconpath; + strlcat(icon_fullpath, icon_name, PATH_MAX_LENGTH * sizeof(char)); + + if (!filestream_exists(icon_fullpath)) + { + /* If the icon doesn't exist at least try to return the subsetting icon*/ + if (id == XMB_TEXTURE_DIALOG_SLICE || id == XMB_TEXTURE_KEY_HOVER || id == XMB_TEXTURE_KEY_HOVER) + return NULL; + else + return "subsetting.png"; + } + else + return icon_name; + } static void xmb_context_reset_textures( From 1b1a0c8d271f7a4fe6d0a6b5fa4aefa2a0a49246 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 02:01:13 +0200 Subject: [PATCH 0292/1292] Stub this out for GEKKO --- libretro-common/rthreads/rthreads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index e38ffb4249..b5db30d788 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -166,7 +166,7 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata) } /* TODO/FIXME - this needs to be implemented for Switch/3DS */ -#if !defined(SWITCH) && !defined(USE_WIN32_THREADS) && !defined(_3DS) +#if !defined(SWITCH) && !defined(USE_WIN32_THREADS) && !defined(_3DS) && !defined(GEKKO) #define HAVE_THREAD_ATTR #endif From 6dc88622208100b9fb01fe2873adb72abad25562 Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 9 Oct 2018 19:07:05 -0500 Subject: [PATCH 0293/1292] [cheevos] autoload state may kick in before achievements are loaded, disable autoload state altogether if cheevos hardcode is enabled --- command.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/command.c b/command.c index f52fcee785..5bee7d0d08 100644 --- a/command.c +++ b/command.c @@ -1278,6 +1278,7 @@ static bool event_init_content(void) { bool contentless = false; bool is_inited = false; + settings_t *settings = config_get_ptr(); content_get_status(&contentless, &is_inited); @@ -1304,7 +1305,18 @@ static bool event_init_content(void) RARCH_LOG("%s.\n", msg_hash_to_str(MSG_SKIPPING_SRAM_LOAD)); +/* + Since the operations are asynchronouse we can't guarantee users will not use auto_load_state to cheat on + achievements so we forbid auto_load_state from happening if cheevos_enable and cheevos_hardcode_mode_enable + are true +*/ +#ifdef HAVE_CHEEVOS + if (!settings->bools.cheevos_enable || !settings->bools.cheevos_hardcore_mode_enable) + command_event_load_auto_state(); +#else command_event_load_auto_state(); +#endif + command_event(CMD_EVENT_BSV_MOVIE_INIT, NULL); command_event(CMD_EVENT_NETPLAY_INIT, NULL); From f1c5b268caf3c3dbaaf5fcb32b46c2ac3fe4a5be Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 04:00:51 +0200 Subject: [PATCH 0294/1292] Hide Quick Menu properly --- menu/menu_displaylist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ae39a02992..c18f006b97 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7310,9 +7310,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) if (!string_is_empty(system->info.library_name) && !string_is_equal(system->info.library_name, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) - menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_CONTENT_SETTINGS, - PARSE_ACTION, false); + if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_CONTENT_SETTINGS, + PARSE_ACTION, false); if (system->load_no_content) menu_displaylist_parse_settings_enum(menu, info, From 13a0274f5779f984053cfb30998b6f874d3596e4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 04:25:11 +0200 Subject: [PATCH 0295/1292] Localize some strings --- menu/cbs/menu_cbs_sublabel.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 32d6c2b5d5..8953602cbd 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -531,12 +531,14 @@ static int action_bind_sublabel_remap_kbd_sublabel( { unsigned user_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) / RARCH_FIRST_CUSTOM_BIND; - snprintf(s, len, "User #%d: %s", user_idx + 1, - input_config_get_device_display_name(user_idx) ? - input_config_get_device_display_name(user_idx) : - (input_config_get_device_name(user_idx) ? - input_config_get_device_name(user_idx) : - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); + snprintf(s, len, "%s #%d: %s", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), + user_idx + 1, + input_config_get_device_display_name(user_idx) ? + input_config_get_device_display_name(user_idx) : + (input_config_get_device_name(user_idx) ? + input_config_get_device_name(user_idx) : + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); return 0; } @@ -589,12 +591,14 @@ static int action_bind_sublabel_remap_sublabel( unsigned offset = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8); - snprintf(s, len, "User #%d: %s", offset + 1, - input_config_get_device_display_name(offset) ? - input_config_get_device_display_name(offset) : - (input_config_get_device_name(offset) ? - input_config_get_device_name(offset) : - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); + snprintf(s, len, "%s #%d: %s", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), + offset + 1, + input_config_get_device_display_name(offset) ? + input_config_get_device_display_name(offset) : + (input_config_get_device_name(offset) ? + input_config_get_device_name(offset) : + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); return 0; } From d1022d90401f4c2478a6d9f7ca57abd81befc48e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 04:32:36 +0200 Subject: [PATCH 0296/1292] Cleanups --- menu/menu_displaylist.c | 154 ++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c18f006b97..96b64a43a2 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1289,7 +1289,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, if (!string_is_empty(info->path)) { size_t lpl_basename_size = PATH_MAX_LENGTH * sizeof(char); - char *lpl_basename = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *lpl_basename = (char*)malloc(lpl_basename_size); lpl_basename[0] = '\0'; fill_pathname_base_noext(lpl_basename, info->path, lpl_basename_size); @@ -1302,9 +1302,9 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, for (i = 0; i < list_size; i++) { - char *path_copy = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *fill_buf = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); size_t path_size = PATH_MAX_LENGTH * sizeof(char); + char *path_copy = (char*)malloc(path_size); + char *fill_buf = (char*)malloc(path_size); const char *core_name = NULL; const char *path = NULL; const char *label = NULL; @@ -1337,9 +1337,10 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, if (path) { - char *path_short = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + size_t path_size = PATH_MAX_LENGTH * sizeof(char); + char *path_short = (char*)malloc(path_size); - path_short[0] = '\0'; + path_short[0] = '\0'; fill_short_pathname_representation(path_short, path, path_size); @@ -1352,10 +1353,9 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, if (!string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) { - char *tmp = (char*) - malloc(PATH_MAX_LENGTH * sizeof(char)); + char *tmp = (char*)malloc(path_size); - tmp[0] = '\0'; + tmp[0] = '\0'; snprintf(tmp, path_size, " (%s)", core_name); strlcat(fill_buf, tmp, path_size); @@ -1486,12 +1486,13 @@ static int create_string_list_rdb_entry_string( char *output_label = NULL; int str_len = 0; struct string_list *str_list = string_list_new(); + size_t path_size = PATH_MAX_LENGTH * sizeof(char); if (!str_list) return -1; attr.i = 0; - tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + tmp = (char*)malloc(path_size); tmp[0] = '\0'; str_len += strlen(label) + 1; @@ -1515,8 +1516,7 @@ static int create_string_list_rdb_entry_string( string_list_join_concat(output_label, str_len, str_list, "|"); fill_pathname_join_concat_noext(tmp, desc, ": ", - actual_string, - PATH_MAX_LENGTH * sizeof(char)); + actual_string, path_size); menu_entries_append_enum(list, tmp, output_label, enum_idx, 0, 0, 0); @@ -1547,8 +1547,8 @@ static int create_string_list_rdb_entry_int( goto error; attr.i = 0; - tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + tmp = (char*)malloc(path_size); + str = (char*)malloc(path_size); tmp[0] = str[0] = '\0'; str_len += strlen(label) + 1; @@ -1654,10 +1654,12 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu, snprintf(crc_str, sizeof(crc_str), "%08X", db_info_entry->crc32); if (!string_is_empty(db_info_entry->name)) - strlcpy(thumbnail_content, db_info_entry->name, sizeof(thumbnail_content)); + strlcpy(thumbnail_content, db_info_entry->name, + sizeof(thumbnail_content)); if (!string_is_empty(thumbnail_content)) - menu_driver_set_thumbnail_content(thumbnail_content, sizeof(thumbnail_content)); + menu_driver_set_thumbnail_content(thumbnail_content, + sizeof(thumbnail_content)); menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL); menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL); @@ -3744,19 +3746,16 @@ static unsigned menu_displaylist_parse_cores( if (type == FILE_TYPE_CORE) { - char *core_path = (char*) - malloc(PATH_MAX_LENGTH * sizeof(char)); - char *display_name = (char*) - malloc(PATH_MAX_LENGTH * sizeof(char)); + size_t path_size = PATH_MAX_LENGTH * sizeof(char); + char *core_path = (char*)malloc(path_size); + char *display_name = (char*)malloc(path_size); core_path[0] = display_name[0] = '\0'; - fill_pathname_join(core_path, dir, path, - PATH_MAX_LENGTH * sizeof(char)); + fill_pathname_join(core_path, dir, path, path_size); if (core_info_list_get_display_name(list, - core_path, display_name, - PATH_MAX_LENGTH * sizeof(char))) + core_path, display_name, path_size)) file_list_set_alt_at_offset(info->list, i, display_name); free(core_path); @@ -4280,19 +4279,22 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) #ifdef HAVE_LAKKA_SWITCH case DISPLAYLIST_SWITCH_CPU_PROFILE: { - runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true); - + unsigned i; + char text[PATH_MAX_LENGTH]; char current_profile[PATH_MAX_LENGTH]; + FILE *profile = NULL; + const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]); + + runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true); - FILE* profile = popen("cpu-profile get", "r"); + profile = popen("cpu-profile get", "r"); fgets(current_profile, PATH_MAX_LENGTH, profile); pclose(profile); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - char text[PATH_MAX_LENGTH]; - - snprintf(text, sizeof(text), "Current profile : %s", current_profile); + snprintf(text, sizeof(text), + "Current profile : %s", current_profile); menu_entries_append_enum(info->list, text, @@ -4300,24 +4302,21 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) 0, MENU_INFO_MESSAGE, 0, 0); - const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]); - - - for (int i = 0; i < profiles_count; i++) + for (i = 0; i < profiles_count; i++) { - char* profile = SWITCH_CPU_PROFILES[i]; - char* speed = SWITCH_CPU_SPEEDS[i]; - + char* profile = SWITCH_CPU_PROFILES[i]; + char* speed = SWITCH_CPU_SPEEDS[i]; + char title[PATH_MAX_LENGTH] = {0}; - + snprintf(title, sizeof(title), "%s (%s)", profile, speed); - - menu_entries_append_enum(info->list, - title, - "", - 0, MENU_SET_SWITCH_CPU_PROFILE, 0, i); - - } + + menu_entries_append_enum(info->list, + title, + "", + 0, MENU_SET_SWITCH_CPU_PROFILE, 0, i); + + } info->need_push = true; info->need_refresh = true; @@ -4327,18 +4326,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) } case DISPLAYLIST_SWITCH_GPU_PROFILE: { + unsigned i; + char text[PATH_MAX_LENGTH]; + char current_profile[PATH_MAX_LENGTH]; + FILE *profile = NULL; + const size_t profiles_count = sizeof(SWITCH_GPU_PROFILES)/sizeof(SWITCH_GPU_PROFILES[1]); + runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true); - char current_profile[PATH_MAX_LENGTH]; - - FILE* profile = popen("gpu-profile get", "r"); + profile = popen("gpu-profile get", "r"); fgets(current_profile, PATH_MAX_LENGTH, profile); pclose(profile); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - char text[PATH_MAX_LENGTH]; - snprintf(text, sizeof(text), "Current profile : %s", current_profile); menu_entries_append_enum(info->list, @@ -4347,22 +4348,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) 0, MENU_INFO_MESSAGE, 0, 0); - const size_t profiles_count = sizeof(SWITCH_GPU_PROFILES)/sizeof(SWITCH_GPU_PROFILES[1]); - for (int i = 0; i < profiles_count; i++) + for (i = 0; i < profiles_count; i++) { - char* profile = SWITCH_GPU_PROFILES[i]; - char* speed = SWITCH_GPU_SPEEDS[i]; - + char* profile = SWITCH_GPU_PROFILES[i]; + char* speed = SWITCH_GPU_SPEEDS[i]; char title[PATH_MAX_LENGTH] = {0}; - + snprintf(title, sizeof(title), "%s (%s)", profile, speed); - - menu_entries_append_enum(info->list, - title, - "", - 0, MENU_SET_SWITCH_GPU_PROFILE, 0, i); - } + + menu_entries_append_enum(info->list, + title, + "", + 0, MENU_SET_SWITCH_GPU_PROFILE, 0, i); + } info->need_push = true; info->need_refresh = true; @@ -4372,26 +4371,27 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) } case DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL: { - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - - const size_t brightness_count = sizeof(SWITCH_BRIGHTNESS)/sizeof(SWITCH_BRIGHTNESS[1]); - - for (int i = 0; i < brightness_count; i++) - { - char title[PATH_MAX_LENGTH] = {0}; - - snprintf(title, sizeof(title), "Set to %d%%", SWITCH_BRIGHTNESS[i]); - - menu_entries_append_enum(info->list, - title, - "", - 0, MENU_SET_SWITCH_BRIGHTNESS, 0, i); + unsigned i; + const size_t brightness_count = sizeof(SWITCH_BRIGHTNESS)/sizeof(SWITCH_BRIGHTNESS[1]); + + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + for (i = 0; i < brightness_count; i++) + { + char title[PATH_MAX_LENGTH] = {0}; + + snprintf(title, sizeof(title), "Set to %d%%", SWITCH_BRIGHTNESS[i]); + + menu_entries_append_enum(info->list, + title, + "", + 0, MENU_SET_SWITCH_BRIGHTNESS, 0, i); } - + info->need_push = true; info->need_refresh = true; info->need_clear = true; - + break; } #endif From b46ce0dec95e60edfedb298019c3da01dd8e8186 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 04:36:53 +0200 Subject: [PATCH 0297/1292] Buildfix --- menu/menu_displaylist.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 37d79a3d99..5c1ff8abaa 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -179,13 +179,12 @@ enum menu_displaylist_ctl_state DISPLAYLIST_CORE_CONTENT, DISPLAYLIST_CORE_CONTENT_DIRS, DISPLAYLIST_CORE_CONTENT_DIRS_SUBDIR, - DISPLAYLIST_PENDING_CLEAR, - #ifdef HAVE_LAKKA_SWITCH DISPLAYLIST_SWITCH_GPU_PROFILE, DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL, DISPLAYLIST_SWITCH_CPU_PROFILE, #endif + DISPLAYLIST_PENDING_CLEAR }; typedef struct menu_displaylist_info From a31cf3c868fbead9fb0ca425e73a49f05c128e99 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 04:49:40 +0200 Subject: [PATCH 0298/1292] Bake in MD5 --- Makefile.common | 3 +-- griffin/griffin.c | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile.common b/Makefile.common index dbd0cac7e0..bc1ea2b9f9 100644 --- a/Makefile.common +++ b/Makefile.common @@ -252,6 +252,7 @@ OBJ += frontend/frontend.o \ $(LIBRETRO_COMM_DIR)/audio/resampler/drivers/sinc_resampler.o \ $(LIBRETRO_COMM_DIR)/audio/resampler/drivers/nearest_resampler.o \ $(LIBRETRO_COMM_DIR)/audio/resampler/drivers/null_resampler.o \ + $(LIBRETRO_COMM_DIR)/utils/md5.o \ location/drivers/nulllocation.o \ camera/drivers/nullcamera.o \ wifi/drivers/nullwifi.o \ @@ -1624,8 +1625,6 @@ ifeq ($(HAVE_NETWORKING), 1) cheevos/var.o \ cheevos/cond.o - OBJ += \ - $(LIBRETRO_COMM_DIR)/utils/md5.o ifeq ($(HAVE_LUA), 1) DEFINES += -DHAVE_LUA \ diff --git a/griffin/griffin.c b/griffin/griffin.c index 7dd8499911..30d8c7718a 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -181,9 +181,7 @@ ACHIEVEMENTS /*============================================================ MD5 ============================================================ */ -#if defined(HAVE_CHEEVOS) || (defined(HAVE_HTTPSERVER) && defined(HAVE_ZLIB)) #include "../libretro-common/utils/md5.c" -#endif /*============================================================ CHEATS From 4ed151fb35c2d954562e1377f641996b59f3db0e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 05:30:50 +0200 Subject: [PATCH 0299/1292] Cleanups - don't set core profile bit immediately --- dynamic.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/dynamic.c b/dynamic.c index 73e593298d..99030368ca 100644 --- a/dynamic.c +++ b/dynamic.c @@ -955,16 +955,8 @@ static bool dynamic_request_hw_context(enum retro_hw_context_type type, break; case RETRO_HW_CONTEXT_OPENGL_CORE: - { - gfx_ctx_flags_t flags; - flags.flags = 0; - BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); - - video_context_driver_set_flags(&flags); - - RARCH_LOG("Requesting core OpenGL context (%u.%u).\n", - major, minor); - } + RARCH_LOG("Requesting core OpenGL context (%u.%u).\n", + major, minor); break; #endif @@ -1374,6 +1366,15 @@ bool rarch_environment_cb(unsigned cmd, void *data) if (!dynamic_verify_hw_context(cb->context_type, cb->version_minor, cb->version_major)) return false; + if (cb->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) + { + gfx_ctx_flags_t flags; + flags.flags = 0; + BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); + + video_context_driver_set_flags(&flags); + } + cb->get_current_framebuffer = video_driver_get_current_framebuffer; cb->get_proc_address = video_driver_get_proc_address; From 641d593216bae59282971a7c41d4d00e6c55f4e9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 05:32:00 +0200 Subject: [PATCH 0300/1292] Add note --- dynamic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dynamic.c b/dynamic.c index 99030368ca..81a03dd2a1 100644 --- a/dynamic.c +++ b/dynamic.c @@ -955,6 +955,8 @@ static bool dynamic_request_hw_context(enum retro_hw_context_type type, break; case RETRO_HW_CONTEXT_OPENGL_CORE: + /* TODO/FIXME - we should do a check here to see if + * the requested core GL version is supported */ RARCH_LOG("Requesting core OpenGL context (%u.%u).\n", major, minor); break; From f53e1ca4b18fa0339144eb8c4150fa3a86de1dca Mon Sep 17 00:00:00 2001 From: Sven <40953353+RetroSven@users.noreply.github.com> Date: Wed, 10 Oct 2018 09:15:46 -0400 Subject: [PATCH 0301/1292] fix new rumble types ; increase max displayed cheats to 6000 --- libretro-common/file/config_file.c | 49 +++--- libretro-common/include/file/config_file.h | 13 ++ managers/cheat_manager.c | 190 ++++++++++++--------- managers/cheat_manager.h | 5 +- menu/menu_driver.h | 2 +- menu/menu_setting.c | 2 +- 6 files changed, 159 insertions(+), 102 deletions(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 0a63e7781a..7dd671b662 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -66,7 +66,7 @@ struct config_include_list }; static config_file_t *config_file_new_internal( - const char *path, unsigned depth); + const char *path, unsigned depth, config_file_cb_t *cb); static int config_sort_compare_func(struct config_entry_list *a, struct config_entry_list *b) @@ -267,7 +267,7 @@ static void add_child_list(config_file_t *parent, config_file_t *child) parent->tail = NULL; } -static void add_sub_conf(config_file_t *conf, char *path) +static void add_sub_conf(config_file_t *conf, char *path, config_file_cb_t *cb) { char real_path[PATH_MAX_LENGTH]; config_file_t *sub_conf = NULL; @@ -314,7 +314,7 @@ static void add_sub_conf(config_file_t *conf, char *path) #endif sub_conf = (config_file_t*) - config_file_new_internal(real_path, conf->include_depth + 1); + config_file_new_internal(real_path, conf->include_depth + 1, cb); if (!sub_conf) return; @@ -324,7 +324,7 @@ static void add_sub_conf(config_file_t *conf, char *path) } static bool parse_line(config_file_t *conf, - struct config_entry_list *list, char *line) + struct config_entry_list *list, char *line, config_file_cb_t *cb) { char *comment = NULL; char *key_tmp = NULL; @@ -351,7 +351,7 @@ static bool parse_line(config_file_t *conf, if (conf->include_depth >= MAX_INCLUDE_DEPTH) fprintf(stderr, "!!! #include depth exceeded for config. Might be a cycle.\n"); else - add_sub_conf(conf, path); + add_sub_conf(conf, path, cb); free(path); } goto error; @@ -396,18 +396,19 @@ error: } static config_file_t *config_file_new_internal( - const char *path, unsigned depth) + const char *path, unsigned depth, config_file_cb_t *cb) { RFILE *file = NULL; struct config_file *conf = (struct config_file*)malloc(sizeof(*conf)); if (!conf) return NULL; - conf->path = NULL; - conf->entries = NULL; - conf->tail = NULL; - conf->includes = NULL; - conf->include_depth = 0; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; + conf->include_depth = 0; + conf->guaranteed_no_duplicates = false ; if (!path || !*path) return conf; @@ -455,7 +456,7 @@ static config_file_t *config_file_new_internal( continue; } - if (*line && parse_line(conf, list, line)) + if (*line && parse_line(conf, list, line, cb)) { if (conf->entries) conf->tail->next = list; @@ -463,6 +464,9 @@ static config_file_t *config_file_new_internal( conf->entries = list; conf->tail = list; + + if (cb != NULL && list->key != NULL && list->value != NULL) + cb->config_file_new_entry_cb(list->key, list->value) ; } free(line); @@ -551,11 +555,12 @@ config_file_t *config_file_new_from_string(const char *from_string) if (!from_string) return conf; - conf->path = NULL; - conf->entries = NULL; - conf->tail = NULL; - conf->includes = NULL; - conf->include_depth = 0; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; + conf->include_depth = 0; + conf->guaranteed_no_duplicates = false ; lines = string_split(from_string, "\n"); if (!lines) @@ -580,7 +585,7 @@ config_file_t *config_file_new_from_string(const char *from_string) if (line && conf) { - if (*line && parse_line(conf, list, line)) + if (*line && parse_line(conf, list, line, NULL)) { if (conf->entries) conf->tail->next = list; @@ -600,9 +605,13 @@ config_file_t *config_file_new_from_string(const char *from_string) return conf; } +config_file_t *config_file_new_with_callback(const char *path, config_file_cb_t *cb) +{ + return config_file_new_internal(path, 0, cb); +} config_file_t *config_file_new(const char *path) { - return config_file_new_internal(path, 0); + return config_file_new_internal(path, 0, NULL); } static struct config_entry_list *config_get_entry(const config_file_t *conf, @@ -834,7 +843,7 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in) void config_set_string(config_file_t *conf, const char *key, const char *val) { struct config_entry_list *last = conf->entries; - struct config_entry_list *entry = config_get_entry(conf, key, &last); + struct config_entry_list *entry = conf->guaranteed_no_duplicates?NULL:config_get_entry(conf, key, &last); if (entry && !entry->readonly) { diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index 97fca031a3..e55430472d 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -58,6 +58,7 @@ struct config_file struct config_entry_list *entries; struct config_entry_list *tail; unsigned include_depth; + bool guaranteed_no_duplicates; struct config_include_list *includes; }; @@ -65,6 +66,13 @@ struct config_file typedef struct config_file config_file_t; +struct config_file_cb +{ + void (*config_file_new_entry_cb)(char*, char*); +}; + +typedef struct config_file_cb config_file_cb_t ; + /* Config file format * - # are treated as comments. Rest of the line is ignored. * - Format is: key = value. There can be as many spaces as you like in-between. @@ -79,6 +87,11 @@ typedef struct config_file config_file_t; * NULL path will create an empty config file. */ config_file_t *config_file_new(const char *path); +/* Loads a config file. Returns NULL if file doesn't exist. + * NULL path will create an empty config file. + * Includes cb callbacks to run custom code during config file processing.*/ +config_file_t *config_file_new_with_callback(const char *path, config_file_cb_t *cb); + /* Load a config file from a string. */ config_file_t *config_file_new_from_string(const char *from_string); diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 73971f69d2..d6cc891414 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -171,6 +172,8 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw if (!conf) return false; + conf->guaranteed_no_duplicates = true ; + config_set_int(conf, "cheats", cheat_manager_state.size); for (i = 0; i < cheat_manager_state.size; i++) @@ -303,39 +306,118 @@ static void cheat_manager_new(unsigned size) return ; } +void cheat_manager_load_cb_first_pass(char *key, char *value) +{ + errno = 0 ; + + if (string_is_equal(key, "cheats")) + { + cheat_manager_state.loading_cheat_size = (unsigned)strtoul(value, NULL, 0); + + if (errno != 0) + cheat_manager_state.loading_cheat_size = 0 ; + } +} + +void cheat_manager_load_cb_second_pass(char *key, char *value) +{ + char cheat_num_str[20] ; + unsigned cheat_num ; + unsigned cheat_idx ; + int idx = 0 ; + int key_length ; + errno = 0 ; + + if (strncmp(key, "cheat", 5) != 0) + return ; + + idx = 5 ; + key_length = strlen(key) ; + + while (idx < key_length && key[idx] >= '0' && key[idx] <= '9' && idx < 24) + { + cheat_num_str[idx-5] = key[idx] ; + idx++ ; + } + + cheat_num_str[idx-5] = '\0' ; + + cheat_num = (unsigned)strtoul(cheat_num_str, NULL, 0); ; + + if (cheat_num+cheat_manager_state.loading_cheat_offset >= cheat_manager_state.size) + return ; + + key = key+idx+1 ; + + cheat_idx = cheat_num+cheat_manager_state.loading_cheat_offset ; + + if (string_is_equal(key, "address")) + cheat_manager_state.cheats[cheat_idx].address = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "address_bit_position")) + cheat_manager_state.cheats[cheat_idx].address_mask = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "big_endian")) + cheat_manager_state.cheats[cheat_idx].big_endian = (string_is_equal(value,"true") || string_is_equal(value,"1")); + else if (string_is_equal(key, "cheat_type")) + cheat_manager_state.cheats[cheat_idx].cheat_type = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "code")) + cheat_manager_state.cheats[cheat_idx].code = strdup(value) ; + else if (string_is_equal(key, "desc")) + cheat_manager_state.cheats[cheat_idx].desc = strdup(value) ; + else if (string_is_equal(key, "enable")) + cheat_manager_state.cheats[cheat_idx].state = (string_is_equal(value,"true") || string_is_equal(value,"1")); + else if (string_is_equal(key, "handler")) + cheat_manager_state.cheats[cheat_idx].handler = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "memory_search_size")) + cheat_manager_state.cheats[cheat_idx].memory_search_size = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "repeat_add_to_address")) + cheat_manager_state.cheats[cheat_idx].repeat_add_to_address = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "repeat_add_to_value")) + cheat_manager_state.cheats[cheat_idx].repeat_add_to_value = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "repeat_count")) + cheat_manager_state.cheats[cheat_idx].repeat_count = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_port")) + cheat_manager_state.cheats[cheat_idx].rumble_port = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_primary_duration")) + cheat_manager_state.cheats[cheat_idx].rumble_primary_duration = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_primary_strength")) + cheat_manager_state.cheats[cheat_idx].rumble_primary_strength = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_secondary_duration")) + cheat_manager_state.cheats[cheat_idx].rumble_secondary_duration = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_secondary_strength")) + cheat_manager_state.cheats[cheat_idx].rumble_secondary_strength = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_type")) + cheat_manager_state.cheats[cheat_idx].rumble_type = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_value")) + cheat_manager_state.cheats[cheat_idx].rumble_value = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "value")) + cheat_manager_state.cheats[cheat_idx].value = (unsigned)strtoul(value, NULL, 0); + +} + bool cheat_manager_load(const char *path, bool append) { unsigned cheats = 0, i; - config_file_t *conf = config_file_new(path); + config_file_cb_t cb ; + cb.config_file_new_entry_cb = cheat_manager_load_cb_first_pass ; + config_file_t *conf = NULL ; unsigned orig_size ; - unsigned int* data_ptrs[16] = { NULL}; - char* keys[16] = { - "cheat%u_handler", - "cheat%u_memory_search_size", - "cheat%u_cheat_type", - "cheat%u_value", - "cheat%u_address", - "cheat%u_address_bit_position", - "cheat%u_rumble_type", - "cheat%u_rumble_value", - "cheat%u_rumble_port", - "cheat%u_rumble_primary_strength", - "cheat%u_rumble_primary_duration", - "cheat%u_rumble_secondary_strength", - "cheat%u_rumble_secondary_duration", - "cheat%u_repeat_count", - "cheat%u_repeat_add_to_value", - "cheat%u_repeat_add_to_address", - }; + + cheat_manager_state.loading_cheat_size = 0 ; + + conf = config_file_new_with_callback(path, &cb); if (!conf) return false; - config_get_uint(conf, "cheats", &cheats); + cheats = cheat_manager_state.loading_cheat_size ; if (cheats == 0) goto error; + config_file_free(conf) ; + conf = NULL ; + + cheat_manager_alloc_if_empty() ; if ( append ) @@ -359,75 +441,25 @@ bool cheat_manager_load(const char *path, bool append) cheat_manager_new(cheats); } + for (i = orig_size; i < cheats; i++) { - unsigned j; - char desc_key[256]; - char code_key[256]; - char enable_key[256]; - char endian_key[256]; - char *tmp = NULL; - bool tmp_bool = false; - - data_ptrs[0] = &cheat_manager_state.cheats[i].handler; - data_ptrs[1] = &cheat_manager_state.cheats[i].memory_search_size; - data_ptrs[2] = &cheat_manager_state.cheats[i].cheat_type; - data_ptrs[3] = &cheat_manager_state.cheats[i].value; - data_ptrs[4] = &cheat_manager_state.cheats[i].address; - data_ptrs[5] = &cheat_manager_state.cheats[i].address_mask; - data_ptrs[6] = &cheat_manager_state.cheats[i].rumble_type; - data_ptrs[7] = &cheat_manager_state.cheats[i].rumble_value; - data_ptrs[8] = &cheat_manager_state.cheats[i].rumble_port; - data_ptrs[9] = &cheat_manager_state.cheats[i].rumble_primary_strength; - data_ptrs[10] = &cheat_manager_state.cheats[i].rumble_primary_duration; - data_ptrs[11] = &cheat_manager_state.cheats[i].rumble_secondary_strength; - data_ptrs[12] = &cheat_manager_state.cheats[i].rumble_secondary_duration; - data_ptrs[13] = &cheat_manager_state.cheats[i].repeat_count; - data_ptrs[14] = &cheat_manager_state.cheats[i].repeat_add_to_value; - data_ptrs[15] = &cheat_manager_state.cheats[i].repeat_add_to_address; - - endian_key[0] = desc_key[0] = code_key[0] = enable_key[0] = '\0'; - - snprintf(desc_key, sizeof(desc_key), "cheat%u_desc", i-orig_size); - snprintf(code_key, sizeof(code_key), "cheat%u_code", i-orig_size); - snprintf(enable_key, sizeof(enable_key), "cheat%u_enable", i-orig_size); - snprintf(endian_key, sizeof(endian_key), "cheat%u_endian", i-orig_size); - cheat_manager_state.cheats[i].idx = i ; - cheat_manager_state.cheats[i].desc = NULL ; cheat_manager_state.cheats[i].code = NULL ; cheat_manager_state.cheats[i].state = false ; cheat_manager_state.cheats[i].big_endian = false ; - - if (config_get_string(conf, desc_key, &tmp) && !string_is_empty(tmp)) - cheat_manager_state.cheats[i].desc = strdup(tmp) ; - - if (config_get_string(conf, code_key, &tmp) && !string_is_empty(tmp)) - cheat_manager_state.cheats[i].code = strdup(tmp) ; - - if (config_get_bool(conf, enable_key, &tmp_bool)) - cheat_manager_state.cheats[i].state = tmp_bool; - - if (config_get_bool(conf, endian_key, &tmp_bool)) - cheat_manager_state.cheats[i].big_endian = tmp_bool; - - if (tmp) - free(tmp); - cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ; cheat_manager_state.cheats[i].memory_search_size = 3; - for (j = 0 ; j < 16 ; j++ ) - { - char key[50] ; - unsigned val = 0; - snprintf(key, sizeof(key), keys[j], i-orig_size); - - if ( config_get_uint(conf, key, &val)) - *(data_ptrs[j]) = val ; - } } + cheat_manager_state.loading_cheat_offset = orig_size ; + cb.config_file_new_entry_cb = cheat_manager_load_cb_second_pass ; + conf = config_file_new_with_callback(path, &cb); + + if (!conf) + return false; + config_file_free(conf); return true; diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index 917ea711b8..1e0737bcbc 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -77,7 +77,8 @@ enum cheat_rumble_type RUMBLE_TYPE_LT_VALUE, RUMBLE_TYPE_GT_VALUE, RUMBLE_TYPE_INCREASE_BY_VALUE, - RUMBLE_TYPE_DECREASE_BY_VALUE + RUMBLE_TYPE_DECREASE_BY_VALUE, + RUMBLE_TYPE_END_LIST }; /* Some codes are ridiculously large - over 10000 bytes */ @@ -178,6 +179,8 @@ struct cheat_manager unsigned browse_address; char working_desc[CHEAT_DESC_SCRATCH_SIZE] ; char working_code[CHEAT_CODE_SCRATCH_SIZE] ; + unsigned int loading_cheat_size; + unsigned int loading_cheat_offset; }; typedef struct cheat_manager cheat_manager_t; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index a48402c62b..d103367302 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -45,7 +45,7 @@ RETRO_BEGIN_DECLS #endif #ifndef MAX_CHEAT_COUNTERS -#define MAX_CHEAT_COUNTERS 100 +#define MAX_CHEAT_COUNTERS 6000 #endif #define MENU_SETTINGS_CORE_INFO_NONE 0xffff diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1a4d06d20f..7c5dff5bf6 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4670,7 +4670,7 @@ static bool setting_append_list( config_uint_cbs(cheat_manager_state.working_cheat.rumble_type, CHEAT_RUMBLE_TYPE, setting_uint_action_left_default,setting_uint_action_right_default, MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED,&setting_get_string_representation_uint_as_enum, - RUMBLE_TYPE_DISABLED,RUMBLE_TYPE_GT_VALUE,1) ; + RUMBLE_TYPE_DISABLED,RUMBLE_TYPE_END_LIST-1,1) ; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.rumble_value, CHEAT_RUMBLE_VALUE, From b9699f4780ff85896cabecec33dd4ea25cf85470 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 10 Oct 2018 09:58:49 -0400 Subject: [PATCH 0302/1292] gdi: texture load support, fix menu text alignment, support multi-line messages --- gfx/common/gdi_common.h | 14 ++++ gfx/common/win32_common.c | 8 +- gfx/drivers/gdi_gfx.c | 66 +++++++++++++++- gfx/drivers_font/gdi_font.c | 100 ++++++++++++++++++------ menu/drivers_display/menu_display_gdi.c | 62 ++++++++++++++- 5 files changed, 218 insertions(+), 32 deletions(-) diff --git a/gfx/common/gdi_common.h b/gfx/common/gdi_common.h index 0f0b971018..ddb33b3fb3 100644 --- a/gfx/common/gdi_common.h +++ b/gfx/common/gdi_common.h @@ -27,6 +27,7 @@ typedef struct gdi #endif HDC winDC; HDC memDC; + HDC texDC; HBITMAP bmp; HBITMAP bmp_old; unsigned video_width; @@ -35,4 +36,17 @@ typedef struct gdi unsigned screen_height; } gdi_t; +typedef struct gdi_texture +{ + int width; + int height; + int active_width; + int active_height; + + enum texture_filter_type type; + void* data; + HBITMAP bmp; + HBITMAP bmp_old; +} gdi_texture_t; + #endif diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 69f82746f6..b580a1bcb0 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -837,18 +837,18 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, /* draw menu contents behind a gradient background */ if (gdi && gdi->memDC) { - RECT rect; + /*RECT rect; HBRUSH brush = CreateSolidBrush(RGB(1,81,127)); - GetClientRect(hwnd, &rect); + GetClientRect(hwnd, &rect);*/ StretchBlt(gdi->winDC, 0, 0, gdi->screen_width, gdi->screen_height, gdi->memDC, 0, 0, gdi->video_width, gdi->video_height, SRCCOPY); - FillRect(gdi->memDC, &rect, brush); - DeleteObject(brush); + /*FillRect(gdi->memDC, &rect, brush); + DeleteObject(brush);*/ } } else diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index dae5a1b091..6b820c1e18 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -16,6 +16,7 @@ */ #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -192,6 +193,9 @@ static bool gdi_gfx_frame(void *data, const void *frame, HWND hwnd = win32_get_window(); BITMAPINFO *info; + /* FIXME */ + video_info->xmb_shadows_enable = false; + if (!frame || !frame_width || !frame_height) return true; @@ -414,9 +418,16 @@ static void gdi_gfx_free(void *data) if (!gdi) return; + if (gdi->bmp) + DeleteObject(gdi->bmp); + + if (gdi->texDC) + { + DeleteDC(gdi->texDC); + gdi->texDC = 0; + } if (gdi->memDC) { - DeleteObject(gdi->bmp); DeleteDC(gdi->memDC); gdi->memDC = 0; } @@ -532,12 +543,61 @@ static void gdi_set_video_mode(void *data, unsigned width, unsigned height, video_context_driver_set_video_mode(&mode); } +static uintptr_t gdi_load_texture(void *video_data, void *data, + bool threaded, enum texture_filter_type filter_type) +{ + struct texture_image *image = (struct texture_image*)data; + int size = image->width * image->height * sizeof(uint32_t); + gdi_texture_t *texture = NULL; + void *tmpdata = NULL; + + if (!image || image->width > 2048 || image->height > 2048) + return 0; + + texture = calloc(1, sizeof(*texture)); + texture->width = image->width; + texture->height = image->height; + texture->active_width = image->width; + texture->active_height = image->height; + texture->data = calloc(1, texture->width * texture->height * sizeof(uint32_t)); + texture->type = filter_type; + + if (!texture->data) + { + free(texture); + return 0; + } + + memcpy(texture->data, image->pixels, texture->width * texture->height * sizeof(uint32_t)); + + return (uintptr_t)texture; +} + +static void gdi_unload_texture(void *data, uintptr_t handle) +{ + struct gdi_texture *texture = (struct gdi_texture*)handle; + + if (!texture) + return; + + if (texture->data) + free(texture->data); + + if (texture->bmp) + { + DeleteObject(texture->bmp); + texture->bmp = NULL; + } + + free(texture); +} + static const video_poke_interface_t gdi_poke_interface = { NULL, /* get_flags */ NULL, /* set_coords */ NULL, /* set_mvp */ - NULL, - NULL, + gdi_load_texture, + gdi_unload_texture, gdi_set_video_mode, win32_get_refresh_rate, NULL, diff --git a/gfx/drivers_font/gdi_font.c b/gfx/drivers_font/gdi_font.c index 1c37ddd5ed..090ab9c9d8 100644 --- a/gfx/drivers_font/gdi_font.c +++ b/gfx/drivers_font/gdi_font.c @@ -18,6 +18,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -85,65 +86,116 @@ static void gdi_render_msg( void *data, const char *msg, const struct font_params *params) { - float x, y, scale; - unsigned newX, newY, len; + float x, y, scale, drop_mod, alpha, drop_alpha; + int i, drop_x, drop_y, msg_strlen; + unsigned newX, newY, newDropX, newDropY; unsigned align; - unsigned red; - unsigned green; - unsigned blue; + unsigned red, green, blue; + unsigned drop_red, drop_green, drop_blue; gdi_raster_t *font = (gdi_raster_t*)data; unsigned width = video_info->width; unsigned height = video_info->height; + SIZE textSize = {0}; + struct string_list *msg_list = NULL; if (!font || string_is_empty(msg) || !font->gdi) return; if (params) { - x = params->x; - y = params->y; - scale = params->scale; - align = params->text_align; + x = params->x; + y = params->y; + drop_x = params->drop_x; + drop_y = params->drop_y; + drop_mod = params->drop_mod; + drop_alpha = params->drop_alpha; + scale = params->scale; + align = params->text_align; - red = FONT_COLOR_GET_RED(params->color); - green = FONT_COLOR_GET_GREEN(params->color); - blue = FONT_COLOR_GET_BLUE(params->color); + red = FONT_COLOR_GET_RED(params->color); + green = FONT_COLOR_GET_GREEN(params->color); + blue = FONT_COLOR_GET_BLUE(params->color); + alpha = FONT_COLOR_GET_ALPHA(params->color); } else { - x = video_info->font_msg_pos_x; - y = video_info->font_msg_pos_y; - scale = 1.0f; - align = TEXT_ALIGN_LEFT; - red = video_info->font_msg_color_r * 255.0f; - green = video_info->font_msg_color_g * 255.0f; - blue = video_info->font_msg_color_b * 255.0f; + x = video_info->font_msg_pos_x; + y = video_info->font_msg_pos_y; + drop_x = -2; + drop_y = -2; + drop_mod = 0.3f; + drop_alpha = 1.0f; + scale = 1.0f; + align = TEXT_ALIGN_LEFT; + red = video_info->font_msg_color_r * 255.0f; + green = video_info->font_msg_color_g * 255.0f; + blue = video_info->font_msg_color_b * 255.0f; + alpha = 255; } - len = utf8len(msg); + msg_strlen = strlen(msg); + + GetTextExtentPoint32(font->gdi->memDC, msg, msg_strlen, &textSize); switch (align) { case TEXT_ALIGN_LEFT: newX = x * width * scale; + newDropX = drop_x * width * scale; break; case TEXT_ALIGN_RIGHT: - newX = (x * width * scale) - len; + newX = (x * width * scale) - textSize.cx; + newDropX = (drop_x * width * scale) - textSize.cx; break; case TEXT_ALIGN_CENTER: - newX = (x * width * scale) - (len / 2); + newX = (x * width * scale) - (textSize.cx / 2); + newDropX = (drop_x * width * scale) - (textSize.cx / 2); break; default: newX = 0; + newDropX = 0; break; } - newY = height - (y * height * scale); + newY = height - (y * height * scale) - textSize.cy; + newDropY = height - (drop_y * height * scale) - textSize.cy; font->gdi->bmp_old = (HBITMAP)SelectObject(font->gdi->memDC, font->gdi->bmp); + SetBkMode(font->gdi->memDC, TRANSPARENT); + + msg_list = string_split(msg, "\n"); + + if (drop_x || drop_y) + { + float dark_alpha = drop_alpha; + drop_red = red * drop_mod * dark_alpha; + drop_green = green * drop_mod * dark_alpha; + drop_blue = blue * drop_mod * dark_alpha; + + SetTextColor(font->gdi->memDC, RGB(drop_red, drop_green, drop_blue)); + + if (msg_list) + { + for (i = 0; i < msg_list->size; i++) + { + TextOut(font->gdi->memDC, newDropX, newDropY + (textSize.cy * i), msg_list->elems[i].data, utf8len(msg_list->elems[i].data)); + } + } + } + SetTextColor(font->gdi->memDC, RGB(red, green, blue)); - TextOut(font->gdi->memDC, newX, newY, msg, len); + + if (msg_list) + { + for (i = 0; i < msg_list->size; i++) + { + TextOut(font->gdi->memDC, newX, newY + (textSize.cy * i), msg_list->elems[i].data, utf8len(msg_list->elems[i].data)); + } + + string_list_free(msg_list); + } + SelectObject(font->gdi->memDC, font->gdi->bmp_old); } diff --git a/menu/drivers_display/menu_display_gdi.c b/menu/drivers_display/menu_display_gdi.c index 95e41b7b28..552404b069 100644 --- a/menu/drivers_display/menu_display_gdi.c +++ b/menu/drivers_display/menu_display_gdi.c @@ -16,17 +16,20 @@ #include +#include #include #include #include "../../config.def.h" #include "../../gfx/font_driver.h" #include "../../gfx/video_driver.h" +#include "../../verbosity.h" #include "../menu_driver.h" #if defined(_WIN32) && !defined(_XBOX) #include "../../gfx/common/win32_common.h" +#include "../../gfx/common/gdi_common.h" #endif static void *menu_display_gdi_get_default_mvp(video_frame_info_t *video_info) @@ -45,6 +48,63 @@ static void menu_display_gdi_blend_end(video_frame_info_t *video_info) static void menu_display_gdi_draw(menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) { + struct gdi_texture *texture = NULL; + gdi_t *gdi = (gdi_t*)video_driver_get_ptr(false); + BITMAPINFO info = {0}; + + if (!gdi || !draw || draw->x < 0 || draw->y < 0 || draw->width <= 1 || draw->height <= 1) + return; + + texture = (struct gdi_texture*)draw->texture; + + if (!texture || texture->width <= 1 || texture->height <= 1) + return; + + info.bmiHeader.biBitCount = 32; + info.bmiHeader.biWidth = texture->width; + info.bmiHeader.biHeight = -texture->height; + info.bmiHeader.biPlanes = 1; + info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + info.bmiHeader.biSizeImage = 0; + info.bmiHeader.biCompression = BI_RGB; + + if (gdi->memDC) + { + BLENDFUNCTION blend = {0}; + + if (!gdi->texDC) + gdi->texDC = CreateCompatibleDC(gdi->winDC); + + if (texture->bmp) + { + texture->bmp_old = SelectObject(gdi->texDC, texture->bmp); + } + else + { + /* scale texture data into a bitmap we can easily blit later */ + texture->bmp = CreateCompatibleBitmap(gdi->winDC, draw->width, draw->height); + texture->bmp_old = SelectObject(gdi->texDC, texture->bmp); + + StretchDIBits(gdi->texDC, 0, 0, draw->width, draw->height, 0, 0, texture->width, texture->height, texture->data, &info, DIB_RGB_COLORS, SRCCOPY); + } + + gdi->bmp_old = SelectObject(gdi->memDC, gdi->bmp); + + blend.BlendOp = AC_SRC_OVER; + blend.BlendFlags = 0; + blend.SourceConstantAlpha = 255;/*clamp_8bit(draw->coords->color[3] * 255.0f);*/ + blend.AlphaFormat = AC_SRC_ALPHA; + + AlphaBlend(gdi->memDC, draw->x, video_info->height - draw->height - draw->y, draw->width, draw->height, gdi->texDC, 0, 0, draw->width, draw->height, blend); + + /*TransparentBlt(gdi->memDC, draw->x, video_info->height - draw->height - draw->y, draw->width, draw->height, gdi->texDC, 0, 0, draw->width, draw->height, 0);*/ + + /* To draw without blending: */ + /*StretchBlt(gdi->memDC, draw->x, video_info->height - draw->height - draw->y, draw->width, draw->height, gdi->texDC, 0, 0, draw->width, draw->height, SRCCOPY);*/ + + SelectObject(gdi->memDC, gdi->bmp_old); + SelectObject(gdi->texDC, texture->bmp_old); + } } static void menu_display_gdi_draw_pipeline(menu_display_ctx_draw_t *draw, @@ -80,7 +140,7 @@ static bool menu_display_gdi_font_init_first( font_path, font_size, true, is_threaded, FONT_DRIVER_RENDER_GDI))) - return false; + return false; return true; } From 04cc18177181d1e022e6e353a9d11bd537d96966 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 16:18:29 +0200 Subject: [PATCH 0303/1292] Cleanups --- gfx/drivers_font/gdi_font.c | 7 ++----- managers/cheat_manager.c | 7 ++++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gfx/drivers_font/gdi_font.c b/gfx/drivers_font/gdi_font.c index 090ab9c9d8..2cb7e0e981 100644 --- a/gfx/drivers_font/gdi_font.c +++ b/gfx/drivers_font/gdi_font.c @@ -87,7 +87,8 @@ static void gdi_render_msg( const struct font_params *params) { float x, y, scale, drop_mod, alpha, drop_alpha; - int i, drop_x, drop_y, msg_strlen; + int drop_x, drop_y, msg_strlen; + unsigned i; unsigned newX, newY, newDropX, newDropY; unsigned align; unsigned red, green, blue; @@ -178,9 +179,7 @@ static void gdi_render_msg( if (msg_list) { for (i = 0; i < msg_list->size; i++) - { TextOut(font->gdi->memDC, newDropX, newDropY + (textSize.cy * i), msg_list->elems[i].data, utf8len(msg_list->elems[i].data)); - } } } @@ -189,9 +188,7 @@ static void gdi_render_msg( if (msg_list) { for (i = 0; i < msg_list->size; i++) - { TextOut(font->gdi->memDC, newX, newY + (textSize.cy * i), msg_list->elems[i].data, utf8len(msg_list->elems[i].data)); - } string_list_free(msg_list); } diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index d6cc891414..5a58463b6b 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -396,11 +396,12 @@ void cheat_manager_load_cb_second_pass(char *key, char *value) bool cheat_manager_load(const char *path, bool append) { + unsigned orig_size; unsigned cheats = 0, i; - config_file_cb_t cb ; + config_file_cb_t cb; + config_file_t *conf = NULL; + cb.config_file_new_entry_cb = cheat_manager_load_cb_first_pass ; - config_file_t *conf = NULL ; - unsigned orig_size ; cheat_manager_state.loading_cheat_size = 0 ; From 455d0d83f07718132cb495bcd9ac3636efb76851 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Wed, 10 Oct 2018 22:25:48 +0800 Subject: [PATCH 0304/1292] Update Simplified Chinese Localization --- intl/msg_hash_chs.h | 684 ++++++++++++++++++++++++++++---------------- 1 file changed, 440 insertions(+), 244 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 27e26619c4..cedf839410 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -188,7 +188,7 @@ MSG_HASH( "Cheevos 账户设置" /*FIXME:"Accounts Cheevos"*/ /*Should be fixed now, not sure though*/ ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME, + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME, "用户名" ) MSG_HASH( @@ -302,7 +302,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, - "SaveRAM自动保存间隔" + "游戏存档自动保存间隔" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, @@ -444,9 +444,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_HARDCORE_MODE_ENABLE, "专家模式" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LEADERBOARDS_ENABLE, + "排行榜" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_BADGES_ENABLE, + "成就奖章" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ACHIEVEMENTS, - "已解锁的成就:" + "已解锁的成就:" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY, @@ -468,6 +476,18 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY, "未锁定" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, + "硬核" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_VERBOSE_ENABLE, + "详细模式" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_AUTO_SCREENSHOT, + "自动截屏" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT, "关闭" @@ -578,7 +598,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DATABASE_SELECTION, MSG_HASH(MENU_ENUM_LABEL_VALUE_DELETE_ENTRY, "移除") MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES, - "选择文件并探测核心") /* TODO/FIXME - update */ + "选择文件并选择核心") /* TODO/FIXME - update */ MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, "<游戏内容文件夹>") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, @@ -598,7 +618,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_INDEX, MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, "光盘控制") MSG_HASH(MENU_ENUM_LABEL_VALUE_DONT_CARE, - "不关心") + "自动") MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST, "下载文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE, @@ -633,6 +653,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_SHOW, "显示帧率") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, "限制最大运行速度") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VRR_RUNLOOP_ENABLE, + "精确同步游戏帧数 (G-Sync, FreeSync)") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS, "帧率限制") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, @@ -879,6 +901,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, "显示图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, "在菜单中隐藏图层") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "在图层上显示控制器") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "显示控制器所在图层编号") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, "轮询类型行为") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, @@ -902,9 +928,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TOUCH_ENABLE, "启用触摸") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TURBO_ENABLE, - "TURBO开关") + "连发开关") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, - "Turbo区间") + "连发按键频率") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS, "输入用户 %u 的绑定") MSG_HASH(MENU_ENUM_LABEL_VALUE_LATENCY_SETTINGS, @@ -1009,6 +1035,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, /* TODO/FIXME - updat "菜单文件浏览器") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, "菜单线性过滤") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "水平动画") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, "菜单") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, @@ -1033,8 +1061,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NEAREST, "最近") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY, "在线游戏") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ALLOW_SLAVES, + "允许从属模式客户端") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, "在线游戏检查帧数") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "输入延迟帧") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "输入延迟帧范围") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, "在线游戏延迟帧数") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, @@ -1057,18 +1091,60 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NICKNAME, "用户名") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, "服务器密码") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_PUBLIC_ANNOUNCE, + "启用公共的在线游戏网络") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REQUIRE_SLAVES, + "只允许从属模式客户端") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REQUEST_DEVICE_I, + "请求设备 %u") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, "在线游戏设置") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG, + "模拟输入分配") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_MAX, + "最大") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_AVERAGE, + "平均" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL, + "数字输入分配" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_OR, + "共用" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_XOR, + "Grapple" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_VOTE, + "Vote" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NONE, + "无" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NO_PREFERENCE, + "不设置" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_START_AS_SPECTATOR, + "在线游戏旁观者模式" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_STATELESS_MODE, "联机无状态模式") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATE_PASSWORD, - "服务器围观的密码") + "服务器观战的密码") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATOR_MODE_ENABLE, "启用在线游戏旁观者") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_TCP_UDP_PORT, - "在线游戏TCP/UDP端口") + "在线游戏 TCP/UDP 端口") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_NAT_TRAVERSAL, - "联机NAT遍历") + "联机 NAT 遍历") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_CMD_ENABLE, "网络命令") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_CMD_PORT, @@ -1118,7 +1194,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, "没有找到设置。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, - "没有渲染器参数.") + "没有渲染器参数。") MSG_HASH(MENU_ENUM_LABEL_VALUE_OFF, "关") MSG_HASH(MENU_ENUM_LABEL_VALUE_ON, @@ -1132,7 +1208,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, "屏幕图层") MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS, - "Adjust Bezels and Onscreen controls") + "调整边框和屏幕图层按键显示") MSG_HASH(MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, "屏幕提示") MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, @@ -1158,7 +1234,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE, MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, "屏幕图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, - "使用PAL60模式") + "使用 PAL60 模式") MSG_HASH(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, "上一级文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO, @@ -1181,6 +1257,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PRESENT, "现在") MSG_HASH(MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, "隐私") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, + "MIDI 设置" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, "退出 RetroArch") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, @@ -1296,6 +1376,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, "启用回溯") MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, "回溯粒度") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE, + "回溯缓冲区大小 (MB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE_STEP, + "回溯缓冲区大小步长 (MB)" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, "回溯") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, @@ -1329,7 +1417,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, "即时存档文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, - "Savestate Thumbnails") + "即时存档缩略图") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, "保存当前配置") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, @@ -1369,13 +1457,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES, MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS, "渲染器效果") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, - "Ribbon") + "彩条效果") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, - "Ribbon (简化)") + "简易彩条效果") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SIMPLE_SNOW, - "Simple Snow") + "简易雪花效果") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW, - "Snow") + "雪花效果") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_ADVANCED_SETTINGS, "显示高级设置") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES, @@ -1384,6 +1472,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHUTDOWN, "关机") MSG_HASH(MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO, "慢动作倍率") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_AHEAD_ENABLED, + "提前运行以降低延迟") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_AHEAD_FRAMES, + "提前运行的帧数") MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE, "排序文件夹中的游戏存档") MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE, @@ -1556,18 +1648,52 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, /* TODO/FIXME - upd "启用多线程数据执行循环") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS, "缩略图") +MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_THUMBNAILS, + "左侧缩略图") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_VERTICAL_THUMBNAILS, + "缩略图垂直排列") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, "缩略图文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST, "缩略图更新程序") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, - "Boxarts") + "游戏包装盒封面") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS, "截屏") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS, "标题画面") MSG_HASH(MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, "显示时间日期") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE, + "日期/时间格式") +MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_STYLE, + "更改菜单中当前日期/时间显示格式。") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + "YYYY-MM-DD HH:MM:SS") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, + "YYYY-MM-DD HH:MM") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, + "MM-DD-YYYY HH:MM") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, + "HH:MM:SS") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, + "HH:MM") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + "DD/MM HH:MM") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, + "MM/DD HH:MM") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, + "HH:MM:SS (AM/PM)") MSG_HASH(MENU_ENUM_LABEL_VALUE_TITLE_COLOR, "菜单标题颜色") MSG_HASH(MENU_ENUM_LABEL_VALUE_TRUE, @@ -1577,7 +1703,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, "UI Companion Start On Boot") MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, - "Menubar") + "菜单栏") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, "无法读取压缩的文件。") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, @@ -1681,7 +1807,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, "预估刷新率") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_POLLED, - "Set Display-Reported Refresh Rate") + "由视频驱动自行设置刷新率") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, "旋转") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, @@ -1745,11 +1871,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, "菜单透明度因子") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, - "Menu Font Red Color") + "菜单字体 RGB 红色分量") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, - "Menu Font Green Color") + "菜单字体 RGB 绿色分量") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, - "Menu Font Blue Color") + "菜单字体 RGB 蓝色分量") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_FONT, "菜单字体") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_CUSTOM, @@ -1812,8 +1938,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS, "显示设置页") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_VIDEO, "显示视频页") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_NETPLAY, + "显示网络联机页") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_LAYOUT, - "Menu Layout") + "菜单布局") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, "菜单图标主题") MSG_HASH(MENU_ENUM_LABEL_VALUE_YES, @@ -1826,6 +1954,14 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, "为测试目的而打开或关闭非官方成就和/或测试版特性。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, "为所有游戏打开或关闭存档、金手指、回退、快进、暂停和慢动作。") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, + "启用或禁用游戏中排行榜。仅在硬核模式下生效。") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, + "在成绩列表中启用或禁用徽章显示。") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, + "启用或禁用 OSD 成就情况显示。") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, + "当完成一个成就时,自动截图。") MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, "修改驱动设置。") MSG_HASH(MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, @@ -1848,6 +1984,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_USER_SETTINGS, "修改帐号、用户名和语言。") MSG_HASH(MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, "修改你的隐私设置。") +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_SETTINGS, + "更改 MIDI 设置。") MSG_HASH(MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, "修改此系统的默认文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, @@ -1855,7 +1994,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, "修改网络设置。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST, - "下载且/或者扫描游戏内容,并将其加入你的收藏中。") + "下载、扫描游戏内容,并将其加入你的收藏中。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_SETTINGS, "调整音频输出的选项。") MSG_HASH(MENU_ENUM_SUBLABEL_BLUETOOTH_ENABLE, @@ -1918,7 +2057,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, "估算的显示器刷新率(Hz)。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED, - "The refresh rate as reported by the display driver.") + "设置为视频驱动自行设置的刷新率") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, "调整视频输出的选项。") MSG_HASH(MENU_ENUM_SUBLABEL_WIFI_SETTINGS, @@ -1926,11 +2065,11 @@ MSG_HASH(MENU_ENUM_SUBLABEL_WIFI_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST, "学习更多关于其是如何工作的。") MSG_HASH(MSG_APPENDED_DISK, - "Appended disk") + "外置磁盘") MSG_HASH(MSG_APPLICATION_DIR, "应用程序文件夹") MSG_HASH(MSG_APPLYING_SHADER, - "Applying shader") + "应用渲染器") MSG_HASH(MSG_AUDIO_MUTED, "静音。") MSG_HASH(MSG_AUDIO_UNMUTED, @@ -1952,11 +2091,11 @@ MSG_HASH(MSG_BYTES, MSG_HASH(MSG_CANNOT_INFER_NEW_CONFIG_PATH, "无法推断新的配置路径,使用当前时间。") MSG_HASH(MSG_CHEEVOS_HARDCORE_MODE_ENABLE, - "硬核模式开启:及时存档和回放被禁用.") + "硬核模式开启:即时存档和回放被禁用。") MSG_HASH(MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, "与已知的magic numbers比较...") MSG_HASH(MSG_COMPILED_AGAINST_API, - "Compiled against API") + "API反编译") MSG_HASH(MSG_CONFIG_DIRECTORY_NOT_SET, "未设置配置文件夹,无法保存新的配置。") MSG_HASH(MSG_CONNECTED_TO, @@ -1970,9 +2109,9 @@ MSG_HASH(MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, MSG_HASH(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, "已创建核心选项文件。") MSG_HASH(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, - "Could not find any next driver") + "找不到更多驱动程序。") MSG_HASH(MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM, - "Could not find compatible system.") + "找不到兼容的系统。") MSG_HASH(MSG_COULD_NOT_FIND_VALID_DATA_TRACK, "无法找到有效的数据轨") MSG_HASH(MSG_COULD_NOT_OPEN_DATA_TRACK, @@ -1980,11 +2119,11 @@ MSG_HASH(MSG_COULD_NOT_OPEN_DATA_TRACK, MSG_HASH(MSG_COULD_NOT_READ_CONTENT_FILE, "无法读取内容文件") MSG_HASH(MSG_COULD_NOT_READ_MOVIE_HEADER, - "无法读取视频头部信息.") + "无法读取视频头部信息。") MSG_HASH(MSG_COULD_NOT_READ_STATE_FROM_MOVIE, - "无法读取视频状态.") + "无法读取视频状态。") MSG_HASH(MSG_CRC32_CHECKSUM_MISMATCH, - "CRC32 checksum mismatch between content file and saved content checksum in replay file header; replay highly likely to desync on playback.") + "游戏的 CRC32 校验码与录像不一致。录像极有可能在重放时出错。") MSG_HASH(MSG_CUSTOM_TIMING_GIVEN, "Custom timing given") MSG_HASH(MSG_DECOMPRESSION_ALREADY_IN_PROGRESS, @@ -1994,9 +2133,9 @@ MSG_HASH(MSG_DECOMPRESSION_FAILED, MSG_HASH(MSG_DETECTED_VIEWPORT_OF, "Detected viewport of") MSG_HASH(MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, - "Did not find a valid content patch.") + "没有找到有效的游戏内容补丁。") MSG_HASH(MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, - "Disconnect device from a valid port.") + "从有效端口断开设备。") MSG_HASH(MSG_DISK_CLOSED, "已关闭") MSG_HASH(MSG_DISK_EJECTED, @@ -2026,23 +2165,23 @@ MSG_HASH(MSG_EXTRACTING, MSG_HASH(MSG_EXTRACTING_FILE, "解压文件") MSG_HASH(MSG_FAILED_SAVING_CONFIG_TO, - "无法保存配置到") + "无法将配置文件保存到") MSG_HASH(MSG_FAILED_TO, - "Failed to") + "失败:") MSG_HASH(MSG_FAILED_TO_ACCEPT_INCOMING_SPECTATOR, - "Failed to accept incoming spectator.") + "同意旁观失败。") MSG_HASH(MSG_FAILED_TO_ALLOCATE_MEMORY_FOR_PATCHED_CONTENT, - "Failed to allocate memory for patched content...") + "为游戏补丁分配内存失败...") MSG_HASH(MSG_FAILED_TO_APPLY_SHADER, - "Failed to apply shader.") + "应用渲染器失败。") MSG_HASH(MSG_FAILED_TO_BIND_SOCKET, - "Failed to bind socket.") + "端口绑定失败。") MSG_HASH(MSG_FAILED_TO_CREATE_THE_DIRECTORY, "创建文件夹失败。") MSG_HASH(MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE, "从压缩文件中提取内容失败") MSG_HASH(MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT, - "从客户端获取昵称失败.") + "从客户端获取昵称失败。") MSG_HASH(MSG_FAILED_TO_LOAD, "无法加载") MSG_HASH(MSG_FAILED_TO_LOAD_CONTENT, @@ -2058,53 +2197,53 @@ MSG_HASH(MSG_FAILED_TO_OPEN_LIBRETRO_CORE, MSG_HASH(MSG_FAILED_TO_PATCH, "补丁应用失败") MSG_HASH(MSG_FAILED_TO_RECEIVE_HEADER_FROM_CLIENT, - "Failed to receive header from client.") + "接收客户端报文失败。") MSG_HASH(MSG_FAILED_TO_RECEIVE_NICKNAME, - "Failed to receive nickname.") + "接收昵称失败。") MSG_HASH(MSG_FAILED_TO_RECEIVE_NICKNAME_FROM_HOST, - "Failed to receive nickname from host.") + "从主机接收昵称失败。") MSG_HASH(MSG_FAILED_TO_RECEIVE_NICKNAME_SIZE_FROM_HOST, - "Failed to receive nickname size from host.") + "从主机接收昵称大小失败。") MSG_HASH(MSG_FAILED_TO_RECEIVE_SRAM_DATA_FROM_HOST, - "Failed to receive SRAM data from host.") + "从主机接收游戏存档数据失败。") MSG_HASH(MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY, - "Failed to remove disk from tray.") + "从托盘中删除磁盘失败。") MSG_HASH(MSG_FAILED_TO_REMOVE_TEMPORARY_FILE, "移除临时文件失败") MSG_HASH(MSG_FAILED_TO_SAVE_SRAM, - "Failed to save SRAM") + "保存游戏存档失败") MSG_HASH(MSG_FAILED_TO_SAVE_STATE_TO, - "Failed to save state to") + "无法保存即时存档到") MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME, - "发送昵称失败.") + "发送昵称失败。") MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME_SIZE, - "发送昵称尺寸失败.") + "发送昵称尺寸失败。") MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME_TO_CLIENT, - "发送昵称至客户端失败.") + "发送昵称至客户端失败。") MSG_HASH(MSG_FAILED_TO_SEND_NICKNAME_TO_HOST, - "发送昵称至宿主端失败.") + "发送昵称至宿主端失败。") MSG_HASH(MSG_FAILED_TO_SEND_SRAM_DATA_TO_CLIENT, - "发送SRAM数据至客户端失败.") + "发送游戏存档数据至客户端失败。") MSG_HASH(MSG_FAILED_TO_START_AUDIO_DRIVER, "音频驱动启动失败,将在无音频模式下继续启动。") MSG_HASH(MSG_FAILED_TO_START_MOVIE_RECORD, - "启动视频录制失败.") + "启动视频录制失败。") MSG_HASH(MSG_FAILED_TO_START_RECORDING, - "Failed to start recording.") + "开始录制失败。") MSG_HASH(MSG_FAILED_TO_TAKE_SCREENSHOT, - "Failed to take screenshot.") + "截屏失败。") MSG_HASH(MSG_FAILED_TO_UNDO_LOAD_STATE, - "Failed to undo load state.") + "撤消即时读档失败。") MSG_HASH(MSG_FAILED_TO_UNDO_SAVE_STATE, - "Failed to undo save state.") + "撤消即时存档失败。") MSG_HASH(MSG_FAILED_TO_UNMUTE_AUDIO, - "Failed to unmute audio.") + "取消静音失败。") MSG_HASH(MSG_FATAL_ERROR_RECEIVED_IN, "Fatal error received in") MSG_HASH(MSG_FILE_NOT_FOUND, "未找到文件") MSG_HASH(MSG_FOUND_AUTO_SAVESTATE_IN, - "Found auto savestate in") + "已找到自动即时存档,位于:") MSG_HASH(MSG_FOUND_DISK_LABEL, "Found disk label") MSG_HASH(MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, @@ -2134,17 +2273,17 @@ MSG_HASH(MSG_INPUT_CHEAT, MSG_HASH(MSG_INPUT_CHEAT_FILENAME, "Input Cheat Filename") MSG_HASH(MSG_INPUT_PRESET_FILENAME, - "Input Preset Filename") + "输入预置文件名") MSG_HASH(MSG_INPUT_RENAME_ENTRY, - "Rename Title") + "重命名标题") MSG_HASH(MSG_INTERFACE, "接口") MSG_HASH(MSG_INTERNAL_STORAGE, "内部存储") MSG_HASH(MSG_REMOVABLE_STORAGE, - "Removable Storage") + "移动存储") MSG_HASH(MSG_INVALID_NICKNAME_SIZE, - "Invalid nickname size.") + "无效的昵称长度。") MSG_HASH(MSG_IN_BYTES, "(字节)") MSG_HASH(MSG_IN_GIGABYTES, @@ -2176,7 +2315,7 @@ MSG_HASH(MSG_MOVIE_FILE_IS_NOT_A_VALID_BSV1_FILE, MSG_HASH(MSG_MOVIE_FORMAT_DIFFERENT_SERIALIZER_VERSION, "视频格式看起来使用了不同的序列化版本。很有可能失败。") MSG_HASH(MSG_MOVIE_PLAYBACK_ENDED, - "视频回放结束.") + "视频回放结束。") MSG_HASH(MSG_MOVIE_RECORD_STOPPED, "停止视频录制。") MSG_HASH(MSG_NETPLAY_FAILED, @@ -2224,19 +2363,19 @@ MSG_HASH(MSG_RESTORED_OLD_SAVE_STATE, MSG_HASH(MSG_RESTORING_DEFAULT_SHADER_PRESET_TO, "重置渲染器预设到") MSG_HASH(MSG_REVERTING_SAVEFILE_DIRECTORY_TO, - "Reverting savefile directory to") + "恢复保存的文件到目录") MSG_HASH(MSG_REVERTING_SAVESTATE_DIRECTORY_TO, - "Reverting savestate directory to") + "恢复存档文件到目录") MSG_HASH(MSG_REWINDING, "正在回溯。") MSG_HASH(MSG_REWIND_INIT, - "Initializing rewind buffer with size") + "初始化回溯缓冲区大小") MSG_HASH(MSG_REWIND_INIT_FAILED, - "初始化回放缓存失败. 回放功能关闭.") + "初始化回放缓存失败。 回放功能关闭。") MSG_HASH(MSG_REWIND_INIT_FAILED_THREADED_AUDIO, "Implementation uses threaded audio. Cannot use rewind.") MSG_HASH(MSG_REWIND_REACHED_END, - "到达回放缓存末端.") + "到达回溯缓存末端。") MSG_HASH(MSG_SAVED_NEW_CONFIG_TO, "已保存新配置到") MSG_HASH(MSG_SAVED_STATE_TO_SLOT, @@ -2270,13 +2409,13 @@ MSG_HASH(MSG_FAST_FORWARD, MSG_HASH(MSG_SLOW_MOTION_REWIND, "慢动作回溯。") MSG_HASH(MSG_SRAM_WILL_NOT_BE_SAVED, - "SRAM will not be saved.") + "SRAM不会被保存。") MSG_HASH(MSG_STARTING_MOVIE_PLAYBACK, - "视频回放.") + "开始回放视频。") MSG_HASH(MSG_STARTING_MOVIE_RECORD_TO, - "Starting movie record to") + "启动视频录制到") MSG_HASH(MSG_STATE_SIZE, - "State size") + "即时存档大小") MSG_HASH(MSG_STATE_SLOT, "即时存档栏位") MSG_HASH(MSG_TAKING_SCREENSHOT, @@ -2298,7 +2437,7 @@ MSG_HASH(MSG_USING_CORE_NAME_FOR_NEW_CONFIG, MSG_HASH(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED, "使用libretro虚拟核心。跳过录制。") MSG_HASH(MSG_VALUE_CONNECT_DEVICE_FROM_A_VALID_PORT, - "Connect device from a valid port.") + "从有效端口连接设备。") MSG_HASH(MSG_VALUE_DISCONNECTING_DEVICE_FROM_PORT, "从端口断开设备") MSG_HASH(MSG_VALUE_REBOOTING, @@ -2308,16 +2447,16 @@ MSG_HASH(MSG_VALUE_SHUTTING_DOWN, MSG_HASH(MSG_VERSION_OF_LIBRETRO_API, "libretro API版本") MSG_HASH(MSG_VIEWPORT_SIZE_CALCULATION_FAILED, - "Viewport size calculation failed! Will continue using raw data. This will probably not work right ...") + "可视区域尺寸计算失败!将继续使用原始数据,这很可能不会正常工作。") MSG_HASH(MSG_VIRTUAL_DISK_TRAY, - "virtual disk tray.") + "虚拟磁盘托盘。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_LATENCY, - "Desired audio latency in milliseconds. Might not be honored if the audio driver can't provide given latency.") + "毫秒级音频延时。 如果音频驱动程序不支持将无法使用。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MUTE, "禁音/取消禁音。") MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, - "Helps smooth out imperfections in timing when synchronizing audio and video at the same time. Be aware that if disabled, proper synchronization is nearly impossible to obtain." + "有助于同步音频和视频。请注意,如果禁用,音频和视频几乎一定会错位。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CAMERA_ALLOW, @@ -2325,15 +2464,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_LOCATION_ALLOW, - "Allow or disallow location services access by cores." + "启用或禁用基于核心的位置服务访问。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_MAX_USERS, - "Maximum amount of users supported by RetroArch." + "支持玩家的最大数量" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, - "Influence how input polling is done inside RetroArch. Setting it to 'Early' or 'Late' can result in less latency, depending on your configuration." + "设置轮询方式。 根据设备的性能,设置为「较早」或「稍晚」可以让等待时间缩短。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, @@ -2473,7 +2612,7 @@ MSG_HASH(MSG_NETPLAY_LAN_SCANNING, MSG_HASH(MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, "当窗口失去焦点时暂停游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, - "Enable or disable composition.") + "启用或禁用桌面布局。") MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "为游戏、图片、音乐和视频启用/禁用历史记录。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, @@ -2481,7 +2620,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, "统一菜单控制") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, - "Use the same controls for both the menu and the game. Applies to the keyboard.") + "在菜单和游戏中使用相同的控制配置。应用于键盘。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, "显示屏幕消息。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_USER_REMOTE_ENABLE, @@ -2499,7 +2638,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SCALE, MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, "联机游戏将在内容加载后开始。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, - "无法找到合适的核心或内容文件,手动加载。") + "无法找到合适的核心或内容文件,请手动加载。") MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, "浏览URL" @@ -2527,7 +2666,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, "轻微模糊像素点边缘以减少像素颗粒感。对运行速度影响很小。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "加载一个由 CPU 控制的视频过滤器。注意:这可能显著降低游戏运行速度。某些视频过滤器仅对32位色(或16位色)核心生效。") + "加载一个由 CPU 控制的视频过滤器。注意:这\n" + "可能显著降低游戏运行速度。某些视频过滤器仅对32位色(或16位色)核心生效。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, "输入您的 Retro 成就账号的用户名。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, @@ -2535,13 +2675,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, "在这里输入您的昵称,用于联网和一些其他服务。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, - "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen.") + "去除滤镜后(而不是渲染器)捕获图像。视频与屏幕上显示的一样。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_LIST, "选择使用的模拟器核心。") MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, "选择需要加载的游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, - "Show network interface(s) and associated IP addresses.") + "显示网络接口和相关IP地址信息。") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, "显示此设备的信息。") MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, @@ -2562,14 +2702,18 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, "设置字体大小(单位:像素)。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, "在菜单中隐藏图层,退出菜单后重新显示。") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "在屏幕图层上显示键盘/控制器。") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "如果开启“在图层上显示控制器”,请选择相应屏幕图层的端口来侦听。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, "扫描到的游戏内容将在此处显示。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, - "只放大整数倍显示。基础分辨率与游戏、宽高比有关。如果「保持宽高比」选项未开启,不保证宽高放大倍数相同。" - ) + "只放大整数倍显示。基础分辨率与游戏、宽高比有关。\n" + "如果「保持宽高比」选项未开启,不保证宽高放大倍数相同。") MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, "使用 GPU 输出来进行截图(如果可能的话)。" @@ -2596,7 +2740,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX, - "每次储存即时存档时,都在新的栏位储存,以避免覆盖原有的即时存档。每次运行游戏时,都会定位到最新的即时存档栏位。") + "每次储存即时存档时,都在新的栏位储存,以避免覆盖原有的即时存档。\n" + "每次运行游戏时,都会定位到最新的即时存档栏位。") MSG_HASH( MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE, "读取即时存档时不覆盖游戏存档。可能会导致某些游戏产生 BUG。" @@ -2609,6 +2754,13 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, "减速时以几分之一速度运行。" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_ENABLED, + "提前运行核心逻辑一帧或多帧,以降低按键延迟。" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_FRAMES, + "设置要提前运行的帧数。 如果滞后于游戏本体的帧数将导致类似于抖动之类的游戏问题。") MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, "启用回溯倒带功能。对游戏运行速度有一定影响。" @@ -2617,6 +2769,15 @@ MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, "每次回溯时回退的帧数。数值越高,回溯越快。" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE, + "回溯缓冲区保留的内存量(单位:MB)。增加内存量可增加回溯历史的时间。" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE_STEP, + "每次增加或减少回溯缓冲区内存量值时,回溯历史将按此大小改变。" + ) + MSG_HASH( MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, "Sets log level for cores. If a log level issued by a core is below this value, it is ignored." @@ -2627,7 +2788,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, - "在 RetroArch 关闭时自动保存即时存档。如果开启了「自动加载即时存档」功能,下次开始游戏时会加载该存档。" + "在RetroArch关闭时自动保存即时存档。\n" + "如果开启了「自动加载即时存档」功能,下次开始游戏时会加载该存档。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_LOAD, @@ -2639,7 +2801,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUTOSAVE_INTERVAL, - "每隔一段时间(单位:秒)自动保存游戏存档,此选项默认关闭(0 表示关闭)。" + "每隔一段时间(单位:秒)自动保存游戏存档,此选项默认关闭。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, @@ -2719,7 +2881,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN, - "Audio DSP plugin that processes audio before it's sent to the driver." + "音频 DSP 插件,用于驱动程序处理之前处理音频。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_OUTPUT_RATE, @@ -2743,47 +2905,47 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, - "The address of the host to connect to." + "要连接到在线游戏网络服务器的地址。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT, - "The port of the host IP address. Can be either a TCP or UDP port." + "服务器 IP 地址端口。可以是 TCP 或 UDP 端口。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_PASSWORD, - "The password for connecting to the netplay host. Used only in host mode." + "连接到在线游戏网络的密码。仅在主机模式下生效。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, - "Whether to announce netplay games publicly. If unset, clients must manually connect rather than using the public lobby." + "是否使用公共的在线游戏网络。如果未设置,客户端必须手动连接而不使用公共的在线游戏网络。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, - "The password for connecting to the netplay host with only spectator privileges. Used only in host mode." + "连接到在线游戏网络的密码,仅有观战权限。仅在主机模式下使用。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_START_AS_SPECTATOR, - "Whether to start netplay in spectator mode." + "是否启动在线游戏旁观者模式。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ALLOW_SLAVES, - "Whether to allow connections in slave mode. Slave-mode clients require very little processing power on either side, but will suffer significantly from network latency." + "是否允许从属模式网络连接。从属模式客户端占用网络带宽小,但网络延迟的比较大。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_REQUIRE_SLAVES, - "Whether to disallow connections not in slave mode. Not recommended except for very fast networks with very weak machines." + "是否禁止从属模式网络连接的客户端连接。仅建议网络速度快、主机性能高的用户开启。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_STATELESS_MODE, - "Whether to run netplay in a mode not requiring save states. If set to true, a very fast network is required, but no rewinding is performed, so there will be no netplay jitter." + "是否在不保存存档的模式下运行在线游戏。开启后联机将不会有时间误差,但需要非常快的网络,且不能使用回溯功能。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_CHECK_FRAMES, - "The frequency in frames with which netplay will verify that the host and client are in sync." + "在线游戏中主机和客户端的帧频率将保持同步。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_NAT_TRAVERSAL, - "When hosting, attempt to listen for connections from the public Internet, using UPnP or similar technologies to escape LANs." + "当联机时,侦听来自公共互联网的连接,使用 UPnP 或类似的技术来规避局域网问题。" ) MSG_HASH( MENU_ENUM_SUBLABEL_STDIN_CMD_ENABLE, @@ -2801,6 +2963,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_THUMBNAILS, "缩略图的显示类型。" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LEFT_THUMBNAILS, + "在屏幕左侧显示缩略图。" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS, + "在屏幕右侧缩略图的下方显示左侧缩略图。" + ) MSG_HASH( MENU_ENUM_SUBLABEL_TIMEDATE_ENABLE, "在菜单中显示当前的日期和时间。" @@ -2822,11 +2992,11 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, "断开当前网络连接。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, - "Scans a directory for compatible files and add them to the collection.") + "扫描目录并将兼容的文件添加到合集中。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_FILE, - "Scans a compatible file and add it to the collection.") + "扫描一个兼容的文件并将其添加到合集中") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, - "Uses a custom swap interval for Vsync. Set this to effectively halve monitor refresh rate." + "为垂直同步使用自定义的交换间隔。该设置可以有效地降低显示器刷新率。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, "在游戏存档的文件名前面加上核心名称来进行排序。" @@ -2835,18 +3005,18 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, "在即时存档的文件名前面加上核心名称来进行排序。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, - "URL to core updater directory on the Libretro buildbot.") + "Libretro buildbot 核心目录的更新 URL。") MSG_HASH(MENU_ENUM_SUBLABEL_BUILDBOT_ASSETS_URL, - "URL to assets updater directory on the Libretro buildbot.") + "Libretro buildbot 资源目录的更新 URL。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, "下载后自动解压。" ) MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, - "Scan for new rooms.") + "扫描新房间。") MSG_HASH(MENU_ENUM_SUBLABEL_DELETE_ENTRY, "删除此条目。") MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION, - "View more information about the content.") + "查看该内容的更多相关信息。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES, "将此游戏加入你的收藏夹。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST, @@ -2857,20 +3027,20 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS, "调整文件管理器设置。") MSG_HASH( MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE, - "Enable customized controls by default at startup." + "程序启动时默认启用自定义控件。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUTO_OVERRIDES_ENABLE, - "Enable customized configuration by default at startup." + "启动时默认启用自定义配置。" ) MSG_HASH(MENU_ENUM_SUBLABEL_GAME_SPECIFIC_OPTIONS, - "Enable customized core options by default at startup.") + "启动时默认启用自定义核心选项") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_ENABLE, - "Shows current core name inside menu.") + "在内部菜单中显示当前核心名称。") MSG_HASH(MENU_ENUM_SUBLABEL_DATABASE_MANAGER, - "View databases.") + "查看游戏信息数据库。") MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_MANAGER, - "View previous searches.") + "查看以前的搜索记录。") MSG_HASH(MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, "截取当前屏幕。") MSG_HASH( @@ -2893,11 +3063,11 @@ MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, "如果你不慎覆盖了即时存档,使用此命令来撤销。") MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, - "Retro Achievements service. For more information, visit http://retroachievements.org" + "Retro 成就服务。更多内容请访问 http://retroachievements.org" ) MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, - "Manages currently configured accounts." + "管理当前用户的配置。" ) MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_REWIND, "调整游戏回溯功能设置。") @@ -2920,7 +3090,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CORE_OPTIONS, MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, "为高级用户显示更多设置项(默认关闭)。") MSG_HASH(MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, - "Perform tasks on a separate thread.") + "在单独的线程上执行任务。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, "允许用户从收藏夹中删除游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, @@ -2939,51 +3109,51 @@ MSG_HASH(MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, "Sets start directory for menu configuration browser.") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, - "The number of frames of input latency for netplay to use to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of noticeable input lag.") + "设置按键延迟以掩盖网络延迟。用按键延迟换取在线游戏时降低CPU负载并减少顿卡。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, - "The range of frames of input latency that may be used to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of unpredictable input lag.") + "设置按键延迟范围以掩盖网络的延迟。用延迟范围内的按键延迟换取在线游戏时降低CPU负载并减少顿卡。") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_CYCLE_TRAY_STATUS, "Cycle the current disk. If the disk is inserted, it will eject the disk. If the disk has not been inserted, it will be inserted. ") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_INDEX, - "Change the disk index.") + "更改磁盘索引。") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_OPTIONS, - "Disk image management.") + "管理磁盘映像。") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND, - "Select a disk image to insert.") + "选择要插入的磁盘映像。") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE, "Makes sure the framerate is capped while inside the menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_LAYOUT, - "Select a different layout for the XMB interface.") + "设置多种XMB界面布局。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_THEME, - "Select a different theme for the icon. Changes will take effect after you restart the program.") + "设置多种的图标主题。重新启动程序后,更改将生效。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, - "Enable drop shadows for all icons. This will have a minor performance hit.") + "启用图标阴影功能。这可能会损失一点点性能。") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, - "Select a different background color gradient theme.") + "设置多种颜色背景的渐变主题。") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, - "Modify the opacity of the background wallpaper.") + "设置壁纸的不透明度。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, - "Select a different background color gradient theme.") + "设置多种颜色的渐变主题。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, - "Select an animated background effect. Can be GPU-intensive depending on the effect. If performance is unsatisfactory, either turn this off or revert to a simpler effect.") + "选择背景动画效果。效果由GPU性能而定,如果性能不理想,请关闭此功能或选择简单特效。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_FONT, - "Select a different main font to be used by the menu.") + "设置菜单中使用的自定义字体文件。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, - "Show the image tab inside the main menu.") + "在主菜单中显示图像页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_MUSIC, - "Show the music tab inside the main menu.") + "在主菜单中显示音乐页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO, - "Show the video tab inside the main menu.") + "在主菜单中显示视频页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_NETPLAY, - "Show the netplay tab inside the main menu.") + "在主菜单中显示网络联机页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS, - "Show the settings tab inside the main menu.") + "在主菜单中显示设置页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY, - "Show the recent history tab inside the main menu.") + "在主菜单中显示最近的历史记录页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD, - "Show the import content tab inside the main menu.") + "在主菜单中显示导入内容页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS, - "Show playlist tabs inside the main menu.") + "在主菜单中显示游戏列表页") MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN, "Show startup screen in menu. This is automatically set to false after the program starts for the first time.") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY, @@ -2995,7 +3165,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_ENABLE, MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, "Set the custom scaling size here. NOTE: You have to enable 'DPI Override' for this scaling size to take effect.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, - "Save all downloaded files to this directory.") + "设置下载文件夹。下载的文件存放在这里。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_REMAPPING_DIRECTORY, "Save all remapped controls to this directory.") MSG_HASH(MENU_ENUM_SUBLABEL_LIBRETRO_DIR_PATH, @@ -3018,12 +3188,12 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_ASSETS_DIRECTORY, - "This location is queried by default when menu interfaces try to look for loadable assets, etc." + "当菜单界面试图查找可加载的资源时,默认情况下查找此位置。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, - "Save all save files to this directory. If not set, will try to save inside the content file's working directory.") + "将所有保存文件保存到该目录。如果没有设置,将尝试保存游戏内容文件的工作目录内。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, - "Save all save states to this directory. If not set, will try to save inside the content file's working directory.") + "将所有存档保存到该目录。如果没有设置,将尝试保存游戏内容文件的工作目录内。") MSG_HASH(MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, "Directory to dump screenshots to.") MSG_HASH(MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, @@ -3034,7 +3204,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR, - "Directory where audio DSP filter files are kept." + "保存音频 DSP 插件文件的目录。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR, @@ -3083,21 +3253,25 @@ MSG_HASH( MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, "快速配置游戏内设置。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INFORMATION, - "View information pertaining to the application/core.") + "查看应用、内核的相关的信息。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, "Floating point value for video aspect ratio (width / height), used if the Aspect Ratio is set to 'Config'.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "Custom viewport height that is used if the Aspect Ratio is set to 'Custom'.") + "如果宽高比设为「自定义」,将使用自定义的视窗高度。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "Custom viewport width that is used if the Aspect Ratio is set to 'Custom'.") + "如果宽高比设为「自定义」,将使用自定义的视窗宽度。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, - "Custom viewport offset used for defining the X-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then.") + "视窗左上角的 X 坐标。如果「放大整数倍」选项已开启,则设置无效。图像将显示在中心。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, - "Custom viewport offset used for defining the Y-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then.") + "视窗左上角的 Y 坐标。如果「放大整数倍」选项已开启,则设置无效。图像将显示在中心。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, - "Use Relay Server") + "启用代理服务器") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, - "Forward netplay connections through a man-in-the-middle server. Useful if the host is behind a firewall or has NAT/UPnP problems.") + "通过代理服务器进行网络连接。如果主机位于防火墙之后或具有NAT/UPnP问题时,建议开启。") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + "代理服务器位置") +MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, + "选择一个代理服务器。服务器位置比较接近的一般网络延迟更低。") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, "Add to mixer") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_PLAY, @@ -3110,134 +3284,138 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FILTER_BY_CURRENT_CORE, "Filter by current core") MSG_HASH( MSG_AUDIO_MIXER_VOLUME, - "Global audio mixer volume" + "全局音效混合器音量" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_MIXER_VOLUME, - "Global audio mixer volume (in dB). 0 dB is normal volume, and no gain is applied." + "全局音效混合器音量(单位:分贝)。 0 为正常音量。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, - "Audio Mixer Volume Level (dB)" + "音效混合器音量级别(dB)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE, - "Audio Mixer Mute" + "音效混合器开关" ) MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, - "Mute/unmute mixer audio.") + "开启/关闭音效混合器。") MSG_HASH(MENU_ENUM_LABEL_MENU_SHOW_ONLINE_UPDATER, - "Show Online Updater") + "显示「在线更新器」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, - "Show/hide the 'Online Updater' option.") + "显示或隐藏「在线更新器」的选项。") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS, + "视图") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS, + "显示或隐藏屏幕上的菜单元素。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER, - "Show Core Updater") + "显示「核心更新程序」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER, - "Show/hide the ability to update cores (and core info files).") + "显示或隐藏「核心更新程序」的选项。") MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN, - "Preparing for content scan...") + "准备扫描内容…") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, - "Delete core") + "删除核心") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, - "Remove this core from disk.") + "从磁盘中删除该核心") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, "重命名此条目") MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY, - "Rename") + "重命名") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, "Framebuffer Opacity") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, "Modify the opacity of the framebuffer.") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, - "Favorites") + "收藏夹") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_FAVORITES, - "Content which you have added to 'Favorites' will appear here.") + "已经添加到“收藏夹”的内容将出现在这里。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, - "Music") + "音乐") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_MUSIC, - "Music which has been previously played will appear here.") + "以前播放过的音乐将出现在这里。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_IMAGES, - "Image") + "图像") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_IMAGES, - "Images which have been previously viewed will appear here.") + "以前看过的图像将出现在这里。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, - "Video") + "视频") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_VIDEO, - "Videos which have been previously played will appear here.") + "以前看过的视频将出现在这里。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, - "Menu Icons") + "菜单图标") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, - "Enable/disable the menu icons shown at the lefthand side of the menu entries.") + "启用或禁用菜单条目左侧显示的菜单图标") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") + "启用设置页") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") + "设置启用设置页的密码") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") + "输入密码") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") + "密码正确。") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") + "密码不正确。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") + "启用设置页。修改启用设置页需要重新启动 RetroArch。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") + "设置在隐藏设置页后,重新启用设置页的密码。启用方法:在主菜单中选择「启用设置页」并输入密码来重新启用设置页。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, - "Allow the user to rename entries in collections.") + "允许在集合中重命名条目。") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, - "Allow to rename entries") + "允许重命名条目") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, - "Show Load Core") + "显示「加载核心」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE, - "Show/hide the 'Load Core' option.") + "显示或隐藏「加载核心」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CONTENT, - "Show Load Content") + "显示「载入游戏内容」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT, - "Show/hide the 'Load Content' option.") + "显示或隐藏「载入游戏内容」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION, - "Show Information") + "显示「信息」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION, - "Show/hide the 'Information' option.") + "显示或隐藏「信息」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS, - "Show Configurations") + "显示「配置」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS, - "Show/hide the 'Configurations' option.") + "显示或隐藏「配置」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, - "Show Help") + "显示「帮助」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, - "Show/hide the 'Help' option.") + "显示或隐藏「帮助」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, - "Show Quit RetroArch") + "显示「退出 RetroArch」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, - "Show/hide the 'Quit RetroArch' option.") + "显示或隐藏「退出 RetroArch」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, - "Show Reboot") + "显示「重启 RetroArch」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, - "Show/hide the 'Reboot' option.") + "显示或隐藏「重启 RetroArch」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_SHUTDOWN, - "Show Shutdown") + "显示「关闭」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_SHUTDOWN, - "Show/hide the 'Shutdown' option.") + "显示或隐藏「关闭」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS, - "Quick Menu") + "快速菜单") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS, - "Show or hide elements on the Quick Menu screen.") + "显示或隐藏快速菜单屏幕上的元素。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT, - "Show Take Screenshot") + "显示「截图」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT, - "Show/hide the 'Take Screenshot' option.") + "显示或隐藏「截图”选项」。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE, - "Show Save/Load State") + "显示「保存/即时读档」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE, - "Show/hide the options for saving/loading state.") + "显示「保存/即时读档」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, - "Show Undo Save/Load State") + "显示「撤消保存/即时读档」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, - "Show/hide the options for undoing save/load state.") + "显示或隐藏 「撤消保存/即时读档」的选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, - "Show Add to Favorites") + "显示「添加到收藏夹」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, - "Show/hide the 'Add to Favorites' option.") + "显示或隐藏「添加到收藏夹」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "显示「核心选项」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3263,13 +3441,23 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, "显示或隐藏「保存游戏独立配置」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, - "Show Information") + "显示「信息」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, - "Show/hide the 'Information' option.") + "显示或隐藏「信息」选项。") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE, + "显示屏显消息(OSD)背景") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED, + "屏显消息(OSD)背景RGB颜色 红色") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN, + "屏显消息(OSD)背景RGB颜色 绿色") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE, + "屏显消息(OSD)背景RGB颜色 蓝色") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY, + "屏显消息(OSD)背景透明度") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, - "Disable Kiosk Mode") + "关闭懒人模式") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, - "Disables kiosk mode. A restart is required for the change to take full effect.") + "关闭懒人模式。重新启动后生效。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, "开启懒人模式") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, @@ -3284,16 +3472,24 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "密码正确。") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "密码错误。") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED, + "屏显消息(OSD)RGB颜色 红色") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, + "屏显消息(OSD)RGB颜色 绿色") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, + "屏显消息(OSD)RGB颜色 蓝色") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, + "显示FPS帧数") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, - "Automatically add content to playlist") + "自动添加内容到游戏列表") MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, - "Automatically scans loaded content so they appear inside playlists.") + "自动扫描游戏文件,并添加在游戏列表中。") MSG_HASH(MSG_SCANNING_OF_FILE_FINISHED, "文件扫描完成") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, "音频重采样质量") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, - "Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.") + "降低此值可以提高性能但会降低音频质量") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, "Watch shader files for changes") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, @@ -3310,7 +3506,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, "Enable border filler thickness") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, "Enable background filler thickness") -MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "For CRT displays only. Attempts to use exact core/game resolution and refresh rate.") +MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "仅适用于 CRT 显示器。尽可能输出原汁原味的信号。") MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, "CRT 原生输出") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, @@ -3318,17 +3514,17 @@ MSG_HASH( ) MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, "CRT Super Resolution") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, - "Show Rewind Settings") + "显示「回溯」设置") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, - "Show/hide the Rewind options.") + "显示或隐藏「回溯」选项。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_LATENCY, - "Show/hide the Latency options.") + "显示或隐藏「延迟」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_LATENCY, - "Show Latency Settings") + "显示「延迟」设置") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS, - "Show/hide the Overlay options.") + "显示或隐藏「图层」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, - "Show Overlay Settings") + "显示「图层」设置") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, "启用菜单声音") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, @@ -3368,11 +3564,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, "Remove") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, - "Volume") + "音量") MSG_HASH(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, "Current core") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_SEARCH_CLEAR, - "Clear") + "清除") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, "In-Menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME, @@ -3384,21 +3580,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING, MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, "Paused") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, - "Enable Discord") + "开启 Discord") MSG_HASH(MENU_ENUM_SUBLABEL_DISCORD_ALLOW, - "Enable or disable Discord support. Will not work with the browser version, only native desktop client.") + "启用或禁用 Discord 支持。仅支持本地桌面客户端。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_INPUT, - "Input") + "输入") MSG_HASH(MENU_ENUM_SUBLABEL_MIDI_INPUT, - "Select input device.") + "选择输入设备。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_OUTPUT, - "Output") + "输出") MSG_HASH(MENU_ENUM_SUBLABEL_MIDI_OUTPUT, - "Select output device.") + "选择输出设备。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_VOLUME, - "Volume") + "音量") MSG_HASH(MENU_ENUM_SUBLABEL_MIDI_VOLUME, - "Set output volume (%).") + "设置输出音量(百分比)。") MSG_HASH(MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, "电源管理") MSG_HASH(MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, @@ -3433,10 +3629,10 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use a custom refresh rate specified in the config file if needed.") + "使用配置文件中指定的自定义刷新率。") MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use Custom Refresh Rate") + "使用自定义刷新率") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, "Select the output port connected to the CRT display.") @@ -3517,7 +3713,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, "Title of Stream") MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, - "拆下 Joy-Con" + "拆下 Joy-Con 手柄" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, From f336fa03379011105e05088fcdcdc0224eff1b4c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 16:38:13 +0200 Subject: [PATCH 0305/1292] CXX_BUILD fixes --- deps/mbedtls/asn1write.c | 6 +- deps/mbedtls/blowfish.c | 517 +++++++++++++++--------------- deps/mbedtls/cipher_wrap.c | 24 +- deps/mbedtls/hmac_drbg.c | 2 +- deps/mbedtls/pem.c | 4 +- deps/mbedtls/ssl_tls.c | 49 +-- gfx/drivers/gl.c | 3 +- managers/cheat_manager.c | 641 ++++++++++++++++++------------------- 8 files changed, 618 insertions(+), 628 deletions(-) diff --git a/deps/mbedtls/asn1write.c b/deps/mbedtls/asn1write.c index 69b61b205f..d7a1e33f7e 100644 --- a/deps/mbedtls/asn1write.c +++ b/deps/mbedtls/asn1write.c @@ -345,7 +345,7 @@ mbedtls_asn1_named_data *mbedtls_asn1_store_named_data( mbedtls_asn1_named_data return( NULL ); cur->oid.len = oid_len; - cur->oid.p = mbedtls_calloc( 1, oid_len ); + cur->oid.p = (unsigned char*)(unsigned char*)(unsigned char*)(unsigned char*)(unsigned char*)(unsigned char*)(unsigned char*)(unsigned char*)(unsigned char*)mbedtls_calloc( 1, oid_len ); if( cur->oid.p == NULL ) { mbedtls_free( cur ); @@ -355,7 +355,7 @@ mbedtls_asn1_named_data *mbedtls_asn1_store_named_data( mbedtls_asn1_named_data memcpy( cur->oid.p, oid, oid_len ); cur->val.len = val_len; - cur->val.p = mbedtls_calloc( 1, val_len ); + cur->val.p = (unsigned char*)mbedtls_calloc( 1, val_len ); if( cur->val.p == NULL ) { mbedtls_free( cur->oid.p ); @@ -378,7 +378,7 @@ mbedtls_asn1_named_data *mbedtls_asn1_store_named_data( mbedtls_asn1_named_data return( NULL ); mbedtls_free( cur->val.p ); - cur->val.p = p; + cur->val.p = (unsigned char*)p; cur->val.len = val_len; } diff --git a/deps/mbedtls/blowfish.c b/deps/mbedtls/blowfish.c index 5f97f77122..e11f186067 100644 --- a/deps/mbedtls/blowfish.c +++ b/deps/mbedtls/blowfish.c @@ -73,7 +73,264 @@ static const uint32_t P[MBEDTLS_BLOWFISH_ROUNDS + 2] = { }; /* declarations of data at the end of this file */ -static const uint32_t S[4][256]; +static const uint32_t S[4][256] = { + { 0xD1310BA6L, 0x98DFB5ACL, 0x2FFD72DBL, 0xD01ADFB7L, + 0xB8E1AFEDL, 0x6A267E96L, 0xBA7C9045L, 0xF12C7F99L, + 0x24A19947L, 0xB3916CF7L, 0x0801F2E2L, 0x858EFC16L, + 0x636920D8L, 0x71574E69L, 0xA458FEA3L, 0xF4933D7EL, + 0x0D95748FL, 0x728EB658L, 0x718BCD58L, 0x82154AEEL, + 0x7B54A41DL, 0xC25A59B5L, 0x9C30D539L, 0x2AF26013L, + 0xC5D1B023L, 0x286085F0L, 0xCA417918L, 0xB8DB38EFL, + 0x8E79DCB0L, 0x603A180EL, 0x6C9E0E8BL, 0xB01E8A3EL, + 0xD71577C1L, 0xBD314B27L, 0x78AF2FDAL, 0x55605C60L, + 0xE65525F3L, 0xAA55AB94L, 0x57489862L, 0x63E81440L, + 0x55CA396AL, 0x2AAB10B6L, 0xB4CC5C34L, 0x1141E8CEL, + 0xA15486AFL, 0x7C72E993L, 0xB3EE1411L, 0x636FBC2AL, + 0x2BA9C55DL, 0x741831F6L, 0xCE5C3E16L, 0x9B87931EL, + 0xAFD6BA33L, 0x6C24CF5CL, 0x7A325381L, 0x28958677L, + 0x3B8F4898L, 0x6B4BB9AFL, 0xC4BFE81BL, 0x66282193L, + 0x61D809CCL, 0xFB21A991L, 0x487CAC60L, 0x5DEC8032L, + 0xEF845D5DL, 0xE98575B1L, 0xDC262302L, 0xEB651B88L, + 0x23893E81L, 0xD396ACC5L, 0x0F6D6FF3L, 0x83F44239L, + 0x2E0B4482L, 0xA4842004L, 0x69C8F04AL, 0x9E1F9B5EL, + 0x21C66842L, 0xF6E96C9AL, 0x670C9C61L, 0xABD388F0L, + 0x6A51A0D2L, 0xD8542F68L, 0x960FA728L, 0xAB5133A3L, + 0x6EEF0B6CL, 0x137A3BE4L, 0xBA3BF050L, 0x7EFB2A98L, + 0xA1F1651DL, 0x39AF0176L, 0x66CA593EL, 0x82430E88L, + 0x8CEE8619L, 0x456F9FB4L, 0x7D84A5C3L, 0x3B8B5EBEL, + 0xE06F75D8L, 0x85C12073L, 0x401A449FL, 0x56C16AA6L, + 0x4ED3AA62L, 0x363F7706L, 0x1BFEDF72L, 0x429B023DL, + 0x37D0D724L, 0xD00A1248L, 0xDB0FEAD3L, 0x49F1C09BL, + 0x075372C9L, 0x80991B7BL, 0x25D479D8L, 0xF6E8DEF7L, + 0xE3FE501AL, 0xB6794C3BL, 0x976CE0BDL, 0x04C006BAL, + 0xC1A94FB6L, 0x409F60C4L, 0x5E5C9EC2L, 0x196A2463L, + 0x68FB6FAFL, 0x3E6C53B5L, 0x1339B2EBL, 0x3B52EC6FL, + 0x6DFC511FL, 0x9B30952CL, 0xCC814544L, 0xAF5EBD09L, + 0xBEE3D004L, 0xDE334AFDL, 0x660F2807L, 0x192E4BB3L, + 0xC0CBA857L, 0x45C8740FL, 0xD20B5F39L, 0xB9D3FBDBL, + 0x5579C0BDL, 0x1A60320AL, 0xD6A100C6L, 0x402C7279L, + 0x679F25FEL, 0xFB1FA3CCL, 0x8EA5E9F8L, 0xDB3222F8L, + 0x3C7516DFL, 0xFD616B15L, 0x2F501EC8L, 0xAD0552ABL, + 0x323DB5FAL, 0xFD238760L, 0x53317B48L, 0x3E00DF82L, + 0x9E5C57BBL, 0xCA6F8CA0L, 0x1A87562EL, 0xDF1769DBL, + 0xD542A8F6L, 0x287EFFC3L, 0xAC6732C6L, 0x8C4F5573L, + 0x695B27B0L, 0xBBCA58C8L, 0xE1FFA35DL, 0xB8F011A0L, + 0x10FA3D98L, 0xFD2183B8L, 0x4AFCB56CL, 0x2DD1D35BL, + 0x9A53E479L, 0xB6F84565L, 0xD28E49BCL, 0x4BFB9790L, + 0xE1DDF2DAL, 0xA4CB7E33L, 0x62FB1341L, 0xCEE4C6E8L, + 0xEF20CADAL, 0x36774C01L, 0xD07E9EFEL, 0x2BF11FB4L, + 0x95DBDA4DL, 0xAE909198L, 0xEAAD8E71L, 0x6B93D5A0L, + 0xD08ED1D0L, 0xAFC725E0L, 0x8E3C5B2FL, 0x8E7594B7L, + 0x8FF6E2FBL, 0xF2122B64L, 0x8888B812L, 0x900DF01CL, + 0x4FAD5EA0L, 0x688FC31CL, 0xD1CFF191L, 0xB3A8C1ADL, + 0x2F2F2218L, 0xBE0E1777L, 0xEA752DFEL, 0x8B021FA1L, + 0xE5A0CC0FL, 0xB56F74E8L, 0x18ACF3D6L, 0xCE89E299L, + 0xB4A84FE0L, 0xFD13E0B7L, 0x7CC43B81L, 0xD2ADA8D9L, + 0x165FA266L, 0x80957705L, 0x93CC7314L, 0x211A1477L, + 0xE6AD2065L, 0x77B5FA86L, 0xC75442F5L, 0xFB9D35CFL, + 0xEBCDAF0CL, 0x7B3E89A0L, 0xD6411BD3L, 0xAE1E7E49L, + 0x00250E2DL, 0x2071B35EL, 0x226800BBL, 0x57B8E0AFL, + 0x2464369BL, 0xF009B91EL, 0x5563911DL, 0x59DFA6AAL, + 0x78C14389L, 0xD95A537FL, 0x207D5BA2L, 0x02E5B9C5L, + 0x83260376L, 0x6295CFA9L, 0x11C81968L, 0x4E734A41L, + 0xB3472DCAL, 0x7B14A94AL, 0x1B510052L, 0x9A532915L, + 0xD60F573FL, 0xBC9BC6E4L, 0x2B60A476L, 0x81E67400L, + 0x08BA6FB5L, 0x571BE91FL, 0xF296EC6BL, 0x2A0DD915L, + 0xB6636521L, 0xE7B9F9B6L, 0xFF34052EL, 0xC5855664L, + 0x53B02D5DL, 0xA99F8FA1L, 0x08BA4799L, 0x6E85076AL }, + { 0x4B7A70E9L, 0xB5B32944L, 0xDB75092EL, 0xC4192623L, + 0xAD6EA6B0L, 0x49A7DF7DL, 0x9CEE60B8L, 0x8FEDB266L, + 0xECAA8C71L, 0x699A17FFL, 0x5664526CL, 0xC2B19EE1L, + 0x193602A5L, 0x75094C29L, 0xA0591340L, 0xE4183A3EL, + 0x3F54989AL, 0x5B429D65L, 0x6B8FE4D6L, 0x99F73FD6L, + 0xA1D29C07L, 0xEFE830F5L, 0x4D2D38E6L, 0xF0255DC1L, + 0x4CDD2086L, 0x8470EB26L, 0x6382E9C6L, 0x021ECC5EL, + 0x09686B3FL, 0x3EBAEFC9L, 0x3C971814L, 0x6B6A70A1L, + 0x687F3584L, 0x52A0E286L, 0xB79C5305L, 0xAA500737L, + 0x3E07841CL, 0x7FDEAE5CL, 0x8E7D44ECL, 0x5716F2B8L, + 0xB03ADA37L, 0xF0500C0DL, 0xF01C1F04L, 0x0200B3FFL, + 0xAE0CF51AL, 0x3CB574B2L, 0x25837A58L, 0xDC0921BDL, + 0xD19113F9L, 0x7CA92FF6L, 0x94324773L, 0x22F54701L, + 0x3AE5E581L, 0x37C2DADCL, 0xC8B57634L, 0x9AF3DDA7L, + 0xA9446146L, 0x0FD0030EL, 0xECC8C73EL, 0xA4751E41L, + 0xE238CD99L, 0x3BEA0E2FL, 0x3280BBA1L, 0x183EB331L, + 0x4E548B38L, 0x4F6DB908L, 0x6F420D03L, 0xF60A04BFL, + 0x2CB81290L, 0x24977C79L, 0x5679B072L, 0xBCAF89AFL, + 0xDE9A771FL, 0xD9930810L, 0xB38BAE12L, 0xDCCF3F2EL, + 0x5512721FL, 0x2E6B7124L, 0x501ADDE6L, 0x9F84CD87L, + 0x7A584718L, 0x7408DA17L, 0xBC9F9ABCL, 0xE94B7D8CL, + 0xEC7AEC3AL, 0xDB851DFAL, 0x63094366L, 0xC464C3D2L, + 0xEF1C1847L, 0x3215D908L, 0xDD433B37L, 0x24C2BA16L, + 0x12A14D43L, 0x2A65C451L, 0x50940002L, 0x133AE4DDL, + 0x71DFF89EL, 0x10314E55L, 0x81AC77D6L, 0x5F11199BL, + 0x043556F1L, 0xD7A3C76BL, 0x3C11183BL, 0x5924A509L, + 0xF28FE6EDL, 0x97F1FBFAL, 0x9EBABF2CL, 0x1E153C6EL, + 0x86E34570L, 0xEAE96FB1L, 0x860E5E0AL, 0x5A3E2AB3L, + 0x771FE71CL, 0x4E3D06FAL, 0x2965DCB9L, 0x99E71D0FL, + 0x803E89D6L, 0x5266C825L, 0x2E4CC978L, 0x9C10B36AL, + 0xC6150EBAL, 0x94E2EA78L, 0xA5FC3C53L, 0x1E0A2DF4L, + 0xF2F74EA7L, 0x361D2B3DL, 0x1939260FL, 0x19C27960L, + 0x5223A708L, 0xF71312B6L, 0xEBADFE6EL, 0xEAC31F66L, + 0xE3BC4595L, 0xA67BC883L, 0xB17F37D1L, 0x018CFF28L, + 0xC332DDEFL, 0xBE6C5AA5L, 0x65582185L, 0x68AB9802L, + 0xEECEA50FL, 0xDB2F953BL, 0x2AEF7DADL, 0x5B6E2F84L, + 0x1521B628L, 0x29076170L, 0xECDD4775L, 0x619F1510L, + 0x13CCA830L, 0xEB61BD96L, 0x0334FE1EL, 0xAA0363CFL, + 0xB5735C90L, 0x4C70A239L, 0xD59E9E0BL, 0xCBAADE14L, + 0xEECC86BCL, 0x60622CA7L, 0x9CAB5CABL, 0xB2F3846EL, + 0x648B1EAFL, 0x19BDF0CAL, 0xA02369B9L, 0x655ABB50L, + 0x40685A32L, 0x3C2AB4B3L, 0x319EE9D5L, 0xC021B8F7L, + 0x9B540B19L, 0x875FA099L, 0x95F7997EL, 0x623D7DA8L, + 0xF837889AL, 0x97E32D77L, 0x11ED935FL, 0x16681281L, + 0x0E358829L, 0xC7E61FD6L, 0x96DEDFA1L, 0x7858BA99L, + 0x57F584A5L, 0x1B227263L, 0x9B83C3FFL, 0x1AC24696L, + 0xCDB30AEBL, 0x532E3054L, 0x8FD948E4L, 0x6DBC3128L, + 0x58EBF2EFL, 0x34C6FFEAL, 0xFE28ED61L, 0xEE7C3C73L, + 0x5D4A14D9L, 0xE864B7E3L, 0x42105D14L, 0x203E13E0L, + 0x45EEE2B6L, 0xA3AAABEAL, 0xDB6C4F15L, 0xFACB4FD0L, + 0xC742F442L, 0xEF6ABBB5L, 0x654F3B1DL, 0x41CD2105L, + 0xD81E799EL, 0x86854DC7L, 0xE44B476AL, 0x3D816250L, + 0xCF62A1F2L, 0x5B8D2646L, 0xFC8883A0L, 0xC1C7B6A3L, + 0x7F1524C3L, 0x69CB7492L, 0x47848A0BL, 0x5692B285L, + 0x095BBF00L, 0xAD19489DL, 0x1462B174L, 0x23820E00L, + 0x58428D2AL, 0x0C55F5EAL, 0x1DADF43EL, 0x233F7061L, + 0x3372F092L, 0x8D937E41L, 0xD65FECF1L, 0x6C223BDBL, + 0x7CDE3759L, 0xCBEE7460L, 0x4085F2A7L, 0xCE77326EL, + 0xA6078084L, 0x19F8509EL, 0xE8EFD855L, 0x61D99735L, + 0xA969A7AAL, 0xC50C06C2L, 0x5A04ABFCL, 0x800BCADCL, + 0x9E447A2EL, 0xC3453484L, 0xFDD56705L, 0x0E1E9EC9L, + 0xDB73DBD3L, 0x105588CDL, 0x675FDA79L, 0xE3674340L, + 0xC5C43465L, 0x713E38D8L, 0x3D28F89EL, 0xF16DFF20L, + 0x153E21E7L, 0x8FB03D4AL, 0xE6E39F2BL, 0xDB83ADF7L }, + { 0xE93D5A68L, 0x948140F7L, 0xF64C261CL, 0x94692934L, + 0x411520F7L, 0x7602D4F7L, 0xBCF46B2EL, 0xD4A20068L, + 0xD4082471L, 0x3320F46AL, 0x43B7D4B7L, 0x500061AFL, + 0x1E39F62EL, 0x97244546L, 0x14214F74L, 0xBF8B8840L, + 0x4D95FC1DL, 0x96B591AFL, 0x70F4DDD3L, 0x66A02F45L, + 0xBFBC09ECL, 0x03BD9785L, 0x7FAC6DD0L, 0x31CB8504L, + 0x96EB27B3L, 0x55FD3941L, 0xDA2547E6L, 0xABCA0A9AL, + 0x28507825L, 0x530429F4L, 0x0A2C86DAL, 0xE9B66DFBL, + 0x68DC1462L, 0xD7486900L, 0x680EC0A4L, 0x27A18DEEL, + 0x4F3FFEA2L, 0xE887AD8CL, 0xB58CE006L, 0x7AF4D6B6L, + 0xAACE1E7CL, 0xD3375FECL, 0xCE78A399L, 0x406B2A42L, + 0x20FE9E35L, 0xD9F385B9L, 0xEE39D7ABL, 0x3B124E8BL, + 0x1DC9FAF7L, 0x4B6D1856L, 0x26A36631L, 0xEAE397B2L, + 0x3A6EFA74L, 0xDD5B4332L, 0x6841E7F7L, 0xCA7820FBL, + 0xFB0AF54EL, 0xD8FEB397L, 0x454056ACL, 0xBA489527L, + 0x55533A3AL, 0x20838D87L, 0xFE6BA9B7L, 0xD096954BL, + 0x55A867BCL, 0xA1159A58L, 0xCCA92963L, 0x99E1DB33L, + 0xA62A4A56L, 0x3F3125F9L, 0x5EF47E1CL, 0x9029317CL, + 0xFDF8E802L, 0x04272F70L, 0x80BB155CL, 0x05282CE3L, + 0x95C11548L, 0xE4C66D22L, 0x48C1133FL, 0xC70F86DCL, + 0x07F9C9EEL, 0x41041F0FL, 0x404779A4L, 0x5D886E17L, + 0x325F51EBL, 0xD59BC0D1L, 0xF2BCC18FL, 0x41113564L, + 0x257B7834L, 0x602A9C60L, 0xDFF8E8A3L, 0x1F636C1BL, + 0x0E12B4C2L, 0x02E1329EL, 0xAF664FD1L, 0xCAD18115L, + 0x6B2395E0L, 0x333E92E1L, 0x3B240B62L, 0xEEBEB922L, + 0x85B2A20EL, 0xE6BA0D99L, 0xDE720C8CL, 0x2DA2F728L, + 0xD0127845L, 0x95B794FDL, 0x647D0862L, 0xE7CCF5F0L, + 0x5449A36FL, 0x877D48FAL, 0xC39DFD27L, 0xF33E8D1EL, + 0x0A476341L, 0x992EFF74L, 0x3A6F6EABL, 0xF4F8FD37L, + 0xA812DC60L, 0xA1EBDDF8L, 0x991BE14CL, 0xDB6E6B0DL, + 0xC67B5510L, 0x6D672C37L, 0x2765D43BL, 0xDCD0E804L, + 0xF1290DC7L, 0xCC00FFA3L, 0xB5390F92L, 0x690FED0BL, + 0x667B9FFBL, 0xCEDB7D9CL, 0xA091CF0BL, 0xD9155EA3L, + 0xBB132F88L, 0x515BAD24L, 0x7B9479BFL, 0x763BD6EBL, + 0x37392EB3L, 0xCC115979L, 0x8026E297L, 0xF42E312DL, + 0x6842ADA7L, 0xC66A2B3BL, 0x12754CCCL, 0x782EF11CL, + 0x6A124237L, 0xB79251E7L, 0x06A1BBE6L, 0x4BFB6350L, + 0x1A6B1018L, 0x11CAEDFAL, 0x3D25BDD8L, 0xE2E1C3C9L, + 0x44421659L, 0x0A121386L, 0xD90CEC6EL, 0xD5ABEA2AL, + 0x64AF674EL, 0xDA86A85FL, 0xBEBFE988L, 0x64E4C3FEL, + 0x9DBC8057L, 0xF0F7C086L, 0x60787BF8L, 0x6003604DL, + 0xD1FD8346L, 0xF6381FB0L, 0x7745AE04L, 0xD736FCCCL, + 0x83426B33L, 0xF01EAB71L, 0xB0804187L, 0x3C005E5FL, + 0x77A057BEL, 0xBDE8AE24L, 0x55464299L, 0xBF582E61L, + 0x4E58F48FL, 0xF2DDFDA2L, 0xF474EF38L, 0x8789BDC2L, + 0x5366F9C3L, 0xC8B38E74L, 0xB475F255L, 0x46FCD9B9L, + 0x7AEB2661L, 0x8B1DDF84L, 0x846A0E79L, 0x915F95E2L, + 0x466E598EL, 0x20B45770L, 0x8CD55591L, 0xC902DE4CL, + 0xB90BACE1L, 0xBB8205D0L, 0x11A86248L, 0x7574A99EL, + 0xB77F19B6L, 0xE0A9DC09L, 0x662D09A1L, 0xC4324633L, + 0xE85A1F02L, 0x09F0BE8CL, 0x4A99A025L, 0x1D6EFE10L, + 0x1AB93D1DL, 0x0BA5A4DFL, 0xA186F20FL, 0x2868F169L, + 0xDCB7DA83L, 0x573906FEL, 0xA1E2CE9BL, 0x4FCD7F52L, + 0x50115E01L, 0xA70683FAL, 0xA002B5C4L, 0x0DE6D027L, + 0x9AF88C27L, 0x773F8641L, 0xC3604C06L, 0x61A806B5L, + 0xF0177A28L, 0xC0F586E0L, 0x006058AAL, 0x30DC7D62L, + 0x11E69ED7L, 0x2338EA63L, 0x53C2DD94L, 0xC2C21634L, + 0xBBCBEE56L, 0x90BCB6DEL, 0xEBFC7DA1L, 0xCE591D76L, + 0x6F05E409L, 0x4B7C0188L, 0x39720A3DL, 0x7C927C24L, + 0x86E3725FL, 0x724D9DB9L, 0x1AC15BB4L, 0xD39EB8FCL, + 0xED545578L, 0x08FCA5B5L, 0xD83D7CD3L, 0x4DAD0FC4L, + 0x1E50EF5EL, 0xB161E6F8L, 0xA28514D9L, 0x6C51133CL, + 0x6FD5C7E7L, 0x56E14EC4L, 0x362ABFCEL, 0xDDC6C837L, + 0xD79A3234L, 0x92638212L, 0x670EFA8EL, 0x406000E0L }, + { 0x3A39CE37L, 0xD3FAF5CFL, 0xABC27737L, 0x5AC52D1BL, + 0x5CB0679EL, 0x4FA33742L, 0xD3822740L, 0x99BC9BBEL, + 0xD5118E9DL, 0xBF0F7315L, 0xD62D1C7EL, 0xC700C47BL, + 0xB78C1B6BL, 0x21A19045L, 0xB26EB1BEL, 0x6A366EB4L, + 0x5748AB2FL, 0xBC946E79L, 0xC6A376D2L, 0x6549C2C8L, + 0x530FF8EEL, 0x468DDE7DL, 0xD5730A1DL, 0x4CD04DC6L, + 0x2939BBDBL, 0xA9BA4650L, 0xAC9526E8L, 0xBE5EE304L, + 0xA1FAD5F0L, 0x6A2D519AL, 0x63EF8CE2L, 0x9A86EE22L, + 0xC089C2B8L, 0x43242EF6L, 0xA51E03AAL, 0x9CF2D0A4L, + 0x83C061BAL, 0x9BE96A4DL, 0x8FE51550L, 0xBA645BD6L, + 0x2826A2F9L, 0xA73A3AE1L, 0x4BA99586L, 0xEF5562E9L, + 0xC72FEFD3L, 0xF752F7DAL, 0x3F046F69L, 0x77FA0A59L, + 0x80E4A915L, 0x87B08601L, 0x9B09E6ADL, 0x3B3EE593L, + 0xE990FD5AL, 0x9E34D797L, 0x2CF0B7D9L, 0x022B8B51L, + 0x96D5AC3AL, 0x017DA67DL, 0xD1CF3ED6L, 0x7C7D2D28L, + 0x1F9F25CFL, 0xADF2B89BL, 0x5AD6B472L, 0x5A88F54CL, + 0xE029AC71L, 0xE019A5E6L, 0x47B0ACFDL, 0xED93FA9BL, + 0xE8D3C48DL, 0x283B57CCL, 0xF8D56629L, 0x79132E28L, + 0x785F0191L, 0xED756055L, 0xF7960E44L, 0xE3D35E8CL, + 0x15056DD4L, 0x88F46DBAL, 0x03A16125L, 0x0564F0BDL, + 0xC3EB9E15L, 0x3C9057A2L, 0x97271AECL, 0xA93A072AL, + 0x1B3F6D9BL, 0x1E6321F5L, 0xF59C66FBL, 0x26DCF319L, + 0x7533D928L, 0xB155FDF5L, 0x03563482L, 0x8ABA3CBBL, + 0x28517711L, 0xC20AD9F8L, 0xABCC5167L, 0xCCAD925FL, + 0x4DE81751L, 0x3830DC8EL, 0x379D5862L, 0x9320F991L, + 0xEA7A90C2L, 0xFB3E7BCEL, 0x5121CE64L, 0x774FBE32L, + 0xA8B6E37EL, 0xC3293D46L, 0x48DE5369L, 0x6413E680L, + 0xA2AE0810L, 0xDD6DB224L, 0x69852DFDL, 0x09072166L, + 0xB39A460AL, 0x6445C0DDL, 0x586CDECFL, 0x1C20C8AEL, + 0x5BBEF7DDL, 0x1B588D40L, 0xCCD2017FL, 0x6BB4E3BBL, + 0xDDA26A7EL, 0x3A59FF45L, 0x3E350A44L, 0xBCB4CDD5L, + 0x72EACEA8L, 0xFA6484BBL, 0x8D6612AEL, 0xBF3C6F47L, + 0xD29BE463L, 0x542F5D9EL, 0xAEC2771BL, 0xF64E6370L, + 0x740E0D8DL, 0xE75B1357L, 0xF8721671L, 0xAF537D5DL, + 0x4040CB08L, 0x4EB4E2CCL, 0x34D2466AL, 0x0115AF84L, + 0xE1B00428L, 0x95983A1DL, 0x06B89FB4L, 0xCE6EA048L, + 0x6F3F3B82L, 0x3520AB82L, 0x011A1D4BL, 0x277227F8L, + 0x611560B1L, 0xE7933FDCL, 0xBB3A792BL, 0x344525BDL, + 0xA08839E1L, 0x51CE794BL, 0x2F32C9B7L, 0xA01FBAC9L, + 0xE01CC87EL, 0xBCC7D1F6L, 0xCF0111C3L, 0xA1E8AAC7L, + 0x1A908749L, 0xD44FBD9AL, 0xD0DADECBL, 0xD50ADA38L, + 0x0339C32AL, 0xC6913667L, 0x8DF9317CL, 0xE0B12B4FL, + 0xF79E59B7L, 0x43F5BB3AL, 0xF2D519FFL, 0x27D9459CL, + 0xBF97222CL, 0x15E6FC2AL, 0x0F91FC71L, 0x9B941525L, + 0xFAE59361L, 0xCEB69CEBL, 0xC2A86459L, 0x12BAA8D1L, + 0xB6C1075EL, 0xE3056A0CL, 0x10D25065L, 0xCB03A442L, + 0xE0EC6E0EL, 0x1698DB3BL, 0x4C98A0BEL, 0x3278E964L, + 0x9F1F9532L, 0xE0D392DFL, 0xD3A0342BL, 0x8971F21EL, + 0x1B0A7441L, 0x4BA3348CL, 0xC5BE7120L, 0xC37632D8L, + 0xDF359F8DL, 0x9B992F2EL, 0xE60B6F47L, 0x0FE3F11DL, + 0xE54CDA54L, 0x1EDAD891L, 0xCE6279CFL, 0xCD3E7E6FL, + 0x1618B166L, 0xFD2C1D05L, 0x848FD2C5L, 0xF6FB2299L, + 0xF523F357L, 0xA6327623L, 0x93A83531L, 0x56CCCD02L, + 0xACF08162L, 0x5A75EBB5L, 0x6E163697L, 0x88D273CCL, + 0xDE966292L, 0x81B949D0L, 0x4C50901BL, 0x71C65614L, + 0xE6C6C7BDL, 0x327A140AL, 0x45E1D006L, 0xC3F27B9AL, + 0xC9AA53FDL, 0x62A80F00L, 0xBB25BFE2L, 0x35BDD2F6L, + 0x71126905L, 0xB2040222L, 0xB6CBCF7CL, 0xCD769C2BL, + 0x53113EC0L, 0x1640E3D3L, 0x38ABBD60L, 0x2547ADF0L, + 0xBA38209CL, 0xF746CE76L, 0x77AFA1C5L, 0x20756060L, + 0x85CBFE4EL, 0x8AE88DD8L, 0x7AAAF9B0L, 0x4CF9AA7EL, + 0x1948C25CL, 0x02FB8A8CL, 0x01C36AE4L, 0xD6EBE1F9L, + 0x90D4F869L, 0xA65CDEA0L, 0x3F09252DL, 0xC208E69FL, + 0xB74E6132L, 0xCE77E25BL, 0x578FDFE3L, 0x3AC372E6L } +}; static uint32_t F( mbedtls_blowfish_context *ctx, uint32_t x ) { @@ -390,264 +647,6 @@ int mbedtls_blowfish_crypt_ctr( mbedtls_blowfish_context *ctx, } #endif /* MBEDTLS_CIPHER_MODE_CTR */ -static const uint32_t S[4][256] = { - { 0xD1310BA6L, 0x98DFB5ACL, 0x2FFD72DBL, 0xD01ADFB7L, - 0xB8E1AFEDL, 0x6A267E96L, 0xBA7C9045L, 0xF12C7F99L, - 0x24A19947L, 0xB3916CF7L, 0x0801F2E2L, 0x858EFC16L, - 0x636920D8L, 0x71574E69L, 0xA458FEA3L, 0xF4933D7EL, - 0x0D95748FL, 0x728EB658L, 0x718BCD58L, 0x82154AEEL, - 0x7B54A41DL, 0xC25A59B5L, 0x9C30D539L, 0x2AF26013L, - 0xC5D1B023L, 0x286085F0L, 0xCA417918L, 0xB8DB38EFL, - 0x8E79DCB0L, 0x603A180EL, 0x6C9E0E8BL, 0xB01E8A3EL, - 0xD71577C1L, 0xBD314B27L, 0x78AF2FDAL, 0x55605C60L, - 0xE65525F3L, 0xAA55AB94L, 0x57489862L, 0x63E81440L, - 0x55CA396AL, 0x2AAB10B6L, 0xB4CC5C34L, 0x1141E8CEL, - 0xA15486AFL, 0x7C72E993L, 0xB3EE1411L, 0x636FBC2AL, - 0x2BA9C55DL, 0x741831F6L, 0xCE5C3E16L, 0x9B87931EL, - 0xAFD6BA33L, 0x6C24CF5CL, 0x7A325381L, 0x28958677L, - 0x3B8F4898L, 0x6B4BB9AFL, 0xC4BFE81BL, 0x66282193L, - 0x61D809CCL, 0xFB21A991L, 0x487CAC60L, 0x5DEC8032L, - 0xEF845D5DL, 0xE98575B1L, 0xDC262302L, 0xEB651B88L, - 0x23893E81L, 0xD396ACC5L, 0x0F6D6FF3L, 0x83F44239L, - 0x2E0B4482L, 0xA4842004L, 0x69C8F04AL, 0x9E1F9B5EL, - 0x21C66842L, 0xF6E96C9AL, 0x670C9C61L, 0xABD388F0L, - 0x6A51A0D2L, 0xD8542F68L, 0x960FA728L, 0xAB5133A3L, - 0x6EEF0B6CL, 0x137A3BE4L, 0xBA3BF050L, 0x7EFB2A98L, - 0xA1F1651DL, 0x39AF0176L, 0x66CA593EL, 0x82430E88L, - 0x8CEE8619L, 0x456F9FB4L, 0x7D84A5C3L, 0x3B8B5EBEL, - 0xE06F75D8L, 0x85C12073L, 0x401A449FL, 0x56C16AA6L, - 0x4ED3AA62L, 0x363F7706L, 0x1BFEDF72L, 0x429B023DL, - 0x37D0D724L, 0xD00A1248L, 0xDB0FEAD3L, 0x49F1C09BL, - 0x075372C9L, 0x80991B7BL, 0x25D479D8L, 0xF6E8DEF7L, - 0xE3FE501AL, 0xB6794C3BL, 0x976CE0BDL, 0x04C006BAL, - 0xC1A94FB6L, 0x409F60C4L, 0x5E5C9EC2L, 0x196A2463L, - 0x68FB6FAFL, 0x3E6C53B5L, 0x1339B2EBL, 0x3B52EC6FL, - 0x6DFC511FL, 0x9B30952CL, 0xCC814544L, 0xAF5EBD09L, - 0xBEE3D004L, 0xDE334AFDL, 0x660F2807L, 0x192E4BB3L, - 0xC0CBA857L, 0x45C8740FL, 0xD20B5F39L, 0xB9D3FBDBL, - 0x5579C0BDL, 0x1A60320AL, 0xD6A100C6L, 0x402C7279L, - 0x679F25FEL, 0xFB1FA3CCL, 0x8EA5E9F8L, 0xDB3222F8L, - 0x3C7516DFL, 0xFD616B15L, 0x2F501EC8L, 0xAD0552ABL, - 0x323DB5FAL, 0xFD238760L, 0x53317B48L, 0x3E00DF82L, - 0x9E5C57BBL, 0xCA6F8CA0L, 0x1A87562EL, 0xDF1769DBL, - 0xD542A8F6L, 0x287EFFC3L, 0xAC6732C6L, 0x8C4F5573L, - 0x695B27B0L, 0xBBCA58C8L, 0xE1FFA35DL, 0xB8F011A0L, - 0x10FA3D98L, 0xFD2183B8L, 0x4AFCB56CL, 0x2DD1D35BL, - 0x9A53E479L, 0xB6F84565L, 0xD28E49BCL, 0x4BFB9790L, - 0xE1DDF2DAL, 0xA4CB7E33L, 0x62FB1341L, 0xCEE4C6E8L, - 0xEF20CADAL, 0x36774C01L, 0xD07E9EFEL, 0x2BF11FB4L, - 0x95DBDA4DL, 0xAE909198L, 0xEAAD8E71L, 0x6B93D5A0L, - 0xD08ED1D0L, 0xAFC725E0L, 0x8E3C5B2FL, 0x8E7594B7L, - 0x8FF6E2FBL, 0xF2122B64L, 0x8888B812L, 0x900DF01CL, - 0x4FAD5EA0L, 0x688FC31CL, 0xD1CFF191L, 0xB3A8C1ADL, - 0x2F2F2218L, 0xBE0E1777L, 0xEA752DFEL, 0x8B021FA1L, - 0xE5A0CC0FL, 0xB56F74E8L, 0x18ACF3D6L, 0xCE89E299L, - 0xB4A84FE0L, 0xFD13E0B7L, 0x7CC43B81L, 0xD2ADA8D9L, - 0x165FA266L, 0x80957705L, 0x93CC7314L, 0x211A1477L, - 0xE6AD2065L, 0x77B5FA86L, 0xC75442F5L, 0xFB9D35CFL, - 0xEBCDAF0CL, 0x7B3E89A0L, 0xD6411BD3L, 0xAE1E7E49L, - 0x00250E2DL, 0x2071B35EL, 0x226800BBL, 0x57B8E0AFL, - 0x2464369BL, 0xF009B91EL, 0x5563911DL, 0x59DFA6AAL, - 0x78C14389L, 0xD95A537FL, 0x207D5BA2L, 0x02E5B9C5L, - 0x83260376L, 0x6295CFA9L, 0x11C81968L, 0x4E734A41L, - 0xB3472DCAL, 0x7B14A94AL, 0x1B510052L, 0x9A532915L, - 0xD60F573FL, 0xBC9BC6E4L, 0x2B60A476L, 0x81E67400L, - 0x08BA6FB5L, 0x571BE91FL, 0xF296EC6BL, 0x2A0DD915L, - 0xB6636521L, 0xE7B9F9B6L, 0xFF34052EL, 0xC5855664L, - 0x53B02D5DL, 0xA99F8FA1L, 0x08BA4799L, 0x6E85076AL }, - { 0x4B7A70E9L, 0xB5B32944L, 0xDB75092EL, 0xC4192623L, - 0xAD6EA6B0L, 0x49A7DF7DL, 0x9CEE60B8L, 0x8FEDB266L, - 0xECAA8C71L, 0x699A17FFL, 0x5664526CL, 0xC2B19EE1L, - 0x193602A5L, 0x75094C29L, 0xA0591340L, 0xE4183A3EL, - 0x3F54989AL, 0x5B429D65L, 0x6B8FE4D6L, 0x99F73FD6L, - 0xA1D29C07L, 0xEFE830F5L, 0x4D2D38E6L, 0xF0255DC1L, - 0x4CDD2086L, 0x8470EB26L, 0x6382E9C6L, 0x021ECC5EL, - 0x09686B3FL, 0x3EBAEFC9L, 0x3C971814L, 0x6B6A70A1L, - 0x687F3584L, 0x52A0E286L, 0xB79C5305L, 0xAA500737L, - 0x3E07841CL, 0x7FDEAE5CL, 0x8E7D44ECL, 0x5716F2B8L, - 0xB03ADA37L, 0xF0500C0DL, 0xF01C1F04L, 0x0200B3FFL, - 0xAE0CF51AL, 0x3CB574B2L, 0x25837A58L, 0xDC0921BDL, - 0xD19113F9L, 0x7CA92FF6L, 0x94324773L, 0x22F54701L, - 0x3AE5E581L, 0x37C2DADCL, 0xC8B57634L, 0x9AF3DDA7L, - 0xA9446146L, 0x0FD0030EL, 0xECC8C73EL, 0xA4751E41L, - 0xE238CD99L, 0x3BEA0E2FL, 0x3280BBA1L, 0x183EB331L, - 0x4E548B38L, 0x4F6DB908L, 0x6F420D03L, 0xF60A04BFL, - 0x2CB81290L, 0x24977C79L, 0x5679B072L, 0xBCAF89AFL, - 0xDE9A771FL, 0xD9930810L, 0xB38BAE12L, 0xDCCF3F2EL, - 0x5512721FL, 0x2E6B7124L, 0x501ADDE6L, 0x9F84CD87L, - 0x7A584718L, 0x7408DA17L, 0xBC9F9ABCL, 0xE94B7D8CL, - 0xEC7AEC3AL, 0xDB851DFAL, 0x63094366L, 0xC464C3D2L, - 0xEF1C1847L, 0x3215D908L, 0xDD433B37L, 0x24C2BA16L, - 0x12A14D43L, 0x2A65C451L, 0x50940002L, 0x133AE4DDL, - 0x71DFF89EL, 0x10314E55L, 0x81AC77D6L, 0x5F11199BL, - 0x043556F1L, 0xD7A3C76BL, 0x3C11183BL, 0x5924A509L, - 0xF28FE6EDL, 0x97F1FBFAL, 0x9EBABF2CL, 0x1E153C6EL, - 0x86E34570L, 0xEAE96FB1L, 0x860E5E0AL, 0x5A3E2AB3L, - 0x771FE71CL, 0x4E3D06FAL, 0x2965DCB9L, 0x99E71D0FL, - 0x803E89D6L, 0x5266C825L, 0x2E4CC978L, 0x9C10B36AL, - 0xC6150EBAL, 0x94E2EA78L, 0xA5FC3C53L, 0x1E0A2DF4L, - 0xF2F74EA7L, 0x361D2B3DL, 0x1939260FL, 0x19C27960L, - 0x5223A708L, 0xF71312B6L, 0xEBADFE6EL, 0xEAC31F66L, - 0xE3BC4595L, 0xA67BC883L, 0xB17F37D1L, 0x018CFF28L, - 0xC332DDEFL, 0xBE6C5AA5L, 0x65582185L, 0x68AB9802L, - 0xEECEA50FL, 0xDB2F953BL, 0x2AEF7DADL, 0x5B6E2F84L, - 0x1521B628L, 0x29076170L, 0xECDD4775L, 0x619F1510L, - 0x13CCA830L, 0xEB61BD96L, 0x0334FE1EL, 0xAA0363CFL, - 0xB5735C90L, 0x4C70A239L, 0xD59E9E0BL, 0xCBAADE14L, - 0xEECC86BCL, 0x60622CA7L, 0x9CAB5CABL, 0xB2F3846EL, - 0x648B1EAFL, 0x19BDF0CAL, 0xA02369B9L, 0x655ABB50L, - 0x40685A32L, 0x3C2AB4B3L, 0x319EE9D5L, 0xC021B8F7L, - 0x9B540B19L, 0x875FA099L, 0x95F7997EL, 0x623D7DA8L, - 0xF837889AL, 0x97E32D77L, 0x11ED935FL, 0x16681281L, - 0x0E358829L, 0xC7E61FD6L, 0x96DEDFA1L, 0x7858BA99L, - 0x57F584A5L, 0x1B227263L, 0x9B83C3FFL, 0x1AC24696L, - 0xCDB30AEBL, 0x532E3054L, 0x8FD948E4L, 0x6DBC3128L, - 0x58EBF2EFL, 0x34C6FFEAL, 0xFE28ED61L, 0xEE7C3C73L, - 0x5D4A14D9L, 0xE864B7E3L, 0x42105D14L, 0x203E13E0L, - 0x45EEE2B6L, 0xA3AAABEAL, 0xDB6C4F15L, 0xFACB4FD0L, - 0xC742F442L, 0xEF6ABBB5L, 0x654F3B1DL, 0x41CD2105L, - 0xD81E799EL, 0x86854DC7L, 0xE44B476AL, 0x3D816250L, - 0xCF62A1F2L, 0x5B8D2646L, 0xFC8883A0L, 0xC1C7B6A3L, - 0x7F1524C3L, 0x69CB7492L, 0x47848A0BL, 0x5692B285L, - 0x095BBF00L, 0xAD19489DL, 0x1462B174L, 0x23820E00L, - 0x58428D2AL, 0x0C55F5EAL, 0x1DADF43EL, 0x233F7061L, - 0x3372F092L, 0x8D937E41L, 0xD65FECF1L, 0x6C223BDBL, - 0x7CDE3759L, 0xCBEE7460L, 0x4085F2A7L, 0xCE77326EL, - 0xA6078084L, 0x19F8509EL, 0xE8EFD855L, 0x61D99735L, - 0xA969A7AAL, 0xC50C06C2L, 0x5A04ABFCL, 0x800BCADCL, - 0x9E447A2EL, 0xC3453484L, 0xFDD56705L, 0x0E1E9EC9L, - 0xDB73DBD3L, 0x105588CDL, 0x675FDA79L, 0xE3674340L, - 0xC5C43465L, 0x713E38D8L, 0x3D28F89EL, 0xF16DFF20L, - 0x153E21E7L, 0x8FB03D4AL, 0xE6E39F2BL, 0xDB83ADF7L }, - { 0xE93D5A68L, 0x948140F7L, 0xF64C261CL, 0x94692934L, - 0x411520F7L, 0x7602D4F7L, 0xBCF46B2EL, 0xD4A20068L, - 0xD4082471L, 0x3320F46AL, 0x43B7D4B7L, 0x500061AFL, - 0x1E39F62EL, 0x97244546L, 0x14214F74L, 0xBF8B8840L, - 0x4D95FC1DL, 0x96B591AFL, 0x70F4DDD3L, 0x66A02F45L, - 0xBFBC09ECL, 0x03BD9785L, 0x7FAC6DD0L, 0x31CB8504L, - 0x96EB27B3L, 0x55FD3941L, 0xDA2547E6L, 0xABCA0A9AL, - 0x28507825L, 0x530429F4L, 0x0A2C86DAL, 0xE9B66DFBL, - 0x68DC1462L, 0xD7486900L, 0x680EC0A4L, 0x27A18DEEL, - 0x4F3FFEA2L, 0xE887AD8CL, 0xB58CE006L, 0x7AF4D6B6L, - 0xAACE1E7CL, 0xD3375FECL, 0xCE78A399L, 0x406B2A42L, - 0x20FE9E35L, 0xD9F385B9L, 0xEE39D7ABL, 0x3B124E8BL, - 0x1DC9FAF7L, 0x4B6D1856L, 0x26A36631L, 0xEAE397B2L, - 0x3A6EFA74L, 0xDD5B4332L, 0x6841E7F7L, 0xCA7820FBL, - 0xFB0AF54EL, 0xD8FEB397L, 0x454056ACL, 0xBA489527L, - 0x55533A3AL, 0x20838D87L, 0xFE6BA9B7L, 0xD096954BL, - 0x55A867BCL, 0xA1159A58L, 0xCCA92963L, 0x99E1DB33L, - 0xA62A4A56L, 0x3F3125F9L, 0x5EF47E1CL, 0x9029317CL, - 0xFDF8E802L, 0x04272F70L, 0x80BB155CL, 0x05282CE3L, - 0x95C11548L, 0xE4C66D22L, 0x48C1133FL, 0xC70F86DCL, - 0x07F9C9EEL, 0x41041F0FL, 0x404779A4L, 0x5D886E17L, - 0x325F51EBL, 0xD59BC0D1L, 0xF2BCC18FL, 0x41113564L, - 0x257B7834L, 0x602A9C60L, 0xDFF8E8A3L, 0x1F636C1BL, - 0x0E12B4C2L, 0x02E1329EL, 0xAF664FD1L, 0xCAD18115L, - 0x6B2395E0L, 0x333E92E1L, 0x3B240B62L, 0xEEBEB922L, - 0x85B2A20EL, 0xE6BA0D99L, 0xDE720C8CL, 0x2DA2F728L, - 0xD0127845L, 0x95B794FDL, 0x647D0862L, 0xE7CCF5F0L, - 0x5449A36FL, 0x877D48FAL, 0xC39DFD27L, 0xF33E8D1EL, - 0x0A476341L, 0x992EFF74L, 0x3A6F6EABL, 0xF4F8FD37L, - 0xA812DC60L, 0xA1EBDDF8L, 0x991BE14CL, 0xDB6E6B0DL, - 0xC67B5510L, 0x6D672C37L, 0x2765D43BL, 0xDCD0E804L, - 0xF1290DC7L, 0xCC00FFA3L, 0xB5390F92L, 0x690FED0BL, - 0x667B9FFBL, 0xCEDB7D9CL, 0xA091CF0BL, 0xD9155EA3L, - 0xBB132F88L, 0x515BAD24L, 0x7B9479BFL, 0x763BD6EBL, - 0x37392EB3L, 0xCC115979L, 0x8026E297L, 0xF42E312DL, - 0x6842ADA7L, 0xC66A2B3BL, 0x12754CCCL, 0x782EF11CL, - 0x6A124237L, 0xB79251E7L, 0x06A1BBE6L, 0x4BFB6350L, - 0x1A6B1018L, 0x11CAEDFAL, 0x3D25BDD8L, 0xE2E1C3C9L, - 0x44421659L, 0x0A121386L, 0xD90CEC6EL, 0xD5ABEA2AL, - 0x64AF674EL, 0xDA86A85FL, 0xBEBFE988L, 0x64E4C3FEL, - 0x9DBC8057L, 0xF0F7C086L, 0x60787BF8L, 0x6003604DL, - 0xD1FD8346L, 0xF6381FB0L, 0x7745AE04L, 0xD736FCCCL, - 0x83426B33L, 0xF01EAB71L, 0xB0804187L, 0x3C005E5FL, - 0x77A057BEL, 0xBDE8AE24L, 0x55464299L, 0xBF582E61L, - 0x4E58F48FL, 0xF2DDFDA2L, 0xF474EF38L, 0x8789BDC2L, - 0x5366F9C3L, 0xC8B38E74L, 0xB475F255L, 0x46FCD9B9L, - 0x7AEB2661L, 0x8B1DDF84L, 0x846A0E79L, 0x915F95E2L, - 0x466E598EL, 0x20B45770L, 0x8CD55591L, 0xC902DE4CL, - 0xB90BACE1L, 0xBB8205D0L, 0x11A86248L, 0x7574A99EL, - 0xB77F19B6L, 0xE0A9DC09L, 0x662D09A1L, 0xC4324633L, - 0xE85A1F02L, 0x09F0BE8CL, 0x4A99A025L, 0x1D6EFE10L, - 0x1AB93D1DL, 0x0BA5A4DFL, 0xA186F20FL, 0x2868F169L, - 0xDCB7DA83L, 0x573906FEL, 0xA1E2CE9BL, 0x4FCD7F52L, - 0x50115E01L, 0xA70683FAL, 0xA002B5C4L, 0x0DE6D027L, - 0x9AF88C27L, 0x773F8641L, 0xC3604C06L, 0x61A806B5L, - 0xF0177A28L, 0xC0F586E0L, 0x006058AAL, 0x30DC7D62L, - 0x11E69ED7L, 0x2338EA63L, 0x53C2DD94L, 0xC2C21634L, - 0xBBCBEE56L, 0x90BCB6DEL, 0xEBFC7DA1L, 0xCE591D76L, - 0x6F05E409L, 0x4B7C0188L, 0x39720A3DL, 0x7C927C24L, - 0x86E3725FL, 0x724D9DB9L, 0x1AC15BB4L, 0xD39EB8FCL, - 0xED545578L, 0x08FCA5B5L, 0xD83D7CD3L, 0x4DAD0FC4L, - 0x1E50EF5EL, 0xB161E6F8L, 0xA28514D9L, 0x6C51133CL, - 0x6FD5C7E7L, 0x56E14EC4L, 0x362ABFCEL, 0xDDC6C837L, - 0xD79A3234L, 0x92638212L, 0x670EFA8EL, 0x406000E0L }, - { 0x3A39CE37L, 0xD3FAF5CFL, 0xABC27737L, 0x5AC52D1BL, - 0x5CB0679EL, 0x4FA33742L, 0xD3822740L, 0x99BC9BBEL, - 0xD5118E9DL, 0xBF0F7315L, 0xD62D1C7EL, 0xC700C47BL, - 0xB78C1B6BL, 0x21A19045L, 0xB26EB1BEL, 0x6A366EB4L, - 0x5748AB2FL, 0xBC946E79L, 0xC6A376D2L, 0x6549C2C8L, - 0x530FF8EEL, 0x468DDE7DL, 0xD5730A1DL, 0x4CD04DC6L, - 0x2939BBDBL, 0xA9BA4650L, 0xAC9526E8L, 0xBE5EE304L, - 0xA1FAD5F0L, 0x6A2D519AL, 0x63EF8CE2L, 0x9A86EE22L, - 0xC089C2B8L, 0x43242EF6L, 0xA51E03AAL, 0x9CF2D0A4L, - 0x83C061BAL, 0x9BE96A4DL, 0x8FE51550L, 0xBA645BD6L, - 0x2826A2F9L, 0xA73A3AE1L, 0x4BA99586L, 0xEF5562E9L, - 0xC72FEFD3L, 0xF752F7DAL, 0x3F046F69L, 0x77FA0A59L, - 0x80E4A915L, 0x87B08601L, 0x9B09E6ADL, 0x3B3EE593L, - 0xE990FD5AL, 0x9E34D797L, 0x2CF0B7D9L, 0x022B8B51L, - 0x96D5AC3AL, 0x017DA67DL, 0xD1CF3ED6L, 0x7C7D2D28L, - 0x1F9F25CFL, 0xADF2B89BL, 0x5AD6B472L, 0x5A88F54CL, - 0xE029AC71L, 0xE019A5E6L, 0x47B0ACFDL, 0xED93FA9BL, - 0xE8D3C48DL, 0x283B57CCL, 0xF8D56629L, 0x79132E28L, - 0x785F0191L, 0xED756055L, 0xF7960E44L, 0xE3D35E8CL, - 0x15056DD4L, 0x88F46DBAL, 0x03A16125L, 0x0564F0BDL, - 0xC3EB9E15L, 0x3C9057A2L, 0x97271AECL, 0xA93A072AL, - 0x1B3F6D9BL, 0x1E6321F5L, 0xF59C66FBL, 0x26DCF319L, - 0x7533D928L, 0xB155FDF5L, 0x03563482L, 0x8ABA3CBBL, - 0x28517711L, 0xC20AD9F8L, 0xABCC5167L, 0xCCAD925FL, - 0x4DE81751L, 0x3830DC8EL, 0x379D5862L, 0x9320F991L, - 0xEA7A90C2L, 0xFB3E7BCEL, 0x5121CE64L, 0x774FBE32L, - 0xA8B6E37EL, 0xC3293D46L, 0x48DE5369L, 0x6413E680L, - 0xA2AE0810L, 0xDD6DB224L, 0x69852DFDL, 0x09072166L, - 0xB39A460AL, 0x6445C0DDL, 0x586CDECFL, 0x1C20C8AEL, - 0x5BBEF7DDL, 0x1B588D40L, 0xCCD2017FL, 0x6BB4E3BBL, - 0xDDA26A7EL, 0x3A59FF45L, 0x3E350A44L, 0xBCB4CDD5L, - 0x72EACEA8L, 0xFA6484BBL, 0x8D6612AEL, 0xBF3C6F47L, - 0xD29BE463L, 0x542F5D9EL, 0xAEC2771BL, 0xF64E6370L, - 0x740E0D8DL, 0xE75B1357L, 0xF8721671L, 0xAF537D5DL, - 0x4040CB08L, 0x4EB4E2CCL, 0x34D2466AL, 0x0115AF84L, - 0xE1B00428L, 0x95983A1DL, 0x06B89FB4L, 0xCE6EA048L, - 0x6F3F3B82L, 0x3520AB82L, 0x011A1D4BL, 0x277227F8L, - 0x611560B1L, 0xE7933FDCL, 0xBB3A792BL, 0x344525BDL, - 0xA08839E1L, 0x51CE794BL, 0x2F32C9B7L, 0xA01FBAC9L, - 0xE01CC87EL, 0xBCC7D1F6L, 0xCF0111C3L, 0xA1E8AAC7L, - 0x1A908749L, 0xD44FBD9AL, 0xD0DADECBL, 0xD50ADA38L, - 0x0339C32AL, 0xC6913667L, 0x8DF9317CL, 0xE0B12B4FL, - 0xF79E59B7L, 0x43F5BB3AL, 0xF2D519FFL, 0x27D9459CL, - 0xBF97222CL, 0x15E6FC2AL, 0x0F91FC71L, 0x9B941525L, - 0xFAE59361L, 0xCEB69CEBL, 0xC2A86459L, 0x12BAA8D1L, - 0xB6C1075EL, 0xE3056A0CL, 0x10D25065L, 0xCB03A442L, - 0xE0EC6E0EL, 0x1698DB3BL, 0x4C98A0BEL, 0x3278E964L, - 0x9F1F9532L, 0xE0D392DFL, 0xD3A0342BL, 0x8971F21EL, - 0x1B0A7441L, 0x4BA3348CL, 0xC5BE7120L, 0xC37632D8L, - 0xDF359F8DL, 0x9B992F2EL, 0xE60B6F47L, 0x0FE3F11DL, - 0xE54CDA54L, 0x1EDAD891L, 0xCE6279CFL, 0xCD3E7E6FL, - 0x1618B166L, 0xFD2C1D05L, 0x848FD2C5L, 0xF6FB2299L, - 0xF523F357L, 0xA6327623L, 0x93A83531L, 0x56CCCD02L, - 0xACF08162L, 0x5A75EBB5L, 0x6E163697L, 0x88D273CCL, - 0xDE966292L, 0x81B949D0L, 0x4C50901BL, 0x71C65614L, - 0xE6C6C7BDL, 0x327A140AL, 0x45E1D006L, 0xC3F27B9AL, - 0xC9AA53FDL, 0x62A80F00L, 0xBB25BFE2L, 0x35BDD2F6L, - 0x71126905L, 0xB2040222L, 0xB6CBCF7CL, 0xCD769C2BL, - 0x53113EC0L, 0x1640E3D3L, 0x38ABBD60L, 0x2547ADF0L, - 0xBA38209CL, 0xF746CE76L, 0x77AFA1C5L, 0x20756060L, - 0x85CBFE4EL, 0x8AE88DD8L, 0x7AAAF9B0L, 0x4CF9AA7EL, - 0x1948C25CL, 0x02FB8A8CL, 0x01C36AE4L, 0xD6EBE1F9L, - 0x90D4F869L, 0xA65CDEA0L, 0x3F09252DL, 0xC208E69FL, - 0xB74E6132L, 0xCE77E25BL, 0x578FDFE3L, 0x3AC372E6L } -}; #endif /* !MBEDTLS_BLOWFISH_ALT */ #endif /* MBEDTLS_BLOWFISH_C */ diff --git a/deps/mbedtls/cipher_wrap.c b/deps/mbedtls/cipher_wrap.c index dc76af8ff4..dabc7a25d4 100644 --- a/deps/mbedtls/cipher_wrap.c +++ b/deps/mbedtls/cipher_wrap.c @@ -87,8 +87,8 @@ static void *gcm_ctx_alloc( void ) static void gcm_ctx_free( void *ctx ) { - mbedtls_gcm_free( ctx ); - mbedtls_free( ctx ); + mbedtls_gcm_free((mbedtls_gcm_context*)ctx); + mbedtls_free(ctx); } #endif /* MBEDTLS_GCM_C */ @@ -106,7 +106,7 @@ static void *ccm_ctx_alloc( void ) static void ccm_ctx_free( void *ctx ) { - mbedtls_ccm_free( ctx ); + mbedtls_ccm_free((mbedtls_ccm_context*)ctx); mbedtls_free( ctx ); } #endif /* MBEDTLS_CCM_C */ @@ -162,7 +162,7 @@ static int aes_setkey_enc_wrap( void *ctx, const unsigned char *key, static void * aes_ctx_alloc( void ) { - mbedtls_aes_context *aes = mbedtls_calloc( 1, sizeof( mbedtls_aes_context ) ); + mbedtls_aes_context *aes = (mbedtls_aes_context*)mbedtls_calloc( 1, sizeof( mbedtls_aes_context ) ); if( aes == NULL ) return( NULL ); @@ -518,8 +518,8 @@ static int camellia_setkey_enc_wrap( void *ctx, const unsigned char *key, static void * camellia_ctx_alloc( void ) { - mbedtls_camellia_context *ctx; - ctx = mbedtls_calloc( 1, sizeof( mbedtls_camellia_context ) ); + mbedtls_camellia_context *ctx = (mbedtls_camellia_context*) + mbedtls_calloc( 1, sizeof( mbedtls_camellia_context ) ); if( ctx == NULL ) return( NULL ); @@ -906,7 +906,8 @@ static int des3_set3key_enc_wrap( void *ctx, const unsigned char *key, static void * des_ctx_alloc( void ) { - mbedtls_des_context *des = mbedtls_calloc( 1, sizeof( mbedtls_des_context ) ); + mbedtls_des_context *des = (mbedtls_des_context*) + mbedtls_calloc( 1, sizeof( mbedtls_des_context ) ); if( des == NULL ) return( NULL ); @@ -924,8 +925,7 @@ static void des_ctx_free( void *ctx ) static void * des3_ctx_alloc( void ) { - mbedtls_des3_context *des3; - des3 = mbedtls_calloc( 1, sizeof( mbedtls_des3_context ) ); + mbedtls_des3_context *des3 = (mbedtls_des3_context*)mbedtls_calloc( 1, sizeof( mbedtls_des3_context ) ); if( des3 == NULL ) return( NULL ); @@ -1123,8 +1123,7 @@ static int blowfish_setkey_wrap( void *ctx, const unsigned char *key, static void * blowfish_ctx_alloc( void ) { - mbedtls_blowfish_context *ctx; - ctx = mbedtls_calloc( 1, sizeof( mbedtls_blowfish_context ) ); + mbedtls_blowfish_context *ctx = (mbedtls_blowfish_context*)mbedtls_calloc( 1, sizeof( mbedtls_blowfish_context ) ); if( ctx == NULL ) return( NULL ); @@ -1233,8 +1232,7 @@ static int arc4_setkey_wrap( void *ctx, const unsigned char *key, static void * arc4_ctx_alloc( void ) { - mbedtls_arc4_context *ctx; - ctx = mbedtls_calloc( 1, sizeof( mbedtls_arc4_context ) ); + mbedtls_arc4_context *ctx = (mbedtls_arc4_context*)mbedtls_calloc( 1, sizeof( mbedtls_arc4_context ) ); if( ctx == NULL ) return( NULL ); diff --git a/deps/mbedtls/hmac_drbg.c b/deps/mbedtls/hmac_drbg.c index a32052b724..a8ed885c82 100644 --- a/deps/mbedtls/hmac_drbg.c +++ b/deps/mbedtls/hmac_drbg.c @@ -447,7 +447,7 @@ static size_t test_offset; static int hmac_drbg_self_test_entropy( void *data, unsigned char *buf, size_t len ) { - const unsigned char *p = data; + const unsigned char *p = (const unsigned char*)data; memcpy( buf, p + test_offset, len ); test_offset += len; return( 0 ); diff --git a/deps/mbedtls/pem.c b/deps/mbedtls/pem.c index 37e857e92c..2995d7fd70 100644 --- a/deps/mbedtls/pem.c +++ b/deps/mbedtls/pem.c @@ -323,7 +323,7 @@ int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const if( ret == MBEDTLS_ERR_BASE64_INVALID_CHARACTER ) return( MBEDTLS_ERR_PEM_INVALID_DATA + ret ); - if( ( buf = mbedtls_calloc( 1, len ) ) == NULL ) + if( ( buf = (unsigned char*)mbedtls_calloc( 1, len ) ) == NULL ) return( MBEDTLS_ERR_PEM_ALLOC_FAILED ); if( ( ret = mbedtls_base64_decode( buf, len, &len, s1, s2 - s1 ) ) != 0 ) @@ -409,7 +409,7 @@ int mbedtls_pem_write_buffer( const char *header, const char *footer, return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL ); } - if( ( encode_buf = mbedtls_calloc( 1, use_len ) ) == NULL ) + if( ( encode_buf = (unsigned char*)mbedtls_calloc( 1, use_len ) ) == NULL ) return( MBEDTLS_ERR_PEM_ALLOC_FAILED ); if( ( ret = mbedtls_base64_encode( encode_buf, use_len, &use_len, der_data, diff --git a/deps/mbedtls/ssl_tls.c b/deps/mbedtls/ssl_tls.c index e417d1915a..6c136351c9 100644 --- a/deps/mbedtls/ssl_tls.c +++ b/deps/mbedtls/ssl_tls.c @@ -163,7 +163,7 @@ static int ssl_session_copy( mbedtls_ssl_session *dst, const mbedtls_ssl_session { int ret; - dst->peer_cert = mbedtls_calloc( 1, sizeof(mbedtls_x509_crt) ); + dst->peer_cert = (mbedtls_x509_crt*)mbedtls_calloc( 1, sizeof(mbedtls_x509_crt) ); if( dst->peer_cert == NULL ) return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); @@ -182,7 +182,7 @@ static int ssl_session_copy( mbedtls_ssl_session *dst, const mbedtls_ssl_session #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C) if( src->ticket != NULL ) { - dst->ticket = mbedtls_calloc( 1, src->ticket_len ); + dst->ticket = (unsigned char*)mbedtls_calloc( 1, src->ticket_len ); if( dst->ticket == NULL ) return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); @@ -2471,14 +2471,15 @@ static int ssl_flight_append( mbedtls_ssl_context *ssl ) mbedtls_ssl_flight_item *msg; /* Allocate space for current message */ - if( ( msg = mbedtls_calloc( 1, sizeof( mbedtls_ssl_flight_item ) ) ) == NULL ) + if( ( msg = (mbedtls_ssl_flight_item*) + mbedtls_calloc( 1, sizeof( mbedtls_ssl_flight_item ) ) ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc %d bytes failed", sizeof( mbedtls_ssl_flight_item ) ) ); return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); } - if( ( msg->p = mbedtls_calloc( 1, ssl->out_msglen ) ) == NULL ) + if( ( msg->p = (unsigned char*)mbedtls_calloc( 1, ssl->out_msglen ) ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc %d bytes failed", ssl->out_msglen ) ); mbedtls_free( msg ); @@ -2950,7 +2951,7 @@ static int ssl_reassemble_dtls_handshake( mbedtls_ssl_context *ssl ) /* The bitmask needs one bit per byte of message excluding header */ alloc_len = 12 + msg_len + msg_len / 8 + ( msg_len % 8 != 0 ); - ssl->handshake->hs_msg = mbedtls_calloc( 1, alloc_len ); + ssl->handshake->hs_msg = (unsigned char*)mbedtls_calloc( 1, alloc_len ); if( ssl->handshake->hs_msg == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc failed (%d bytes)", alloc_len ) ); @@ -4453,7 +4454,7 @@ int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl ) mbedtls_free( ssl->session_negotiate->peer_cert ); } - if( ( ssl->session_negotiate->peer_cert = mbedtls_calloc( 1, + if( ( ssl->session_negotiate->peer_cert = (mbedtls_x509_crt*)mbedtls_calloc( 1, sizeof( mbedtls_x509_crt ) ) ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%d bytes) failed", @@ -5506,17 +5507,17 @@ static int ssl_handshake_init( mbedtls_ssl_context *ssl ) */ if( ssl->transform_negotiate == NULL ) { - ssl->transform_negotiate = mbedtls_calloc( 1, sizeof(mbedtls_ssl_transform) ); + ssl->transform_negotiate = (mbedtls_ssl_transform*)mbedtls_calloc( 1, sizeof(mbedtls_ssl_transform) ); } if( ssl->session_negotiate == NULL ) { - ssl->session_negotiate = mbedtls_calloc( 1, sizeof(mbedtls_ssl_session) ); + ssl->session_negotiate = (mbedtls_ssl_session*)mbedtls_calloc( 1, sizeof(mbedtls_ssl_session) ); } if( ssl->handshake == NULL ) { - ssl->handshake = mbedtls_calloc( 1, sizeof(mbedtls_ssl_handshake_params) ); + ssl->handshake = (mbedtls_ssl_handshake_params*)mbedtls_calloc( 1, sizeof(mbedtls_ssl_handshake_params) ); } /* All pointers should exist and can be directly freed without issue */ @@ -5610,8 +5611,8 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl, /* * Prepare base structures */ - if( ( ssl-> in_buf = mbedtls_calloc( 1, len ) ) == NULL || - ( ssl->out_buf = mbedtls_calloc( 1, len ) ) == NULL ) + if( ( ssl-> in_buf = (unsigned char*)mbedtls_calloc( 1, len ) ) == NULL || + ( ssl->out_buf = (unsigned char*)mbedtls_calloc( 1, len ) ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc(%d bytes) failed", len ) ); mbedtls_free( ssl->in_buf ); @@ -5936,27 +5937,26 @@ static int ssl_append_key_cert( mbedtls_ssl_key_cert **head, mbedtls_x509_crt *cert, mbedtls_pk_context *key ) { - mbedtls_ssl_key_cert *new; - - new = mbedtls_calloc( 1, sizeof( mbedtls_ssl_key_cert ) ); - if( new == NULL ) + mbedtls_ssl_key_cert *keycert = (mbedtls_ssl_key_cert*) + mbedtls_calloc( 1, sizeof( mbedtls_ssl_key_cert ) ); + if( keycert == NULL ) return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); - new->cert = cert; - new->key = key; - new->next = NULL; + keycert->cert = cert; + keycert->key = key; + keycert->next = NULL; /* Update head is the list was null, else add to the end */ if( *head == NULL ) { - *head = new; + *head = keycert; } else { mbedtls_ssl_key_cert *cur = *head; while( cur->next != NULL ) cur = cur->next; - cur->next = new; + cur->next = keycert; } return( 0 ); @@ -6054,8 +6054,8 @@ int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf, conf->psk_identity = NULL; } - if( ( conf->psk = mbedtls_calloc( 1, psk_len ) ) == NULL || - ( conf->psk_identity = mbedtls_calloc( 1, psk_identity_len ) ) == NULL ) + if( ( conf->psk = (unsigned char*)mbedtls_calloc( 1, psk_len ) ) == NULL || + ( conf->psk_identity = (unsigned char*)mbedtls_calloc( 1, psk_identity_len ) ) == NULL ) { mbedtls_free( conf->psk ); mbedtls_free( conf->psk_identity ); @@ -6085,7 +6085,8 @@ int mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl, if( ssl->handshake->psk != NULL ) mbedtls_free( ssl->handshake->psk ); - if( ( ssl->handshake->psk = mbedtls_calloc( 1, psk_len ) ) == NULL ) + if( ( ssl->handshake->psk = (unsigned char*) + mbedtls_calloc( 1, psk_len ) ) == NULL ) return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); ssl->handshake->psk_len = psk_len; @@ -6185,7 +6186,7 @@ int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname ) if( hostname_len > MBEDTLS_SSL_MAX_HOST_NAME_LEN ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); - ssl->hostname = mbedtls_calloc( 1, hostname_len + 1 ); + ssl->hostname = (char*)mbedtls_calloc( 1, hostname_len + 1 ); if( ssl->hostname == NULL ) return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index aa0f52dba7..09c6e826f0 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -364,10 +364,11 @@ static void gl_set_viewport_wrapper(void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate) { video_frame_info_t video_info; + gl_t *gl = (gl_t*)data; video_driver_build_info(&video_info); - gl_set_viewport(data, &video_info, + gl_set_viewport(gl, &video_info, viewport_width, viewport_height, force_full, allow_rotate); } diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 5a58463b6b..d581e4790d 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -108,7 +108,7 @@ void cheat_manager_set_code(unsigned i, const char *str) return; if (!string_is_empty(str)) - strcpy(cheat_manager_state.cheats[i].code,str) ; + strcpy(cheat_manager_state.cheats[i].code,str); cheat_manager_state.cheats[i].state = true; } @@ -151,7 +151,7 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw buf[0] = cheats_file[0] = '\0'; if ( (!cheat_manager_state.cheats) || cheat_manager_state.size==0 ) - return false ; + return false; if (!cheat_database) strlcpy(cheats_file, path, sizeof(cheats_file)); @@ -172,7 +172,7 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw if (!conf) return false; - conf->guaranteed_no_duplicates = true ; + conf->guaranteed_no_duplicates = true; config_set_int(conf, "cheats", cheat_manager_state.size); @@ -240,44 +240,42 @@ bool cheat_manager_copy_idx_to_working(unsigned idx) return false; } - memcpy(&(cheat_manager_state.working_cheat), &(cheat_manager_state.cheats[idx]), sizeof(struct item_cheat)) ; + memcpy(&(cheat_manager_state.working_cheat), &(cheat_manager_state.cheats[idx]), sizeof(struct item_cheat)); if ( cheat_manager_state.cheats[idx].desc != NULL ) - strlcpy(cheat_manager_state.working_desc, cheat_manager_state.cheats[idx].desc, CHEAT_DESC_SCRATCH_SIZE) ; + strlcpy(cheat_manager_state.working_desc, cheat_manager_state.cheats[idx].desc, CHEAT_DESC_SCRATCH_SIZE); else - cheat_manager_state.working_desc[0] = '\0' ; + cheat_manager_state.working_desc[0] = '\0'; if ( cheat_manager_state.cheats[idx].code != NULL ) - strlcpy(cheat_manager_state.working_code, cheat_manager_state.cheats[idx].code, CHEAT_CODE_SCRATCH_SIZE) ; + strlcpy(cheat_manager_state.working_code, cheat_manager_state.cheats[idx].code, CHEAT_CODE_SCRATCH_SIZE); else - cheat_manager_state.working_code[0] = '\0' ; + cheat_manager_state.working_code[0] = '\0'; - return true ; + return true; } bool cheat_manager_copy_working_to_idx(unsigned idx) { if ( (!cheat_manager_state.cheats) || (cheat_manager_state.size < idx+1)) - { return false; - } - memcpy(&(cheat_manager_state.cheats[idx]), &(cheat_manager_state.working_cheat), sizeof(struct item_cheat)) ; + memcpy(&(cheat_manager_state.cheats[idx]), &(cheat_manager_state.working_cheat), sizeof(struct item_cheat)); if ( cheat_manager_state.cheats[idx].desc != NULL ) - free(cheat_manager_state.cheats[idx].desc) ; + free(cheat_manager_state.cheats[idx].desc); - cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc) ; + cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc); if ( cheat_manager_state.cheats[idx].code != NULL ) - free(cheat_manager_state.cheats[idx].code) ; + free(cheat_manager_state.cheats[idx].code); - cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code) ; - return true ; + cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code); + return true; } static void cheat_manager_new(unsigned size) { unsigned i; - cheat_manager_free() ; + cheat_manager_free(); cheat_manager_state.buf_size = size; cheat_manager_state.size = size; @@ -290,66 +288,66 @@ static void cheat_manager_new(unsigned size) cheat_manager_state.buf_size = 0; cheat_manager_state.size = 0; cheat_manager_state.cheats = NULL; - return ; + return; } for (i = 0; i < cheat_manager_state.size; i++) { - cheat_manager_state.cheats[i].desc = NULL ; - cheat_manager_state.cheats[i].code = NULL ; + cheat_manager_state.cheats[i].desc = NULL; + cheat_manager_state.cheats[i].code = NULL; cheat_manager_state.cheats[i].state = false; cheat_manager_state.cheats[i].repeat_count = 1; cheat_manager_state.cheats[i].repeat_add_to_value = 0; cheat_manager_state.cheats[i].repeat_add_to_address = 1; } - return ; + return; } void cheat_manager_load_cb_first_pass(char *key, char *value) { - errno = 0 ; + errno = 0; if (string_is_equal(key, "cheats")) { cheat_manager_state.loading_cheat_size = (unsigned)strtoul(value, NULL, 0); if (errno != 0) - cheat_manager_state.loading_cheat_size = 0 ; + cheat_manager_state.loading_cheat_size = 0; } } void cheat_manager_load_cb_second_pass(char *key, char *value) { - char cheat_num_str[20] ; - unsigned cheat_num ; - unsigned cheat_idx ; - int idx = 0 ; - int key_length ; - errno = 0 ; + char cheat_num_str[20]; + unsigned cheat_num; + unsigned cheat_idx; + int idx = 0; + int key_length; + errno = 0; if (strncmp(key, "cheat", 5) != 0) - return ; + return; - idx = 5 ; - key_length = strlen(key) ; + idx = 5; + key_length = strlen(key); while (idx < key_length && key[idx] >= '0' && key[idx] <= '9' && idx < 24) { - cheat_num_str[idx-5] = key[idx] ; - idx++ ; + cheat_num_str[idx-5] = key[idx]; + idx++; } - cheat_num_str[idx-5] = '\0' ; + cheat_num_str[idx-5] = '\0'; - cheat_num = (unsigned)strtoul(cheat_num_str, NULL, 0); ; + cheat_num = (unsigned)strtoul(cheat_num_str, NULL, 0); if (cheat_num+cheat_manager_state.loading_cheat_offset >= cheat_manager_state.size) - return ; + return; - key = key+idx+1 ; + key = key+idx+1; - cheat_idx = cheat_num+cheat_manager_state.loading_cheat_offset ; + cheat_idx = cheat_num+cheat_manager_state.loading_cheat_offset; if (string_is_equal(key, "address")) cheat_manager_state.cheats[cheat_idx].address = (unsigned)strtoul(value, NULL, 0); @@ -360,9 +358,9 @@ void cheat_manager_load_cb_second_pass(char *key, char *value) else if (string_is_equal(key, "cheat_type")) cheat_manager_state.cheats[cheat_idx].cheat_type = (unsigned)strtoul(value, NULL, 0); else if (string_is_equal(key, "code")) - cheat_manager_state.cheats[cheat_idx].code = strdup(value) ; + cheat_manager_state.cheats[cheat_idx].code = strdup(value); else if (string_is_equal(key, "desc")) - cheat_manager_state.cheats[cheat_idx].desc = strdup(value) ; + cheat_manager_state.cheats[cheat_idx].desc = strdup(value); else if (string_is_equal(key, "enable")) cheat_manager_state.cheats[cheat_idx].state = (string_is_equal(value,"true") || string_is_equal(value,"1")); else if (string_is_equal(key, "handler")) @@ -401,61 +399,59 @@ bool cheat_manager_load(const char *path, bool append) config_file_cb_t cb; config_file_t *conf = NULL; - cb.config_file_new_entry_cb = cheat_manager_load_cb_first_pass ; + cb.config_file_new_entry_cb = cheat_manager_load_cb_first_pass; - cheat_manager_state.loading_cheat_size = 0 ; + cheat_manager_state.loading_cheat_size = 0; conf = config_file_new_with_callback(path, &cb); if (!conf) return false; - cheats = cheat_manager_state.loading_cheat_size ; + cheats = cheat_manager_state.loading_cheat_size; if (cheats == 0) goto error; - config_file_free(conf) ; - conf = NULL ; + config_file_free(conf); + conf = NULL; - cheat_manager_alloc_if_empty() ; + cheat_manager_alloc_if_empty(); if ( append ) { - orig_size = cheat_manager_get_size() ; + orig_size = cheat_manager_get_size(); if ( orig_size == 0) { cheat_manager_new(cheats); } else { - cheats = cheats + orig_size ; - if (cheat_manager_realloc(cheats, CHEAT_HANDLER_TYPE_EMU)) - { - } + cheats = cheats + orig_size; + if (cheat_manager_realloc(cheats, CHEAT_HANDLER_TYPE_EMU)) { } } } else { - orig_size = 0 ; + orig_size = 0; cheat_manager_new(cheats); } for (i = orig_size; i < cheats; i++) { - cheat_manager_state.cheats[i].idx = i ; - cheat_manager_state.cheats[i].desc = NULL ; - cheat_manager_state.cheats[i].code = NULL ; - cheat_manager_state.cheats[i].state = false ; - cheat_manager_state.cheats[i].big_endian = false ; - cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ; + cheat_manager_state.cheats[i].idx = i; + cheat_manager_state.cheats[i].desc = NULL; + cheat_manager_state.cheats[i].code = NULL; + cheat_manager_state.cheats[i].state = false; + cheat_manager_state.cheats[i].big_endian = false; + cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE; cheat_manager_state.cheats[i].memory_search_size = 3; } - cheat_manager_state.loading_cheat_offset = orig_size ; - cb.config_file_new_entry_cb = cheat_manager_load_cb_second_pass ; + cheat_manager_state.loading_cheat_offset = orig_size; + cb.config_file_new_entry_cb = cheat_manager_load_cb_second_pass; conf = config_file_new_with_callback(path, &cb); if (!conf) @@ -474,26 +470,26 @@ error: bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) { unsigned i; - unsigned orig_size ; + unsigned orig_size; if (!cheat_manager_state.cheats) { cheat_manager_state.cheats = (struct item_cheat*) calloc(new_size, sizeof(struct item_cheat)); - orig_size = 0 ; + orig_size = 0; } else { - orig_size = cheat_manager_state.size ; + orig_size = cheat_manager_state.size; /* if size is decreasing, free the items that will be lost */ for (i = new_size; i < orig_size; i++) { if ( cheat_manager_state.cheats[i].code != NULL ) - free(cheat_manager_state.cheats[i].code) ; + free(cheat_manager_state.cheats[i].code); if ( cheat_manager_state.cheats[i].desc != NULL ) - free(cheat_manager_state.cheats[i].desc) ; + free(cheat_manager_state.cheats[i].desc); } cheat_manager_state.cheats = (struct item_cheat*) @@ -512,14 +508,14 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) for (i = orig_size; i < cheat_manager_state.size; i++) { - memset(&(cheat_manager_state.cheats[i]), 0, sizeof(cheat_manager_state.cheats[i])) ; - cheat_manager_state.cheats[i].state = false; - cheat_manager_state.cheats[i].handler = default_handler; - cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ; - cheat_manager_state.cheats[i].memory_search_size = 3; - cheat_manager_state.cheats[i].idx = i; - cheat_manager_state.cheats[i].repeat_count = 1; - cheat_manager_state.cheats[i].repeat_add_to_value = 0; + memset(&(cheat_manager_state.cheats[i]), 0, sizeof(cheat_manager_state.cheats[i])); + cheat_manager_state.cheats[i].state = false; + cheat_manager_state.cheats[i].handler = default_handler; + cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE; + cheat_manager_state.cheats[i].memory_search_size = 3; + cheat_manager_state.cheats[i].idx = i; + cheat_manager_state.cheats[i].repeat_count = 1; + cheat_manager_state.cheats[i].repeat_add_to_value = 0; cheat_manager_state.cheats[i].repeat_add_to_address = 1; } @@ -528,37 +524,37 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) void cheat_manager_free(void) { - unsigned i = 0 ; + unsigned i = 0; if (cheat_manager_state.cheats) { for (i = 0; i < cheat_manager_state.size; i++) { if ( cheat_manager_state.cheats[i].desc != NULL ) - free(cheat_manager_state.cheats[i].desc) ; + free(cheat_manager_state.cheats[i].desc); if ( cheat_manager_state.cheats[i].code != NULL ) - free(cheat_manager_state.cheats[i].code) ; + free(cheat_manager_state.cheats[i].code); } free(cheat_manager_state.cheats); } if ( cheat_manager_state.prev_memory_buf ) - free(cheat_manager_state.prev_memory_buf) ; + free(cheat_manager_state.prev_memory_buf); if ( cheat_manager_state.matches ) - free(cheat_manager_state.matches) ; + free(cheat_manager_state.matches); - cheat_manager_state.cheats = NULL ; - cheat_manager_state.size = 0 ; - cheat_manager_state.buf_size = 0 ; - cheat_manager_state.prev_memory_buf = NULL ; - cheat_manager_state.curr_memory_buf = NULL ; - cheat_manager_state.matches = NULL ; - cheat_manager_state.total_memory_size = 0 ; - cheat_manager_state.actual_memory_size = 0 ; - cheat_manager_state.memory_initialized = false ; - cheat_manager_state.memory_search_initialized = false ; + cheat_manager_state.cheats = NULL; + cheat_manager_state.size = 0; + cheat_manager_state.buf_size = 0; + cheat_manager_state.prev_memory_buf = NULL; + cheat_manager_state.curr_memory_buf = NULL; + cheat_manager_state.matches = NULL; + cheat_manager_state.total_memory_size = 0; + cheat_manager_state.actual_memory_size = 0; + cheat_manager_state.memory_initialized = false; + cheat_manager_state.memory_search_initialized = false; } @@ -588,7 +584,7 @@ void cheat_manager_toggle_index(unsigned i) cheat_manager_update(&cheat_manager_state, i); if (!settings) - return ; + return; if (settings->bools.apply_cheats_after_toggle) cheat_manager_apply_cheats(); @@ -657,18 +653,17 @@ bool cheat_manager_get_game_specific_filename(char * cheat_filename, size_t max_ struct retro_system_info system_info; if (!settings || !global || !cheat_filename) - return false ; + return false; if ( !core_get_system_info(&system_info) ) - return false ; - + return false; core_name = system_info.library_name; game_name = path_basename(global->name.cheatfile); if ( string_is_empty(settings->paths.path_cheat_database) || string_is_empty(core_name) || string_is_empty(game_name) ) - return false ; + return false; cheat_filename[0] = '\0'; strlcat(cheat_filename, settings->paths.path_cheat_database, max_length); @@ -681,23 +676,23 @@ bool cheat_manager_get_game_specific_filename(char * cheat_filename, size_t max_ strlcat(cheat_filename, game_name, max_length); - return true ; + return true; } void cheat_manager_load_game_specific_cheats() { - char cheat_file[PATH_MAX_LENGTH] ; + char cheat_file[PATH_MAX_LENGTH]; if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) - cheat_manager_load(cheat_file,true) ; + cheat_manager_load(cheat_file,true); } void cheat_manager_save_game_specific_cheats() { - char cheat_file[PATH_MAX_LENGTH] ; + char cheat_file[PATH_MAX_LENGTH]; if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) - cheat_manager_save(cheat_file, NULL, true) ; + cheat_manager_save(cheat_file, NULL, true); } @@ -708,11 +703,8 @@ void cheat_manager_state_free(void) bool cheat_manager_alloc_if_empty(void) { - if (!cheat_manager_state.cheats) - { cheat_manager_new(0); - } return true; } @@ -731,9 +723,8 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) } if ( meminfo.size == 0 ) - { - return 0 ; - } + return 0; + cheat_manager_state.actual_memory_size = (unsigned)meminfo.size; cheat_manager_state.curr_memory_buf = meminfo.data; cheat_manager_state.total_memory_size = (unsigned)meminfo.size; @@ -787,84 +778,84 @@ static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int * { case 0 : { - *bytes_per_item = 1 ; - *bits = 1 ; - *mask = 0x01 ; - break ; + *bytes_per_item = 1; + *bits = 1; + *mask = 0x01; + break; } case 1 : { - *bytes_per_item = 1 ; - *bits = 2 ; - *mask = 0x03 ; - break ; + *bytes_per_item = 1; + *bits = 2; + *mask = 0x03; + break; } case 2 : { - *bytes_per_item = 1 ; - *bits = 4 ; - *mask = 0x0F ; - break ; + *bytes_per_item = 1; + *bits = 4; + *mask = 0x0F; + break; } case 3 : { - *bytes_per_item = 1 ; - *bits = 8 ; - *mask = 0xFF ; - break ; + *bytes_per_item = 1; + *bits = 8; + *mask = 0xFF; + break; } case 4 : { - *bytes_per_item = 2 ; - *bits = 8 ; - *mask = 0xFFFF ; - break ; + *bytes_per_item = 2; + *bits = 8; + *mask = 0xFFFF; + break; } case 5 : { - *bytes_per_item = 4 ; - *bits = 8 ; - *mask = 0xFFFFFFFF ; - break ; + *bytes_per_item = 4; + *bits = 8; + *mask = 0xFFFFFFFF; + break; } } } int cheat_manager_search_exact(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EXACT) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EXACT); } int cheat_manager_search_lt(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_LT) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_LT); } int cheat_manager_search_gt(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_GT) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_GT); } int cheat_manager_search_lte(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_LTE) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_LTE); } int cheat_manager_search_gte(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_GTE) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_GTE); } int cheat_manager_search_eq(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQ) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQ); } int cheat_manager_search_neq(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_NEQ) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_NEQ); } int cheat_manager_search_eqplus(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQPLUS) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQPLUS); } int cheat_manager_search_eqminus(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQMINUS) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQMINUS); } int cheat_manager_search(enum cheat_search_type search_type) @@ -883,14 +874,14 @@ int cheat_manager_search(enum cheat_search_type search_type) if (!cheat_manager_state.curr_memory_buf) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_NOT_INITIALIZED), 1, 180, true); - return 0 ; + return 0; } - cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ; + cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); /* little endian FF000000 = 256 */ - for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) + for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { unsigned byte_part; @@ -900,73 +891,73 @@ int cheat_manager_search(enum cheat_search_type search_type) { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; + *(curr+idx) + (*(curr+idx+1)*256); prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : - *(prev+idx) + (*(prev+idx+1)*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256); + break; } case 4 : { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : - *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); + break; } case 1 : default : { - curr_val = *(curr+idx) ; - prev_val = *(prev+idx) ; - break ; + curr_val = *(curr+idx); + prev_val = *(prev+idx); + break; } } - for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) + for (byte_part = 0; byte_part < 8/bits; byte_part++) { - unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask ; - unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask ; - unsigned int prev_match ; + unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask; + unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask; + unsigned int prev_match; if (bits < 8 ) - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); else - prev_match = *(cheat_manager_state.matches+idx) ; + prev_match = *(cheat_manager_state.matches+idx); if (prev_match > 0) { - bool match = false ; + bool match = false; switch (search_type) { case CHEAT_SEARCH_TYPE_EXACT : - match = ( curr_subval == cheat_manager_state.search_exact_value) ; + match = ( curr_subval == cheat_manager_state.search_exact_value); break; case CHEAT_SEARCH_TYPE_LT : - match = ( curr_subval < prev_subval) ; + match = ( curr_subval < prev_subval); break; case CHEAT_SEARCH_TYPE_GT : - match = ( curr_subval > prev_subval) ; + match = ( curr_subval > prev_subval); break; case CHEAT_SEARCH_TYPE_LTE : - match = ( curr_subval <= prev_subval) ; + match = ( curr_subval <= prev_subval); break; case CHEAT_SEARCH_TYPE_GTE : - match = ( curr_subval >= prev_subval) ; + match = ( curr_subval >= prev_subval); break; case CHEAT_SEARCH_TYPE_EQ : - match = ( curr_subval == prev_subval) ; + match = ( curr_subval == prev_subval); break; case CHEAT_SEARCH_TYPE_NEQ : - match = ( curr_subval != prev_subval) ; + match = ( curr_subval != prev_subval); break; case CHEAT_SEARCH_TYPE_EQPLUS : - match = ( curr_subval == prev_subval+cheat_manager_state.search_eqplus_value) ; + match = ( curr_subval == prev_subval+cheat_manager_state.search_eqplus_value); break; case CHEAT_SEARCH_TYPE_EQMINUS : - match = ( curr_subval == prev_subval-cheat_manager_state.search_eqminus_value) ; + match = ( curr_subval == prev_subval-cheat_manager_state.search_eqminus_value); break; } if (!match ) @@ -975,9 +966,9 @@ int cheat_manager_search(enum cheat_search_type search_type) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; + memset(cheat_manager_state.matches+idx,0,bytes_per_item); if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches-- ; + cheat_manager_state.num_matches--; } } } @@ -985,7 +976,7 @@ int cheat_manager_search(enum cheat_search_type search_type) memcpy(cheat_manager_state.prev_memory_buf, cheat_manager_state.curr_memory_buf, cheat_manager_state.actual_memory_size); - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches) ; + snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches); msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, 1, 180, true); @@ -994,7 +985,7 @@ int cheat_manager_search(enum cheat_search_type search_type) menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); #endif - return 0 ; + return 0; } bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int address, unsigned int address_mask, @@ -1003,15 +994,15 @@ bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int ad int new_size = cheat_manager_get_size() + 1; if ( !cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO) ) - return false ; + return false; - cheat_manager_state.cheats[cheat_manager_state.size-1].address = address ; - cheat_manager_state.cheats[cheat_manager_state.size-1].address_mask = address_mask ; - cheat_manager_state.cheats[cheat_manager_state.size-1].memory_search_size = memory_search_size ; - cheat_manager_state.cheats[cheat_manager_state.size-1].value = value ; - cheat_manager_state.cheats[cheat_manager_state.size-1].big_endian = big_endian ; + cheat_manager_state.cheats[cheat_manager_state.size-1].address = address; + cheat_manager_state.cheats[cheat_manager_state.size-1].address_mask = address_mask; + cheat_manager_state.cheats[cheat_manager_state.size-1].memory_search_size = memory_search_size; + cheat_manager_state.cheats[cheat_manager_state.size-1].value = value; + cheat_manager_state.cheats[cheat_manager_state.size-1].big_endian = big_endian; - return true ; + return true; } int cheat_manager_add_matches(const char *path, const char *label, unsigned type, size_t menuidx, size_t entry_idx) @@ -1030,66 +1021,66 @@ int cheat_manager_add_matches(const char *path, if ( cheat_manager_state.num_matches + cheat_manager_state.size > 100 ) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY), 1, 180, true); - return 0 ; + return 0; } - cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ; + cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); - for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) + for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { switch ( bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256); + break; case 4 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + break; case 1 : default : - curr_val = *(curr+idx) ; - break ; + curr_val = *(curr+idx); + break; } - for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) + for (byte_part = 0; byte_part < 8/bits; byte_part++) { unsigned int prev_match; if (bits < 8 ) { - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); if (prev_match) { if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)), cheat_manager_state.big_endian, curr_val) ) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true); - return 0 ; + return 0; } - num_added++ ; + num_added++; } } else { - prev_match = *(cheat_manager_state.matches+idx) ; + prev_match = *(cheat_manager_state.matches+idx); if (prev_match) { if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, cheat_manager_state.big_endian, curr_val)) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true); - return 0 ; + return 0; } - num_added++ ; + num_added++; } } } } - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_manager_state.num_matches) ; + snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_manager_state.num_matches); msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, 1, 180, true); @@ -1111,38 +1102,38 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu case RUMBLE_TYPE_DISABLED: return; case RUMBLE_TYPE_CHANGES: - rumble = (curr_value != cheat->rumble_prev_value) ; - break ; + rumble = (curr_value != cheat->rumble_prev_value); + break; case RUMBLE_TYPE_DOES_NOT_CHANGE: - rumble = (curr_value == cheat->rumble_prev_value) ; - break ; + rumble = (curr_value == cheat->rumble_prev_value); + break; case RUMBLE_TYPE_INCREASE: - rumble = (curr_value > cheat->rumble_prev_value) ; - break ; + rumble = (curr_value > cheat->rumble_prev_value); + break; case RUMBLE_TYPE_DECREASE: - rumble = (curr_value < cheat->rumble_prev_value) ; - break ; + rumble = (curr_value < cheat->rumble_prev_value); + break; case RUMBLE_TYPE_EQ_VALUE: - rumble = (curr_value == cheat->rumble_value) ; - break ; + rumble = (curr_value == cheat->rumble_value); + break; case RUMBLE_TYPE_NEQ_VALUE: - rumble = (curr_value != cheat->rumble_value) ; - break ; + rumble = (curr_value != cheat->rumble_value); + break; case RUMBLE_TYPE_LT_VALUE: - rumble = (curr_value < cheat->rumble_value) ; - break ; + rumble = (curr_value < cheat->rumble_value); + break; case RUMBLE_TYPE_GT_VALUE: - rumble = (curr_value > cheat->rumble_value) ; + rumble = (curr_value > cheat->rumble_value); break; case RUMBLE_TYPE_INCREASE_BY_VALUE: - rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value) ; - break ; + rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value); + break; case RUMBLE_TYPE_DECREASE_BY_VALUE: - rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value) ; - break ; + rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value); + break; } - cheat->rumble_prev_value = curr_value ; + cheat->rumble_prev_value = curr_value; /* Give the emulator enough time * to initialize, load state, etc */ @@ -1150,15 +1141,15 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu { if (rumble) { - cheat->rumble_primary_end_time = cpu_features_get_time_usec() + (cheat->rumble_primary_duration*1000) ; - cheat->rumble_secondary_end_time = cpu_features_get_time_usec() + (cheat->rumble_secondary_duration*1000) ; + cheat->rumble_primary_end_time = cpu_features_get_time_usec() + (cheat->rumble_primary_duration*1000); + cheat->rumble_secondary_end_time = cpu_features_get_time_usec() + (cheat->rumble_secondary_duration*1000); input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_STRONG, cheat->rumble_primary_strength); input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_WEAK, cheat->rumble_secondary_strength); } } else { - cheat->rumble_initialized++ ; + cheat->rumble_initialized++; return; } @@ -1177,7 +1168,7 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu { if (cheat->rumble_secondary_end_time != 0) input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_WEAK, 0); - cheat->rumble_secondary_end_time = 0 ; + cheat->rumble_secondary_end_time = 0; } else { @@ -1197,19 +1188,19 @@ void cheat_manager_apply_retro_cheats(void) if ((!cheat_manager_state.cheats)) return; - for (i = 0 ; i < cheat_manager_state.size ; i++ ) + for (i = 0; i < cheat_manager_state.size; i++ ) { unsigned char *curr; unsigned int idx; bool set_value = false; unsigned int value_to_set = 0; - unsigned int repeat_iter = 0 ; - unsigned int address_mask = cheat_manager_state.cheats[i].address_mask ; + unsigned int repeat_iter = 0; + unsigned int address_mask = cheat_manager_state.cheats[i].address_mask; if (cheat_manager_state.cheats[i].handler != CHEAT_HANDLER_TYPE_RETRO || !cheat_manager_state.cheats[i].state) - continue ; + continue; if (!cheat_manager_state.memory_initialized) - cheat_manager_initialize_memory(NULL, false) ; + cheat_manager_initialize_memory(NULL, false); /* If we're still not initialized, something * must have gone wrong - just bail */ @@ -1218,13 +1209,13 @@ void cheat_manager_apply_retro_cheats(void) if (!run_cheat) { - run_cheat = true ; - continue ; + run_cheat = true; + continue; } - cheat_manager_setup_search_meta(cheat_manager_state.cheats[i].memory_search_size, &bytes_per_item, &mask, &bits) ; + cheat_manager_setup_search_meta(cheat_manager_state.cheats[i].memory_search_size, &bytes_per_item, &mask, &bits); - curr = cheat_manager_state.curr_memory_buf ; - idx = cheat_manager_state.cheats[i].address ; + curr = cheat_manager_state.curr_memory_buf; + idx = cheat_manager_state.cheats[i].address; switch (bytes_per_item) { @@ -1232,142 +1223,142 @@ void cheat_manager_apply_retro_cheats(void) { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256); + break; } case 4 : { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + break; } case 1 : default : { - curr_val = *(curr+idx) ; - break ; + curr_val = *(curr+idx); + break; } } - cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val) ; + cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val); switch (cheat_manager_state.cheats[i].cheat_type ) { case CHEAT_TYPE_SET_TO_VALUE : - set_value = true ; - value_to_set = cheat_manager_state.cheats[i].value ; - break ; + set_value = true; + value_to_set = cheat_manager_state.cheats[i].value; + break; case CHEAT_TYPE_INCREASE_VALUE: - set_value = true ; - value_to_set = curr_val + cheat_manager_state.cheats[i].value ; + set_value = true; + value_to_set = curr_val + cheat_manager_state.cheats[i].value; break; case CHEAT_TYPE_DECREASE_VALUE: - set_value = true ; - value_to_set = curr_val - cheat_manager_state.cheats[i].value ; + set_value = true; + value_to_set = curr_val - cheat_manager_state.cheats[i].value; break; case CHEAT_TYPE_RUN_NEXT_IF_EQ: if (!(curr_val == cheat_manager_state.cheats[i].value)) - run_cheat = false ; + run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_NEQ: if (!(curr_val != cheat_manager_state.cheats[i].value )) - run_cheat = false ; + run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_LT: if (!(cheat_manager_state.cheats[i].value < curr_val)) - run_cheat = false ; + run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_GT: if (!(cheat_manager_state.cheats[i].value > curr_val)) - run_cheat = false ; + run_cheat = false; break; } if (set_value) { - for ( repeat_iter = 1 ; repeat_iter <= cheat_manager_state.cheats[i].repeat_count ; repeat_iter++) + for ( repeat_iter = 1; repeat_iter <= cheat_manager_state.cheats[i].repeat_count; repeat_iter++) { switch (bytes_per_item) { case 2 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 8) & 0xFF ; - *(curr+idx+1) = value_to_set & 0xFF ; + *(curr+idx) = (value_to_set >> 8) & 0xFF; + *(curr+idx+1) = value_to_set & 0xFF; } else { - *(curr+idx) = value_to_set & 0xFF ; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF ; + *(curr+idx) = value_to_set & 0xFF; + *(curr+idx+1) = (value_to_set >> 8) & 0xFF; } - break ; + break; case 4 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 24) & 0xFF ; - *(curr+idx+1) = (value_to_set >> 16) & 0xFF ; - *(curr+idx+2) = (value_to_set >> 8) & 0xFF ; - *(curr+idx+3) = value_to_set & 0xFF ; + *(curr+idx) = (value_to_set >> 24) & 0xFF; + *(curr+idx+1) = (value_to_set >> 16) & 0xFF; + *(curr+idx+2) = (value_to_set >> 8) & 0xFF; + *(curr+idx+3) = value_to_set & 0xFF; } else { - *(curr+idx) = value_to_set & 0xFF ; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF ; - *(curr+idx+2) = (value_to_set >> 16) & 0xFF ; - *(curr+idx+3) = (value_to_set >> 24) & 0xFF ; + *(curr+idx) = value_to_set & 0xFF; + *(curr+idx+1) = (value_to_set >> 8) & 0xFF; + *(curr+idx+2) = (value_to_set >> 16) & 0xFF; + *(curr+idx+3) = (value_to_set >> 24) & 0xFF; } - break ; + break; case 1 : if (bits < 8) { unsigned bitpos; unsigned char val = *(curr+idx); - for (bitpos = 0 ; bitpos < 8 ; bitpos++) + for (bitpos = 0; bitpos < 8; bitpos++) { if ((address_mask>>bitpos)&0x01 ) { - mask = (~(1<>bitpos)&0x01)<>bitpos)&0x01)< cheat_manager_state.num_matches-1) @@ -1396,57 +1387,57 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); if (match_action == CHEAT_MATCH_ACTION_TYPE_BROWSE) - start_idx = *address ; + start_idx = *address; else - start_idx = 0 ; + start_idx = 0; - for (idx = start_idx ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) + for (idx = start_idx; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { switch (bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; + *(curr+idx) + (*(curr+idx+1)*256); if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : - *(prev+idx) + (*(prev+idx+1)*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256); + break; case 4 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : - *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); + break; case 1 : default : - curr_val = *(curr+idx) ; + curr_val = *(curr+idx); if (prev != NULL) - prev_val = *(prev+idx) ; - break ; + prev_val = *(prev+idx); + break; } if (match_action == CHEAT_MATCH_ACTION_TYPE_BROWSE) { *curr_value = curr_val; *prev_value = prev_val; - return ; + return; } if (!prev) return; - for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) + for (byte_part = 0; byte_part < 8/bits; byte_part++) { - unsigned int prev_match ; + unsigned int prev_match; if (bits < 8 ) { - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); if (prev_match) { if (target_match_idx == curr_match_idx) @@ -1454,12 +1445,12 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig switch (match_action) { case CHEAT_MATCH_ACTION_TYPE_BROWSE : - return ; + return; case CHEAT_MATCH_ACTION_TYPE_VIEW : - *address = idx ; - *address_mask = (mask << (byte_part*bits)) ; - *curr_value = curr_val ; - *prev_value = prev_val ; + *address = idx; + *address_mask = (mask << (byte_part*bits)); + *curr_value = curr_val; + *prev_value = prev_val; return; case CHEAT_MATCH_ACTION_TYPE_COPY : if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)), @@ -1467,26 +1458,26 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true); - return ; + return; case CHEAT_MATCH_ACTION_TYPE_DELETE : if (bits < 8) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; + memset(cheat_manager_state.matches+idx,0,bytes_per_item); if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches-- ; + cheat_manager_state.num_matches--; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); return; } return; } - curr_match_idx++ ; + curr_match_idx++; } } else { - prev_match = *(cheat_manager_state.matches+idx) ; + prev_match = *(cheat_manager_state.matches+idx); if (prev_match) { if (target_match_idx == curr_match_idx) @@ -1494,33 +1485,33 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig switch (match_action) { case CHEAT_MATCH_ACTION_TYPE_BROWSE : - return ; + return; case CHEAT_MATCH_ACTION_TYPE_VIEW : - *address = idx ; - *address_mask = 0xFF ; - *curr_value = curr_val ; - *prev_value = prev_val ; - return ; + *address = idx; + *address_mask = 0xFF; + *curr_value = curr_val; + *prev_value = prev_val; + return; case CHEAT_MATCH_ACTION_TYPE_COPY : if ( !cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, cheat_manager_state.big_endian, curr_val) ) runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true); - return ; + return; case CHEAT_MATCH_ACTION_TYPE_DELETE : if ( bits < 8 ) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; + memset(cheat_manager_state.matches+idx,0,bytes_per_item); if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches-- ; + cheat_manager_state.num_matches--; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); - return ; + return; } } - curr_match_idx++ ; + curr_match_idx++; } } @@ -1530,8 +1521,8 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig int cheat_manager_copy_match(rarch_setting_t *setting, bool wraparound) { cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_COPY, - cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ; - return 0 ; + cheat_manager_state.match_idx, NULL, NULL, NULL, NULL); + return 0; } int cheat_manager_delete_match(rarch_setting_t *setting, bool wraparound) From 230a7fd7b023bc9cdee86251b37b726eb884441a Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 10 Oct 2018 10:59:28 -0400 Subject: [PATCH 0306/1292] Win95 buildfix --- menu/drivers_display/menu_display_gdi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/menu/drivers_display/menu_display_gdi.c b/menu/drivers_display/menu_display_gdi.c index 1c5b6e0a6e..e4b2f1f746 100644 --- a/menu/drivers_display/menu_display_gdi.c +++ b/menu/drivers_display/menu_display_gdi.c @@ -70,7 +70,9 @@ static void menu_display_gdi_draw(menu_display_ctx_draw_t *draw, if (gdi->memDC) { +#if _WIN32_WINNT >= 0x0410 /* Win98 */ BLENDFUNCTION blend = {0}; +#endif if (!gdi->texDC) gdi->texDC = CreateCompatibleDC(gdi->winDC); @@ -90,17 +92,20 @@ static void menu_display_gdi_draw(menu_display_ctx_draw_t *draw, gdi->bmp_old = SelectObject(gdi->memDC, gdi->bmp); +#if _WIN32_WINNT >= 0x0410 /* Win98 */ blend.BlendOp = AC_SRC_OVER; blend.BlendFlags = 0; blend.SourceConstantAlpha = 255;/*clamp_8bit(draw->coords->color[3] * 255.0f);*/ blend.AlphaFormat = AC_SRC_ALPHA; + /* AlphaBlend() is only available since Win98 */ AlphaBlend(gdi->memDC, draw->x, video_info->height - draw->height - draw->y, draw->width, draw->height, gdi->texDC, 0, 0, draw->width, draw->height, blend); - /*TransparentBlt(gdi->memDC, draw->x, video_info->height - draw->height - draw->y, draw->width, draw->height, gdi->texDC, 0, 0, draw->width, draw->height, 0);*/ +#else + /* Just draw without the blending */ + StretchBlt(gdi->memDC, draw->x, video_info->height - draw->height - draw->y, draw->width, draw->height, gdi->texDC, 0, 0, draw->width, draw->height, SRCCOPY); - /* To draw without blending: */ - /*StretchBlt(gdi->memDC, draw->x, video_info->height - draw->height - draw->y, draw->width, draw->height, gdi->texDC, 0, 0, draw->width, draw->height, SRCCOPY);*/ +#endif SelectObject(gdi->memDC, gdi->bmp_old); SelectObject(gdi->texDC, texture->bmp_old); From 4c3b06d64039c8cedd0a671d335783dc0a6fc288 Mon Sep 17 00:00:00 2001 From: Sven <40953353+RetroSven@users.noreply.github.com> Date: Wed, 10 Oct 2018 11:10:49 -0400 Subject: [PATCH 0307/1292] bugfix cheat saving --- libretro-common/file/config_file.c | 7 ++++++- libretro-common/include/file/config_file.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 7dd671b662..846fa2c6fc 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -406,6 +406,7 @@ static config_file_t *config_file_new_internal( conf->path = NULL; conf->entries = NULL; conf->tail = NULL; + conf->last = NULL; conf->includes = NULL; conf->include_depth = 0; conf->guaranteed_no_duplicates = false ; @@ -558,6 +559,7 @@ config_file_t *config_file_new_from_string(const char *from_string) conf->path = NULL; conf->entries = NULL; conf->tail = NULL; + conf->last = NULL; conf->includes = NULL; conf->include_depth = 0; conf->guaranteed_no_duplicates = false ; @@ -842,7 +844,7 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in) void config_set_string(config_file_t *conf, const char *key, const char *val) { - struct config_entry_list *last = conf->entries; + struct config_entry_list *last = (conf->guaranteed_no_duplicates && conf->last) ? conf->last : conf->entries; struct config_entry_list *entry = conf->guaranteed_no_duplicates?NULL:config_get_entry(conf, key, &last); if (entry && !entry->readonly) @@ -868,6 +870,9 @@ void config_set_string(config_file_t *conf, const char *key, const char *val) last->next = entry; else conf->entries = entry; + + conf->last = entry ; + } void config_unset(config_file_t *conf, const char *key) diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index e55430472d..d2d5b026f7 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -57,6 +57,7 @@ struct config_file char *path; struct config_entry_list *entries; struct config_entry_list *tail; + struct config_entry_list *last; unsigned include_depth; bool guaranteed_no_duplicates; From b61c67b5c68e6a5ecd733c34a2a91e03cb5e1166 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 17:17:02 +0200 Subject: [PATCH 0308/1292] Don't have GDI fallback to rgui --- configuration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/configuration.c b/configuration.c index 4759929212..118fe20bef 100644 --- a/configuration.c +++ b/configuration.c @@ -2357,6 +2357,7 @@ static bool check_menu_driver_compatibility(void) string_is_equal(video_driver, "d3d10") || string_is_equal(video_driver, "d3d11") || string_is_equal(video_driver, "d3d12") || + string_is_equal(video_driver, "gdi") || string_is_equal(video_driver, "gl") || string_is_equal(video_driver, "gx2") || string_is_equal(video_driver, "vulkan") || From c3c169aeabd1f4a7010f698a251018f06cbaca8d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 18:08:13 +0200 Subject: [PATCH 0309/1292] Add this --- gfx/drivers/gl.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 09c6e826f0..7db576af99 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1788,28 +1788,37 @@ static void *gl_init(const video_info_t *video, hwr = video_driver_get_hw_context(); +#ifdef GL_CONTEXT_PROFILE_MASK if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) { - gfx_ctx_flags_t flags; + /* Check if we have a core context */ + GLint gl_flags = 0; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &gl_flags); - gl_query_core_context_set(true); - gl->core_context_in_use = true; - - /** - * Ensure that the rest of the frontend knows we have a core context - */ - flags.flags = 0; - BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); - - video_context_driver_set_flags(&flags); - - RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); - if (!gl_check_capability(GL_CAPS_VAO)) + if (gl_flags & GL_CONTEXT_CORE_PROFILE_BIT) { - RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); - goto error; + gfx_ctx_flags_t flags; + + gl_query_core_context_set(true); + gl->core_context_in_use = true; + + /** + * Ensure that the rest of the frontend knows we have a core context + */ + flags.flags = 0; + BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); + + video_context_driver_set_flags(&flags); + + RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); + if (!gl_check_capability(GL_CAPS_VAO)) + { + RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); + goto error; + } } } +#endif if (!renderchain_gl_init_first(&gl->renderchain_driver, &gl->renderchain_data)) From 5b4473b9489c6034fb88e78f6bf3775fa8448644 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 18:24:41 +0200 Subject: [PATCH 0310/1292] Create gl_set_core_context --- dynamic.c | 16 ++++++++-------- gfx/common/gl_common.h | 18 ++++++++++++++++++ gfx/drivers/gl.c | 19 ++++++------------- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/dynamic.c b/dynamic.c index 81a03dd2a1..e011d802fa 100644 --- a/dynamic.c +++ b/dynamic.c @@ -39,6 +39,10 @@ #include "cheevos/cheevos.h" #endif +#ifdef HAVE_OPENGL +#include "gfx/common/gl_common.h" +#endif + #ifdef HAVE_NETWORKING #include "network/netplay/netplay.h" #endif @@ -1368,14 +1372,10 @@ bool rarch_environment_cb(unsigned cmd, void *data) if (!dynamic_verify_hw_context(cb->context_type, cb->version_minor, cb->version_major)) return false; - if (cb->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) - { - gfx_ctx_flags_t flags; - flags.flags = 0; - BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); - - video_context_driver_set_flags(&flags); - } +#if defined(HAVE_OPENGL) + if (!gl_set_core_context(cb->context_type)) + return false; +#endif cb->get_current_framebuffer = video_driver_get_current_framebuffer; cb->get_proc_address = video_driver_get_proc_address; diff --git a/gfx/common/gl_common.h b/gfx/common/gl_common.h index 41a52f2bd5..0f77410cd5 100644 --- a/gfx/common/gl_common.h +++ b/gfx/common/gl_common.h @@ -19,6 +19,7 @@ #include #include +#include #include #ifdef HAVE_CONFIG_H @@ -386,6 +387,23 @@ static INLINE GLenum gl_min_filter_to_mag(GLenum type) return type; } +static INLINE bool gl_set_core_context(enum retro_hw_context_type ctx_type) +{ + gfx_ctx_flags_t flags; + if (ctx_type != RETRO_HW_CONTEXT_OPENGL_CORE) + return false; + + /** + * Ensure that the rest of the frontend knows we have a core context + */ + flags.flags = 0; + BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); + + video_context_driver_set_flags(&flags); + + return true; +} + RETRO_END_DECLS #endif diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 7db576af99..8589a69c6e 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1797,25 +1797,18 @@ static void *gl_init(const video_info_t *video, if (gl_flags & GL_CONTEXT_CORE_PROFILE_BIT) { - gfx_ctx_flags_t flags; - - gl_query_core_context_set(true); - gl->core_context_in_use = true; - - /** - * Ensure that the rest of the frontend knows we have a core context - */ - flags.flags = 0; - BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); - - video_context_driver_set_flags(&flags); - RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); if (!gl_check_capability(GL_CAPS_VAO)) { RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); goto error; } + + if (gl_set_core_context(hwr->context_type)) + { + gl_query_core_context_set(true); + gl->core_context_in_use = true; + } } } #endif From 1bda769faba5a2615db4a3eb4c1a7c9d803d105c Mon Sep 17 00:00:00 2001 From: Ayssia Date: Thu, 11 Oct 2018 01:51:18 +0800 Subject: [PATCH 0311/1292] Update Simplified Chinese Localization --- intl/msg_hash_chs.h | 120 ++++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index cedf839410..6f821a465c 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -137,7 +137,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, - "强制同步CPU和GPU,以性能为代价换取低延迟。" + "强制同步 CPU 和 GPU,以性能为代价换取低延迟。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_THREADED, @@ -266,7 +266,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_LATENCY, - "音频时延(ms)" + "音频时延(ms)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW, @@ -278,7 +278,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, - "音频输出码率(Hz)" + "音频输出码率(Hz)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_RATE_CONTROL_DELTA, @@ -298,7 +298,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME, - "音频音量级别(dB)" + "音频音量级别(dB)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, @@ -680,7 +680,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_LOADING_CONTENT, MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT, "扫描游戏内容") MSG_HASH(MENU_ENUM_LABEL_VALUE_HELP_WHAT_IS_A_CORE, - "什么是“核心”?") + "什么是「核心」?") MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_LIST_ENABLE, "启用历史记录") MSG_HASH(MENU_ENUM_LABEL_VALUE_HISTORY_TAB, @@ -1218,7 +1218,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, MSG_HASH(MENU_ENUM_LABEL_VALUE_OPTIONAL, "任意") MSG_HASH(MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, - "OSK图层文件夹") + "OSK 图层文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY, "图层") MSG_HASH(MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, @@ -1278,11 +1278,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION, MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DEVELOPER, "开发者") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_ISSUE, - "Edge杂志发行") + "Edge 杂志发行") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_RATING, - "Edge杂志评分") + "Edge 杂志评分") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_REVIEW, - "Edge杂志评论") + "Edge 杂志评论") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ELSPA_RATING, "ELSPA 分级") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ENHANCEMENT_HW, @@ -1290,7 +1290,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ENHANCEMENT_HW, MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ESRB_RATING, "ESRB 分级") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FAMITSU_MAGAZINE_RATING, - "次世代(Famitsu)杂志评分") + "Fami通 杂志评分") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FRANCHISE, "经销商") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE, @@ -1365,11 +1365,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME, MSG_HASH(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT, "继续") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROKEYBOARD, - "Retro 键盘") + "键盘") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROPAD, - "Retro 触摸板") + "手柄") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETROPAD_WITH_ANALOG, - "RetroPad w/ Analog") + "带摇杆的手柄") MSG_HASH(MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, "Retro 成就") MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, @@ -1485,7 +1485,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SSH_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_START_CORE, "启动核心") MSG_HASH(MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, - "启动远程的RetroPad") + "启动远程输入设备") MSG_HASH(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, "启动视频处理") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATE_SLOT, @@ -1519,7 +1519,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COMMAND_IFACE_SUPPORT, MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CORETEXT_SUPPORT, "CoreText 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES, - "CPU特性") + "CPU 特性") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_DPI, "显示器度量DPI") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_HEIGHT, @@ -1719,7 +1719,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_ASSETS, MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES, "更新自动配置档案") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, - "更新CG 渲染器效果文件") + "更新 CG 渲染器效果文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS, "更新金手指") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, @@ -1727,7 +1727,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES, "更新数据库") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_GLSL_SHADERS, - "更新GLSL 渲染器效果文件") + "更新 GLSL 渲染器效果文件") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_LAKKA, "更新 Lakka") MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_OVERLAYS, @@ -1769,11 +1769,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_FLICKER, "闪烁过滤器") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_ENABLE, - "显示屏显消息(OSD)") + "显示屏显消息 (OSD)") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, - "屏显消息(OSD)字体") + "屏显消息 (OSD) 字体") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE, - "屏显消息(OSD)大小") + "屏显消息 (OSD) 大小") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_ASPECT, "强制视窗比例") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, @@ -1783,21 +1783,21 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN, "使用全屏模式") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA, - "视频Gamma") + "视频 Gamma") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD, - "启用GPU录像") + "启用 GPU 录像") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GPU_SCREENSHOT, - "启用GPU截屏") + "启用 GPU 截屏") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC, - "强制GPU同步") + "强制 GPU 同步") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES, - "强制GPU同步帧数") + "强制 GPU 同步帧数") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, "最大交换链图像数") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, - "屏显消息(OSD)X轴位置") + "屏显消息(OSD)X轴位置") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, - "屏显消息(OSD)Y轴位置") + "屏显消息(OSD)Y轴位置") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, "显示器索引") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, @@ -2006,7 +2006,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, "管理和创建配置文件。") MSG_HASH(MENU_ENUM_SUBLABEL_CPU_CORES, - "CPU拥有的核心总数。") + "CPU 拥有的核心总数。") MSG_HASH(MENU_ENUM_SUBLABEL_FPS_SHOW, "在屏幕上显示当前每秒的帧率。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, @@ -2028,7 +2028,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, "显示核心、网络和系统的信息。显示数据库和光标的管理器。") MSG_HASH(MENU_ENUM_SUBLABEL_ONLINE_UPDATER, - "下载并更新RetroArch的附加插件和组件。") + "下载并更新 RetroArch 的附加插件和组件。") MSG_HASH(MENU_ENUM_SUBLABEL_SAMBA_ENABLE, "启用或者禁止网络文件夹共享(SAMBA)。") MSG_HASH(MENU_ENUM_SUBLABEL_SERVICES_SETTINGS, @@ -2049,13 +2049,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, "以增加画面卡顿的风险换取低延时,在垂直同步后增加\n" "时延(毫秒)。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, - "设置当开启“强制GPU同步”时CPU可以预先GPU多少帧。") + "设置当开启「强制 GPU 同步」时 CPU 可以提前 GPU 多少帧。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, "强制显示驱动程序使用特定的缓冲模式。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, "选择将要使用哪一个显示器。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, - "估算的显示器刷新率(Hz)。") + "估算的显示器刷新率(Hz)。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED, "设置为视频驱动自行设置的刷新率") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, @@ -2095,13 +2095,13 @@ MSG_HASH(MSG_CHEEVOS_HARDCORE_MODE_ENABLE, MSG_HASH(MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, "与已知的magic numbers比较...") MSG_HASH(MSG_COMPILED_AGAINST_API, - "API反编译") + "未按照 API 编译") MSG_HASH(MSG_CONFIG_DIRECTORY_NOT_SET, "未设置配置文件夹,无法保存新的配置。") MSG_HASH(MSG_CONNECTED_TO, "连接至") MSG_HASH(MSG_CONTENT_CRC32S_DIFFER, - "内容的CRC32s不同。无法使用不同的游戏。") + "内容的 CRC32s 不同。无法使用不同的游戏。") MSG_HASH(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, "跳过内容加载。实现将自行加载。") MSG_HASH(MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, @@ -2285,11 +2285,11 @@ MSG_HASH(MSG_REMOVABLE_STORAGE, MSG_HASH(MSG_INVALID_NICKNAME_SIZE, "无效的昵称长度。") MSG_HASH(MSG_IN_BYTES, - "(字节)") + "(字节)") MSG_HASH(MSG_IN_GIGABYTES, - "(吉字节)") + "(GB)") MSG_HASH(MSG_IN_MEGABYTES, - "(兆字节)") + "(MB)") MSG_HASH(MSG_LIBRETRO_ABI_BREAK, "is compiled against a different version of libretro than this libretro implementation.") MSG_HASH(MSG_LIBRETRO_FRONTEND, @@ -2435,7 +2435,7 @@ MSG_HASH(MSG_UNRECOGNIZED_COMMAND, MSG_HASH(MSG_USING_CORE_NAME_FOR_NEW_CONFIG, "Using core name for new config.") MSG_HASH(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED, - "使用libretro虚拟核心。跳过录制。") + "使用 libretro 虚拟核心。跳过录制。") MSG_HASH(MSG_VALUE_CONNECT_DEVICE_FROM_A_VALID_PORT, "从有效端口连接设备。") MSG_HASH(MSG_VALUE_DISCONNECTING_DEVICE_FROM_PORT, @@ -2445,7 +2445,7 @@ MSG_HASH(MSG_VALUE_REBOOTING, MSG_HASH(MSG_VALUE_SHUTTING_DOWN, "正在关机……") MSG_HASH(MSG_VERSION_OF_LIBRETRO_API, - "libretro API版本") + "libretro API 版本") MSG_HASH(MSG_VIEWPORT_SIZE_CALCULATION_FAILED, "可视区域尺寸计算失败!将继续使用原始数据,这很可能不会正常工作。") MSG_HASH(MSG_VIRTUAL_DISK_TRAY, @@ -2500,11 +2500,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, - "Describes the period of which turbo-enabled buttons toggle. Numbers are described in frames." + "连发时每两次按键之间的间隔帧数。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE, - "Describes how long the period of a turbo-enabled button should be. Numbers are described in frames." + "连发时每次按键按下的帧数。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_VSYNC, @@ -2641,11 +2641,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, "无法找到合适的核心或内容文件,请手动加载。") MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, - "浏览URL" + "浏览 URL" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_URL, - "URL路径" + "URL 路径" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BROWSE_START, @@ -2675,7 +2675,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, "在这里输入您的昵称,用于联网和一些其他服务。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, - "去除滤镜后(而不是渲染器)捕获图像。视频与屏幕上显示的一样。") + "捕获图像时保留滤镜,使您录制的视频与屏幕上显示的一样美丽。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_LIST, "选择使用的模拟器核心。") MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, @@ -2705,7 +2705,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, "在屏幕图层上显示键盘/控制器。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, - "如果开启“在图层上显示控制器”,请选择相应屏幕图层的端口来侦听。") + "如果开启「在图层上显示控制器」,请选择相应屏幕图层的端口来侦听。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, "扫描到的游戏内容将在此处显示。" @@ -2788,7 +2788,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, - "在RetroArch关闭时自动保存即时存档。\n" + "在 RetroArch 关闭时自动保存即时存档。\n" "如果开启了「自动加载即时存档」功能,下次开始游戏时会加载该存档。" ) MSG_HASH( @@ -3109,9 +3109,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, "Sets start directory for menu configuration browser.") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, - "设置按键延迟以掩盖网络延迟。用按键延迟换取在线游戏时降低CPU负载并减少顿卡。") + "设置按键延迟以掩盖网络延迟。用按键延迟换取在线游戏时降低 CPU 负载并减少顿卡。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, - "设置按键延迟范围以掩盖网络的延迟。用延迟范围内的按键延迟换取在线游戏时降低CPU负载并减少顿卡。") + "设置按键延迟范围以掩盖网络的延迟。用延迟范围内的按键延迟换取在线游戏时降低 CPU 负载并减少顿卡。") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_CYCLE_TRAY_STATUS, "Cycle the current disk. If the disk is inserted, it will eject the disk. If the disk has not been inserted, it will be inserted. ") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_INDEX, @@ -3123,7 +3123,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND, MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE, "Makes sure the framerate is capped while inside the menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_LAYOUT, - "设置多种XMB界面布局。") + "设置多种 XMB 界面布局。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_THEME, "设置多种的图标主题。重新启动程序后,更改将生效。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, @@ -3135,7 +3135,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "设置多种颜色的渐变主题。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, - "选择背景动画效果。效果由GPU性能而定,如果性能不理想,请关闭此功能或选择简单特效。") + "选择背景动画效果。效果由 GPU 性能而定,如果性能不理想,请关闭此功能或选择简单特效。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_FONT, "设置菜单中使用的自定义字体文件。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, @@ -3292,7 +3292,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, - "音效混合器音量级别(dB)" + "音效混合器音量级别(dB)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE, @@ -3329,7 +3329,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, "收藏夹") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_FAVORITES, - "已经添加到“收藏夹”的内容将出现在这里。") + "已经添加到「收藏夹」的内容将出现在这里。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, "音乐") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_MUSIC, @@ -3403,7 +3403,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT, "显示「截图」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT, - "显示或隐藏「截图”选项」。") + "显示或隐藏「截图」选项」。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE, "显示「保存/即时读档」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE, @@ -3445,15 +3445,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, "显示或隐藏「信息」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE, - "显示屏显消息(OSD)背景") + "显示屏显消息(OSD)背景") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED, - "屏显消息(OSD)背景RGB颜色 红色") + "屏显消息(OSD)背景RGB颜色 红色") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN, - "屏显消息(OSD)背景RGB颜色 绿色") + "屏显消息(OSD)背景RGB颜色 绿色") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE, - "屏显消息(OSD)背景RGB颜色 蓝色") + "屏显消息(OSD)背景RGB颜色 蓝色") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY, - "屏显消息(OSD)背景透明度") + "屏显消息(OSD)背景透明度") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, "关闭懒人模式") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, @@ -3473,11 +3473,11 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "密码错误。") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED, - "屏显消息(OSD)RGB颜色 红色") + "屏显消息(OSD)RGB颜色 红色") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, - "屏显消息(OSD)RGB颜色 绿色") + "屏显消息(OSD)RGB颜色 绿色") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, - "屏显消息(OSD)RGB颜色 蓝色") + "屏显消息(OSD)RGB颜色 蓝色") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, "显示FPS帧数") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, From eddf441a2a6f5d8c096a26499ebf99bd07101bec Mon Sep 17 00:00:00 2001 From: Ayssia Date: Thu, 11 Oct 2018 01:52:36 +0800 Subject: [PATCH 0312/1292] Minor Fix --- intl/msg_hash_chs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 6f821a465c..82528f44d0 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -2083,7 +2083,7 @@ MSG_HASH(MSG_AUTOSAVE_FAILED, MSG_HASH(MSG_AUTO_SAVE_STATE_TO, "自动保存即时存档至") MSG_HASH(MSG_BLOCKING_SRAM_OVERWRITE, - "阻止 SRAM 覆盖") + "阻止覆盖游戏存档") MSG_HASH(MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, "Bringing up command interface on port") MSG_HASH(MSG_BYTES, @@ -2401,7 +2401,7 @@ MSG_HASH(MSG_SHADER, MSG_HASH(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, "预设渲染器已加载。") MSG_HASH(MSG_SKIPPING_SRAM_LOAD, - "跳过 SRAM 加载。") + "跳过游戏存档加载。") MSG_HASH(MSG_SLOW_MOTION, "慢动作。") MSG_HASH(MSG_FAST_FORWARD, @@ -2409,7 +2409,7 @@ MSG_HASH(MSG_FAST_FORWARD, MSG_HASH(MSG_SLOW_MOTION_REWIND, "慢动作回溯。") MSG_HASH(MSG_SRAM_WILL_NOT_BE_SAVED, - "SRAM不会被保存。") + "游戏存档不会被保存。") MSG_HASH(MSG_STARTING_MOVIE_PLAYBACK, "开始回放视频。") MSG_HASH(MSG_STARTING_MOVIE_RECORD_TO, From c2112c4cbfec679b22db994d3b880e31994687f0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 20:15:31 +0200 Subject: [PATCH 0313/1292] Commit this diff patch by gblues --- wiiu/include/sys/socket.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wiiu/include/sys/socket.h b/wiiu/include/sys/socket.h index 3486f5130f..242e161c0e 100644 --- a/wiiu/include/sys/socket.h +++ b/wiiu/include/sys/socket.h @@ -28,6 +28,7 @@ extern "C" { /* return codes */ #define SO_SUCCESS 0 #define SO_EWOULDBLOCK 6 +#define SO_EINVAL 11 #define EWOULDBLOCK SO_EWOULDBLOCK #define EAGAIN SO_EWOULDBLOCK @@ -42,11 +43,10 @@ struct sockaddr char sa_data[]; }; -struct sockaddr_storage -{ - sa_family_t ss_family; - char __ss_padding[26]; -}; +/* Wii U only supports IPv4 so we make sockaddr_storage ++ be sockaddr_in for compatibility. ++ */ +#define sockaddr_storage sockaddr_in struct linger { From 192d1f6dd479135b6bdfb8775e1e855577f2cad0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 20:17:33 +0200 Subject: [PATCH 0314/1292] Updates --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 6aaebd3bde..7a26574e83 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ - SCANNER: Fix GDI disc scanning. - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. +- WIIU: Initial netplay peer-to-peer support. # 1.7.5 - CAMERA: Fix Video4Linux2 driver that broke years ago. From d32b08b0f4cd0a6e8d63245c8a1801a435da3afc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 20:31:55 +0200 Subject: [PATCH 0315/1292] Add split joycon settings --- configuration.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/configuration.c b/configuration.c index 118fe20bef..813ee6ca0d 100644 --- a/configuration.c +++ b/configuration.c @@ -1575,6 +1575,16 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("dpi_override_value", &settings->uints.menu_dpi_override_value, true, menu_dpi_override_value, false); SETTING_UINT("menu_thumbnails", &settings->uints.menu_thumbnails, true, menu_thumbnails_default, false); SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, menu_timedate_style, false); +#ifdef HAVE_LIBNX + SETTING_UINT("split_joycon_p1", &settings->uints.input_split_joycon[0], true, 0, false); + SETTING_UINT("split_joycon_p2", &settings->uints.input_split_joycon[1], true, 0, false); + SETTING_UINT("split_joycon_p3", &settings->uints.input_split_joycon[2], true, 0, false); + SETTING_UINT("split_joycon_p4", &settings->uints.input_split_joycon[3], true, 0, false); + SETTING_UINT("split_joycon_p5", &settings->uints.input_split_joycon[4], true, 0, false); + SETTING_UINT("split_joycon_p6", &settings->uints.input_split_joycon[5], true, 0, false); + SETTING_UINT("split_joycon_p7", &settings->uints.input_split_joycon[6], true, 0, false); + SETTING_UINT("split_joycon_p8", &settings->uints.input_split_joycon[7], true, 0, false); +#endif #ifdef HAVE_XMB SETTING_UINT("menu_left_thumbnails", &settings->uints.menu_left_thumbnails, true, menu_left_thumbnails_default, false); SETTING_UINT("xmb_alpha_factor", &settings->uints.menu_xmb_alpha_factor, true, xmb_alpha_factor, false); From d3f8d8a08df6961cec3a88f967dc6c221d833aee Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Wed, 10 Oct 2018 11:38:03 -0700 Subject: [PATCH 0316/1292] wiiu: small cleanup == DETAILS - remove extraneous '+' from a manually applied diff - fix the net_listen.sh script so it works properly on Mac OSX == TESTING Works locally. --- wiiu/include/sys/socket.h | 4 ++-- wiiu/net_listen.sh | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/wiiu/include/sys/socket.h b/wiiu/include/sys/socket.h index 242e161c0e..322d6bb905 100644 --- a/wiiu/include/sys/socket.h +++ b/wiiu/include/sys/socket.h @@ -44,8 +44,8 @@ struct sockaddr }; /* Wii U only supports IPv4 so we make sockaddr_storage -+ be sockaddr_in for compatibility. -+ */ + be sockaddr_in for compatibility. + */ #define sockaddr_storage sockaddr_in struct linger diff --git a/wiiu/net_listen.sh b/wiiu/net_listen.sh index f023734305..ca121f4af2 100755 --- a/wiiu/net_listen.sh +++ b/wiiu/net_listen.sh @@ -6,7 +6,28 @@ # # If you would like a logfile, pipe this script's output to tee. -script_dir=$(dirname $(readlink -f $0)) +NETCAT= + +find_netcat() +{ + NETCAT=$(which netcat 2>/dev/null |grep '/') + if [ -z "$NETCAT" ]; then + NETCAT=$(which nc 2>/dev/null |grep '/') + if [ -z "$NETCAT" ]; then + echo "Failed to find either 'netcat' or 'nc'. Please install it." + exit 1 + fi + fi +} + +do_readlink() +{ + local exe=$1 + echo "$(cd $(dirname $exe) && pwd)" +} + +find_netcat +script_dir=$(do_readlink $0) IP=$(which ip 2>/dev/null | grep '^/') IFCONFIG=$(which ifconfig 2>/dev/null | grep '^/') @@ -54,8 +75,8 @@ echo "Listening for UDP packets on broadcast IP: $broadcast" while [ $exit_listen_loop -eq 0 ]; do echo ========= `date` ========= if [ -z "$TS" ]; then - netcat -kluw 0 $broadcast $PC_DEVELOPMENT_TCP_PORT + $NETCAT -kluw 0 $broadcast $PC_DEVELOPMENT_TCP_PORT else - netcat -kluw 0 $broadcast $PC_DEVELOPMENT_TCP_PORT |ts '[%Y-%m-%d %H:%M:%.S]' + $NETCAT -kluw 0 $broadcast $PC_DEVELOPMENT_TCP_PORT |ts '[%Y-%m-%d %H:%M:%.S]' fi done From 98625796106ea6453102b67ac4108b856ed3b9a3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 23:26:18 +0200 Subject: [PATCH 0317/1292] Revert "bugfix cheat saving" This reverts commit 4c3b06d64039c8cedd0a671d335783dc0a6fc288. --- libretro-common/file/config_file.c | 7 +------ libretro-common/include/file/config_file.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 846fa2c6fc..7dd671b662 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -406,7 +406,6 @@ static config_file_t *config_file_new_internal( conf->path = NULL; conf->entries = NULL; conf->tail = NULL; - conf->last = NULL; conf->includes = NULL; conf->include_depth = 0; conf->guaranteed_no_duplicates = false ; @@ -559,7 +558,6 @@ config_file_t *config_file_new_from_string(const char *from_string) conf->path = NULL; conf->entries = NULL; conf->tail = NULL; - conf->last = NULL; conf->includes = NULL; conf->include_depth = 0; conf->guaranteed_no_duplicates = false ; @@ -844,7 +842,7 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in) void config_set_string(config_file_t *conf, const char *key, const char *val) { - struct config_entry_list *last = (conf->guaranteed_no_duplicates && conf->last) ? conf->last : conf->entries; + struct config_entry_list *last = conf->entries; struct config_entry_list *entry = conf->guaranteed_no_duplicates?NULL:config_get_entry(conf, key, &last); if (entry && !entry->readonly) @@ -870,9 +868,6 @@ void config_set_string(config_file_t *conf, const char *key, const char *val) last->next = entry; else conf->entries = entry; - - conf->last = entry ; - } void config_unset(config_file_t *conf, const char *key) diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index d2d5b026f7..e55430472d 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -57,7 +57,6 @@ struct config_file char *path; struct config_entry_list *entries; struct config_entry_list *tail; - struct config_entry_list *last; unsigned include_depth; bool guaranteed_no_duplicates; From 7d0dba30071a6768448494435ce67400c509b7e5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Oct 2018 23:34:16 +0200 Subject: [PATCH 0318/1292] Revert this - was getting crashes in both OSX and MSVC 2003 in config_file.c inside config_get_entry --- libretro-common/file/config_file.c | 49 +- libretro-common/include/file/config_file.h | 14 - managers/cheat_manager.c | 784 ++++++++++----------- managers/cheat_manager.h | 5 +- menu/menu_driver.h | 2 +- menu/menu_setting.c | 2 +- 6 files changed, 399 insertions(+), 457 deletions(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 7dd671b662..0a63e7781a 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -66,7 +66,7 @@ struct config_include_list }; static config_file_t *config_file_new_internal( - const char *path, unsigned depth, config_file_cb_t *cb); + const char *path, unsigned depth); static int config_sort_compare_func(struct config_entry_list *a, struct config_entry_list *b) @@ -267,7 +267,7 @@ static void add_child_list(config_file_t *parent, config_file_t *child) parent->tail = NULL; } -static void add_sub_conf(config_file_t *conf, char *path, config_file_cb_t *cb) +static void add_sub_conf(config_file_t *conf, char *path) { char real_path[PATH_MAX_LENGTH]; config_file_t *sub_conf = NULL; @@ -314,7 +314,7 @@ static void add_sub_conf(config_file_t *conf, char *path, config_file_cb_t *cb) #endif sub_conf = (config_file_t*) - config_file_new_internal(real_path, conf->include_depth + 1, cb); + config_file_new_internal(real_path, conf->include_depth + 1); if (!sub_conf) return; @@ -324,7 +324,7 @@ static void add_sub_conf(config_file_t *conf, char *path, config_file_cb_t *cb) } static bool parse_line(config_file_t *conf, - struct config_entry_list *list, char *line, config_file_cb_t *cb) + struct config_entry_list *list, char *line) { char *comment = NULL; char *key_tmp = NULL; @@ -351,7 +351,7 @@ static bool parse_line(config_file_t *conf, if (conf->include_depth >= MAX_INCLUDE_DEPTH) fprintf(stderr, "!!! #include depth exceeded for config. Might be a cycle.\n"); else - add_sub_conf(conf, path, cb); + add_sub_conf(conf, path); free(path); } goto error; @@ -396,19 +396,18 @@ error: } static config_file_t *config_file_new_internal( - const char *path, unsigned depth, config_file_cb_t *cb) + const char *path, unsigned depth) { RFILE *file = NULL; struct config_file *conf = (struct config_file*)malloc(sizeof(*conf)); if (!conf) return NULL; - conf->path = NULL; - conf->entries = NULL; - conf->tail = NULL; - conf->includes = NULL; - conf->include_depth = 0; - conf->guaranteed_no_duplicates = false ; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; + conf->include_depth = 0; if (!path || !*path) return conf; @@ -456,7 +455,7 @@ static config_file_t *config_file_new_internal( continue; } - if (*line && parse_line(conf, list, line, cb)) + if (*line && parse_line(conf, list, line)) { if (conf->entries) conf->tail->next = list; @@ -464,9 +463,6 @@ static config_file_t *config_file_new_internal( conf->entries = list; conf->tail = list; - - if (cb != NULL && list->key != NULL && list->value != NULL) - cb->config_file_new_entry_cb(list->key, list->value) ; } free(line); @@ -555,12 +551,11 @@ config_file_t *config_file_new_from_string(const char *from_string) if (!from_string) return conf; - conf->path = NULL; - conf->entries = NULL; - conf->tail = NULL; - conf->includes = NULL; - conf->include_depth = 0; - conf->guaranteed_no_duplicates = false ; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; + conf->include_depth = 0; lines = string_split(from_string, "\n"); if (!lines) @@ -585,7 +580,7 @@ config_file_t *config_file_new_from_string(const char *from_string) if (line && conf) { - if (*line && parse_line(conf, list, line, NULL)) + if (*line && parse_line(conf, list, line)) { if (conf->entries) conf->tail->next = list; @@ -605,13 +600,9 @@ config_file_t *config_file_new_from_string(const char *from_string) return conf; } -config_file_t *config_file_new_with_callback(const char *path, config_file_cb_t *cb) -{ - return config_file_new_internal(path, 0, cb); -} config_file_t *config_file_new(const char *path) { - return config_file_new_internal(path, 0, NULL); + return config_file_new_internal(path, 0); } static struct config_entry_list *config_get_entry(const config_file_t *conf, @@ -843,7 +834,7 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in) void config_set_string(config_file_t *conf, const char *key, const char *val) { struct config_entry_list *last = conf->entries; - struct config_entry_list *entry = conf->guaranteed_no_duplicates?NULL:config_get_entry(conf, key, &last); + struct config_entry_list *entry = config_get_entry(conf, key, &last); if (entry && !entry->readonly) { diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index e55430472d..cbeac2ed98 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -58,7 +58,6 @@ struct config_file struct config_entry_list *entries; struct config_entry_list *tail; unsigned include_depth; - bool guaranteed_no_duplicates; struct config_include_list *includes; }; @@ -66,13 +65,6 @@ struct config_file typedef struct config_file config_file_t; -struct config_file_cb -{ - void (*config_file_new_entry_cb)(char*, char*); -}; - -typedef struct config_file_cb config_file_cb_t ; - /* Config file format * - # are treated as comments. Rest of the line is ignored. * - Format is: key = value. There can be as many spaces as you like in-between. @@ -87,11 +79,6 @@ typedef struct config_file_cb config_file_cb_t ; * NULL path will create an empty config file. */ config_file_t *config_file_new(const char *path); -/* Loads a config file. Returns NULL if file doesn't exist. - * NULL path will create an empty config file. - * Includes cb callbacks to run custom code during config file processing.*/ -config_file_t *config_file_new_with_callback(const char *path, config_file_cb_t *cb); - /* Load a config file from a string. */ config_file_t *config_file_new_from_string(const char *from_string); @@ -191,4 +178,3 @@ bool config_file_exists(const char *path); RETRO_END_DECLS #endif - diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index d581e4790d..85296e55e4 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -89,12 +88,8 @@ void cheat_manager_apply_cheats(void) core_set_cheat(&cheat_info); } } - - if (cheat_manager_state.size > 0) - { - runloop_msg_queue_push(msg_hash_to_str(MSG_APPLYING_CHEAT), 1, 180, true); - RARCH_LOG("%s\n", msg_hash_to_str(MSG_APPLYING_CHEAT)); - } + runloop_msg_queue_push(msg_hash_to_str(MSG_APPLYING_CHEAT), 1, 180, true); + RARCH_LOG("%s\n", msg_hash_to_str(MSG_APPLYING_CHEAT)); #ifdef HAVE_CHEEVOS data_bool = idx != 0; @@ -108,7 +103,7 @@ void cheat_manager_set_code(unsigned i, const char *str) return; if (!string_is_empty(str)) - strcpy(cheat_manager_state.cheats[i].code,str); + strcpy(cheat_manager_state.cheats[i].code,str) ; cheat_manager_state.cheats[i].state = true; } @@ -151,7 +146,7 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw buf[0] = cheats_file[0] = '\0'; if ( (!cheat_manager_state.cheats) || cheat_manager_state.size==0 ) - return false; + return false ; if (!cheat_database) strlcpy(cheats_file, path, sizeof(cheats_file)); @@ -172,8 +167,6 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw if (!conf) return false; - conf->guaranteed_no_duplicates = true; - config_set_int(conf, "cheats", cheat_manager_state.size); for (i = 0; i < cheat_manager_state.size; i++) @@ -240,42 +233,44 @@ bool cheat_manager_copy_idx_to_working(unsigned idx) return false; } - memcpy(&(cheat_manager_state.working_cheat), &(cheat_manager_state.cheats[idx]), sizeof(struct item_cheat)); + memcpy(&(cheat_manager_state.working_cheat), &(cheat_manager_state.cheats[idx]), sizeof(struct item_cheat)) ; if ( cheat_manager_state.cheats[idx].desc != NULL ) - strlcpy(cheat_manager_state.working_desc, cheat_manager_state.cheats[idx].desc, CHEAT_DESC_SCRATCH_SIZE); + strlcpy(cheat_manager_state.working_desc, cheat_manager_state.cheats[idx].desc, CHEAT_DESC_SCRATCH_SIZE) ; else - cheat_manager_state.working_desc[0] = '\0'; + cheat_manager_state.working_desc[0] = '\0' ; if ( cheat_manager_state.cheats[idx].code != NULL ) - strlcpy(cheat_manager_state.working_code, cheat_manager_state.cheats[idx].code, CHEAT_CODE_SCRATCH_SIZE); + strlcpy(cheat_manager_state.working_code, cheat_manager_state.cheats[idx].code, CHEAT_CODE_SCRATCH_SIZE) ; else - cheat_manager_state.working_code[0] = '\0'; + cheat_manager_state.working_code[0] = '\0' ; - return true; + return true ; } bool cheat_manager_copy_working_to_idx(unsigned idx) { if ( (!cheat_manager_state.cheats) || (cheat_manager_state.size < idx+1)) + { return false; + } - memcpy(&(cheat_manager_state.cheats[idx]), &(cheat_manager_state.working_cheat), sizeof(struct item_cheat)); + memcpy(&(cheat_manager_state.cheats[idx]), &(cheat_manager_state.working_cheat), sizeof(struct item_cheat)) ; if ( cheat_manager_state.cheats[idx].desc != NULL ) - free(cheat_manager_state.cheats[idx].desc); + free(cheat_manager_state.cheats[idx].desc) ; - cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc); + cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc) ; if ( cheat_manager_state.cheats[idx].code != NULL ) - free(cheat_manager_state.cheats[idx].code); + free(cheat_manager_state.cheats[idx].code) ; - cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code); - return true; + cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code) ; + return true ; } static void cheat_manager_new(unsigned size) { unsigned i; - cheat_manager_free(); + cheat_manager_free() ; cheat_manager_state.buf_size = size; cheat_manager_state.size = size; @@ -288,175 +283,147 @@ static void cheat_manager_new(unsigned size) cheat_manager_state.buf_size = 0; cheat_manager_state.size = 0; cheat_manager_state.cheats = NULL; - return; + return ; } for (i = 0; i < cheat_manager_state.size; i++) { - cheat_manager_state.cheats[i].desc = NULL; - cheat_manager_state.cheats[i].code = NULL; + cheat_manager_state.cheats[i].desc = NULL ; + cheat_manager_state.cheats[i].code = NULL ; cheat_manager_state.cheats[i].state = false; cheat_manager_state.cheats[i].repeat_count = 1; cheat_manager_state.cheats[i].repeat_add_to_value = 0; cheat_manager_state.cheats[i].repeat_add_to_address = 1; } - return; -} - -void cheat_manager_load_cb_first_pass(char *key, char *value) -{ - errno = 0; - - if (string_is_equal(key, "cheats")) - { - cheat_manager_state.loading_cheat_size = (unsigned)strtoul(value, NULL, 0); - - if (errno != 0) - cheat_manager_state.loading_cheat_size = 0; - } -} - -void cheat_manager_load_cb_second_pass(char *key, char *value) -{ - char cheat_num_str[20]; - unsigned cheat_num; - unsigned cheat_idx; - int idx = 0; - int key_length; - errno = 0; - - if (strncmp(key, "cheat", 5) != 0) - return; - - idx = 5; - key_length = strlen(key); - - while (idx < key_length && key[idx] >= '0' && key[idx] <= '9' && idx < 24) - { - cheat_num_str[idx-5] = key[idx]; - idx++; - } - - cheat_num_str[idx-5] = '\0'; - - cheat_num = (unsigned)strtoul(cheat_num_str, NULL, 0); - - if (cheat_num+cheat_manager_state.loading_cheat_offset >= cheat_manager_state.size) - return; - - key = key+idx+1; - - cheat_idx = cheat_num+cheat_manager_state.loading_cheat_offset; - - if (string_is_equal(key, "address")) - cheat_manager_state.cheats[cheat_idx].address = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "address_bit_position")) - cheat_manager_state.cheats[cheat_idx].address_mask = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "big_endian")) - cheat_manager_state.cheats[cheat_idx].big_endian = (string_is_equal(value,"true") || string_is_equal(value,"1")); - else if (string_is_equal(key, "cheat_type")) - cheat_manager_state.cheats[cheat_idx].cheat_type = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "code")) - cheat_manager_state.cheats[cheat_idx].code = strdup(value); - else if (string_is_equal(key, "desc")) - cheat_manager_state.cheats[cheat_idx].desc = strdup(value); - else if (string_is_equal(key, "enable")) - cheat_manager_state.cheats[cheat_idx].state = (string_is_equal(value,"true") || string_is_equal(value,"1")); - else if (string_is_equal(key, "handler")) - cheat_manager_state.cheats[cheat_idx].handler = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "memory_search_size")) - cheat_manager_state.cheats[cheat_idx].memory_search_size = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "repeat_add_to_address")) - cheat_manager_state.cheats[cheat_idx].repeat_add_to_address = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "repeat_add_to_value")) - cheat_manager_state.cheats[cheat_idx].repeat_add_to_value = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "repeat_count")) - cheat_manager_state.cheats[cheat_idx].repeat_count = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "rumble_port")) - cheat_manager_state.cheats[cheat_idx].rumble_port = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "rumble_primary_duration")) - cheat_manager_state.cheats[cheat_idx].rumble_primary_duration = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "rumble_primary_strength")) - cheat_manager_state.cheats[cheat_idx].rumble_primary_strength = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "rumble_secondary_duration")) - cheat_manager_state.cheats[cheat_idx].rumble_secondary_duration = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "rumble_secondary_strength")) - cheat_manager_state.cheats[cheat_idx].rumble_secondary_strength = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "rumble_type")) - cheat_manager_state.cheats[cheat_idx].rumble_type = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "rumble_value")) - cheat_manager_state.cheats[cheat_idx].rumble_value = (unsigned)strtoul(value, NULL, 0); - else if (string_is_equal(key, "value")) - cheat_manager_state.cheats[cheat_idx].value = (unsigned)strtoul(value, NULL, 0); - + return ; } bool cheat_manager_load(const char *path, bool append) { - unsigned orig_size; unsigned cheats = 0, i; - config_file_cb_t cb; - config_file_t *conf = NULL; - - cb.config_file_new_entry_cb = cheat_manager_load_cb_first_pass; - - cheat_manager_state.loading_cheat_size = 0; - - conf = config_file_new_with_callback(path, &cb); + config_file_t *conf = config_file_new(path); + unsigned orig_size ; + unsigned int* data_ptrs[16] = { NULL}; + char* keys[16] = { + "cheat%u_handler", + "cheat%u_memory_search_size", + "cheat%u_cheat_type", + "cheat%u_value", + "cheat%u_address", + "cheat%u_address_bit_position", + "cheat%u_rumble_type", + "cheat%u_rumble_value", + "cheat%u_rumble_port", + "cheat%u_rumble_primary_strength", + "cheat%u_rumble_primary_duration", + "cheat%u_rumble_secondary_strength", + "cheat%u_rumble_secondary_duration", + "cheat%u_repeat_count", + "cheat%u_repeat_add_to_value", + "cheat%u_repeat_add_to_address", + }; if (!conf) return false; - cheats = cheat_manager_state.loading_cheat_size; + config_get_uint(conf, "cheats", &cheats); if (cheats == 0) goto error; - config_file_free(conf); - conf = NULL; - - - cheat_manager_alloc_if_empty(); + cheat_manager_alloc_if_empty() ; if ( append ) { - orig_size = cheat_manager_get_size(); + orig_size = cheat_manager_get_size() ; if ( orig_size == 0) { cheat_manager_new(cheats); } else { - cheats = cheats + orig_size; - if (cheat_manager_realloc(cheats, CHEAT_HANDLER_TYPE_EMU)) { } + cheats = cheats + orig_size ; + if (cheat_manager_realloc(cheats, CHEAT_HANDLER_TYPE_EMU)) + { + } } } else { - orig_size = 0; + orig_size = 0 ; cheat_manager_new(cheats); } - for (i = orig_size; i < cheats; i++) { - cheat_manager_state.cheats[i].idx = i; - cheat_manager_state.cheats[i].desc = NULL; - cheat_manager_state.cheats[i].code = NULL; - cheat_manager_state.cheats[i].state = false; - cheat_manager_state.cheats[i].big_endian = false; - cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE; + unsigned j; + char desc_key[256]; + char code_key[256]; + char enable_key[256]; + char endian_key[256]; + char *tmp = NULL; + bool tmp_bool = false; + + data_ptrs[0] = &cheat_manager_state.cheats[i].handler; + data_ptrs[1] = &cheat_manager_state.cheats[i].memory_search_size; + data_ptrs[2] = &cheat_manager_state.cheats[i].cheat_type; + data_ptrs[3] = &cheat_manager_state.cheats[i].value; + data_ptrs[4] = &cheat_manager_state.cheats[i].address; + data_ptrs[5] = &cheat_manager_state.cheats[i].address_mask; + data_ptrs[6] = &cheat_manager_state.cheats[i].rumble_type; + data_ptrs[7] = &cheat_manager_state.cheats[i].rumble_value; + data_ptrs[8] = &cheat_manager_state.cheats[i].rumble_port; + data_ptrs[9] = &cheat_manager_state.cheats[i].rumble_primary_strength; + data_ptrs[10] = &cheat_manager_state.cheats[i].rumble_primary_duration; + data_ptrs[11] = &cheat_manager_state.cheats[i].rumble_secondary_strength; + data_ptrs[12] = &cheat_manager_state.cheats[i].rumble_secondary_duration; + data_ptrs[13] = &cheat_manager_state.cheats[i].repeat_count; + data_ptrs[14] = &cheat_manager_state.cheats[i].repeat_add_to_value; + data_ptrs[15] = &cheat_manager_state.cheats[i].repeat_add_to_address; + + endian_key[0] = desc_key[0] = code_key[0] = enable_key[0] = '\0'; + + snprintf(desc_key, sizeof(desc_key), "cheat%u_desc", i-orig_size); + snprintf(code_key, sizeof(code_key), "cheat%u_code", i-orig_size); + snprintf(enable_key, sizeof(enable_key), "cheat%u_enable", i-orig_size); + snprintf(endian_key, sizeof(endian_key), "cheat%u_endian", i-orig_size); + + cheat_manager_state.cheats[i].idx = i ; + + cheat_manager_state.cheats[i].desc = NULL ; + cheat_manager_state.cheats[i].code = NULL ; + cheat_manager_state.cheats[i].state = false ; + cheat_manager_state.cheats[i].big_endian = false ; + + if (config_get_string(conf, desc_key, &tmp) && !string_is_empty(tmp)) + cheat_manager_state.cheats[i].desc = strdup(tmp) ; + + if (config_get_string(conf, code_key, &tmp) && !string_is_empty(tmp)) + cheat_manager_state.cheats[i].code = strdup(tmp) ; + + if (config_get_bool(conf, enable_key, &tmp_bool)) + cheat_manager_state.cheats[i].state = tmp_bool; + + if (config_get_bool(conf, endian_key, &tmp_bool)) + cheat_manager_state.cheats[i].big_endian = tmp_bool; + + if (tmp) + free(tmp); + + cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ; cheat_manager_state.cheats[i].memory_search_size = 3; + for (j = 0 ; j < 16 ; j++ ) + { + char key[50] ; + unsigned val = 0; + snprintf(key, sizeof(key), keys[j], i-orig_size); + + if ( config_get_uint(conf, key, &val)) + *(data_ptrs[j]) = val ; + } } - cheat_manager_state.loading_cheat_offset = orig_size; - cb.config_file_new_entry_cb = cheat_manager_load_cb_second_pass; - conf = config_file_new_with_callback(path, &cb); - - if (!conf) - return false; - config_file_free(conf); return true; @@ -470,26 +437,26 @@ error: bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) { unsigned i; - unsigned orig_size; + unsigned orig_size ; if (!cheat_manager_state.cheats) { cheat_manager_state.cheats = (struct item_cheat*) calloc(new_size, sizeof(struct item_cheat)); - orig_size = 0; + orig_size = 0 ; } else { - orig_size = cheat_manager_state.size; + orig_size = cheat_manager_state.size ; /* if size is decreasing, free the items that will be lost */ for (i = new_size; i < orig_size; i++) { if ( cheat_manager_state.cheats[i].code != NULL ) - free(cheat_manager_state.cheats[i].code); + free(cheat_manager_state.cheats[i].code) ; if ( cheat_manager_state.cheats[i].desc != NULL ) - free(cheat_manager_state.cheats[i].desc); + free(cheat_manager_state.cheats[i].desc) ; } cheat_manager_state.cheats = (struct item_cheat*) @@ -508,14 +475,14 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) for (i = orig_size; i < cheat_manager_state.size; i++) { - memset(&(cheat_manager_state.cheats[i]), 0, sizeof(cheat_manager_state.cheats[i])); - cheat_manager_state.cheats[i].state = false; - cheat_manager_state.cheats[i].handler = default_handler; - cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE; - cheat_manager_state.cheats[i].memory_search_size = 3; - cheat_manager_state.cheats[i].idx = i; - cheat_manager_state.cheats[i].repeat_count = 1; - cheat_manager_state.cheats[i].repeat_add_to_value = 0; + memset(&(cheat_manager_state.cheats[i]), 0, sizeof(cheat_manager_state.cheats[i])) ; + cheat_manager_state.cheats[i].state = false; + cheat_manager_state.cheats[i].handler = default_handler; + cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ; + cheat_manager_state.cheats[i].memory_search_size = 3; + cheat_manager_state.cheats[i].idx = i; + cheat_manager_state.cheats[i].repeat_count = 1; + cheat_manager_state.cheats[i].repeat_add_to_value = 0; cheat_manager_state.cheats[i].repeat_add_to_address = 1; } @@ -524,37 +491,37 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) void cheat_manager_free(void) { - unsigned i = 0; + unsigned i = 0 ; if (cheat_manager_state.cheats) { for (i = 0; i < cheat_manager_state.size; i++) { if ( cheat_manager_state.cheats[i].desc != NULL ) - free(cheat_manager_state.cheats[i].desc); + free(cheat_manager_state.cheats[i].desc) ; if ( cheat_manager_state.cheats[i].code != NULL ) - free(cheat_manager_state.cheats[i].code); + free(cheat_manager_state.cheats[i].code) ; } free(cheat_manager_state.cheats); } if ( cheat_manager_state.prev_memory_buf ) - free(cheat_manager_state.prev_memory_buf); + free(cheat_manager_state.prev_memory_buf) ; if ( cheat_manager_state.matches ) - free(cheat_manager_state.matches); + free(cheat_manager_state.matches) ; - cheat_manager_state.cheats = NULL; - cheat_manager_state.size = 0; - cheat_manager_state.buf_size = 0; - cheat_manager_state.prev_memory_buf = NULL; - cheat_manager_state.curr_memory_buf = NULL; - cheat_manager_state.matches = NULL; - cheat_manager_state.total_memory_size = 0; - cheat_manager_state.actual_memory_size = 0; - cheat_manager_state.memory_initialized = false; - cheat_manager_state.memory_search_initialized = false; + cheat_manager_state.cheats = NULL ; + cheat_manager_state.size = 0 ; + cheat_manager_state.buf_size = 0 ; + cheat_manager_state.prev_memory_buf = NULL ; + cheat_manager_state.curr_memory_buf = NULL ; + cheat_manager_state.matches = NULL ; + cheat_manager_state.total_memory_size = 0 ; + cheat_manager_state.actual_memory_size = 0 ; + cheat_manager_state.memory_initialized = false ; + cheat_manager_state.memory_search_initialized = false ; } @@ -584,7 +551,7 @@ void cheat_manager_toggle_index(unsigned i) cheat_manager_update(&cheat_manager_state, i); if (!settings) - return; + return ; if (settings->bools.apply_cheats_after_toggle) cheat_manager_apply_cheats(); @@ -653,17 +620,18 @@ bool cheat_manager_get_game_specific_filename(char * cheat_filename, size_t max_ struct retro_system_info system_info; if (!settings || !global || !cheat_filename) - return false; + return false ; if ( !core_get_system_info(&system_info) ) - return false; + return false ; + core_name = system_info.library_name; game_name = path_basename(global->name.cheatfile); if ( string_is_empty(settings->paths.path_cheat_database) || string_is_empty(core_name) || string_is_empty(game_name) ) - return false; + return false ; cheat_filename[0] = '\0'; strlcat(cheat_filename, settings->paths.path_cheat_database, max_length); @@ -676,23 +644,23 @@ bool cheat_manager_get_game_specific_filename(char * cheat_filename, size_t max_ strlcat(cheat_filename, game_name, max_length); - return true; + return true ; } void cheat_manager_load_game_specific_cheats() { - char cheat_file[PATH_MAX_LENGTH]; + char cheat_file[PATH_MAX_LENGTH] ; if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) - cheat_manager_load(cheat_file,true); + cheat_manager_load(cheat_file,true) ; } void cheat_manager_save_game_specific_cheats() { - char cheat_file[PATH_MAX_LENGTH]; + char cheat_file[PATH_MAX_LENGTH] ; if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) - cheat_manager_save(cheat_file, NULL, true); + cheat_manager_save(cheat_file, NULL, true) ; } @@ -703,8 +671,11 @@ void cheat_manager_state_free(void) bool cheat_manager_alloc_if_empty(void) { + if (!cheat_manager_state.cheats) + { cheat_manager_new(0); + } return true; } @@ -722,9 +693,6 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) return 0; } - if ( meminfo.size == 0 ) - return 0; - cheat_manager_state.actual_memory_size = (unsigned)meminfo.size; cheat_manager_state.curr_memory_buf = meminfo.data; cheat_manager_state.total_memory_size = (unsigned)meminfo.size; @@ -778,84 +746,84 @@ static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int * { case 0 : { - *bytes_per_item = 1; - *bits = 1; - *mask = 0x01; - break; + *bytes_per_item = 1 ; + *bits = 1 ; + *mask = 0x01 ; + break ; } case 1 : { - *bytes_per_item = 1; - *bits = 2; - *mask = 0x03; - break; + *bytes_per_item = 1 ; + *bits = 2 ; + *mask = 0x03 ; + break ; } case 2 : { - *bytes_per_item = 1; - *bits = 4; - *mask = 0x0F; - break; + *bytes_per_item = 1 ; + *bits = 4 ; + *mask = 0x0F ; + break ; } case 3 : { - *bytes_per_item = 1; - *bits = 8; - *mask = 0xFF; - break; + *bytes_per_item = 1 ; + *bits = 8 ; + *mask = 0xFF ; + break ; } case 4 : { - *bytes_per_item = 2; - *bits = 8; - *mask = 0xFFFF; - break; + *bytes_per_item = 2 ; + *bits = 8 ; + *mask = 0xFFFF ; + break ; } case 5 : { - *bytes_per_item = 4; - *bits = 8; - *mask = 0xFFFFFFFF; - break; + *bytes_per_item = 4 ; + *bits = 8 ; + *mask = 0xFFFFFFFF ; + break ; } } } int cheat_manager_search_exact(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EXACT); + return cheat_manager_search(CHEAT_SEARCH_TYPE_EXACT) ; } int cheat_manager_search_lt(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_LT); + return cheat_manager_search(CHEAT_SEARCH_TYPE_LT) ; } int cheat_manager_search_gt(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_GT); + return cheat_manager_search(CHEAT_SEARCH_TYPE_GT) ; } int cheat_manager_search_lte(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_LTE); + return cheat_manager_search(CHEAT_SEARCH_TYPE_LTE) ; } int cheat_manager_search_gte(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_GTE); + return cheat_manager_search(CHEAT_SEARCH_TYPE_GTE) ; } int cheat_manager_search_eq(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQ); + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQ) ; } int cheat_manager_search_neq(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_NEQ); + return cheat_manager_search(CHEAT_SEARCH_TYPE_NEQ) ; } int cheat_manager_search_eqplus(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQPLUS); + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQPLUS) ; } int cheat_manager_search_eqminus(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQMINUS); + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQMINUS) ; } int cheat_manager_search(enum cheat_search_type search_type) @@ -874,14 +842,14 @@ int cheat_manager_search(enum cheat_search_type search_type) if (!cheat_manager_state.curr_memory_buf) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_NOT_INITIALIZED), 1, 180, true); - return 0; + return 0 ; } - cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); + cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ; /* little endian FF000000 = 256 */ - for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) + for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) { unsigned byte_part; @@ -891,73 +859,73 @@ int cheat_manager_search(enum cheat_search_type search_type) { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); + *(curr+idx) + (*(curr+idx+1)*256) ; prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : - *(prev+idx) + (*(prev+idx+1)*256); - break; + *(prev+idx) + (*(prev+idx+1)*256) ; + break ; } case 4 : { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : - *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); - break; + *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256) ; + break ; } case 1 : default : { - curr_val = *(curr+idx); - prev_val = *(prev+idx); - break; + curr_val = *(curr+idx) ; + prev_val = *(prev+idx) ; + break ; } } - for (byte_part = 0; byte_part < 8/bits; byte_part++) + for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) { - unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask; - unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask; - unsigned int prev_match; + unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask ; + unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask ; + unsigned int prev_match ; if (bits < 8 ) - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; else - prev_match = *(cheat_manager_state.matches+idx); + prev_match = *(cheat_manager_state.matches+idx) ; if (prev_match > 0) { - bool match = false; + bool match = false ; switch (search_type) { case CHEAT_SEARCH_TYPE_EXACT : - match = ( curr_subval == cheat_manager_state.search_exact_value); + match = ( curr_subval == cheat_manager_state.search_exact_value) ; break; case CHEAT_SEARCH_TYPE_LT : - match = ( curr_subval < prev_subval); + match = ( curr_subval < prev_subval) ; break; case CHEAT_SEARCH_TYPE_GT : - match = ( curr_subval > prev_subval); + match = ( curr_subval > prev_subval) ; break; case CHEAT_SEARCH_TYPE_LTE : - match = ( curr_subval <= prev_subval); + match = ( curr_subval <= prev_subval) ; break; case CHEAT_SEARCH_TYPE_GTE : - match = ( curr_subval >= prev_subval); + match = ( curr_subval >= prev_subval) ; break; case CHEAT_SEARCH_TYPE_EQ : - match = ( curr_subval == prev_subval); + match = ( curr_subval == prev_subval) ; break; case CHEAT_SEARCH_TYPE_NEQ : - match = ( curr_subval != prev_subval); + match = ( curr_subval != prev_subval) ; break; case CHEAT_SEARCH_TYPE_EQPLUS : - match = ( curr_subval == prev_subval+cheat_manager_state.search_eqplus_value); + match = ( curr_subval == prev_subval+cheat_manager_state.search_eqplus_value) ; break; case CHEAT_SEARCH_TYPE_EQMINUS : - match = ( curr_subval == prev_subval-cheat_manager_state.search_eqminus_value); + match = ( curr_subval == prev_subval-cheat_manager_state.search_eqminus_value) ; break; } if (!match ) @@ -966,9 +934,9 @@ int cheat_manager_search(enum cheat_search_type search_type) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item); + memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches--; + cheat_manager_state.num_matches-- ; } } } @@ -976,7 +944,7 @@ int cheat_manager_search(enum cheat_search_type search_type) memcpy(cheat_manager_state.prev_memory_buf, cheat_manager_state.curr_memory_buf, cheat_manager_state.actual_memory_size); - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches); + snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches) ; msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, 1, 180, true); @@ -985,7 +953,7 @@ int cheat_manager_search(enum cheat_search_type search_type) menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); #endif - return 0; + return 0 ; } bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int address, unsigned int address_mask, @@ -994,15 +962,15 @@ bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int ad int new_size = cheat_manager_get_size() + 1; if ( !cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO) ) - return false; + return false ; - cheat_manager_state.cheats[cheat_manager_state.size-1].address = address; - cheat_manager_state.cheats[cheat_manager_state.size-1].address_mask = address_mask; - cheat_manager_state.cheats[cheat_manager_state.size-1].memory_search_size = memory_search_size; - cheat_manager_state.cheats[cheat_manager_state.size-1].value = value; - cheat_manager_state.cheats[cheat_manager_state.size-1].big_endian = big_endian; + cheat_manager_state.cheats[cheat_manager_state.size-1].address = address ; + cheat_manager_state.cheats[cheat_manager_state.size-1].address_mask = address_mask ; + cheat_manager_state.cheats[cheat_manager_state.size-1].memory_search_size = memory_search_size ; + cheat_manager_state.cheats[cheat_manager_state.size-1].value = value ; + cheat_manager_state.cheats[cheat_manager_state.size-1].big_endian = big_endian ; - return true; + return true ; } int cheat_manager_add_matches(const char *path, const char *label, unsigned type, size_t menuidx, size_t entry_idx) @@ -1021,66 +989,66 @@ int cheat_manager_add_matches(const char *path, if ( cheat_manager_state.num_matches + cheat_manager_state.size > 100 ) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY), 1, 180, true); - return 0; + return 0 ; } - cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); + cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ; - for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) + for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) { switch ( bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); - break; + *(curr+idx) + (*(curr+idx+1)*256) ; + break ; case 4 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); - break; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; + break ; case 1 : default : - curr_val = *(curr+idx); - break; + curr_val = *(curr+idx) ; + break ; } - for (byte_part = 0; byte_part < 8/bits; byte_part++) + for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) { unsigned int prev_match; if (bits < 8 ) { - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; if (prev_match) { if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)), cheat_manager_state.big_endian, curr_val) ) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true); - return 0; + return 0 ; } - num_added++; + num_added++ ; } } else { - prev_match = *(cheat_manager_state.matches+idx); + prev_match = *(cheat_manager_state.matches+idx) ; if (prev_match) { if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, cheat_manager_state.big_endian, curr_val)) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true); - return 0; + return 0 ; } - num_added++; + num_added++ ; } } } } - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_manager_state.num_matches); + snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_manager_state.num_matches) ; msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, 1, 180, true); @@ -1102,38 +1070,38 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu case RUMBLE_TYPE_DISABLED: return; case RUMBLE_TYPE_CHANGES: - rumble = (curr_value != cheat->rumble_prev_value); - break; + rumble = (curr_value != cheat->rumble_prev_value) ; + break ; case RUMBLE_TYPE_DOES_NOT_CHANGE: - rumble = (curr_value == cheat->rumble_prev_value); - break; + rumble = (curr_value == cheat->rumble_prev_value) ; + break ; case RUMBLE_TYPE_INCREASE: - rumble = (curr_value > cheat->rumble_prev_value); - break; + rumble = (curr_value > cheat->rumble_prev_value) ; + break ; case RUMBLE_TYPE_DECREASE: - rumble = (curr_value < cheat->rumble_prev_value); - break; + rumble = (curr_value < cheat->rumble_prev_value) ; + break ; case RUMBLE_TYPE_EQ_VALUE: - rumble = (curr_value == cheat->rumble_value); - break; + rumble = (curr_value == cheat->rumble_value) ; + break ; case RUMBLE_TYPE_NEQ_VALUE: - rumble = (curr_value != cheat->rumble_value); - break; + rumble = (curr_value != cheat->rumble_value) ; + break ; case RUMBLE_TYPE_LT_VALUE: - rumble = (curr_value < cheat->rumble_value); - break; + rumble = (curr_value < cheat->rumble_value) ; + break ; case RUMBLE_TYPE_GT_VALUE: - rumble = (curr_value > cheat->rumble_value); + rumble = (curr_value > cheat->rumble_value) ; break; case RUMBLE_TYPE_INCREASE_BY_VALUE: - rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value); - break; + rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value) ; + break ; case RUMBLE_TYPE_DECREASE_BY_VALUE: - rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value); - break; + rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value) ; + break ; } - cheat->rumble_prev_value = curr_value; + cheat->rumble_prev_value = curr_value ; /* Give the emulator enough time * to initialize, load state, etc */ @@ -1141,15 +1109,15 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu { if (rumble) { - cheat->rumble_primary_end_time = cpu_features_get_time_usec() + (cheat->rumble_primary_duration*1000); - cheat->rumble_secondary_end_time = cpu_features_get_time_usec() + (cheat->rumble_secondary_duration*1000); + cheat->rumble_primary_end_time = cpu_features_get_time_usec() + (cheat->rumble_primary_duration*1000) ; + cheat->rumble_secondary_end_time = cpu_features_get_time_usec() + (cheat->rumble_secondary_duration*1000) ; input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_STRONG, cheat->rumble_primary_strength); input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_WEAK, cheat->rumble_secondary_strength); } } else { - cheat->rumble_initialized++; + cheat->rumble_initialized++ ; return; } @@ -1168,7 +1136,7 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu { if (cheat->rumble_secondary_end_time != 0) input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_WEAK, 0); - cheat->rumble_secondary_end_time = 0; + cheat->rumble_secondary_end_time = 0 ; } else { @@ -1188,19 +1156,19 @@ void cheat_manager_apply_retro_cheats(void) if ((!cheat_manager_state.cheats)) return; - for (i = 0; i < cheat_manager_state.size; i++ ) + for (i = 0 ; i < cheat_manager_state.size ; i++ ) { unsigned char *curr; unsigned int idx; bool set_value = false; unsigned int value_to_set = 0; - unsigned int repeat_iter = 0; - unsigned int address_mask = cheat_manager_state.cheats[i].address_mask; + unsigned int repeat_iter = 0 ; + unsigned int address_mask = cheat_manager_state.cheats[i].address_mask ; if (cheat_manager_state.cheats[i].handler != CHEAT_HANDLER_TYPE_RETRO || !cheat_manager_state.cheats[i].state) - continue; + continue ; if (!cheat_manager_state.memory_initialized) - cheat_manager_initialize_memory(NULL, false); + cheat_manager_initialize_memory(NULL, false) ; /* If we're still not initialized, something * must have gone wrong - just bail */ @@ -1209,13 +1177,13 @@ void cheat_manager_apply_retro_cheats(void) if (!run_cheat) { - run_cheat = true; - continue; + run_cheat = true ; + continue ; } - cheat_manager_setup_search_meta(cheat_manager_state.cheats[i].memory_search_size, &bytes_per_item, &mask, &bits); + cheat_manager_setup_search_meta(cheat_manager_state.cheats[i].memory_search_size, &bytes_per_item, &mask, &bits) ; - curr = cheat_manager_state.curr_memory_buf; - idx = cheat_manager_state.cheats[i].address; + curr = cheat_manager_state.curr_memory_buf ; + idx = cheat_manager_state.cheats[i].address ; switch (bytes_per_item) { @@ -1223,142 +1191,142 @@ void cheat_manager_apply_retro_cheats(void) { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); - break; + *(curr+idx) + (*(curr+idx+1)*256) ; + break ; } case 4 : { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); - break; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; + break ; } case 1 : default : { - curr_val = *(curr+idx); - break; + curr_val = *(curr+idx) ; + break ; } } - cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val); + cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val) ; switch (cheat_manager_state.cheats[i].cheat_type ) { case CHEAT_TYPE_SET_TO_VALUE : - set_value = true; - value_to_set = cheat_manager_state.cheats[i].value; - break; + set_value = true ; + value_to_set = cheat_manager_state.cheats[i].value ; + break ; case CHEAT_TYPE_INCREASE_VALUE: - set_value = true; - value_to_set = curr_val + cheat_manager_state.cheats[i].value; + set_value = true ; + value_to_set = curr_val + cheat_manager_state.cheats[i].value ; break; case CHEAT_TYPE_DECREASE_VALUE: - set_value = true; - value_to_set = curr_val - cheat_manager_state.cheats[i].value; + set_value = true ; + value_to_set = curr_val - cheat_manager_state.cheats[i].value ; break; case CHEAT_TYPE_RUN_NEXT_IF_EQ: if (!(curr_val == cheat_manager_state.cheats[i].value)) - run_cheat = false; + run_cheat = false ; break; case CHEAT_TYPE_RUN_NEXT_IF_NEQ: if (!(curr_val != cheat_manager_state.cheats[i].value )) - run_cheat = false; + run_cheat = false ; break; case CHEAT_TYPE_RUN_NEXT_IF_LT: if (!(cheat_manager_state.cheats[i].value < curr_val)) - run_cheat = false; + run_cheat = false ; break; case CHEAT_TYPE_RUN_NEXT_IF_GT: if (!(cheat_manager_state.cheats[i].value > curr_val)) - run_cheat = false; + run_cheat = false ; break; } if (set_value) { - for ( repeat_iter = 1; repeat_iter <= cheat_manager_state.cheats[i].repeat_count; repeat_iter++) + for ( repeat_iter = 1 ; repeat_iter <= cheat_manager_state.cheats[i].repeat_count ; repeat_iter++) { switch (bytes_per_item) { case 2 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 8) & 0xFF; - *(curr+idx+1) = value_to_set & 0xFF; + *(curr+idx) = (value_to_set >> 8) & 0xFF ; + *(curr+idx+1) = value_to_set & 0xFF ; } else { - *(curr+idx) = value_to_set & 0xFF; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF; + *(curr+idx) = value_to_set & 0xFF ; + *(curr+idx+1) = (value_to_set >> 8) & 0xFF ; } - break; + break ; case 4 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 24) & 0xFF; - *(curr+idx+1) = (value_to_set >> 16) & 0xFF; - *(curr+idx+2) = (value_to_set >> 8) & 0xFF; - *(curr+idx+3) = value_to_set & 0xFF; + *(curr+idx) = (value_to_set >> 24) & 0xFF ; + *(curr+idx+1) = (value_to_set >> 16) & 0xFF ; + *(curr+idx+2) = (value_to_set >> 8) & 0xFF ; + *(curr+idx+3) = value_to_set & 0xFF ; } else { - *(curr+idx) = value_to_set & 0xFF; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF; - *(curr+idx+2) = (value_to_set >> 16) & 0xFF; - *(curr+idx+3) = (value_to_set >> 24) & 0xFF; + *(curr+idx) = value_to_set & 0xFF ; + *(curr+idx+1) = (value_to_set >> 8) & 0xFF ; + *(curr+idx+2) = (value_to_set >> 16) & 0xFF ; + *(curr+idx+3) = (value_to_set >> 24) & 0xFF ; } - break; + break ; case 1 : if (bits < 8) { unsigned bitpos; unsigned char val = *(curr+idx); - for (bitpos = 0; bitpos < 8; bitpos++) + for (bitpos = 0 ; bitpos < 8 ; bitpos++) { if ((address_mask>>bitpos)&0x01 ) { - mask = (~(1<>bitpos)&0x01)<>bitpos)&0x01)< cheat_manager_state.num_matches-1) @@ -1387,57 +1355,57 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); if (match_action == CHEAT_MATCH_ACTION_TYPE_BROWSE) - start_idx = *address; + start_idx = *address ; else - start_idx = 0; + start_idx = 0 ; - for (idx = start_idx; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) + for (idx = start_idx ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) { switch (bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); + *(curr+idx) + (*(curr+idx+1)*256) ; if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : - *(prev+idx) + (*(prev+idx+1)*256); - break; + *(prev+idx) + (*(prev+idx+1)*256) ; + break ; case 4 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : - *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); - break; + *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256) ; + break ; case 1 : default : - curr_val = *(curr+idx); + curr_val = *(curr+idx) ; if (prev != NULL) - prev_val = *(prev+idx); - break; + prev_val = *(prev+idx) ; + break ; } if (match_action == CHEAT_MATCH_ACTION_TYPE_BROWSE) { *curr_value = curr_val; *prev_value = prev_val; - return; + return ; } if (!prev) return; - for (byte_part = 0; byte_part < 8/bits; byte_part++) + for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) { - unsigned int prev_match; + unsigned int prev_match ; if (bits < 8 ) { - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; if (prev_match) { if (target_match_idx == curr_match_idx) @@ -1445,12 +1413,12 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig switch (match_action) { case CHEAT_MATCH_ACTION_TYPE_BROWSE : - return; + return ; case CHEAT_MATCH_ACTION_TYPE_VIEW : - *address = idx; - *address_mask = (mask << (byte_part*bits)); - *curr_value = curr_val; - *prev_value = prev_val; + *address = idx ; + *address_mask = (mask << (byte_part*bits)) ; + *curr_value = curr_val ; + *prev_value = prev_val ; return; case CHEAT_MATCH_ACTION_TYPE_COPY : if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)), @@ -1458,26 +1426,26 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true); - return; + return ; case CHEAT_MATCH_ACTION_TYPE_DELETE : if (bits < 8) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item); + memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches--; + cheat_manager_state.num_matches-- ; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); return; } return; } - curr_match_idx++; + curr_match_idx++ ; } } else { - prev_match = *(cheat_manager_state.matches+idx); + prev_match = *(cheat_manager_state.matches+idx) ; if (prev_match) { if (target_match_idx == curr_match_idx) @@ -1485,33 +1453,33 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig switch (match_action) { case CHEAT_MATCH_ACTION_TYPE_BROWSE : - return; + return ; case CHEAT_MATCH_ACTION_TYPE_VIEW : - *address = idx; - *address_mask = 0xFF; - *curr_value = curr_val; - *prev_value = prev_val; - return; + *address = idx ; + *address_mask = 0xFF ; + *curr_value = curr_val ; + *prev_value = prev_val ; + return ; case CHEAT_MATCH_ACTION_TYPE_COPY : if ( !cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, cheat_manager_state.big_endian, curr_val) ) runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true); - return; + return ; case CHEAT_MATCH_ACTION_TYPE_DELETE : if ( bits < 8 ) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item); + memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches--; + cheat_manager_state.num_matches-- ; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); - return; + return ; } } - curr_match_idx++; + curr_match_idx++ ; } } @@ -1521,8 +1489,8 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig int cheat_manager_copy_match(rarch_setting_t *setting, bool wraparound) { cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_COPY, - cheat_manager_state.match_idx, NULL, NULL, NULL, NULL); - return 0; + cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ; + return 0 ; } int cheat_manager_delete_match(rarch_setting_t *setting, bool wraparound) diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index 1e0737bcbc..917ea711b8 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -77,8 +77,7 @@ enum cheat_rumble_type RUMBLE_TYPE_LT_VALUE, RUMBLE_TYPE_GT_VALUE, RUMBLE_TYPE_INCREASE_BY_VALUE, - RUMBLE_TYPE_DECREASE_BY_VALUE, - RUMBLE_TYPE_END_LIST + RUMBLE_TYPE_DECREASE_BY_VALUE }; /* Some codes are ridiculously large - over 10000 bytes */ @@ -179,8 +178,6 @@ struct cheat_manager unsigned browse_address; char working_desc[CHEAT_DESC_SCRATCH_SIZE] ; char working_code[CHEAT_CODE_SCRATCH_SIZE] ; - unsigned int loading_cheat_size; - unsigned int loading_cheat_offset; }; typedef struct cheat_manager cheat_manager_t; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 0110f9ef21..dee87c546a 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -45,7 +45,7 @@ RETRO_BEGIN_DECLS #endif #ifndef MAX_CHEAT_COUNTERS -#define MAX_CHEAT_COUNTERS 6000 +#define MAX_CHEAT_COUNTERS 100 #endif #define MENU_SETTINGS_CORE_INFO_NONE 0xffff diff --git a/menu/menu_setting.c b/menu/menu_setting.c index fbf57eab1b..0f6b8e889b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4745,7 +4745,7 @@ static bool setting_append_list( config_uint_cbs(cheat_manager_state.working_cheat.rumble_type, CHEAT_RUMBLE_TYPE, setting_uint_action_left_default,setting_uint_action_right_default, MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED,&setting_get_string_representation_uint_as_enum, - RUMBLE_TYPE_DISABLED,RUMBLE_TYPE_END_LIST-1,1) ; + RUMBLE_TYPE_DISABLED,RUMBLE_TYPE_GT_VALUE,1) ; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.rumble_value, CHEAT_RUMBLE_VALUE, From 2517670f80cd012ed27ca69b8a64d21beb527679 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 10 Oct 2018 17:53:27 -0400 Subject: [PATCH 0319/1292] gdi: remove unused variable --- gfx/drivers_font/gdi_font.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gfx/drivers_font/gdi_font.c b/gfx/drivers_font/gdi_font.c index 2cb7e0e981..baa236d6ab 100644 --- a/gfx/drivers_font/gdi_font.c +++ b/gfx/drivers_font/gdi_font.c @@ -86,7 +86,7 @@ static void gdi_render_msg( void *data, const char *msg, const struct font_params *params) { - float x, y, scale, drop_mod, alpha, drop_alpha; + float x, y, scale, drop_mod, drop_alpha; int drop_x, drop_y, msg_strlen; unsigned i; unsigned newX, newY, newDropX, newDropY; @@ -116,7 +116,6 @@ static void gdi_render_msg( red = FONT_COLOR_GET_RED(params->color); green = FONT_COLOR_GET_GREEN(params->color); blue = FONT_COLOR_GET_BLUE(params->color); - alpha = FONT_COLOR_GET_ALPHA(params->color); } else { @@ -131,7 +130,6 @@ static void gdi_render_msg( red = video_info->font_msg_color_r * 255.0f; green = video_info->font_msg_color_g * 255.0f; blue = video_info->font_msg_color_b * 255.0f; - alpha = 255; } msg_strlen = strlen(msg); From 454efe03dc18d862318c3a3101e9d522738da87d Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 10 Oct 2018 19:02:36 -0500 Subject: [PATCH 0320/1292] fix auto shader preset loading in d3d10, d3d11, d3d12 --- gfx/drivers/d3d10.c | 6 ++++-- gfx/drivers/d3d11.c | 5 +++-- gfx/drivers/d3d12.c | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index dd08fdf786..b123cda661 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -23,6 +23,8 @@ #include "../../driver.h" #include "../../verbosity.h" #include "../../configuration.h" +#include "../../retroarch.h" + #include "../video_driver.h" #include "../font_driver.h" #include "../common/win32_common.h" @@ -909,10 +911,10 @@ d3d10_gfx_init(const video_info_t* video, if (settings->bools.video_shader_enable) { - const char* ext = path_get_extension(settings->paths.path_shader); + const char* ext = path_get_extension(retroarch_get_shader_preset()); if (ext && !strncmp(ext, "slang", 5)) - d3d10_gfx_set_shader(d3d10, RARCH_SHADER_SLANG, settings->paths.path_shader); + d3d10_gfx_set_shader(d3d10, RARCH_SHADER_SLANG, retroarch_get_shader_preset()); } #if 0 diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 405894bbef..137ad02525 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -25,6 +25,7 @@ #include "../../driver.h" #include "../../verbosity.h" #include "../configuration.h" +#include "../../retroarch.h" #include "../video_driver.h" #include "../font_driver.h" #include "../common/win32_common.h" @@ -954,10 +955,10 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i if (settings->bools.video_shader_enable) { - const char* ext = path_get_extension(settings->paths.path_shader); + const char* ext = path_get_extension(retroarch_get_shader_preset()); if (ext && !strncmp(ext, "slang", 5)) - d3d11_gfx_set_shader(d3d11, RARCH_SHADER_SLANG, settings->paths.path_shader); + d3d11_gfx_set_shader(d3d11, RARCH_SHADER_SLANG, retroarch_get_shader_preset()); } if (video_driver_get_hw_context()->context_type == RETRO_HW_CONTEXT_DIRECT3D && diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index 0f2ab31178..c4dab9fcc3 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -31,6 +31,7 @@ #include "../../driver.h" #include "../../verbosity.h" #include "../../configuration.h" +#include "../../retroarch.h" #include "wiiu/wiiu_dbg.h" @@ -971,10 +972,10 @@ d3d12_gfx_init(const video_info_t* video, const input_driver_t** input, void** i if (settings->bools.video_shader_enable) { - const char* ext = path_get_extension(settings->paths.path_shader); + const char* ext = path_get_extension(retroarch_get_shader_preset()); if (ext && string_is_equal(ext, "slangp")) - d3d12_gfx_set_shader(d3d12, RARCH_SHADER_SLANG, settings->paths.path_shader); + d3d12_gfx_set_shader(d3d12, RARCH_SHADER_SLANG, retroarch_get_shader_preset()); } return d3d12; From 0782c3c82086e1f2a8eed64ed1d5623f18510e24 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Oct 2018 03:26:39 +0200 Subject: [PATCH 0321/1292] Cleanups --- gfx/drivers/metal.m | 38 ++++++++++++++++++++++++-------------- retroarch.c | 3 +-- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/gfx/drivers/metal.m b/gfx/drivers/metal.m index 0fcd932d01..3496d035bf 100644 --- a/gfx/drivers/metal.m +++ b/gfx/drivers/metal.m @@ -1,9 +1,17 @@ -// -// metal.m -// RetroArch_Metal -// -// Created by Stuart Carnie on 5/14/18. -// +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - Stuart Carnie + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ #import #import @@ -28,9 +36,7 @@ #endif #ifdef HAVE_MENU - #import "../../menu/menu_driver.h" - #endif #import "../font_driver.h" @@ -145,10 +151,12 @@ static void metal_free(void *data) static void metal_set_viewport(void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate) { -// RARCH_LOG("[Metal]: set_viewport size: %dx%d full: %s rotate: %s\n", -// viewport_width, viewport_height, -// force_full ? "YES" : "NO", -// allow_rotate ? "YES" : "NO"); +#if 0 + RARCH_LOG("[Metal]: set_viewport size: %dx%d full: %s rotate: %s\n", + viewport_width, viewport_height, + force_full ? "YES" : "NO", + allow_rotate ? "YES" : "NO"); +#endif } static void metal_set_rotation(void *data, unsigned rotation) @@ -270,7 +278,9 @@ static void metal_set_texture_enable(void *data, bool state, bool full_screen) return; md.menu.enabled = state; - //md.menu.fullScreen = full_screen; +#if 0 + md.menu.fullScreen = full_screen; +#endif } static void metal_set_osd_msg(void *data, @@ -398,7 +408,7 @@ static const video_overlay_interface_t metal_overlay_interface = { }; static void metal_get_overlay_interface(void *data, - const video_overlay_interface_t **iface) + const video_overlay_interface_t **iface) { (void)data; *iface = &metal_overlay_interface; diff --git a/retroarch.c b/retroarch.c index ccfe66dc9f..4a286e30e7 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2060,8 +2060,7 @@ char* retroarch_get_shader_preset(void) return runtime_shader_preset; else if (!string_is_empty(settings->paths.path_shader)) return settings->paths.path_shader; - else - return NULL; + return NULL; } bool retroarch_override_setting_is_set(enum rarch_override_setting enum_idx, void *data) From c443d6b4753dffa2ed0a9f7e379cd5e4c9b841cb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Oct 2018 03:26:58 +0200 Subject: [PATCH 0322/1292] Revert "Revert this - was getting crashes in both OSX and MSVC 2003" This reverts commit 7d0dba30071a6768448494435ce67400c509b7e5. --- libretro-common/file/config_file.c | 49 +- libretro-common/include/file/config_file.h | 14 + managers/cheat_manager.c | 784 +++++++++++---------- managers/cheat_manager.h | 5 +- menu/menu_driver.h | 2 +- menu/menu_setting.c | 2 +- 6 files changed, 457 insertions(+), 399 deletions(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 0a63e7781a..7dd671b662 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -66,7 +66,7 @@ struct config_include_list }; static config_file_t *config_file_new_internal( - const char *path, unsigned depth); + const char *path, unsigned depth, config_file_cb_t *cb); static int config_sort_compare_func(struct config_entry_list *a, struct config_entry_list *b) @@ -267,7 +267,7 @@ static void add_child_list(config_file_t *parent, config_file_t *child) parent->tail = NULL; } -static void add_sub_conf(config_file_t *conf, char *path) +static void add_sub_conf(config_file_t *conf, char *path, config_file_cb_t *cb) { char real_path[PATH_MAX_LENGTH]; config_file_t *sub_conf = NULL; @@ -314,7 +314,7 @@ static void add_sub_conf(config_file_t *conf, char *path) #endif sub_conf = (config_file_t*) - config_file_new_internal(real_path, conf->include_depth + 1); + config_file_new_internal(real_path, conf->include_depth + 1, cb); if (!sub_conf) return; @@ -324,7 +324,7 @@ static void add_sub_conf(config_file_t *conf, char *path) } static bool parse_line(config_file_t *conf, - struct config_entry_list *list, char *line) + struct config_entry_list *list, char *line, config_file_cb_t *cb) { char *comment = NULL; char *key_tmp = NULL; @@ -351,7 +351,7 @@ static bool parse_line(config_file_t *conf, if (conf->include_depth >= MAX_INCLUDE_DEPTH) fprintf(stderr, "!!! #include depth exceeded for config. Might be a cycle.\n"); else - add_sub_conf(conf, path); + add_sub_conf(conf, path, cb); free(path); } goto error; @@ -396,18 +396,19 @@ error: } static config_file_t *config_file_new_internal( - const char *path, unsigned depth) + const char *path, unsigned depth, config_file_cb_t *cb) { RFILE *file = NULL; struct config_file *conf = (struct config_file*)malloc(sizeof(*conf)); if (!conf) return NULL; - conf->path = NULL; - conf->entries = NULL; - conf->tail = NULL; - conf->includes = NULL; - conf->include_depth = 0; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; + conf->include_depth = 0; + conf->guaranteed_no_duplicates = false ; if (!path || !*path) return conf; @@ -455,7 +456,7 @@ static config_file_t *config_file_new_internal( continue; } - if (*line && parse_line(conf, list, line)) + if (*line && parse_line(conf, list, line, cb)) { if (conf->entries) conf->tail->next = list; @@ -463,6 +464,9 @@ static config_file_t *config_file_new_internal( conf->entries = list; conf->tail = list; + + if (cb != NULL && list->key != NULL && list->value != NULL) + cb->config_file_new_entry_cb(list->key, list->value) ; } free(line); @@ -551,11 +555,12 @@ config_file_t *config_file_new_from_string(const char *from_string) if (!from_string) return conf; - conf->path = NULL; - conf->entries = NULL; - conf->tail = NULL; - conf->includes = NULL; - conf->include_depth = 0; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; + conf->include_depth = 0; + conf->guaranteed_no_duplicates = false ; lines = string_split(from_string, "\n"); if (!lines) @@ -580,7 +585,7 @@ config_file_t *config_file_new_from_string(const char *from_string) if (line && conf) { - if (*line && parse_line(conf, list, line)) + if (*line && parse_line(conf, list, line, NULL)) { if (conf->entries) conf->tail->next = list; @@ -600,9 +605,13 @@ config_file_t *config_file_new_from_string(const char *from_string) return conf; } +config_file_t *config_file_new_with_callback(const char *path, config_file_cb_t *cb) +{ + return config_file_new_internal(path, 0, cb); +} config_file_t *config_file_new(const char *path) { - return config_file_new_internal(path, 0); + return config_file_new_internal(path, 0, NULL); } static struct config_entry_list *config_get_entry(const config_file_t *conf, @@ -834,7 +843,7 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in) void config_set_string(config_file_t *conf, const char *key, const char *val) { struct config_entry_list *last = conf->entries; - struct config_entry_list *entry = config_get_entry(conf, key, &last); + struct config_entry_list *entry = conf->guaranteed_no_duplicates?NULL:config_get_entry(conf, key, &last); if (entry && !entry->readonly) { diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index cbeac2ed98..e55430472d 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -58,6 +58,7 @@ struct config_file struct config_entry_list *entries; struct config_entry_list *tail; unsigned include_depth; + bool guaranteed_no_duplicates; struct config_include_list *includes; }; @@ -65,6 +66,13 @@ struct config_file typedef struct config_file config_file_t; +struct config_file_cb +{ + void (*config_file_new_entry_cb)(char*, char*); +}; + +typedef struct config_file_cb config_file_cb_t ; + /* Config file format * - # are treated as comments. Rest of the line is ignored. * - Format is: key = value. There can be as many spaces as you like in-between. @@ -79,6 +87,11 @@ typedef struct config_file config_file_t; * NULL path will create an empty config file. */ config_file_t *config_file_new(const char *path); +/* Loads a config file. Returns NULL if file doesn't exist. + * NULL path will create an empty config file. + * Includes cb callbacks to run custom code during config file processing.*/ +config_file_t *config_file_new_with_callback(const char *path, config_file_cb_t *cb); + /* Load a config file from a string. */ config_file_t *config_file_new_from_string(const char *from_string); @@ -178,3 +191,4 @@ bool config_file_exists(const char *path); RETRO_END_DECLS #endif + diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 85296e55e4..d581e4790d 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -88,8 +89,12 @@ void cheat_manager_apply_cheats(void) core_set_cheat(&cheat_info); } } - runloop_msg_queue_push(msg_hash_to_str(MSG_APPLYING_CHEAT), 1, 180, true); - RARCH_LOG("%s\n", msg_hash_to_str(MSG_APPLYING_CHEAT)); + + if (cheat_manager_state.size > 0) + { + runloop_msg_queue_push(msg_hash_to_str(MSG_APPLYING_CHEAT), 1, 180, true); + RARCH_LOG("%s\n", msg_hash_to_str(MSG_APPLYING_CHEAT)); + } #ifdef HAVE_CHEEVOS data_bool = idx != 0; @@ -103,7 +108,7 @@ void cheat_manager_set_code(unsigned i, const char *str) return; if (!string_is_empty(str)) - strcpy(cheat_manager_state.cheats[i].code,str) ; + strcpy(cheat_manager_state.cheats[i].code,str); cheat_manager_state.cheats[i].state = true; } @@ -146,7 +151,7 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw buf[0] = cheats_file[0] = '\0'; if ( (!cheat_manager_state.cheats) || cheat_manager_state.size==0 ) - return false ; + return false; if (!cheat_database) strlcpy(cheats_file, path, sizeof(cheats_file)); @@ -167,6 +172,8 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw if (!conf) return false; + conf->guaranteed_no_duplicates = true; + config_set_int(conf, "cheats", cheat_manager_state.size); for (i = 0; i < cheat_manager_state.size; i++) @@ -233,44 +240,42 @@ bool cheat_manager_copy_idx_to_working(unsigned idx) return false; } - memcpy(&(cheat_manager_state.working_cheat), &(cheat_manager_state.cheats[idx]), sizeof(struct item_cheat)) ; + memcpy(&(cheat_manager_state.working_cheat), &(cheat_manager_state.cheats[idx]), sizeof(struct item_cheat)); if ( cheat_manager_state.cheats[idx].desc != NULL ) - strlcpy(cheat_manager_state.working_desc, cheat_manager_state.cheats[idx].desc, CHEAT_DESC_SCRATCH_SIZE) ; + strlcpy(cheat_manager_state.working_desc, cheat_manager_state.cheats[idx].desc, CHEAT_DESC_SCRATCH_SIZE); else - cheat_manager_state.working_desc[0] = '\0' ; + cheat_manager_state.working_desc[0] = '\0'; if ( cheat_manager_state.cheats[idx].code != NULL ) - strlcpy(cheat_manager_state.working_code, cheat_manager_state.cheats[idx].code, CHEAT_CODE_SCRATCH_SIZE) ; + strlcpy(cheat_manager_state.working_code, cheat_manager_state.cheats[idx].code, CHEAT_CODE_SCRATCH_SIZE); else - cheat_manager_state.working_code[0] = '\0' ; + cheat_manager_state.working_code[0] = '\0'; - return true ; + return true; } bool cheat_manager_copy_working_to_idx(unsigned idx) { if ( (!cheat_manager_state.cheats) || (cheat_manager_state.size < idx+1)) - { return false; - } - memcpy(&(cheat_manager_state.cheats[idx]), &(cheat_manager_state.working_cheat), sizeof(struct item_cheat)) ; + memcpy(&(cheat_manager_state.cheats[idx]), &(cheat_manager_state.working_cheat), sizeof(struct item_cheat)); if ( cheat_manager_state.cheats[idx].desc != NULL ) - free(cheat_manager_state.cheats[idx].desc) ; + free(cheat_manager_state.cheats[idx].desc); - cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc) ; + cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc); if ( cheat_manager_state.cheats[idx].code != NULL ) - free(cheat_manager_state.cheats[idx].code) ; + free(cheat_manager_state.cheats[idx].code); - cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code) ; - return true ; + cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code); + return true; } static void cheat_manager_new(unsigned size) { unsigned i; - cheat_manager_free() ; + cheat_manager_free(); cheat_manager_state.buf_size = size; cheat_manager_state.size = size; @@ -283,147 +288,175 @@ static void cheat_manager_new(unsigned size) cheat_manager_state.buf_size = 0; cheat_manager_state.size = 0; cheat_manager_state.cheats = NULL; - return ; + return; } for (i = 0; i < cheat_manager_state.size; i++) { - cheat_manager_state.cheats[i].desc = NULL ; - cheat_manager_state.cheats[i].code = NULL ; + cheat_manager_state.cheats[i].desc = NULL; + cheat_manager_state.cheats[i].code = NULL; cheat_manager_state.cheats[i].state = false; cheat_manager_state.cheats[i].repeat_count = 1; cheat_manager_state.cheats[i].repeat_add_to_value = 0; cheat_manager_state.cheats[i].repeat_add_to_address = 1; } - return ; + return; +} + +void cheat_manager_load_cb_first_pass(char *key, char *value) +{ + errno = 0; + + if (string_is_equal(key, "cheats")) + { + cheat_manager_state.loading_cheat_size = (unsigned)strtoul(value, NULL, 0); + + if (errno != 0) + cheat_manager_state.loading_cheat_size = 0; + } +} + +void cheat_manager_load_cb_second_pass(char *key, char *value) +{ + char cheat_num_str[20]; + unsigned cheat_num; + unsigned cheat_idx; + int idx = 0; + int key_length; + errno = 0; + + if (strncmp(key, "cheat", 5) != 0) + return; + + idx = 5; + key_length = strlen(key); + + while (idx < key_length && key[idx] >= '0' && key[idx] <= '9' && idx < 24) + { + cheat_num_str[idx-5] = key[idx]; + idx++; + } + + cheat_num_str[idx-5] = '\0'; + + cheat_num = (unsigned)strtoul(cheat_num_str, NULL, 0); + + if (cheat_num+cheat_manager_state.loading_cheat_offset >= cheat_manager_state.size) + return; + + key = key+idx+1; + + cheat_idx = cheat_num+cheat_manager_state.loading_cheat_offset; + + if (string_is_equal(key, "address")) + cheat_manager_state.cheats[cheat_idx].address = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "address_bit_position")) + cheat_manager_state.cheats[cheat_idx].address_mask = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "big_endian")) + cheat_manager_state.cheats[cheat_idx].big_endian = (string_is_equal(value,"true") || string_is_equal(value,"1")); + else if (string_is_equal(key, "cheat_type")) + cheat_manager_state.cheats[cheat_idx].cheat_type = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "code")) + cheat_manager_state.cheats[cheat_idx].code = strdup(value); + else if (string_is_equal(key, "desc")) + cheat_manager_state.cheats[cheat_idx].desc = strdup(value); + else if (string_is_equal(key, "enable")) + cheat_manager_state.cheats[cheat_idx].state = (string_is_equal(value,"true") || string_is_equal(value,"1")); + else if (string_is_equal(key, "handler")) + cheat_manager_state.cheats[cheat_idx].handler = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "memory_search_size")) + cheat_manager_state.cheats[cheat_idx].memory_search_size = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "repeat_add_to_address")) + cheat_manager_state.cheats[cheat_idx].repeat_add_to_address = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "repeat_add_to_value")) + cheat_manager_state.cheats[cheat_idx].repeat_add_to_value = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "repeat_count")) + cheat_manager_state.cheats[cheat_idx].repeat_count = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_port")) + cheat_manager_state.cheats[cheat_idx].rumble_port = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_primary_duration")) + cheat_manager_state.cheats[cheat_idx].rumble_primary_duration = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_primary_strength")) + cheat_manager_state.cheats[cheat_idx].rumble_primary_strength = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_secondary_duration")) + cheat_manager_state.cheats[cheat_idx].rumble_secondary_duration = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_secondary_strength")) + cheat_manager_state.cheats[cheat_idx].rumble_secondary_strength = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_type")) + cheat_manager_state.cheats[cheat_idx].rumble_type = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "rumble_value")) + cheat_manager_state.cheats[cheat_idx].rumble_value = (unsigned)strtoul(value, NULL, 0); + else if (string_is_equal(key, "value")) + cheat_manager_state.cheats[cheat_idx].value = (unsigned)strtoul(value, NULL, 0); + } bool cheat_manager_load(const char *path, bool append) { + unsigned orig_size; unsigned cheats = 0, i; - config_file_t *conf = config_file_new(path); - unsigned orig_size ; - unsigned int* data_ptrs[16] = { NULL}; - char* keys[16] = { - "cheat%u_handler", - "cheat%u_memory_search_size", - "cheat%u_cheat_type", - "cheat%u_value", - "cheat%u_address", - "cheat%u_address_bit_position", - "cheat%u_rumble_type", - "cheat%u_rumble_value", - "cheat%u_rumble_port", - "cheat%u_rumble_primary_strength", - "cheat%u_rumble_primary_duration", - "cheat%u_rumble_secondary_strength", - "cheat%u_rumble_secondary_duration", - "cheat%u_repeat_count", - "cheat%u_repeat_add_to_value", - "cheat%u_repeat_add_to_address", - }; + config_file_cb_t cb; + config_file_t *conf = NULL; + + cb.config_file_new_entry_cb = cheat_manager_load_cb_first_pass; + + cheat_manager_state.loading_cheat_size = 0; + + conf = config_file_new_with_callback(path, &cb); if (!conf) return false; - config_get_uint(conf, "cheats", &cheats); + cheats = cheat_manager_state.loading_cheat_size; if (cheats == 0) goto error; - cheat_manager_alloc_if_empty() ; + config_file_free(conf); + conf = NULL; + + + cheat_manager_alloc_if_empty(); if ( append ) { - orig_size = cheat_manager_get_size() ; + orig_size = cheat_manager_get_size(); if ( orig_size == 0) { cheat_manager_new(cheats); } else { - cheats = cheats + orig_size ; - if (cheat_manager_realloc(cheats, CHEAT_HANDLER_TYPE_EMU)) - { - } + cheats = cheats + orig_size; + if (cheat_manager_realloc(cheats, CHEAT_HANDLER_TYPE_EMU)) { } } } else { - orig_size = 0 ; + orig_size = 0; cheat_manager_new(cheats); } + for (i = orig_size; i < cheats; i++) { - unsigned j; - char desc_key[256]; - char code_key[256]; - char enable_key[256]; - char endian_key[256]; - char *tmp = NULL; - bool tmp_bool = false; - - data_ptrs[0] = &cheat_manager_state.cheats[i].handler; - data_ptrs[1] = &cheat_manager_state.cheats[i].memory_search_size; - data_ptrs[2] = &cheat_manager_state.cheats[i].cheat_type; - data_ptrs[3] = &cheat_manager_state.cheats[i].value; - data_ptrs[4] = &cheat_manager_state.cheats[i].address; - data_ptrs[5] = &cheat_manager_state.cheats[i].address_mask; - data_ptrs[6] = &cheat_manager_state.cheats[i].rumble_type; - data_ptrs[7] = &cheat_manager_state.cheats[i].rumble_value; - data_ptrs[8] = &cheat_manager_state.cheats[i].rumble_port; - data_ptrs[9] = &cheat_manager_state.cheats[i].rumble_primary_strength; - data_ptrs[10] = &cheat_manager_state.cheats[i].rumble_primary_duration; - data_ptrs[11] = &cheat_manager_state.cheats[i].rumble_secondary_strength; - data_ptrs[12] = &cheat_manager_state.cheats[i].rumble_secondary_duration; - data_ptrs[13] = &cheat_manager_state.cheats[i].repeat_count; - data_ptrs[14] = &cheat_manager_state.cheats[i].repeat_add_to_value; - data_ptrs[15] = &cheat_manager_state.cheats[i].repeat_add_to_address; - - endian_key[0] = desc_key[0] = code_key[0] = enable_key[0] = '\0'; - - snprintf(desc_key, sizeof(desc_key), "cheat%u_desc", i-orig_size); - snprintf(code_key, sizeof(code_key), "cheat%u_code", i-orig_size); - snprintf(enable_key, sizeof(enable_key), "cheat%u_enable", i-orig_size); - snprintf(endian_key, sizeof(endian_key), "cheat%u_endian", i-orig_size); - - cheat_manager_state.cheats[i].idx = i ; - - cheat_manager_state.cheats[i].desc = NULL ; - cheat_manager_state.cheats[i].code = NULL ; - cheat_manager_state.cheats[i].state = false ; - cheat_manager_state.cheats[i].big_endian = false ; - - if (config_get_string(conf, desc_key, &tmp) && !string_is_empty(tmp)) - cheat_manager_state.cheats[i].desc = strdup(tmp) ; - - if (config_get_string(conf, code_key, &tmp) && !string_is_empty(tmp)) - cheat_manager_state.cheats[i].code = strdup(tmp) ; - - if (config_get_bool(conf, enable_key, &tmp_bool)) - cheat_manager_state.cheats[i].state = tmp_bool; - - if (config_get_bool(conf, endian_key, &tmp_bool)) - cheat_manager_state.cheats[i].big_endian = tmp_bool; - - if (tmp) - free(tmp); - - cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ; + cheat_manager_state.cheats[i].idx = i; + cheat_manager_state.cheats[i].desc = NULL; + cheat_manager_state.cheats[i].code = NULL; + cheat_manager_state.cheats[i].state = false; + cheat_manager_state.cheats[i].big_endian = false; + cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE; cheat_manager_state.cheats[i].memory_search_size = 3; - for (j = 0 ; j < 16 ; j++ ) - { - char key[50] ; - unsigned val = 0; - snprintf(key, sizeof(key), keys[j], i-orig_size); - - if ( config_get_uint(conf, key, &val)) - *(data_ptrs[j]) = val ; - } } + cheat_manager_state.loading_cheat_offset = orig_size; + cb.config_file_new_entry_cb = cheat_manager_load_cb_second_pass; + conf = config_file_new_with_callback(path, &cb); + + if (!conf) + return false; + config_file_free(conf); return true; @@ -437,26 +470,26 @@ error: bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) { unsigned i; - unsigned orig_size ; + unsigned orig_size; if (!cheat_manager_state.cheats) { cheat_manager_state.cheats = (struct item_cheat*) calloc(new_size, sizeof(struct item_cheat)); - orig_size = 0 ; + orig_size = 0; } else { - orig_size = cheat_manager_state.size ; + orig_size = cheat_manager_state.size; /* if size is decreasing, free the items that will be lost */ for (i = new_size; i < orig_size; i++) { if ( cheat_manager_state.cheats[i].code != NULL ) - free(cheat_manager_state.cheats[i].code) ; + free(cheat_manager_state.cheats[i].code); if ( cheat_manager_state.cheats[i].desc != NULL ) - free(cheat_manager_state.cheats[i].desc) ; + free(cheat_manager_state.cheats[i].desc); } cheat_manager_state.cheats = (struct item_cheat*) @@ -475,14 +508,14 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) for (i = orig_size; i < cheat_manager_state.size; i++) { - memset(&(cheat_manager_state.cheats[i]), 0, sizeof(cheat_manager_state.cheats[i])) ; - cheat_manager_state.cheats[i].state = false; - cheat_manager_state.cheats[i].handler = default_handler; - cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ; - cheat_manager_state.cheats[i].memory_search_size = 3; - cheat_manager_state.cheats[i].idx = i; - cheat_manager_state.cheats[i].repeat_count = 1; - cheat_manager_state.cheats[i].repeat_add_to_value = 0; + memset(&(cheat_manager_state.cheats[i]), 0, sizeof(cheat_manager_state.cheats[i])); + cheat_manager_state.cheats[i].state = false; + cheat_manager_state.cheats[i].handler = default_handler; + cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE; + cheat_manager_state.cheats[i].memory_search_size = 3; + cheat_manager_state.cheats[i].idx = i; + cheat_manager_state.cheats[i].repeat_count = 1; + cheat_manager_state.cheats[i].repeat_add_to_value = 0; cheat_manager_state.cheats[i].repeat_add_to_address = 1; } @@ -491,37 +524,37 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) void cheat_manager_free(void) { - unsigned i = 0 ; + unsigned i = 0; if (cheat_manager_state.cheats) { for (i = 0; i < cheat_manager_state.size; i++) { if ( cheat_manager_state.cheats[i].desc != NULL ) - free(cheat_manager_state.cheats[i].desc) ; + free(cheat_manager_state.cheats[i].desc); if ( cheat_manager_state.cheats[i].code != NULL ) - free(cheat_manager_state.cheats[i].code) ; + free(cheat_manager_state.cheats[i].code); } free(cheat_manager_state.cheats); } if ( cheat_manager_state.prev_memory_buf ) - free(cheat_manager_state.prev_memory_buf) ; + free(cheat_manager_state.prev_memory_buf); if ( cheat_manager_state.matches ) - free(cheat_manager_state.matches) ; + free(cheat_manager_state.matches); - cheat_manager_state.cheats = NULL ; - cheat_manager_state.size = 0 ; - cheat_manager_state.buf_size = 0 ; - cheat_manager_state.prev_memory_buf = NULL ; - cheat_manager_state.curr_memory_buf = NULL ; - cheat_manager_state.matches = NULL ; - cheat_manager_state.total_memory_size = 0 ; - cheat_manager_state.actual_memory_size = 0 ; - cheat_manager_state.memory_initialized = false ; - cheat_manager_state.memory_search_initialized = false ; + cheat_manager_state.cheats = NULL; + cheat_manager_state.size = 0; + cheat_manager_state.buf_size = 0; + cheat_manager_state.prev_memory_buf = NULL; + cheat_manager_state.curr_memory_buf = NULL; + cheat_manager_state.matches = NULL; + cheat_manager_state.total_memory_size = 0; + cheat_manager_state.actual_memory_size = 0; + cheat_manager_state.memory_initialized = false; + cheat_manager_state.memory_search_initialized = false; } @@ -551,7 +584,7 @@ void cheat_manager_toggle_index(unsigned i) cheat_manager_update(&cheat_manager_state, i); if (!settings) - return ; + return; if (settings->bools.apply_cheats_after_toggle) cheat_manager_apply_cheats(); @@ -620,18 +653,17 @@ bool cheat_manager_get_game_specific_filename(char * cheat_filename, size_t max_ struct retro_system_info system_info; if (!settings || !global || !cheat_filename) - return false ; + return false; if ( !core_get_system_info(&system_info) ) - return false ; - + return false; core_name = system_info.library_name; game_name = path_basename(global->name.cheatfile); if ( string_is_empty(settings->paths.path_cheat_database) || string_is_empty(core_name) || string_is_empty(game_name) ) - return false ; + return false; cheat_filename[0] = '\0'; strlcat(cheat_filename, settings->paths.path_cheat_database, max_length); @@ -644,23 +676,23 @@ bool cheat_manager_get_game_specific_filename(char * cheat_filename, size_t max_ strlcat(cheat_filename, game_name, max_length); - return true ; + return true; } void cheat_manager_load_game_specific_cheats() { - char cheat_file[PATH_MAX_LENGTH] ; + char cheat_file[PATH_MAX_LENGTH]; if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) - cheat_manager_load(cheat_file,true) ; + cheat_manager_load(cheat_file,true); } void cheat_manager_save_game_specific_cheats() { - char cheat_file[PATH_MAX_LENGTH] ; + char cheat_file[PATH_MAX_LENGTH]; if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) - cheat_manager_save(cheat_file, NULL, true) ; + cheat_manager_save(cheat_file, NULL, true); } @@ -671,11 +703,8 @@ void cheat_manager_state_free(void) bool cheat_manager_alloc_if_empty(void) { - if (!cheat_manager_state.cheats) - { cheat_manager_new(0); - } return true; } @@ -693,6 +722,9 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) return 0; } + if ( meminfo.size == 0 ) + return 0; + cheat_manager_state.actual_memory_size = (unsigned)meminfo.size; cheat_manager_state.curr_memory_buf = meminfo.data; cheat_manager_state.total_memory_size = (unsigned)meminfo.size; @@ -746,84 +778,84 @@ static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int * { case 0 : { - *bytes_per_item = 1 ; - *bits = 1 ; - *mask = 0x01 ; - break ; + *bytes_per_item = 1; + *bits = 1; + *mask = 0x01; + break; } case 1 : { - *bytes_per_item = 1 ; - *bits = 2 ; - *mask = 0x03 ; - break ; + *bytes_per_item = 1; + *bits = 2; + *mask = 0x03; + break; } case 2 : { - *bytes_per_item = 1 ; - *bits = 4 ; - *mask = 0x0F ; - break ; + *bytes_per_item = 1; + *bits = 4; + *mask = 0x0F; + break; } case 3 : { - *bytes_per_item = 1 ; - *bits = 8 ; - *mask = 0xFF ; - break ; + *bytes_per_item = 1; + *bits = 8; + *mask = 0xFF; + break; } case 4 : { - *bytes_per_item = 2 ; - *bits = 8 ; - *mask = 0xFFFF ; - break ; + *bytes_per_item = 2; + *bits = 8; + *mask = 0xFFFF; + break; } case 5 : { - *bytes_per_item = 4 ; - *bits = 8 ; - *mask = 0xFFFFFFFF ; - break ; + *bytes_per_item = 4; + *bits = 8; + *mask = 0xFFFFFFFF; + break; } } } int cheat_manager_search_exact(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EXACT) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EXACT); } int cheat_manager_search_lt(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_LT) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_LT); } int cheat_manager_search_gt(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_GT) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_GT); } int cheat_manager_search_lte(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_LTE) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_LTE); } int cheat_manager_search_gte(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_GTE) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_GTE); } int cheat_manager_search_eq(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQ) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQ); } int cheat_manager_search_neq(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_NEQ) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_NEQ); } int cheat_manager_search_eqplus(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQPLUS) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQPLUS); } int cheat_manager_search_eqminus(rarch_setting_t *setting, bool wraparound) { - return cheat_manager_search(CHEAT_SEARCH_TYPE_EQMINUS) ; + return cheat_manager_search(CHEAT_SEARCH_TYPE_EQMINUS); } int cheat_manager_search(enum cheat_search_type search_type) @@ -842,14 +874,14 @@ int cheat_manager_search(enum cheat_search_type search_type) if (!cheat_manager_state.curr_memory_buf) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_NOT_INITIALIZED), 1, 180, true); - return 0 ; + return 0; } - cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ; + cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); /* little endian FF000000 = 256 */ - for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) + for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { unsigned byte_part; @@ -859,73 +891,73 @@ int cheat_manager_search(enum cheat_search_type search_type) { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; + *(curr+idx) + (*(curr+idx+1)*256); prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : - *(prev+idx) + (*(prev+idx+1)*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256); + break; } case 4 : { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : - *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); + break; } case 1 : default : { - curr_val = *(curr+idx) ; - prev_val = *(prev+idx) ; - break ; + curr_val = *(curr+idx); + prev_val = *(prev+idx); + break; } } - for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) + for (byte_part = 0; byte_part < 8/bits; byte_part++) { - unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask ; - unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask ; - unsigned int prev_match ; + unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask; + unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask; + unsigned int prev_match; if (bits < 8 ) - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); else - prev_match = *(cheat_manager_state.matches+idx) ; + prev_match = *(cheat_manager_state.matches+idx); if (prev_match > 0) { - bool match = false ; + bool match = false; switch (search_type) { case CHEAT_SEARCH_TYPE_EXACT : - match = ( curr_subval == cheat_manager_state.search_exact_value) ; + match = ( curr_subval == cheat_manager_state.search_exact_value); break; case CHEAT_SEARCH_TYPE_LT : - match = ( curr_subval < prev_subval) ; + match = ( curr_subval < prev_subval); break; case CHEAT_SEARCH_TYPE_GT : - match = ( curr_subval > prev_subval) ; + match = ( curr_subval > prev_subval); break; case CHEAT_SEARCH_TYPE_LTE : - match = ( curr_subval <= prev_subval) ; + match = ( curr_subval <= prev_subval); break; case CHEAT_SEARCH_TYPE_GTE : - match = ( curr_subval >= prev_subval) ; + match = ( curr_subval >= prev_subval); break; case CHEAT_SEARCH_TYPE_EQ : - match = ( curr_subval == prev_subval) ; + match = ( curr_subval == prev_subval); break; case CHEAT_SEARCH_TYPE_NEQ : - match = ( curr_subval != prev_subval) ; + match = ( curr_subval != prev_subval); break; case CHEAT_SEARCH_TYPE_EQPLUS : - match = ( curr_subval == prev_subval+cheat_manager_state.search_eqplus_value) ; + match = ( curr_subval == prev_subval+cheat_manager_state.search_eqplus_value); break; case CHEAT_SEARCH_TYPE_EQMINUS : - match = ( curr_subval == prev_subval-cheat_manager_state.search_eqminus_value) ; + match = ( curr_subval == prev_subval-cheat_manager_state.search_eqminus_value); break; } if (!match ) @@ -934,9 +966,9 @@ int cheat_manager_search(enum cheat_search_type search_type) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; + memset(cheat_manager_state.matches+idx,0,bytes_per_item); if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches-- ; + cheat_manager_state.num_matches--; } } } @@ -944,7 +976,7 @@ int cheat_manager_search(enum cheat_search_type search_type) memcpy(cheat_manager_state.prev_memory_buf, cheat_manager_state.curr_memory_buf, cheat_manager_state.actual_memory_size); - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches) ; + snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches); msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, 1, 180, true); @@ -953,7 +985,7 @@ int cheat_manager_search(enum cheat_search_type search_type) menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); #endif - return 0 ; + return 0; } bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int address, unsigned int address_mask, @@ -962,15 +994,15 @@ bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int ad int new_size = cheat_manager_get_size() + 1; if ( !cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO) ) - return false ; + return false; - cheat_manager_state.cheats[cheat_manager_state.size-1].address = address ; - cheat_manager_state.cheats[cheat_manager_state.size-1].address_mask = address_mask ; - cheat_manager_state.cheats[cheat_manager_state.size-1].memory_search_size = memory_search_size ; - cheat_manager_state.cheats[cheat_manager_state.size-1].value = value ; - cheat_manager_state.cheats[cheat_manager_state.size-1].big_endian = big_endian ; + cheat_manager_state.cheats[cheat_manager_state.size-1].address = address; + cheat_manager_state.cheats[cheat_manager_state.size-1].address_mask = address_mask; + cheat_manager_state.cheats[cheat_manager_state.size-1].memory_search_size = memory_search_size; + cheat_manager_state.cheats[cheat_manager_state.size-1].value = value; + cheat_manager_state.cheats[cheat_manager_state.size-1].big_endian = big_endian; - return true ; + return true; } int cheat_manager_add_matches(const char *path, const char *label, unsigned type, size_t menuidx, size_t entry_idx) @@ -989,66 +1021,66 @@ int cheat_manager_add_matches(const char *path, if ( cheat_manager_state.num_matches + cheat_manager_state.size > 100 ) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY), 1, 180, true); - return 0 ; + return 0; } - cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ; + cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); - for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) + for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { switch ( bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256); + break; case 4 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + break; case 1 : default : - curr_val = *(curr+idx) ; - break ; + curr_val = *(curr+idx); + break; } - for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) + for (byte_part = 0; byte_part < 8/bits; byte_part++) { unsigned int prev_match; if (bits < 8 ) { - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); if (prev_match) { if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)), cheat_manager_state.big_endian, curr_val) ) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true); - return 0 ; + return 0; } - num_added++ ; + num_added++; } } else { - prev_match = *(cheat_manager_state.matches+idx) ; + prev_match = *(cheat_manager_state.matches+idx); if (prev_match) { if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, cheat_manager_state.big_endian, curr_val)) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true); - return 0 ; + return 0; } - num_added++ ; + num_added++; } } } } - snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_manager_state.num_matches) ; + snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS), cheat_manager_state.num_matches); msg[sizeof(msg) - 1] = 0; runloop_msg_queue_push(msg, 1, 180, true); @@ -1070,38 +1102,38 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu case RUMBLE_TYPE_DISABLED: return; case RUMBLE_TYPE_CHANGES: - rumble = (curr_value != cheat->rumble_prev_value) ; - break ; + rumble = (curr_value != cheat->rumble_prev_value); + break; case RUMBLE_TYPE_DOES_NOT_CHANGE: - rumble = (curr_value == cheat->rumble_prev_value) ; - break ; + rumble = (curr_value == cheat->rumble_prev_value); + break; case RUMBLE_TYPE_INCREASE: - rumble = (curr_value > cheat->rumble_prev_value) ; - break ; + rumble = (curr_value > cheat->rumble_prev_value); + break; case RUMBLE_TYPE_DECREASE: - rumble = (curr_value < cheat->rumble_prev_value) ; - break ; + rumble = (curr_value < cheat->rumble_prev_value); + break; case RUMBLE_TYPE_EQ_VALUE: - rumble = (curr_value == cheat->rumble_value) ; - break ; + rumble = (curr_value == cheat->rumble_value); + break; case RUMBLE_TYPE_NEQ_VALUE: - rumble = (curr_value != cheat->rumble_value) ; - break ; + rumble = (curr_value != cheat->rumble_value); + break; case RUMBLE_TYPE_LT_VALUE: - rumble = (curr_value < cheat->rumble_value) ; - break ; + rumble = (curr_value < cheat->rumble_value); + break; case RUMBLE_TYPE_GT_VALUE: - rumble = (curr_value > cheat->rumble_value) ; + rumble = (curr_value > cheat->rumble_value); break; case RUMBLE_TYPE_INCREASE_BY_VALUE: - rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value) ; - break ; + rumble = (curr_value == cheat->rumble_prev_value + cheat->rumble_value); + break; case RUMBLE_TYPE_DECREASE_BY_VALUE: - rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value) ; - break ; + rumble = (curr_value == cheat->rumble_prev_value - cheat->rumble_value); + break; } - cheat->rumble_prev_value = curr_value ; + cheat->rumble_prev_value = curr_value; /* Give the emulator enough time * to initialize, load state, etc */ @@ -1109,15 +1141,15 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu { if (rumble) { - cheat->rumble_primary_end_time = cpu_features_get_time_usec() + (cheat->rumble_primary_duration*1000) ; - cheat->rumble_secondary_end_time = cpu_features_get_time_usec() + (cheat->rumble_secondary_duration*1000) ; + cheat->rumble_primary_end_time = cpu_features_get_time_usec() + (cheat->rumble_primary_duration*1000); + cheat->rumble_secondary_end_time = cpu_features_get_time_usec() + (cheat->rumble_secondary_duration*1000); input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_STRONG, cheat->rumble_primary_strength); input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_WEAK, cheat->rumble_secondary_strength); } } else { - cheat->rumble_initialized++ ; + cheat->rumble_initialized++; return; } @@ -1136,7 +1168,7 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu { if (cheat->rumble_secondary_end_time != 0) input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_WEAK, 0); - cheat->rumble_secondary_end_time = 0 ; + cheat->rumble_secondary_end_time = 0; } else { @@ -1156,19 +1188,19 @@ void cheat_manager_apply_retro_cheats(void) if ((!cheat_manager_state.cheats)) return; - for (i = 0 ; i < cheat_manager_state.size ; i++ ) + for (i = 0; i < cheat_manager_state.size; i++ ) { unsigned char *curr; unsigned int idx; bool set_value = false; unsigned int value_to_set = 0; - unsigned int repeat_iter = 0 ; - unsigned int address_mask = cheat_manager_state.cheats[i].address_mask ; + unsigned int repeat_iter = 0; + unsigned int address_mask = cheat_manager_state.cheats[i].address_mask; if (cheat_manager_state.cheats[i].handler != CHEAT_HANDLER_TYPE_RETRO || !cheat_manager_state.cheats[i].state) - continue ; + continue; if (!cheat_manager_state.memory_initialized) - cheat_manager_initialize_memory(NULL, false) ; + cheat_manager_initialize_memory(NULL, false); /* If we're still not initialized, something * must have gone wrong - just bail */ @@ -1177,13 +1209,13 @@ void cheat_manager_apply_retro_cheats(void) if (!run_cheat) { - run_cheat = true ; - continue ; + run_cheat = true; + continue; } - cheat_manager_setup_search_meta(cheat_manager_state.cheats[i].memory_search_size, &bytes_per_item, &mask, &bits) ; + cheat_manager_setup_search_meta(cheat_manager_state.cheats[i].memory_search_size, &bytes_per_item, &mask, &bits); - curr = cheat_manager_state.curr_memory_buf ; - idx = cheat_manager_state.cheats[i].address ; + curr = cheat_manager_state.curr_memory_buf; + idx = cheat_manager_state.cheats[i].address; switch (bytes_per_item) { @@ -1191,142 +1223,142 @@ void cheat_manager_apply_retro_cheats(void) { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256); + break; } case 4 : { curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; - break ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + break; } case 1 : default : { - curr_val = *(curr+idx) ; - break ; + curr_val = *(curr+idx); + break; } } - cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val) ; + cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val); switch (cheat_manager_state.cheats[i].cheat_type ) { case CHEAT_TYPE_SET_TO_VALUE : - set_value = true ; - value_to_set = cheat_manager_state.cheats[i].value ; - break ; + set_value = true; + value_to_set = cheat_manager_state.cheats[i].value; + break; case CHEAT_TYPE_INCREASE_VALUE: - set_value = true ; - value_to_set = curr_val + cheat_manager_state.cheats[i].value ; + set_value = true; + value_to_set = curr_val + cheat_manager_state.cheats[i].value; break; case CHEAT_TYPE_DECREASE_VALUE: - set_value = true ; - value_to_set = curr_val - cheat_manager_state.cheats[i].value ; + set_value = true; + value_to_set = curr_val - cheat_manager_state.cheats[i].value; break; case CHEAT_TYPE_RUN_NEXT_IF_EQ: if (!(curr_val == cheat_manager_state.cheats[i].value)) - run_cheat = false ; + run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_NEQ: if (!(curr_val != cheat_manager_state.cheats[i].value )) - run_cheat = false ; + run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_LT: if (!(cheat_manager_state.cheats[i].value < curr_val)) - run_cheat = false ; + run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_GT: if (!(cheat_manager_state.cheats[i].value > curr_val)) - run_cheat = false ; + run_cheat = false; break; } if (set_value) { - for ( repeat_iter = 1 ; repeat_iter <= cheat_manager_state.cheats[i].repeat_count ; repeat_iter++) + for ( repeat_iter = 1; repeat_iter <= cheat_manager_state.cheats[i].repeat_count; repeat_iter++) { switch (bytes_per_item) { case 2 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 8) & 0xFF ; - *(curr+idx+1) = value_to_set & 0xFF ; + *(curr+idx) = (value_to_set >> 8) & 0xFF; + *(curr+idx+1) = value_to_set & 0xFF; } else { - *(curr+idx) = value_to_set & 0xFF ; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF ; + *(curr+idx) = value_to_set & 0xFF; + *(curr+idx+1) = (value_to_set >> 8) & 0xFF; } - break ; + break; case 4 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 24) & 0xFF ; - *(curr+idx+1) = (value_to_set >> 16) & 0xFF ; - *(curr+idx+2) = (value_to_set >> 8) & 0xFF ; - *(curr+idx+3) = value_to_set & 0xFF ; + *(curr+idx) = (value_to_set >> 24) & 0xFF; + *(curr+idx+1) = (value_to_set >> 16) & 0xFF; + *(curr+idx+2) = (value_to_set >> 8) & 0xFF; + *(curr+idx+3) = value_to_set & 0xFF; } else { - *(curr+idx) = value_to_set & 0xFF ; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF ; - *(curr+idx+2) = (value_to_set >> 16) & 0xFF ; - *(curr+idx+3) = (value_to_set >> 24) & 0xFF ; + *(curr+idx) = value_to_set & 0xFF; + *(curr+idx+1) = (value_to_set >> 8) & 0xFF; + *(curr+idx+2) = (value_to_set >> 16) & 0xFF; + *(curr+idx+3) = (value_to_set >> 24) & 0xFF; } - break ; + break; case 1 : if (bits < 8) { unsigned bitpos; unsigned char val = *(curr+idx); - for (bitpos = 0 ; bitpos < 8 ; bitpos++) + for (bitpos = 0; bitpos < 8; bitpos++) { if ((address_mask>>bitpos)&0x01 ) { - mask = (~(1<>bitpos)&0x01)<>bitpos)&0x01)< cheat_manager_state.num_matches-1) @@ -1355,57 +1387,57 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); if (match_action == CHEAT_MATCH_ACTION_TYPE_BROWSE) - start_idx = *address ; + start_idx = *address; else - start_idx = 0 ; + start_idx = 0; - for (idx = start_idx ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item) + for (idx = start_idx; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { switch (bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256) ; + *(curr+idx) + (*(curr+idx+1)*256); if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : - *(prev+idx) + (*(prev+idx+1)*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256); + break; case 4 : curr_val = cheat_manager_state.big_endian ? (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256) ; + *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : - *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256) ; - break ; + *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); + break; case 1 : default : - curr_val = *(curr+idx) ; + curr_val = *(curr+idx); if (prev != NULL) - prev_val = *(prev+idx) ; - break ; + prev_val = *(prev+idx); + break; } if (match_action == CHEAT_MATCH_ACTION_TYPE_BROWSE) { *curr_value = curr_val; *prev_value = prev_val; - return ; + return; } if (!prev) return; - for (byte_part = 0 ; byte_part < 8/bits ; byte_part++) + for (byte_part = 0; byte_part < 8/bits; byte_part++) { - unsigned int prev_match ; + unsigned int prev_match; if (bits < 8 ) { - prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)) ; + prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); if (prev_match) { if (target_match_idx == curr_match_idx) @@ -1413,12 +1445,12 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig switch (match_action) { case CHEAT_MATCH_ACTION_TYPE_BROWSE : - return ; + return; case CHEAT_MATCH_ACTION_TYPE_VIEW : - *address = idx ; - *address_mask = (mask << (byte_part*bits)) ; - *curr_value = curr_val ; - *prev_value = prev_val ; + *address = idx; + *address_mask = (mask << (byte_part*bits)); + *curr_value = curr_val; + *prev_value = prev_val; return; case CHEAT_MATCH_ACTION_TYPE_COPY : if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)), @@ -1426,26 +1458,26 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true); - return ; + return; case CHEAT_MATCH_ACTION_TYPE_DELETE : if (bits < 8) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; + memset(cheat_manager_state.matches+idx,0,bytes_per_item); if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches-- ; + cheat_manager_state.num_matches--; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); return; } return; } - curr_match_idx++ ; + curr_match_idx++; } } else { - prev_match = *(cheat_manager_state.matches+idx) ; + prev_match = *(cheat_manager_state.matches+idx); if (prev_match) { if (target_match_idx == curr_match_idx) @@ -1453,33 +1485,33 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig switch (match_action) { case CHEAT_MATCH_ACTION_TYPE_BROWSE : - return ; + return; case CHEAT_MATCH_ACTION_TYPE_VIEW : - *address = idx ; - *address_mask = 0xFF ; - *curr_value = curr_val ; - *prev_value = prev_val ; - return ; + *address = idx; + *address_mask = 0xFF; + *curr_value = curr_val; + *prev_value = prev_val; + return; case CHEAT_MATCH_ACTION_TYPE_COPY : if ( !cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, cheat_manager_state.big_endian, curr_val) ) runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true); - return ; + return; case CHEAT_MATCH_ACTION_TYPE_DELETE : if ( bits < 8 ) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & (( ~(mask << (byte_part*bits))) & 0xFF ); else - memset(cheat_manager_state.matches+idx,0,bytes_per_item) ; + memset(cheat_manager_state.matches+idx,0,bytes_per_item); if ( cheat_manager_state.num_matches > 0 ) - cheat_manager_state.num_matches-- ; + cheat_manager_state.num_matches--; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); - return ; + return; } } - curr_match_idx++ ; + curr_match_idx++; } } @@ -1489,8 +1521,8 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig int cheat_manager_copy_match(rarch_setting_t *setting, bool wraparound) { cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_COPY, - cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ; - return 0 ; + cheat_manager_state.match_idx, NULL, NULL, NULL, NULL); + return 0; } int cheat_manager_delete_match(rarch_setting_t *setting, bool wraparound) diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index 917ea711b8..1e0737bcbc 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -77,7 +77,8 @@ enum cheat_rumble_type RUMBLE_TYPE_LT_VALUE, RUMBLE_TYPE_GT_VALUE, RUMBLE_TYPE_INCREASE_BY_VALUE, - RUMBLE_TYPE_DECREASE_BY_VALUE + RUMBLE_TYPE_DECREASE_BY_VALUE, + RUMBLE_TYPE_END_LIST }; /* Some codes are ridiculously large - over 10000 bytes */ @@ -178,6 +179,8 @@ struct cheat_manager unsigned browse_address; char working_desc[CHEAT_DESC_SCRATCH_SIZE] ; char working_code[CHEAT_CODE_SCRATCH_SIZE] ; + unsigned int loading_cheat_size; + unsigned int loading_cheat_offset; }; typedef struct cheat_manager cheat_manager_t; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index dee87c546a..0110f9ef21 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -45,7 +45,7 @@ RETRO_BEGIN_DECLS #endif #ifndef MAX_CHEAT_COUNTERS -#define MAX_CHEAT_COUNTERS 100 +#define MAX_CHEAT_COUNTERS 6000 #endif #define MENU_SETTINGS_CORE_INFO_NONE 0xffff diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 0f6b8e889b..fbf57eab1b 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4745,7 +4745,7 @@ static bool setting_append_list( config_uint_cbs(cheat_manager_state.working_cheat.rumble_type, CHEAT_RUMBLE_TYPE, setting_uint_action_left_default,setting_uint_action_right_default, MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED,&setting_get_string_representation_uint_as_enum, - RUMBLE_TYPE_DISABLED,RUMBLE_TYPE_GT_VALUE,1) ; + RUMBLE_TYPE_DISABLED,RUMBLE_TYPE_END_LIST-1,1) ; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; config_uint_cbs(cheat_manager_state.working_cheat.rumble_value, CHEAT_RUMBLE_VALUE, From 49a3514147eab34132b2af65683871ca3bdd4e6a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Oct 2018 03:27:06 +0200 Subject: [PATCH 0323/1292] Revert "Revert "bugfix cheat saving"" This reverts commit 98625796106ea6453102b67ac4108b856ed3b9a3. --- libretro-common/file/config_file.c | 7 ++++++- libretro-common/include/file/config_file.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 7dd671b662..846fa2c6fc 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -406,6 +406,7 @@ static config_file_t *config_file_new_internal( conf->path = NULL; conf->entries = NULL; conf->tail = NULL; + conf->last = NULL; conf->includes = NULL; conf->include_depth = 0; conf->guaranteed_no_duplicates = false ; @@ -558,6 +559,7 @@ config_file_t *config_file_new_from_string(const char *from_string) conf->path = NULL; conf->entries = NULL; conf->tail = NULL; + conf->last = NULL; conf->includes = NULL; conf->include_depth = 0; conf->guaranteed_no_duplicates = false ; @@ -842,7 +844,7 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in) void config_set_string(config_file_t *conf, const char *key, const char *val) { - struct config_entry_list *last = conf->entries; + struct config_entry_list *last = (conf->guaranteed_no_duplicates && conf->last) ? conf->last : conf->entries; struct config_entry_list *entry = conf->guaranteed_no_duplicates?NULL:config_get_entry(conf, key, &last); if (entry && !entry->readonly) @@ -868,6 +870,9 @@ void config_set_string(config_file_t *conf, const char *key, const char *val) last->next = entry; else conf->entries = entry; + + conf->last = entry ; + } void config_unset(config_file_t *conf, const char *key) diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index e55430472d..d2d5b026f7 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -57,6 +57,7 @@ struct config_file char *path; struct config_entry_list *entries; struct config_entry_list *tail; + struct config_entry_list *last; unsigned include_depth; bool guaranteed_no_duplicates; From 08e8fa31449cb1ca929b82641efa7b7312895f0a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Oct 2018 03:38:50 +0200 Subject: [PATCH 0324/1292] This shouldn't return false --- dynamic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dynamic.c b/dynamic.c index e011d802fa..6613a4f03c 100644 --- a/dynamic.c +++ b/dynamic.c @@ -1373,8 +1373,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) return false; #if defined(HAVE_OPENGL) - if (!gl_set_core_context(cb->context_type)) - return false; + if (!gl_set_core_context(cb->context_type)) { } #endif cb->get_current_framebuffer = video_driver_get_current_framebuffer; From 75f8e2e7a166713f899a82752cea49a78d6afd68 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Oct 2018 03:52:38 +0200 Subject: [PATCH 0325/1292] Revert --- gfx/drivers/gl.c | 68 +++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 8589a69c6e..66f45482d5 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -364,11 +364,10 @@ static void gl_set_viewport_wrapper(void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate) { video_frame_info_t video_info; - gl_t *gl = (gl_t*)data; video_driver_build_info(&video_info); - gl_set_viewport(gl, &video_info, + gl_set_viewport(data, &video_info, viewport_width, viewport_height, force_full, allow_rotate); } @@ -954,7 +953,7 @@ static bool gl_frame(void *data, const void *frame, return false; #ifdef HAVE_LIBNX - /* Should be called once per frame */ + // Should be called once per frame if(!appletMainLoop()) return false; #endif @@ -1507,38 +1506,31 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl) struct retro_hw_render_callback *hwr = video_driver_get_hw_context(); unsigned major = hwr->version_major; unsigned minor = hwr->version_minor; - enum retro_hw_context_type ctx_type = hwr->context_type; - bool hw_context_in_use = ctx_type != RETRO_HW_CONTEXT_NONE; #ifdef HAVE_OPENGLES api = GFX_CTX_OPENGL_ES_API; api_name = "OpenGL ES 2.0"; - switch (ctx_type) + if (hwr->context_type == RETRO_HW_CONTEXT_OPENGLES3) { - case RETRO_HW_CONTEXT_OPENGLES3: - major = 3; - minor = 0; - api_name = "OpenGL ES 3.0"; - break; - case RETRO_HW_CONTEXT_OPENGLES_VERSION: - api_name = "OpenGL ES 3.1+"; - break; - case RETRO_HW_CONTEXT_NONE: - default: - break; + major = 3; + minor = 0; + api_name = "OpenGL ES 3.0"; } + else if (hwr->context_type == RETRO_HW_CONTEXT_OPENGLES_VERSION) + api_name = "OpenGL ES 3.1+"; #else - api = GFX_CTX_OPENGL_API; - api_name = "OpenGL"; + api = GFX_CTX_OPENGL_API; + api_name = "OpenGL"; #endif (void)api_name; gl_shared_context_use = settings->bools.video_shared_context - && hw_context_in_use; + && hwr->context_type != RETRO_HW_CONTEXT_NONE; - if (libretro_get_shared_context() && hw_context_in_use) + if ( (libretro_get_shared_context()) + && (hwr->context_type != RETRO_HW_CONTEXT_NONE)) gl_shared_context_use = true; return video_context_driver_init_first(gl, @@ -1788,30 +1780,28 @@ static void *gl_init(const video_info_t *video, hwr = video_driver_get_hw_context(); -#ifdef GL_CONTEXT_PROFILE_MASK if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) { - /* Check if we have a core context */ - GLint gl_flags = 0; - glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &gl_flags); + gfx_ctx_flags_t flags; - if (gl_flags & GL_CONTEXT_CORE_PROFILE_BIT) + gl_query_core_context_set(true); + gl->core_context_in_use = true; + + /** + * Ensure that the rest of the frontend knows we have a core context + */ + flags.flags = 0; + BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); + + video_context_driver_set_flags(&flags); + + RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); + if (!gl_check_capability(GL_CAPS_VAO)) { - RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); - if (!gl_check_capability(GL_CAPS_VAO)) - { - RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); - goto error; - } - - if (gl_set_core_context(hwr->context_type)) - { - gl_query_core_context_set(true); - gl->core_context_in_use = true; - } + RARCH_ERR("[GL]: Failed to initialize VAOs.\n"); + goto error; } } -#endif if (!renderchain_gl_init_first(&gl->renderchain_driver, &gl->renderchain_data)) From 5d6c4c3a466f437a5bd0fab7243f57f4aadc1d6f Mon Sep 17 00:00:00 2001 From: Ayssia Date: Thu, 11 Oct 2018 10:55:56 +0800 Subject: [PATCH 0326/1292] Minor fix & Multiline formatting --- intl/msg_hash_chs.c | 47 ++++----- intl/msg_hash_chs.h | 232 +++++++++++++++++++++++++++++--------------- 2 files changed, 174 insertions(+), 105 deletions(-) diff --git a/intl/msg_hash_chs.c b/intl/msg_hash_chs.c index 7a07249434..498c4e4e4c 100644 --- a/intl/msg_hash_chs.c +++ b/intl/msg_hash_chs.c @@ -593,8 +593,8 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG: snprintf(s, len, - "你可以使用下述的方式通过游戏控制器或者键盘来对\n" - "菜单进行控制:\n" + "你可以使用下述的方式通过游戏控制\n" + "器或者键盘来对菜单进行控制:\n" " \n" ); break; @@ -608,23 +608,19 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) /* Work around C89 limitations */ char u[501]; const char * t = - "RetroArch relies on an unique form of\n" - "audio/video synchronization where it needs to be\n" - "calibrated against the refresh rate of your\n" - "display for best performance results.\n" + "RetroArch 依赖于一种独特的音频/视频同步形式,\n" + "需要根据显示器的刷新率对其进行校准,以获得最佳\n" + "性能。\n" " \n" - "If you experience any audio crackling or video\n" - "tearing, usually it means that you need to\n" - "calibrate the settings. Some choices below:\n" + "如果你的音频出现任何噼啪声或图像撕裂,通常意味\n" + "着你需要调整设置。下面是调整方法:\n" " \n"; snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ - "a) Go to '%s' -> '%s', and enable\n" - "'Threaded Video'. Refresh rate will not matter\n" - "in this mode, framerate will be higher,\n" - "but video might be less smooth.\n" - "b) Go to '%s' -> '%s', and look at\n" - "'%s'. Let it run for\n" - "2048 frames, then press 'OK'.", + "a) 在「%s」 ->「%s」中开启\n" + "「多线程渲染」。在这种模式下,刷新率不会发生变\n" + "化、帧率会提高,但是画面可能不那么流畅。\n" + "b) 在「%s」 -> 「%s」, 查看\n" + "「%s」。令其运行 2048 帧后,按 OK 键。", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), @@ -1755,8 +1751,9 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) "你可以通过以下几种方法来获取核心: \n" "一、通过访问菜单项「%s」 \n" " -> 「%s」来下载;\n" - "二、手动将其移入核心文件夹中,访问文件夹设置 \n" - "找到你的「%s」。", + " \n" + "二、手动将其移入核心文件夹中,访问文件\n" + "夹设置找到你的「%s」。", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) @@ -1769,16 +1766,14 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len) break; case MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC: snprintf(s, len, - "You can change the virtual gamepad overlay\n" - "by going to '%s' -> '%s'." + "你可以通过「%s」->「%s」更改虚拟按键。\n" " \n" - "From there you can change the overlay,\n" - "change the size and opacity of the buttons, etc.\n" + "从那里你可以改变虚拟按键的样式、大小和不透\n" + "明度。\n" " \n" - "NOTE: By default, virtual gamepad overlays are\n" - "hidden when in the menu.\n" - "If you'd like to change this behavior,\n" - "you can set '%s' to false.", + "注意:默认情况下,在菜单中虚拟按键是隐藏的。\n" + "如果您想在菜单中显示,可以将「%s」\n" + "设置为 OFF 。", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 82528f44d0..0ffd2a46d1 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -141,8 +141,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_THREADED, - "以延迟和视频撕裂为代价换取高性能,当且仅当能\n" - "达到全速模拟时使用。" + "以延迟和视频撕裂为代价换取高性能。\n" + "当且仅当能达到全速模拟时使用。" ) MSG_HASH( MSG_AUDIO_VOLUME, @@ -1537,7 +1537,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT, "EGL 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FBO_SUPPORT, - "OpenGL/Direct3D 渲染至纹理 (多渲染批次渲染器) 支持") + "OpenGL/Direct3D 纹理渲染 (多层渲染器) 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FFMPEG_SUPPORT, "FFmpeg 支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FREETYPE_SUPPORT, @@ -1949,19 +1949,23 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YES, MSG_HASH(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO, "渲染器预设") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, - "打开或关闭成就。更多内容请访问 http://retroachievements.org") + "打开或关闭成就。更多内容请访问\n" + "http://retroachievements.org") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, - "为测试目的而打开或关闭非官方成就和/或测试版特性。") + "为测试目的而打开或关闭非官方成就\n" + "和测试版特性。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, - "为所有游戏打开或关闭存档、金手指、回退、快进、暂停和慢动作。") + "为所有游戏打开或关闭存档、金手指、回退、\n" + "快进、暂停和慢动作。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, - "启用或禁用游戏中排行榜。仅在硬核模式下生效。") + "启用或禁用游戏中排行榜。\n" + "仅在硬核模式下生效。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, - "在成绩列表中启用或禁用徽章显示。") + "在成绩列表中启用或禁用徽章显示。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, - "启用或禁用 OSD 成就情况显示。") + "启用或禁用 OSD 成就情况显示。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, - "当完成一个成就时,自动截图。") + "当完成一个成就时,自动截图。") MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, "修改驱动设置。") MSG_HASH(MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, @@ -1971,7 +1975,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CORE_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_SETTINGS, "修改录制的设置。") MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS, - "修改显示覆盖、键盘覆盖和屏幕通知的设置。") + "修改显示图层、键盘图层和屏幕通知的设置。") MSG_HASH(MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS, "修改回滚、快进和慢动作的设置。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVING_SETTINGS, @@ -2026,7 +2030,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY, MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, "在局域网内搜索并连接联网游戏的主机。") MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, - "显示核心、网络和系统的信息。显示数据库和光标的管理器。") + "显示核心、网络和系统的信息。\n" + "显示数据库和光标的管理器。") MSG_HASH(MENU_ENUM_SUBLABEL_ONLINE_UPDATER, "下载并更新 RetroArch 的附加插件和组件。") MSG_HASH(MENU_ENUM_SUBLABEL_SAMBA_ENABLE, @@ -2043,13 +2048,14 @@ MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE, "设置用户界面的语言。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, "在帧与帧之间插入黑色的中间帧,通常用于消除在\n" - "120Hz刷新率的显示器上运行60Hz的游戏内容带来\n" - "的重影。") + "120Hz 刷新率的显示器上运行 60Hz 的游戏内容\n" + "带来的重影。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, "以增加画面卡顿的风险换取低延时,在垂直同步后增加\n" "时延(毫秒)。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, - "设置当开启「强制 GPU 同步」时 CPU 可以提前 GPU 多少帧。") + "当开启「强制 GPU 同步」时,\n" + "CPU 可提前 GPU 多少帧。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, "强制显示驱动程序使用特定的缓冲模式。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, @@ -2451,12 +2457,15 @@ MSG_HASH(MSG_VIEWPORT_SIZE_CALCULATION_FAILED, MSG_HASH(MSG_VIRTUAL_DISK_TRAY, "虚拟磁盘托盘。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_LATENCY, - "毫秒级音频延时。 如果音频驱动程序不支持将无法使用。") + "音频延迟(单位:毫秒)。\n" + "如果设置太低,音频驱动程序可能并不支持,\n" + "从而不会生效。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MUTE, "禁音/取消禁音。") MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, - "有助于同步音频和视频。请注意,如果禁用,音频和视频几乎一定会错位。" + "有助于同步音频和视频。\n" + "请注意,如果禁用,音频和视频几乎一定会错位。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CAMERA_ALLOW, @@ -2472,11 +2481,13 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, - "设置轮询方式。 根据设备的性能,设置为「较早」或「稍晚」可以让等待时间缩短。" + "设置轮询方式。根据设备的性能,\n" + "设置为「较早」或「稍晚」可以让等待时间缩短。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, - "允许任何用户打开菜单。如果禁用,则只有用户1能打开菜单。" + "允许任何用户打开菜单。\n" + "如果禁用,则只有用户 1 能打开菜单。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_VOLUME, @@ -2512,11 +2523,14 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, - "允许核心自行设置屏幕旋转角度,若关闭,旋转请求将被忽略。需要旋转显示器的用户请设置此选项。" + "允许核心自行设置屏幕旋转角度。\n" + "若关闭,旋转请求将被忽略。\n" + "需要旋转显示器的用户请设置此选项。" ) MSG_HASH( MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, - "某些核心关闭时可能会直接关闭 RetroArch。启用此选项可以避免这种情况发生。" + "某些核心关闭时可能会直接关闭 RetroArch。\n" + "启用此选项可以避免这种情况发生。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, @@ -2524,7 +2538,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, - "屏幕的刷新率。注意:如果视频独立线程已启用,此选项将被忽略。" + "屏幕的刷新率。注意:如果视频独立线程已启用,\n" + "此选项将被忽略。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_ENABLE, @@ -2620,7 +2635,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, "统一菜单控制") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, - "在菜单和游戏中使用相同的控制配置。应用于键盘。") + "在菜单和游戏中使用相同的控制配置。\n" + "应用于键盘。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, "显示屏幕消息。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETWORK_USER_REMOTE_ENABLE, @@ -2664,10 +2680,12 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, "不显示图像周围可能存在的黑边。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, - "轻微模糊像素点边缘以减少像素颗粒感。对运行速度影响很小。") + "轻微模糊像素点边缘以减少像素颗粒感。\n" + "对运行速度影响很小。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "加载一个由 CPU 控制的视频过滤器。注意:这\n" - "可能显著降低游戏运行速度。某些视频过滤器仅对32位色(或16位色)核心生效。") + "加载一个由 CPU 控制的视频过滤器。注意:\n" + "这可能显著降低游戏运行速度。某些视频过滤器\n" + "仅对 32 位色(或 16 位色)核心生效。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, "输入您的 Retro 成就账号的用户名。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, @@ -2691,9 +2709,11 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, "设置视窗的高度,0 表示尽可能地放大。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "设置全屏模式的分辨率宽度,0 表示使用桌面分辨率。") + "设置全屏模式的分辨率宽度,\n" + "0 表示使用桌面分辨率。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "设置全屏模式的分辨率高度,0 表示使用桌面分辨率。") + "设置全屏模式的分辨率高度,\n" + "0 表示使用桌面分辨率。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "设置屏显文字的 X 坐标。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -2705,15 +2725,17 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, "在屏幕图层上显示键盘/控制器。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, - "如果开启「在图层上显示控制器」,请选择相应屏幕图层的端口来侦听。") + "如果开启「在图层上显示控制器」,\n" + "请选择相应屏幕图层的端口来侦听。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, "扫描到的游戏内容将在此处显示。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, - "只放大整数倍显示。基础分辨率与游戏、宽高比有关。\n" - "如果「保持宽高比」选项未开启,不保证宽高放大倍数相同。") + "只放大整数倍显示。基础分辨率与游戏、宽高比\n" + "有关。如果「保持宽高比」选项未开启,不保证\n" + "宽高放大倍数相同。") MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, "使用 GPU 输出来进行截图(如果可能的话)。" @@ -2740,11 +2762,13 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX, - "每次储存即时存档时,都在新的栏位储存,以避免覆盖原有的即时存档。\n" - "每次运行游戏时,都会定位到最新的即时存档栏位。") + "每次储存即时存档时,都在新的栏位储存,\n" + "以避免覆盖原有的即时存档。每次运行游戏时,\n" + "都会定位到最新的即时存档栏位。") MSG_HASH( MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE, - "读取即时存档时不覆盖游戏存档。可能会导致某些游戏产生 BUG。" + "读取即时存档时不覆盖游戏存档。\n" + "可能会导致某些游戏产生 BUG。" ) MSG_HASH( MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO, @@ -2760,7 +2784,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_RUN_AHEAD_FRAMES, - "设置要提前运行的帧数。 如果滞后于游戏本体的帧数将导致类似于抖动之类的游戏问题。") + "设置要提前运行的帧数。如果滞后于游戏本体的帧数\n" + "将导致类似于抖动之类的游戏问题。") MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, "启用回溯倒带功能。对游戏运行速度有一定影响。" @@ -2771,11 +2796,13 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE, - "回溯缓冲区保留的内存量(单位:MB)。增加内存量可增加回溯历史的时间。" + "回溯缓冲区保留的内存量(单位:MB)。\n" + "增加内存量可增加回溯历史的时间。" ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE_STEP, - "每次增加或减少回溯缓冲区内存量值时,回溯历史将按此大小改变。" + "每次增加或减少回溯缓冲区内存量值时,\n" + "将按此大小改变。" ) MSG_HASH( @@ -2789,7 +2816,8 @@ MSG_HASH( MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, "在 RetroArch 关闭时自动保存即时存档。\n" - "如果开启了「自动加载即时存档」功能,下次开始游戏时会加载该存档。" + "如果开启了「自动加载即时存档」功能,\n" + "下次开始游戏时会加载该存档。" ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_LOAD, @@ -2801,7 +2829,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUTOSAVE_INTERVAL, - "每隔一段时间(单位:秒)自动保存游戏存档,此选项默认关闭。" + "每隔一段时间(单位:秒)自动保存游戏存档,\n" + "此选项默认关闭。" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, @@ -2809,11 +2838,13 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, - "启用自动配置按键。RetroArch 将尝试自动配置手柄按键和即插即用模式。" + "启用自动配置按键。RetroArch 将尝试自动配置\n" + "手柄按键和即插即用模式。" ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, - "交换确认键和取消键的键位,默认(关闭)为日版键位,开启则为美版键位。" + "交换确认键和取消键的键位,\n" + "默认(关闭)为日版键位,开启则为美版键位。" ) MSG_HASH( MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO, @@ -2829,7 +2860,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_DRIVER, - "使用的输入驱动。不同的视频驱动可能需要使用不同的输入驱动。" + "使用的输入驱动。不同的视频驱动可能需要使用\n" + "不同的输入驱动。" ) MSG_HASH( MENU_ENUM_SUBLABEL_JOYPAD_DRIVER, @@ -2865,7 +2897,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, - "在文件管理器中,只显示当前核心支持的游戏(根据扩展名)。" + "在文件管理器中,只显示当前核心\n" + "支持的游戏(根据扩展名)。" ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_WALLPAPER, @@ -2917,11 +2950,14 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, - "是否使用公共的在线游戏网络。如果未设置,客户端必须手动连接而不使用公共的在线游戏网络。" + "是否使用公共的在线游戏网络。\n" + "如果未设置,客户端必须手动连接而不使用\n" + "公共的在线游戏网络。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, - "连接到在线游戏网络的密码,仅有观战权限。仅在主机模式下使用。" + "连接到在线游戏网络的密码,\n" + "仅有观战权限。仅在主机模式下使用。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_START_AS_SPECTATOR, @@ -2929,15 +2965,20 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ALLOW_SLAVES, - "是否允许从属模式网络连接。从属模式客户端占用网络带宽小,但网络延迟的比较大。" + "是否允许从属模式网络连接。\n" + "从属模式客户端占用网络带宽小,\n" + "但网络延迟比较大。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_REQUIRE_SLAVES, - "是否禁止从属模式网络连接的客户端连接。仅建议网络速度快、主机性能高的用户开启。" + "是否禁止从属模式网络连接的客户端连接。\n" + "仅建议网络速度快、主机性能高的用户开启。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_STATELESS_MODE, - "是否在不保存存档的模式下运行在线游戏。开启后联机将不会有时间误差,但需要非常快的网络,且不能使用回溯功能。" + "是否在不保存存档的模式下运行在线游戏。\n" + "开启后联机将不会有时间误差,但需要\n" + "非常快的网络,且不能使用回溯功能。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_CHECK_FRAMES, @@ -2945,7 +2986,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_NAT_TRAVERSAL, - "当联机时,侦听来自公共互联网的连接,使用 UPnP 或类似的技术来规避局域网问题。" + "当联机时,侦听来自公共互联网的连接,\n" + "使用 UPnP 或类似的技术来规避局域网问题。" ) MSG_HASH( MENU_ENUM_SUBLABEL_STDIN_CMD_ENABLE, @@ -2981,7 +3023,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND, - "如果开启此选项,在列表的最上端继续向上翻页会回到最下端,向下翻页时也一样。" + "如果开启此选项,在列表的最上端继续向上翻页\n" + "会回到最下端,向下翻页时也一样。" ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, @@ -2996,13 +3039,16 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_FILE, "扫描一个兼容的文件并将其添加到合集中") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, - "为垂直同步使用自定义的交换间隔。该设置可以有效地降低显示器刷新率。" + "为垂直同步使用自定义的交换间隔。该设置可以\n" + "有效地降低显示器刷新率。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, - "在游戏存档的文件名前面加上核心名称来进行排序。" + "在游戏存档的文件名前面加上核心名称\n" + "来进行排序。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, - "在即时存档的文件名前面加上核心名称来进行排序。" + "在即时存档的文件名前面加上核心名称\n" + "来进行排序。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, "Libretro buildbot 核心目录的更新 URL。") @@ -3058,12 +3104,15 @@ MSG_HASH(MENU_ENUM_SUBLABEL_RESUME_CONTENT, MSG_HASH(MENU_ENUM_SUBLABEL_STATE_SLOT, "更改即时存档使用的栏位序号。") MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, - "如果你不慎读错了即时存档,使用此命令来撤销。") + "如果你不慎读错了即时存档,\n" + "使用此命令来撤销。") MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, - "如果你不慎覆盖了即时存档,使用此命令来撤销。") + "如果你不慎覆盖了即时存档,\n" + "使用此命令来撤销。") MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, - "Retro 成就服务。更多内容请访问 http://retroachievements.org" + "Retro 成就服务。更多内容请访问\n" + "http://retroachievements.org" ) MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, @@ -3074,11 +3123,14 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_REWIND, MSG_HASH(MENU_ENUM_SUBLABEL_RESTART_CONTENT, "重新开始游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, - "保存一个独立配置文件,该配置对此核心运行的所有游戏生效。") + "保存一个独立配置文件,\n" + "该配置对此核心运行的所有游戏生效。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, - "保存一个独立配置文件,该配置对此游戏文件夹下的所有游戏生效。") + "保存一个独立配置文件,\n" + "该配置对此游戏文件夹下的所有游戏生效。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, - "保存一个独立配置文件,该配置对此游戏生效。") + "保存一个独立配置文件,\n" + "该配置对此游戏生效。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, "设置金手指。") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_OPTIONS, @@ -3109,9 +3161,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, "Sets start directory for menu configuration browser.") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, - "设置按键延迟以掩盖网络延迟。用按键延迟换取在线游戏时降低 CPU 负载并减少顿卡。") + "设置按键延迟以掩盖网络延迟。\n" + "用按键延迟换取在线游戏时降低 CPU 负载\n" + "并减少顿卡。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, - "设置按键延迟范围以掩盖网络的延迟。用延迟范围内的按键延迟换取在线游戏时降低 CPU 负载并减少顿卡。") + "设置按键延迟范围以掩盖网络的延迟。\n" + "用一定的按键延迟换取在线游戏时\n" + "降低 CPU 负载并减少顿卡。") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_CYCLE_TRAY_STATUS, "Cycle the current disk. If the disk is inserted, it will eject the disk. If the disk has not been inserted, it will be inserted. ") MSG_HASH(MENU_ENUM_SUBLABEL_DISK_INDEX, @@ -3191,9 +3247,11 @@ MSG_HASH( "当菜单界面试图查找可加载的资源时,默认情况下查找此位置。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, - "将所有保存文件保存到该目录。如果没有设置,将尝试保存游戏内容文件的工作目录内。") + "将所有游戏存档保存到该目录。如果没有设置,\n" + "将尝试保存游戏内容文件的工作目录内。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, - "将所有存档保存到该目录。如果没有设置,将尝试保存游戏内容文件的工作目录内。") + "将所有即时存档保存到该目录。如果没有设置,\n" + "将尝试保存游戏内容文件的工作目录内。") MSG_HASH(MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, "Directory to dump screenshots to.") MSG_HASH(MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, @@ -3257,21 +3315,27 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INFORMATION, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, "Floating point value for video aspect ratio (width / height), used if the Aspect Ratio is set to 'Config'.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "如果宽高比设为「自定义」,将使用自定义的视窗高度。") + "如果宽高比设为「自定义」,将使用自定义的\n" + "视窗高度。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "如果宽高比设为「自定义」,将使用自定义的视窗宽度。") + "如果宽高比设为「自定义」,将使用自定义的\n" + "视窗宽度。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, - "视窗左上角的 X 坐标。如果「放大整数倍」选项已开启,则设置无效。图像将显示在中心。") + "视窗左上角的 X 坐标。如果「放大整数倍」选项\n" + "已开启,则设置无效。图像将显示在中心。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, - "视窗左上角的 Y 坐标。如果「放大整数倍」选项已开启,则设置无效。图像将显示在中心。") + "视窗左上角的 Y 坐标。如果「放大整数倍」选项\n" + "已开启,则设置无效。图像将显示在中心。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, "启用代理服务器") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, - "通过代理服务器进行网络连接。如果主机位于防火墙之后或具有NAT/UPnP问题时,建议开启。") + "通过代理服务器进行网络连接。如果主机位于\n" + "防火墙之后或具有NAT/UPnP问题时,建议开启。") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, "代理服务器位置") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, - "选择一个代理服务器。服务器位置比较接近的一般网络延迟更低。") + "选择一个代理服务器。服务器位置较近的\n" + "一般网络延迟更低。") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, "Add to mixer") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_PLAY, @@ -3281,14 +3345,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION, MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION_AND_PLAY, "Add to mixer and play") MSG_HASH(MENU_ENUM_LABEL_VALUE_FILTER_BY_CURRENT_CORE, - "Filter by current core") + "过滤当前核心支持文件") MSG_HASH( MSG_AUDIO_MIXER_VOLUME, "全局音效混合器音量" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_MIXER_VOLUME, - "全局音效混合器音量(单位:分贝)。 0 为正常音量。" + "全局音效混合器音量(单位:分贝)。\n" + "0 为正常音量。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, @@ -3319,8 +3384,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, "从磁盘中删除该核心") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, - "重命名此条目") -MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY, "重命名") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, "Framebuffer Opacity") @@ -3357,13 +3420,20 @@ MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, "密码不正确。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "启用设置页。修改启用设置页需要重新启动 RetroArch。") + "启用设置页。修改启用设置页需要\n" + "重新启动 RetroArch。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, - "设置在隐藏设置页后,重新启用设置页的密码。启用方法:在主菜单中选择「启用设置页」并输入密码来重新启用设置页。") + "设置在隐藏设置页后,重新启用设置页的密码。\n" + "启用方法:在主菜单中选择「启用设置页」\n" + "并输入密码来重新启用设置页。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, "允许在集合中重命名条目。") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, "允许重命名条目") +MSG_HASH( + MENU_ENUM_SUBLABEL_RENAME_ENTRY, + "重命名此条目。" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, "显示「加载核心」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE, @@ -3403,7 +3473,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT, "显示「截图」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT, - "显示或隐藏「截图」选项」。") + "显示或隐藏「截图」选项。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE, "显示「保存/即时读档」") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE, @@ -3461,11 +3531,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, "开启懒人模式") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, - "隐藏所有与配置文件相关的选项,以防止误改选项导致麻烦。") + "隐藏所有与配置文件相关的选项,\n" + "以防止误改选项导致麻烦。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, "设置退出懒人模式的密码") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, - "设置密码后,在主菜单选择「退出懒人模式」并输入密码才能退出懒人模式。") + "设置密码后,在主菜单选择「退出懒人模式」\n" + "并输入密码才能退出懒人模式。") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD, "请输入密码") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, @@ -3506,7 +3578,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, "Enable border filler thickness") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, "Enable background filler thickness") -MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "仅适用于 CRT 显示器。尽可能输出原汁原味的信号。") +MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, + "仅适用于 CRT 显示器。\n" + "尽可能输出原汁原味的信号。") MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, "CRT 原生输出") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, From 21e39c03897c42fd45cf58550093f1d8e588f0f4 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 11 Oct 2018 05:00:34 +0200 Subject: [PATCH 0327/1292] Cleanups --- managers/cheat_manager.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index d581e4790d..6fd50412b7 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -322,15 +322,14 @@ void cheat_manager_load_cb_second_pass(char *key, char *value) char cheat_num_str[20]; unsigned cheat_num; unsigned cheat_idx; - int idx = 0; - int key_length; + int idx = 5; + size_t key_length = 0; errno = 0; if (strncmp(key, "cheat", 5) != 0) return; - idx = 5; - key_length = strlen(key); + key_length = strlen((const char*)key); while (idx < key_length && key[idx] >= '0' && key[idx] <= '9' && idx < 24) { From 85c1de7d3a406d69b0647da18d978f64a813cd0d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Oct 2018 05:05:05 +0200 Subject: [PATCH 0328/1292] Cleanups --- gfx/drivers/gl.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 66f45482d5..0111500ad2 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1782,18 +1782,10 @@ static void *gl_init(const video_info_t *video, if (hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE) { - gfx_ctx_flags_t flags; - gl_query_core_context_set(true); gl->core_context_in_use = true; - /** - * Ensure that the rest of the frontend knows we have a core context - */ - flags.flags = 0; - BIT32_SET(flags.flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); - - video_context_driver_set_flags(&flags); + gl_set_core_context(hwr->context_type); RARCH_LOG("[GL]: Using Core GL context, setting up VAO...\n"); if (!gl_check_capability(GL_CAPS_VAO)) From 7059f2b64560c4c5fbc502d293d343dc2d89cd85 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Thu, 11 Oct 2018 18:48:36 +0800 Subject: [PATCH 0329/1292] Major update by @loverlf --- intl/msg_hash_chs.h | 1056 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 976 insertions(+), 80 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 0ffd2a46d1..70c2262068 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -426,7 +426,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD, - "加载金手指文件" + "加载金手指文件(覆盖)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD_APPEND, + "加载金手指文件(追加)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS, @@ -854,7 +858,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, "鼠标捕获开关") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, - "Game focus toggle") + "游戏焦点切换") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, "即时读档") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, @@ -887,6 +891,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, "上一个渲染器") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_HOLD_KEY, "慢动作") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_KEY, + "慢动作切换") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, "存档槽 -") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, @@ -1374,6 +1380,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, "Retro 成就") MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, "启用回溯") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_TOGGLE, + "切换后立即应用金手指") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_LOAD, + "游戏加载时自动应用金手指") MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, "回溯粒度") MSG_HASH( @@ -1751,9 +1761,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, "允许旋转") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, - "自动选择视窗比例") + "自动选择宽高比") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, - "视窗比例选项") + "宽高比选项") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, "黑色帧补间") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, @@ -1830,6 +1840,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, "保存渲染器预设为") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, "保存核心预设") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT, + "保存内容到预设的目录") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, "保存游戏预设") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT, @@ -1930,6 +1942,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY, "显示历史页") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD, "显示导入内容页") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS, + "显示列表标签页") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES, + "显示收藏页") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES, "显示图像页") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_MUSIC, @@ -1963,7 +1979,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, "在成绩列表中启用或禁用徽章显示。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, - "启用或禁用 OSD 成就情况显示。") + "启用或禁用屏显消息(OSD)显示成就获取情况。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, "当完成一个成就时,自动截图。") MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, @@ -2461,7 +2477,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_LATENCY, "如果设置太低,音频驱动程序可能并不支持,\n" "从而不会生效。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MUTE, - "禁音/取消禁音。") + "静音或取消静音。") MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, "有助于同步音频和视频。\n" @@ -2790,6 +2806,26 @@ MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, "启用回溯倒带功能。对游戏运行速度有一定影响。" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE, + "切换后立即应用金手指。" +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD, + "游戏加载时自动应用金手指。" +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_COUNT, + "The number of times the cheat will be applied. Use with the other two Iteration options to affect large areas of memory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_ADDRESS, + "After each 'Number of Iterations' the Memory Address will be increased by this number times the 'Memory Search Size'." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE, + "After each 'Number of Iterations' the Value will be increased by this amount." + ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, "每次回溯时回退的帧数。数值越高,回溯越快。" @@ -2804,7 +2840,99 @@ MSG_HASH( "每次增加或减少回溯缓冲区内存量值时,\n" "将按此大小改变。" ) - +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_IDX, + "列表中的索引位置。" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADDRESS_BIT_POSITION, + "Address bitmask when Memory Search Size < 8-bit." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_MATCH_IDX, + "Select the match to view." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_OR_CONT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_OR_RESTART, + "使用 左/右 按钮改变大小。" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EXACT, + "使用 左/右 按钮改变数值。" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LTE, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GTE, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQ, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_NEQ, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQPLUS, + "Left/Right to change value" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQMINUS, + "Left/Right to change value" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_MATCHES, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_VIEW_MATCHES, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_CREATE_OPTION, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DELETE_OPTION, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_TOP, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_BOTTOM, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DELETE_ALL, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_RELOAD_CHEATS, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_BIG_ENDIAN, + "大字节:258 = 0x0102,\n" + "小字节:258 = 0x0201" + ) MSG_HASH( MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, "Sets log level for cores. If a log level issued by a core is below this value, it is ignored." @@ -3120,6 +3248,10 @@ MSG_HASH( ) MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_REWIND, "调整游戏回溯功能设置。") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_DETAILS, + "管理金手指详细设置。") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_SEARCH, + "开始或继续金手指搜索。") MSG_HASH(MENU_ENUM_SUBLABEL_RESTART_CONTENT, "重新开始游戏。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, @@ -3154,12 +3286,12 @@ MSG_HASH( "Usually set by developers who bundle libretro/RetroArch apps to point to assets." ) MSG_HASH(MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPERS_DIRECTORY, - "Directory to store wallpapers dynamically loaded by the menu depending on context.") + "设置动态壁纸文件夹。根据上下文动态加载菜单的壁纸。") MSG_HASH(MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, - "Supplementary thumbnails (boxarts/misc. images, etc.) are stored here." + "设置缩略图文件夹。(boxarts/misc. images, etc.)" ) MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, - "Sets start directory for menu configuration browser.") + "设置菜单配置文件的启起始文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, "设置按键延迟以掩盖网络延迟。\n" "用按键延迟换取在线游戏时降低 CPU 负载\n" @@ -3177,7 +3309,10 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DISK_OPTIONS, MSG_HASH(MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND, "选择要插入的磁盘映像。") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE, - "Makes sure the framerate is capped while inside the menu.") + "确保菜单内的帧率上限。") +MSG_HASH(MENU_ENUM_SUBLABEL_VRR_RUNLOOP_ENABLE, + "保持核心请求数据不偏离时间,使用\n" + "G-Sync、FreeSync 动态刷新率屏幕技术。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_LAYOUT, "设置多种 XMB 界面布局。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_THEME, @@ -3191,9 +3326,12 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "设置多种颜色的渐变主题。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, - "选择背景动画效果。效果由 GPU 性能而定,如果性能不理想,请关闭此功能或选择简单特效。") + "选择背景动画效果。效果由 GPU 性能而定,如果\n" + "性能不理想,请关闭此功能或选择简单特效。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_FONT, "设置菜单中使用的自定义字体文件。") +MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES, + "在主菜单中显示收藏页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, "在主菜单中显示图像页。") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_MUSIC, @@ -3221,30 +3359,33 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_ENABLE, MSG_HASH(MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, "Set the custom scaling size here. NOTE: You have to enable 'DPI Override' for this scaling size to take effect.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, - "设置下载文件夹。下载的文件存放在这里。") + "保存下载文件的文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_REMAPPING_DIRECTORY, - "Save all remapped controls to this directory.") + "保存自定义键位文件的文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_LIBRETRO_DIR_PATH, - "Directory where the program searches for content/cores.") + "保存核心文件的文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_LIBRETRO_INFO_PATH, - "Application/core information files are stored here.") + "保存核心信息文件的文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_JOYPAD_AUTOCONFIG_DIR, - "If a joypad is plugged in, that joypad will be autoconfigured if a config file corresponding to it is present inside this directory.") + "如果插入的游戏手柄与该目录中的配置文件匹配,\n" + "这个游戏手柄将自动完成配置。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_DIRECTORY, - "Save all collections to this directory.") + "保存游戏列表文件的文件夹。") MSG_HASH( MENU_ENUM_SUBLABEL_CACHE_DIRECTORY, - "If set to a directory, content which is temporarily extracted (e.g. from archives) will be extracted to this directory." + "如果设置为目录,临时提取的内容(例如从档案中)\n" + "将被临时提取到该目录。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_DIRECTORY, - "Saved queries are stored to this directory.") + "保存指针文件的文件夹。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_DATABASE_DIRECTORY, - "Databases are stored to this directory." + "保存游戏内容数据库文件的文件夹。" ) MSG_HASH( MENU_ENUM_SUBLABEL_ASSETS_DIRECTORY, - "当菜单界面试图查找可加载的资源时,默认情况下查找此位置。" + "当菜单界面试图查找可加载的资源时,\n" + "默认情况下查找此位置。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, "将所有游戏存档保存到该目录。如果没有设置,\n" @@ -3253,12 +3394,12 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, "将所有即时存档保存到该目录。如果没有设置,\n" "将尝试保存游戏内容文件的工作目录内。") MSG_HASH(MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, - "Directory to dump screenshots to.") + "保存屏幕截图文件的文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, - "Defines a directory where overlays are kept for easy access.") + "保存图层文件的文件夹。") MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH, - "Cheat files are kept here." + "保存金手指文件的文件夹。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR, @@ -3266,60 +3407,69 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR, - "Directory where CPU-based video filter files are kept." + "设置视频滤镜文件的文件夹。" ) MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_DIR, - "Defines a directory where GPU-based video shader files are kept for easy access.") + "设置视频渲染器文件的文件夹。") MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_OUTPUT_DIRECTORY, "Recordings will be dumped to this directory.") MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_CONFIG_DIRECTORY, "Recording configurations will be kept here.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_PATH, - "Select a different font for onscreen notifications.") + "为屏显消息设置不同的字体。") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_APPLY_CHANGES, - "Changes to the shader configuration will take effect immediately. Use this if you changed the amount of shader passes, filtering, FBO scale, etc.") + "对渲染器配置的更改将立即生效。\n" + "建议调试渲染器各项属性的用户开启此项。") MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SHADER_NUM_PASSES, - "Increase or decrease the amount of shader pipeline passes. You can bind a separate shader to each pipeline pass and configure its scale and filtering." + "增加或减少渲染器通道数量。\n" + "每个通道都能单独配置所用的渲染器属性。" ) MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET, - "Load a shader preset. The shader pipeline will be automatically set-up.") + "通过加载一个预设渲染器配置文件来自动设置。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, - "Save the current shader settings as a new shader preset.") + "将当前渲染器设置保存为新的渲染器预设文件。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE, - "Save the current shader settings as the default settings for this application/core.") + "将当前渲染器设置保存为当前内核的默认设置。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME, - "Save the current shader settings as the default settings for the content.") + "将当前渲染器设置保存为当前游戏内容的默认设置。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS, - "Modifies the current shader directly. Changes will not be saved to the preset file.") + "直接修改当前渲染器,更改不会保存到预设文件中。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_PARAMETERS, - "Modifies the shader preset itself currently used in the menu.") + "修改当前在菜单中使用的渲染器预设文件.") MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_NUM_PASSES, - "Increase or decrease the amount of cheats." + "增加或减少金手指数量。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES, - "Cheat changes will take effect immediately.") + "立即生效金手指修改。") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_START_SEARCH, + "开始搜索新的金手指。数据类型(bit 数)可以改变。") +MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_CONTINUE_SEARCH, + "继续搜索新一个金手指。") MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD, - "Load a cheat file." + "加载一个金手指文件并替换当前作弊代码。" ) +MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD_APPEND, + "加载一个金手指文件并附加到当前作弊代码") MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_FILE_SAVE_AS, - "Save current cheats as a save file." + "把当前的作弊代码保存成一个金手指文件。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, "快速配置游戏内设置。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_INFORMATION, "查看应用、内核的相关的信息。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, - "Floating point value for video aspect ratio (width / height), used if the Aspect Ratio is set to 'Config'.") + "如果宽高比设为「依照设置」,\n" + "将使用此数值作为宽高比。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "如果宽高比设为「自定义」,将使用自定义的\n" - "视窗高度。") + "如果宽高比设为「自定义」,\n" + "将使用自定义的视窗高度。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "如果宽高比设为「自定义」,将使用自定义的\n" - "视窗宽度。") + "如果宽高比设为「自定义」,\n" + "将使用自定义的视窗宽度。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, "视窗左上角的 X 坐标。如果「放大整数倍」选项\n" "已开启,则设置无效。图像将显示在中心。") @@ -3365,7 +3515,7 @@ MSG_HASH( ) MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, "开启/关闭音效混合器。") -MSG_HASH(MENU_ENUM_LABEL_MENU_SHOW_ONLINE_UPDATER, +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, "显示「在线更新器」") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, "显示或隐藏「在线更新器」的选项。") @@ -3386,9 +3536,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, "重命名") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, - "Framebuffer Opacity") + "帧缓冲区不透明度") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, - "Modify the opacity of the framebuffer.") + "修改帧缓冲区的不透明度。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, "收藏夹") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_FAVORITES, @@ -3523,7 +3673,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE, "屏显消息(OSD)背景RGB颜色 蓝色") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY, - "屏显消息(OSD)背景透明度") + "屏显消息(OSD)背景不透明度") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, "关闭懒人模式") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, @@ -3565,13 +3715,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, "Watch shader files for changes") MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, - "Auto-apply changes made to shader files on disk.") + "自动对磁盘上的渲染器文件进行更改。") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, "显示视窗装饰") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, - "Display Statistics") + "显示参数信息") MSG_HASH(MENU_ENUM_SUBLABEL_STATISTICS_SHOW, - "Show onscreen technical statistics.") + "游戏运行时在显示器上显示相关技术参数信息。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_ENABLE, "Enable border filler") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, @@ -3612,35 +3762,37 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, "关于独立配置的选项。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, - "Will start playback of the audio stream. Once finished, it will remove the current audio stream from memory.") + "开始播放音频流。完成后将其从完全内存中删除。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, - "Will start playback of the audio stream. Once finished, it will loop and play the track again from the beginning.") + "开始播放音频流,完成后再次循环播放此音频流。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, - "Will start playback of the audio stream. Once finished, it will jump to the next audio stream in sequential order and repeat this behavior. Useful as an album playback mode.") + "开始播放音频流,完成后跳转到下一个音频流,\n" + "并重复这种行为。用于循环播放模式。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, - "This will stop playback of the audio stream, but not remove it from memory. You can start playing it again by selecting 'Play'.") + "这将停止播放音频流,但不将其从内存中删除。\n" + "你可以通过选择「播放」来开始播放。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, - "This will stop playback of the audio stream and remove it entirely from memory.") + "这将停止播放音频流,并将其完全从内存中删除。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, - "Adjust the volume of the audio stream.") + "调整音频流的音量。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER, "Add this audio track to an available audio stream slot. If no slots are currently available, it will be ignored.") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, "Add this audio track to an available audio stream slot and play it. If no slots are currently available, it will be ignored.") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, - "Play") + "播放") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, - "Play (Looped)") + "循环播放") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL, - "Play (Sequential)") + "顺序播放") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, - "Stop") + "暂停") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, - "Remove") + "停止") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, "音量") MSG_HASH(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, - "Current core") + "当前核心") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_SEARCH_CLEAR, "清除") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, @@ -3674,12 +3826,756 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, MSG_HASH(MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, "更改电源管理设置。") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, - "Sustained Performance Mode") + "保持性能模式") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MPV_SUPPORT, - "mpv support") + "MPV 支持") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_IDX, + "索引" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MATCH_IDX, + "View Match #" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MATCH, + "匹配地址: %08X 掩码: %02X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_MATCH, + "创建匹配代码" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_MATCH, + "删除匹配" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_BROWSE_MEMORY, + "浏览地址:%08X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DESC, + "描述" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_STATE, + "激活" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CODE, + "代码" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_HANDLER, + "处理程序" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MEMORY_SEARCH_SIZE, + "Memory Search Size" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_TYPE, + "Type" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_VALUE, + "Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS, + "Memory Address" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS_BIT_POSITION, + "Memory Address Mask" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_TYPE, + "Rumble When Memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_VALUE, + "Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PORT, + "Rumble Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_STRENGTH, + "Rumble Primary Strength" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_DURATION, + "Rumble Primary Duration (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_STRENGTH, + "Rumble Secondary Strength" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_DURATION, + "Rumble Secondary Duration (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_COUNT, + "Number of Iterations" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_VALUE, + "Value Increase Each Iteration" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_ADDRESS, + "Address Increase Each Iteration" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_AFTER, + "在当前之后添加新的金手指" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BEFORE, + "在当前之前添加新的金手指" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_AFTER, + "复制当前金手指之后" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_BEFORE, + "复制当前金手指之前" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE, + "删除当前金手指" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_EMU, + "模拟器" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_RETRO, + "RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_DISABLED, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_SET_TO_VALUE, + "Set To Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_INCREASE_VALUE, + "Increase By Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_DECREASE_VALUE, + "Decrease By Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_EQ, + "Run next cheat if value = memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_NEQ, + "Run next cheat if value != memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_LT, + "Run next cheat if value < memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_GT, + "Run next cheat if value > memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_CHANGES, + "Changes" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DOES_NOT_CHANGE, + "Does Not Change" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE, + "Increases" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE, + "Decreases" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_EQ_VALUE, + "= Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_NEQ_VALUE, + "!= Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_LT_VALUE, + "< Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_GT_VALUE, + "> Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE_BY_VALUE, + "Increases by Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE_BY_VALUE, + "Decreases by Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_1, + "1-bit, max value = 0x01" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_2, + "2-bit, max value = 0x03" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_4, + "4-bit, max value = 0x0F" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_8, + "8-bit, max value = 0xFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_16, + "16-bit, max value = 0xFFFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_32, + "32-bit, max value = 0xFFFFFFFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_0, + "1" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_1, + "2" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_2, + "3" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_3, + "4" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_4, + "5" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_5, + "6" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_6, + "7" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_7, + "8" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_8, + "9" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_9, + "10" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_10, + "11" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_11, + "12" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_12, + "13" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_13, + "14" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_14, + "15" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_15, + "16" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_16, + "All" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_CONT, + "开始或继续金手指搜索" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_RESTART, + "开始或重新金手指搜索" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EXACT, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LT, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GT, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQ, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GTE, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LTE, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_NEQ, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQPLUS, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQMINUS, + "搜索内存值" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES, + "将 %u 个匹配添加到列表中" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_VIEW_MATCHES, + "查看匹配的 %u 个列表" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CREATE_OPTION, + "从这个匹配中创建代码" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_OPTION, + "删除此匹配项" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_TOP, + "向顶部添加新代码" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BOTTOM, + "向底部添加新代码" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_ALL, + "删除所有代码" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RELOAD_CHEATS, + "重装加载特定游戏金手指文件" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL, + "等于 %u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL, + "小于之前" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL, + "大于之前" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL, + "小于或等于之前" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL, + "大于或等于之前" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL, + "等于之前" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL, + "不等于之前" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL, + "等于之前 + %u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL, + "等于之前 - %u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_SETTINGS, + "开始或继续金手指搜索" + ) +MSG_HASH( + MSG_CHEAT_INIT_SUCCESS, + "Successfully started cheat search" + ) +MSG_HASH( + MSG_CHEAT_INIT_FAIL, + "Failed to start cheat search" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_NOT_INITIALIZED, + "Searching has not been initialized/started" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_FOUND_MATCHES, + "New match count = %u" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_BIG_ENDIAN, + "大字节" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS, + "Added %u matches" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL, + "Failed to add matches" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS, + "Created code from match" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADD_MATCH_FAIL, + "Failed to create code" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS, + "Deleted match" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY, + "Not enough room. The total number of cheats you can have is 100." + ) +MSG_HASH( + MSG_CHEAT_ADD_TOP_SUCCESS, + "New cheat added to top of list." + ) +MSG_HASH( + MSG_CHEAT_ADD_BOTTOM_SUCCESS, + "New cheat added to bottom of list." + ) +MSG_HASH( + MSG_CHEAT_DELETE_ALL_INSTRUCTIONS, + "Press right five times to delete all cheats." + ) +MSG_HASH( + MSG_CHEAT_DELETE_ALL_SUCCESS, + "All cheats deleted." + ) +MSG_HASH( + MSG_CHEAT_ADD_BEFORE_SUCCESS, + "New cheat added before this one." + ) +MSG_HASH( + MSG_CHEAT_ADD_AFTER_SUCCESS, + "New cheat added after this one." + ) +MSG_HASH( + MSG_CHEAT_COPY_BEFORE_SUCCESS, + "Cheat copied before this one." + ) +MSG_HASH( + MSG_CHEAT_COPY_AFTER_SUCCESS, + "Cheat copied after this one." + ) +MSG_HASH( + MSG_CHEAT_DELETE_SUCCESS, + "Cheat deleted." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PROGRESS, + "Progress:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_LIST_MAX_COUNT, + "\"All Playlists\" max list entries:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_GRID_MAX_COUNT, + "\"All Playlists\" max grid entries:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SHOW_HIDDEN_FILES, + "Show hidden files and folders:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_NEW_PLAYLIST, + "New Playlist" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ENTER_NEW_PLAYLIST_NAME, + "Please enter the new playlist name:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DELETE_PLAYLIST, + "Delete Playlist" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RENAME_PLAYLIST, + "Rename Playlist" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST, + "Are you sure you want to delete the playlist \"%1\"?" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_QUESTION, + "Question" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_DELETE_FILE, + "Could not delete file." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE, + "Could not rename file." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_GATHERING_LIST_OF_FILES, + "Gathering list of files..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADDING_FILES_TO_PLAYLIST, + "Adding files to playlist..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY, + "Playlist Entry" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_NAME, + "Name:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH, + "Path:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_CORE, + "Core:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_DATABASE, + "Database:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS, + "Extensions:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS_PLACEHOLDER, + "(space-separated; includes all by default)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_FILTER_INSIDE_ARCHIVES, + "Filter inside archives" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS, + "(used to find thumbnails)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM, + "Are you sure you want to delete the item \"%1\"?" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, + "Please choose a single playlist first." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DELETE, + "Delete" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY, + "Add Entry..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_FILES, + "Add File(s)..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER, + "Add Folder..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_EDIT, + "Edit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_FILES, + "Select Files" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER, + "Select Folder" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY, + "Error updating playlist entry." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS, + "Please fill out all required fields." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_NIGHTLY, + "Update RetroArch (nightly)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FINISHED, + "RetroArch updated successfully. Please restart the application for the changes to take effect." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FAILED, + "Update failed." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT_CONTRIBUTORS, + "Contributors" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CURRENT_SHADER, + "Current shader" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MOVE_DOWN, + "Move Down" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MOVE_UP, + "Move Up" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOAD, + "Load" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SAVE, + "Save" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_REMOVE, + "Remove" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_APPLY, + "Apply" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_ADD_PASS, + "Add Pass" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES, + "Clear All Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_NO_PASSES, + "No shader passes." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_PASS, + "Reset Pass" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_ALL_PASSES, + "Reset All Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_PARAMETER, + "Reset Parameter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_THUMBNAIL, + "Download thumbnail" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALREADY_IN_PROGRESS, + "A download is already in progress." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST, + "Start on playlist:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS, + "Download All Thumbnails" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_ENTIRE_SYSTEM, + "Entire System" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_THIS_PLAYLIST, + "This Playlist" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_PACK_DOWNLOADED_SUCCESSFULLY, + "Thumbnails downloaded successfully." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_PLAYLIST_THUMBNAIL_PROGRESS, + "Succeeded: %1 Failed: %2" + ) +MSG_HASH( + MSG_DEVICE_CONFIGURED_IN_PORT, + "Configured in port:" + ) +MSG_HASH( + MSG_FAILED_TO_SET_DISK, + "Failed to set disk" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_OPTIONS, + "Core Options" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ADAPTIVE_VSYNC, - "Adaptive Vsync" + "自适应 Vsync 同步" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, @@ -3699,7 +4595,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, - "X-Axis Centering" + "X 轴居中" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, @@ -3709,7 +4605,7 @@ MSG_HASH( "使用自定义刷新率") MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Select the output port connected to the CRT display.") + "选择连接到CRT显示器的输出端口。") MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, "Output Display ID") @@ -3731,43 +4627,43 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, - "Start Streaming" + "开始直播" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_STREAMING, - "Starts streaming." + "开始直播串流传输。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, - "Stop Streaming" + "停止直播" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, - "Stops streaming." + "停止直播串流传输。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_RECORDING_TOGGLE, - "Recording toggle" + "录制开关" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, - "Streaming toggle" + "直播开关" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, - "Record Quality" + "录制质量" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, - "Stream Quality" + "直播质量" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_STREAMING_URL, - "Streaming URL" + "直播 URL" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, - "UDP Stream Port" + "直播 UDP 端口" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, @@ -3784,7 +4680,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, - "Title of Stream") + "直播标题") MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, "拆下 Joy-Con 手柄" From 7d0b041bfaee04ee405c08acb75d8269cf9b4778 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Thu, 11 Oct 2018 18:52:26 +0800 Subject: [PATCH 0330/1292] Fix duplicate line --- intl/msg_hash_chs.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 70c2262068..29055f0d28 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -177,7 +177,7 @@ MSG_HASH( "对不起,未实现:核心未请求内容,无法加入联机游戏。" ) MSG_HASH( -MSG_FAILED_TO_SET_DISK, + MSG_FAILED_TO_SET_DISK, "设置磁盘失败") MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_PASSWORD, @@ -4565,10 +4565,6 @@ MSG_HASH( MSG_DEVICE_CONFIGURED_IN_PORT, "Configured in port:" ) -MSG_HASH( - MSG_FAILED_TO_SET_DISK, - "Failed to set disk" - ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_CORE_OPTIONS, "Core Options" From 8509132ebd26690909b4e9daf38a0ff6c190ae53 Mon Sep 17 00:00:00 2001 From: LamboLighting Date: Fri, 12 Oct 2018 01:22:33 +0300 Subject: [PATCH 0331/1292] (Language) Greek translation of RetroArch First steps of the translation. Still a WIP. Most of the menu labels have been translated. Lots of sublabels still need translation. --- Makefile.common | 3 +- griffin/griffin.c | 1 + intl/msg_hash_el.c | 2256 ++++++++ intl/msg_hash_el.h | 7677 ++++++++++++++++++++++++++++ intl/msg_hash_us.h | 4 + libretro-common/include/libretro.h | 1 + menu/menu_setting.c | 2 +- msg_hash.c | 6 + msg_hash.h | 4 + 9 files changed, 9952 insertions(+), 2 deletions(-) create mode 100644 intl/msg_hash_el.c create mode 100644 intl/msg_hash_el.h diff --git a/Makefile.common b/Makefile.common index bc1ea2b9f9..a9be11ef4e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -308,7 +308,8 @@ OBJ += intl/msg_hash_de.o \ intl/msg_hash_vn.o \ intl/msg_hash_chs.o \ intl/msg_hash_cht.o \ - intl/msg_hash_ar.o + intl/msg_hash_ar.o \ + intl/msg_hash_el.o endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 30d8c7718a..d1be92b996 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1035,6 +1035,7 @@ RETROARCH #include "../intl/msg_hash_chs.c" #include "../intl/msg_hash_cht.c" #include "../intl/msg_hash_ar.c" +#include "../intl/msg_hash_el.c" #endif #include "../intl/msg_hash_us.c" diff --git a/intl/msg_hash_el.c b/intl/msg_hash_el.c new file mode 100644 index 0000000000..fe0dd74863 --- /dev/null +++ b/intl/msg_hash_el.c @@ -0,0 +1,2256 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2017 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include + +#include +#include + +#include "../msg_hash.h" +#include "../verbosity.h" + +#ifdef RARCH_INTERNAL +#include "../configuration.h" + +int menu_hash_get_help_el_enum(enum msg_hash_enums msg, char *s, size_t len) +{ + settings_t *settings = config_get_ptr(); + + if (msg == MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM) + { + snprintf(s, len, + "TODO/FIXME - Fill in message here." + ); + return 0; + } + if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && + msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN) + { + unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN; + + switch (idx) + { + case RARCH_FAST_FORWARD_KEY: + snprintf(s, len, + "Αλλαγή ανάμεσα σε γρήγορη και \n" + "κανονική ταχύτητα." + ); + break; + case RARCH_FAST_FORWARD_HOLD_KEY: + snprintf(s, len, + "Κρατήστε πατημένο για γρήγορη ταχύτητα. \n" + " \n" + "Αφήνοντας το κουμπί απενεργοποιείται η γρήγορη ταχύτητα." + ); + break; + case RARCH_SLOWMOTION_KEY: + snprintf(s, len, + "Αλλάζει την αργή ταχύτητα."); + break; + case RARCH_SLOWMOTION_HOLD_KEY: + snprintf(s, len, + "Κρατήστε για αρχή ταχύτητα."); + break; + case RARCH_PAUSE_TOGGLE: + snprintf(s, len, + "Αλλαγή ανάμεσα σε κατάσταση παύσης και μη παύσης."); + break; + case RARCH_FRAMEADVANCE: + snprintf(s, len, + "Προπόρευση καρέ κατά την παύση περιεχομένου."); + break; + case RARCH_SHADER_NEXT: + snprintf(s, len, + "Εφαρμόζει την επόμενη σκίαση στο ευρετήριο."); + break; + case RARCH_SHADER_PREV: + snprintf(s, len, + "Εφαρμόζει την προηγούμενη σκίαση στο ευρετήριο."); + break; + case RARCH_CHEAT_INDEX_PLUS: + case RARCH_CHEAT_INDEX_MINUS: + case RARCH_CHEAT_TOGGLE: + snprintf(s, len, + "Κωδικοί."); + break; + case RARCH_RESET: + snprintf(s, len, + "Επαναφορά του περιεχομένου."); + break; + case RARCH_SCREENSHOT: + snprintf(s, len, + "Λήψη στιγμιοτύπου."); + break; + case RARCH_MUTE: + snprintf(s, len, + "Σίγαση/κατάργηση σίγασης ήχου."); + break; + case RARCH_OSK: + snprintf(s, len, + "Ενεργοποιεί το πληκτρολόγιο οθόνης."); + break; + case RARCH_NETPLAY_GAME_WATCH: + snprintf(s, len, + "Εναλλαγή λειτουργίας παιχνιδιού/παρακολούθησης Netplay."); + break; + case RARCH_ENABLE_HOTKEY: + snprintf(s, len, + "Ενεργοποίηση άλλων πλήκτρων εντολών. \n" + " \n" + "Εάν αυτό το πλήκτρο είναι συνδεδεμένο είτε με\n" + "ένα πληκτρολόγιο ή κάποιο κουμπί χειριστιερίου, \n" + "όλα τα υπόλοιπα κουμπιά εντολών θα ενεργοποιηθούν μόνο \n" + "εάν και αυτό είναι πατημένο την ίδια στιγμή. \n" + " \n" + "Διαφορετικά, όλα τα κουμπιά εντολών πληκτρολογίου \n" + "μπορούν να απενεργοποιηθούν από τον χρήστη."); + break; + case RARCH_VOLUME_UP: + snprintf(s, len, + "Αυξάνει την ένταση του ήχου."); + break; + case RARCH_VOLUME_DOWN: + snprintf(s, len, + "Μειώνει την ένταση του ήχου."); + break; + case RARCH_OVERLAY_NEXT: + snprintf(s, len, + "Αλλάζει στο επόμενο επικάλλυμα. Επαναφέρεται."); + break; + case RARCH_DISK_EJECT_TOGGLE: + snprintf(s, len, + "Ενεργοποιεί την αφαίρεση δίσκων. \n" + " \n" + "Χρησιμοποιείται για περιεχόμενο με πολλούς δίσκους. "); + break; + case RARCH_DISK_NEXT: + case RARCH_DISK_PREV: + snprintf(s, len, + "Αλλάζει ανάμεσα σε εικόνες δίσκων. Χρησιμοποιείστε μετά την εξαγωγή. \n" + " \n" + "Ολοκληρώστε πατώντας εξαγωγή ξανά."); + break; + case RARCH_GRAB_MOUSE_TOGGLE: + snprintf(s, len, + "Ενεργοποίηση ελέγχου ποντικιού. \n" + " \n" + "Όταν το ποντίκι ελέγχεται, το RetroArch κρύβει το \n" + "ποντίκι, και κρατάει τον δρομέα μέσα στο \n" + "παράθυρο για να επιτρέψει την σχετική εισαγωγή \n" + "ώστε να λειτουργήσει καλύτερα."); + break; + case RARCH_GAME_FOCUS_TOGGLE: + snprintf(s, len, + "Ενεργοποίηση εστίασης παιχνιδιού.\n" + " \n" + "Όταν ένα παιχνίδι έχει την εστίαση, το RetroArch θα απενεργοποιήσει \n" + "τα κουμπιά εντολών και θα κρατήσει τον δρομέα του ποντικιού μέσα στο παράθυρο."); + break; + case RARCH_MENU_TOGGLE: + snprintf(s, len, "Ενεργοποιεί το μενού."); + break; + case RARCH_LOAD_STATE_KEY: + snprintf(s, len, + "Φορτώνει κατάσταση."); + break; + case RARCH_FULLSCREEN_TOGGLE_KEY: + snprintf(s, len, + "Ενεργοποιεί την πλήρη οθόνη."); + break; + case RARCH_QUIT_KEY: + snprintf(s, len, + "Κουμπί καθαρής εξόδου από το RetroArch. \n" + " \n" + "Η απότομη απενεργοποίηση της λειτουργίας του θα \n" + "τερματίσει το RetroArch χωρίς να αποθηκεύσει την RAM κ.α." +#ifdef __unix__ + "\nΣε Unix-likes, SIGINT/SIGTERM επιτρέπουν την \n" + "καθαρή απενεργοποίηση." +#endif + ""); + break; + case RARCH_STATE_SLOT_PLUS: + case RARCH_STATE_SLOT_MINUS: + snprintf(s, len, + "Θυρίδες κατάστασης. \n" + " \n" + "Με την θυρίδα τοποθετημένη στο 0, το όνομα της αποθηκευμένης κατάστασης είναι \n" + "*.state (ή οτιδήποτε έχει καθοριστεί στην γραμμή εντολών). \n" + " \n" + "Όταν η θυρίδα δεν είναι 0, η διαδρομή θα είναι <διαδρομή>, \n" + "όπου είναι ο αριθμός θυρίδας."); + break; + case RARCH_SAVE_STATE_KEY: + snprintf(s, len, + "Αποθηκεύει την κατάσταση."); + break; + case RARCH_REWIND: + snprintf(s, len, + "Κρατήστε το κουμπί για επιστροφή προς τα πίσω. \n" + " \n" + "Η επιστροφή προς τα πίσω πρέπει να είναι ενεργοποιημένη."); + break; + case RARCH_BSV_RECORD_TOGGLE: + snprintf(s, len, + "Αλλαγή ανάμεσα σε εγγραφή ή όχι."); + break; + default: + if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + break; + } + + return 0; + } + + switch (msg) + { + case MENU_ENUM_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS: + snprintf(s, len, "Στοιχεία σύνδεσης για τον \n" + "λογαριασμό Retro Achievements. \n" + " \n" + "Επισκεφθείτε το retroachievements.org και εγγραφείτε \n" + "για δωρεάν λογαριασμό. \n" + " \n" + "Μετά την ολοκλήρωση της εγγραφής, πρέπει να \n" + "εισάγετε το όνομα χρήστη και τον κωδικό στο \n" + "RetroArch."); + break; + case MENU_ENUM_LABEL_CHEEVOS_USERNAME: + snprintf(s, len, "Όνομα χρήστη για τον λογαριασμό σας στο Retro Achievements."); + break; + case MENU_ENUM_LABEL_CHEEVOS_PASSWORD: + snprintf(s, len, "Κωδικός για τον λογαριασμό σας στο Retro Achievements."); + break; + case MENU_ENUM_LABEL_USER_LANGUAGE: + snprintf(s, len, "Τοπικοποίηση του μενού και όλων των μηνυμάτων \n" + "ανάλογα με την γλώσσα που έχετε επιλέξει \n" + "εδώ. \n" + " \n" + "Χρειάζεται επανεκκίνηση για να ενεργοποιηθούν \n" + "οι αλλαγές. \n" + " \n" + "Σημείωση: πιθανόν να μην έχουν εφαρμοστεί \n" + "όλες οι γλώσσες. \n" + " \n" + "Σε περίπτωση που μία γλώσσα δεν έχει εφαρμοστεί, \n" + "χρησιμοποιούμε τα Αγγλικά."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_PATH: + snprintf(s, len, "Αλλαγή της γραμματοσειράς που χρησιμοποιείται \n" + "για το κείμενο της Οθόνης Απεικόνισης."); + break; + case MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS: + snprintf(s, len, "Αυτόματη φόρτωση επιλογών πυρήνα βάση περιεχομένου."); + break; + case MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE: + snprintf(s, len, "Αυτόματη φόρτωση ρυθμίσεων παράκαμψης."); + break; + case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE: + snprintf(s, len, "Αυτόματη φόρτωση αρχείων αναδιοργάνωσης πλήκτρων."); + break; + case MENU_ENUM_LABEL_SORT_SAVESTATES_ENABLE: + snprintf(s, len, "Οργάνωση καταστάσεων αποθήκευσης σε φακέλους \n" + "ονομασμένες με βάση τον πυρήνα libretro που χρησιμοποιούν."); + break; + case MENU_ENUM_LABEL_SORT_SAVEFILES_ENABLE: + snprintf(s, len, "Οργάνωση αρχείων αποθήκευσης σε φακέλους \n" + "ονομασμένα με βάση τον πυρήνα libretro που χρησιμοποιούν."); + break; + case MENU_ENUM_LABEL_RESUME_CONTENT: + snprintf(s, len, "Έξοδος από το μενού και επιστροφή \n" + "στο περιεχόμενο."); + break; + case MENU_ENUM_LABEL_RESTART_CONTENT: + snprintf(s, len, "Επανεκκινεί το περιεχόμενο από την αρχή."); + break; + case MENU_ENUM_LABEL_CLOSE_CONTENT: + snprintf(s, len, "Κλείνει το περιεχόμενο και το αποφορτώνει από την \n" + "μνήμη."); + break; + case MENU_ENUM_LABEL_UNDO_LOAD_STATE: + snprintf(s, len, "Εάν μία κατάσταση φορτώθηκε, το περιεχόμενο \n" + "θα επανέλθει στην κατάσταση πριν την φόρτωση."); + break; + case MENU_ENUM_LABEL_UNDO_SAVE_STATE: + snprintf(s, len, "Εάν μία κατάσταση αντικαταστάθηκε, θα \n" + "επανέλθει στην προηγούμενη κατάσταση αποθήκευσης."); + break; + case MENU_ENUM_LABEL_TAKE_SCREENSHOT: + snprintf(s, len, "Δημιουργία στιγμιοτύπου. \n" + " \n" + "Το στιγμιότυπο θα αποθηκευθεί στην \n" + "Διαδρομή Στιγμιοτύπων."); + break; + case MENU_ENUM_LABEL_ADD_TO_FAVORITES: + snprintf(s, len, "Προσθήκη της καταχώρισης στα Αγαπημένα."); + break; + case MENU_ENUM_LABEL_RUN: + snprintf(s, len, "Έναρξη περιεχομένου."); + break; + case MENU_ENUM_LABEL_INFORMATION: + snprintf(s, len, "Προβολή περισσότερων μεταδεδομένων πληροφοριών \n" + "σχετικά με το περιεχόμενο."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CONFIG: + snprintf(s, len, "Αρχείο Διαμόρφωσης."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_COMPRESSED_ARCHIVE: + snprintf(s, len, "Συμπιεσμένο αρχείο."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_RECORD_CONFIG: + snprintf(s, len, "Αρχείο διαμόρφωσης καταγραφών."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CURSOR: + snprintf(s, len, "Αρχείο ερωτήματος βάσης δεδομένων."); + break; + case MENU_ENUM_LABEL_FILE_CONFIG: + snprintf(s, len, "Αρχείο Διαμόρφωσης."); + break; + case MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY: + snprintf(s, len, + "Επέλεξε αυτό για να ανιχνεύσεις περιεχόμενο στην \n" + "τρέχουσα διαδρομή."); + break; + case MENU_ENUM_LABEL_USE_THIS_DIRECTORY: + snprintf(s, len, + "Επέλεξε αυτό για να ορίσεις αυτήν ως την διαδρομή."); + break; + case MENU_ENUM_LABEL_CONTENT_DATABASE_DIRECTORY: + snprintf(s, len, + "Ευρετήριο Βάσης Δεδομένων Περιεχομένου. \n" + " \n" + "Διαδρομή για το ευρετήριο της βάσης δεδομένων \n" + "περιεχομένου."); + break; + case MENU_ENUM_LABEL_THUMBNAILS_DIRECTORY: + snprintf(s, len, + "Ευρετήριο Μικρογραφιών. \n" + " \n" + "Για την αποθήκευση αρχείων μικρογραφιών."); + break; + case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: + snprintf(s, len, + "Ευρετήριο Πληροφοριών Πυρήνων. \n" + " \n" + "Ένα ευρετήριο για το που να ψάξεις \n" + "για πληφοροφίες των πυρήνων libretro."); + break; + case MENU_ENUM_LABEL_PLAYLIST_DIRECTORY: + snprintf(s, len, + "Ευρετήριο Λιστών Αναπαραγωγής. \n" + " \n" + "Αποθηκέυστε όλα τα αρχεία λιστών αναπαραγωγής \n" + "σε αυτό το ευρετήριο."); + break; + case MENU_ENUM_LABEL_DUMMY_ON_CORE_SHUTDOWN: + snprintf(s, len, + "Μερικοί πυρήνες μπορεί να έχουν \n" + "λειτουργία απενεργοποίησης. \n" + " \n" + "If this option is left disabled, \n" + "selecting the shutdown procedure \n" + "would trigger RetroArch being shut \n" + "down. \n" + " \n" + "Enabling this option will load a \n" + "dummy core instead so that we remain \n" + "inside the menu and RetroArch won't \n" + "shutdown."); + break; + case MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE: + snprintf(s, len, + "Some cores might need \n" + "firmware or bios files. \n" + " \n" + "If this option is disabled, \n" + "it will try to load even if such \n" + "firmware is missing. \n"); + break; + case MENU_ENUM_LABEL_PARENT_DIRECTORY: + snprintf(s, len, + "Go back to the parent directory."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_SHADER_PRESET: + snprintf(s, len, + "Shader preset file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_SHADER: + snprintf(s, len, + "Shader file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_REMAP: + snprintf(s, len, + "Remap controls file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CHEAT: + snprintf(s, len, + "Cheat file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_OVERLAY: + snprintf(s, len, + "Overlay file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_RDB: + snprintf(s, len, + "Database file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_FONT: + snprintf(s, len, + "TrueType font file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_PLAIN_FILE: + snprintf(s, len, + "Plain file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_MOVIE_OPEN: + snprintf(s, len, + "Video. \n" + " \n" + "Select it to open this file with the \n" + "video player."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_MUSIC_OPEN: + snprintf(s, len, + "Music. \n" + " \n" + "Select it to open this file with the \n" + "music player."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE: + snprintf(s, len, + "Image file."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_IMAGE_OPEN_WITH_VIEWER: + snprintf(s, len, + "Image. \n" + " \n" + "Select it to open this file with the \n" + "image viewer."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION: + snprintf(s, len, + "Libretro core. \n" + " \n" + "Selecting this will associate this core \n" + "to the game."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_CORE: + snprintf(s, len, + "Libretro core. \n" + " \n" + "Select this file to have RetroArch load this core."); + break; + case MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY: + snprintf(s, len, + "Directory. \n" + " \n" + "Select it to open this directory."); + break; + case MENU_ENUM_LABEL_CACHE_DIRECTORY: + snprintf(s, len, + "Cache Directory. \n" + " \n" + "Content decompressed by RetroArch will be \n" + "temporarily extracted to this directory."); + break; + case MENU_ENUM_LABEL_HISTORY_LIST_ENABLE: + snprintf(s, len, + "If enabled, every content loaded \n" + "in RetroArch will be automatically \n" + "added to the recent history list."); + break; + case MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY: + snprintf(s, len, + "File Browser Directory. \n" + " \n" + "Sets start directory for menu file browser."); + break; + case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR: + snprintf(s, len, + "Influence how input polling is done inside \n" + "RetroArch. \n" + " \n" + "Early - Input polling is performed before \n" + "the frame is processed. \n" + "Normal - Input polling is performed when \n" + "polling is requested. \n" + "Late - Input polling is performed on \n" + "first input state request per frame.\n" + " \n" + "Setting it to 'Early' or 'Late' can result \n" + "in less latency, \n" + "depending on your configuration.\n\n" + "Will be ignored when using netplay." + ); + break; + case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_HIDE_UNBOUND: + snprintf(s, len, + "Hide input descriptors that were not set \n" + "by the core."); + break; + case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE: + snprintf(s, len, + "Video refresh rate of your monitor. \n" + "Used to calculate a suitable audio input rate."); + break; + case MENU_ENUM_LABEL_VIDEO_FORCE_SRGB_DISABLE: + snprintf(s, len, + "Forcibly disable sRGB FBO support. Some Intel \n" + "OpenGL drivers on Windows have video problems \n" + "with sRGB FBO support enabled."); + break; + case MENU_ENUM_LABEL_AUDIO_ENABLE: + snprintf(s, len, + "Enable audio output."); + break; + case MENU_ENUM_LABEL_AUDIO_SYNC: + snprintf(s, len, + "Synchronize audio (recommended)."); + break; + case MENU_ENUM_LABEL_AUDIO_LATENCY: + snprintf(s, len, + "Desired audio latency in milliseconds. \n" + "Might not be honored if the audio driver \n" + "can't provide given latency."); + break; + case MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE: + snprintf(s, len, + "Allow cores to set rotation. If false, \n" + "rotation requests are honored, but ignored.\n\n" + "Used for setups where one manually rotates \n" + "the monitor."); + break; + case MENU_ENUM_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW: + snprintf(s, len, + "Show the input descriptors set by the core \n" + "instead of the default ones."); + break; + case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: + snprintf(s, len, + "Number of entries that will be kept in \n" + "content history playlist."); + break; + case MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN: + snprintf(s, len, + "To use windowed mode or not when going \n" + "fullscreen."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_SIZE: + snprintf(s, len, + "Font size for on-screen messages."); + break; + case MENU_ENUM_LABEL_SAVESTATE_AUTO_INDEX: + snprintf(s, len, + "Automatically increment slot index on each save, \n" + "generating multiple savestate files. \n" + "When the content is loaded, state slot will be \n" + "set to the highest existing value (last savestate)."); + break; + case MENU_ENUM_LABEL_FPS_SHOW: + snprintf(s, len, + "Enables displaying the current frames \n" + "per second."); + break; + case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE: + snprintf(s, len, + "Show and/or hide onscreen messages."); + break; + case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X: + case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_Y: + snprintf(s, len, + "Offset for where messages will be placed \n" + "onscreen. Values are in range [0.0, 1.0]."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE: + snprintf(s, len, + "Enable or disable the current overlay."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU: + snprintf(s, len, + "Hide the current overlay from appearing \n" + "inside the menu."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS: + snprintf(s, len, + "Show keyboard/controller button presses on \n" + "the onscreen overlay."); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT: + snprintf(s, len, + "Select the port to listen for controller input \n" + "to display on the onscreen overlay."); + break; + case MENU_ENUM_LABEL_OVERLAY_PRESET: + snprintf(s, len, + "Path to input overlay."); + break; + case MENU_ENUM_LABEL_OVERLAY_OPACITY: + snprintf(s, len, + "Overlay opacity."); + break; + case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT: + snprintf(s, len, + "Input bind timer timeout (in seconds). \n" + "Amount of seconds to wait until proceeding \n" + "to the next bind."); + break; + case MENU_ENUM_LABEL_INPUT_BIND_HOLD: + snprintf(s, len, + "Input bind hold time (in seconds). \n" + "Amount of seconds to hold an input to bind it."); + break; + case MENU_ENUM_LABEL_OVERLAY_SCALE: + snprintf(s, len, + "Overlay scale."); + break; + case MENU_ENUM_LABEL_AUDIO_OUTPUT_RATE: + snprintf(s, len, + "Audio output samplerate."); + break; + case MENU_ENUM_LABEL_VIDEO_SHARED_CONTEXT: + snprintf(s, len, + "Set to true if hardware-rendered cores \n" + "should get their private context. \n" + "Avoids having to assume hardware state changes \n" + "inbetween frames." + ); + break; + case MENU_ENUM_LABEL_CORE_LIST: + snprintf(s, len, + "Load Core. \n" + " \n" + "Browse for a libretro core \n" + "implementation. Where the browser \n" + "starts depends on your Core Directory \n" + "path. If blank, it will start in root. \n" + " \n" + "If Core Directory is a directory, the menu \n" + "will use that as top folder. If Core \n" + "Directory is a full path, it will start \n" + "in the folder where the file is."); + break; + case MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG: + snprintf(s, len, + "You can use the following controls below \n" + "on either your gamepad or keyboard in order\n" + "to control the menu: \n" + " \n" + ); + break; + case MENU_ENUM_LABEL_WELCOME_TO_RETROARCH: + snprintf(s, len, + "Welcome to RetroArch\n" + ); + break; + case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: { + /* Work around C89 limitations */ + char u[501]; + const char *t = + "RetroArch relies on an unique form of\n" + "audio/video synchronization where it needs to be\n" + "calibrated against the refresh rate of your\n" + "display for best performance results.\n" + " \n" + "If you experience any audio crackling or video\n" + "tearing, usually it means that you need to\n" + "calibrate the settings. Some choices below:\n" + " \n"; + snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ + "a) Go to '%s' -> '%s', and enable\n" + "'Threaded Video'. Refresh rate will not matter\n" + "in this mode, framerate will be higher,\n" + "but video might be less smooth.\n" + "b) Go to '%s' -> '%s', and look at\n" + "'%s'. Let it run for\n" + "2048 frames, then press 'OK'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)); + strlcpy(s, t, len); + strlcat(s, u, len); + } + break; + case MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: + snprintf(s, len, + "To scan for content, go to '%s' and\n" + "select either '%s' or %s'.\n" + " \n" + "Files will be compared to database entries.\n" + "If there is a match, it will add an entry\n" + "to a collection.\n" + " \n" + "You can then easily access this content by\n" + "going to '%s' ->\n" + "'%s'\n" + "instead of having to go through the\n" + "filebrowser everytime.\n" + " \n" + "NOTE: Content for some cores might still not be\n" + "scannable.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST) + ); + break; + case MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT: + snprintf(s, len, + "Welcome to RetroArch\n" + "\n" + "Extracting assets, please wait.\n" + "This might take a while...\n" + ); + break; + case MENU_ENUM_LABEL_INPUT_DRIVER: + { + const char *lbl = settings ? settings->arrays.input_driver : NULL; + + if (string_is_equal(lbl, msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_UDEV))) + snprintf(s, len, + "udev Input driver. \n" + " \n" + "It uses the recent evdev joypad API \n" + "for joystick support. It supports \n" + "hotplugging and force feedback. \n" + " \n" + "The driver reads evdev events for keyboard \n" + "support. It also supports keyboard callback, \n" + "mice and touchpads. \n" + " \n" + "By default in most distros, /dev/input nodes \n" + "are root-only (mode 600). You can set up a udev \n" + "rule which makes these accessible to non-root." + ); + else if (string_is_equal(lbl, + msg_hash_to_str(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW))) + snprintf(s, len, + "linuxraw Input driver. \n" + " \n" + "This driver requires an active TTY. Keyboard \n" + "events are read directly from the TTY which \n" + "makes it simpler, but not as flexible as udev. \n" "Mice, etc, are not supported at all. \n" + " \n" + "This driver uses the older joystick API \n" + "(/dev/input/js*)."); + else + snprintf(s, len, + "Input driver.\n" + " \n" + "Depending on video driver, it might \n" + "force a different input driver."); + } + break; + case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: + snprintf(s, len, + "Load Content. \n" + "Browse for content. \n" + " \n" + "To load content, you need a \n" + "'Core' to use, and a content file. \n" + " \n" + "To control where the menu starts \n" + "to browse for content, set \n" + "'File Browser Directory'. \n" + "If not set, it will start in root. \n" + " \n" + "The browser will filter out \n" + "extensions for the last core set \n" + "in 'Load Core', and use that core \n" + "when content is loaded." + ); + break; + case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY: + snprintf(s, len, + "Loading content from history. \n" + " \n" + "As content is loaded, content and libretro \n" + "core combinations are saved to history. \n" + " \n" + "The history is saved to a file in the same \n" + "directory as the RetroArch config file. If \n" + "no config file was loaded in startup, history \n" + "will not be saved or loaded, and will not exist \n" + "in the main menu." + ); + break; + case MENU_ENUM_LABEL_VIDEO_DRIVER: + snprintf(s, len, + "Current Video driver."); + + if (string_is_equal(settings->arrays.video_driver, "gl")) + { + snprintf(s, len, + "OpenGL Video driver. \n" + " \n" + "This driver allows libretro GL cores to \n" + "be used in addition to software-rendered \n" + "core implementations.\n" + " \n" + "Performance for software-rendered and \n" + "libretro GL core implementations is \n" + "dependent on your graphics card's \n" + "underlying GL driver)."); + } + else if (string_is_equal(settings->arrays.video_driver, "sdl2")) + { + snprintf(s, len, + "SDL 2 Video driver.\n" + " \n" + "This is an SDL 2 software-rendered video \n" + "driver.\n" + " \n" + "Performance for software-rendered libretro \n" + "core implementations is dependent \n" + "on your platform SDL implementation."); + } + else if (string_is_equal(settings->arrays.video_driver, "sdl1")) + { + snprintf(s, len, + "SDL Video driver.\n" + " \n" + "This is an SDL 1.2 software-rendered video \n" + "driver.\n" + " \n" + "Performance is considered to be suboptimal. \n" + "Consider using it only as a last resort."); + } + else if (string_is_equal(settings->arrays.video_driver, "d3d")) + { + snprintf(s, len, + "Direct3D Video driver. \n" + " \n" + "Performance for software-rendered cores \n" + "is dependent on your graphic card's \n" + "underlying D3D driver)."); + } + else if (string_is_equal(settings->arrays.video_driver, "exynos")) + { + snprintf(s, len, + "Exynos-G2D Video Driver. \n" + " \n" + "This is a low-level Exynos video driver. \n" + "Uses the G2D block in Samsung Exynos SoC \n" + "for blit operations. \n" + " \n" + "Performance for software rendered cores \n" + "should be optimal."); + } + else if (string_is_equal(settings->arrays.video_driver, "drm")) + { + snprintf(s, len, + "Plain DRM Video Driver. \n" + " \n" + "This is a low-level video driver using. \n" + "libdrm for hardware scaling using \n" + "GPU overlays."); + } + else if (string_is_equal(settings->arrays.video_driver, "sunxi")) + { + snprintf(s, len, + "Sunxi-G2D Video Driver. \n" + " \n" + "This is a low-level Sunxi video driver. \n" + "Uses the G2D block in Allwinner SoCs."); + } + break; + case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN: + snprintf(s, len, + "Audio DSP plugin.\n" + " Processes audio before it's sent to \n" + "the driver." + ); + break; + case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER: + { + const char *lbl = settings ? settings->arrays.audio_resampler : NULL; + + if (string_is_equal(lbl, msg_hash_to_str( + MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_SINC))) + strlcpy(s, + "Windowed SINC implementation.", len); + else if (string_is_equal(lbl, msg_hash_to_str( + MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER_CC))) + strlcpy(s, + "Convoluted Cosine implementation.", len); + else if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + } + break; + + case MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION: snprintf(s, len, "SET CRT"); + break; + + case MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_SUPER: snprintf(s, len, "SET CRT SUPER"); + break; + + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET: + snprintf(s, len, + "Load Shader Preset. \n" + " \n" + " Load a shader preset directly. \n" + "The menu shader menu is updated accordingly. \n" + " \n" + "If the CGP uses scaling methods which are not \n" + "simple, (i.e. source scaling, same scaling \n" + "factor for X/Y), the scaling factor displayed \n" + "in the menu might not be correct." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS: + snprintf(s, len, + "Scale for this pass. \n" + " \n" + "The scale factor accumulates, i.e. 2x \n" + "for first pass and 2x for second pass \n" + "will give you a 4x total scale. \n" + " \n" + "If there is a scale factor for last \n" + "pass, the result is stretched to \n" + "screen with the filter specified in \n" + "'Default Filter'. \n" + " \n" + "If 'Don't Care' is set, either 1x \n" + "scale or stretch to fullscreen will \n" + "be used depending if it's not the last \n" + "pass or not." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES: + snprintf(s, len, + "Shader Passes. \n" + " \n" + "RetroArch allows you to mix and match various \n" + "shaders with arbitrary shader passes, with \n" + "custom hardware filters and scale factors. \n" + " \n" + "This option specifies the number of shader \n" + "passes to use. If you set this to 0, and use \n" + "Apply Shader Changes, you use a 'blank' shader. \n" + " \n" + "The Default Filter option will affect the \n" + "stretching filter."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS: + snprintf(s, len, + "Shader Parameters. \n" + " \n" + "Modifies current shader directly. Will not be \n" + "saved to CGP/GLSLP preset file."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS: + snprintf(s, len, + "Shader Preset Parameters. \n" + " \n" + "Modifies shader preset currently in menu." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_PASS: + snprintf(s, len, + "Path to shader. \n" + " \n" + "All shaders must be of the same \n" + "type (i.e. CG, GLSL or HLSL). \n" + " \n" + "Set Shader Directory to set where \n" + "the browser starts to look for \n" + "shaders." + ); + break; + case MENU_ENUM_LABEL_CONFIGURATION_SETTINGS: + snprintf(s, len, + "Determines how configuration files \n" + "are loaded and prioritized."); + break; + case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT: + snprintf(s, len, + "Saves config to disk on exit.\n" + "Useful for menu as settings can be\n" + "modified. Overwrites the config.\n" + " \n" + "#include's and comments are not \n" + "preserved. \n" + " \n" + "By design, the config file is \n" + "considered immutable as it is \n" + "likely maintained by the user, \n" + "and should not be overwritten \n" + "behind the user's back." +#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) + "\nThis is not not the case on \n" + "consoles however, where \n" + "looking at the config file \n" + "manually isn't really an option." +#endif + ); + break; + case MENU_ENUM_LABEL_CONFIRM_ON_EXIT: + snprintf(s, len, "Are you sure you want to quit?"); + break; + case MENU_ENUM_LABEL_SHOW_HIDDEN_FILES: + snprintf(s, len, "Show hidden files\n" + "and folders."); + break; + case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS: + snprintf(s, len, + "Hardware filter for this pass. \n" + " \n" + "If 'Don't Care' is set, 'Default \n" + "Filter' will be used." + ); + break; + case MENU_ENUM_LABEL_AUTOSAVE_INTERVAL: + snprintf(s, len, + "Autosaves the non-volatile SRAM \n" + "at a regular interval.\n" + " \n" + "This is disabled by default unless set \n" + "otherwise. The interval is measured in \n" + "seconds. \n" + " \n" + "A value of 0 disables autosave."); + break; + case MENU_ENUM_LABEL_INPUT_BIND_DEVICE_TYPE: + snprintf(s, len, + "Input Device Type. \n" + " \n" + "Picks which device type to use. This is \n" + "relevant for the libretro core itself." + ); + break; + case MENU_ENUM_LABEL_LIBRETRO_LOG_LEVEL: + snprintf(s, len, + "Sets log level for libretro cores \n" + "(GET_LOG_INTERFACE). \n" + " \n" + " If a log level issued by a libretro \n" + " core is below libretro_log level, it \n" + " is ignored.\n" + " \n" + " DEBUG logs are always ignored unless \n" + " verbose mode is activated (--verbose).\n" + " \n" + " DEBUG = 0\n" + " INFO = 1\n" + " WARN = 2\n" + " ERROR = 3" + ); + break; + case MENU_ENUM_LABEL_STATE_SLOT_INCREASE: + case MENU_ENUM_LABEL_STATE_SLOT_DECREASE: + snprintf(s, len, + "State slots.\n" + " \n" + " With slot set to 0, save state name is *.state \n" + " (or whatever defined on commandline).\n" + "When slot is != 0, path will be (path)(d), \n" + "where (d) is slot number."); + break; + case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: + snprintf(s, len, + "Apply Shader Changes. \n" + " \n" + "After changing shader settings, use this to \n" + "apply changes. \n" + " \n" + "Changing shader settings is a somewhat \n" + "expensive operation so it has to be \n" + "done explicitly. \n" + " \n" + "When you apply shaders, the menu shader \n" + "settings are saved to a temporary file (either \n" + "menu.cgp or menu.glslp) and loaded. The file \n" + "persists after RetroArch exits. The file is \n" + "saved to Shader Directory." + ); + break; + case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES: + snprintf(s, len, + "Watch shader files for new changes. \n" + " \n" + "After saving changes to a shader on disk, \n" + "it will automatically be recompiled \n" + "and applied to the running content." + ); + break; + case MENU_ENUM_LABEL_MENU_TOGGLE: + snprintf(s, len, + "Toggles menu."); + break; + case MENU_ENUM_LABEL_GRAB_MOUSE_TOGGLE: + snprintf(s, len, + "Toggles mouse grab.\n" + " \n" + "When mouse is grabbed, RetroArch hides the \n" + "mouse, and keeps the mouse pointer inside \n" + "the window to allow relative mouse input to \n" + "work better."); + break; + case MENU_ENUM_LABEL_GAME_FOCUS_TOGGLE: + snprintf(s, len, + "Toggles game focus.\n" + " \n" + "When a game has focus, RetroArch will both disable \n" + "hotkeys and keep/warp the mouse pointer inside the window."); + break; + case MENU_ENUM_LABEL_DISK_NEXT: + snprintf(s, len, + "Cycles through disk images. Use after \n" + "ejecting. \n" + " \n" + " Complete by toggling eject again."); + break; + case MENU_ENUM_LABEL_VIDEO_FILTER: +#ifdef HAVE_FILTERS_BUILTIN + snprintf(s, len, + "CPU-based video filter."); +#else + snprintf(s, len, + "CPU-based video filter.\n" + " \n" + "Path to a dynamic library."); +#endif + break; + case MENU_ENUM_LABEL_AUDIO_DEVICE: + snprintf(s, len, + "Override the default audio device \n" + "the audio driver uses.\n" + "This is driver dependent. E.g.\n" +#ifdef HAVE_ALSA + " \n" + "ALSA wants a PCM device." +#endif +#ifdef HAVE_OSS + " \n" + "OSS wants a path (e.g. /dev/dsp)." +#endif +#ifdef HAVE_JACK + " \n" + "JACK wants portnames (e.g. system:playback1\n" + ",system:playback_2)." +#endif +#ifdef HAVE_RSOUND + " \n" + "RSound wants an IP address to an RSound \n" + "server." +#endif + ); + break; + case MENU_ENUM_LABEL_DISK_EJECT_TOGGLE: + snprintf(s, len, + "Toggles eject for disks.\n" + " \n" + "Used for multiple-disk content."); + break; + case MENU_ENUM_LABEL_ENABLE_HOTKEY: + snprintf(s, len, + "Enable other hotkeys.\n" + " \n" + " If this hotkey is bound to either keyboard, \n" + "joybutton or joyaxis, all other hotkeys will \n" + "be disabled unless this hotkey is also held \n" + "at the same time. \n" + " \n" + "This is useful for RETRO_KEYBOARD centric \n" + "implementations which query a large area of \n" + "the keyboard, where it is not desirable that \n" + "hotkeys get in the way."); + break; + case MENU_ENUM_LABEL_REWIND_ENABLE: + snprintf(s, len, + "Enable rewinding.\n" + " \n" + "This will take a performance hit, \n" + "so it is disabled by default."); + break; + case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_TOGGLE: + snprintf(s, len, + "Apply cheat immediately after toggling."); + break; + case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_LOAD: + snprintf(s, len, + "Auto-apply cheats when game loads."); + break; + case MENU_ENUM_LABEL_LIBRETRO_DIR_PATH: + snprintf(s, len, + "Core Directory. \n" + " \n" + "A directory for where to search for \n" + "libretro core implementations."); + break; + case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO: + snprintf(s, len, + "Refresh Rate Auto.\n" + " \n" + "The accurate refresh rate of our monitor (Hz).\n" + "This is used to calculate audio input rate with \n" + "the formula: \n" + " \n" + "audio_input_rate = game input rate * display \n" + "refresh rate / game refresh rate\n" + " \n" + "If the implementation does not report any \n" + "values, NTSC defaults will be assumed for \n" + "compatibility.\n" + " \n" + "This value should stay close to 60Hz to avoid \n" + "large pitch changes. If your monitor does \n" + "not run at 60Hz, or something close to it, \n" + "disable VSync, and leave this at its default."); + break; + case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_POLLED: + snprintf(s, len, + "Set Polled Refresh Rate\n" + " \n" + "Sets the refresh rate to the actual value\n" + "polled from the display driver."); + break; + case MENU_ENUM_LABEL_VIDEO_ROTATION: + snprintf(s, len, + "Forces a certain rotation \n" + "of the screen.\n" + " \n" + "The rotation is added to rotations which\n" + "the libretro core sets (see Video Allow\n" + "Rotate)."); + break; + case MENU_ENUM_LABEL_VIDEO_SCALE: + snprintf(s, len, + "Fullscreen resolution.\n" + " \n" + "Resolution of 0 uses the \n" + "resolution of the environment.\n"); + break; + case MENU_ENUM_LABEL_FASTFORWARD_RATIO: + snprintf(s, len, + "Fastforward ratio.\n" + " \n" + "The maximum rate at which content will\n" + "be run when using fast forward.\n" + " \n" + " (E.g. 5.0 for 60 fps content => 300 fps \n" + "cap).\n" + " \n" + "RetroArch will go to sleep to ensure that \n" + "the maximum rate will not be exceeded.\n" + "Do not rely on this cap to be perfectly \n" + "accurate."); + break; + case MENU_ENUM_LABEL_VRR_RUNLOOP_ENABLE: + snprintf(s, len, + "Sync to Exact Content Framerate.\n" + " \n" + "This option is the equivalent of forcing x1 speed\n" + "while still allowing fast forward.\n" + "No deviation from the core requested refresh rate,\n" + "no sound Dynamic Rate Control)."); + break; + case MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX: + snprintf(s, len, + "Which monitor to prefer.\n" + " \n" + "0 (default) means no particular monitor \n" + "is preferred, 1 and up (1 being first \n" + "monitor), suggests RetroArch to use that \n" + "particular monitor."); + break; + case MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN: + snprintf(s, len, + "Forces cropping of overscanned \n" + "frames.\n" + " \n" + "Exact behavior of this option is \n" + "core-implementation specific."); + break; + case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER: + snprintf(s, len, + "Only scales video in integer \n" + "steps.\n" + " \n" + "The base size depends on system-reported \n" + "geometry and aspect ratio.\n" + " \n" + "If Force Aspect is not set, X/Y will be \n" + "integer scaled independently."); + break; + case MENU_ENUM_LABEL_AUDIO_VOLUME: + snprintf(s, len, + "Audio volume, expressed in dB.\n" + " \n" + " 0 dB is normal volume. No gain will be applied.\n" + "Gain can be controlled in runtime with Input\n" + "Volume Up / Input Volume Down."); + break; + case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA: + snprintf(s, len, + "Audio rate control.\n" + " \n" + "Setting this to 0 disables rate control.\n" + "Any other value controls audio rate control \n" + "delta.\n" + " \n" + "Defines how much input rate can be adjusted \n" + "dynamically.\n" + " \n" + " Input rate is defined as: \n" + " input rate * (1.0 +/- (rate control delta))"); + break; + case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW: + snprintf(s, len, + "Maximum audio timing skew.\n" + " \n" + "Defines the maximum change in input rate.\n" + "You may want to increase this to enable\n" + "very large changes in timing, for example\n" + "running PAL cores on NTSC displays, at the\n" + "cost of inaccurate audio pitch.\n" + " \n" + " Input rate is defined as: \n" + " input rate * (1.0 +/- (max timing skew))"); + break; + case MENU_ENUM_LABEL_OVERLAY_NEXT: + snprintf(s, len, + "Toggles to next overlay.\n" + " \n" + "Wraps around."); + break; + case MENU_ENUM_LABEL_LOG_VERBOSITY: + snprintf(s, len, + "Enable or disable verbosity level \n" + "of frontend."); + break; + case MENU_ENUM_LABEL_VOLUME_UP: + snprintf(s, len, + "Increases audio volume."); + break; + case MENU_ENUM_LABEL_VOLUME_DOWN: + snprintf(s, len, + "Decreases audio volume."); + break; + case MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION: + snprintf(s, len, + "Forcibly disable composition.\n" + "Only valid on Windows Vista/7 for now."); + break; + case MENU_ENUM_LABEL_PERFCNT_ENABLE: + snprintf(s, len, + "Enable or disable frontend \n" + "performance counters."); + break; + case MENU_ENUM_LABEL_SYSTEM_DIRECTORY: + snprintf(s, len, + "System Directory. \n" + " \n" + "Sets the 'system' directory.\n" + "Cores can query for this\n" + "directory to load BIOSes, \n" + "system-specific configs, etc."); + break; + case MENU_ENUM_LABEL_SAVESTATE_AUTO_SAVE: + case MENU_ENUM_LABEL_SAVESTATE_AUTO_LOAD: + snprintf(s, len, + "Automatically saves a savestate at the \n" + "end of RetroArch's lifetime.\n" + " \n" + "RetroArch will automatically load any savestate\n" + "with this path on startup if 'Auto Load State\n" + "is enabled."); + break; + case MENU_ENUM_LABEL_VIDEO_THREADED: + snprintf(s, len, + "Use threaded video driver.\n" + " \n" + "Using this might improve performance at the \n" + "possible cost of latency and more video \n" + "stuttering."); + break; + case MENU_ENUM_LABEL_VIDEO_VSYNC: + snprintf(s, len, + "Video V-Sync.\n"); + break; + case MENU_ENUM_LABEL_VIDEO_HARD_SYNC: + snprintf(s, len, + "Attempts to hard-synchronize \n" + "CPU and GPU.\n" + " \n" + "Can reduce latency at the cost of \n" + "performance."); + break; + case MENU_ENUM_LABEL_REWIND_GRANULARITY: + snprintf(s, len, + "Rewind granularity.\n" + " \n" + " When rewinding defined number of \n" + "frames, you can rewind several frames \n" + "at a time, increasing the rewinding \n" + "speed."); + break; + case MENU_ENUM_LABEL_REWIND_BUFFER_SIZE: + snprintf(s, len, + "Rewind buffer size (MB).\n" + " \n" + " The amount of memory in MB to reserve \n" + "for rewinding. Increasing this value \n" + "increases the rewind history length.\n"); + break; + case MENU_ENUM_LABEL_REWIND_BUFFER_SIZE_STEP: + snprintf(s, len, + "Rewind buffer size step (MB).\n" + " \n" + " Each time you increase or decrease \n" + "the rewind buffer size value via this \n" + "UI it will change by this amount.\n"); + break; + case MENU_ENUM_LABEL_SCREENSHOT: + snprintf(s, len, + "Take screenshot."); + break; + case MENU_ENUM_LABEL_VIDEO_FRAME_DELAY: + snprintf(s, len, + "Sets how many milliseconds to delay\n" + "after VSync before running the core.\n" + "\n" + "Can reduce latency at the cost of\n" + "higher risk of stuttering.\n" + " \n" + "Maximum is 15."); + break; + case MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES: + snprintf(s, len, + "Sets how many frames CPU can \n" + "run ahead of GPU when using 'GPU \n" + "Hard Sync'.\n" + " \n" + "Maximum is 3.\n" + " \n" + " 0: Syncs to GPU immediately.\n" + " 1: Syncs to previous frame.\n" + " 2: Etc ..."); + break; + case MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION: + snprintf(s, len, + "Inserts a black frame inbetween \n" + "frames.\n" + " \n" + "Useful for 120 Hz monitors who want to \n" + "play 60 Hz material with eliminated \n" + "ghosting.\n" + " \n" + "Video refresh rate should still be \n" + "configured as if it is a 60 Hz monitor \n" + "(divide refresh rate by 2)."); + break; + case MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN: + snprintf(s, len, + "Show startup screen in menu.\n" + "Is automatically set to false when seen\n" + "for the first time.\n" + " \n" + "This is only updated in config if\n" + "'Save Configuration on Exit' is enabled.\n"); + break; + case MENU_ENUM_LABEL_VIDEO_FULLSCREEN: + snprintf(s, len, "Toggles fullscreen."); + break; + case MENU_ENUM_LABEL_BLOCK_SRAM_OVERWRITE: + snprintf(s, len, + "Block SRAM from being overwritten \n" + "when loading save states.\n" + " \n" + "Might potentially lead to buggy games."); + break; + case MENU_ENUM_LABEL_PAUSE_NONACTIVE: + snprintf(s, len, + "Pause gameplay when window focus \n" + "is lost."); + break; + case MENU_ENUM_LABEL_VIDEO_GPU_SCREENSHOT: + snprintf(s, len, + "Screenshots output of GPU shaded \n" + "material if available."); + break; + case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY: + snprintf(s, len, + "Screenshot Directory. \n" + " \n" + "Directory to dump screenshots to." + ); + break; + case MENU_ENUM_LABEL_VIDEO_SWAP_INTERVAL: + snprintf(s, len, + "VSync Swap Interval.\n" + " \n" + "Uses a custom swap interval for VSync. Set this \n" + "to effectively halve monitor refresh rate."); + break; + case MENU_ENUM_LABEL_SAVEFILE_DIRECTORY: + snprintf(s, len, + "Savefile Directory. \n" + " \n" + "Save all save files (*.srm) to this \n" + "directory. This includes related files like \n" + ".bsv, .rt, .psrm, etc...\n" + " \n" + "This will be overridden by explicit command line\n" + "options."); + break; + case MENU_ENUM_LABEL_SAVESTATE_DIRECTORY: + snprintf(s, len, + "Savestate Directory. \n" + " \n" + "Save all save states (*.state) to this \n" + "directory.\n" + " \n" + "This will be overridden by explicit command line\n" + "options."); + break; + case MENU_ENUM_LABEL_ASSETS_DIRECTORY: + snprintf(s, len, + "Assets Directory. \n" + " \n" + " This location is queried by default when \n" + "menu interfaces try to look for loadable \n" + "assets, etc."); + break; + case MENU_ENUM_LABEL_DYNAMIC_WALLPAPERS_DIRECTORY: + snprintf(s, len, + "Dynamic Wallpapers Directory. \n" + " \n" + " The place to store backgrounds that will \n" + "be loaded dynamically by the menu depending \n" + "on context."); + break; + case MENU_ENUM_LABEL_SLOWMOTION_RATIO: + snprintf(s, len, + "Slowmotion ratio." + " \n" + "When slowmotion, content will slow\n" + "down by factor."); + break; + case MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD: + snprintf(s, len, + "Defines axis threshold.\n" + " \n" + "How far an axis must be tilted to result\n" + "in a button press.\n" + " Possible values are [0.0, 1.0]."); + break; + case MENU_ENUM_LABEL_INPUT_TURBO_PERIOD: + snprintf(s, len, + "Turbo period.\n" + " \n" + "Describes the period of which turbo-enabled\n" + "buttons toggle.\n" + " \n" + "Numbers are described in frames." + ); + break; + case MENU_ENUM_LABEL_INPUT_DUTY_CYCLE: + snprintf(s, len, + "Duty cycle.\n" + " \n" + "Describes how long the period of a turbo-enabled\n" + "should be.\n" + " \n" + "Numbers are described in frames." + ); + break; + case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: + snprintf(s, len, "Enable touch support."); + break; + case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: + snprintf(s, len, "Use front instead of back touch."); + break; + case MENU_ENUM_LABEL_MOUSE_ENABLE: + snprintf(s, len, "Enable mouse input inside the menu."); + break; + case MENU_ENUM_LABEL_POINTER_ENABLE: + snprintf(s, len, "Enable touch input inside the menu."); + break; + case MENU_ENUM_LABEL_MENU_WALLPAPER: + snprintf(s, len, "Path to an image to set as the background."); + break; + case MENU_ENUM_LABEL_NAVIGATION_WRAPAROUND: + snprintf(s, len, + "Wrap-around to beginning and/or end \n" + "if boundary of list is reached \n" + "horizontally and/or vertically."); + break; + case MENU_ENUM_LABEL_PAUSE_LIBRETRO: + snprintf(s, len, + "If disabled, the game will keep \n" + "running in the background when we are in the \n" + "menu."); + break; + case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE: + snprintf(s, len, + "Suspends the screensaver. Is a hint that \n" + "does not necessarily have to be \n" + "honored by the video driver."); + break; + case MENU_ENUM_LABEL_NETPLAY_MODE: + snprintf(s, len, + "Netplay client mode for the current user. \n" + "Will be 'Server' mode if disabled."); + break; + case MENU_ENUM_LABEL_NETPLAY_DELAY_FRAMES: + snprintf(s, len, + "The amount of delay frames to use for netplay. \n" + " \n" + "Increasing this value will increase \n" + "performance, but introduce more latency."); + break; + case MENU_ENUM_LABEL_NETPLAY_PUBLIC_ANNOUNCE: + snprintf(s, len, + "Whether to announce netplay games publicly. \n" + " \n" + "If set to false, clients must manually connect \n" + "rather than using the public lobby."); + break; + case MENU_ENUM_LABEL_NETPLAY_START_AS_SPECTATOR: + snprintf(s, len, + "Whether to start netplay in spectator mode. \n" + " \n" + "If set to true, netplay will be in spectator mode \n" + "on start. It's always possible to change mode \n" + "later."); + break; + case MENU_ENUM_LABEL_NETPLAY_ALLOW_SLAVES: + snprintf(s, len, + "Whether to allow connections in slave mode. \n" + " \n" + "Slave-mode clients require very little processing \n" + "power on either side, but will suffer \n" + "significantly from network latency."); + break; + case MENU_ENUM_LABEL_NETPLAY_REQUIRE_SLAVES: + snprintf(s, len, + "Whether to disallow connections not in slave mode. \n" + " \n" + "Not recommended except for very fast networks \n" + "with very weak machines. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_STATELESS_MODE: + snprintf(s, len, + "Whether to run netplay in a mode not requiring\n" + "save states. \n" + " \n" + "If set to true, a very fast network is required,\n" + "but no rewinding is performed, so there will be\n" + "no netplay jitter.\n"); + break; + case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES: + snprintf(s, len, + "The frequency in frames with which netplay \n" + "will verify that the host and client are in \n" + "sync. \n" + " \n" + "With most cores, this value will have no \n" + "visible effect and can be ignored. With \n" + "nondeterminstic cores, this value determines \n" + "how often the netplay peers will be brought \n" + "into sync. With buggy cores, setting this \n" + "to any non-zero value will cause severe \n" + "performance issues. Set to zero to perform \n" + "no checks. This value is only used on the \n" + "netplay host. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN: + snprintf(s, len, + "The number of frames of input latency for \n" + "netplay to use to hide network latency. \n" + " \n" + "When in netplay, this option delays local \n" + "input, so that the frame being run is \n" + "closer to the frames being received from \n" + "the network. This reduces jitter and makes \n" + "netplay less CPU-intensive, but at the \n" + "price of noticeable input lag. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE: + snprintf(s, len, + "The range of frames of input latency that \n" + "may be used by netplay to hide network \n" + "latency. \n" + "\n" + "If set, netplay will adjust the number of \n" + "frames of input latency dynamically to \n" + "balance CPU time, input latency and \n" + "network latency. This reduces jitter and \n" + "makes netplay less CPU-intensive, but at \n" + "the price of unpredictable input lag. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL: + snprintf(s, len, + "When hosting, attempt to listen for\n" + "connections from the public internet, using\n" + "UPnP or similar technologies to escape LANs. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER: + snprintf(s, len, + "When hosting a netplay session, relay connection through a \n" + "man-in-the-middle server \n" + "to get around firewalls or NAT/UPnP issues. \n"); + break; + case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER: + snprintf(s, len, + "Specifies the man-in-the-middle server \n" + "to use for netplay. A server that is \n" + "located closer to you may have less latency. \n"); + break; + case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES: + snprintf(s, len, + "Maximum amount of swapchain images. This \n" + "can tell the video driver to use a specific \n" + "video buffering mode. \n" + " \n" + "Single buffering - 1\n" + "Double buffering - 2\n" + "Triple buffering - 3\n" + " \n" + "Setting the right buffering mode can have \n" + "a big impact on latency."); + break; + case MENU_ENUM_LABEL_VIDEO_SMOOTH: + snprintf(s, len, + "Smoothens picture with bilinear filtering. \n" + "Should be disabled if using shaders."); + break; + case MENU_ENUM_LABEL_TIMEDATE_ENABLE: + snprintf(s, len, + "Shows current date and/or time inside menu."); + break; + case MENU_ENUM_LABEL_BATTERY_LEVEL_ENABLE: + snprintf(s, len, + "Shows current battery level inside menu."); + break; + case MENU_ENUM_LABEL_CORE_ENABLE: + snprintf(s, len, + "Shows current core inside menu."); + break; + case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST: + snprintf(s, len, + "Enables Netplay in host (server) mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT: + snprintf(s, len, + "Enables Netplay in client mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_DISCONNECT: + snprintf(s, len, + "Disconnects an active Netplay connection."); + break; + case MENU_ENUM_LABEL_NETPLAY_LAN_SCAN_SETTINGS: + snprintf(s, len, + "Search for and connect to netplay hosts on the local network."); + break; + case MENU_ENUM_LABEL_NETPLAY_SETTINGS: + snprintf(s, len, + "Setting related to Netplay."); + break; + case MENU_ENUM_LABEL_DYNAMIC_WALLPAPER: + snprintf(s, len, + "Dynamically load a new background \n" + "depending on context."); + break; + case MENU_ENUM_LABEL_CORE_UPDATER_BUILDBOT_URL: + snprintf(s, len, + "URL to core updater directory on the \n" + "Libretro buildbot."); + break; + case MENU_ENUM_LABEL_BUILDBOT_ASSETS_URL: + snprintf(s, len, + "URL to assets updater directory on the \n" + "Libretro buildbot."); + break; + case MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE: + snprintf(s, len, + "if enabled, overrides the input binds \n" + "with the remapped binds set for the \n" + "current core."); + break; + case MENU_ENUM_LABEL_OVERLAY_DIRECTORY: + snprintf(s, len, + "Overlay Directory. \n" + " \n" + "Defines a directory where overlays are \n" + "kept for easy access."); + break; + case MENU_ENUM_LABEL_INPUT_MAX_USERS: + snprintf(s, len, + "Maximum amount of users supported by \n" + "RetroArch."); + break; + case MENU_ENUM_LABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE: + snprintf(s, len, + "After downloading, automatically extract \n" + "archives that the downloads are contained \n" + "inside."); + break; + case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE: + snprintf(s, len, + "Filter files being shown by \n" + "supported extensions."); + break; + case MENU_ENUM_LABEL_NETPLAY_NICKNAME: + snprintf(s, len, + "The username of the person running RetroArch. \n" + "This will be used for playing online games."); + break; + case MENU_ENUM_LABEL_NETPLAY_TCP_UDP_PORT: + snprintf(s, len, + "The port of the host IP address. \n" + "Can be either a TCP or UDP port."); + break; + case MENU_ENUM_LABEL_NETPLAY_SPECTATOR_MODE_ENABLE: + snprintf(s, len, + "Enable or disable spectator mode for \n" + "the user during netplay."); + break; + case MENU_ENUM_LABEL_NETPLAY_IP_ADDRESS: + snprintf(s, len, + "The address of the host to connect to."); + break; + case MENU_ENUM_LABEL_NETPLAY_PASSWORD: + snprintf(s, len, + "The password for connecting to the netplay \n" + "host. Used only in host mode."); + break; + case MENU_ENUM_LABEL_NETPLAY_SPECTATE_PASSWORD: + snprintf(s, len, + "The password for connecting to the netplay \n" + "host with only spectator privileges. Used \n" + "only in host mode."); + break; + case MENU_ENUM_LABEL_STDIN_CMD_ENABLE: + snprintf(s, len, + "Enable stdin command interface."); + break; + case MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT: + snprintf(s, len, + "Start User Interface companion driver \n" + "on boot (if available)."); + break; + case MENU_ENUM_LABEL_MENU_DRIVER: + snprintf(s, len, "Menu driver to use."); + break; + case MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO: + snprintf(s, len, + "Gamepad button combination to toggle menu. \n" + " \n" + "0 - None \n" + "1 - Press L + R + Y + D-Pad Down \n" + "simultaneously. \n" + "2 - Press L3 + R3 simultaneously. \n" + "3 - Press Start + Select simultaneously."); + break; + case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU: + snprintf(s, len, "Allows any user to control the menu. \n" + " \n" + "When disabled, only user 1 can control the menu."); + break; + case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE: + snprintf(s, len, + "Enable input auto-detection.\n" + " \n" + "Will attempt to auto-configure \n" + "joypads, Plug-and-Play style."); + break; + case MENU_ENUM_LABEL_CAMERA_ALLOW: + snprintf(s, len, + "Allow or disallow camera access by \n" + "cores."); + break; + case MENU_ENUM_LABEL_LOCATION_ALLOW: + snprintf(s, len, + "Allow or disallow location services \n" + "access by cores."); + break; + case MENU_ENUM_LABEL_TURBO: + snprintf(s, len, + "Turbo enable.\n" + " \n" + "Holding the turbo while pressing another \n" + "button will let the button enter a turbo \n" + "mode where the button state is modulated \n" + "with a periodic signal. \n" + " \n" + "The modulation stops when the button \n" + "itself (not turbo button) is released."); + break; + case MENU_ENUM_LABEL_OSK_ENABLE: + snprintf(s, len, + "Enable/disable on-screen keyboard."); + break; + case MENU_ENUM_LABEL_AUDIO_MUTE: + snprintf(s, len, + "Mute/unmute audio."); + break; + case MENU_ENUM_LABEL_REWIND: + snprintf(s, len, + "Hold button down to rewind.\n" + " \n" + "Rewind must be enabled."); + break; + case MENU_ENUM_LABEL_EXIT_EMULATOR: + snprintf(s, len, + "Key to exit RetroArch cleanly." +#if !defined(RARCH_MOBILE) && !defined(RARCH_CONSOLE) + "\nKilling it in any hard way (SIGKILL, \n" + "etc) will terminate without saving\n" + "RAM, etc. On Unix-likes,\n" + "SIGINT/SIGTERM allows\n" + "a clean deinitialization." +#endif + ); + break; + case MENU_ENUM_LABEL_LOAD_STATE: + snprintf(s, len, + "Loads state."); + break; + case MENU_ENUM_LABEL_SAVE_STATE: + snprintf(s, len, + "Saves state."); + break; + case MENU_ENUM_LABEL_NETPLAY_GAME_WATCH: + snprintf(s, len, + "Netplay toggle play/spectate mode."); + break; + case MENU_ENUM_LABEL_CHEAT_INDEX_PLUS: + snprintf(s, len, + "Increment cheat index.\n"); + break; + case MENU_ENUM_LABEL_CHEAT_INDEX_MINUS: + snprintf(s, len, + "Decrement cheat index.\n"); + break; + case MENU_ENUM_LABEL_SHADER_PREV: + snprintf(s, len, + "Applies previous shader in directory."); + break; + case MENU_ENUM_LABEL_SHADER_NEXT: + snprintf(s, len, + "Applies next shader in directory."); + break; + case MENU_ENUM_LABEL_RESET: + snprintf(s, len, + "Reset the content.\n"); + break; + case MENU_ENUM_LABEL_PAUSE_TOGGLE: + snprintf(s, len, + "Toggle between paused and non-paused state."); + break; + case MENU_ENUM_LABEL_CHEAT_TOGGLE: + snprintf(s, len, + "Toggle cheat index.\n"); + break; + case MENU_ENUM_LABEL_CHEAT_IDX: + snprintf(s, len, + "Index position in list.\n"); + break; + case MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION: + snprintf(s, len, + "Address bitmask when Memory Search Size < 8-bit.\n"); + break; + case MENU_ENUM_LABEL_CHEAT_REPEAT_COUNT: + snprintf(s, len, + "The number of times the cheat will be applied.\nUse with the other two Iteration options to affect large areas of memory."); + break; + case MENU_ENUM_LABEL_CHEAT_REPEAT_ADD_TO_ADDRESS: + snprintf(s, len, + "After each 'Number of Iterations' the Memory Address will be increased by this number times the 'Memory Search Size'."); + break; + case MENU_ENUM_LABEL_CHEAT_REPEAT_ADD_TO_VALUE: + snprintf(s, len, + "After each 'Number of Iterations' the Value will be increased by this amount."); + break; + case MENU_ENUM_LABEL_CHEAT_MATCH_IDX: + snprintf(s, len, + "Select the match to view."); + break; + case MENU_ENUM_LABEL_CHEAT_START_OR_CONT: + snprintf(s, len, + "Scan memory to create new cheats"); + break; + case MENU_ENUM_LABEL_CHEAT_START_OR_RESTART: + snprintf(s, len, + "Left/Right to change bit-size\n"); + break; + case MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT: + snprintf(s, len, + "Left/Right to change value\n"); + break; + case MENU_ENUM_LABEL_CHEAT_SEARCH_LT: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_SEARCH_GT: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_SEARCH_EQ: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS: + snprintf(s, len, + "Left/Right to change value\n"); + break; + case MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS: + snprintf(s, len, + "Left/Right to change value\n"); + break; + case MENU_ENUM_LABEL_CHEAT_ADD_MATCHES: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_VIEW_MATCHES: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_CREATE_OPTION: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_DELETE_OPTION: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_TOP: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_RELOAD_CHEATS: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_BOTTOM: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_DELETE_ALL: + snprintf(s, len, + " "); + break; + case MENU_ENUM_LABEL_CHEAT_BIG_ENDIAN: + snprintf(s, len, + "Big endian : 258 = 0x0102\n" + "Little endian : 258 = 0x0201"); + break; + case MENU_ENUM_LABEL_HOLD_FAST_FORWARD: + snprintf(s, len, + "Hold for fast-forward. Releasing button \n" + "disables fast-forward."); + break; + case MENU_ENUM_LABEL_SLOWMOTION_HOLD: + snprintf(s, len, + "Hold for slowmotion."); + break; + case MENU_ENUM_LABEL_FRAME_ADVANCE: + snprintf(s, len, + "Frame advance when content is paused."); + break; + case MENU_ENUM_LABEL_BSV_RECORD_TOGGLE: + snprintf(s, len, + "Toggle between recording and not."); + break; + case MENU_ENUM_LABEL_L_X_PLUS: + case MENU_ENUM_LABEL_L_X_MINUS: + case MENU_ENUM_LABEL_L_Y_PLUS: + case MENU_ENUM_LABEL_L_Y_MINUS: + case MENU_ENUM_LABEL_R_X_PLUS: + case MENU_ENUM_LABEL_R_X_MINUS: + case MENU_ENUM_LABEL_R_Y_PLUS: + case MENU_ENUM_LABEL_R_Y_MINUS: + snprintf(s, len, + "Axis for analog stick (DualShock-esque).\n" + " \n" + "Bound as usual, however, if a real analog \n" + "axis is bound, it can be read as a true analog.\n" + " \n" + "Positive X axis is right. \n" + "Positive Y axis is down."); + break; + case MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC: + snprintf(s, len, + "RetroArch by itself does nothing. \n" + " \n" + "To make it do things, you need to \n" + "load a program into it. \n" + "\n" + "We call such a program 'Libretro core', \n" + "or 'core' in short. \n" + " \n" + "To load a core, select one from\n" + "'Load Core'.\n" + " \n" +#ifdef HAVE_NETWORKING + "You can obtain cores in several ways: \n" + "* Download them by going to\n" + "'%s' -> '%s'.\n" + "* Manually move them over to\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) +#else + "You can obtain cores by\n" + "manually moving them over to\n" + "'%s'.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH) +#endif + ); + break; + case MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC: + snprintf(s, len, + "You can change the virtual gamepad overlay\n" + "by going to '%s' -> '%s'." + " \n" + "From there you can change the overlay,\n" + "change the size and opacity of the buttons, etc.\n" + " \n" + "NOTE: By default, virtual gamepad overlays are\n" + "hidden when in the menu.\n" + "If you'd like to change this behavior,\n" + "you can set '%s' to false.", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU) + ); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE: + snprintf(s, len, + "Enables a background color for the OSD."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED: + snprintf(s, len, + "Sets the red value of the OSD background color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN: + snprintf(s, len, + "Sets the green value of the OSD background color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE: + snprintf(s, len, + "Sets the blue value of the OSD background color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY: + snprintf(s, len, + "Sets the opacity of the OSD background color. Valid values are between 0.0 and 1.0."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED: + snprintf(s, len, + "Sets the red value of the OSD text color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN: + snprintf(s, len, + "Sets the green value of the OSD text color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE: + snprintf(s, len, + "Sets the blue value of the OSD text color. Valid values are between 0 and 255."); + break; + case MENU_ENUM_LABEL_MIDI_DRIVER: + snprintf(s, len, + "MIDI driver to use."); + break; + case MENU_ENUM_LABEL_MIDI_INPUT: + snprintf(s, len, + "Sets the input device (driver specific).\n" + "When set to \"Off\", MIDI input will be disabled.\n" + "Device name can also be typed in."); + break; + case MENU_ENUM_LABEL_MIDI_OUTPUT: + snprintf(s, len, + "Sets the output device (driver specific).\n" + "When set to \"Off\", MIDI output will be disabled.\n" + "Device name can also be typed in.\n" + " \n" + "When MIDI output is enabled and core and game/app support MIDI output,\n" + "some or all sounds (depends on game/app) will be generated by MIDI device.\n" + "In case of \"null\" MIDI driver this means that those sounds won't be audible."); + break; + case MENU_ENUM_LABEL_MIDI_VOLUME: + snprintf(s, len, + "Sets the master volume of the output device."); + break; + default: + if (string_is_empty(s)) + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len); + return -1; + } + + return 0; +} +#endif + +#ifdef HAVE_MENU +static const char *menu_hash_to_str_el_label_enum(enum msg_hash_enums msg) +{ + if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && + msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN) + { + static char hotkey_lbl[128] = {0}; + unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN; + snprintf(hotkey_lbl, sizeof(hotkey_lbl), "input_hotkey_binds_%d", idx); + return hotkey_lbl; + } + + switch (msg) + { +#include "msg_hash_lbl.h" + default: +#if 0 + RARCH_LOG("Unimplemented: [%d]\n", msg); +#endif + break; + } + + return "null"; +} +#endif + +const char *msg_hash_to_str_el(enum msg_hash_enums msg) { +#ifdef HAVE_MENU + const char *ret = menu_hash_to_str_el_label_enum(msg); + + if (ret && !string_is_equal(ret, "null")) + return ret; +#endif + + switch (msg) { +#include "msg_hash_el.h" + default: +#if 0 + RARCH_LOG("Unimplemented: [%d]\n", msg); + { + RARCH_LOG("[%d] : %s\n", msg - 1, msg_hash_to_str(((enum msg_hash_enums)(msg - 1)))); + } +#endif + break; + } + + return "null"; +} diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h new file mode 100644 index 0000000000..7d5f31b053 --- /dev/null +++ b/intl/msg_hash_el.h @@ -0,0 +1,7677 @@ +MSG_HASH( + MSG_COMPILER, + "Μεταγλωττιστής" + ) +MSG_HASH( + MSG_UNKNOWN_COMPILER, + "Άγνωστος Μεταγλωττιστής" + ) +MSG_HASH( + MSG_NATIVE, + "Native" + ) +MSG_HASH( + MSG_DEVICE_DISCONNECTED_FROM_PORT, + "Η συσκευή αποσυνδέθηκε από την θύρα" + ) +MSG_HASH( + MSG_UNKNOWN_NETPLAY_COMMAND_RECEIVED, + "Λήφθηκε άγνωστη εντολή netplay" + ) +MSG_HASH( + MSG_FILE_ALREADY_EXISTS_SAVING_TO_BACKUP_BUFFER, + "Το αρχείο υπάρχει ήδη. Αποθήκευση σε εφεδρική ενδιάμεση μνήμη." + ) +MSG_HASH( + MSG_GOT_CONNECTION_FROM, + "Λήφθηκε σύνδεση από: \"%s\"" + ) +MSG_HASH( + MSG_GOT_CONNECTION_FROM_NAME, + "Λήφθηκε σύνδεση από: \"%s (%s)\"" + ) +MSG_HASH( + MSG_PUBLIC_ADDRESS, + "Δημόσια διεύθυνση" + ) +MSG_HASH( + MSG_NO_ARGUMENTS_SUPPLIED_AND_NO_MENU_BUILTIN, + "Δεν παρασχέθηκε διαφωνία και δεν υπάρχει ενσωματωμένο μενού, εμφάνιση βοήθειας..." + ) +MSG_HASH( + MSG_SETTING_DISK_IN_TRAY, + "Τοποθέτηση δίσκου στην μονάδα δίσκου" + ) +MSG_HASH( + MSG_WAITING_FOR_CLIENT, + "Αναμονή για πελάτη ..." + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME, + "Αποσυνδεθήκατε από το παιχνίδι" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, + "Έχετε συνδεθεί ως παίκτης %u" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_WITH_INPUT_DEVICES_S, + "Έχετε συνδεθεί με συσκευές εισόδου %.*s" + ) +MSG_HASH( + MSG_NETPLAY_PLAYER_S_LEFT, + "Ο παίκτης %.*s αποσυνδέθηκε από το παιχνίδι" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_AS_PLAYER_N, + "%.*s συνδέθηκε ως παίκτης %u" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_WITH_INPUT_DEVICES_S, + "%.*s συνδέθηκε με συσκευές εισόδου %.*s" + ) +MSG_HASH( + MSG_NETPLAY_NOT_RETROARCH, + "Η προσπάθεια σύνδεσης netplay απέτυχε επειδή ο συμπέκτης δεν χρησιμοποιεί το RetroArch ή χρησιμοποιεί πιο παλιά έκδοση." + ) +MSG_HASH( + MSG_NETPLAY_OUT_OF_DATE, + "Ο συμπαίκτης χρησιμοποιεί πιο παλιά έκδοση RetroArch. Αδύνατη η σύνδεση." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_VERSIONS, + "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Ο συμπαίκτης netplay χρησιμοποιεί διαφορετική έκδοση του RetroArch. Εάν προκύψουν προβλήματα χρησιμοποιήστε την ίδια έκδοση." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORES, + "Ο συμπαίκτης netplay χρησιμοποιεί διαφορειτκό πυρήνα. Αδύνατη η σύνδεση." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORE_VERSIONS, + "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Ο συμπαίκτης netplay χρησιμοποιεί διαφορετική έκδοση του πυρήνα. Εάν προκύψουν προβλήματα χρησιμοποιήστε την ίδια έκδοση." + ) +MSG_HASH( + MSG_NETPLAY_ENDIAN_DEPENDENT, + "Αυτός ο πυρήνας δεν υποστηρίζει σύνδεση διαφορετικών πλατφόρμων για netplay ανάμεσα σε αυτά τα συστήματα" + ) +MSG_HASH( + MSG_NETPLAY_PLATFORM_DEPENDENT, + "Αυτός ο πυρήνας δεν υποστηρίζει σύνδεση διαφορετικών πλατφόρμων για netplay" + ) +MSG_HASH( + MSG_NETPLAY_ENTER_PASSWORD, + "Εισάγετε κωδικό διακομιστή netplay:" + ) +MSG_HASH( + MSG_NETPLAY_INCORRECT_PASSWORD, + "Λάθος κωδικός" + ) +MSG_HASH( + MSG_NETPLAY_SERVER_NAMED_HANGUP, + "\"%s\" αποσυνδέθηκε" + ) +MSG_HASH( + MSG_NETPLAY_SERVER_HANGUP, + "Ένας πελάτης netplay έχει αποσυνδεθεί" + ) +MSG_HASH( + MSG_NETPLAY_CLIENT_HANGUP, + "Αποσύνδεση netplay" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_UNPRIVILEGED, + "Δεν έχετε άδεια για να παίξετε" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS, + "Δεν υπάρχουν κενές θέσεις παικτών" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE, + "Οι συσκευές εισόδου που ζητήθηκαν δεν είναι διαθέσιμες" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY, + "Δεν μπορεί να γίνει αλλαγή σε κατάσταση παιχνιδιού" + ) +MSG_HASH( + MSG_NETPLAY_PEER_PAUSED, + "Ο συμπαίκτης netplay \"%s\" έκανε παύση" + ) +MSG_HASH( + MSG_NETPLAY_CHANGED_NICK, + "Το ψευδώνυμο σας άλλαξε σε \"%s\"" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, + "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SETTINGS, + "Προσαρμόζει τις εμφανισιακές ρυθμίσεις της οθόνης του μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, + "Σκληρός συγχρονισμός επεξεργαστή και κάρτας γραφικών. Μειώνει την καθυστέρηση με τίμημα την επίδοση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_THREADED, + "Βελτιώνει την επίδοση με τίμημα την καθυστέρηση και περισσότερα κολλήματα στο βίντεο. Χρησιμοποιείστε μόνο εάν δεν μπορείτε να αποκτήσετε πλήρη ταχύτητα με άλλον τρόπο." + ) +MSG_HASH( + MSG_AUDIO_VOLUME, + "Ένταση ήχου" + ) +MSG_HASH( + MSG_AUTODETECT, + "Αυτόματη ανίχνευση" + ) +MSG_HASH( + MSG_AUTOLOADING_SAVESTATE_FROM, + "Αυτόματη φόρτωση κατάστασης αποθήκευσης από" + ) +MSG_HASH( + MSG_CAPABILITIES, + "Ικανότητες" + ) +MSG_HASH( + MSG_CONNECTING_TO_NETPLAY_HOST, + "Σύνδεση με εξυπηρετητή netplay" + ) +MSG_HASH( + MSG_CONNECTING_TO_PORT, + "Σύνδεση στην θύρα" + ) +MSG_HASH( + MSG_CONNECTION_SLOT, + "Θέση σύνδεσης" + ) +MSG_HASH( + MSG_SORRY_UNIMPLEMENTED_CORES_DONT_DEMAND_CONTENT_NETPLAY, + "Συγγνώμη, μη εφαρμοσμένο: πυρήνες που δεν απαιτούν περιεχόμενο δεν μπορούν να συμμετέχουν στο netplay." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_PASSWORD, + "Κωδικός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_SETTINGS, + "Επιτεύγματα Λογαριασμού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME, + "Όνομα Χρήστη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST, + "Λογαριασμοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST_END, + "Accounts List Endpoint" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_RETRO_ACHIEVEMENTS, + "RetroAchievements" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST, + "Επιτεύγματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_PAUSE, + "Παύση Σκληροπυρηνικής Λειτουργίας Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_RESUME, + "Συνέχιση Σκληροπυρηνικής Λειτουργίας Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE, + "Επιτεύγματα (Σκληροπυρηνικά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST, + "Σάρωση Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATIONS_LIST, + "Διαμορφώσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TAB, + "Εισαγωγή περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, + "Δωμάτια Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ASK_ARCHIVE, + "Ερώτηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY, + "Εργαλεία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_BLOCK_FRAMES, + "Φραγή Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DEVICE, + "Συσκευή Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DRIVER, + "Οδηγός Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DSP_PLUGIN, + "Πρόσθετο Ήχου DSP" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE, + "Ενεργοποίηση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR, + "Φίλτρα Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TURBO_DEADZONE_LIST, + "Turbo/Νεκρή Ζώνη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_LATENCY, + "Καθυστέρηση Ήχου (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW, + "Μέγιστη Χρονική Διαστρέβλωση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MUTE, + "Σίγαση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, + "Συχνότητα Εξόδου Ήχου (Hz)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RATE_CONTROL_DELTA, + "Δυναμικός Έλεγχος Βαθμού Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER, + "Οδηγός Επαναδειγματολήπτη Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS, + "Ήχος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_SYNC, + "Συγχρονισμός Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME, + "Ένταση Ήχου (dB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_EXCLUSIVE_MODE, + "Αποκλειστική Λειτουργία WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_FLOAT_FORMAT, + "Ασταθής Μορφή WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_SH_BUFFER_LENGTH, + "Μήκος Κοινόχρηστης Ενδιάμεσης Μνήμης WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, + "Διάστημα Αυτόματης Αποθήκευσης SaveRAM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, + "Φόρτωση Αρχείων Παράκαμψης Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_REMAPS_ENABLE, + "Φόρτωση Αρχείων Αναδιοργάνωσης Πλήτρκων Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE, + "Φόρτωση Προεπιλογών Σκιάσεων Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, + "Πίσω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM, + "Επιβεβαίωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT, + "Έξοδος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN, + "Μετακίνηση Προς Τα Κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP, + "Μετακίνηση Προς Τα Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START, + "Εκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD, + "Ενεργοποίηση/Απενεργοποίηση Πληκτρολογίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU, + "Ενεργοποίηση/Απενεργοποίηση Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS, + "Βασικός χειρισμός μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_CONFIRM, + "Επιβεβαίωση/ΟΚ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_INFO, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_QUIT, + "Έξοδος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_SCROLL_UP, + "Μετακίνηση Προς Τα Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_START, + "Προεπιλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_KEYBOARD, + "Ενεργοποίηση/Απενεργοποίηση Πληκτρολογίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_MENU, + "Ενεργοποίηση/Απενεργοποίηση Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BLOCK_SRAM_OVERWRITE, + "Απενεργοποίηση αντικατάστασης SaveRAM κατά την φάση φόρτωσης κατάστασης αποθήκευσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BLUETOOTH_ENABLE, + "Ενεργοποίηση Bluetooth" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BUILDBOT_ASSETS_URL, + "Σύνδεσμος Εργαλείων του Buildbot" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, + "Κρυφή Μνήμη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CAMERA_ALLOW, + "Επίτρεψη Κάμερας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER, + "Οδηγός Κάμερας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT, + "Απάτη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_CHANGES, + "Εφαρμογή Αλλαγών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_SEARCH, + "Έναρξη Αναζήτησης Για Νέους Κωδικούς Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CONTINUE_SEARCH, + "Συνέχιση Αναζήτησης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH, + "Αρχεία Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE, + "Αρχείο Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD, + "Φόρτωση Αρχείου Απάτης (Αντικατάσταση)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD_APPEND, + "Φόρτωση Αρχείου Απάτης (Προσάρτηση)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS, + "Αποθήκευση Αρχείου Απάτης Ως" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_NUM_PASSES, + "Φορές Περάσματος Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_DESCRIPTION, + "Περιγραφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_HARDCORE_MODE_ENABLE, + "Σκληροπυρηνική Λειτουργία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LEADERBOARDS_ENABLE, + "Κατατάξεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_BADGES_ENABLE, + "Εμβλήματα Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ACHIEVEMENTS, + "Κλειδωμένα Επιτεύγματα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY, + "Κλειδωμένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_SETTINGS, + "RetroAchievements" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_TEST_UNOFFICIAL, + "Δοκιμή Ανεπίσημων Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS, + "Ξεκλειδωμένα Επιτεύγματα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY, + "Ξεκλείδωτο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, + "Σκληροπυρηνικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_VERBOSE_ENABLE, + "Βερμπαλιστική Λειτουργία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_AUTO_SCREENSHOT, + "Αυτόματο Στιγμιότυπο Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT, + "Κλείσιμο Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIG, + "Διαμόρφωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATIONS, + "Φόρτωση Διαμορφώσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS, + "Διαμόρφωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT, + "Απόθηκευση Διαμόρφωσης με την Έξοδο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST, + "Συλλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY, + "Βάσεις Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_DIR, + "Περιεχόμενο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, + "Μέγεθος Λίστας Ιστορικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, + "Επίτρεψη αφαίρεσης καταχωρήσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, + "Γρήγορο Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIR, + "Λήψεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY, + "Λήψεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS, + "Απάτες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_COUNTERS, + "Μετρητές Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_ENABLE, + "Εμφάνιση ονόματος πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFORMATION, + "Πληροφορίες πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS, + "Δημιουργοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES, + "Κατηγορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_LABEL, + "Επιγραφή πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_NAME, + "Όνομα πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE, + "Firmware(s)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES, + "Άδεια(ες)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS, + "Άδειες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS, + "Υποστηριζόμενες επεκτάσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_MANUFACTURER, + "Κατασκευαστής συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_NAME, + "Όνομα συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS, + "Χειρισμοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_LIST, + "Φόρτωση Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_OPTIONS, + "Επιλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_SETTINGS, + "Πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_SET_SUPPORTS_NO_CONTENT_ENABLE, + "Αυτόματη Έναρξη Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, + "Αυτόματη εξαγωγή ληφθέντος συμπιεσμένου αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_BUILDBOT_URL, + "Σύνδεσμος Buildbot Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST, + "Ενημέρωση Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_SETTINGS, + "Ενημερωτής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CPU_ARCHITECTURE, + "Αρχιτεκτονική Επεξεργαστή:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CPU_CORES, + "Πυρήνες Επεξεργαστή:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY, + "Δρομείς" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CURSOR_MANAGER, + "Διαχειριστής Δρομέα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CUSTOM_RATIO, + "Πρωτιμώμενη Αναλογία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER, + "Διαχειριστής Βάσης Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_SELECTION, + "Επιλογή Βάσης Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DELETE_ENTRY, + "Κατάργηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FAVORITES, + "Ευρετήριο έναρξης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, + "<Ευρετήριο περιεχομένων>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, + "<Προκαθορισμένο>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, + "<Κανένα>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, + "Το ευρετήριο δεν βρέθηκε." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, + "Ευρετήρια" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, + "Disk Cycle Tray Status" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, + "Disk Image Append" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_INDEX, + "Disk Index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, + "Disk Control" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DONT_CARE, + "Don't care" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST, + "Λήψεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE, + "Λήψη Πυρήνα..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT, + "Λήψη Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_ENABLE, + "DPI Override Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE, + "DPI Override" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS, + "Οδηγοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN, + "Φόρτωση Dummy στο Κλείσιμο Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHECK_FOR_MISSING_FIRMWARE, + "Έλεγχος για απών Firmware Πριν την Φόρτωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, + "Δυναμικό Φόντο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, + "Δυναμικά Φόντα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_ENABLE, + "Ενεργοποίηση Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, + "Χρώμα καταχώρησης μενού όταν το ποντίκι βρίσκεται από πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, + "Χρώμα καταχώρησης μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FALSE, + "Ψευδές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, + "Μέγιστη Ταχύτητα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, + "Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FPS_SHOW, + "Προβολή Ρυθμού Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, + "Περιορισμός Μέγιστης Ταχύτητας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VRR_RUNLOOP_ENABLE, + "Συγχρονισμός με τον Ακριβή Ρυθμό Καρέ του Περιεχομένου (G-Sync, FreeSync)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS, + "Περιορισμός Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, + "Frontend Counters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS, + "Φόρτωση Επιλογών Πυρήνα Βάση Συγκεκριμένου Περιεχομένου Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE, + "Δημιουργία αρχείου επιλογών παιχνιδιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE, + "Αποθήκευση αρχείου επιλογών παιχνιδιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP, + "Βοήθεια" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING, + "Αντιμετώπιση Προβλημάτων Ήχου/Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD, + "Αλλαγή Επικαλύμματος Εικονικού Χειριστηρίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_CONTROLS, + "Βασικός Χειρισμός Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_LIST, + "Βοήθεια" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_LOADING_CONTENT, + "Φόρτωση Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT, + "Σάρωση Για Περιεχόμενο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_WHAT_IS_A_CORE, + "Τι Είναι Ο Πυρήνας;" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HISTORY_LIST_ENABLE, + "Ενεργοποίηση Λίστας Ιστορικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HISTORY_TAB, + "Ιστορικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU, + "Οριζόντιο Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_IMAGES_TAB, + "Εικόνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INFORMATION, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INFORMATION_LIST, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE, + "Τύπος Αναλογικού Σε Ψηφιακό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU, + "Όλοι Οι Χρήστες Χειρίζονται Το Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X, + "Αριστερό Αναλογικό X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_MINUS, + "Αριστερό Αναλογικό X- (αριστερά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_PLUS, + "Αριστερό Αναλογικό X+ (δεξιά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y, + "Αριστερό Αναλογικό Y" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_MINUS, + "Αριστερό Αναλογικό Y- (πάνω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_PLUS, + "Αριστερό Αναλογικό Y+ (κάτω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X, + "Δεξί Αναλογικό X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_MINUS, + "Δεξί Αναλογικό X- (αριστερά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_PLUS, + "Δεξί Αναλογικό X+ (δεξιά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y, + "Δεξί Αναλογικό Y" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_MINUS, + "Δεξί Αναλογικό Y- (πάνω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_PLUS, + "Δεξί Αναλογικό Y+ (κάτω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_TRIGGER, + "Σκανδάλη Όπλου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_RELOAD, + "Γέμισμα Όπλου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_A, + "Όπλο Aux A" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_B, + "Όπλο Aux B" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_C, + "Όπλο Aux C" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_START, + "Όπλο Start" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_SELECT, + "Όπλο Select" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_UP, + "Όπλο D-pad Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_DOWN, + "Όπλο D-pad Κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_LEFT, + "Όπλο D-pad Αριστερά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_RIGHT, + "Όπλο D-pad Δεξιά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, + "Ενεργοποίηση Αυτόματης Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, + "Νεκρή Ζώνη Αναλογικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, + "Εναλλαγή Κουμπιών Επιβεβαίωσης & Ακύρωσης Στο Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, + "Σύνδεση Όλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL, + "Επαναφορά Συνδέσεων Όλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT, + "Λήξη Χρόνου Σύνδεσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_HOLD, + "Κράτημα Σύνδεσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_HIDE_UNBOUND, + "Hide Unbound Core Input Descriptors" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_LABEL_SHOW, + "Display Input Descriptor Labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX, + "Κατάλογος Συσκευών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE, + "Τύπος Συσκευής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX, + "Κατάλογος Ποντικιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DRIVER, + "Οδηγός Εισαγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DUTY_CYCLE, + "Duty Cycle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_BINDS, + "Input Hotkey Binds" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ICADE_ENABLE, + "Keyboard Gamepad Mapping Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_A, + "Κουμπί A (δεξιά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B, + "Κουμπί B (κάτω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_DOWN, + "D-pad κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L2, + "Κουμπί L2 (σκανδάλι)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L3, + "Κουμπί L3 (αντίχειρας)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L, + "Κουμπί L (πίσω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_LEFT, + "D-pad αριστερό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R2, + "Κουμπί R2 (σκανδάλι)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R3, + "Κουμπί R3 (αντίχειρας)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R, + "Κουμπί R (πίσω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_RIGHT, + "D-pad δεξί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_SELECT, + "Κουμπί Select" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_START, + "Κουμπί Start" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_UP, + "D-pad πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_X, + "Κουμπί X (πάνω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_Y, + "Κουμπί Y (αριστερό)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_KEY, + "(Κουμπί: %s)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_LEFT, + "Ποντίκι 1" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_RIGHT, + "Ποντίκι 2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_MIDDLE, + "Ποντίκι 3" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON4, + "Ποντίκι 4" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON5, + "Ποντίκι 5" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_UP, + "Ροδέλα Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_DOWN, + "Ροδέλα Κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_UP, + "Ροδέλα Αριστερά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_DOWN, + "Ροδέλα Δεξιά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE, + "Keyboard Gamepad Mapping Type" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS, + "Μέγιστοι Χρήστες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Συνδιασμός Πλήκτρων Χειριστηρίου για Άνοιγμα Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, + "Cheat index -" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_PLUS, + "Cheat index +" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_TOGGLE, + "Cheat toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_EJECT_TOGGLE, + "Disk eject toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, + "Disk next" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, + "Disk prev" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, + "Ενεργοποίηση πλήκτρων εντολών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_HOLD_KEY, + "Fast forward hold" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_KEY, + "Fast forward toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, + "Frameadvance" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, + "Πλήρης οθόνη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, + "Grab mouse toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, + "Game focus toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, + "Desktop menu toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, + "Load state" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, + "Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_BSV_RECORD_TOGGLE, + "Input replay movie record toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, + "Σίγαση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, + "Netplay toggle play/spectate mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, + "Πληκτρολόγιο οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, + "Overlay next" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, + "Παύση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Έξοδος από το RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, + "Reset game" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, + "Επιστροφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_DETAILS, + "Λεπτομέρειες Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_SEARCH, + "Start or Continue Cheat Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, + "Save state" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, + "Λήψη Στιγμιότυπου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, + "Επόμενη σκίαση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, + "Προηγούμενη σκίαση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_HOLD_KEY, + "Παύση αργής κίνησης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_KEY, + "Αργή κίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, + "Savestate slot -" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, + "Savestate slot +" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, + "Ένταση -" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, + "Ένταση +" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, + "Display Overlay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, + "Hide Overlay In Menu" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "Show Inputs On Overlay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "Show Inputs Listen Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, + "Poll Type Behavior" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, + "Early" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, + "Late" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, + "Normal" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_PREFER_FRONT_TOUCH, + "Prefer Front Touch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, + "Input Remapping" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, + "Remap Binds Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG, + "Αποθήκευση Αυτόματης Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS, + "Εισαγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE, + "Ενεργοποίηση Μικρού Πληκτρολογίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_TOUCH_ENABLE, + "Ενεργοποίηση Αφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_TURBO_ENABLE, + "Ενεργοποίηση Turbo" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, + "Turbo Period" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS, + "Σύνδεση Πλήκτρων Εισόδου Χρήστη %u" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LATENCY_SETTINGS, + "Καθυστέρηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INTERNAL_STORAGE_STATUS, + "Internal storage status" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, + "Input Autoconfig" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_JOYPAD_DRIVER, + "Οδηγός Joypad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LAKKA_SERVICES, + "Υπηρεσίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_CHINESE_SIMPLIFIED, + "Chinese (Simplified)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_CHINESE_TRADITIONAL, + "Chinese (Traditional)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_DUTCH, + "Dutch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ENGLISH, + "English" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ESPERANTO, + "Esperanto" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_FRENCH, + "French" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_GERMAN, + "German" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ITALIAN, + "Italian" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_JAPANESE, + "Japanese" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_KOREAN, + "Korean" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_POLISH, + "Polish" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_BRAZIL, + "Portuguese (Brazil)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_PORTUGAL, + "Portuguese (Portugal)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_RUSSIAN, + "Russian" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_SPANISH, + "Spanish" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, + "Vietnamese" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_GREEK, + "Ελληνικά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, + "Αριστερό Αναλογικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, + "Πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, + "Πληροφορίες Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LIBRETRO_LOG_LEVEL, + "Core Logging Level" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LINEAR, + "Γραμμικός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_ARCHIVE, + "Φόρτωση Αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY, + "Φόρτωση Πρόσφατου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST, + "Φόρτωση Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_STATE, + "Φόρτωση Κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOCATION_ALLOW, + "Επίτρεψη Τοποθεσίας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER, + "Οδηγός Τοποθεσίας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOGGING_SETTINGS, + "Αρχείο Καταγραφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOG_VERBOSITY, + "Logging Verbosity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MAIN_MENU, + "Κεντρικό Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MANAGEMENT, + "Ρυθμίσεις Βάσης Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME, + "Χρώμα Θέματος Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE, + "Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE_GREY, + "Μπλε Γκρι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_DARK_BLUE, + "Σκούρο Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_GREEN, + "Πράσινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_NVIDIA_SHIELD, + "Shield" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED, + "Κόκκινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW, + "Κίτρινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_FOOTER_OPACITY, + "Footer Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY, + "Header Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_DRIVER, + "Οδηγός Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE, + "Throttle Menu Framerate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, + "Ρυθμίσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, + "Menu Linear Filter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, + "Εμφάνιση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, + "Φόντο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY, + "Background opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MISSING, + "Λείπει" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MORE, + "..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MOUSE_ENABLE, + "Υποστήριξη Ποντικιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MULTIMEDIA_SETTINGS, + "Πολυμέσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MUSIC_TAB, + "Μουσική" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, + "Φιλτράρισμα άγνωστων επεκτάσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NAVIGATION_WRAPAROUND, + "Navigation Wrap-Around" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NEAREST, + "Κοντινότερο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY, + "Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ALLOW_SLAVES, + "Allow Slave-Mode Clients" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, + "Netplay Check Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "Input Latency Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "Input Latency Frames Range" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, + "Netplay Delay Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, + "Disconnect from netplay host" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, + "Ενεργοποίηση Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, + "Σύνδεση σε οικοδεσπότη netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, + "Έναρξη netplay ως οικοδεσπότης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Λήξη netplay ως οικοδεσπότης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, + "Διέυθυνση Διακομιστή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, + "Σάρωση τοπικού δικτύου Scan local network" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, + "Netplay Client Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_NICKNAME, + "Όνομα Χρήστη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, + "Κωδικός Διακομιστή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_PUBLIC_ANNOUNCE, + "Δημόσια Ανακοίνωση Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_REQUEST_DEVICE_I, + "Request Device %u" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_REQUIRE_SLAVES, + "Disallow Non-Slave-Mode Clients" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, + "Ρυθμίσεις Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG, + "Analog Input Sharing" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_MAX, + "Μέγιστο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_AVERAGE, + "Μέσος Όρος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL, + "Digital Input Sharing" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_OR, + "Κοινοποίηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_XOR, + "Grapple" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_VOTE, + "Ψήφος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NONE, + "Κανείς" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NO_PREFERENCE, + "Καμία προτίμηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_START_AS_SPECTATOR, + "Netplay Spectator Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_STATELESS_MODE, + "Netplay Stateless Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATE_PASSWORD, + "Server Spectate-Only Password" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATOR_MODE_ENABLE, + "Netplay Spectator Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_TCP_UDP_PORT, + "Netplay TCP Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_NAT_TRAVERSAL, + "Netplay NAT Traversal" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_CMD_ENABLE, + "Network Commands" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_CMD_PORT, + "Network Command Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION, + "Πληροφορίες Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_ENABLE, + "Χειριστήριο Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_PORT, + "Network Remote Base Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_SETTINGS, + "Δίκτυο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO, + "Όχι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NONE, + "Τίποτα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE, + "Μ/Δ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY, + "Δεν υπάρχουν επιτεύγματα προς προβολή." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORE, + "Κανένας Πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE, + "Δεν υπάρχουν διαθέσιμοι πυρήνες." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORE_INFORMATION_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες πληροφορίες πυρήνα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες επιλογές πυρήνα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY, + "Δεν υπάρχουν καταχωρήσεις προς εμφάνιση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_HISTORY_AVAILABLE, + "Δεν υπάρχει διαθέσιμο ιστορικό." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες πληροφορίες." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_ITEMS, + "Δεν υπάρχουν αντικείμενα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_NETPLAY_HOSTS_FOUND, + "Δεν βρέθηκαν εξυπηρετητές netplay." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_NETWORKS_FOUND, + "Δεν βρέθηκαν δίκτυα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS, + "No performance counters." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_PLAYLISTS, + "Δεν βρέθηκαν λίστες αναπαραγωγής." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες καταχωρήσεις στην λίστα αναπαραγωγής." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, + "Δεν βρέθηκαν ρυθμίσεις." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, + "Δεν βρέθηκαν παράμετροι σκίασης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OFF, + "OFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ON, + "ON" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONLINE, + "Online" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER, + "Διαδικτυακός Ενημερωτής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, + "Οθόνη Απεικόνισης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, + "Επικάλλυμα Οθόνης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS, + "Adjust Bezels and Onscreen controls" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, + "Ειδοποιήσεις Οθόνης Απεικόνισης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, + "Adjust the Onscreen Notifications" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, + "Περιήγηση Αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OPTIONAL, + "Προεραιτικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY, + "Επικάλλυμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, + "Autoload Preferred Overlay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, + "Επικάλλυμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, + "Overlay Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_PRESET, + "Overlay Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE, + "Overlay Scale" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, + "Onscreen Overlay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, + "Use PAL60 Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, + "Προηγούμενο ευρετήριο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO, + "Παύση όταν ενεργοποιείται το μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PAUSE_NONACTIVE, + "Μην εκτελείτε στο παρασκήνιο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PERFCNT_ENABLE, + "Performance Counters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB, + "Λίστες Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, + "Λίστα Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, + "Λίστες Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, + "Υποστήριξη Αφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PORT, + "Θύρα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PRESENT, + "Present" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, + "Ιδιωτικότητα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, + "MIDI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, + "Έξοδος από RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, + "Analog supported" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_BBFC_RATING, + "BBFC Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CERO_RATING, + "CERO Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_COOP, + "Co-op supported" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CRC32, + "CRC32" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION, + "Description" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DEVELOPER, + "Developer" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_ISSUE, + "Edge Magazine Issue" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_RATING, + "Edge Magazine Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_REVIEW, + "Edge Magazine Review" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ELSPA_RATING, + "ELSPA Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ENHANCEMENT_HW, + "Enhancement Hardware" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ESRB_RATING, + "ESRB Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FAMITSU_MAGAZINE_RATING, + "Famitsu Magazine Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FRANCHISE, + "Franchise" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE, + "Genre" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_MD5, + "MD5" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME, + "Όνομα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ORIGIN, + "Origin" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PEGI_RATING, + "PEGI Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PUBLISHER, + "Publisher" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_MONTH, + "Releasedate Month" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_YEAR, + "Releasedate Year" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RUMBLE, + "Rumble supported" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL, + "Serial" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SHA1, + "SHA1" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, + "Έναρξη Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, + "TGDB Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REBOOT, + "Επανεκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, + "Recording Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, + "Recording Output" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORDING_SETTINGS, + "Εγγραφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, + "Custom Record Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, + "Custom Stream Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, + "Οδηγός Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_DRIVER, + "Οδηγός MIDI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_ENABLE, + "Enable Recording" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_PATH, + "Save Output Recording as..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, + "Save Recordings in Output Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE, + "Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_LOAD, + "Load Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CORE, + "Save Core Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CONTENT_DIR, + "Save Content Directory Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_GAME, + "Save Game Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CORE, + "Delete Core Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_GAME, + "Delete Game Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CONTENT_DIR, + "Delete Game Content Directory Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REQUIRED, + "Απαραίτητο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESTART_CONTENT, + "Επανεκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESTART_RETROARCH, + "Επανεκκίνηση RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESUME, + "Συνέχιση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESUME_CONTENT, + "Συνέχιση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETROKEYBOARD, + "RetroKeyboard" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETROPAD, + "RetroPad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETROPAD_WITH_ANALOG, + "RetroPad με Αναλογικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, + "Επιτεύγματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, + "Ενεργοποίηση Επιστροφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_TOGGLE, + "Apply After Toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_LOAD, + "Auto-Apply Cheats During Game Load" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, + "Rewind Granularity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE, + "Rewind Buffer Size (MB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE_STEP, + "Rewind Buffer Size Step (MB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, + "Επιστροφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SETTINGS, + "Ρυθμίσεις Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DETAILS_SETTINGS, + "Λεπτομέρειες Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_SETTINGS, + "Έναρξη ή Συνέχιση Αναζήτησης Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, + "Περιηγητής Αρχείων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, + "Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, + "Εμφάνιση Αρχικής Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, + "Δεξί Αναλογικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, + "Προσθήκη στα Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, + "Προσθήκη στα Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION, + "Επαναφορά Συσχέτισης Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN, + "Εκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_MUSIC, + "Εκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE, + "Ενεργοποίηση SAMBA" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, + "Αρχείο Αποθήκευσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_INDEX, + "Save State Auto Index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, + "Auto Load State" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, + "Auto Save State" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, + "Savestate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, + "Savestate Thumbnails" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, + "Αποθήκευση Τρέχουσας Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, + "Save Core Overrides" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, + "Save Content Directory Overrides" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, + "Save Game Overrides" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_NEW_CONFIG, + "Αποθήκευση Νέας Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_STATE, + "Κατάσταση Αποθήκευσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, + "Αποθήκευση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY, + "Σάρωση Ευρετηρίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCAN_FILE, + "Σάρωση αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY, + "<Σάρωση Αυτού Του Ευρετηρίου>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, + "Στιγμιότυπο Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, + "Ανάλυση Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SEARCH, + "Αναζήτηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SECONDS, + "δευτερόλεπτα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SETTINGS, + "Ρυθμίσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, + "Ρυθμίσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER, + "Σκίαση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES, + "Εφαμοργή Αλλαγών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS, + "Σκιάσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, + "Κορδέλλα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, + "Κορδέλλα (απλοποιημένη)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SIMPLE_SNOW, + "Απλό Χιόνι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW, + "Χιόνι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHOW_ADVANCED_SETTINGS, + "Εμφάνιση Ρυθμίσεων Για Προχωρημένους" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES, + "Εμφάνιση Κρυφών Αρχείων και Φακέλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHUTDOWN, + "Τερματισμός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO, + "Slow-Motion Ratio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_ENABLED, + "Run-Ahead to Reduce Latency" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_FRAMES, + "Number of Frames to Run Ahead" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_SECONDARY_INSTANCE, + "RunAhead Use Second Instance" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_HIDE_WARNINGS, + "RunAhead Hide Warnings" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE, + "Sort Saves In Folders" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE, + "Sort Savestates In Folders" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATES_IN_CONTENT_DIR_ENABLE, + "Write Savestates to Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVEFILES_IN_CONTENT_DIR_ENABLE, + "Write Saves to Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEMFILES_IN_CONTENT_DIR_ENABLE, + "System Files are in Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCREENSHOTS_IN_CONTENT_DIR_ENABLE, + "Write Screenshots to Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SSH_ENABLE, + "Ενεργοποίηση SSH" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_START_CORE, + "Έναρξη Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, + "Έναρξη Απομακρυσμένου RetroPad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, + "Έναρξη Επεξεργαστή Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STATE_SLOT, + "State Slot" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STATUS, + "Κατάσταση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STDIN_CMD_ENABLE, + "Εντολές stdin" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SUPPORTED_CORES, + "Προτεινόμενοι πυρήνες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE, + "Αναστολή Προφύλαξης Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_BGM_ENABLE, + "System BGM Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY, + "Σύστημα/BIOS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION, + "Πληροφορίες Συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_7ZIP_SUPPORT, + "Υποστήριξη 7zip" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ALSA_SUPPORT, + "Υποστήριξη ALSA" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE, + "Ημερομηνία Κατασκευής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CG_SUPPORT, + "Υποστήριξη Cg" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COCOA_SUPPORT, + "Υποστήριξη Cocoa" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COMMAND_IFACE_SUPPORT, + "Υποστήριξη Γραμμής Εντολών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CORETEXT_SUPPORT, + "Υποστήριξη CoreText" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES, + "Χαρακτηριστικά Επεξεργαστή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_DPI, + "DPI Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_HEIGHT, + "Ύψος Οθόνης (mm)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_WIDTH, + "Πλάτος Οθόνης (mm)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DSOUND_SUPPORT, + "Υποστήριξη DirectSound" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WASAPI_SUPPORT, + "Υποστήριξη WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYLIB_SUPPORT, + "Υποστήριξη δυναμικής βιβλιοθήκης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, + "Dynamic run-time loading of libretro library" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT, + "Υποστήριξη EGL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FBO_SUPPORT, + "Υποστήριξη OpenGL/Direct3D render-to-texture (multi-pass shaders)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FFMPEG_SUPPORT, + "Υποστήριξη FFmpeg" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FREETYPE_SUPPORT, + "Υποστήριξη FreeType" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_STB_TRUETYPE_SUPPORT, + "Υποστήριξη STB TrueType" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER, + "Frontend identifier" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_NAME, + "Frontend name" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_OS, + "Frontend OS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION, + "Έκδοση Git" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GLSL_SUPPORT, + "Υποστήριξη GLSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_HLSL_SUPPORT, + "Υποστήριξη HLSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_JACK_SUPPORT, + "Υποστήριξη JACK" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_KMS_SUPPORT, + "Υποστήριξη KMS/EGL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LAKKA_VERSION, + "Έκδοση Lakka" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBRETRODB_SUPPORT, + "Υποστήριξη LibretroDB" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBUSB_SUPPORT, + "Υποστήριξη Libusb" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBXML2_SUPPORT, + "Υποστήριξη libxml2 XML parsing" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETPLAY_SUPPORT, + "Υποστήριξη Netplay (peer-to-peer)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_COMMAND_IFACE_SUPPORT, + "Υποστήριξη Γραμμής Εντολών Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_REMOTE_SUPPORT, + "Υποστήριξη Χειριστηρίου Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENAL_SUPPORT, + "Υποστήριξη OpenAL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGLES_SUPPORT, + "Υποστήριξη OpenGL ES" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGL_SUPPORT, + "Υποστήριξη OpenGL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENSL_SUPPORT, + "Υποστήριξη OpenSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENVG_SUPPORT, + "Υποστήριξη OpenVG" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OSS_SUPPORT, + "Υποστήριξη OSS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OVERLAY_SUPPORT, + "Υποστήριξη Επικαλλυμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE, + "Πηγή ρεύματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED, + "Φορτισμένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGING, + "Φορτίζει" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING, + "Ξεφορτίζει" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_NO_SOURCE, + "Καμία πηγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PULSEAUDIO_SUPPORT, + "Υποστήριξη PulseAudio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PYTHON_SUPPORT, + "Υποστήριξη Python (script support in shaders)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RBMP_SUPPORT, + "Υποστήριξη BMP (RBMP)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETRORATING_LEVEL, + "Επίπεδο RetroRating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RJPEG_SUPPORT, + "Υποστήριξη JPEG (RJPEG)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ROARAUDIO_SUPPORT, + "Υποστήριξη RoarAudio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RPNG_SUPPORT, + "Υποστήριξη PNG (RPNG)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RSOUND_SUPPORT, + "Υποστήριξη RSound" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RTGA_SUPPORT, + "Υποστήριξη TGA (RTGA)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL2_SUPPORT, + "Υποστήριξη SDL2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_IMAGE_SUPPORT, + "Υποστήριξη Εικόνων SDL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_SUPPORT, + "Υποστήριξη SDL1.2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SLANG_SUPPORT, + "Υποστήριξη Slang" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_THREADING_SUPPORT, + "Υποστήριξη Threading" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_UDEV_SUPPORT, + "Υποστήριξη Udev" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_V4L2_SUPPORT, + "Υποστήριξη Video4Linux2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER, + "Οδηγός video context" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VULKAN_SUPPORT, + "Υποστήριξη Vulkan" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_METAL_SUPPORT, + "Υποστήριξη Metal" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WAYLAND_SUPPORT, + "Υποστήριξη Wayland" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_X11_SUPPORT, + "Υποστήριξη X11" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XAUDIO2_SUPPORT, + "Υποστήριξη XAudio2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XVIDEO_SUPPORT, + "Υποστήριξη XVideo" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT, + "Υποστήριξη Zlib" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT, + "Λήψη Στιγμιότυπου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, + "Threaded tasks" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAILS, + "Σκίτσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LEFT_THUMBNAILS, + "Σκίτσα Αριστερά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_VERTICAL_THUMBNAILS, + "Thumbnails Vertical Disposition" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, + "Σκίτσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST, + "Ενημερωτής Σκίτσων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, + "Εξώφυλλα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS, + "Στιγμιότυπα Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS, + "Οθόνες Τίτλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, + "Εμφάνιση ημερομηνίας / ώρας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE, + "Στυλ ημερομηνίας / ώρας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_STYLE, + "Αλλάζει το στυλ της τρέχουσας ημερομηνίας ή και ώρας που φαίνεται μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + "YYYY-MM-DD HH:MM:SS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, + "YYYY-MM-DD HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, + "MM-DD-YYYY HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, + "HH:MM:SS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, + "HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + "DD/MM HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, + "MM/DD HH:MM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, + "HH:MM:SS (AM/PM)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TITLE_COLOR, + "Χρώμα τίτλου μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TRUE, + "Αληθές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, + "UI Companion Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, + "UI Companion Start On Boot" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE, + "Show desktop menu on startup" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE, + "Enable desktop menu (restart)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, + "Menubar" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, + "Αδυναμία ανάγνωσης συμπιεσμένου αρχείου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, + "Undo Load State" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE, + "Undo Save State" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNKNOWN, + "Άγνωστο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATER_SETTINGS, + "Ενημερωτής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_ASSETS, + "Ενημέρωση Βασικών Στοιχείων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES, + "Ενημέρωση Προφίλ Joypad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, + "Ενημέρωση των Σκιάσεων Cg" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS, + "Ενημέρωση Απατών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, + "Ενημέρωση Αρχείων Πληροφοριών Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES, + "Ενημέρωση Βάσεων Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_GLSL_SHADERS, + "Ενημέρωση Σκιάσεων GLSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_LAKKA, + "Ενημέρωση Lakka" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_OVERLAYS, + "Ενημέρωση Επικαλλυμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_SLANG_SHADERS, + "Ενημέρωση Σκιάσεων Slang" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER, + "Χρήστης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_KEYBOARD, + "Kbd" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS, + "Διεπαφή Χρήστη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER_LANGUAGE, + "Γλώσσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER_SETTINGS, + "Χρήστης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER, + "Χρήση Ενσωματωμένου Προβολέα Εικόνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USE_BUILTIN_PLAYER, + "Χρήση Ενσωματωμένου Αναπαραγωγέα Πολυμέσων Use Builtin Media Player" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, + "<Χρήση αυτού του ευρετηρίου>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, + "Επίτρεψη περιστροφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO, + "Config Aspect Ratio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, + "Auto Aspect Ratio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, + "Aspect Ratio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, + "Black Frame Insertion" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, + "Crop Overscan (Reload)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, + "Disable Desktop Composition" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER, + "Οδηγός Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FILTER, + "Φίλτρο Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR, + "Φίλτρο Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_FLICKER, + "Flicker filter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FONT_ENABLE, + "Enable Onscreen Notifications" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, + "Notification Font" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE, + "Notification Size" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_ASPECT, + "Force aspect ratio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, + "Force-disable sRGB FBO" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, + "Frame Delay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN, + "Start in Fullscreen Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA, + "Video Gamma" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD, + "Use GPU Recording" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_GPU_SCREENSHOT, + "GPU Screenshot Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC, + "Hard GPU Sync" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES, + "Hard GPU Sync Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Max swapchain images" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, + "Notification X Position" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, + "Notification Y Position" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, + "Monitor Index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, + "Use Post Filter Recording" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, + "Vertical Refresh Rate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, + "Estimated Screen Framerate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_POLLED, + "Set Display-Reported Refresh Rate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, + "Περιστροφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, + "Windowed Scale" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, + "Integer Scale" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, + "Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, + "Σκίαση Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, + "Shader Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, + "Shader Parameters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, + "Load Shader Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, + "Save Shader Preset As" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, + "Save Core Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT, + "Save Content Directory Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, + "Save Game Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT, + "Enable Hardware Shared Context" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SMOOTH, + "Bilinear Filtering" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SOFT_FILTER, + "Soft Filter Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SWAP_INTERVAL, + "Vertical Sync (Vsync) Swap Interval" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_TAB, + "Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, + "Threaded Video" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER, + "Deflicker" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + "Custom Aspect Ratio Height" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, + "Custom Aspect Ratio Width" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, + "Custom Aspect Ratio X Pos." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, + "Custom Aspect Ratio Y Pos." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, + "Set VI Screen Width" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, + "Vertical Sync (Vsync)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, + "Windowed Fullscreen Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, + "Window Width" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, + "Window Height" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_X, + "Fullscreen Width" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y, + "Fullscreen Height" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, + "Οδηγός Wi-Fi" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, + "Wi-Fi" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, + "Menu Alpha Factor" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, + "Menu Font Red Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, + "Menu Font Green Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, + "Menu Font Blue Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_FONT, + "Γραμματοσειρά Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_CUSTOM, + "Custom" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_FLATUI, + "FlatUI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME, + "Μονόχρωμο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED, + "Μονόχρωμο Αναστρεμένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_SYSTEMATIC, + "Systematic" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_NEOACTIVE, + "NeoActive" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_PIXEL, + "Pixel" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, + "RetroActive" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROSYSTEM, + "Retrosystem" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, + "Dot-Art" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_AUTOMATIC, + "Automatic" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, + "Χρώμα Θέματος Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, + "Πράσινο Μήλο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK, + "Σκούρο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LIGHT, + "Φωτεινό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MORNING_BLUE, + "Πρωινό Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE, + "Σκούρο Μωβ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE, + "Μπλε Ηλεκτρίκ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN, + "Χρυσαφί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED, + "Legacy Κόκκινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE, + "Μεσωνύκτιο Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_PLAIN, + "Απλό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA, + "Κάτω Από Την Θάλασσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED, + "Ηφαιστιακό Κόκκινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, + "Menu Shader Pipeline" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR, + "Menu Scale Factor" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, + "Ενεργοποίηση Σκιών Εικονιδίων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY, + "Προβολή Καρτέλας Ιστορικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD, + "Προβολή Καρτέλας Εισαγωγής Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS, + "Προβολή Καρτέλας Λίστας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES, + "Προβολή Καρτέλας Αγαπημένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES, + "Προβολή Καρτέλας Εικόνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_MUSIC, + "Προβολή Καρτέλας Μουσικής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS, + "Προβολή Καρτέλας Ρυθμίσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_VIDEO, + "Προβολή Καρτέλας Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_NETPLAY, + "Προβολή Καρτέλας Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_LAYOUT, + "Διάταξη Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_THEME, + "Θέμα Εικόνων Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_YES, + "Ναι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO, + "Shader Preset" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, + "Ενεργοποίηση ή απενεργοποίηση επιτευγμάτων. Για περισσότερες πληροφορίες επισκεφθείτε http://retroachievements.org" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, + "Enable or disable unofficial achievements and/or beta features for testing purposes." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, + "Enable or disable savestates, cheats, rewind, pause, and slow-motion for all games." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, + "Enable or disable in-game leaderboards. Has no effect if Hardcore Mode is disabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, + "Enable or disable badge display in the Achievement List." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, + "Enable or disable OSD verbosity for achievements." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, + "Automatically take a screenshot when an achievement is triggered." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, + "Αλλαγή οδηγών που χρησιμοποιούνται από το σύστημα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, + "Αλλαγή ρυθμίσεων επιτευγμάτων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_SETTINGS, + "Αλλαγή ρυθμίσεων πυρήνα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORDING_SETTINGS, + "Αλλαγή ρυθμίσεων εγγραφής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS, + "Αλλαγή επικάλλυψης οθόνης και επικάλλυψης πληκτρολογίου και ρυθμίσεις ειδοποιήσεων οθόνης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS, + "Αλλαγή ρυθμίσεων επιστροφής, γρήγορης κίνησης και αργής κίνησης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVING_SETTINGS, + "Αλλαγή ρυθμίσεων αποθήκευσης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOGGING_SETTINGS, + "Αλλαγή ρυθμίσεων αρχείου καταγραφής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_USER_INTERFACE_SETTINGS, + "Αλλαγή ρυθμίσεων περιβάλλοντος χρήστη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_USER_SETTINGS, + "Αλλαγή ρυθμίσεων λογαριασμού, ονόματος χρήστη και γλώσσας." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, + "Αλλαγή ρυθμίσεων ιδιοτηκότητας." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_SETTINGS, + "Αλλαγή ρυθμίσεων MIDI." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, + "Αλλαγή προκαθορισμένων ευρετηρίων όπου βρίσκονται τα αρχεία." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, + "Αλλαγή ρυθμίσεων λιστών αναπαραγωγής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, + "Αλλαγή ρυθμίσεων εξυπηρετητή και δικτύου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST, + "Σάρωση περιεχομένου και προσθήκη στην βάση δεδομένων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_SETTINGS, + "Αλλαγή ρυθμίσεων εξόδου ήχου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BLUETOOTH_ENABLE, + "Ενεργοποίηση ή απενεργοποίηση bluetooth." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT, + "Αποθήκευση αλλαγών στο αρχείο διαμόρφωσης κατά την έξοδο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS, + "Αλλαγή προκαθορισμένων ρυθμίσεων των αρχείων διαμόρφωσης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, + "Διαχειρισμός και δημιουργία αρχείων διαμόρφωσης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CPU_CORES, + "Αριθμός πυρήνων που έχει ο επεξεργαστής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FPS_SHOW, + "Εμφανίζει τον τρέχον ρυθμό καρέ ανά δευτερόλεπτο στην οθόνη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, + "Διαμόρφωση ρυθμίσεων πλήκτρων εντολών." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Συνδιασμός κουμπιών χειριστηρίου για την εμφάνιση του μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_SETTINGS, + "Αλλαγή ρυθμίσεων χειριστηρίου, πληκτρολογίου και ποντικιού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, + "Διαμόρφωση χειρισμών για αυτόν τον χρήστη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LATENCY_SETTINGS, + "Αλλαγή ρυθμίσεων συσχετιζόμενες με το βίντεο, τον ήχο και την καθυστέρηση εισαγωγής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOG_VERBOSITY, + "Ενεργοποίηση ή απενεργοποίηση αρχείων καταγραφής στο τερματικό." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY, + "Συμμετοχή ή δημιουργία μίας συνεδρίας netplay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, + "Αναζήτηση για και σύνδεση με οικοδεσπότη netplay στο τοπικό δίκτυο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, + "Εμφάνιση πληροφοριών συστήματος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONLINE_UPDATER, + "Κατεβάστε πρόσθετα, στοιχεία και περιεχόμενο για το RetroArch." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAMBA_ENABLE, + "Enable or disable network sharing of your folders." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SERVICES_SETTINGS, + "Manage operating system level services." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHOW_HIDDEN_FILES, + "Show hidden files/directories inside the file browser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SSH_ENABLE, + "Enable or disable remote command line access." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, + "Prevents your system's screensaver from becoming active." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, + "Sets the window size relative to the core viewport size. Alternatively, you can set a window width and height below for a fixed window size." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_USER_LANGUAGE, + "Ορίζει την γλώσσα του περιβάλλοντος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, + "Inserts a black frame inbetween frames. Useful for users with 120Hz screens who want to play 60Hz content to eliminate ghosting." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, + "Reduces latency at the cost of a higher risk of video stuttering. Adds a delay after V-Sync (in ms)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, + "Sets how many frames the CPU can run ahead of the GPU when using 'Hard GPU Sync'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Tells the video driver to explicitly use a specified buffering mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, + "Selects which display screen to use." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, + "The accurate estimated refresh rate of the screen in Hz." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED, + "The refresh rate as reported by the display driver." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, + "Αλλαγή ρυθμίσεων εξόδου βίντεο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_WIFI_SETTINGS, + "Scans for wireless networks and establishes connection." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_HELP_LIST, + "Μάθετε περισσότερα για το πως λειτουργεί το πρόγραμμα." + ) +MSG_HASH( + MSG_ADDED_TO_FAVORITES, + "Προστέθηκε στα αγαπημένα" + ) +MSG_HASH( + MSG_RESET_CORE_ASSOCIATION, + "Playlist entry core association has been reset." + ) +MSG_HASH( + MSG_APPENDED_DISK, + "Appended disk" + ) +MSG_HASH( + MSG_APPLICATION_DIR, + "Application Dir" + ) +MSG_HASH( + MSG_APPLYING_CHEAT, + "Applying cheat changes." + ) +MSG_HASH( + MSG_APPLYING_SHADER, + "Applying shader" + ) +MSG_HASH( + MSG_AUDIO_MUTED, + "Ο ήχος απενεργοποιήθηκε." + ) +MSG_HASH( + MSG_AUDIO_UNMUTED, + "Ο ήχος ενεργοποιήθηκε." + ) +MSG_HASH( + MSG_AUTOCONFIG_FILE_ERROR_SAVING, + "Error saving autoconf file." + ) +MSG_HASH( + MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY, + "Autoconfig file saved successfully." + ) +MSG_HASH( + MSG_AUTOSAVE_FAILED, + "Could not initialize autosave." + ) +MSG_HASH( + MSG_AUTO_SAVE_STATE_TO, + "Auto save state to" + ) +MSG_HASH( + MSG_BLOCKING_SRAM_OVERWRITE, + "Blocking SRAM Overwrite" + ) +MSG_HASH( + MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, + "Bringing up command interface on port" + ) +MSG_HASH( + MSG_BYTES, + "bytes" + ) +MSG_HASH( + MSG_CANNOT_INFER_NEW_CONFIG_PATH, + "Cannot infer new config path. Use current time." + ) +MSG_HASH( + MSG_CHEEVOS_HARDCORE_MODE_ENABLE, + "Achievements Hardcore Mode Enabled, savestate & rewind were disabled." + ) +MSG_HASH( + MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, + "Comparing with known magic numbers..." + ) +MSG_HASH( + MSG_COMPILED_AGAINST_API, + "Compiled against API" + ) +MSG_HASH( + MSG_CONFIG_DIRECTORY_NOT_SET, + "Config directory not set. Cannot save new config." + ) +MSG_HASH( + MSG_CONNECTED_TO, + "Συνδέθηκε με" + ) +MSG_HASH( + MSG_CONTENT_CRC32S_DIFFER, + "Content CRC32s differ. Cannot use different games." + ) +MSG_HASH( + MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, + "Content loading skipped. Implementation will load it on its own." + ) +MSG_HASH( + MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, + "Core does not support save states." + ) +MSG_HASH( + MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, + "Core options file created successfully." + ) +MSG_HASH( + MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, + "Could not find any next driver" + ) +MSG_HASH( + MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM, + "Could not find compatible system." + ) +MSG_HASH( + MSG_COULD_NOT_FIND_VALID_DATA_TRACK, + "Could not find valid data track" + ) +MSG_HASH( + MSG_COULD_NOT_OPEN_DATA_TRACK, + "could not open data track" + ) +MSG_HASH( + MSG_COULD_NOT_READ_CONTENT_FILE, + "Could not read content file" + ) +MSG_HASH( + MSG_COULD_NOT_READ_MOVIE_HEADER, + "Could not read movie header." + ) +MSG_HASH( + MSG_COULD_NOT_READ_STATE_FROM_MOVIE, + "Could not read state from movie." + ) +MSG_HASH( + MSG_CRC32_CHECKSUM_MISMATCH, + "CRC32 checksum mismatch between content file and saved content checksum in replay file header. Replay highly likely to desync on playback." + ) +MSG_HASH( + MSG_CUSTOM_TIMING_GIVEN, + "Custom timing given" + ) +MSG_HASH( + MSG_DECOMPRESSION_ALREADY_IN_PROGRESS, + "Decompression already in progress." + ) +MSG_HASH( + MSG_DECOMPRESSION_FAILED, + "Decompression failed." + ) +MSG_HASH( + MSG_DETECTED_VIEWPORT_OF, + "Detected viewport of" + ) +MSG_HASH( + MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, + "Did not find a valid content patch." + ) +MSG_HASH( + MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, + "Disconnect device from a valid port." + ) +MSG_HASH( + MSG_DISK_CLOSED, + "Closed" + ) +MSG_HASH( + MSG_DISK_EJECTED, + "Ejected" + ) +MSG_HASH( + MSG_DOWNLOADING, + "Γίνεται λήψη" + ) +MSG_HASH( + MSG_INDEX_FILE, + "index" + ) +MSG_HASH( + MSG_DOWNLOAD_FAILED, + "Η λήψη απέτυχε" + ) +MSG_HASH( + MSG_ERROR, + "Πρόβλημα" + ) +MSG_HASH( + MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT, + "Libretro core requires content, but nothing was provided." + ) +MSG_HASH( + MSG_ERROR_LIBRETRO_CORE_REQUIRES_SPECIAL_CONTENT, + "Libretro core requires special content, but none were provided." + ) +MSG_HASH( + MSG_ERROR_PARSING_ARGUMENTS, + "Error parsing arguments." + ) +MSG_HASH( + MSG_ERROR_SAVING_CORE_OPTIONS_FILE, + "Error saving core options file." + ) +MSG_HASH( + MSG_ERROR_SAVING_REMAP_FILE, + "Error saving remap file." + ) +MSG_HASH( + MSG_ERROR_REMOVING_REMAP_FILE, + "Error removing remap file." + ) +MSG_HASH( + MSG_ERROR_SAVING_SHADER_PRESET, + "Error saving shader preset." + ) +MSG_HASH( + MSG_EXTERNAL_APPLICATION_DIR, + "External Application Dir" + ) +MSG_HASH( + MSG_EXTRACTING, + "Γίνεται εξαγωγή" + ) +MSG_HASH( + MSG_EXTRACTING_FILE, + "Γίνεται εξαγωγή αρχείου" + ) +MSG_HASH( + MSG_FAILED_SAVING_CONFIG_TO, + "Failed saving config to" + ) +MSG_HASH( + MSG_FAILED_TO, + "Failed to" + ) +MSG_HASH( + MSG_FAILED_TO_ACCEPT_INCOMING_SPECTATOR, + "Failed to accept incoming spectator." + ) +MSG_HASH( + MSG_FAILED_TO_ALLOCATE_MEMORY_FOR_PATCHED_CONTENT, + "Failed to allocate memory for patched content..." + ) +MSG_HASH( + MSG_FAILED_TO_APPLY_SHADER, + "Failed to apply shader." + ) +MSG_HASH( + MSG_FAILED_TO_BIND_SOCKET, + "Failed to bind socket." + ) +MSG_HASH( + MSG_FAILED_TO_CREATE_THE_DIRECTORY, + "Failed to create the directory." + ) +MSG_HASH( + MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE, + "Failed to extract content from compressed file" + ) +MSG_HASH( + MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT, + "Failed to get nickname from client." + ) +MSG_HASH( + MSG_FAILED_TO_LOAD, + "Failed to load" + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_CONTENT, + "Failed to load content" + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_MOVIE_FILE, + "Failed to load movie file" + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_OVERLAY, + "Failed to load overlay." + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_STATE, + "Failed to load state from" + ) +MSG_HASH( + MSG_FAILED_TO_OPEN_LIBRETRO_CORE, + "Failed to open libretro core" + ) +MSG_HASH( + MSG_FAILED_TO_PATCH, + "Failed to patch" + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_HEADER_FROM_CLIENT, + "Failed to receive header from client." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_NICKNAME, + "Failed to receive nickname." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_NICKNAME_FROM_HOST, + "Failed to receive nickname from host." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_NICKNAME_SIZE_FROM_HOST, + "Failed to receive nickname size from host." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_SRAM_DATA_FROM_HOST, + "Failed to receive SRAM data from host." + ) +MSG_HASH( + MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY, + "Failed to remove disk from tray." + ) +MSG_HASH( + MSG_FAILED_TO_REMOVE_TEMPORARY_FILE, + "Failed to remove temporary file" + ) +MSG_HASH( + MSG_FAILED_TO_SAVE_SRAM, + "Failed to save SRAM" + ) +MSG_HASH( + MSG_FAILED_TO_SAVE_STATE_TO, + "Failed to save state to" + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME, + "Failed to send nickname." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME_SIZE, + "Failed to send nickname size." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME_TO_CLIENT, + "Failed to send nickname to client." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME_TO_HOST, + "Failed to send nickname to host." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_SRAM_DATA_TO_CLIENT, + "Failed to send SRAM data to client." + ) +MSG_HASH( + MSG_FAILED_TO_START_AUDIO_DRIVER, + "Failed to start audio driver. Will continue without audio." + ) +MSG_HASH( + MSG_FAILED_TO_START_MOVIE_RECORD, + "Failed to start movie record." + ) +MSG_HASH( + MSG_FAILED_TO_START_RECORDING, + "Failed to start recording." + ) +MSG_HASH( + MSG_FAILED_TO_TAKE_SCREENSHOT, + "Failed to take screenshot." + ) +MSG_HASH( + MSG_FAILED_TO_UNDO_LOAD_STATE, + "Failed to undo load state." + ) +MSG_HASH( + MSG_FAILED_TO_UNDO_SAVE_STATE, + "Failed to undo save state." + ) +MSG_HASH( + MSG_FAILED_TO_UNMUTE_AUDIO, + "Failed to unmute audio." + ) +MSG_HASH( + MSG_FATAL_ERROR_RECEIVED_IN, + "Fatal error received in" + ) +MSG_HASH( + MSG_FILE_NOT_FOUND, + "Το αρχείο δεν βρέθηκε" + ) +MSG_HASH( + MSG_FOUND_AUTO_SAVESTATE_IN, + "Found auto savestate in" + ) +MSG_HASH( + MSG_FOUND_DISK_LABEL, + "Found disk label" + ) +MSG_HASH( + MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, + "Found first data track on file" + ) +MSG_HASH( + MSG_FOUND_LAST_STATE_SLOT, + "Found last state slot" + ) +MSG_HASH( + MSG_FOUND_SHADER, + "Found shader" + ) +MSG_HASH( + MSG_FRAMES, + "Καρέ" + ) +MSG_HASH( + MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT, + "Per-Game Options: game-specific core options found at" + ) +MSG_HASH( + MSG_GOT_INVALID_DISK_INDEX, + "Got invalid disk index." + ) +MSG_HASH( + MSG_GRAB_MOUSE_STATE, + "Grab mouse state" + ) +MSG_HASH( + MSG_GAME_FOCUS_ON, + "Game focus on" + ) +MSG_HASH( + MSG_GAME_FOCUS_OFF, + "Game focus off" + ) +MSG_HASH( + MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING, + "Libretro core is hardware rendered. Must use post-shaded recording as well." + ) +MSG_HASH( + MSG_INFLATED_CHECKSUM_DID_NOT_MATCH_CRC32, + "Inflated checksum did not match CRC32." + ) +MSG_HASH( + MSG_INPUT_CHEAT, + "Εισαγωγή Απάτης" + ) +MSG_HASH( + MSG_INPUT_CHEAT_FILENAME, + "Input Cheat Filename" + ) +MSG_HASH( + MSG_INPUT_PRESET_FILENAME, + "Input Preset Filename" + ) +MSG_HASH( + MSG_INPUT_RENAME_ENTRY, + "Rename Title" + ) +MSG_HASH( + MSG_INTERFACE, + "Αντάπτορας Δικτύου" + ) +MSG_HASH( + MSG_INTERNAL_STORAGE, + "Εσωτερική Μνήμη Αποθήκευσης" + ) +MSG_HASH( + MSG_REMOVABLE_STORAGE, + "Αφαιρούμενο Μέσο Αποθήκευσης" + ) +MSG_HASH( + MSG_INVALID_NICKNAME_SIZE, + "Μη έγκυρο μέγεθος ψευδώνυμου." + ) +MSG_HASH( + MSG_IN_BYTES, + "σε bytes" + ) +MSG_HASH( + MSG_IN_GIGABYTES, + "σε gigabytes" + ) +MSG_HASH( + MSG_IN_MEGABYTES, + "σε megabytes" + ) +MSG_HASH( + MSG_LIBRETRO_ABI_BREAK, + "is compiled against a different version of libretro than this libretro implementation." + ) +MSG_HASH( + MSG_LIBRETRO_FRONTEND, + "Frontend for libretro" + ) +MSG_HASH( + MSG_LOADED_STATE_FROM_SLOT, + "Loaded state from slot #%d." + ) +MSG_HASH( + MSG_LOADED_STATE_FROM_SLOT_AUTO, + "Loaded state from slot #-1 (auto)." + ) +MSG_HASH( + MSG_LOADING, + "Γίνεται φόρτωση" + ) +MSG_HASH( + MSG_FIRMWARE, + "One or more firmware files are missing" + ) +MSG_HASH( + MSG_LOADING_CONTENT_FILE, + "Loading content file" + ) +MSG_HASH( + MSG_LOADING_HISTORY_FILE, + "Loading history file" + ) +MSG_HASH( + MSG_LOADING_STATE, + "Loading state" + ) +MSG_HASH( + MSG_MEMORY, + "Μνήμη" + ) +MSG_HASH( + MSG_MOVIE_FILE_IS_NOT_A_VALID_BSV1_FILE, + "Input replay movie file is not a valid BSV1 file." + ) +MSG_HASH( + MSG_MOVIE_FORMAT_DIFFERENT_SERIALIZER_VERSION, + "Input replay movie format seems to have a different serializer version. Will most likely fail." + ) +MSG_HASH( + MSG_MOVIE_PLAYBACK_ENDED, + "Input replay movie playback ended." + ) +MSG_HASH( + MSG_MOVIE_RECORD_STOPPED, + "Stopping movie record." + ) +MSG_HASH( + MSG_NETPLAY_FAILED, + "Failed to initialize netplay." + ) +MSG_HASH( + MSG_NO_CONTENT_STARTING_DUMMY_CORE, + "No content, starting dummy core." + ) +MSG_HASH( + MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET, + "No save state has been overwritten yet." + ) +MSG_HASH( + MSG_NO_STATE_HAS_BEEN_LOADED_YET, + "No state has been loaded yet." + ) +MSG_HASH( + MSG_OVERRIDES_ERROR_SAVING, + "Error saving overrides." + ) +MSG_HASH( + MSG_OVERRIDES_SAVED_SUCCESSFULLY, + "Overrides saved successfully." + ) +MSG_HASH( + MSG_PAUSED, + "Παύση." + ) +MSG_HASH( + MSG_PROGRAM, + "RetroArch" + ) +MSG_HASH( + MSG_READING_FIRST_DATA_TRACK, + "Reading first data track..." + ) +MSG_HASH( + MSG_RECEIVED, + "ελήφθη" + ) +MSG_HASH( + MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, + "Recording terminated due to resize." + ) +MSG_HASH( + MSG_RECORDING_TO, + "Εγγραφή σε" + ) +MSG_HASH( + MSG_REDIRECTING_CHEATFILE_TO, + "Redirecting cheat file to" + ) +MSG_HASH( + MSG_REDIRECTING_SAVEFILE_TO, + "Redirecting save file to" + ) +MSG_HASH( + MSG_REDIRECTING_SAVESTATE_TO, + "Redirecting savestate to" + ) +MSG_HASH( + MSG_REMAP_FILE_SAVED_SUCCESSFULLY, + "Remap file saved successfully." + ) +MSG_HASH( + MSG_REMAP_FILE_REMOVED_SUCCESSFULLY, + "Remap file removed successfully." + ) +MSG_HASH( + MSG_REMOVED_DISK_FROM_TRAY, + "Removed disk from tray." + ) +MSG_HASH( + MSG_REMOVING_TEMPORARY_CONTENT_FILE, + "Removing temporary content file" + ) +MSG_HASH( + MSG_RESET, + "Reset" + ) +MSG_HASH( + MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, + "Restarting recording due to driver reinit." + ) +MSG_HASH( + MSG_RESTORED_OLD_SAVE_STATE, + "Restored old save state." + ) +MSG_HASH( + MSG_RESTORING_DEFAULT_SHADER_PRESET_TO, + "Shaders: restoring default shader preset to" + ) +MSG_HASH( + MSG_REVERTING_SAVEFILE_DIRECTORY_TO, + "Reverting savefile directory to" + ) +MSG_HASH( + MSG_REVERTING_SAVESTATE_DIRECTORY_TO, + "Reverting savestate directory to" + ) +MSG_HASH( + MSG_REWINDING, + "Rewinding." + ) +MSG_HASH( + MSG_REWIND_INIT, + "Initializing rewind buffer with size" + ) +MSG_HASH( + MSG_REWIND_INIT_FAILED, + "Failed to initialize rewind buffer. Rewinding will be disabled." + ) +MSG_HASH( + MSG_REWIND_INIT_FAILED_THREADED_AUDIO, + "Implementation uses threaded audio. Cannot use rewind." + ) +MSG_HASH( + MSG_REWIND_REACHED_END, + "Reached end of rewind buffer." + ) +MSG_HASH( + MSG_SAVED_NEW_CONFIG_TO, + "Saved new config to" + ) +MSG_HASH( + MSG_SAVED_STATE_TO_SLOT, + "Saved state to slot #%d." + ) +MSG_HASH( + MSG_SAVED_STATE_TO_SLOT_AUTO, + "Saved state to slot #-1 (auto)." + ) +MSG_HASH( + MSG_SAVED_SUCCESSFULLY_TO, + "Saved successfully to" + ) +MSG_HASH( + MSG_SAVING_RAM_TYPE, + "Saving RAM type" + ) +MSG_HASH( + MSG_SAVING_STATE, + "Saving state" + ) +MSG_HASH( + MSG_SCANNING, + "Σάρωση" + ) +MSG_HASH( + MSG_SCANNING_OF_DIRECTORY_FINISHED, + "Η σάρωση του ευρετηρίου ολοκληρώθηκε" + ) +MSG_HASH( + MSG_SENDING_COMMAND, + "Αποστολή εντολής" + ) +MSG_HASH( + MSG_SEVERAL_PATCHES_ARE_EXPLICITLY_DEFINED, + "Several patches are explicitly defined, ignoring all..." + ) +MSG_HASH( + MSG_SHADER, + "Σκίαση" + ) +MSG_HASH( + MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, + "Shader preset saved successfully." + ) +MSG_HASH( + MSG_SKIPPING_SRAM_LOAD, + "Skipping SRAM load." + ) +MSG_HASH( + MSG_SLOW_MOTION, + "Αργή κίνηση." + ) +MSG_HASH( + MSG_FAST_FORWARD, + "Fast forward." + ) +MSG_HASH( + MSG_SLOW_MOTION_REWIND, + "Slow motion rewind." + ) +MSG_HASH( + MSG_SRAM_WILL_NOT_BE_SAVED, + "SRAM will not be saved." + ) +MSG_HASH( + MSG_STARTING_MOVIE_PLAYBACK, + "Starting movie playback." + ) +MSG_HASH( + MSG_STARTING_MOVIE_RECORD_TO, + "Starting movie record to" + ) +MSG_HASH( + MSG_STATE_SIZE, + "State size" + ) +MSG_HASH( + MSG_STATE_SLOT, + "State slot" + ) +MSG_HASH( + MSG_TAKING_SCREENSHOT, + "Taking screenshot." + ) +MSG_HASH( + MSG_TO, + "to" + ) +MSG_HASH( + MSG_UNDID_LOAD_STATE, + "Undid load state." + ) +MSG_HASH( + MSG_UNDOING_SAVE_STATE, + "Undoing save state" + ) +MSG_HASH( + MSG_UNKNOWN, + "Άγνωστο" + ) +MSG_HASH( + MSG_UNPAUSED, + "Unpaused." + ) +MSG_HASH( + MSG_UNRECOGNIZED_COMMAND, + "Unrecognized command" + ) +MSG_HASH( + MSG_USING_CORE_NAME_FOR_NEW_CONFIG, + "Using core name for new config." + ) +MSG_HASH( + MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED, + "Using libretro dummy core. Skipping recording." + ) +MSG_HASH( + MSG_VALUE_CONNECT_DEVICE_FROM_A_VALID_PORT, + "Connect device from a valid port." + ) +MSG_HASH( + MSG_VALUE_DISCONNECTING_DEVICE_FROM_PORT, + "Disconnecting device from port" + ) +MSG_HASH( + MSG_VALUE_REBOOTING, + "Επανεκκίνηση..." + ) +MSG_HASH( + MSG_VALUE_SHUTTING_DOWN, + "Τερματισμός λειτουργίας..." + ) +MSG_HASH( + MSG_VERSION_OF_LIBRETRO_API, + "Έκδοση του libretro API" + ) +MSG_HASH( + MSG_VIEWPORT_SIZE_CALCULATION_FAILED, + "Viewport size calculation failed! Will continue using raw data. This will probably not work right ..." + ) +MSG_HASH( + MSG_VIRTUAL_DISK_TRAY, + "virtual disk tray." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_LATENCY, + "Επιθυμητή καθυστέρηση ήχου σε milliseconds. Ίσως να μην τηρηθεί εάν ο οδηγός ήχου δεν μπορεί να παρέχει την επιλεγμένη καθυστέρηση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MUTE, + "Σίγαση/κατάργηση σίγασης ήχου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, + "Helps smooth out imperfections in timing when synchronizing audio and video. Be aware that if disabled, proper synchronization is nearly impossible to obtain." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CAMERA_ALLOW, + "Allow or disallow camera access by cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOCATION_ALLOW, + "Allow or disallow location services access by cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_MAX_USERS, + "Μέγιστος αριθμός χρηστών που υποστηρίζεται από το RetroArch." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, + "Influence how input polling is done inside RetroArch. Setting it to 'Early' or 'Late' can result in less latency, depending on your configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, + "Allows any user to control the menu. If disabled, only User 1 can control the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_VOLUME, + "Ένταση ήχου (σε dB). Το 0 είναι η φυσιολογική ένταση και δεν εφαρμόζεται gain." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_EXCLUSIVE_MODE, + "Allow the WASAPI driver to take exclusive control of the audio device. If disabled, it will use shared mode instead." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_FLOAT_FORMAT, + "Use float format for the WASAPI driver, if supported by your audio device." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH, + "The intermediate buffer length (in frames) when using the WASAPI driver in shared mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_SYNC, + "Συγχρονισμός ήχου. Προτείνεται." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, + "How far an axis must be tilted to result in a button press." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, + "Amount of seconds to wait until proceeding to the next bind." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_BIND_HOLD, + "Amount of seconds to hold an input to bind it." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, + "Describes the period when turbo-enabled buttons are toggled. Numbers are described in frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE, + "Describes how long the period of a turbo-enabled button should be. Numbers are described in frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VSYNC, + "Synchronizes the output video of the graphics card to the refresh rate of the screen. Recommended." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, + "Allow cores to set rotation. When disabled, rotation requests are ignored. Useful for setups where one manually rotates the screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, + "Some cores might have a shutdown feature. If enabled, it will prevent the core from shutting RetroArch down. Instead, it loads a dummy core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, + "Check if all the required firmware is present before attempting to load content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, + "Vertical refresh rate of your screen. Used to calculate a suitable audio input rate.\n" + "NOTE: This will be ignored if 'Threaded Video' is enabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_ENABLE, + "Ενεργοποίηση εξόδου ήχου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW, + "The maximum change in audio input rate. Increasing this enables very large changes in timing at the cost of an inaccurate audio pitch (e.g., running PAL cores on NTSC displays)." + ) +MSG_HASH( + MSG_FAILED, + "failed" + ) +MSG_HASH( + MSG_SUCCEEDED, + "succeeded" + ) +MSG_HASH( + MSG_DEVICE_NOT_CONFIGURED, + "not configured" + ) +MSG_HASH( + MSG_DEVICE_NOT_CONFIGURED_FALLBACK, + "not configured, using fallback" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST, + "Database Cursor List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DEVELOPER, + "Database - Filter : Developer" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PUBLISHER, + "Database - Filter : Publisher" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISABLED, + "Disabled" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ENABLED, + "Enabled" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_PATH, + "Content History Path" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ORIGIN, + "Database - Filter : Origin" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_FRANCHISE, + "Database - Filter : Franchise" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ESRB_RATING, + "Database - Filter : ESRB Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ELSPA_RATING, + "Database - Filter : ELSPA Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PEGI_RATING, + "Database - Filter : PEGI Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_CERO_RATING, + "Database - Filter : CERO Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_BBFC_RATING, + "Database - Filter : BBFC Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_MAX_USERS, + "Database - Filter : Max Users" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_MONTH, + "Database - Filter : Releasedate By Month" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_YEAR, + "Database - Filter : Releasedate By Year" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_ISSUE, + "Database - Filter : Edge Magazine Issue" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_RATING, + "Database - Filter : Edge Magazine Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DATABASE_INFO, + "Πληροφορίες Βάσης Δεδομένων" + ) +MSG_HASH( + MSG_WIFI_SCAN_COMPLETE, + "Η σάρωτη του Wi-Fi ολοκληρώθηκε." + ) +MSG_HASH( + MSG_SCANNING_WIRELESS_NETWORKS, + "Scanning wireless networks..." + ) +MSG_HASH( + MSG_NETPLAY_LAN_SCAN_COMPLETE, + "Netplay scan complete." + ) +MSG_HASH( + MSG_NETPLAY_LAN_SCANNING, + "Scanning for netplay hosts..." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, + "Pause gameplay when RetroArch is not the active window." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, + "Enable or disable composition." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, + "Enable or disable recent playlist for games, images, music, and videos." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, + "Limit the number of entries in recent playlist for games, images, music, and videos." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, + "Use the same controls for both the menu and the game. Applies to the keyboard." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, + "Εμφάνιση μηνυμάτων οθόνης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_USER_REMOTE_ENABLE, + "User %d Remote Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BATTERY_LEVEL_ENABLE, + "Εμφάνιση επιπέδου μπαταρίας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SELECT_FILE, + "Επιλογή Αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SELECT_FROM_COLLECTION, + "Επιλογή Από Συλλογή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FILTER, + "Φίλτρα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCALE, + "Κλίμακα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, + "Netplay will start when content is loaded." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, + "Couldn't find a suitable core or content file, load manually." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, + "Browse URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_URL, + "URL Path" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_START, + "Έναρξη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, + "Bokeh" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOWFLAKE, + "Χιονονιφάδα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, + "Ανανέωση Λίστας Δωματίων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME, + "Ψευδώνυμο: %s" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, + "Ψευδώνυμο (lan): %s" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, + "Βρέθηκε συμβατό περιεχόμενο" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, + "Cuts off a few pixels around the edges of the image customarily left blank by developers which sometimes also contain garbage pixels." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, + "Adds a slight blur to the image to take the edge off of the hard pixel edges. This option has very little impact on performance." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FILTER, + "Apply a CPU-powered video filter.\n" + "NOTE: Might come at a high performance cost. Some video filters might only work for cores that use 32bit or 16bit color." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, + "Input the username of your RetroAchievements account." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, + "Input the password of your RetroAchievements account." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, + "Input your user name here. This will be used for netplay sessions, among other things." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, + "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_LIST, + "Επιλέξτε ποιον πυρήνα θα χρησιμοποιήστε." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, + "Επιλέξτε ποιο περιεχόμενο θα ξεκινήσετε." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, + "Εμφάνιση ανταπτόρων δικτύου και τις συσχετιζόμενες διευθύνσεις IP." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, + "Εμφάνιση πληροφοριών για την συγκεκριμένη συσκευή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Έξοδος από το πρόγραμμα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, + "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, + "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, + "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, + "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, + "Specify custom X axis position for onscreen text." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, + "Specify custom Y axis position for onscreen text." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, + "Specify the font size in points." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, + "Hide the overlay while inside the menu, and show it again when exiting the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "Show keyboard/controller inputs on the onscreen overlay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "Select the port for the overlay to listen to if Show Inputs On Overlay is enabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, + "Το σαρωμένο περιεχόμενο θα εμφανίζεται εδώ." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, + "Only scales video in integer steps. The base size depends on system-reported geometry and aspect ratio. If 'Force Aspect' is not set, X/Y will be integer scaled independently." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, + "Screenshots output of GPU shaded material if available." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ROTATION, + "Forces a certain rotation of the screen. The rotation is added to rotations which the core sets." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FORCE_SRGB_DISABLE, + "Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows have video problems with sRGB FBO support if this is enabled. Enabling this can work around it." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, + "Start in fullscreen. Can be changed at runtime. Can be overridden by a command line switch" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, + "If fullscreen, prefer using a windowed fullscreen mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD, + "Records output of GPU shaded material if available." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX, + "When making a savestate, save state index is automatically increased before it is saved. When loading content, the index will be set to the highest existing index." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE, + "Block Save RAM from being overwritten when loading save states. Might potentially lead to buggy games." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO, + "The maximum rate at which content will be run when using fast forward (e.g., 5.0x for 60 fps content = 300 fps cap). If set to 0.0x, fastforward ratio is unlimited (no FPS cap)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, + "When in slow motion, content will slow down by the factor specified/set." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_ENABLED, + "Run core logic one or more frames ahead then load the state back to reduce perceived input lag." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_FRAMES, + "The number of frames to run ahead. Causes gameplay issues such as jitter if you exceed the number of lag frames internal to the game." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_SECONDARY_INSTANCE, + "Use a second instance of the RetroArch core to run ahead. Prevents audio problems due to loading state." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_HIDE_WARNINGS, + "Hides the warning message that appears when using RunAhead and the core does not support savestates." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_ENABLE, + "Enable rewinding. This will take a performance hit when playing." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE, + "Apply cheat immediately after toggling." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD, + "Auto-apply cheats when game loads." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_COUNT, + "The number of times the cheat will be applied. Use with the other two Iteration options to affect large areas of memory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_ADDRESS, + "After each 'Number of Iterations' the Memory Address will be increased by this number times the 'Memory Search Size'." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE, + "After each 'Number of Iterations' the Value will be increased by this amount." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, + "When rewinding a defined number of frames, you can rewind several frames at a time, increasing the rewind speed." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE, + "The amount of memory (in MB) to reserve for the rewind buffer. Increasing this will increase the amount of rewind history." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE_STEP, + "Each time you increase or decrease the rewind buffer size value via this UI it will change by this amount" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_IDX, + "Index position in list." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADDRESS_BIT_POSITION, + "Address bitmask when Memory Search Size < 8-bit." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_MATCH_IDX, + "Select the match to view." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_OR_CONT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_OR_RESTART, + "Αριστερά/Δεξιά για αλλαγή μεγέθους bit" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EXACT, + "Αριστερά/Δεξιά για αλλαγή τιμής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LTE, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GTE, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQ, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_NEQ, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQPLUS, + "Αριστερά/Δεξιά για αλλαγή τιμής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQMINUS, + "Αριστερά/Δεξιά για αλλαγή τιμής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_MATCHES, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_VIEW_MATCHES, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_CREATE_OPTION, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DELETE_OPTION, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_TOP, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_BOTTOM, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DELETE_ALL, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_RELOAD_CHEATS, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_BIG_ENDIAN, + "Big endian : 258 = 0x0102,\n" + "Little endian : 258 = 0x0201" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, + "Sets log level for cores. If a log level issued by a core is below this value, it is ignored." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PERFCNT_ENABLE, + "Enable performance counters for RetroArch (and cores)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, + "Automatically makes a savestate at the end of RetroArch's runtime. RetroArch will automatically load this savestate if 'Auto Load State' is enabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_LOAD, + "Automatically load the auto save state on startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_THUMBNAIL_ENABLE, + "Show thumbnails of save states inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTOSAVE_INTERVAL, + "Autosaves the non-volatile Save RAM at a regular interval. This is disabled by default unless set otherwise. The interval is measured in seconds. A value of 0 disables autosave." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, + "If enabled, overrides the input binds with the remapped binds set for the current core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, + "Enable input auto-detection. Will attempt to autoconfigure joypads, Plug-and-Play style." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, + "Swap buttons for OK/Cancel. Disabled is the Japanese button orientation, enabled is the western orientation." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO, + "If disabled, the content will keep running in the background when RetroArch's menu is toggled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_DRIVER, + "Οδηγός βίντεο προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DRIVER, + "Οδηγός ήχου προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_DRIVER, + "Οδηγός Εισόδου προς χρήση. Ανάλογα με τον οδηγό βίντεο, ίσως αλλάξει αναγκαστικά ο οδηγός εισαγωγής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_JOYPAD_DRIVER, + "Οδηγός Joypad προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_DRIVER, + "Οδηγός Επαναδειγματολήπτη Ήχου προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CAMERA_DRIVER, + "Οδηγός Κάμερας προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOCATION_DRIVER, + "Οδηγός Τοποθεσίας προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_DRIVER, + "Οδηγός Μενού προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORD_DRIVER, + "Οδηγός Εγγραφής προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_DRIVER, + "Οδηγός MIDI προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_WIFI_DRIVER, + "Οδηγός Wi-Fi προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, + "Filter files being shown in filebrowser by supported extensions." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_WALLPAPER, + "Select an image to set as menu wallpaper." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPER, + "Dynamically load a new wallpaper depending on context." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DEVICE, + "Παράκαμψη της προκαθορισμένης συσκευής ήχου που χρησιμοποιεί ο οδηγός ήχου. Αυτή η επιλογή εξαρτάται από τον οδηγό." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN, + "Πρόσθετο ήχου DSP που επεξεργάζεται τον ήχο πριν αποσταλεί στον οδηγό." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_OUTPUT_RATE, + "Audio output sample rate." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_OPACITY, + "Opacity of all UI elements of the overlay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_SCALE, + "Scale of all UI elements of the overlay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE, + "Enable the overlay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_PRESET, + "Select an overlay from the file browser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, + "The address of the host to connect to." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT, + "The port of the host IP address. Can be either a TCP or UDP port." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_PASSWORD, + "The password for connecting to the netplay host. Used only in host mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, + "Whether to announce netplay games publicly. If unset, clients must manually connect rather than using the public lobby." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, + "The password for connecting to the netplay host with only spectator privileges. Used only in host mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_START_AS_SPECTATOR, + "Whether to start netplay in spectator mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ALLOW_SLAVES, + "Whether to allow connections in slave mode. Slave-mode clients require very little processing power on either side, but will suffer significantly from network latency." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REQUIRE_SLAVES, + "Whether to disallow connections not in slave mode. Not recommended except for very fast networks with very weak machines." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_STATELESS_MODE, + "Whether to run netplay in a mode not requiring save states. If set to true, a very fast network is required, but no rewinding is performed, so there will be no netplay jitter." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_CHECK_FRAMES, + "The frequency in frames with which netplay will verify that the host and client are in sync." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_NAT_TRAVERSAL, + "When hosting, attempt to listen for connections from the public Internet, using UPnP or similar technologies to escape LANs." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_STDIN_CMD_ENABLE, + "Enable stdin command interface." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MOUSE_ENABLE, + "Enable mouse controls inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_POINTER_ENABLE, + "Enable touch controls inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_THUMBNAILS, + "Type of thumbnail to display." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LEFT_THUMBNAILS, + "Type of thumbnail to display at the left." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS, + "Display the left thumbnail under the right one, on the right side of the screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_ENABLE, + "Εμφάνιση τρέχουσας ημερομηνίας ή και ώρας μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BATTERY_LEVEL_ENABLE, + "Εμφάνιση τρέχουσας μπαταρίας μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND, + "Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, + "Ενεργοποιεί το netplay ως οικοδεσπότης (εξυπηρετητής)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, + "Ενεργοποιεί το netplay ως πελάτης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, + "Αποσυνδέει μία ενεργή σύνδεση Netplay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, + "Σαρώνει ένα ευρετήριο για συμβατά αρχεία και τα προσθέτει στην συλλογή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SCAN_FILE, + "Σαρώνει ένα συμβατό αρχείο και το προσθέτει στην συλλογή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, + "Uses a custom swap interval for Vsync. Set this to effectively halve monitor refresh rate." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, + "Sort save files in folders named after the core used." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, + "Sort save states in folders named after the core used." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REQUEST_DEVICE_I, + "Request to play with the given input device." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, + "URL to core updater directory on the Libretro buildbot." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BUILDBOT_ASSETS_URL, + "URL to assets updater directory on the Libretro buildbot." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, + "After downloading, automatically extract files contained in the downloaded archives." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, + "Σάρωση για νέα δωμάτια." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DELETE_ENTRY, + "Κατάργηση αυτής της καταχώρησης από την συλλογή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INFORMATION, + "View more information about the content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES, + "Προσθήκη καταχώρησης στα αγαπημένα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST, + "Προσθήκη καταχώρησης στα αγαπημένα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN, + "Έναρξη περιεχομένου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS, + "Προσαρμογή ρυθμίσεων εξερευνητή αρχείου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE, + "Enable customized controls by default at startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTO_OVERRIDES_ENABLE, + "Enable customized configuration by default at startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GAME_SPECIFIC_OPTIONS, + "Enable customized core options by default at startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_ENABLE, + "Εμφανίζει το όνομα του τρέχων πυρήνα μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DATABASE_MANAGER, + "Προβολή βάσεων δεδομένων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CURSOR_MANAGER, + "Προβολή προηγούμενων αναζητήσεων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, + "Captures an image of the screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CLOSE_CONTENT, + "Closes the current content. Any unsaved changes might be lost." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOAD_STATE, + "Load a saved state from the currently selected slot." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_STATE, + "Save a state to the currently selected slot." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESUME, + "Resume the currently running content and leave the Quick Menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESUME_CONTENT, + "Resume the currently running content and leave the Quick Menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_STATE_SLOT, + "Changes the currently selected state slot." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, + "If a state was loaded, content will go back to the state prior to loading." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, + "If a state was overwritten, it will roll back to the previous save state." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, + "RetroAchievements service. For more information, visit http://retroachievements.org" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, + "Manages currently configured accounts." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_META_REWIND, + "Manages rewind settings." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_DETAILS, + "Manages cheat details settings." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_SEARCH, + "Start or continue a cheat code search." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESTART_CONTENT, + "Restarts the content from the beginning." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, + "Saves an override configuration file which will apply for all content loaded with this core. Will take precedence over the main configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, + "Saves an override configuration file which will apply for all content loaded from the same directory as the current file. Will take precedence over the main configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, + "Saves an override configuration file which will apply for the current content only. Will take precedence over the main configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, + "Set up cheat codes." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHADER_OPTIONS, + "Set up shaders to visually augment the image." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS, + "Change the controls for the currently running content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_OPTIONS, + "Change the options for the currently running content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, + "Show advanced settings for power users (hidden by default)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, + "Perform tasks on a separate thread." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, + "Allow the user to remove entries from collections." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, + "Sets the System directory. Cores can query for this directory to load BIOSes, system-specific configs, etc." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RGUI_BROWSER_DIRECTORY, + "Sets start directory for the filebrowser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_DIR, + "Usually set by developers who bundle libretro/RetroArch apps to point to assets." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPERS_DIRECTORY, + "Directory to store wallpapers dynamically loaded by the menu depending on context." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, + "Supplementary thumbnails (boxarts/misc. images, etc.) are stored here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, + "Sets start directory for menu configuration browser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "The number of frames of input latency for netplay to use to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of noticeable input lag." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "The range of frames of input latency that may be used to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of unpredictable input lag." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_CYCLE_TRAY_STATUS, + "Cycle the current disk. If the disk is inserted, it will eject the disk. If the disk has not been inserted, it will be inserted. " + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_INDEX, + "Change the disk index." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_OPTIONS, + "Disk image management." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND, + "Select a disk image to insert." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE, + "Makes sure the framerate is capped while inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VRR_RUNLOOP_ENABLE, + "No deviation from core requested timing. Use for Variable Refresh Rate screens, G-Sync, FreeSync." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_LAYOUT, + "Select a different layout for the XMB interface." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_THEME, + "Select a different theme for the icon. Changes will take effect after you restart the program." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, + "Enable drop shadows for all icons. This will have a minor performance hit." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, + "Select a different background color gradient theme." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, + "Modify the opacity of the background wallpaper." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, + "Select a different background color gradient theme." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, + "Select an animated background effect. Can be GPU-intensive depending on the effect. If performance is unsatisfactory, either turn this off or revert to a simpler effect." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_FONT, + "Select a different main font to be used by the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES, + "Προβολή καρτέλας αγαπημένων μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, + "Προβολή καρτέλας εικόνων μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_MUSIC, + "Προβολή καρτέλας μουσικής μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO, + "Προβολή καρτέλας βίντεο μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_NETPLAY, + "Προβολή καρτέλας netplay μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS, + "Προβολή καρτέλας ρυθμίσεων μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY, + "Προβολή καρτέλας πρόσφατου ιστορικού μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD, + "Προβολή καρτέλας εισαγωγής περιεχομένου μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS, + "Προβολή καρτέλας λίστας αναπαραγωγής μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN, + "Προβολή οθόνης εκκίνησης στο μενού. Τίθεται αυτόματα σε αρνητικό μετά την πρώτη εκκίνηση του προγράμματος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY, + "Modify the opacity of the header graphic." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_MENU_FOOTER_OPACITY, + "Modify the opacity of the footer graphic." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DPI_OVERRIDE_ENABLE, + "The menu normally scales itself dynamically. If you want to set a specific scaling size instead, enable this." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, + "Set the custom scaling size here.\n" + "NOTE: You have to enable 'DPI Override' for this scaling size to take effect." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, + "Save all downloaded files to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_REMAPPING_DIRECTORY, + "Save all remapped controls to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LIBRETRO_DIR_PATH, + "Directory where the program searches for content/cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LIBRETRO_INFO_PATH, + "Application/core information files are stored here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_JOYPAD_AUTOCONFIG_DIR, + "If a joypad is plugged in, that joypad will be autoconfigured if a config file corresponding to it is present inside this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_DIRECTORY, + "Save all collections to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CACHE_DIRECTORY, + "If set to a directory, content which is temporarily extracted (e.g. from archives) will be extracted to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CURSOR_DIRECTORY, + "Saved queries are stored to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_DATABASE_DIRECTORY, + "Databases are stored to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ASSETS_DIRECTORY, + "This location is queried by default when menu interfaces try to look for loadable assets, etc." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, + "Save all save files to this directory. If not set, will try to save inside the content file's working directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, + "Save all save states to this directory. If not set, will try to save inside the content file's working directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, + "Directory to dump screenshots to." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, + "Defines a directory where overlays are kept for easy access." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH, + "Cheat files are kept here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR, + "Directory where audio DSP filter files are kept." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR, + "Directory where CPU-based video filter files are kept." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_DIR, + "Defines a directory where GPU-based video shader files are kept for easy access." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORDING_OUTPUT_DIRECTORY, + "Recordings will be dumped to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORDING_CONFIG_DIRECTORY, + "Recording configurations will be kept here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FONT_PATH, + "Select a different font for onscreen notifications." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHADER_APPLY_CHANGES, + "Changes to the shader configuration will take effect immediately. Use this if you changed the amount of shader passes, filtering, FBO scale, etc." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_NUM_PASSES, + "Increase or decrease the amount of shader pipeline passes. You can bind a separate shader to each pipeline pass and configure its scale and filtering." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET, + "Load a shader preset. The shader pipeline will be automatically set-up." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, + "Save the current shader settings as a new shader preset." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE, + "Save the current shader settings as the default settings for this application/core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_PARENT, + "Save the current shader settings as the default settings for all files in the current content directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME, + "Save the current shader settings as the default settings for the content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS, + "Modifies the current shader directly. Changes will not be saved to the preset file." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_PARAMETERS, + "Modifies the shader preset itself currently used in the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_NUM_PASSES, + "Increase or decrease the amount of cheats." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES, + "Cheat changes will take effect immediately." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_SEARCH, + "Start search for a new cheat. Number of bits can be changed." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_CONTINUE_SEARCH, + "Continue search for a new cheat." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD, + "Load a cheat file and replace existing cheats." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD_APPEND, + "Load a cheat file and append to existing cheats." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_SAVE_AS, + "Save current cheats as a save file." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, + "Quickly access all relevant in-game settings." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_INFORMATION, + "View information pertaining to the application/core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, + "Floating point value for video aspect ratio (width / height), used if the Aspect Ratio is set to 'Config'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + "Custom viewport height that is used if the Aspect Ratio is set to 'Custom'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, + "Custom viewport width that is used if the Aspect Ratio is set to 'Custom'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, + "Custom viewport offset used for defining the X-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, + "Custom viewport offset used for defining the Y-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, + "Χρήση Εξυπηρετητή Αναμετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, + "Forward netplay connections through a man-in-the-middle server. Useful if the host is behind a firewall or has NAT/UPnP problems." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + "Τοποθεσία Εξυπηρετητή Αναμετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, + "Choose a specific relay server to use. Geographically closer locations tend to have lower latency." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, + "Προσθήκη στον μίκτη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_PLAY, + "Προσθήκη στον μίκτη και αναπαραγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION, + "Προσθήκη στον μίκτη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION_AND_PLAY, + "Προσθήκη στον μίκτη και αναπαραγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FILTER_BY_CURRENT_CORE, + "Φιλτράρισμα με βάση τον τρέχων πυρήνα" + ) +MSG_HASH( + MSG_AUDIO_MIXER_VOLUME, + "Γενική ένταση μίκτη ήχου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MIXER_VOLUME, + "Γενική ένταση μίκτη ήχου (σε dB). Το 0 είναι η φυσιολογική ένταση και δεν εφαρμόζεται gain." /*Need a good translation for gain if there's any*/ + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, + "Επίπεδο Έντασης Μίκτη Ήχου (dB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE, + "Σίγαση Μίκτη Ήχου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, + "Σίγαση/κατάργηση σίγασης μίκτη ήχου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, + "Προβολή Διαδικτυακού Ενημερωτή" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, + "Εμφάνιση/απόκρυψη της επιλογής 'Διαδικτυακού Ενημερωτή'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS, + "Προβολές" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS, + "Προβολή ή απόκρυψη στοιχείων στην οθόνη του μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER, + "Προβολή Ενημερωτή Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER, + "Εμφάνιση/απόκρυψη της ικανότητας ενημέρωσης πυρήνων (και πληροφοριακών αρχείων πυρήνων)." + ) +MSG_HASH( + MSG_PREPARING_FOR_CONTENT_SCAN, + "Προετοιμασία για σάρωση περιεχομένου..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_DELETE, + "Διαγραφή πυρήνα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_DELETE, + "Κατάργηση αυτού του πυρήνα από τον δίσκο." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, + "Framebuffer Opacity" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, + "Modify the opacity of the framebuffer." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, + "Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_FAVORITES, + "Περιεχόμενο που έχετε προσθέσει στα 'Αγαπημένα' θα εμφανίζεται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, + "Μουσική" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_MUSIC, + "Μουσική που έχει προηγουμένως αναπαραχθεί θα εμφανίζονται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_IMAGES, + "Εικόνα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_IMAGES, + "Εικόνες που έχουν προηγουμένως προβληθεί θα εμφανίζονται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, + "Βίντεο" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_VIDEO, + "Βίντεο που έχουν προηγουμένως αναπαραχθεί θα εμφανίζονται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, + "Εικονίδια Μενού" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, + "Ενεργοποίηση/Απενεργοποίηση των εικονιδίων που εμφανίζονται στα αριστερά των καταχωρήσεων του μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Ενεργοποίηση Καρτέλας Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS_PASSWORD, + "Ορισμός Κωδικού Για Την Ενεργοποίηση Της Καρτέλας Ρυθμίσεων" + ) +MSG_HASH( + MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Εισαγωγή Κωδικού" + ) +MSG_HASH( + MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Σωστός κωδικός." + ) +MSG_HASH( + MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Λανθασμένος κωδικός." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Ενεργοποιεί την καρτέλα Ρυθμίσεις. Χρειάζεται επανεκκίνηση για να εμφανιστεί η καρτέλα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, + "Allow the user to rename entries in collections." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, + "Allow to rename entries" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RENAME_ENTRY, + "Rename the title of the entry." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, + "Μετονομασία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, + "Προβολή Φόρτωσης Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE, + "Εμφάνιση/απόκρυψη της επιλογής 'Φόρτωση Πυρήνα'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CONTENT, + "Προβολή Φόρτωσης Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT, + "Εμφάνιση/απόκρυψη της επιλογής 'Φόρτωση Περιεχομένου'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION, + "Προβολή Πληροφοριών" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION, + "Εμφάνιση/απόκρυψη της επιλογής 'Πληροφορίες'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS, + "Προβολή Διαμορφώσεων" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS, + "Εμφάνιση/απόκρυψη της επιλογής 'Διαμορφώσεις'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, + "Προβολή Βοήθειας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, + "Εμφάνιση/απόκρυψη της επιλογής 'Βοήθεια'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Προβολή Εξόδου RetroArch" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Εμφάνιση/απόκρυψη της επιλογής 'Έξοδος από RetroArch'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, + "Προβολή Επανεκκίνησης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, + "Εμφάνιση/απόκρυψη της επιλογής 'Επανεκκίνηση'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_SHUTDOWN, + "Show Shutdown" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_SHUTDOWN, + "Show/hide the 'Shutdown' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS, + "Γρήγορο Μενού" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS, + "Show or hide elements on the Quick Menu screen." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT, + "Show Take Screenshot" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT, + "Show/hide the 'Take Screenshot' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE, + "Show Save/Load State" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE, + "Show/hide the options for saving/loading state." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, + "Show Undo Save/Load State" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, + "Show/hide the options for undoing save/load state." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, + "Show Add to Favorites" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, + "Show/hide the 'Add to Favorites' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, + "Show Options" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, + "Show/hide the 'Options' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CONTROLS, + "Show Controls" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS, + "Show/hide the 'Controls' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS, + "Show Cheats" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS, + "Show/hide the 'Cheats' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS, + "Show Shaders" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS, + "Show/hide the 'Shaders' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, + "Show Save Core Overrides" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, + "Show/hide the 'Save Core Overrides' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, + "Show Save Game Overrides" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, + "Show/hide the 'Save Game Overrides' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, + "Show Information" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, + "Show/hide the 'Information' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE, + "Notification Background Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED, + "Notification Background Red Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN, + "Notification Background Green Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE, + "Notification Background Blue Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY, + "Notification Background Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, + "Disable Kiosk Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, + "Disables kiosk mode. A restart is required for the change to take full effect." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, + "Ενεργοποίηση Λειτουργίας Κιόσκι" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, + "Protects the setup by hiding all configuration related settings." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, + "Set Password For Disabling Kiosk Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, + "Supplying a password when enabling kiosk mode makes it possible to later disable it from the menu, by going to the Main Menu, selecting Disable Kiosk Mode and entering the password." + ) +MSG_HASH( + MSG_INPUT_KIOSK_MODE_PASSWORD, + "Εισαγωγή Κωδικού" + ) +MSG_HASH( + MSG_INPUT_KIOSK_MODE_PASSWORD_OK, + "Σωστός κωδικός." + ) +MSG_HASH( + MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, + "Λανθασμένος κωδικός." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED, + "Notification Red Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, + "Notification Green Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, + "Notification Blue Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, + "Show frame count on FPS display" + ) +MSG_HASH( + MSG_CONFIG_OVERRIDE_LOADED, + "Configuration override loaded." + ) +MSG_HASH( + MSG_GAME_REMAP_FILE_LOADED, + "Game remap file loaded." + ) +MSG_HASH( + MSG_CORE_REMAP_FILE_LOADED, + "Core remap file loaded." + ) +MSG_HASH( + MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES, + "RunAhead has been disabled because this core does not support save states." + ) +MSG_HASH( + MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, + "Failed to save state. RunAhead has been disabled." + ) +MSG_HASH( + MSG_RUNAHEAD_FAILED_TO_LOAD_STATE, + "Failed to load state. RunAhead has been disabled." + ) +MSG_HASH( + MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, + "Failed to create second instance. RunAhead will now use only one instance." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists." + ) +MSG_HASH( + MSG_SCANNING_OF_FILE_FINISHED, + "Scanning of file finished" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, + "Window Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, + "Ποιότητα Επαναδειγματολήπτη Ήχου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, + "Ελαττώστε αυτή την τιμή για καλύτερη επίδοση/χαμηλότερη καθυστέρηση αντί ποιότητας ήχου, αυξήστε εάν θέλετε καλύτερη ποιότητα με κόστος στην επίδοση/χαμηλώτερη καθυστέρηση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, + "Watch shader files for changes" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, + "Auto-apply changes made to shader files on disk." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, + "Show Window Decorations" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, + "Εμφάνιση Στατιστικών" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_STATISTICS_SHOW, + "Εμφάνιση τεχνικών στατιστικών στην οθόνη." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_ENABLE, + "Enable border filler" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, + "Enable border filler thickness" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, + "Enable background filler thickness" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, + "Για οθόνες CRT μόνο. Προσπαθεί να χρησιμοποιήσει την ακριβή ανάλυση πυρήνα/παιχνιδιού και ρυθμού ανανέωσης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, + "CRT SwitchRes" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, + "Switch among native and ultrawide super resolutions." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, + "Σούπερ Ανάλυση CRT" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, + "Προβολή Ρυθμίσεων Επιστροφής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, + "Εμφάνιση/απόκρυψη επιλογών Επιστροφής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_LATENCY, + "Εμφάνιση/απόκρυψη επιλογών Καθυστέρησης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_LATENCY, + "Προβολή Ρυθμίσεων Καθυστέρησης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS, + "Εμφάνιση/απόκρυψη επιλογών Επικαλλυμάτων." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, + "Προβολή Ρυθμίσεων Επικαλλυμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, + "Ενεργοποίηση ήχου μενού" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, + "Ενεργοποίηση ή απενεργοποίηση ήχου μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, + "Ρυθμίσεις Μίκτη" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, + "Εμφάνιση και/ή επεξεργασία ρυθμίσεων μίκτη." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_INFO, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE, + "&File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE, + "&Load Core..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE, + "&Unload Core" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT, + "E&xit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT, + "&Edit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH, + "&Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW, + "&View" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS, + "Closed Docks" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_SHADER_PARAMS, + "Shader Parameters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS, + "&Options..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_DOCK_POSITIONS, + "Remember dock positions:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_GEOMETRY, + "Remember window geometry:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_LAST_TAB, + "Remember last content browser tab:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME, + "Θέμα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_SYSTEM_DEFAULT, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_DARK, + "Σκούρο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_CUSTOM, + "Custom..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_TITLE, + "Επιλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_TOOLS, + "&Tools" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP, + "&Help" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT, + "Σχετικά με το RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_DOCUMENTATION, + "Εγχειρίδιο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE, + "Load Custom Core..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE, + "Φόρτωση Πυρήνα΄" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOADING_CORE, + "Φόρτωση Πυρήνα..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_NAME, + "Όνομα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION, + "Έκδοση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS, + "Λίστες Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER, + "File Browser" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_TOP, + "Top" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_UP, + "Up" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER, + "Content Browser" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART, + "Boxart" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT, + "Screenshot" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN, + "Title Screen" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ALL_PLAYLISTS, + "All Playlists" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE, + "Core" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_INFO, + "Core Info" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_SELECTION_ASK, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_INFORMATION, + "Information" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_WARNING, + "Warning" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ERROR, + "Error" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR, + "Network Error" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESTART_TO_TAKE_EFFECT, + "Please restart the program for the changes to take effect." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOG, + "Log" + ) +#ifdef HAVE_QT +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SCAN_FINISHED, + "Scan Finished.

    \n" + "In order for content to be correctly scanned, you must:\n" + "
    • have a compatible core already downloaded
    • \n" + "
    • have \"Core Info Files\" updated via Online Updater
    • \n" + "
    • have \"Databases\" updated via Online Updater
    • \n" + "
    • restart RetroArch if any of the above was just done
    \n" + "Finally, the content must match existing databases from here. If it is still not working, consider submitting a bug report." + ) +#endif +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHOW_WIMP, + "Εμφάνιση Μενού Επιφάνεις Εργασίας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHOW_WIMP, + "Opens the desktop menu if closed." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN, + "Don't show this again" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_STOP, + "Στοπ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ASSOCIATE_CORE, + "Associate Core" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_HIDDEN_PLAYLISTS, + "Hidden Playlists" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_HIDE, + "Hide" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_HIGHLIGHT_COLOR, + "Highlight color:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CHOOSE, + "&Choose..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_COLOR, + "Select Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_THEME, + "Select Theme" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME, + "Custom Theme" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_PATH_IS_BLANK, + "File path is blank." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY, + "File is empty." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED, + "Could not open file for reading." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_WRITE_OPEN_FAILED, + "Could not open file for writing." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST, + "File does not exist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST, + "Suggest loaded core first:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ZOOM, + "Zoom" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_VIEW, + "View" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_ICONS, + "Icons" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST, + "List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, + "Overrides" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, + "Options for overriding the global configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, + "Will start playback of the audio stream. Once finished, it will remove the current audio stream from memory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, + "Will start playback of the audio stream. Once finished, it will loop and play the track again from the beginning." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, + "Will start playback of the audio stream. Once finished, it will jump to the next audio stream in sequential order and repeat this behavior. Useful as an album playback mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, + "This will stop playback of the audio stream, but not remove it from memory. You can start playing it again by selecting 'Play'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, + "This will stop playback of the audio stream and remove it entirely from memory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, + "Adjust the volume of the audio stream." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_MIXER, + "Add this audio track to an available audio stream slot. If no slots are currently available, it will be ignored." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, + "Add this audio track to an available audio stream slot and play it. If no slots are currently available, it will be ignored." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, + "Αναπαραγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, + "Αναπαραγωγή (Looped)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL, + "Αναπαραγωγή (Sequential)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, + "Στοπ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, + "Κατάργηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, + "Ένταση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, + "Τρέχων πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_SEARCH_CLEAR, + "Clear" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACHIEVEMENT_PAUSE, + "Pause achievements for current session (This action will enable savestates, cheats, rewind, pause, and slow-motion)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACHIEVEMENT_RESUME, + "Resume achievements for current session (This action will disable savestates, cheats, rewind, pause, and slow-motion and reset the current game)." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, + "In-Menu" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME, + "In-Game" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED, + "In-Game (Paused)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING, + "Playing" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, + "Paused" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, + "Ενεργοποίηση Discord Rich Presence" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISCORD_ALLOW, + "Ενεργοποίηση ή απενεργοποίηση υποστήριξης Discord Rich Presence.\n" + "ΣΗΜΕΙΩΣΗ: Δεν θα δουλέψει με την έκδοση του περιηγητή, μόνο με την τοπικά εγκατεστημένη." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_INPUT, + "Είσοδος" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_INPUT, + "Επιλογή συσκευής εισόδου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_OUTPUT, + "Έξοδος" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_OUTPUT, + "Επιλογή συσκευής εξόδου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_VOLUME, + "Ένταση" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_VOLUME, + "Ορισμός έντασης εξόδου (%)." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, + "Διαχείριση Ενέργειας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, + "Αλλαγή ρυθμίσεων διαχείρισης ενέργειας." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, + "Κατάσταση Συνεχούς Επίδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MPV_SUPPORT, + "Υποστήριξη mpv" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_IDX, + "Index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MATCH_IDX, + "View Match #" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MATCH, + "Match Address: %08X Mask: %02X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_MATCH, + "Create Code Match #" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_MATCH, + "Delete Match #" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_BROWSE_MEMORY, + "Browse Address: %08X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DESC, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_STATE, + "Ενεργοποιημένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CODE, + "Κωδικός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_HANDLER, + "Handler" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MEMORY_SEARCH_SIZE, + "Memory Search Size" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_TYPE, + "Τύπος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_VALUE, + "Τιμή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS, + "Memory Address" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS_BIT_POSITION, + "Memory Address Mask" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_TYPE, + "Rumble When Memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_VALUE, + "Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PORT, + "Rumble Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_STRENGTH, + "Rumble Primary Strength" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_DURATION, + "Rumble Primary Duration (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_STRENGTH, + "Rumble Secondary Strength" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_DURATION, + "Rumble Secondary Duration (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_COUNT, + "Number of Iterations" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_VALUE, + "Value Increase Each Iteration" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_ADDRESS, + "Address Increase Each Iteration" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_AFTER, + "Add New Cheat After This One" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BEFORE, + "Add New Cheat Before This One" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_AFTER, + "Copy This Cheat After" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_BEFORE, + "Copy This Cheat Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE, + "Delete This Cheat" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_EMU, + "Emulator" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_RETRO, + "RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_DISABLED, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_SET_TO_VALUE, + "Set To Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_INCREASE_VALUE, + "Increase By Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_DECREASE_VALUE, + "Decrease By Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_EQ, + "Run next cheat if value = memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_NEQ, + "Run next cheat if value != memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_LT, + "Run next cheat if value < memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_GT, + "Run next cheat if value > memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_CHANGES, + "Changes" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DOES_NOT_CHANGE, + "Does Not Change" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE, + "Increases" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE, + "Decreases" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_EQ_VALUE, + "= Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_NEQ_VALUE, + "!= Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_LT_VALUE, + "< Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_GT_VALUE, + "> Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE_BY_VALUE, + "Increases by Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE_BY_VALUE, + "Decreases by Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_1, + "1-bit, max value = 0x01" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_2, + "2-bit, max value = 0x03" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_4, + "4-bit, max value = 0x0F" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_8, + "8-bit, max value = 0xFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_16, + "16-bit, max value = 0xFFFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_32, + "32-bit, max value = 0xFFFFFFFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_0, + "1" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_1, + "2" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_2, + "3" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_3, + "4" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_4, + "5" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_5, + "6" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_6, + "7" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_7, + "8" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_8, + "9" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_9, + "10" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_10, + "11" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_11, + "12" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_12, + "13" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_13, + "14" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_14, + "15" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_15, + "16" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_16, + "All" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_CONT, + "Start or Continue Cheat Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_RESTART, + "Start or Restart Cheat Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EXACT, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LT, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GT, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQ, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GTE, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LTE, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_NEQ, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQPLUS, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQMINUS, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES, + "Add the %u Matches to Your List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_VIEW_MATCHES, + "View the List of %u Matches" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CREATE_OPTION, + "Create Code From This Match" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_OPTION, + "Delete This Match" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_TOP, + "Add New Code to Top" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BOTTOM, + "Add New Code to Bottom" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_ALL, + "Delete All Codes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RELOAD_CHEATS, + "Reload Game-Specific Cheats" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL, + "Equal to %u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL, + "Less Than Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL, + "Greater Than Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL, + "Less Than or Equal To Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL, + "Greater Than or Equal To Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL, + "Equal to Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL, + "Not Equal to Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL, + "Equal to Before+%u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL, + "Equal to Before-%u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_SETTINGS, + "Start or Continue Cheat Search" + ) +MSG_HASH( + MSG_CHEAT_INIT_SUCCESS, + "Successfully started cheat search" + ) +MSG_HASH( + MSG_CHEAT_INIT_FAIL, + "Failed to start cheat search" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_NOT_INITIALIZED, + "Searching has not been initialized/started" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_FOUND_MATCHES, + "New match count = %u" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_BIG_ENDIAN, + "Big Endian" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS, + "Added %u matches" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL, + "Failed to add matches" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS, + "Created code from match" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADD_MATCH_FAIL, + "Failed to create code" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS, + "Deleted match" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY, + "Not enough room. The total number of cheats you can have is 100." + ) +MSG_HASH( + MSG_CHEAT_ADD_TOP_SUCCESS, + "New cheat added to top of list." + ) +MSG_HASH( + MSG_CHEAT_ADD_BOTTOM_SUCCESS, + "New cheat added to bottom of list." + ) +MSG_HASH( + MSG_CHEAT_DELETE_ALL_INSTRUCTIONS, + "Press right five times to delete all cheats." + ) +MSG_HASH( + MSG_CHEAT_DELETE_ALL_SUCCESS, + "All cheats deleted." + ) +MSG_HASH( + MSG_CHEAT_ADD_BEFORE_SUCCESS, + "New cheat added before this one." + ) +MSG_HASH( + MSG_CHEAT_ADD_AFTER_SUCCESS, + "New cheat added after this one." + ) +MSG_HASH( + MSG_CHEAT_COPY_BEFORE_SUCCESS, + "Cheat copied before this one." + ) +MSG_HASH( + MSG_CHEAT_COPY_AFTER_SUCCESS, + "Cheat copied after this one." + ) +MSG_HASH( + MSG_CHEAT_DELETE_SUCCESS, + "Cheat deleted." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PROGRESS, + "Progress:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_LIST_MAX_COUNT, + "\"All Playlists\" max list entries:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_GRID_MAX_COUNT, + "\"All Playlists\" max grid entries:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SHOW_HIDDEN_FILES, + "Εμφάνιση κρυφών αρχείων και φακέλων:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_NEW_PLAYLIST, + "Νέα Λίστα Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ENTER_NEW_PLAYLIST_NAME, + "Please enter the new playlist name:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DELETE_PLAYLIST, + "Διαγραφή Λίστας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RENAME_PLAYLIST, + "Μετονομασία Λίστας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST, + "Are you sure you want to delete the playlist \"%1\"?" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_QUESTION, + "Question" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_DELETE_FILE, + "Could not delete file." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE, + "Could not rename file." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_GATHERING_LIST_OF_FILES, + "Gathering list of files..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADDING_FILES_TO_PLAYLIST, + "Adding files to playlist..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY, + "Playlist Entry" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_NAME, + "Όνομα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH, + "Path:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_CORE, + "Πυρήνας:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_DATABASE, + "Database:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS, + "Extensions:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS_PLACEHOLDER, + "(space-separated; includes all by default)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_FILTER_INSIDE_ARCHIVES, + "Filter inside archives" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS, + "(used to find thumbnails)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM, + "Are you sure you want to delete the item \"%1\"?" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, + "Please choose a single playlist first." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DELETE, + "Delete" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY, + "Add Entry..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_FILES, + "Add File(s)..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER, + "Add Folder..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_EDIT, + "Edit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_FILES, + "Select Files" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER, + "Select Folder" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY, + "Error updating playlist entry." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS, + "Please fill out all required fields." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_NIGHTLY, + "Update RetroArch (nightly)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FINISHED, + "RetroArch updated successfully. Please restart the application for the changes to take effect." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FAILED, + "Update failed." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT_CONTRIBUTORS, + "Contributors" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CURRENT_SHADER, + "Current shader" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MOVE_DOWN, + "Move Down" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MOVE_UP, + "Move Up" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOAD, + "Load" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SAVE, + "Save" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_REMOVE, + "Remove" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_APPLY, + "Apply" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_ADD_PASS, + "Add Pass" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES, + "Clear All Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_NO_PASSES, + "No shader passes." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_PASS, + "Reset Pass" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_ALL_PASSES, + "Reset All Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_PARAMETER, + "Reset Parameter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_THUMBNAIL, + "Download thumbnail" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALREADY_IN_PROGRESS, + "A download is already in progress." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST, + "Start on playlist:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS, + "Λήψη Όλων των Σκίτσων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_ENTIRE_SYSTEM, + "Όλο το Σύστημα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_THIS_PLAYLIST, + "Αυτή η Λίστα Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_PACK_DOWNLOADED_SUCCESSFULLY, + "Thumbnails downloaded successfully." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_PLAYLIST_THUMBNAIL_PROGRESS, + "Succeeded: %1 Failed: %2" + ) +MSG_HASH( + MSG_DEVICE_CONFIGURED_IN_PORT, + "Configured in port:" + ) +MSG_HASH( + MSG_FAILED_TO_SET_DISK, + "Failed to set disk" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_OPTIONS, + "Επιλογές Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ADAPTIVE_VSYNC, + "Adaptive Vsync" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, + "V-Sync is enabled until performance falls below the target refresh rate. Can minimize stuttering when performance falls below realtime, and can be more energy efficient." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, + "CRT SwitchRes" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, + "Output native, low-resolution signals for use with CRT displays." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, + "Cycle through these options if the image is not centered properly on the display." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, + "X-Axis Centering" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, + "Use a custom refresh rate specified in the config file if needed." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, + "Use Custom Refresh Rate" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, + "Select the output port connected to the CRT display." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, + "Output Display ID" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, + "Έναρξη Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, + "Ξεκινάει την εγγραφή." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, + "Τέλος Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, + "Σταματάει την εγγραφή." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, + "Έναρξη Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_START_STREAMING, + "Ξεκινάει την απευθείας μετάδοση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, + "Τέλος Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, + "Σταματάει την απευθείας μετάδοση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_RECORDING_TOGGLE, + "Εγγραφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, + "Απευθείας Μετάδοση" + ) +MSG_HASH( + MSG_CHEEVOS_HARDCORE_MODE_DISABLED, + "A savestate was loaded, Achievements Hardcore Mode disabled for the current session. Restart to enable hardcore mode." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Ποιότητα Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Ποιότητα Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Σύνδεσμος Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "Θύρα UDP Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Κλειδί Απευθείας Μετάδοσης Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "Κλειδί Απευθείας Μετάδοσης YouTube" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Μέσο Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Τίτλος Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, + "Χωριστά Joy-Con" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, + "Επαναφορά Προεπιλογών" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, + "Επαναφορά της τρέχουσας διαμόρφωσης στις προεπιλεγμένες ρυθμίσεις." + ) \ No newline at end of file diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index a3a118a1d1..6b4c968fcd 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1515,6 +1515,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_LANG_ARABIC, "Arabic" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_GREEK, + "Greek" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Left Analog" diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index c2cbba6769..4cbd18936c 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -271,6 +271,7 @@ enum retro_language RETRO_LANGUAGE_POLISH = 14, RETRO_LANGUAGE_VIETNAMESE = 15, RETRO_LANGUAGE_ARABIC = 16, + RETRO_LANGUAGE_GREEK = 17, RETRO_LANGUAGE_LAST, /* Ensure sizeof(enum) == sizeof(int) */ diff --git a/menu/menu_setting.c b/menu/menu_setting.c index fbf57eab1b..5431fa6df6 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1873,7 +1873,7 @@ static void setting_get_string_representation_uint_user_language( modes[RETRO_LANGUAGE_POLISH] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_POLISH); modes[RETRO_LANGUAGE_VIETNAMESE] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE); modes[RETRO_LANGUAGE_ARABIC] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_ARABIC); - + modes[RETRO_LANGUAGE_GREEK] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LANG_GREEK); strlcpy(s, modes[*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE)], len); } #endif diff --git a/msg_hash.c b/msg_hash.c index ce82ea9f4e..a9e7e7e5b2 100644 --- a/msg_hash.c +++ b/msg_hash.c @@ -82,6 +82,9 @@ int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len) case RETRO_LANGUAGE_ARABIC: ret = menu_hash_get_help_ar_enum(msg, s, len); break; + case RETRO_LANGUAGE_GREEK: + ret = menu_hash_get_help_el_enum(msg, s, len); + break; default: break; } @@ -151,6 +154,9 @@ const char *msg_hash_to_str(enum msg_hash_enums msg) case RETRO_LANGUAGE_ARABIC: ret = msg_hash_to_str_ar(msg); break; + case RETRO_LANGUAGE_GREEK: + ret = msg_hash_to_str_el(msg); + break; default: break; } diff --git a/msg_hash.h b/msg_hash.h index bce6ce1de8..855e2609bb 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1838,6 +1838,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_LANG_POLISH, MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + MENU_ENUM_LABEL_VALUE_LANG_GREEK, MENU_ENUM_LABEL_VALUE_NONE, MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE, @@ -2443,6 +2444,9 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len); const char *msg_hash_to_str_ar(enum msg_hash_enums msg); int menu_hash_get_help_ar_enum(enum msg_hash_enums msg, char *s, size_t len); +const char *msg_hash_to_str_el(enum msg_hash_enums msg); +int menu_hash_get_help_el_enum(enum msg_hash_enums msg, char *s, size_t len); + int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len); enum msg_file_type msg_hash_to_file_type(uint32_t hash); From c5f9fc0a342ed28b793b64fcf35dc950d4a098d8 Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Thu, 11 Oct 2018 15:37:15 -0700 Subject: [PATCH 0332/1292] WiiU: fix network information == DETAILS For local netplay, it's useful to have your IP address easily available. This commit makes the Information > Network Information menu display the Wii U's IP address. Change summary: - Fix the logging init to be reentrant to avoid socket consumption - Add implementation of POSIX `getifaddrs()` and `freeifaddrs()` to `missing_libc_functions.c` - Remove compiler directives protecting the code paths that call `getifaddrs()` from being used in Wii U builds == TESTING Have tested locally, successfully get IP address information in the Information > Network Information. I think this may also fix NAT traversal. Will need to be tested. --- Makefile.wiiu | 2 - frontend/drivers/platform_wiiu.c | 3 + libretro-common/net/net_natt.c | 2 +- menu/menu_displaylist.c | 4 +- wiiu/include/arpa/inet.h | 1 + wiiu/include/ifaddrs.h | 18 ++++ wiiu/system/missing_libc_functions.c | 129 +++++++++++++++++++++++++++ 7 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 wiiu/include/ifaddrs.h diff --git a/Makefile.wiiu b/Makefile.wiiu index 83c890e2a8..81bd02c697 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -137,8 +137,6 @@ endif WANT_IOSUHAX = 1 include Makefile.common - BLACKLIST := $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o - OBJ := $(filter-out $(BLACKLIST),$(OBJ)) OBJ += gfx/drivers/gx2_gfx.o OBJ += gfx/drivers_font/wiiu_font.o diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index 1976beb86a..69e9ffc7c4 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -530,6 +530,9 @@ static void wiiu_log_init(int port) { wiiu_log_lock = 0; + if(wiiu_log_socket >= 0) + return; + if(broadcast_init(port) < 0) return; diff --git a/libretro-common/net/net_natt.c b/libretro-common/net/net_natt.c index 14dbdeeb8b..b6dc5c91b4 100644 --- a/libretro-common/net/net_natt.c +++ b/libretro-common/net/net_natt.c @@ -184,7 +184,7 @@ static bool natt_open_port(struct natt_status *status, bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_protocol proto) { -#if !defined(HAVE_SOCKET_LEGACY) && !defined(WIIU) && !defined(SWITCH) +#if !defined(HAVE_SOCKET_LEGACY) && !defined(SWITCH) size_t i; char port_str[6]; struct net_ifinfo list; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 96b64a43a2..d816d94af0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -97,7 +97,7 @@ static enum msg_hash_enums new_type = MSG_UNKNOWN; * function pointer callback functions that don't necessarily * call each other. */ -#if !defined(HAVE_SOCKET_LEGACY) && !defined(WIIU) && !defined(SWITCH) +#if !defined(HAVE_SOCKET_LEGACY) && !defined(SWITCH) #include static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info) @@ -4834,7 +4834,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) break; case DISPLAYLIST_NETWORK_INFO: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); -#if defined(HAVE_NETWORKING) && !defined(HAVE_SOCKET_LEGACY) && !defined(WIIU) && !defined(SWITCH) +#if defined(HAVE_NETWORKING) && !defined(HAVE_SOCKET_LEGACY) && !defined(SWITCH) count = menu_displaylist_parse_network_info(info); #endif diff --git a/wiiu/include/arpa/inet.h b/wiiu/include/arpa/inet.h index fa505565c6..2a79d9526d 100644 --- a/wiiu/include/arpa/inet.h +++ b/wiiu/include/arpa/inet.h @@ -6,6 +6,7 @@ extern "C" { #endif #include +#include char *inet_ntoa(struct in_addr in); const char *inet_ntop(int af, const void *cp, char *buf, socklen_t len); diff --git a/wiiu/include/ifaddrs.h b/wiiu/include/ifaddrs.h new file mode 100644 index 0000000000..bf78a06c02 --- /dev/null +++ b/wiiu/include/ifaddrs.h @@ -0,0 +1,18 @@ +#ifndef _IFADDRS_H_ +#define _IFADDRS_H_ + +#include + +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + unsigned int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_dstaddr; + void *ifa_data; +}; + +int getifaddrs(struct ifaddrs **ifap); +void freeifaddrs(struct ifaddrs *ifp); +#endif // _IFADDRS_H_ \ No newline at end of file diff --git a/wiiu/system/missing_libc_functions.c b/wiiu/system/missing_libc_functions.c index bc47266b3a..4a35405a10 100644 --- a/wiiu/system/missing_libc_functions.c +++ b/wiiu/system/missing_libc_functions.c @@ -5,10 +5,18 @@ #include #include #include +#include +#include #include #include +#include #include #include +#include +#include +#include + +#include /* This is usually in libogc; we can't use that on wiiu */ int usleep(useconds_t microseconds) { @@ -112,3 +120,124 @@ int clock_gettime(clockid_t clk_id, struct timespec* tp) { } return 0; } + +/** + * Implementation of getifaddrs() and freeifaddrs() for WiiU. + */ + +// the Wii U doesn't define an interface name, so we'll use something generic. +static const char *wiiu_iface_name = "eth0"; + +/** + * Allocate and zeroize the hunk of memory for the ifaddrs struct and its contents; the struct will be filled + * out later. + * + * returns NULL if any of the memory allocations fail. + */ +static struct ifaddrs *buildEmptyIfa() { + struct ifaddrs *result = (struct ifaddrs *)malloc(sizeof(struct ifaddrs)); + if(result != NULL) { + memset(result, 0, sizeof(struct ifaddrs)); + result->ifa_name = strdup(wiiu_iface_name); + result->ifa_addr = (struct sockaddr *)malloc(sizeof(struct sockaddr_in)); + result->ifa_netmask = (struct sockaddr *)malloc(sizeof(struct sockaddr_in)); + result->ifa_dstaddr = (struct sockaddr *)malloc(sizeof(struct sockaddr_in)); + + if(!result->ifa_name || !result->ifa_addr || !result->ifa_netmask || !result->ifa_dstaddr) + goto error; + + memset(result->ifa_addr, 0, sizeof(struct sockaddr_in)); + result->ifa_addr->sa_family = AF_INET; + memset(result->ifa_netmask, 0, sizeof(struct sockaddr_in)); + result->ifa_netmask->sa_family = AF_INET; + memset(result->ifa_dstaddr, 0, sizeof(struct sockaddr_in)); + result->ifa_dstaddr->sa_family = AF_INET; + } + + return result; + error: + freeifaddrs(result); + return NULL; +} + +static int getAssignedAddress(struct sockaddr_in *sa) { + if(sa == NULL) + return -1; + ACIpAddress addr; + int result = ACGetAssignedAddress(&addr); + if(result == 0) + sa->sin_addr.s_addr = addr; + + return result; +} + +static int getAssignedSubnet(struct sockaddr_in *sa) { + if(sa == NULL) + return -1; + + ACIpAddress mask; + int result = ACGetAssignedSubnet(&mask); + if(result == 0) + sa->sin_addr.s_addr = mask; + + return result; +} + +static int getBroadcastAddress(struct sockaddr_in *sa, struct sockaddr_in *addr, struct sockaddr_in *mask) { + if(!sa || !addr || !mask) + return -1; + + sa->sin_addr.s_addr = addr->sin_addr.s_addr | (~mask->sin_addr.s_addr); + return 0; +} + +static struct ifaddrs *getWiiUInterfaceAddressData(void) { + struct ifaddrs *result = buildEmptyIfa(); + + if(result != NULL) { + if(getAssignedAddress((struct sockaddr_in *)result->ifa_addr) < 0 || + getAssignedSubnet((struct sockaddr_in *)result->ifa_netmask) < 0 || + getBroadcastAddress((struct sockaddr_in *)result->ifa_dstaddr, + (struct sockaddr_in *)result->ifa_addr, + (struct sockaddr_in *)result->ifa_netmask) < 0) { + goto error; + } + } + + return result; + + error: + freeifaddrs(result); + return NULL; +} + +int getifaddrs(struct ifaddrs **ifap) { + if(ifap == NULL) { + return -1; + } + *ifap = getWiiUInterfaceAddressData(); + + return (*ifap == NULL) ? -1 : 0; +} + +void freeifaddrs(struct ifaddrs *ifp) { + if(ifp != NULL) { + if(ifp->ifa_name) { + free(ifp->ifa_name); + ifp->ifa_name = NULL; + } + if(ifp->ifa_addr) { + free(ifp->ifa_addr); + ifp->ifa_addr = NULL; + } + if(ifp->ifa_netmask) { + free(ifp->ifa_netmask); + ifp->ifa_netmask = NULL; + } + if(ifp->ifa_dstaddr) { + free(ifp->ifa_dstaddr); + ifp->ifa_dstaddr = NULL; + } + free(ifp); + } +} \ No newline at end of file From b8cb3fd4a7175b551f2f6c72cadb6b7ce0bce4d6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Oct 2018 01:37:53 +0200 Subject: [PATCH 0333/1292] (CHANGES.md) Update --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7a26574e83..b308524723 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ # 1.7.6 (future) - DATE: Add Date / Time style options. - MIDI: Add a Linux ALSA driver for MIDI. +- LOCALIZATION: Add Greek translation. - LOCALIZATION: Update German translation. - LOCALIZATION: Update Italian translation. - LOCALIZATION: Update Simplified Chinese translation. @@ -8,7 +9,7 @@ - SCANNER: Fix GDI disc scanning. - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. -- WIIU: Initial netplay peer-to-peer support. +- WIIU: Initial netplay peer-to-peer support. Network information working. # 1.7.5 - CAMERA: Fix Video4Linux2 driver that broke years ago. From e1227b2d68cc95dc8ae84fa5503d062fb541fcef Mon Sep 17 00:00:00 2001 From: radius Date: Thu, 11 Oct 2018 20:15:50 -0500 Subject: [PATCH 0334/1292] enable local room discovery on WiiU --- network/netplay/netplay_discovery.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/network/netplay/netplay_discovery.c b/network/netplay/netplay_discovery.c index 67781977c0..0acc6c7598 100644 --- a/network/netplay/netplay_discovery.c +++ b/network/netplay/netplay_discovery.c @@ -134,7 +134,7 @@ void deinit_netplay_discovery(void) /* Todo: implement net_ifinfo and ntohs for consoles */ bool netplay_discovery_driver_ctl(enum rarch_netplay_discovery_ctl_state state, void *data) { -#ifndef RARCH_CONSOLE +#if defined(WIIU) || !defined(RARCH_CONSOLE) char port_str[6]; int ret; unsigned k = 0; @@ -162,7 +162,7 @@ bool netplay_discovery_driver_ctl(enum rarch_netplay_discovery_ctl_state state, #if defined(SOL_SOCKET) && defined(SO_BROADCAST) if (setsockopt(lan_ad_client_fd, SOL_SOCKET, SO_BROADCAST, (const char *)&canBroadcast, sizeof(canBroadcast)) < 0) - RARCH_WARN("[discovery] Failed to set netplay discovery port to broadcast\n"); + RARCH_WARN("[discovery] Failed to set netplay discovery port to broadcast\n"); #endif /* Put together the request */ @@ -238,7 +238,7 @@ error: bool netplay_lan_ad_server(netplay_t *netplay) { /* Todo: implement net_ifinfo and ntohs for consoles */ -#ifndef RARCH_CONSOLE +#if defined(WIIU) || !defined(RARCH_CONSOLE) fd_set fds; int ret; struct timeval tmp_tv = {0}; @@ -255,7 +255,7 @@ bool netplay_lan_ad_server(netplay_t *netplay) return false; if (lan_ad_server_fd < 0 && !init_lan_ad_server_socket(netplay, RARCH_DEFAULT_PORT)) - return false; + return false; /* Check for any ad queries */ while (1) From 8daff7e3da60511757b0d4f95b3e8d32dd7616d2 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 7 Oct 2018 09:53:13 -0500 Subject: [PATCH 0335/1292] force fast-save-states while netplay is enabled --- dynamic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dynamic.c b/dynamic.c index 6613a4f03c..e1bd95e018 100644 --- a/dynamic.c +++ b/dynamic.c @@ -1839,6 +1839,8 @@ bool rarch_environment_cb(unsigned cmd, void *data) #ifdef HAVE_NETWORKING if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_REPLAYING, NULL)) result &= ~(1|2); + if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) + result |= 4; #endif if (data != NULL) { From 7dd05d4750fbba9ec6efda1265b2ac32c650b3a0 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Fri, 12 Oct 2018 13:10:44 +0800 Subject: [PATCH 0336/1292] Minor Fix --- intl/msg_hash_chs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 29055f0d28..7344c0f331 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1841,7 +1841,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, "保存核心预设") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT, - "保存内容到预设的目录") + "保存游戏文件夹预设") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, "保存游戏预设") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT, @@ -3430,7 +3430,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, "将当前渲染器设置保存为新的渲染器预设文件。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE, - "将当前渲染器设置保存为当前内核的默认设置。") + "将当前渲染器设置保存为当前核心的默认设置。") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_PARENT, + "将当前渲染器设置保存为当前游戏文件夹的默认设置。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME, "将当前渲染器设置保存为当前游戏内容的默认设置。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS, From 92eb209c6f88f88ca33f16d118fccaaeff42c9f5 Mon Sep 17 00:00:00 2001 From: Ayssia Date: Fri, 12 Oct 2018 13:51:43 +0800 Subject: [PATCH 0337/1292] Minor Fix --- intl/msg_hash_chs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 7344c0f331..70ab24efab 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1760,6 +1760,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, "<使用当前文件夹>") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, "允许旋转") +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO, + "宽高比设置") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, "自动选择宽高比") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, From eac0d603f43df28f74e16d78cdf071c2c11ff02b Mon Sep 17 00:00:00 2001 From: natinusala Date: Fri, 12 Oct 2018 17:29:24 +0200 Subject: [PATCH 0338/1292] libnx: add network interfaces info --- Makefile.libnx | 2 +- frontend/drivers/platform_switch.c | 2 + libretro-common/net/net_ifinfo.c | 73 +++++++++++++++++++++++++++++- libretro-common/net/net_natt.c | 2 +- menu/menu_displaylist.c | 4 +- 5 files changed, 77 insertions(+), 6 deletions(-) diff --git a/Makefile.libnx b/Makefile.libnx index 00343d6b1c..d84f191f88 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -70,7 +70,7 @@ else endif include Makefile.common -BLACKLIST := $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o +BLACKLIST := OBJ := $(filter-out $(BLACKLIST),$(OBJ)) diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 39cb228a47..166640ee21 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -191,6 +191,7 @@ static void frontend_switch_deinit(void *data) (void)data; #ifdef HAVE_LIBNX + nifmExit(); #if defined(SWITCH) && defined(NXLINK) socketExit(); #endif @@ -607,6 +608,7 @@ static void frontend_switch_init(void *data) (void)data; #ifdef HAVE_LIBNX + nifmInitialize(); #ifndef HAVE_OPENGL /* Init Resolution before initDefault */ gfxInitResolution(1280, 720); diff --git a/libretro-common/net/net_ifinfo.c b/libretro-common/net/net_ifinfo.c index 77c5971171..55be3c90e9 100644 --- a/libretro-common/net/net_ifinfo.c +++ b/libretro-common/net/net_ifinfo.c @@ -38,9 +38,11 @@ #ifdef WANT_IFADDRS #include #else +#ifndef HAVE_LIBNX #include #endif #endif +#endif #include @@ -71,10 +73,77 @@ void net_ifinfo_free(net_ifinfo_t *list) free(list->entries); } +#ifdef HAVE_LIBNX +static void convert_ip(char *dst, size_t size, uint32_t ip, bool inverted) +{ + unsigned char bytes[4]; + bytes[0] = ip & 0xFF; + bytes[1] = (ip >> 8) & 0xFF; + bytes[2] = (ip >> 16) & 0xFF; + bytes[3] = (ip >> 24) & 0xFF; + + if (inverted) + snprintf(dst, size, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]); + else + snprintf(dst, size, "%d.%d.%d.%d", bytes[3], bytes[2], bytes[1], bytes[0]); +} +#endif + bool net_ifinfo_new(net_ifinfo_t *list) { unsigned k = 0; -#if defined(_WIN32) && !defined(_XBOX) +#ifdef HAVE_LIBNX + uint32_t id; + Result rc; + + char hostname[128]; + struct net_ifinfo_entry *ptr = NULL; + + memset(list, 0, sizeof(net_ifinfo_t)); + + /* loopback */ + convert_ip(hostname, sizeof(hostname), INADDR_LOOPBACK, false); + + ptr = (struct net_ifinfo_entry*) + realloc(list->entries, (k+1) * sizeof(struct net_ifinfo_entry)); + + if (!ptr) + goto error; + + list->entries = ptr; + + list->entries[k].name = strdup("lo"); + list->entries[k].host = strdup(hostname); + list->size = k + 1; + + k++; + + /* + actual interface + can be wlan or eth (with a wiiu adapter) + so we just use "switch" as a name + */ + rc = nifmGetCurrentIpAddress(&id); + + if (!R_SUCCEEDED(rc)) /* not connected to any network */ + return true; + + convert_ip(hostname, sizeof(hostname), id, true); + + ptr = (struct net_ifinfo_entry*) + realloc(list->entries, (k+1) * sizeof(struct net_ifinfo_entry)); + + if (!ptr) + goto error; + + list->entries = ptr; + + list->entries[k].name = strdup("switch"); + list->entries[k].host = strdup(hostname); + list->size = k + 1; + + return true; +#elif defined(_WIN32) && !defined(_XBOX) PIP_ADAPTER_ADDRESSES adapter_addresses = NULL, aa = NULL; PIP_ADAPTER_UNICAST_ADDRESS ua = NULL; #ifdef _WIN32_WINNT_WINXP @@ -173,7 +242,7 @@ error: #ifdef _WIN32 if (adapter_addresses) free(adapter_addresses); -#else +#elif !defined(HAVE_LIBNX) freeifaddrs(ifaddr); #endif net_ifinfo_free(list); diff --git a/libretro-common/net/net_natt.c b/libretro-common/net/net_natt.c index b6dc5c91b4..eca2a65500 100644 --- a/libretro-common/net/net_natt.c +++ b/libretro-common/net/net_natt.c @@ -184,7 +184,7 @@ static bool natt_open_port(struct natt_status *status, bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_protocol proto) { -#if !defined(HAVE_SOCKET_LEGACY) && !defined(SWITCH) +#if !defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX)) size_t i; char port_str[6]; struct net_ifinfo list; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index d816d94af0..adb2d3d375 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -97,7 +97,7 @@ static enum msg_hash_enums new_type = MSG_UNKNOWN; * function pointer callback functions that don't necessarily * call each other. */ -#if !defined(HAVE_SOCKET_LEGACY) && !defined(SWITCH) +#if !defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX)) #include static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info) @@ -4834,7 +4834,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) break; case DISPLAYLIST_NETWORK_INFO: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); -#if defined(HAVE_NETWORKING) && !defined(HAVE_SOCKET_LEGACY) && !defined(SWITCH) +#if defined(HAVE_NETWORKING) && !defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX)) count = menu_displaylist_parse_network_info(info); #endif From ba020720dbb25d3bccadb01ccd622f207bc1d9cc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Oct 2018 18:29:52 +0200 Subject: [PATCH 0339/1292] Add HAVE_NETPLAYDISCOVERY --- Makefile.common | 4 +++ Makefile.griffin | 11 ++++++ Makefile.libnx | 1 + Makefile.wiiu | 3 +- Makefile.win | 1 + network/netplay/netplay_discovery.c | 4 +-- pkg/android/phoenix/jni/Android.mk | 2 +- pkg/android/phoenix64/jni/Android.mk | 2 +- .../RetroArch_Metal.xcodeproj/project.pbxproj | 2 ++ .../RetroArch_PPC.xcodeproj/project.pbxproj | 2 ++ .../RetroArch_iOS10.xcodeproj/project.pbxproj | 5 +++ .../project.pbxproj | 5 +++ .../RetroArch_iOS11.xcodeproj/project.pbxproj | 5 +++ .../project.pbxproj | 5 +++ .../RetroArch_iOS6.xcodeproj/project.pbxproj | 5 +++ .../RetroArch_iOS8.xcodeproj/project.pbxproj | 5 +++ .../RetroArch_iOS9.xcodeproj/project.pbxproj | 5 +++ pkg/msvc/msvc-2003/RetroArch-msvc2003.vcproj | 2 +- pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj | 2 +- pkg/msvc/msvc-2008/RetroArch-msvc2008.vcproj | 8 ++--- pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj | 18 +++++----- pkg/msvc/msvc-2012/RetroArch-msvc2012.vcxproj | 6 ++-- pkg/msvc/msvc-2013/RetroArch-msvc2013.vcxproj | 10 +++--- pkg/msvc/msvc-2015/RetroArch-msvc2015.vcxproj | 18 +++++----- pkg/msvc/msvc-2017/RetroArch-msvc2017.vcxproj | 34 +++++++++---------- qb/config.params.sh | 1 + 26 files changed, 112 insertions(+), 54 deletions(-) diff --git a/Makefile.common b/Makefile.common index a9be11ef4e..361de1abb5 100644 --- a/Makefile.common +++ b/Makefile.common @@ -98,6 +98,10 @@ endif CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -I$(DEPS_DIR) # Switches +# +ifeq ($(HAVE_NETPLAYDISCOVERY), 1) + CFLAGS += -DHAVE_NETPLAYDISCOVERY +endif ifeq ($(HAVE_NETLOGGER), 1) CFLAGS += -DHAVE_LOGGER diff --git a/Makefile.griffin b/Makefile.griffin index 0249e2b8e5..03d6d22d8d 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -320,6 +320,7 @@ else ifeq ($(platform), windows_msvc6_x86) HAVE_7ZIP := 1 HAVE_NETWORKING := 0 HAVE_NETWORK_CMD := 1 + HAVE_NETPLAYDISCOVERY := 1 HAVE_OVERLAY := 1 HAVE_MATERIALUI := 1 HAVE_XMB := 1 @@ -361,6 +362,7 @@ else ifeq ($(platform), windows_msvc2003_x86) HAVE_7ZIP := 1 HAVE_NETWORKING := 1 HAVE_NETWORK_CMD := 1 + HAVE_NETPLAYDISCOVERY := 1 HAVE_OVERLAY := 1 HAVE_MATERIALUI := 1 HAVE_XMB := 1 @@ -407,6 +409,7 @@ else ifeq ($(platform), windows_msvc2005_x86) HAVE_7ZIP := 1 HAVE_NETWORKING := 1 HAVE_NETWORK_CMD := 1 + HAVE_NETPLAYDISCOVERY := 1 HAVE_OVERLAY := 1 HAVE_MATERIALUI := 1 HAVE_XMB := 1 @@ -454,6 +457,7 @@ else ifneq (,$(findstring windows_msvc2010,$(platform))) HAVE_7ZIP := 1 HAVE_NETWORKING := 1 HAVE_NETWORK_CMD := 1 + HAVE_NETPLAYDISCOVERY := 1 HAVE_OVERLAY := 1 HAVE_MATERIALUI := 1 HAVE_XMB := 1 @@ -524,6 +528,7 @@ else ifneq (,$(findstring windows_msvc2012,$(platform))) HAVE_7ZIP := 1 HAVE_NETWORKING := 1 HAVE_NETWORK_CMD := 1 + HAVE_NETPLAYDISCOVERY := 1 HAVE_OVERLAY := 1 HAVE_MATERIALUI := 1 HAVE_XMB := 1 @@ -598,6 +603,7 @@ else ifneq (,$(findstring windows_msvc2013,$(platform))) HAVE_7ZIP := 1 HAVE_NETWORKING := 1 HAVE_NETWORK_CMD := 1 + HAVE_NETPLAYDISCOVERY := 1 HAVE_OVERLAY := 1 HAVE_MATERIALUI := 1 HAVE_XMB := 1 @@ -672,6 +678,7 @@ else ifneq (,$(findstring windows_msvc2015,$(platform))) HAVE_7ZIP := 1 HAVE_NETWORKING := 1 HAVE_NETWORK_CMD := 1 + HAVE_NETPLAYDISCOVERY := 1 HAVE_OVERLAY := 1 HAVE_MATERIALUI := 1 HAVE_XMB := 1 @@ -857,6 +864,10 @@ ifeq ($(HAVE_NETWORKING), 1) CFLAGS += -DHAVE_NETWORKING endif +ifeq ($(HAVE_NETPLAYDISCOVERY), 1) + CFLAGS += -DHAVE_NETPLAYDISCOVERY +endif + ifeq ($(RARCH_CONSOLE), 1) CFLAGS += -DRARCH_CONSOLE endif diff --git a/Makefile.libnx b/Makefile.libnx index d84f191f88..d417ee1a5e 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -36,6 +36,7 @@ HAVE_STATIC_AUDIO_FILTERS = 1 HAVE_MENU = 1 HAVE_RUNAHEAD = 1 HAVE_NETWORKING = 1 +HAVE_NETPLAYDISCOVERY = 1 HAVE_STB_FONT = 1 HAVE_CHEEVOS = 1 diff --git a/Makefile.wiiu b/Makefile.wiiu index 81bd02c697..e77be12ea9 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -105,7 +105,7 @@ endif OBJ += griffin/griffin.o DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER - DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING + DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING -DHAVE_NETPLAYDISCOVERY # DEFINES += -DWANT_IFADDRS # DEFINES += -DHAVE_FREETYPE DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI @@ -128,6 +128,7 @@ endif HAVE_LANGEXTRA = 1 HAVE_LIBRETRODB = 1 HAVE_NETWORKING = 1 + HAVE_NETPLAYDISCOVERY = 1 HAVE_CHEEVOS = 1 # WANT_IFADDRS = 1 HAVE_OVERLAY = 1 diff --git a/Makefile.win b/Makefile.win index 932d0f896f..02d70bde7f 100644 --- a/Makefile.win +++ b/Makefile.win @@ -8,6 +8,7 @@ HAVE_OPENGL = 1 HAVE_DYLIB = 1 HAVE_D3D9 = 1 HAVE_NETWORKING = 1 +HAVE_NETPLAYDISCOVERY = 1 HAVE_STDIN_CMD = 1 HAVE_COMMAND = 1 HAVE_THREADS = 1 diff --git a/network/netplay/netplay_discovery.c b/network/netplay/netplay_discovery.c index 0acc6c7598..fa998ad9b6 100644 --- a/network/netplay/netplay_discovery.c +++ b/network/netplay/netplay_discovery.c @@ -134,7 +134,7 @@ void deinit_netplay_discovery(void) /* Todo: implement net_ifinfo and ntohs for consoles */ bool netplay_discovery_driver_ctl(enum rarch_netplay_discovery_ctl_state state, void *data) { -#if defined(WIIU) || !defined(RARCH_CONSOLE) +#ifdef HAVE_NETPLAYDISCOVERY char port_str[6]; int ret; unsigned k = 0; @@ -238,7 +238,7 @@ error: bool netplay_lan_ad_server(netplay_t *netplay) { /* Todo: implement net_ifinfo and ntohs for consoles */ -#if defined(WIIU) || !defined(RARCH_CONSOLE) +#ifdef HAVE_NETPLAYDISCOVERY fd_set fds; int ret; struct timeval tmp_tv = {0}; diff --git a/pkg/android/phoenix/jni/Android.mk b/pkg/android/phoenix/jni/Android.mk index 84351cad95..c2f1802597 100644 --- a/pkg/android/phoenix/jni/Android.mk +++ b/pkg/android/phoenix/jni/Android.mk @@ -72,7 +72,7 @@ else DEFINES += -DHAVE_OPENGLES2 endif -DEFINES += -DRARCH_MOBILE -DHAVE_GRIFFIN -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_OPENGLES -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_EGL -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DINLINE=inline -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETWORKGAMEPAD -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_MATERIALUI -DHAVE_XMB -DHAVE_SHADERPIPELINE -DHAVE_LIBRETRODB -DHAVE_STB_FONT -DHAVE_IMAGEVIEWER -DHAVE_UPDATE_ASSETS -DHAVE_CC_RESAMPLER -DHAVE_MINIUPNPC -DHAVE_BUILTINMINIUPNPC -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -DHAVE_KEYMAPPER -DHAVE_NETWORKGAMEPAD -DHAVE_FLAC -DHAVE_DR_FLAC -DHAVE_DR_MP3 -DHAVE_CHD -DHAVE_RUNAHEAD -DENABLE_HLSL +DEFINES += -DRARCH_MOBILE -DHAVE_GRIFFIN -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_OPENGLES -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_EGL -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DINLINE=inline -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETWORKGAMEPAD -DHAVE_NETWORKING -DHAVE_NETPLAYDISCOVERY -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_MATERIALUI -DHAVE_XMB -DHAVE_SHADERPIPELINE -DHAVE_LIBRETRODB -DHAVE_STB_FONT -DHAVE_IMAGEVIEWER -DHAVE_UPDATE_ASSETS -DHAVE_CC_RESAMPLER -DHAVE_MINIUPNPC -DHAVE_BUILTINMINIUPNPC -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -DHAVE_KEYMAPPER -DHAVE_NETWORKGAMEPAD -DHAVE_FLAC -DHAVE_DR_FLAC -DHAVE_DR_MP3 -DHAVE_CHD -DHAVE_RUNAHEAD -DENABLE_HLSL DEFINES += -DWANT_IFADDRS ifeq ($(HAVE_VULKAN),1) diff --git a/pkg/android/phoenix64/jni/Android.mk b/pkg/android/phoenix64/jni/Android.mk index 4e148617fa..9862b63375 100644 --- a/pkg/android/phoenix64/jni/Android.mk +++ b/pkg/android/phoenix64/jni/Android.mk @@ -72,7 +72,7 @@ else DEFINES += -DHAVE_OPENGLES2 endif -DEFINES += -DRARCH_MOBILE -DHAVE_GRIFFIN -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_OPENGLES -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_EGL -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DINLINE=inline -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETWORKGAMEPAD -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_MATERIALUI -DHAVE_XMB -DHAVE_SHADERPIPELINE -DHAVE_LIBRETRODB -DHAVE_STB_FONT -DHAVE_IMAGEVIEWER -DHAVE_UPDATE_ASSETS -DHAVE_CC_RESAMPLER -DHAVE_MINIUPNPC -DHAVE_BUILTINMINIUPNPC -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -DHAVE_KEYMAPPER -DHAVE_NETWORKGAMEPAD -DHAVE_FLAC -DHAVE_DR_FLAC -DHAVE_DR_MP3 -DHAVE_CHD -DHAVE_RUNAHEAD -DENABLE_HLSL +DEFINES += -DRARCH_MOBILE -DHAVE_GRIFFIN -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_OPENGLES -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_EGL -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DINLINE=inline -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETWORKGAMEPAD -DHAVE_NETPLAYDISCOVERY -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_MATERIALUI -DHAVE_XMB -DHAVE_SHADERPIPELINE -DHAVE_LIBRETRODB -DHAVE_STB_FONT -DHAVE_IMAGEVIEWER -DHAVE_UPDATE_ASSETS -DHAVE_CC_RESAMPLER -DHAVE_MINIUPNPC -DHAVE_BUILTINMINIUPNPC -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -DHAVE_KEYMAPPER -DHAVE_NETWORKGAMEPAD -DHAVE_FLAC -DHAVE_DR_FLAC -DHAVE_DR_MP3 -DHAVE_CHD -DHAVE_RUNAHEAD -DENABLE_HLSL DEFINES += -DWANT_IFADDRS ifeq ($(HAVE_VULKAN),1) diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index 2cfc05036c..a0780ba6cc 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -1843,6 +1843,7 @@ "-DHAVE_COCOA", "-DHAVE_NETWORKGAMEPAD", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DRARCH_INTERNAL", "-DHAVE_THREADS", "-DHAVE_DYLIB", @@ -1957,6 +1958,7 @@ "-DHAVE_COCOA", "-DHAVE_NETWORKGAMEPAD", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DRARCH_INTERNAL", "-DHAVE_THREADS", "-DHAVE_DYLIB", diff --git a/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj index 5ed3fc21e5..15f9cadc81 100644 --- a/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj @@ -319,6 +319,7 @@ "-DHAVE_MAIN", "-DHAVE_NETWORKGAMEPAD", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DRARCH_INTERNAL", "-DHAVE_THREADS", "-DHAVE_DYLIB", @@ -395,6 +396,7 @@ "-DHAVE_MAIN", "-DHAVE_NETWORKGAMEPAD", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DRARCH_INTERNAL", "-DHAVE_THREADS", "-DHAVE_DYLIB", diff --git a/pkg/apple/RetroArch_iOS10.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS10.xcodeproj/project.pbxproj index a7643d2152..e1461cca61 100644 --- a/pkg/apple/RetroArch_iOS10.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS10.xcodeproj/project.pbxproj @@ -332,6 +332,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -419,6 +420,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -473,6 +475,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -561,6 +564,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -633,6 +637,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", diff --git a/pkg/apple/RetroArch_iOS10_static.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS10_static.xcodeproj/project.pbxproj index fbc4f7413e..71564abe2b 100644 --- a/pkg/apple/RetroArch_iOS10_static.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS10_static.xcodeproj/project.pbxproj @@ -341,6 +341,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -427,6 +428,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -480,6 +482,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -567,6 +570,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -638,6 +642,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", diff --git a/pkg/apple/RetroArch_iOS11.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS11.xcodeproj/project.pbxproj index d83a5f8d63..510c0bd261 100644 --- a/pkg/apple/RetroArch_iOS11.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS11.xcodeproj/project.pbxproj @@ -332,6 +332,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -420,6 +421,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -475,6 +477,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -564,6 +567,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -636,6 +640,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", diff --git a/pkg/apple/RetroArch_iOS11_static.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS11_static.xcodeproj/project.pbxproj index c161f1728e..ebb461a418 100644 --- a/pkg/apple/RetroArch_iOS11_static.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS11_static.xcodeproj/project.pbxproj @@ -340,6 +340,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -426,6 +427,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -479,6 +481,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -566,6 +569,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", @@ -637,6 +641,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_GRIFFIN", "-DHAVE_STB_VORBIS", diff --git a/pkg/apple/RetroArch_iOS6.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS6.xcodeproj/project.pbxproj index 4e542c6909..59ff093d67 100644 --- a/pkg/apple/RetroArch_iOS6.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS6.xcodeproj/project.pbxproj @@ -344,6 +344,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -428,6 +429,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -478,6 +480,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -561,6 +564,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -632,6 +636,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", diff --git a/pkg/apple/RetroArch_iOS8.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS8.xcodeproj/project.pbxproj index 386b08d978..bf69260f49 100644 --- a/pkg/apple/RetroArch_iOS8.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS8.xcodeproj/project.pbxproj @@ -346,6 +346,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -417,6 +418,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -494,6 +496,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -581,6 +584,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -634,6 +638,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", diff --git a/pkg/apple/RetroArch_iOS9.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS9.xcodeproj/project.pbxproj index c713aba2e8..1decfd22f3 100644 --- a/pkg/apple/RetroArch_iOS9.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS9.xcodeproj/project.pbxproj @@ -361,6 +361,7 @@ "-DHAVE_NETWORKGAMEPAD", "-DHAVE_CORETEXT", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -446,6 +447,7 @@ "-DHAVE_NETWORKGAMEPAD", "-DHAVE_CORETEXT", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -498,6 +500,7 @@ "-DHAVE_NETWORKGAMEPAD", "-DHAVE_CORETEXT", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -585,6 +588,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", @@ -656,6 +660,7 @@ "-DHAVE_CORETEXT", "-DHAVE_HID", "-DHAVE_NETWORKING", + "-DHAVE_NETPLAYDISCOVERY", "-DHAVE_AVFOUNDATION", "-DHAVE_RUNAHEAD", "-DHAVE_GRIFFIN", diff --git a/pkg/msvc/msvc-2003/RetroArch-msvc2003.vcproj b/pkg/msvc/msvc-2003/RetroArch-msvc2003.vcproj index fa171bc956..7531907b67 100644 --- a/pkg/msvc/msvc-2003/RetroArch-msvc2003.vcproj +++ b/pkg/msvc/msvc-2003/RetroArch-msvc2003.vcproj @@ -21,7 +21,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\libretro-common\include";"$(SolutionDir)\..\..\libretro-common\include\compat\msvc";"$(SolutionDir)\..\..\deps";"$(SolutionDir)\..\..\deps\stb";"$(SolutionDir)\..\..\deps\rcheevos\include";"$(SolutionDir)\..\..\gfx\include"" - PreprocessorDefinitions="_WIN32;WINVER=0x0400;_WIN32_WINNT=0x0400;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;WANT_ZLIB;HAVE_DINPUT;HAVE_DSOUND;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_D3D;HAVE_D3D8;DEBUG;_DEBUG;__STDC_CONSTANT_MACROS" + PreprocessorDefinitions="_WIN32;WINVER=0x0400;_WIN32_WINNT=0x0400;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;WANT_ZLIB;HAVE_DINPUT;HAVE_DSOUND;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETPLAYDISCOVERY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_OVERLAY;HAVE_RGUI;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;HAVE_D3D;HAVE_D3D8;DEBUG;_DEBUG;__STDC_CONSTANT_MACROS" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="5" diff --git a/pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj b/pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj index 0838d2ba65..ed75674de6 100644 --- a/pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj +++ b/pkg/msvc/msvc-2005/RetroArch-msvc2005.vcproj @@ -42,7 +42,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\libretro-common\include";"$(SolutionDir)\..\..\libretro-common\include\compat\msvc";"$(SolutionDir)\..\..\deps";"$(SolutionDir)\..\..\deps\stb";"$(SolutionDir)\..\..\deps\rcheevos\include";"$(SolutionDir)\..\..\gfx\include";"$(INETSDK)\Include";"$(DXSDK_DIR)\Include"" - PreprocessorDefinitions="_WIN32_WINNT=0x0410;_WIN32;RARCH_INTERNAL;HAVE_THREADS;HAVE_D3D;HAVE_D3D9;HAVE_GLSL;HAVE_SHADERPIPELINE;HAVE_OPENGL;HAVE_CC_RESAMPLER;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_RPNG;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;WANT_ZLIB;HAVE_DINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_RTHREADS;HAVE_DYNAMIC;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" + PreprocessorDefinitions="_WIN32_WINNT=0x0410;_WIN32;RARCH_INTERNAL;HAVE_THREADS;HAVE_D3D;HAVE_D3D9;HAVE_GLSL;HAVE_SHADERPIPELINE;HAVE_OPENGL;HAVE_CC_RESAMPLER;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_RPNG;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;WANT_ZLIB;HAVE_DINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_RTHREADS;HAVE_DYNAMIC;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" diff --git a/pkg/msvc/msvc-2008/RetroArch-msvc2008.vcproj b/pkg/msvc/msvc-2008/RetroArch-msvc2008.vcproj index afaa0ce5ca..efd4191f59 100644 --- a/pkg/msvc/msvc-2008/RetroArch-msvc2008.vcproj +++ b/pkg/msvc/msvc-2008/RetroArch-msvc2008.vcproj @@ -42,7 +42,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\libretro-common\include";"$(SolutionDir)\..\..\libretro-common\include\compat\msvc";"$(SolutionDir)\..\..\deps";"$(SolutionDir)\..\..\deps\rcheevos\include";"$(SolutionDir)\..\..\gfx\include"" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_GLSL;HAVE_OVERLAY;HAVE_DINPUT;HAVE_XINPUT;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_GLSL;HAVE_OVERLAY;HAVE_DINPUT;HAVE_XINPUT;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -118,7 +118,7 @@ Optimization="2" EnableIntrinsicFunctions="true" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\libretro-common\include";"$(SolutionDir)\..\..\libretro-common\include\compat\msvc";"$(SolutionDir)\..\..\deps";"$(SolutionDir)\..\..\deps\rcheevos\include";"$(SolutionDir)\..\..\gfx\include";"$(DXSDK_DIR)Include"" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_GLSL;HAVE_OVERLAY;HAVE_DINPUT;HAVE_XINPUT;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_GLSL;HAVE_OVERLAY;HAVE_DINPUT;HAVE_XINPUT;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" @@ -193,7 +193,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\libretro-common\include";"$(SolutionDir)\..\..\libretro-common\include\compat\msvc";"$(SolutionDir)\..\..\deps";"$(SolutionDir)\..\..\deps\rcheevos\include";"$(SolutionDir)\..\..\gfx\include"" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -269,7 +269,7 @@ Optimization="2" EnableIntrinsicFunctions="true" AdditionalIncludeDirectories=""$(SolutionDir)\..\..\libretro-common\include";"$(SolutionDir)\..\..\libretro-common\include\compat\msvc";"$(SolutionDir)\..\..\deps";"$(SolutionDir)\..\..\deps\rcheevos\include";"$(SolutionDir)\..\..\gfx\include"" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;RC_DISABLE_LUA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_RUNAHEAD;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DYLIB;HAVE_DYNAMIC;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT;__STDC_CONSTANT_MACROS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" diff --git a/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj b/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj index bde207b1b2..e6d615a696 100644 --- a/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj +++ b/pkg/msvc/msvc-2010/RetroArch-msvc2010.vcxproj @@ -182,7 +182,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -202,7 +202,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -223,7 +223,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -243,7 +243,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -266,7 +266,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -292,7 +292,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3DX;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -319,7 +319,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -345,7 +345,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_CHEEVOS;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -383,4 +383,4 @@ - \ No newline at end of file + diff --git a/pkg/msvc/msvc-2012/RetroArch-msvc2012.vcxproj b/pkg/msvc/msvc-2012/RetroArch-msvc2012.vcxproj index c4ae7da5b0..e243793e61 100644 --- a/pkg/msvc/msvc-2012/RetroArch-msvc2012.vcxproj +++ b/pkg/msvc/msvc-2012/RetroArch-msvc2012.vcxproj @@ -52,7 +52,7 @@ Level3 Disabled - WIN32;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_MENU;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_OPENGL;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;_DEBUG;%(PreprocessorDefinitions) + WIN32;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_MENU;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_OPENGL;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;_DEBUG;%(PreprocessorDefinitions) $(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps\SPIRV-Cross;%(AdditionalIncludeDirectories) @@ -70,7 +70,7 @@ MaxSpeed true true - WIN32;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_MENU;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_OPENGL;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;%(PreprocessorDefinitions) + WIN32;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_MENU;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_OPENGL;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;%(PreprocessorDefinitions) $(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps\SPIRV-Cross;%(AdditionalIncludeDirectories) @@ -93,4 +93,4 @@ - \ No newline at end of file + diff --git a/pkg/msvc/msvc-2013/RetroArch-msvc2013.vcxproj b/pkg/msvc/msvc-2013/RetroArch-msvc2013.vcxproj index b3d93c79db..9d8f038124 100644 --- a/pkg/msvc/msvc-2013/RetroArch-msvc2013.vcxproj +++ b/pkg/msvc/msvc-2013/RetroArch-msvc2013.vcxproj @@ -84,7 +84,7 @@ Level3 Disabled - WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_UPDATE_ASSETS;HAVE_MENU;HAVE_SLANG;HAVE_GLSLANG;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;ENABLE_HLSL;%(PreprocessorDefinitions) + WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_UPDATE_ASSETS;HAVE_MENU;HAVE_SLANG;HAVE_GLSLANG;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;ENABLE_HLSL;%(PreprocessorDefinitions) $(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\glslang;$(SolutionDir)\..\..\deps\rcheevos\include;$(SolutionDir)\..\..\deps\SPIRV-Cross;%(AdditionalIncludeDirectories) OldStyle @@ -100,7 +100,7 @@ Level3 Disabled - WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_MENU;HAVE_SLANG;HAVE_GLSLANG;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;ENABLE_HLSL;%(PreprocessorDefinitions) + WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_MENU;HAVE_SLANG;HAVE_GLSLANG;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;_DEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;ENABLE_HLSL;%(PreprocessorDefinitions) $(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\glslang;$(SolutionDir)\..\..\deps\rcheevos\include;$(SolutionDir)\..\..\deps\SPIRV-Cross;%(AdditionalIncludeDirectories) OldStyle @@ -118,7 +118,7 @@ MaxSpeed true true - WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;HAVE_MENU;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_COMMAND;HAVE_NETWORK_CMD;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;ENABLE_HLSL;%(PreprocessorDefinitions) + WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;HAVE_MENU;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_COMMAND;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;ENABLE_HLSL;%(PreprocessorDefinitions) $(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\glslang;$(SolutionDir)\..\..\deps\rcheevos\include;$(SolutionDir)\..\..\deps\SPIRV-Cross;%(AdditionalIncludeDirectories) OldStyle @@ -138,7 +138,7 @@ MaxSpeed true true - WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_MENU;HAVE_SLANG;HAVE_GLSLANG;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;%(PreprocessorDefinitions) + WIN32;WANT_GLSLANG;HAVE_DYNAMIC;HAVE_DYLIB;HAVE_SPIRV_CROSS;RC_DISABLE_LUA;HAVE_MENU;HAVE_SLANG;HAVE_GLSLANG;HAVE_UPDATE_ASSETS;HAVE_XMB;HAVE_SHADERPIPELINE;HAVE_RGUI;HAVE_MATERIALUI;NDEBUG;_WINDOWS;HAVE_XAUDIO;HAVE_DSOUND;HAVE_DINPUT;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_OPENGL;HAVE_VULKAN;HAVE_GLSL;HAVE_THREADS;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_RJPEG;HAVE_RPNG;HAVE_ZLIB;WANT_ZLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_OVERLAY;HAVE_7ZIP;HAVE_LIBRETRODB;HAVE_STB_FONT;%(PreprocessorDefinitions) $(SolutionDir)\..\..\gfx\include\dxsdk;$(SolutionDir)\..\..\gfx\include;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\glslang;$(SolutionDir)\..\..\deps\rcheevos\include;$(SolutionDir)\..\..\deps\SPIRV-Cross;%(AdditionalIncludeDirectories) OldStyle @@ -168,4 +168,4 @@ - \ No newline at end of file + diff --git a/pkg/msvc/msvc-2015/RetroArch-msvc2015.vcxproj b/pkg/msvc/msvc-2015/RetroArch-msvc2015.vcxproj index e7cba6c2e2..7be9b56ada 100644 --- a/pkg/msvc/msvc-2015/RetroArch-msvc2015.vcxproj +++ b/pkg/msvc/msvc-2015/RetroArch-msvc2015.vcxproj @@ -190,7 +190,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -210,7 +210,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -231,7 +231,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -252,7 +252,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -275,7 +275,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -300,7 +300,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -326,7 +326,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -351,7 +351,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;HAVE_UPDATE_ASSETS;HAVE_SLANG;HAVE_GLSLANG;WANT_GLSLANG;HAVE_VULKAN;HAVE_SPIRV_CROSS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\gfx\include\dxsdk;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -385,4 +385,4 @@ - \ No newline at end of file + diff --git a/pkg/msvc/msvc-2017/RetroArch-msvc2017.vcxproj b/pkg/msvc/msvc-2017/RetroArch-msvc2017.vcxproj index 477ca5b610..162d564902 100644 --- a/pkg/msvc/msvc-2017/RetroArch-msvc2017.vcxproj +++ b/pkg/msvc/msvc-2017/RetroArch-msvc2017.vcxproj @@ -371,7 +371,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -391,7 +391,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -412,7 +412,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -433,7 +433,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -454,7 +454,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -474,7 +474,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -495,7 +495,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -516,7 +516,7 @@ Level3 Disabled - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_FBO;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreadedDebug CompileAsCpp @@ -539,7 +539,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -564,7 +564,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -590,7 +590,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -616,7 +616,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;__SSE__;__i686__;HAVE_OVERLAY;HAVE_MENU;HAVE_RGUI;HAVE_GL_SYNC;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -642,7 +642,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -667,7 +667,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -693,7 +693,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -719,7 +719,7 @@ MaxSpeed true true - WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT + WIN32;RARCH_INTERNAL;HAVE_CC_RESAMPLER;WANT_GLSLANG;HAVE_SLANG;HAVE_GLSLANG;HAVE_SPIRV_CROSS;HAVE_UPDATE_ASSETS;HAVE_D3D;HAVE_D3D9;HAVE_D3D10;HAVE_D3D11;HAVE_D3D12;HAVE_VULKAN;ENABLE_HLSL;RC_DISABLE_LUA;HAVE_CG;HAVE_GLSL;HAVE_CHEEVOS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_LANGEXTRA;HAVE_FBO;HAVE_ZLIB;HAVE_QT;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;HAVE_XMB;HAVE_SHADERPIPELINE;WANT_ZLIB;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_DINPUT;HAVE_XINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETWORKING;HAVE_NETWORK_CMD;HAVE_NETPLAYDISCOVERY;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;HAVE_RPNG;HAVE_RJPEG;HAVE_RBMP;HAVE_RTGA;HAVE_IMAGEVIEWER;WANT_ZLIB;_CRT_SECURE_NO_WARNINGS;__SSE__;__SSE2__;__x86_64__;HAVE_OVERLAY;HAVE_RGUI;HAVE_GL_SYNC;HAVE_MENU;HAVE_7ZIP;HAVE_MATERIALUI;HAVE_LIBRETRODB;HAVE_STB_FONT $(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\..\;$(MSBuildProjectDirectory)\..\..\..\deps\rcheevos\include;$(CG_INC_PATH);$(MSBuildProjectDirectory)\..\..\..\deps\zlib;$(MSBuildProjectDirectory)\..\..\..\libretro-common\include;$(MSBuildProjectDirectory)\..\..\..\deps;$(MSBuildProjectDirectory)\..\..\..\deps\glslang;$(MSBuildProjectDirectory)\..\..\..\deps\SPIRV-Cross;$(MSBuildProjectDirectory)\..\..\..\deps\stb;$(MSBuildProjectDirectory)\..\..\..\gfx\include;%(AdditionalIncludeDirectories) MultiThreaded CompileAsCpp @@ -908,4 +908,4 @@ - \ No newline at end of file + diff --git a/qb/config.params.sh b/qb/config.params.sh index 659ae20ca0..1e097b8f0c 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -37,6 +37,7 @@ HAVE_DYLIB=auto # Dynamic loading support HAVE_NETWORKING=auto # Networking features (recommended) HAVE_NETWORKGAMEPAD=auto # Networked game pad (plus baked-in core) C89_NETWORKGAMEPAD=no +HAVE_NETPLAYDISCOVERY=yes # Add netplay discovery (room creation, etc.) HAVE_MINIUPNPC=auto # Mini UPnP client library (for NAT traversal) HAVE_BUILTINMINIUPNPC=yes # Bake in Mini UPnP client library (for NAT traversal) C89_BUILTINMINIUPNPC=no From 56a69b073f2bba38b0581ac097676b137011af2e Mon Sep 17 00:00:00 2001 From: altiereslima Date: Fri, 12 Oct 2018 14:15:02 -0300 Subject: [PATCH 0340/1292] Update intl/msg_hash_pt_br.h --- intl/msg_hash_pt_br.h | 234 +++++++++++++++++++++++++++++++++--------- 1 file changed, 187 insertions(+), 47 deletions(-) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index ec0cb6b929..0861a1335d 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -1,3 +1,29 @@ +#ifdef HAVE_LAKKA_SWITCH +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE, + "Overclock da GPU" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, + "Faz um Overclock ou underclock na CPU do Switch" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, + "Brilho da tela" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, + "Aumentar ou diminuir o brilho da tela do Switch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, + "Overclock da CPU" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE, + "Faz um Overclock na CPU do Switch" + ) +#endif MSG_HASH( MSG_COMPILER, "Compilador" @@ -8,7 +34,7 @@ MSG_HASH( ) MSG_HASH( MSG_NATIVE, - "Native") + "Nativo") MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, "Dispositivo desconectado da porta" @@ -1489,6 +1515,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_LANG_ARABIC, "Árabe" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_GREEK, + "Grego" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Analógico Esquerdo" @@ -2160,6 +2190,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, "Carregar Configuração de Gravação..." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, + "Configuração de Transmissão Personalizada" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, "Driver de Gravação" @@ -2876,6 +2910,46 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, "Exibir data e hora" ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE, + "Estilo da data / hora" + ) + MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_STYLE, + "Altera o estilo da data atual ou como a hora é mostrada dentro do menu." + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + "YYYY-MM-DD HH:MM:SS" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, + "YYYY-MM-DD HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, + "MM-DD-YYYY HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, + "HH:MM:SS" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, + "HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + "DD/MM HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, + "MM/DD HH:MM" + ) + MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, + "HH:MM:SS (AM/PM)" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TITLE_COLOR, "Cor do título do menu" @@ -4542,7 +4616,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, - "Taxa de atualização vertical da sua tela. Utilizado para calcular uma taxa de saída de áudio adequada. OBS: Isto será ignorado se a função 'Vídeo Paralelizado' estiver habilitada." + "Taxa de atualização vertical da sua tela. Utilizado para calcular uma taxa de saída de áudio adequada.\n" + "OBS: Isto será ignorado se a função 'Vídeo Paralelizado' estiver habilitada." ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_ENABLE, @@ -4766,7 +4841,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "Aplica um filtro de vídeo processado pela CPU. OBS: Pode vir a um alto custo de desempenho. Alguns filtros de vídeo podem funcionar apenas para núcleos que usam cores de 32 bits ou 16 bits." + "Aplica um filtro de vídeo processado pela CPU.\n" + "OBS: Pode vir a um alto custo de desempenho. Alguns filtros de vídeo podem funcionar apenas para núcleos que usam cores de 32 bits ou 16 bits." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, @@ -4920,6 +4996,18 @@ MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD, "Aplicar trapaças automaticamente quando o jogo for carregado." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_COUNT, + "O número de vezes que a trapaça será aplicada. Use com as outras duas opções de iteração para afetar grandes áreas da memória." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_ADDRESS, + "Após cada 'Número de Iterações', o Endereço de Memória será aumentado pelo número de vezes do 'Tamanho da Pesquisa da Memória'." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE, + "Após cada "Número de Iterações", o Valor será aumentado por esse valor." + ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, "Ao definir um número de quadros para o rebobinamento, você pode retroceder vários quadros de uma só vez, aumentando a velocidade da função." @@ -5022,7 +5110,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_BIG_ENDIAN, - "Big endian : 258 = 0x0102,\nLittle endian : 258 = 0x0201" + "Big endian : 258 = 0x0102,\n" + "Little endian : 258 = 0x0201" ) MSG_HASH( MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, @@ -5570,7 +5659,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, - "Define o tamanho do dimensionamento personalizado aqui. OBS: Você deve habilitar a função 'Redefinição de DPI' para que este dimensionamento tenha efeito." + "Define o tamanho do dimensionamento personalizado aqui.\n" + "OBS: Você deve habilitar a função 'Redefinição de DPI' para que este dimensionamento tenha efeito." ) MSG_HASH( MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, @@ -5922,7 +6012,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, - "Permitir renomear itens" ) + "Permitir renomear itens" + ) MSG_HASH( MENU_ENUM_SUBLABEL_RENAME_ENTRY, "Renomear o título do item." @@ -6257,7 +6348,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, - "Switch among native and ultrawide super resolutions." + "Alterna entre resoluções nativas e ultrawide." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, @@ -6498,6 +6589,7 @@ MSG_HASH( "
  • reiniciar o RetroArch caso alguma das situações acima tenha sido feita
  • \n" "E finalmente, o conteúdo deve corresponder as bases de dados existentes aqui. Se ainda não estiver funcionando, considere enviar um relatório de erro." ) +#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_SHOW_WIMP, "Exibir Menu Desktop" @@ -6506,7 +6598,6 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SHOW_WIMP, "Abre o menu desktop se estiver fechado." ) -#endif MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN, "Não mostrar isto novamente" @@ -6688,12 +6779,13 @@ MSG_HASH( "Pausado" ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, + MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, "Habilitar o Discord" - ) + ) MSG_HASH( MENU_ENUM_SUBLABEL_DISCORD_ALLOW, - "Habilitar ou desabilitar o suporte ao Discord. Não funcionará com a versão do navegador, apenas o cliente nativo de desktop." + "Habilitar ou desabilitar o suporte ao Discord.\n" + "Não funcionará com a versão do navegador, apenas o cliente nativo de desktop." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_MIDI_INPUT, @@ -6823,6 +6915,18 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_DURATION, "Duração (ms) da Vibração Secundária" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_COUNT, + "Número de Iterações" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_VALUE, + "Aumento de Valor em Cada Iteração" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_ADDRESS, + "Aumento de Endereço em Cada Iteração" +) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_AFTER, "Adicionar Nova Trapaça Depois Desta" @@ -6919,6 +7023,14 @@ MSG_HASH( MENU_ENUM_LABEL_RUMBLE_TYPE_GT_VALUE, "Maior Ao Valor da Vibração" ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE_BY_VALUE, + "Aumenta o Valor da Vibração" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE_BY_VALUE, + "Diminui o Valor da Vibração" + ) MSG_HASH( MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_1, "1-bit, valor máx. = 0x01" @@ -7235,6 +7347,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_DELETE_PLAYLIST, "Excluir Lista de Reprodução" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RENAME_PLAYLIST, + "Renomear Lista de Reprodução" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST, "Tem certeza de que deseja excluir a lista de reprodução \"%1\"?" @@ -7457,87 +7573,103 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ADAPTIVE_VSYNC, - "Adaptive Vsync" + "Vsync Adaptativo" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, - "V-Sync is enabled until performance falls below the target refresh rate. Can minimize stuttering when performance falls below realtime, and can be more energy efficient." + "O V-Sync é ativado até o desempenho ficar abaixo da taxa de atualização desejada. Pode minimizar as travadas quando o desempenho cai abaixo do tempo real e pode ser mais eficiente em termos energéticos." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, - "CRT SwitchRes" + "SwitchRes CRT" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, - "Output native, low-resolution signals for use with CRT displays." + "Saída nativa, sinais de baixa resolução para uso com monitores CRT." ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, - "Cycle through these options if the image is not centered properly on the display." + "Alterne entre essas opções se a imagem não estiver centralizada corretamente no visor." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, - "X-Axis Centering" + "Centralização do Eixo-X" ) MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use a custom refresh rate specified in the config file if needed.") + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, + "Use uma taxa de atualização personalizada especificada no arquivo de configuração, se necessário." + ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use Custom Refresh Rate") + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, + "Usar Taxa de Atualização Personalizada" + ) MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Select the output port connected to the CRT display.") + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, + "Selecione a porta de saída conectada ao monitor CRT." + ) MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Output Display ID") + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, + "ID da Saída de Exibição" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, - "Start Recording" + "Iniciar Gravação" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, - "Starts recording." + "Inicia a gravação." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, - "Stop Recording" + "Parar Gravação" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, - "Stops recording." + "Para a gravação." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, - "Start Streaming" + "Iniciar Transmissão" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_STREAMING, - "Starts streaming." + "Inicia a transmissão." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, - "Stop Streaming" + "Parar Transmissão" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, - "Stops streaming." + "Para a transmissão." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_RECORDING_TOGGLE, + "Alternar gravação" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, + "Alternar transmissão" + ) +MSG_HASH( + MSG_CHEEVOS_HARDCORE_MODE_DISABLED, + "Um estado do jogo foi carregado, Conquistas no Modo Hardcore foram desativadas para a sessão atual. Reinicie para ativar o modo hardcore." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, - "Record Quality" + "Qualidade da Gravação" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, - "Stream Quality" + "Qualidade da Transmissão" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_STREAMING_URL, - "Streaming URL" + "URL da Transmissão" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, - "UDP Stream Port" + "Porta da Transmissão UDP" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, @@ -7547,23 +7679,31 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, "YouTube" ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, - "Twitch Stream Key") -MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, - "YouTube Stream Key") -MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, - "Streaming Mode") -MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, - "Title of Stream") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Chave da Transmissão do Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "Chave da Transmissão do YouTube" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Modo de Transmissão" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Título da Transmissão" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, "Split Joy-Con" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, - "Reset To Defaults" + "Restaurar aos Padrões" ) MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, - "Reset the current configuration to default values." + "Restaura a configuração atual para os valores padrão." ) From 4a67dd8d022dc58d44446eecedb7cf00d9ecc3a9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Oct 2018 21:31:59 +0200 Subject: [PATCH 0341/1292] Buildfix --- intl/msg_hash_pt_br.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 0861a1335d..cf21f460b4 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -5006,7 +5006,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE, - "Após cada "Número de Iterações", o Valor será aumentado por esse valor." + "Após cada Número de Iterações, o Valor será aumentado por esse valor." ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, From 84948c9b8b02ac4878bc495348aeab3225e7d0ad Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Oct 2018 23:12:06 +0200 Subject: [PATCH 0342/1292] Backport orbea commits - don't unload content if it was never loaded - don't deinit core when they are not inited - sorry for the long delays --- core_impl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core_impl.c b/core_impl.c index eb4b2fffd0..a8a5acb949 100644 --- a/core_impl.c +++ b/core_impl.c @@ -396,7 +396,9 @@ bool core_unload(void) { video_driver_set_cached_frame_ptr(NULL); - current_core.retro_deinit(); + if (current_core.inited) + current_core.retro_deinit(); + return true; } @@ -407,9 +409,11 @@ bool core_unload_game(void) video_driver_set_cached_frame_ptr(NULL); - current_core.retro_unload_game(); - - current_core.game_loaded = false; + if (current_core.game_loaded) + { + current_core.retro_unload_game(); + current_core.game_loaded = false; + } audio_driver_stop(); From dbe35078ddf9ebeaaa178b6ace8313189014d172 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 13 Oct 2018 22:07:10 +0200 Subject: [PATCH 0343/1292] (Mojave) have to bump up deployment target to OSX 10.6 --- pkg/apple/RetroArch.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/apple/RetroArch.xcodeproj/project.pbxproj b/pkg/apple/RetroArch.xcodeproj/project.pbxproj index a6cb029d2c..66253f4f41 100644 --- a/pkg/apple/RetroArch.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch.xcodeproj/project.pbxproj @@ -385,7 +385,7 @@ ); INFOPLIST_FILE = OSX/Info.plist; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_CFLAGS = ( "$(inherited)", "-DHAVE_CG", @@ -419,7 +419,7 @@ ); INFOPLIST_FILE = OSX/Info.plist; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_CFLAGS = ( "$(inherited)", "-DHAVE_CG", @@ -455,7 +455,7 @@ ); INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_NAME = RetroArch; }; @@ -485,7 +485,7 @@ ); INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_NAME = RetroArch; }; @@ -510,7 +510,7 @@ "-DHAVE_LROUND", "-DFLAC__HAS_OGG=0", "-DHAVE_CHD", - "-DHAVE_STB_VORBIS", + "-DHAVE_STB_VORBIS", "-DHAVE_MINIUPNPC", "-DHAVE_BUILTINMINIUPNPC", "-DHAVE_UPDATE_ASSETS", @@ -574,7 +574,7 @@ "-DHAVE_LROUND", "-DFLAC__HAS_OGG=0", "-DHAVE_CHD", - "-DHAVE_STB_VORBIS", + "-DHAVE_STB_VORBIS", "-DHAVE_MINIUPNPC", "-DHAVE_BUILTINMINIUPNPC", "-DHAVE_UPDATE_ASSETS", From 8c9e6a7c4e40089e606f45a5f99d3a5f6c24650d Mon Sep 17 00:00:00 2001 From: radius Date: Sat, 13 Oct 2018 16:06:43 -0500 Subject: [PATCH 0344/1292] fix these two --- menu/cbs/menu_cbs_deferred_push.c | 3 +++ menu/cbs/menu_cbs_ok.c | 33 +++++++++++++++++++------------ msg_hash.h | 1 + record/drivers/record_ffmpeg.c | 1 + 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index c7258c52cf..656c995a8c 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -1341,6 +1341,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_LABEL_RECORD_CONFIG: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_record_configfile); break; + case MENU_LABEL_STREAM_CONFIG: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_stream_configfile); + break; case MENU_LABEL_NETPLAY: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_netplay); break; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index d6fe477c11..5d4c54541a 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -477,12 +477,14 @@ int generic_action_ok_displaylist_push(const char *path, dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_STREAM_CONFIGFILE: - filebrowser_clear_type(); - info.type = type; - info.directory_ptr = idx; - info_path = settings->paths.path_stream_config; - info_label = label; - dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + { + global_t *global = global_get_ptr(); + info.type = type; + info.directory_ptr = idx; + info_path = global->record.config_dir; + info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + } break; case ACTION_OK_DL_RECORD_CONFIGFILE: filebrowser_clear_type(); @@ -1302,20 +1304,22 @@ static int generic_action_ok(const char *path, break; case ACTION_OK_LOAD_STREAM_CONFIGFILE: { - settings_t *settings = config_get_ptr(); + settings_t *settings = config_get_ptr(); flush_char = msg_hash_to_str(flush_id); - strlcpy(settings->paths.path_stream_config, action_path, - sizeof(settings->paths.path_stream_config)); + + if (settings) + strlcpy(settings->paths.path_stream_config, action_path, + sizeof(settings->paths.path_stream_config)); } break; case ACTION_OK_LOAD_RECORD_CONFIGFILE: { - global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); flush_char = msg_hash_to_str(flush_id); - if (global) - strlcpy(global->record.config, action_path, - sizeof(global->record.config)); + if (settings) + strlcpy(settings->paths.path_record_config, action_path, + sizeof(settings->paths.path_record_config)); } break; case ACTION_OK_LOAD_REMAPPING_FILE: @@ -5288,6 +5292,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_RECORD_CONFIG: BIND_ACTION_OK(cbs, action_ok_record_configfile); break; + case MENU_LABEL_STREAM_CONFIG: + BIND_ACTION_OK(cbs, action_ok_stream_configfile); + break; #ifdef HAVE_NETWORKING case MENU_LABEL_UPDATE_LAKKA: BIND_ACTION_OK(cbs, action_ok_lakka_list); diff --git a/msg_hash.h b/msg_hash.h index 855e2609bb..49a6ae1d41 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2254,6 +2254,7 @@ enum msg_hash_enums /* Record settings */ #define MENU_LABEL_RECORD_CONFIG 0x11c3daf9U +#define MENU_LABEL_STREAM_CONFIG 0x79774b86U /* Cheat options */ diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index a4c332ac45..b181492bde 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -944,6 +944,7 @@ static void *ffmpeg_new(const struct record_params *params) if (params->preset == RECORD_CONFIG_TYPE_RECORDING_CUSTOM || params->preset == RECORD_CONFIG_TYPE_STREAMING_CUSTOM) { + RARCH_LOG("config: %s %s\n", &handle->config, params->config); if (!ffmpeg_init_config(&handle->config, params->config)) goto error; } From 32c346a3e71a3d1af546b9eee754df5f28892fd3 Mon Sep 17 00:00:00 2001 From: radius Date: Sat, 13 Oct 2018 18:17:17 -0500 Subject: [PATCH 0345/1292] make discord app id configurable --- config.def.h | 2 ++ configuration.c | 5 ++++- configuration.h | 2 ++ discord/discord.c | 5 +++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index e9cadb4165..a656c49fe6 100644 --- a/config.def.h +++ b/config.def.h @@ -811,4 +811,6 @@ static char buildbot_server_url[] = ""; static char buildbot_assets_server_url[] = "http://buildbot.libretro.com/assets/"; +static char default_discord_app_id[] = "475456035851599874"; + #endif diff --git a/configuration.c b/configuration.c index 813ee6ca0d..817b792cae 100644 --- a/configuration.c +++ b/configuration.c @@ -1111,7 +1111,7 @@ static struct config_array_setting *populate_settings_array(settings_t *settings SETTING_ARRAY("midi_input", settings->arrays.midi_input, true, midi_input, true); SETTING_ARRAY("midi_output", settings->arrays.midi_output, true, midi_output, true); SETTING_ARRAY("youtube_stream_key", settings->arrays.youtube_stream_key, true, NULL, true); - SETTING_ARRAY("twitch_stream_key", settings->arrays.twitch_stream_key, true, NULL, true); + SETTING_ARRAY("discord_app_id", settings->arrays.discord_app_id, true, default_discord_app_id, true); *size = count; return tmp; @@ -1814,6 +1814,9 @@ void config_set_defaults(void) *settings->paths.path_menu_xmb_font = '\0'; #endif + strlcpy(settings->arrays.discord_app_id, + default_discord_app_id, sizeof(settings->arrays.discord_app_id)); + #ifdef HAVE_MATERIALUI if (g_defaults.menu.materialui.menu_color_theme_enable) settings->uints.menu_materialui_color_theme = g_defaults.menu.materialui.menu_color_theme; diff --git a/configuration.h b/configuration.h index 28f599ff87..ec4dc7dce4 100644 --- a/configuration.h +++ b/configuration.h @@ -482,6 +482,8 @@ typedef struct settings char youtube_stream_key[PATH_MAX_LENGTH]; char twitch_stream_key[PATH_MAX_LENGTH]; + + char discord_app_id[PATH_MAX_LENGTH]; } arrays; struct diff --git a/discord/discord.c b/discord/discord.c index 0a33824fa5..572f56deb1 100644 --- a/discord/discord.c +++ b/discord/discord.c @@ -18,6 +18,7 @@ #include "discord.h" #include "../retroarch.h" +#include "../configuration.h" #include "../core.h" #include "../core_info.h" #include "../paths.h" @@ -35,7 +36,6 @@ #include "../cheevos/cheevos.h" #endif -static const char* APPLICATION_ID = "475456035851599874"; static int FrustrationLevel = 0; static int64_t start_time = 0; @@ -211,6 +211,7 @@ void discord_update(enum discord_presence presence) void discord_init(void) { + settings_t *settings = config_get_ptr(); DiscordEventHandlers handlers; RARCH_LOG("[Discord] initializing ..\n"); @@ -224,7 +225,7 @@ void discord_init(void) handlers.spectateGame = handle_discord_spectate; handlers.joinRequest = handle_discord_join_request; - Discord_Initialize(APPLICATION_ID, &handlers, 1, NULL); + Discord_Initialize(settings->arrays.discord_app_id, &handlers, 1, NULL); discord_ready = true; } From bf7c3f17b3b49be8a804fbde8e5d3e85ee75d367 Mon Sep 17 00:00:00 2001 From: radius Date: Sat, 13 Oct 2018 21:09:19 -0500 Subject: [PATCH 0346/1292] start registering the application so it can be started from discord --- deps/discord-rpc/src/discord_register_win.cpp | 10 +++++----- discord/discord.c | 7 ++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/deps/discord-rpc/src/discord_register_win.cpp b/deps/discord-rpc/src/discord_register_win.cpp index e441318dd5..60b1db3e08 100644 --- a/deps/discord-rpc/src/discord_register_win.cpp +++ b/deps/discord-rpc/src/discord_register_win.cpp @@ -77,22 +77,22 @@ static void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* comma wchar_t openCommand[1024]; if (command && command[0]) { - StringCbPrintfW(openCommand, sizeof(openCommand), L"%s", command); + StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", command); } else { // StringCbCopyW(openCommand, sizeof(openCommand), exeFilePath); - StringCbPrintfW(openCommand, sizeof(openCommand), L"%s", exeFilePath); + StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", exeFilePath); } wchar_t protocolName[64]; - StringCbPrintfW(protocolName, sizeof(protocolName), L"discord-%s", applicationId); + StringCbPrintfW(protocolName, sizeof(protocolName), L"discord-%S", applicationId); wchar_t protocolDescription[128]; StringCbPrintfW( - protocolDescription, sizeof(protocolDescription), L"URL:Run game %s protocol", applicationId); + protocolDescription, sizeof(protocolDescription), L"URL:Run game %S protocol", applicationId); wchar_t urlProtocol = 0; wchar_t keyName[256]; - StringCbPrintfW(keyName, sizeof(keyName), L"Software\\Classes\\%s", protocolName); + StringCbPrintfW(keyName, sizeof(keyName), L"Software\\Classes\\%S", protocolName); HKEY key; auto status = RegCreateKeyExW(HKEY_CURRENT_USER, keyName, 0, nullptr, 0, KEY_WRITE, nullptr, &key, nullptr); diff --git a/discord/discord.c b/discord/discord.c index 572f56deb1..0efe85e036 100644 --- a/discord/discord.c +++ b/discord/discord.c @@ -16,6 +16,7 @@ #include #include "discord.h" +#include "discord_register.h" #include "../retroarch.h" #include "../configuration.h" @@ -225,7 +226,11 @@ void discord_init(void) handlers.spectateGame = handle_discord_spectate; handlers.joinRequest = handle_discord_join_request; - Discord_Initialize(settings->arrays.discord_app_id, &handlers, 1, NULL); + /* To-Do: Add the arguments RetroArch was started with to the register URI*/ + const char command[256] = "retroarch"; + + Discord_Initialize(settings->arrays.discord_app_id, &handlers, 0, NULL); + Discord_Register(settings->arrays.discord_app_id, NULL); discord_ready = true; } From 4d6dfd163d35ef07d5e5120b2bb994b481db2d9d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 06:00:26 +0200 Subject: [PATCH 0347/1292] Remove unused function --- gfx/video_driver.c | 6 ------ gfx/video_driver.h | 2 -- 2 files changed, 8 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index dd7168415e..768657a42c 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -460,12 +460,6 @@ static bool set_resize_null(void *a, unsigned b, unsigned c) return false; } -void video_driver_set_resize(unsigned width, unsigned height) -{ - if (current_video_context.set_resize) - current_video_context.set_resize(video_context_data, width, height); -} - /** * video_driver_find_handle: * @idx : index of driver to get handle to. diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 19f1767460..97c4dd63b8 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1126,8 +1126,6 @@ void video_driver_set_threaded(bool val); void video_driver_get_status(uint64_t *frame_count, bool * is_alive, bool *is_focused); -void video_driver_set_resize(unsigned width, unsigned height); - /** * video_context_driver_init_first: * @data : Input data. From 24e18fcce6c68f9105dd7b2fa4d385a21c33a175 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 07:59:43 +0200 Subject: [PATCH 0348/1292] Simplify video_context_driver_init_first --- gfx/video_driver.c | 103 ++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 62 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 768657a42c..28055fe7d4 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3009,74 +3009,30 @@ static const gfx_ctx_driver_t *video_context_driver_init( const gfx_ctx_driver_t *ctx, const char *ident, enum gfx_ctx_api api, unsigned major, - unsigned minor, bool hw_render_ctx) + unsigned minor, bool hw_render_ctx, + void **ctx_data) { - if (ctx->bind_api(data, api, major, minor)) + video_frame_info_t video_info; + + if (!ctx->bind_api(data, api, major, minor)) { - video_frame_info_t video_info; - void *ctx_data = NULL; + RARCH_WARN("Failed to bind API (#%u, version %u.%u)" + " on context driver \"%s\".\n", + (unsigned)api, major, minor, ctx->ident); - video_driver_build_info(&video_info); - - ctx_data = ctx->init(&video_info, data); - - if (!ctx_data) - return NULL; - - if (ctx->bind_hw_render) - ctx->bind_hw_render(ctx_data, - video_info.shared_context && hw_render_ctx); - - video_context_data = ctx_data; - - return ctx; + return NULL; } -#ifndef _WIN32 - RARCH_WARN("Failed to bind API (#%u, version %u.%u)" - " on context driver \"%s\".\n", - (unsigned)api, major, minor, ctx->ident); -#endif + video_driver_build_info(&video_info); - return NULL; -} + if (!(*ctx_data = ctx->init(&video_info, data))) + return NULL; -/** - * video_context_driver_find_driver: - * @data : Input data. - * @ident : Identifier of graphics context driver to find. - * @api : API of higher-level graphics API. - * @major : Major version number of higher-level graphics API. - * @minor : Minor version number of higher-level graphics API. - * @hw_render_ctx : Request a graphics context driver capable of - * hardware rendering? - * - * Finds graphics context driver and initializes. - * - * Returns: graphics context driver if found, otherwise NULL. - **/ -static const gfx_ctx_driver_t *video_context_driver_find_driver(void *data, - const char *ident, - enum gfx_ctx_api api, unsigned major, - unsigned minor, bool hw_render_ctx) -{ - int i = find_video_context_driver_index(ident); + if (ctx->bind_hw_render) + ctx->bind_hw_render(*ctx_data, + video_info.shared_context && hw_render_ctx); - if (i >= 0) - return video_context_driver_init(data, gfx_ctx_drivers[i], ident, - api, major, minor, hw_render_ctx); - - for (i = 0; gfx_ctx_drivers[i]; i++) - { - const gfx_ctx_driver_t *ctx = - video_context_driver_init(data, gfx_ctx_drivers[i], ident, - api, major, minor, hw_render_ctx); - - if (ctx) - return ctx; - } - - return NULL; + return ctx; } /** @@ -3097,8 +3053,31 @@ const gfx_ctx_driver_t *video_context_driver_init_first(void *data, const char *ident, enum gfx_ctx_api api, unsigned major, unsigned minor, bool hw_render_ctx) { - return video_context_driver_find_driver(data, ident, api, - major, minor, hw_render_ctx); + void *ctx_data = NULL; + int i = find_video_context_driver_index(ident); + + if (i >= 0) + { + const gfx_ctx_driver_t *ctx = video_context_driver_init(data, gfx_ctx_drivers[i], ident, + api, major, minor, hw_render_ctx, &ctx_data); + if (ctx) + video_context_data = ctx_data; + } + + for (i = 0; gfx_ctx_drivers[i]; i++) + { + const gfx_ctx_driver_t *ctx = + video_context_driver_init(data, gfx_ctx_drivers[i], ident, + api, major, minor, hw_render_ctx, &ctx_data); + + if (ctx) + { + video_context_data = ctx_data; + return ctx; + } + } + + return NULL; } bool video_context_driver_check_window(gfx_ctx_size_t *size_data) From 2bca74bbaa6e5eecc9a32b8f0d08c5804c118e65 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 08:00:42 +0200 Subject: [PATCH 0349/1292] Fix this --- gfx/video_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 28055fe7d4..4a126070a9 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3061,7 +3061,10 @@ const gfx_ctx_driver_t *video_context_driver_init_first(void *data, const gfx_ctx_driver_t *ctx = video_context_driver_init(data, gfx_ctx_drivers[i], ident, api, major, minor, hw_render_ctx, &ctx_data); if (ctx) + { video_context_data = ctx_data; + return ctx; + } } for (i = 0; gfx_ctx_drivers[i]; i++) From e661cf3cfde95f66aa3289affdde43bd20077dfa Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 08:13:05 +0200 Subject: [PATCH 0350/1292] Rewrite video_context_driver_init_first --- gfx/common/gdi_common.h | 1 + gfx/common/gl_common.h | 1 + gfx/common/sixel_common.h | 1 + gfx/common/vulkan_common.h | 1 + gfx/drivers/gdi_gfx.c | 6 +++++- gfx/drivers/gl.c | 11 +++++++++-- gfx/drivers/sixel_gfx.c | 8 ++++++-- gfx/drivers/vg.c | 6 +++++- gfx/drivers/vulkan.c | 19 ++++++++++++------- gfx/video_driver.c | 11 +++++------ gfx/video_driver.h | 6 ++++-- 11 files changed, 50 insertions(+), 21 deletions(-) diff --git a/gfx/common/gdi_common.h b/gfx/common/gdi_common.h index ddb33b3fb3..4bac582f3f 100644 --- a/gfx/common/gdi_common.h +++ b/gfx/common/gdi_common.h @@ -34,6 +34,7 @@ typedef struct gdi unsigned video_height; unsigned screen_width; unsigned screen_height; + void *ctx_data; } gdi_t; typedef struct gdi_texture diff --git a/gfx/common/gl_common.h b/gfx/common/gl_common.h index 0f77410cd5..4488287813 100644 --- a/gfx/common/gl_common.h +++ b/gfx/common/gl_common.h @@ -317,6 +317,7 @@ struct gl const gl_renderchain_driver_t *renderchain_driver; void *renderchain_data; + void *ctx_data; }; static INLINE void gl_bind_texture(GLuint id, GLint wrap_mode, GLint mag_filter, diff --git a/gfx/common/sixel_common.h b/gfx/common/sixel_common.h index 5d6e40ced1..d0bda4cef9 100644 --- a/gfx/common/sixel_common.h +++ b/gfx/common/sixel_common.h @@ -29,6 +29,7 @@ typedef struct sixel unsigned video_height; unsigned screen_width; unsigned screen_height; + void *ctx_data; } sixel_t; #endif diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index e4e3a50570..524f69336d 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -332,6 +332,7 @@ typedef struct vk vulkan_context_t *context; video_info_t video; + void *ctx_data; VkFormat tex_fmt; math_matrix_4x4 mvp, mvp_no_rot; diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index 6b820c1e18..b560f52d07 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -82,6 +82,7 @@ static void *gdi_gfx_init(const video_info_t *video, unsigned full_x, full_y; gfx_ctx_input_t inp; gfx_ctx_mode_t mode; + void *ctx_data = NULL; const gfx_ctx_driver_t *ctx_driver = NULL; unsigned win_width = 0, win_height = 0; unsigned temp_width = 0, temp_height = 0; @@ -106,10 +107,13 @@ static void *gdi_gfx_init(const video_info_t *video, ctx_driver = video_context_driver_init_first(gdi, settings->arrays.video_context_driver, - GFX_CTX_GDI_API, 1, 0, false); + GFX_CTX_GDI_API, 1, 0, false, &ctx_data); if (!ctx_driver) goto error; + if (ctx_data) + gdi->ctx_data = ctx_data; + video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); RARCH_LOG("[GDI]: Found GDI context: %s\n", ctx_driver->ident); diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 0111500ad2..9ba79b00e4 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1501,6 +1501,8 @@ static bool gl_init_pbo_readback(gl_t *gl) static const gfx_ctx_driver_t *gl_get_context(gl_t *gl) { enum gfx_ctx_api api; + const gfx_ctx_driver_t *gfx_ctx = NULL; + void *ctx_data = NULL; const char *api_name = NULL; settings_t *settings = config_get_ptr(); struct retro_hw_render_callback *hwr = video_driver_get_hw_context(); @@ -1533,9 +1535,14 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl) && (hwr->context_type != RETRO_HW_CONTEXT_NONE)) gl_shared_context_use = true; - return video_context_driver_init_first(gl, + gfx_ctx = video_context_driver_init_first(gl, settings->arrays.video_context_driver, - api, major, minor, gl_shared_context_use); + api, major, minor, gl_shared_context_use, &ctx_data); + + if (ctx_data) + gl->ctx_data = ctx_data; + + return gfx_ctx; } #ifdef GL_DEBUG diff --git a/gfx/drivers/sixel_gfx.c b/gfx/drivers/sixel_gfx.c index 4777587688..20676cc755 100644 --- a/gfx/drivers/sixel_gfx.c +++ b/gfx/drivers/sixel_gfx.c @@ -188,9 +188,10 @@ static void scroll_on_demand(int pixelheight) static void *sixel_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { + gfx_ctx_input_t inp; + void *ctx_data = NULL; settings_t *settings = config_get_ptr(); sixel_t *sixel = (sixel_t*)calloc(1, sizeof(*sixel)); - gfx_ctx_input_t inp; const gfx_ctx_driver_t *ctx_driver = NULL; const char *scale_str = NULL; @@ -218,11 +219,14 @@ static void *sixel_gfx_init(const video_info_t *video, ctx_driver = video_context_driver_init_first(sixel, settings->arrays.video_context_driver, - GFX_CTX_SIXEL_API, 1, 0, false); + GFX_CTX_SIXEL_API, 1, 0, false, &ctx_data); if (!ctx_driver) goto error; + if (ctx_data) + sixel->ctx_data = ctx_data; + video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); RARCH_LOG("[SIXEL]: Found SIXEL context: %s\n", ctx_driver->ident); diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 7f9c383d3e..f830e89117 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -102,15 +102,19 @@ static void *vg_init(const video_info_t *video, int interval = 0; unsigned temp_width = 0; unsigned temp_height = 0; + void *ctx_data = NULL; settings_t *settings = config_get_ptr(); vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t)); const gfx_ctx_driver_t *ctx = video_context_driver_init_first( vg, settings->arrays.video_context_driver, - GFX_CTX_OPENVG_API, 0, 0, false); + GFX_CTX_OPENVG_API, 0, 0, false, &ctx_data); if (!vg || !ctx) goto error; + if (ctx_data) + vg->ctx_data = ctx_data; + video_context_driver_set((void*)ctx); video_context_driver_get_video_size(&mode); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index cec0089daa..abf12506fb 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -61,14 +61,19 @@ static void vulkan_viewport_info(void *data, struct video_viewport *vp); static const gfx_ctx_driver_t *vulkan_get_context(vk_t *vk) { - unsigned major = 1; - unsigned minor = 0; - settings_t *settings = config_get_ptr(); - enum gfx_ctx_api api = GFX_CTX_VULKAN_API; - - return video_context_driver_init_first( + void *ctx_data = NULL; + unsigned major = 1; + unsigned minor = 0; + settings_t *settings = config_get_ptr(); + enum gfx_ctx_api api = GFX_CTX_VULKAN_API; + const gfx_ctx_driver_t *gfx_ctx = video_context_driver_init_first( vk, settings->arrays.video_context_driver, - api, major, minor, false); + api, major, minor, false, &ctx_data); + + if (ctx_data) + vk->ctx_data = ctx_data; + + return gfx_ctx; } static void vulkan_init_render_pass( diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 4a126070a9..c9aa356823 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3051,18 +3051,17 @@ static const gfx_ctx_driver_t *video_context_driver_init( **/ const gfx_ctx_driver_t *video_context_driver_init_first(void *data, const char *ident, enum gfx_ctx_api api, unsigned major, - unsigned minor, bool hw_render_ctx) + unsigned minor, bool hw_render_ctx, void **ctx_data) { - void *ctx_data = NULL; int i = find_video_context_driver_index(ident); if (i >= 0) { const gfx_ctx_driver_t *ctx = video_context_driver_init(data, gfx_ctx_drivers[i], ident, - api, major, minor, hw_render_ctx, &ctx_data); + api, major, minor, hw_render_ctx, ctx_data); if (ctx) { - video_context_data = ctx_data; + video_context_data = *ctx_data; return ctx; } } @@ -3071,11 +3070,11 @@ const gfx_ctx_driver_t *video_context_driver_init_first(void *data, { const gfx_ctx_driver_t *ctx = video_context_driver_init(data, gfx_ctx_drivers[i], ident, - api, major, minor, hw_render_ctx, &ctx_data); + api, major, minor, hw_render_ctx, ctx_data); if (ctx) { - video_context_data = ctx_data; + video_context_data = *ctx_data; return ctx; } } diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 97c4dd63b8..6add41cec4 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1140,8 +1140,10 @@ void video_driver_get_status(uint64_t *frame_count, bool * is_alive, * * Returns: graphics context driver if found, otherwise NULL. **/ -const gfx_ctx_driver_t *video_context_driver_init_first(void *data, const char *ident, - enum gfx_ctx_api api, unsigned major, unsigned minor, bool hw_render_ctx); +const gfx_ctx_driver_t *video_context_driver_init_first( + void *data, const char *ident, + enum gfx_ctx_api api, unsigned major, unsigned minor, + bool hw_render_ctx, void **ctx_data); bool video_context_driver_check_window(gfx_ctx_size_t *size_data); From 448d2d333c5f04bbf4710a0c23a0d3adfc2954b0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 08:22:26 +0200 Subject: [PATCH 0351/1292] Set ctx_driver --- gfx/common/gdi_common.h | 1 + gfx/common/gl_common.h | 1 + gfx/common/sixel_common.h | 1 + gfx/common/vulkan_common.h | 1 + gfx/drivers/gdi_gfx.c | 1 + gfx/drivers/gl.c | 1 + gfx/drivers/sixel_gfx.c | 1 + gfx/drivers/vg.c | 3 +++ gfx/drivers/vulkan.c | 1 + 9 files changed, 11 insertions(+) diff --git a/gfx/common/gdi_common.h b/gfx/common/gdi_common.h index 4bac582f3f..3fc5423f9f 100644 --- a/gfx/common/gdi_common.h +++ b/gfx/common/gdi_common.h @@ -35,6 +35,7 @@ typedef struct gdi unsigned screen_width; unsigned screen_height; void *ctx_data; + const gfx_ctx_driver_t *ctx_driver; } gdi_t; typedef struct gdi_texture diff --git a/gfx/common/gl_common.h b/gfx/common/gl_common.h index 4488287813..893fdfb709 100644 --- a/gfx/common/gl_common.h +++ b/gfx/common/gl_common.h @@ -318,6 +318,7 @@ struct gl const gl_renderchain_driver_t *renderchain_driver; void *renderchain_data; void *ctx_data; + const gfx_ctx_driver_t *ctx_driver; }; static INLINE void gl_bind_texture(GLuint id, GLint wrap_mode, GLint mag_filter, diff --git a/gfx/common/sixel_common.h b/gfx/common/sixel_common.h index d0bda4cef9..f53438f0eb 100644 --- a/gfx/common/sixel_common.h +++ b/gfx/common/sixel_common.h @@ -30,6 +30,7 @@ typedef struct sixel unsigned screen_width; unsigned screen_height; void *ctx_data; + const gfx_ctx_driver_t *ctx_driver; } sixel_t; #endif diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 524f69336d..10d6a1b1ba 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -333,6 +333,7 @@ typedef struct vk vulkan_context_t *context; video_info_t video; void *ctx_data; + const gfx_ctx_driver_t *ctx_driver; VkFormat tex_fmt; math_matrix_4x4 mvp, mvp_no_rot; diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index b560f52d07..8765351ca4 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -114,6 +114,7 @@ static void *gdi_gfx_init(const video_info_t *video, if (ctx_data) gdi->ctx_data = ctx_data; + gdi->ctx_driver = ctx_driver; video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); RARCH_LOG("[GDI]: Found GDI context: %s\n", ctx_driver->ident); diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 9ba79b00e4..bf23195a58 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1733,6 +1733,7 @@ static void *gl_init(const video_info_t *video, video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); + gl->ctx_driver = ctx_driver; gl->video_info = *video; RARCH_LOG("[GL]: Found GL context: %s\n", ctx_driver->ident); diff --git a/gfx/drivers/sixel_gfx.c b/gfx/drivers/sixel_gfx.c index 20676cc755..6966820e14 100644 --- a/gfx/drivers/sixel_gfx.c +++ b/gfx/drivers/sixel_gfx.c @@ -227,6 +227,7 @@ static void *sixel_gfx_init(const video_info_t *video, if (ctx_data) sixel->ctx_data = ctx_data; + sixel->ctx_driver = ctx_driver; video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); RARCH_LOG("[SIXEL]: Found SIXEL context: %s\n", ctx_driver->ident); diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index f830e89117..b93ce38fb2 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -71,6 +71,8 @@ typedef struct VGuint mGlyphIndices[1024]; VGPaint mPaintFg; VGPaint mPaintBg; + void *ctx_data; + const gfx_ctx_driver_t *ctx_driver; } vg_t; static PFNVGCREATEEGLIMAGETARGETKHRPROC pvgCreateEGLImageTargetKHR; @@ -115,6 +117,7 @@ static void *vg_init(const video_info_t *video, if (ctx_data) vg->ctx_data = ctx_data; + vg->ctx_driver = ctx; video_context_driver_set((void*)ctx); video_context_driver_get_video_size(&mode); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index abf12506fb..6713a46fbc 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1146,6 +1146,7 @@ static void *vulkan_init(const video_info_t *video, goto error; } + vk->ctx_driver = ctx_driver; video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); video_context_driver_get_video_size(&mode); From c73d13d4bc4066c484c0639c9b8316c43ede1088 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 08:40:00 +0200 Subject: [PATCH 0352/1292] Don't use video_context_driver_check_window anymore - go call it directly --- gfx/drivers/gl.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index bf23195a58..860df2c31a 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2019,31 +2019,26 @@ error: static bool gl_alive(void *data) { - gfx_ctx_size_t size_data; unsigned temp_width = 0; unsigned temp_height = 0; bool ret = false; bool quit = false; bool resize = false; gl_t *gl = (gl_t*)data; + bool is_shutdown = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL); /* Needed because some context drivers don't track their sizes */ video_driver_get_size(&temp_width, &temp_height); - size_data.quit = &quit; - size_data.resize = &resize; - size_data.width = &temp_width; - size_data.height = &temp_height; + gl->ctx_driver->check_window(gl->ctx_data, + &quit, &resize, &temp_width, &temp_height, is_shutdown); - if (video_context_driver_check_window(&size_data)) - { - if (quit) - gl->quitting = true; - else if (resize) - gl->should_resize = true; + if (quit) + gl->quitting = true; + else if (resize) + gl->should_resize = true; - ret = !gl->quitting; - } + ret = !gl->quitting; if (temp_width != 0 && temp_height != 0) video_driver_set_size(&temp_width, &temp_height); From 4e99132e232e2c5d6ba251645afb420afdc31cae Mon Sep 17 00:00:00 2001 From: waitingmoon Date: Sun, 14 Oct 2018 17:41:51 +0900 Subject: [PATCH 0353/1292] Update JP translation (#7407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update JP translation (Video and Audio) * Update JP translation (Main Menu, Settings) * Update JP translation (Netplay, Import) * minor change * Change システム to 全般 * Change 全般 to メイン (refrect 5ch users opinion) * restore explanation of non-windowed fullscreen mode --- intl/msg_hash_ja.h | 212 ++++++++++++++++++++++++--------------------- 1 file changed, 111 insertions(+), 101 deletions(-) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index cd9030d9ce..66f0aa5dc1 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -152,11 +152,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SETTINGS, - "メニューの外観に関係する設定を変更する。" + "メニューの外観に関係する設定を変更します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_LATENCY_SETTINGS, - "ビデオやオーディオ、入力の遅延に関係する設定を変更します。" + "ビデオやオーディオ、入力の遅延に関係する設定を\n変更します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, @@ -244,7 +244,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONFIGURATIONS_LIST, - "設定ファイル" + "メイン設定ファイル" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ADD_TAB, @@ -344,7 +344,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, - "オーバーライドファイルを自動的にロード" + "優先設定ファイルを自動的にロード" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTO_REMAPS_ENABLE, @@ -546,7 +546,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONFIG, - "コンフィグ" + "メイン設定ファイル" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONFIGURATIONS, @@ -554,7 +554,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS, - "設定" + "設定ファイル" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT, @@ -721,7 +721,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, "Frontend Counters") MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS, - "コンテンツ特定のコア設定を自動的にロード") + "コンテンツごとのコア設定を自動的にロード") MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE, "Create game-options file") MSG_HASH(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE, @@ -1480,7 +1480,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, "ステートセーブのサムネイル") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, - "現在の設定を保存") + "現在のメイン設定を保存") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, "コアの優先を保存") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, @@ -1488,7 +1488,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, "ゲームの優先を保存") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_NEW_CONFIG, - "新しい設定を保存") + "新しいメイン設定を保存") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVE_STATE, "ステートセーブ") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, @@ -1786,7 +1786,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_SLANG_SHADERS, MSG_HASH(MENU_ENUM_LABEL_VALUE_USER, "ユーザー") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS, - "ユーザーインタフェース") + "ユーザーインターフェース") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_LANGUAGE, "言語") MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_SETTINGS, @@ -1850,7 +1850,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, "OSDメッセージのY位置") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, - "モニタのインデックス") + "モニターの識別番号") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, "事後フィルターの録画を有効") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, @@ -1898,9 +1898,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER, "非フリッカー") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "カスタムビューポートの縦幅") + "カスタムビューポートの高さ") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "カスタムビューポートの横幅") + "カスタムビューポートの幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, "カスタムビューポートのX位置") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, @@ -1912,20 +1912,20 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, "ウィンドウフルスクリーンモード") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, - "ウィンドウの横幅") + "ウィンドウの幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, - "ウィンドウの縦幅") + "ウィンドウの高さ") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_X, - "フルスクリーンの横幅") + "フルスクリーンの幅") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y, - "フルスクリーンの縦幅") + "フルスクリーンの高さ") MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "非ウィンドウフルスクリーンモードの横幅サイズを指定します。0を指定すると、デスクトップ解像度を使用します。" + "フルスクリーンモード時の幅を指定します。0を指定\nすると、デスクトップ解像度が適用されます。\nウィンドウフルスクリーンモードを使用している場合、\n幅はデスクトップ解像度で固定されます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "非ウィンドウフルスクリーンモードの縦幅サイズを指定します。0を指定すると、デスクトップ解像度を使用します。" + "フルスクリーンモード時の高さを指定します。0を指定\nすると、デスクトップ解像度が適用されます。\nウィンドウフルスクリーンモードを使用している場合、\n高さはデスクトップ解像度で固定されます。" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, "Wi-Fiのドライバ") @@ -2026,57 +2026,57 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, "ステートセーブやチート、巻き戻し、早送り、一時停止、スローモーションをすべてのゲームで無効する。") MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, - "システムのドライバを変更する。") + "システムのドライバを変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, - "実績に関係する設定を変更する。") + "実績に関係する設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_SETTINGS, - "コアの設定を変更する。") + "コアの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_RECORDING_SETTINGS, - "録画の設定を変更する。") + "録画の設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS, - "OSDオーバーレイ、キーボードオーバーレイ、OSDメッセージの設定を変更する。") + "OSDオーバーレイやキーボードオーバーレイ、\nOSDメッセージの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS, - "巻き戻しや早送り、スローモーションの設定を変更する。") + "巻き戻しや早送り、スローモーションの設定を\n変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_SAVING_SETTINGS, - "保存に関係する設定を変更する。") + "保存に関係する設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_LOGGING_SETTINGS, - "ログの設定を変更する。") + "ログの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_USER_INTERFACE_SETTINGS, - "ユーザーインタフェースの設定を変更する。") + "ユーザーインターフェースの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_USER_SETTINGS, - "アカウントやユーザー名、言語を変更する。") + "アカウントやユーザー名、ユーザーインターフェースの\n言語を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, - "プライバシー設定を変更する。") + "プライバシーの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, - "このシステムの初期ディレクトリーを変更する。") + "システムの動作に関係するファイルが格納される\n初期ディレクトリを変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, - "プレイリストの設定を変更する。") + "プレイリストの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, - "ネットワークの設定を変更する。") + "ネットワークの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST, - "コンテンツをスキャンしてデータベースに登録する。") + "コンテンツをスキャンしてデータベースに登録します。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_SETTINGS, - "オーディオ出力の設定を変更する。") + "オーディオ出力の設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_BLUETOOTH_ENABLE, "Bluetoothを有効する。") MSG_HASH(MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT, "終了時に設定を自動的に保存する。") MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS, - "コンフィグファイルのデフォルト設定を変更する。") + "設定ファイルのデフォルト設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, - "コンフィグファイルを管理と作成する。") + "メイン設定ファイルの作成と管理を行います。") MSG_HASH(MENU_ENUM_SUBLABEL_CPU_CORES, "CPUのコア数") MSG_HASH(MENU_ENUM_SUBLABEL_FPS_SHOW, "画面に現在のフレームレートを表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, - "ホットキー設定を変更する。") + "ホットキーの設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, "同時押しでメニューに切り替え") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_SETTINGS, - "ゲームパッド、キーボード、マウスの設定を変更する。") + "ゲームパッドやキーボード、マウスの設定を変更\nします。") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, - "このユーザーの入力設定を変更する。") + "このユーザーの入力設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_LOG_VERBOSITY, "端末にログすることを有効と無効。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY, @@ -2084,9 +2084,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY, MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, "ローカルネットワーク上のネットプレイホストをスキャンして接続する。") MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, - "コア、ネットワーク、システムの詳細を表示する。\nデータベースとカーソルのマネジャーを表示する。") + "コアやネットワーク、システムの詳細および、\nデータベース、カーソルのマネージャーを\n表示します。") MSG_HASH(MENU_ENUM_SUBLABEL_ONLINE_UPDATER, - "RetroArchにアドオン、コンポーネント、コンテンツをダウンロードする。") + "RetroArchにアドオンやコンポーネント、コンテンツを\nダウンロードします。") MSG_HASH(MENU_ENUM_SUBLABEL_SAMBA_ENABLE, "フォルダのネットワーク共有を有効する。") MSG_HASH(MENU_ENUM_SUBLABEL_SERVICES_SETTINGS, @@ -2096,11 +2096,11 @@ MSG_HASH(MENU_ENUM_SUBLABEL_SHOW_HIDDEN_FILES, MSG_HASH(MENU_ENUM_SUBLABEL_SSH_ENABLE, "SSHでのアクセスを有効する。") MSG_HASH(MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, - "システムのスクリーンセーバーをアクティブになることを予防する。") + "システムのスクリーンセーバーの起動を防止します。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, - "コアのビューポートサイズを基準にしたウィンドウサイズを指定します。横幅と縦幅が一定の固定ウィンドウサイズを指定することもできます(下の項目)。") + "コアが出力するビューポートサイズを基準に\nウィンドウをスケールします。下の項目では、一定の\n幅と高さが適用される固定ウィンドウサイズを\n設定できます。") MSG_HASH(MENU_ENUM_SUBLABEL_USER_LANGUAGE, - "インタフェースの言語を変更する。") + "ユーザーインターフェースの言語を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, "フレームの間に黒フレームを挿入する。60Hzコンテンツを120Hz画面でやることを役に立つ。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, @@ -2110,17 +2110,17 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, "指定するバッファーモードをビデオドライバに伝える。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, - "希望する画面を選択する。") + "フルスクリーン画面を表示するモニターの識別番号を\n選択します。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, "画面の正確な推定のリフレッシュレート") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED, "ディスプレイドライバーによって提供されたリフレッシュレート") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, - "ビデオ出力の設定を変更する。") + "ビデオ出力の設定を変更します。") MSG_HASH(MENU_ENUM_SUBLABEL_WIFI_SETTINGS, "無線ネットワークを検索して接続する。") MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST, - "RetroArchの使い方について学ぶ。") + "RetroArchの基本的な使い方についてのヘルプを表示\nします。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES, "チートの変更点を今すぐに適用する。") MSG_HASH(MSG_ADDED_TO_FAVORITES, @@ -2446,7 +2446,7 @@ MSG_HASH(MSG_REWIND_INIT_FAILED_THREADED_AUDIO, MSG_HASH(MSG_REWIND_REACHED_END, "巻き戻しバッファの終わりに達しました") MSG_HASH(MSG_SAVED_NEW_CONFIG_TO, - "新しいコンフィグを保存しました to") + "新しいメイン設定ファイルを保存しました to") MSG_HASH(MSG_SAVED_STATE_TO_SLOT, "スロット%dにステートセーブしました") MSG_HASH(MSG_SAVED_STATE_TO_SLOT_AUTO, @@ -2522,7 +2522,7 @@ MSG_HASH(MSG_VIRTUAL_DISK_TRAY, MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_LATENCY, "ミリ秒でのオーディオ遅延。ドライバ対応による。") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MUTE, - "オーディオを消音する。") + "オーディオを消音します。") MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, "Helps smooth out imperfections in timing when synchronizing audio and video at the same time. Be aware that if disabled, proper synchronization is nearly impossible to obtain." @@ -2587,7 +2587,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_ENABLE, - "オーディオ出力を有効にする。" + "オーディオ出力を有効にします。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW, @@ -2723,11 +2723,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, "対応するコンテンツが見つかりました") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, - "開発者によって慣例的に空白にされていたイメージの端にあるいくつかのピクセルを切り取ります。 不正確なピクセルを含むこともあります。") + "コンテンツの開発者によって慣例的に空白にされていた\nイメージの端にあるいくつかのピクセルを\n切り取ります。不正確なピクセルを含むことも\nあります。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, - "画像にわずかなぼかしを加えて、ピクセルのエッジを柔らかくします。このオプションは、パフォーマンスにはほとんど影響しません。") + "イメージにわずかなぼかしを加えて、ピクセルの輪郭の\n硬さを和らげます。このオプションは\nパフォーマンスにはほとんど影響しません。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "CPUベースのビデオフィルターを適用します。備考: パフォーマンスを多く消費するかもしれません。一部のビデオフィルターは、32bitまたは16bitカラーを使用するコアでのみ動作する可能性があります。") + "CPUベースのビデオフィルターを適用します。\n一部のビデオフィルターは、コアによっては動作しない\n可能性があります。また、パフォーマンスに大きく\n影響します。") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, "RetroAchievementsアカウントのユーザー名") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, @@ -2737,34 +2737,44 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_LIST, - "使用するコアを選択する。") + "使用するコアを選択します。") MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, - "起動するコンテンツを選択する。") + "起動するコンテンツを選択します。") MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, "ネットワークインタフェースとIPアドレスを表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, "デバイス特定の仕様") MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, - "アプリを終了する。") + "RetroArchを終了します。") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, + "アスペクト比が「コンフィグ」に設定されている場合に\n使用されるアスペクト比の浮動小数点値(幅/高さ)\nです。") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + "アスペクト比が「カスタム」に設定されている場合に\n使用されるカスタムビューポートの高さです。") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, + "アスペクト比が「カスタム」に設定されている場合に\n使用されるカスタムビューポートの幅です。") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, + "ビューポートのX軸位置を定義するために使用される\nカスタムビューポートのオフセット値です。\n「整数スケール」が有効になっている場合は無視され、\nビューポートは自動的に中央寄せされます。") +MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, + "ビューポートのY軸位置を定義するために使用される\nカスタムビューポートのオフセット値です。\n「整数スケール」が有効になっている場合は無視され、\nビューポートは自動的に中央寄せされます。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, - "ディスプレイのカスタムビデオ横幅を指定します。0を指定すると可能な限りウィンドウをスケールします。") + "ウィンドウの幅を指定します。0を指定すると\n可能な限りウィンドウをスケールします。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, - "ディスプレイのカスタムビデオ縦幅を指定します。0を指定すると可能な限りウィンドウをスケールします。") + "ウィンドウの高さを指定します。0を指定すると\n可能な限りウィンドウをスケールします。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, - "OSDのカスタムX軸を指定する。") + "OSDのカスタムX軸位置を指定します。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, - "OSDのカスタムY軸を指定する。") + "OSDのカスタムY軸位置を指定します。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, "ポイントでのフォントサイズ") MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, "メニュー表示中はオーバーレイを隠し、メニューを閉じたときに再表示する。") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, - "スキャンされたコンテンツがここに表示されます。" + "スキャンしたコンテンツを表示します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, - "ビデオのスケールを整数に限定します。基礎サイズはシステムによって報告されたジオメトリとアスペクト比に依存します。「強制アスペクト比」が指定されていない場合、横幅と縦幅はそれぞれ独立して整数でスケールされます。" + "ビデオのスケールを整数に限定します。基礎サイズは\nシステムが提供するジオメトリとアスペクト比に依存\nします。「強制アスペクト比」が指定されていない\n場合、幅と高さはそれぞれ整数でスケールされます。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, @@ -2776,15 +2786,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FORCE_SRGB_DISABLE, - "sRGB FBOの対応を強制的に無効にします。sRGB FBOの対応が有効になっている一部のWindows用Intel Open GLドライバはビデオ問題を有します。この機能を有効にすることで問題を回避できます。" + "sRGB FBOの対応を強制的に無効にすることで、一部の\nWindows用Intel OpenGLドライバで発生するビデオの\n問題を回避します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, - "フルスクリーンで起動する。実行時にも切り替えできる。" + "フルスクリーンで起動します。実行時にも切り替え\n可能です。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, - "フルスクリーンであればウィンドウフルスクリーンモードを使用する。" + "ウィンドウフルスクリーンモードを使用します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD, @@ -2912,7 +2922,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_DEVICE, - "オーディオドライバーが使用する標準オーディオデバイスをオーバーライドする。\nこの設定はドライバーに依存する。" + "オーディオドライバーが使用する\n標準オーディオデバイスをオーバーライドします。\nこの設定はドライバーに依存します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN, @@ -3000,24 +3010,24 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, - "ネットプレイをホスト(サーバー)モードで有効にします。" + "ネットプレイをホスト (サーバー) モードで有効に\nします。" ) MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, "ネットプレイをクライアントモードで有効にします。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, "アクティブなネットプレイ接続を切断する。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, - "対応ファイルをフォルダからスキャンしてコレクションに追加します。") + "フォルダ内のすべての対応ファイルをスキャンして\nコレクションに追加します。") MSG_HASH(MENU_ENUM_SUBLABEL_SCAN_FILE, - "対応ファイルをスキャンしてコレクションに追加します。") + "対応ファイルをスキャンしてコレクションに追加\nします。") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, "Uses a custom swap interval for Vsync. Set this to effectively halve monitor refresh rate." ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, - "使用したコアの名前に基づいてセーブファイルをフォルダごとに分類します。" + "使用したコアの名前に基づいてセーブファイルを\nフォルダごとに分類します。" ) MSG_HASH(MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, - "使用したコアの名前に基づいてステートセーブをフォルダごとに分類します。" + "使用したコアの名前に基づいてステートセーブを\nフォルダごとに分類します。" ) MSG_HASH(MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, "URL to core updater directory on the Libretro buildbot.") @@ -3116,7 +3126,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, "サムネイルファイルの保存フォルダ" ) MSG_HASH(MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, - "設定ファイルブラウザーの初期ディレクトリを指定する。") + "設定ファイルブラウザの初期ディレクトリを指定します。") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, "The number of frames of input latency for netplay to use to hide network latency. This reduces jitter and makes netplay less CPU-intensive, at the expense of noticeable input lag.") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, @@ -3264,7 +3274,7 @@ MSG_HASH( "オーディオミキサーを消音" ) MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, - "ミキサーオーディオを消音/消音解除にする。") + "ミキサーオーディオを消音します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, "オンラインアップデーターを表示") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, @@ -3286,7 +3296,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, "コアをハードディスクから削除する。") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, - "エントリーの名前を変更する") + "エントリーの名前を変更") MSG_HASH(MENU_ENUM_SUBLABEL_RENAME_ENTRY, "このエントリーのタイトルを変更します。") MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY, @@ -3298,19 +3308,19 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, "お気に入り") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_FAVORITES, - "「お気に入りに追加」したコンテンツがここに表示されます。") + "お気に入りに追加したコンテンツを表示します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, "音楽") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_MUSIC, - "再生した音楽がここに表示されます。") + "再生した音楽を表示します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_IMAGES, "画像") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_IMAGES, - "表示した画像がここに表示されます。") + "表示した画像を表示します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, "ビデオ") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_VIDEO, - "再生したビデオがここに表示されます。") + "再生したビデオ表示します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "メニューのアイコン") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, @@ -3346,9 +3356,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION, MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION, "「情報」オプションを表示/非表示にする。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS, - "「設定ファイル」を表示") + "「メイン設定ファイル」を表示") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS, - "「設定ファイル」オプションを表示/非表示にする。") + "「メイン設定ファイル」オプションを表示/非表示にする。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, "「ヘルプ」を表示") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, @@ -3484,7 +3494,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, "オーディオリサンプラーの音質") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, - "オーディオ品質よりもパフォーマンス/遅延を優先する場合は低い設定を、パフォーマンス/遅延よりもオーディオ品質を優先する場合は高い設定を選択します。") + "オーディオ品質よりもパフォーマンス/遅延を優先する\n場合は低い設定を、パフォーマンス/遅延よりも\nオーディオ品質を優先する場合は高い設定を選択\nします。") MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, "シェーダーファイルの変更を監視") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, @@ -3522,11 +3532,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, "メニューのオーディオを有効") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, - "メニューの音を有効または無効にする。") + "メニューのオーディオ出力を有効にします。") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, "ミキサー設定") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, - "オーディオミキサー設定を表示/編集する。") + "オーディオミキサーの設定を表示/編集します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_INFO, "詳細") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE, @@ -3676,29 +3686,29 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST, MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, "オーバーライド") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, - "グローバル設定をオーバーライドするための設定です。") + "メイン設定をオーバーライドするための設定です。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, - "オーディオストリームの再生を開始します。再生が終わると、現在のオーディオストリームはメモリから取り除かれます。") + "オーディオストリームの再生を開始します。再生が\n終わると、現在のオーディオストリームはメモリから\n取り除かれます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, - "オーディオストリームの再生を開始します。再生が終わると、トラックは最初から繰り返して再生されます。") + "オーディオストリームの再生を開始します。再生が\n終わると、トラックは最初から繰り返して再生\nされます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, - "オーディオストリームの再生を開始します。再生が終わると、順番に次のオーディオストリームに\n移り、それを繰り返します。アルバム再生モードとして便利です。") + "オーディオストリームの再生を開始します。再生が\n終わると、順番に次のオーディオストリームに移り、\nそれを繰り返します。アルバム再生モードとして\n便利です。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, - "オーディオストリームの再生を停止します。メモリからは取り除かれず、「再生」を選択することで再び再生を開始できます。") + "オーディオストリームの再生を停止します。\nメモリからは取り除かれず、「再生」を選択する\nことで再び再生を開始できます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, - "オーディオストリームの再生を停止してメモリから完全に取り除きます。") + "オーディオストリームの再生を停止してメモリから\n完全に取り除きます。") MSG_HASH(MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, "オーディオストリームの音量を調整します。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER, - "このオーディオトラックを使用可能なオーディオストリームスロットに追加します。空きスロットが存在しない場合は無視されます。") + "このオーディオトラックを使用可能な\nオーディオストリームスロットに追加します。\n空きスロットが存在しない場合は無視されます。") MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, - "このオーディオトラックを使用可能なオーディオストリームスロットに追加して再生します。空きスロットが存在しない場合は無視されます。") + "このオーディオトラックを使用可能な\nオーディオストリームスロットに追加して再生します。\n空きスロットが存在しない場合は無視されます。") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, "再生") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, - "再生(ループ)") + "再生(ループ)") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL, - "再生(順番に)") + "再生(順番に)") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, "一時停止") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, @@ -3736,7 +3746,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MIDI_VOLUME, MSG_HASH(MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, "電源管理") MSG_HASH(MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, - "電源に関係する設定を変更する。") + "電源に関係する設定を変更します。") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, "パフォーマンス維持モード") MSG_HASH(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MPV_SUPPORT, @@ -3877,7 +3887,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, - "Output native, low-resolution signals for use with CRT displays." + "CRTディスプレイで利用するためのネイティブな\n低解像度信号を出力します。" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, @@ -3889,7 +3899,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "設定ファイルで指定されたカスタムリフレッシュレートを使用します。") + "設定ファイルで定義されたカスタムリフレッシュレートを使用します。") MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, "カスタムリフレッシュレートを使用") @@ -3905,7 +3915,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, - "録画を開始する。" + "録画を開始します。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, @@ -3913,7 +3923,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, - "録画を停止する。" + "録画を停止します。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, @@ -3921,7 +3931,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_STREAMING, - "ストリーミングを開始する。" + "ストリーミングを開始します。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, @@ -3929,7 +3939,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, - "ストリーミングを停止する。" + "ストリーミングを停止します。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_RECORDING_TOGGLE, From d4861e095265500579f1f7c834431d565e8641c1 Mon Sep 17 00:00:00 2001 From: LamboLighting Date: Sun, 14 Oct 2018 15:06:35 +0300 Subject: [PATCH 0354/1292] More Greek translations and some fixes More things translated and fixed some spelling mistakes from the previous commit. --- intl/msg_hash_el.h | 120 ++++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 7d5f31b053..3245125e2f 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -548,7 +548,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT, - "Απόθηκευση Διαμόρφωσης με την Έξοδο" + "Απόθηκευση Διαμόρφωσης στην Έξοδο" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST, @@ -2608,7 +2608,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, - "Dynamic run-time loading of libretro library" + "Δυναμική φόρτωση κατά την εκτέλεση της βιβλιοθήκης libretro" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT, @@ -2632,15 +2632,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER, - "Frontend identifier" + "Αναγνωριστικό λειτουργικού συστήματος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_NAME, - "Frontend name" + "Όνομα λειτουργικού συστήματος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_OS, - "Frontend OS" + "Λειτουργικό Σύστημα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION, @@ -2676,7 +2676,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBXML2_SUPPORT, - "Υποστήριξη libxml2 XML parsing" + "Υποστήριξη ανάλυσης libxml2 XML" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETPLAY_SUPPORT, @@ -2744,7 +2744,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PYTHON_SUPPORT, - "Υποστήριξη Python (script support in shaders)" + "Υποστήριξη Python (υποστήριξη script στις σκιάσεις)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RBMP_SUPPORT, @@ -3044,15 +3044,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO, - "Config Aspect Ratio" + "Διαμόρφωση Αναλογίας Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, - "Auto Aspect Ratio" + "Αυτόματη Αναλογία Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, - "Aspect Ratio" + "Αναλογία Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, @@ -3084,19 +3084,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FONT_ENABLE, - "Enable Onscreen Notifications" + "Ενεργοποίηση Ειδοποιήσεων Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, - "Notification Font" + "Γραμματοσειρά Ειδοποιήσεων" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE, - "Notification Size" + "Μέγεθος Γραμματοσειράς" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_ASPECT, - "Force aspect ratio" + "Εξαναγκασμένη αναλογία απεικόνισης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, @@ -3104,31 +3104,31 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, - "Frame Delay" + "Καθυστέρηση Καρέ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN, - "Start in Fullscreen Mode" + "Έναρξη σε Κατάσταση Πλήρης Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA, - "Video Gamma" + "Gamma Βίντεο" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD, - "Use GPU Recording" + "Χρήση Εγγραφής Κάρτας Γραφικών" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_GPU_SCREENSHOT, - "GPU Screenshot Enable" + "Ενεργοποίηση Στιγμιότυπου Οθόνης Κάρτας Γραφικών" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC, - "Hard GPU Sync" + "Σκληρός Συγχρονισμός Κάρτας Γραφικών" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES, - "Hard GPU Sync Frames" + "Σκληρός Συγχρονισμός Καρέ Κάρτας Γραφικών" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, @@ -3144,7 +3144,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, - "Monitor Index" + "Ένδειξη Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, @@ -3152,7 +3152,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, - "Vertical Refresh Rate" + "Κάθετος Ρυθμός Ανανέωσης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, @@ -3168,7 +3168,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, - "Windowed Scale" + "Κλίμακα Παραθύρου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, @@ -3264,23 +3264,23 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, - "Windowed Fullscreen Mode" + "Παράθυρο Πλήρης Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, - "Window Width" + "Πλάτος Παραθύρου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, - "Window Height" + "Ύψος Παραθύρου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_X, - "Fullscreen Width" + "Πλάτος Πλήρης Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y, - "Fullscreen Height" + "Ύψος Πλήρης Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, @@ -3296,15 +3296,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, - "Menu Font Red Color" + "Γραμματοσειρά Μενού Κόκκινο Χρώμα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, - "Menu Font Green Color" + "Γραμματοσειρά Μενού Πράσινο Χρώμα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, - "Menu Font Blue Color" + "Γραμματοσειρά Μενού Μπλε Χρώμα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_XMB_FONT, @@ -3324,7 +3324,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED, - "Μονόχρωμο Αναστρεμένο" + "Μονόχρωμο Ανεστραμμένο" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_SYSTEMATIC, @@ -3648,7 +3648,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, - "Prevents your system's screensaver from becoming active." + "Αποτρέπει την προφύλαξη οθόνης του συστήματος από το να ενεργοποιηθεί." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, @@ -3676,7 +3676,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, - "Selects which display screen to use." + "Επιλέγει ποιά οθόνη θα χρησιμοποιηθεί." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, @@ -4689,23 +4689,23 @@ MSG_HASH( ) MSG_HASH( MSG_WIFI_SCAN_COMPLETE, - "Η σάρωτη του Wi-Fi ολοκληρώθηκε." + "Η σάρωση του Wi-Fi ολοκληρώθηκε." ) MSG_HASH( MSG_SCANNING_WIRELESS_NETWORKS, - "Scanning wireless networks..." + "Σάρωση ασύρματων δικτύων..." ) MSG_HASH( MSG_NETPLAY_LAN_SCAN_COMPLETE, - "Netplay scan complete." + "Οκληρώθηκε η σάρωση Netplay." ) MSG_HASH( MSG_NETPLAY_LAN_SCANNING, - "Scanning for netplay hosts..." + "Σάρωση για οικοδεσπότες netplay..." ) MSG_HASH( MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, - "Pause gameplay when RetroArch is not the active window." + "Παύση παιχνιδιού όταν το RetroArch δεν είναι το ενεργό παράθυρο." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, @@ -4713,19 +4713,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, - "Enable or disable recent playlist for games, images, music, and videos." + "Ενεργοποίηση ή απενεργοποίηση λίστας πρόσφατων για παιχνίδια, εικόνες, μουσική και βίντεο." ) MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, - "Limit the number of entries in recent playlist for games, images, music, and videos." + "Περιορισμός καταχωρήσεων στην λίστα πρόσφατων για παιχνίδια, εικόνες, μουσική και βίντεο." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, - "Unified Menu Controls" + "Ενοποιημένος Χειρισμός Μενού" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, - "Use the same controls for both the menu and the game. Applies to the keyboard." + "Χρήση του ίδιου χειρισμού για το μενού και το παιχνίδι. Εφαρμόζεται στο πληκτρολόγιο." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, @@ -4910,11 +4910,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, - "Start in fullscreen. Can be changed at runtime. Can be overridden by a command line switch" + "Έναρξη σε πλήρη οθόνη. Μπορεί να αλλάξει κατά την εκτέλεση. Μπορεί να παρακαμπτεί από έναν διακόπτη γραμμής τερματικού." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, - "If fullscreen, prefer using a windowed fullscreen mode." + "Εάν χρησιμοποιηθεί πλήρης οθόνη προτιμήστε την κατάσταση παραθύρου πλήρης οθόνης." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD, @@ -6272,7 +6272,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, - "Ελαττώστε αυτή την τιμή για καλύτερη επίδοση/χαμηλότερη καθυστέρηση αντί ποιότητας ήχου, αυξήστε εάν θέλετε καλύτερη ποιότητα με κόστος στην επίδοση/χαμηλώτερη καθυστέρηση." + "Ελαττώστε αυτή την τιμή για καλύτερη επίδοση/χαμηλότερη καθυστέρηση αντί ποιότητας ήχου, αυξήστε εάν θέλετε καλύτερη ποιότητα με κόστος στην επίδοση/χαμηλότερη καθυστέρηση." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, @@ -7521,19 +7521,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_PACK_DOWNLOADED_SUCCESSFULLY, - "Thumbnails downloaded successfully." + "Επιτυχής λήψη σκίτσων." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_PLAYLIST_THUMBNAIL_PROGRESS, - "Succeeded: %1 Failed: %2" + "Πέτυχαν: %1 Απέτυχαν: %2" ) MSG_HASH( MSG_DEVICE_CONFIGURED_IN_PORT, - "Configured in port:" + "Διαμορφώθηκε στην θύρα:" ) MSG_HASH( MSG_FAILED_TO_SET_DISK, - "Failed to set disk" + "Αποτυχία ορισμού δίσκου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QT_CORE_OPTIONS, @@ -7541,11 +7541,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ADAPTIVE_VSYNC, - "Adaptive Vsync" + "Προσαρμοστικό Vsync" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, - "V-Sync is enabled until performance falls below the target refresh rate. Can minimize stuttering when performance falls below realtime, and can be more energy efficient." + "Το V-Sync είναι ενεργοποιημένο μέχρι η επίδοση να πέσει κάτω από τον στόχο ρυθμού ανανέωσης. Μπορεί να μιώσει τα κολλήματα όταν η επίδοση πέφτει χαμηλότερα από τον κανονικό χρόνο και μπορεί να είναι πιο αποδοτικό ενεργειακά." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, @@ -7553,31 +7553,31 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, - "Output native, low-resolution signals for use with CRT displays." + "Εξαγωγή ντόπιων, χαμηλής ανάλυσης σημάτων για χρήση με οθόνες CRT." ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, - "Cycle through these options if the image is not centered properly on the display." + "Εναλλάξτε μεταξύ αυτών των επιλογών εάν η εικόνα δεν είναι σωστά κεντραρισμένη στην οθόνη." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, - "X-Axis Centering" + "Κεντράρισμα Άξωνα Χ" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use a custom refresh rate specified in the config file if needed." + "Χρήση προσαρμοσμένου ρυθμού ανανέωσης προσδιορισμένου στο αρχείο διαμόρφωσης εάν χρειάζεται." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Use Custom Refresh Rate" + "Χρήση Προσαρμοσμένου Ρυθμού Ανανέωσης" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Select the output port connected to the CRT display." + "Επιλέξτε την θύρα εξόδου που είναι συνδεδεμένη με την οθόνη CRT." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Output Display ID" + "ID Οθόνης Εξόδου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, From 2edd03361c35ef2648d30ff421bfcee44158bb4f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 17:49:10 +0200 Subject: [PATCH 0355/1292] Remove video_context_driver_check_window --- gfx/drivers/gdi_gfx.c | 15 +++++++-------- gfx/drivers/sixel_gfx.c | 10 ++++------ gfx/drivers/vg.c | 10 +++------- gfx/drivers/vulkan.c | 21 ++++++++------------- gfx/video_driver.c | 18 ------------------ gfx/video_driver.h | 2 -- 6 files changed, 22 insertions(+), 54 deletions(-) diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index 8765351ca4..9caa715d27 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -30,6 +30,7 @@ #include "../../driver.h" #include "../../configuration.h" +#include "../../retroarch.h" #include "../../verbosity.h" #include "../../frontend/frontend_driver.h" #include "../common/gdi_common.h" @@ -360,23 +361,21 @@ static void gdi_gfx_set_nonblock_state(void *data, bool toggle) static bool gdi_gfx_alive(void *data) { - gfx_ctx_size_t size_data; unsigned temp_width = 0; unsigned temp_height = 0; bool quit = false; bool resize = false; bool ret = false; + bool is_shutdown = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL); + gdi_t *gdi = (gdi_t*)data; /* Needed because some context drivers don't track their sizes */ video_driver_get_size(&temp_width, &temp_height); - size_data.quit = &quit; - size_data.resize = &resize; - size_data.width = &temp_width; - size_data.height = &temp_height; + gdi->ctx_driver->check_window(gdi->ctx_data, + &quit, &resize, &temp_width, &temp_height, is_shutdown); - if (video_context_driver_check_window(&size_data)) - ret = !quit; + ret = !quit; if (temp_width != 0 && temp_height != 0) video_driver_set_size(&temp_width, &temp_height); @@ -406,7 +405,7 @@ static bool gdi_gfx_has_windowed(void *data) static void gdi_gfx_free(void *data) { gdi_t *gdi = (gdi_t*)data; - HWND hwnd = win32_get_window(); + HWND hwnd = win32_get_window(); if (gdi_menu_frame) { diff --git a/gfx/drivers/sixel_gfx.c b/gfx/drivers/sixel_gfx.c index 6966820e14..8daecdaa32 100644 --- a/gfx/drivers/sixel_gfx.c +++ b/gfx/drivers/sixel_gfx.c @@ -439,16 +439,14 @@ static bool sixel_gfx_alive(void *data) unsigned temp_height = 0; bool quit = false; bool resize = false; + bool is_shutdown = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL); + sixel_t *sixel = (sixel_t*)data; /* Needed because some context drivers don't track their sizes */ video_driver_get_size(&temp_width, &temp_height); - size_data.quit = &quit; - size_data.resize = &resize; - size_data.width = &temp_width; - size_data.height = &temp_height; - - video_context_driver_check_window(&size_data); + sixel->ctx_driver->check_window(sixel->ctx_data, + &quit, &resize, &temp_width, &temp_height, is_shutdown); if (temp_width != 0 && temp_height != 0) video_driver_set_size(&temp_width, &temp_height); diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index b93ce38fb2..28db6bdde7 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -441,18 +441,14 @@ static bool vg_frame(void *data, const void *frame, static bool vg_alive(void *data) { - gfx_ctx_size_t size_data; bool quit = false; unsigned temp_width = 0; unsigned temp_height = 0; vg_t *vg = (vg_t*)data; + bool is_shutdown = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL); - size_data.quit = &quit; - size_data.resize = &vg->should_resize; - size_data.width = &temp_width; - size_data.height = &temp_height; - - video_context_driver_check_window(&size_data); + vg->ctx_driver->check_window(vg->ctx_data, + &quit, &resize, &temp_width, &temp_height, is_shutdown); if (temp_width != 0 && temp_height != 0) video_driver_set_size(&temp_width, &temp_height); diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 6713a46fbc..859b37a2b6 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1286,30 +1286,25 @@ static void vulkan_set_nonblock_state(void *data, bool state) static bool vulkan_alive(void *data) { - gfx_ctx_size_t size_data; unsigned temp_width = 0; unsigned temp_height = 0; bool ret = false; bool quit = false; bool resize = false; vk_t *vk = (vk_t*)data; + bool is_shutdown = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL); video_driver_get_size(&temp_width, &temp_height); - size_data.quit = &quit; - size_data.resize = &resize; - size_data.width = &temp_width; - size_data.height = &temp_height; + vk->ctx_driver->check_window(vk->ctx_data, + &quit, &resize, &temp_width, &temp_height, is_shutdown); - if (video_context_driver_check_window(&size_data)) - { - if (quit) - vk->quitting = true; - else if (resize) - vk->should_resize = true; + if (quit) + vk->quitting = true; + else if (resize) + vk->should_resize = true; - ret = !vk->quitting; - } + ret = !vk->quitting; if (temp_width != 0 && temp_height != 0) video_driver_set_size(&temp_width, &temp_height); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index c9aa356823..e2233a4323 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3082,24 +3082,6 @@ const gfx_ctx_driver_t *video_context_driver_init_first(void *data, return NULL; } -bool video_context_driver_check_window(gfx_ctx_size_t *size_data) -{ - if ( video_context_data - && current_video_context.check_window) - { - bool is_shutdown = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL); - current_video_context.check_window(video_context_data, - size_data->quit, - size_data->resize, - size_data->width, - size_data->height, - is_shutdown); - return true; - } - - return false; -} - bool video_context_driver_init_image_buffer(const video_info_t *data) { if ( diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 6add41cec4..013df5745a 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1145,8 +1145,6 @@ const gfx_ctx_driver_t *video_context_driver_init_first( enum gfx_ctx_api api, unsigned major, unsigned minor, bool hw_render_ctx, void **ctx_data); -bool video_context_driver_check_window(gfx_ctx_size_t *size_data); - bool video_context_driver_find_prev_driver(void); bool video_context_driver_find_next_driver(void); From 454761a6edd0ba7b94215cf6f5bf1a54a4410052 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 19:49:24 +0200 Subject: [PATCH 0356/1292] Get rid of video_context_driver_bind_hw_render --- gfx/drivers/gl.c | 41 ++++++++++++----------- gfx/drivers_renderchain/gl2_renderchain.c | 16 ++++----- gfx/video_driver.c | 8 ----- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 860df2c31a..e6578d753c 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -118,10 +118,11 @@ static const GLfloat white_color[] = { static bool gl_shared_context_use = false; -void context_bind_hw_render(bool enable) +void context_bind_hw_render(void *data, bool enable) { + gl_t *gl = (gl_t*)data; if (gl_shared_context_use) - video_context_driver_bind_hw_render(&enable); + gl->ctx_driver->bind_hw_render(gl->ctx_data, enable); } @@ -678,7 +679,7 @@ static void gl_set_texture_frame(void *data, if (!gl) return; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); menu_filter = settings->bools.menu_linear_filter ? TEXTURE_FILTER_LINEAR : TEXTURE_FILTER_NEAREST; @@ -695,7 +696,7 @@ static void gl_set_texture_frame(void *data, gl->menu_texture_alpha = alpha; glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); - context_bind_hw_render(true); + context_bind_hw_render(gl, true); } static void gl_set_texture_enable(void *data, bool state, bool full_screen) @@ -958,7 +959,7 @@ static bool gl_frame(void *data, const void *frame, return false; #endif - context_bind_hw_render(false); + context_bind_hw_render(gl, false); if (gl->core_context_in_use && gl->renderchain_driver->bind_vao) gl->renderchain_driver->bind_vao(gl, gl->renderchain_data); @@ -1226,7 +1227,7 @@ static bool gl_frame(void *data, const void *frame, gl->renderchain_driver->unbind_vao(gl, gl->renderchain_data); - context_bind_hw_render(true); + context_bind_hw_render(gl, true); return true; } @@ -1266,7 +1267,7 @@ static void gl_free(void *data) if (!gl) return; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); if (gl->have_sync) { @@ -1332,13 +1333,13 @@ static void gl_set_nonblock_state(void *data, bool state) RARCH_LOG("[GL]: VSync => %s\n", state ? "off" : "on"); - context_bind_hw_render(false); + context_bind_hw_render(gl, false); if (!state) interval = settings->uints.video_swap_interval; video_context_driver_swap_interval(&interval); - context_bind_hw_render(true); + context_bind_hw_render(gl, true); } static bool resolve_extensions(gl_t *gl, const char *context_ident, const video_info_t *video) @@ -1870,9 +1871,9 @@ static void *gl_init(const video_info_t *video, * create textures. */ gl->textures = 1; #ifdef GL_DEBUG - context_bind_hw_render(true); + context_bind_hw_render(gl, true); gl_begin_debug(gl); - context_bind_hw_render(false); + context_bind_hw_render(gl, false); #endif } @@ -2008,7 +2009,7 @@ static void *gl_init(const video_info_t *video, goto error; } - context_bind_hw_render(true); + context_bind_hw_render(gl, true); return gl; error: @@ -2065,7 +2066,7 @@ static void gl_update_tex_filter_frame(gl_t *gl) wrap_info.idx = 0; wrap_info.type = RARCH_WRAP_BORDER; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); shader_filter.index = 1; shader_filter.smooth = &smooth; @@ -2102,7 +2103,7 @@ static void gl_update_tex_filter_frame(gl_t *gl) } glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); - context_bind_hw_render(true); + context_bind_hw_render(gl, true); } static bool gl_set_shader(void *data, @@ -2117,7 +2118,7 @@ static bool gl_set_shader(void *data, if (!gl) return false; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); if (type == RARCH_SHADER_NONE) return false; @@ -2200,13 +2201,13 @@ static bool gl_set_shader(void *data, /* Apparently need to set viewport for passes when we aren't using FBOs. */ gl_set_shader_viewports(gl); - context_bind_hw_render(true); + context_bind_hw_render(gl, true); #endif return true; error: - context_bind_hw_render(true); + context_bind_hw_render(gl, true); return false; } @@ -2304,7 +2305,7 @@ static bool gl_overlay_load(void *data, if (!gl) return false; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); gl_free_overlay(gl); gl->overlay_tex = (GLuint*) @@ -2312,7 +2313,7 @@ static bool gl_overlay_load(void *data, if (!gl->overlay_tex) { - context_bind_hw_render(true); + context_bind_hw_render(gl, true); return false; } @@ -2350,7 +2351,7 @@ static bool gl_overlay_load(void *data, gl->overlay_color_coord[16 * i + j] = 1.0f; } - context_bind_hw_render(true); + context_bind_hw_render(gl, true); return true; } diff --git a/gfx/drivers_renderchain/gl2_renderchain.c b/gfx/drivers_renderchain/gl2_renderchain.c index 52ac479b11..64a138218f 100644 --- a/gfx/drivers_renderchain/gl2_renderchain.c +++ b/gfx/drivers_renderchain/gl2_renderchain.c @@ -164,7 +164,7 @@ static void gl2_renderchain_bind_backbuffer(void *data, #endif } -void context_bind_hw_render(bool enable); +void context_bind_hw_render(void *data, bool enable); void gl_load_texture_data( uint32_t id_data, @@ -532,7 +532,7 @@ static void gl2_renderchain_deinit_hw_render( if (!gl) return; - context_bind_hw_render(true); + context_bind_hw_render(gl, true); if (gl->hw_render_fbo_init) gl2_delete_fb(gl->textures, gl->hw_render_fbo); @@ -540,7 +540,7 @@ static void gl2_renderchain_deinit_hw_render( gl2_delete_rb(gl->textures, chain->hw_render_depth); gl->hw_render_fbo_init = false; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); } static void gl2_renderchain_free(gl_t *gl, void *chain_data) @@ -956,7 +956,7 @@ static bool gl2_renderchain_init_hw_render( /* We can only share texture objects through contexts. * FBOs are "abstract" objects and are not shared. */ - context_bind_hw_render(true); + context_bind_hw_render(gl, true); RARCH_LOG("[GL]: Initializing HW render (%u x %u).\n", width, height); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_fbo_size); @@ -1037,7 +1037,7 @@ static bool gl2_renderchain_init_hw_render( gl2_renderchain_bind_backbuffer(gl, chain_data); gl->hw_render_fbo_init = true; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); return true; } @@ -1076,7 +1076,7 @@ static bool gl2_renderchain_read_viewport( if (!gl) return false; - context_bind_hw_render(false); + context_bind_hw_render(gl, false); num_pixels = gl->vp.width * gl->vp.height; @@ -1160,11 +1160,11 @@ static bool gl2_renderchain_read_viewport( gl->readback_buffer_screenshot = NULL; } - context_bind_hw_render(true); + context_bind_hw_render(gl, true); return true; error: - context_bind_hw_render(true); + context_bind_hw_render(gl, true); return false; } diff --git a/gfx/video_driver.c b/gfx/video_driver.c index e2233a4323..cf5211f338 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3119,14 +3119,6 @@ bool video_context_driver_get_video_output_next(void) return true; } -bool video_context_driver_bind_hw_render(bool *enable) -{ - if (!current_video_context.bind_hw_render) - return false; - current_video_context.bind_hw_render(video_context_data, *enable); - return true; -} - void video_context_driver_make_current(bool release) { if (current_video_context.make_current) From 6b03a95b8dc52986b5161ef768420f2daa2a0583 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 14 Oct 2018 20:04:29 +0200 Subject: [PATCH 0357/1292] Cleanup --- gfx/drivers/gl.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index e6578d753c..f447f2bb1b 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -118,11 +118,14 @@ static const GLfloat white_color[] = { static bool gl_shared_context_use = false; +#define gl_context_bind_hw_render(gl, enable) \ + if (gl_shared_context_use) \ + gl->ctx_driver->bind_hw_render(gl->ctx_data, enable) + void context_bind_hw_render(void *data, bool enable) { gl_t *gl = (gl_t*)data; - if (gl_shared_context_use) - gl->ctx_driver->bind_hw_render(gl->ctx_data, enable); + gl_context_bind_hw_render(gl, enable); } @@ -679,7 +682,7 @@ static void gl_set_texture_frame(void *data, if (!gl) return; - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); menu_filter = settings->bools.menu_linear_filter ? TEXTURE_FILTER_LINEAR : TEXTURE_FILTER_NEAREST; @@ -696,7 +699,7 @@ static void gl_set_texture_frame(void *data, gl->menu_texture_alpha = alpha; glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); } static void gl_set_texture_enable(void *data, bool state, bool full_screen) @@ -959,7 +962,7 @@ static bool gl_frame(void *data, const void *frame, return false; #endif - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); if (gl->core_context_in_use && gl->renderchain_driver->bind_vao) gl->renderchain_driver->bind_vao(gl, gl->renderchain_data); @@ -1227,7 +1230,7 @@ static bool gl_frame(void *data, const void *frame, gl->renderchain_driver->unbind_vao(gl, gl->renderchain_data); - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); return true; } @@ -1267,7 +1270,7 @@ static void gl_free(void *data) if (!gl) return; - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); if (gl->have_sync) { @@ -1333,13 +1336,13 @@ static void gl_set_nonblock_state(void *data, bool state) RARCH_LOG("[GL]: VSync => %s\n", state ? "off" : "on"); - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); if (!state) interval = settings->uints.video_swap_interval; video_context_driver_swap_interval(&interval); - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); } static bool resolve_extensions(gl_t *gl, const char *context_ident, const video_info_t *video) @@ -1871,9 +1874,9 @@ static void *gl_init(const video_info_t *video, * create textures. */ gl->textures = 1; #ifdef GL_DEBUG - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); gl_begin_debug(gl); - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); #endif } @@ -2009,7 +2012,7 @@ static void *gl_init(const video_info_t *video, goto error; } - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); return gl; error: @@ -2066,7 +2069,7 @@ static void gl_update_tex_filter_frame(gl_t *gl) wrap_info.idx = 0; wrap_info.type = RARCH_WRAP_BORDER; - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); shader_filter.index = 1; shader_filter.smooth = &smooth; @@ -2103,7 +2106,7 @@ static void gl_update_tex_filter_frame(gl_t *gl) } glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); } static bool gl_set_shader(void *data, @@ -2118,7 +2121,7 @@ static bool gl_set_shader(void *data, if (!gl) return false; - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); if (type == RARCH_SHADER_NONE) return false; @@ -2201,13 +2204,13 @@ static bool gl_set_shader(void *data, /* Apparently need to set viewport for passes when we aren't using FBOs. */ gl_set_shader_viewports(gl); - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); #endif return true; error: - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); return false; } @@ -2305,7 +2308,7 @@ static bool gl_overlay_load(void *data, if (!gl) return false; - context_bind_hw_render(gl, false); + gl_context_bind_hw_render(gl, false); gl_free_overlay(gl); gl->overlay_tex = (GLuint*) @@ -2313,7 +2316,7 @@ static bool gl_overlay_load(void *data, if (!gl->overlay_tex) { - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); return false; } @@ -2351,7 +2354,7 @@ static bool gl_overlay_load(void *data, gl->overlay_color_coord[16 * i + j] = 1.0f; } - context_bind_hw_render(gl, true); + gl_context_bind_hw_render(gl, true); return true; } From 35620ffe473f5dee6119bf9a8e2e0e77df270420 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Sun, 14 Oct 2018 11:07:57 -0700 Subject: [PATCH 0358/1292] feat(Metal): Add support for screen shots --- .../RetroArch_Metal.xcodeproj/project.pbxproj | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index a0780ba6cc..e4dcacd08a 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -8,12 +8,7 @@ /* Begin PBXBuildFile section */ 05269A6220ABF20500C29F1E /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05269A6120ABF20500C29F1E /* MetalKit.framework */; }; - 053FC25E21433F2200D98D46 /* QtConcurrent.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25521433F1700D98D46 /* QtConcurrent.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 053FC26021433F2200D98D46 /* QtCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25421433F1700D98D46 /* QtCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 053FC26221433F2200D98D46 /* QtGui.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25321433F1700D98D46 /* QtGui.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 053FC26421433F2200D98D46 /* QtNetwork.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25621433F1800D98D46 /* QtNetwork.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 053FC26521433F2200D98D46 /* QtWidgets.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25721433F1800D98D46 /* QtWidgets.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 053FC26621433F2200D98D46 /* QtWidgets.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25721433F1800D98D46 /* QtWidgets.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 053FC270214340F500D98D46 /* QtGui.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25321433F1700D98D46 /* QtGui.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 053FC271214340F500D98D46 /* QtNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25621433F1800D98D46 /* QtNetwork.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 053FC272214341E000D98D46 /* QtConcurrent.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25521433F1700D98D46 /* QtConcurrent.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; @@ -76,11 +71,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 053FC26021433F2200D98D46 /* QtCore.framework in Embed Frameworks */, - 053FC25E21433F2200D98D46 /* QtConcurrent.framework in Embed Frameworks */, - 053FC26621433F2200D98D46 /* QtWidgets.framework in Embed Frameworks */, - 053FC26421433F2200D98D46 /* QtNetwork.framework in Embed Frameworks */, - 053FC26221433F2200D98D46 /* QtGui.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -1603,7 +1593,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/zsh; - shellScript = "BINARY=${TARGET_BUILD_DIR}/${EXECUTABLE_PATH}\nVER=Versions/${QT_VERSION}\nfor name in {QtConcurrent,QtCore,QtWidgets,QtNetwork,QtGui}; do\n echo updating install path for ${name}.framework\n install_name_tool -change ${QT_FRAMEWORK_PATH}/${name}.framework/${VER}/${name} @executable_path/../Frameworks/${name}.framework/${VER}/${name} ${BINARY}\ndone"; + shellScript = "echo \"Updating ${FULL_PRODUCT_NAME} with Qt deployment\"\n${QT_INSTALL}/bin/macdeployqt ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME} -no-strip -verbose=1\n"; showEnvVarsInLog = 0; }; 053FC2782143764B00D98D46 /* ShellScript */ = { @@ -1617,7 +1607,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "make -C ${SRCBASE} -f Makefile.apple HAVE_QT=1 MOC=${QT_INSTALL}/bin/moc generate"; + shellScript = "make -C ${SRCBASE} -f Makefile.apple HAVE_QT=1 MOC=${QT_INSTALL}/bin/moc generate\n"; }; /* End PBXShellScriptBuildPhase section */ From b48768c02360f7769b6e66813c88b432caa598ce Mon Sep 17 00:00:00 2001 From: Sven <40953353+RetroSven@users.noreply.github.com> Date: Sun, 14 Oct 2018 14:25:44 -0400 Subject: [PATCH 0359/1292] extend cheat searching to accommodate multiple memory pointers --- libretro-common/include/libretro.h | 19 ++- managers/cheat_manager.c | 231 ++++++++++++++++++++++------- managers/cheat_manager.h | 4 +- menu/menu_displaylist.c | 4 +- menu/menu_setting.c | 2 +- 5 files changed, 197 insertions(+), 63 deletions(-) diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 4cbd18936c..6748c44dad 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -1290,14 +1290,17 @@ struct retro_hw_render_context_negotiation_interface * dependence */ #define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT (1 << 6) -#define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */ -#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */ -#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */ -#define RETRO_MEMDESC_ALIGN_4 (2 << 16) -#define RETRO_MEMDESC_ALIGN_8 (3 << 16) -#define RETRO_MEMDESC_MINSIZE_2 (1 << 24) /* All memory in this region is accessed at least 2 bytes at the time. */ -#define RETRO_MEMDESC_MINSIZE_4 (2 << 24) -#define RETRO_MEMDESC_MINSIZE_8 (3 << 24) +#define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */ +#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */ +#define RETRO_MEMDESC_SYSTEM_RAM (1 << 2) /* The memory area is system RAM. This is main RAM of the gaming system. */ +#define RETRO_MEMDESC_SAVE_RAM (1 << 3) /* The memory area is save RAM. This RAM is usually found on a game cartridge, backed up by a battery. */ +#define RETRO_MEMDESC_VIDEO_RAM (1 << 4) /* The memory area is video RAM (VRAM) */ +#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */ +#define RETRO_MEMDESC_ALIGN_4 (2 << 16) +#define RETRO_MEMDESC_ALIGN_8 (3 << 16) +#define RETRO_MEMDESC_MINSIZE_2 (1 << 24) /* All memory in this region is accessed at least 2 bytes at the time. */ +#define RETRO_MEMDESC_MINSIZE_4 (2 << 24) +#define RETRO_MEMDESC_MINSIZE_8 (3 << 24) struct retro_memory_descriptor { uint64_t flags; diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 6fd50412b7..de8892c30d 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -544,14 +544,22 @@ void cheat_manager_free(void) if ( cheat_manager_state.matches ) free(cheat_manager_state.matches); + if ( cheat_manager_state.memory_buf_list ) + free(cheat_manager_state.memory_buf_list); + + if ( cheat_manager_state.memory_size_list ) + free(cheat_manager_state.memory_size_list); + cheat_manager_state.cheats = NULL; cheat_manager_state.size = 0; cheat_manager_state.buf_size = 0; cheat_manager_state.prev_memory_buf = NULL; cheat_manager_state.curr_memory_buf = NULL; + cheat_manager_state.memory_buf_list = NULL; + cheat_manager_state.memory_size_list = NULL; cheat_manager_state.matches = NULL; + cheat_manager_state.num_memory_buffers = 0; cheat_manager_state.total_memory_size = 0; - cheat_manager_state.actual_memory_size = 0; cheat_manager_state.memory_initialized = false; cheat_manager_state.memory_search_initialized = false; @@ -713,34 +721,105 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) retro_ctx_memory_info_t meminfo; bool refresh = false; bool is_search_initialization = (setting != NULL); + rarch_system_info_t *system = runloop_get_system_info(); + int i ; + unsigned offset = 0; - meminfo.id = RETRO_MEMORY_SYSTEM_RAM; - if (!core_get_memory(&meminfo)) + cheat_manager_state.num_memory_buffers = 0 ; + cheat_manager_state.total_memory_size = 0 ; + cheat_manager_state.curr_memory_buf = NULL ; + if (cheat_manager_state.memory_buf_list != NULL) { - runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true); - return 0; + free(cheat_manager_state.memory_buf_list) ; + cheat_manager_state.memory_buf_list = NULL ; + } + if (cheat_manager_state.memory_size_list != NULL) + { + free(cheat_manager_state.memory_size_list) ; + cheat_manager_state.memory_size_list = NULL ; } - if ( meminfo.size == 0 ) - return 0; + if (system && system->mmaps.num_descriptors > 0) + { + for (i = 0; i < system->mmaps.num_descriptors; i++) + { + if ((system->mmaps.descriptors[i].core.flags & RETRO_MEMDESC_SYSTEM_RAM) != 0 && + system->mmaps.descriptors[i].core.ptr != NULL && + system->mmaps.descriptors[i].core.len > 0) + { + cheat_manager_state.num_memory_buffers++ ; + + if (cheat_manager_state.memory_buf_list == NULL) + cheat_manager_state.memory_buf_list = calloc(1, sizeof(uint8_t *)); + else + cheat_manager_state.memory_buf_list = realloc(cheat_manager_state.memory_buf_list, sizeof(uint8_t *)*cheat_manager_state.num_memory_buffers); + + if (cheat_manager_state.memory_size_list == NULL) + cheat_manager_state.memory_size_list = calloc(1, sizeof(unsigned)); + else + cheat_manager_state.memory_size_list = realloc(cheat_manager_state.memory_size_list, sizeof(unsigned)*cheat_manager_state.num_memory_buffers); + + cheat_manager_state.memory_buf_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.ptr ; + cheat_manager_state.memory_size_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.len ; + cheat_manager_state.total_memory_size += system->mmaps.descriptors[i].core.len ; + + if (cheat_manager_state.curr_memory_buf == NULL) + cheat_manager_state.curr_memory_buf = system->mmaps.descriptors[i].core.ptr; + } + } + } + + if (cheat_manager_state.num_memory_buffers == 0) + { + meminfo.id = RETRO_MEMORY_SYSTEM_RAM; + if (!core_get_memory(&meminfo)) + { + runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true); + return 0; + } + + if (meminfo.size == 0) + return 0; + + cheat_manager_state.memory_buf_list = calloc(1, sizeof(uint8_t *)); + cheat_manager_state.memory_size_list = calloc(1, sizeof(unsigned)); + cheat_manager_state.num_memory_buffers = 1 ; + cheat_manager_state.memory_buf_list[0] = meminfo.data ; + cheat_manager_state.memory_size_list[0] = (unsigned)meminfo.size ; + cheat_manager_state.total_memory_size = (unsigned)meminfo.size; + cheat_manager_state.curr_memory_buf = meminfo.data; + + } - cheat_manager_state.actual_memory_size = (unsigned)meminfo.size; - cheat_manager_state.curr_memory_buf = meminfo.data; - cheat_manager_state.total_memory_size = (unsigned)meminfo.size; cheat_manager_state.num_matches = (cheat_manager_state.total_memory_size*8)/((int)pow(2,cheat_manager_state.search_bit_size)); + /* Ensure we're aligned on 4-byte boundary */ #if 0 if (meminfo.size % 4 > 0) cheat_manager_state.total_memory_size = cheat_manager_state.total_memory_size + (4 - (meminfo.size%4)); #endif + if (is_search_initialization) { + if (cheat_manager_state.prev_memory_buf != NULL) + { + free(cheat_manager_state.prev_memory_buf); + cheat_manager_state.prev_memory_buf = NULL ; + } + cheat_manager_state.prev_memory_buf = (uint8_t*) calloc(cheat_manager_state.total_memory_size, sizeof(uint8_t)); if (!cheat_manager_state.prev_memory_buf) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_FAIL), 1, 180, true); return 0; } + + if (cheat_manager_state.matches != NULL) + { + free(cheat_manager_state.matches); + cheat_manager_state.matches = NULL ; + } + cheat_manager_state.matches = (uint8_t*) calloc(cheat_manager_state.total_memory_size, sizeof(uint8_t)); if (!cheat_manager_state.matches) { @@ -751,7 +830,15 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) } memset(cheat_manager_state.matches, 0xFF, cheat_manager_state.total_memory_size); - memcpy(cheat_manager_state.prev_memory_buf, cheat_manager_state.curr_memory_buf, cheat_manager_state.actual_memory_size); + + offset = 0 ; + + for ( i = 0 ; i < cheat_manager_state.num_memory_buffers ; i++) + { + memcpy(cheat_manager_state.prev_memory_buf+offset, cheat_manager_state.memory_buf_list[i], cheat_manager_state.memory_size_list[i]); + offset += cheat_manager_state.memory_size_list[i] ; + } + cheat_manager_state.memory_search_initialized = true; } @@ -771,6 +858,25 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) return 0; } +static unsigned translate_address(unsigned address, unsigned char **curr) +{ + unsigned offset = 0 ; + unsigned i = 0 ; + + for (i = 0 ; i < cheat_manager_state.num_memory_buffers ; i++ ) + { + if ( (address >= offset) && (address < offset+cheat_manager_state.memory_size_list[i]) ) + { + *curr = cheat_manager_state.memory_buf_list[i] ; + break ; + } + else + offset += cheat_manager_state.memory_size_list[i] ; + } + + return offset ; +} + static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int *bytes_per_item, unsigned int *mask, unsigned int *bits) { switch( bitsize) @@ -868,9 +974,11 @@ int cheat_manager_search(enum cheat_search_type search_type) unsigned int mask = 0; unsigned int bytes_per_item = 1; unsigned int bits = 8; + unsigned int offset = 0; + unsigned int i = 0; bool refresh = false; - if (!cheat_manager_state.curr_memory_buf) + if (cheat_manager_state.num_memory_buffers == 0) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_NOT_INITIALIZED), 1, 180, true); return 0; @@ -884,13 +992,15 @@ int cheat_manager_search(enum cheat_search_type search_type) { unsigned byte_part; + offset = translate_address(idx, &curr) ; + switch (bytes_per_item) { case 2 : { curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); + (*(curr+idx-offset)*256) + *(curr+idx+1-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256); prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : *(prev+idx) + (*(prev+idx+1)*256); @@ -899,8 +1009,8 @@ int cheat_manager_search(enum cheat_search_type search_type) case 4 : { curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + (*(curr+idx-offset)*256*256*256) + (*(curr+idx+1-offset)*256*256) + (*(curr+idx+2-offset)*256) + *(curr+idx+3-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256) + (*(curr+idx+2-offset)*256*256) + (*(curr+idx+3-offset)*256*256*256); prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); @@ -909,7 +1019,7 @@ int cheat_manager_search(enum cheat_search_type search_type) case 1 : default : { - curr_val = *(curr+idx); + curr_val = *(curr-offset+idx); prev_val = *(prev+idx); break; } @@ -973,7 +1083,13 @@ int cheat_manager_search(enum cheat_search_type search_type) } } - memcpy(cheat_manager_state.prev_memory_buf, cheat_manager_state.curr_memory_buf, cheat_manager_state.actual_memory_size); + offset = 0 ; + + for ( i = 0 ; i < cheat_manager_state.num_memory_buffers ; i++) + { + memcpy(cheat_manager_state.prev_memory_buf+offset, cheat_manager_state.memory_buf_list[i], cheat_manager_state.memory_size_list[i]); + offset += cheat_manager_state.memory_size_list[i] ; + } snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches); msg[sizeof(msg) - 1] = 0; @@ -1015,7 +1131,9 @@ int cheat_manager_add_matches(const char *path, unsigned int bits = 8; unsigned int curr_val = 0; unsigned int num_added = 0; - unsigned char *curr = cheat_manager_state.curr_memory_buf; + unsigned int offset = 0; + unsigned int i = 0; + unsigned char *curr = cheat_manager_state.curr_memory_buf; if ( cheat_manager_state.num_matches + cheat_manager_state.size > 100 ) { @@ -1026,21 +1144,23 @@ int cheat_manager_add_matches(const char *path, for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { + offset = translate_address(idx, &curr) ; + switch ( bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); + (*(curr+idx-offset)*256) + *(curr+idx+1-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256); break; case 4 : curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + (*(curr+idx-offset)*256*256*256) + (*(curr+idx+1-offset)*256*256) + (*(curr+idx+2-offset)*256) + *(curr+idx+3-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256) + (*(curr+idx+2-offset)*256*256) + (*(curr+idx+3-offset)*256*256*256); break; case 1 : default : - curr_val = *(curr+idx); + curr_val = *(curr-offset+idx); break; } for (byte_part = 0; byte_part < 8/bits; byte_part++) @@ -1178,6 +1298,7 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu void cheat_manager_apply_retro_cheats(void) { unsigned i; + unsigned int offset; unsigned int mask = 0; unsigned int bytes_per_item = 1; unsigned int bits = 8; @@ -1216,26 +1337,28 @@ void cheat_manager_apply_retro_cheats(void) curr = cheat_manager_state.curr_memory_buf; idx = cheat_manager_state.cheats[i].address; + offset = translate_address(idx, &curr) ; + switch (bytes_per_item) { case 2 : { curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); + (*(curr+idx-offset)*256) + *(curr+idx+1-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256); break; } case 4 : { curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + (*(curr+idx-offset)*256*256*256) + (*(curr+idx+1-offset)*256*256) + (*(curr+idx+2-offset)*256) + *(curr+idx+3-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256) + (*(curr+idx+2-offset)*256*256) + (*(curr+idx+3-offset)*256*256*256); break; } case 1 : default : { - curr_val = *(curr+idx); + curr_val = *(curr+idx-offset); break; } } @@ -1283,30 +1406,30 @@ void cheat_manager_apply_retro_cheats(void) case 2 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 8) & 0xFF; - *(curr+idx+1) = value_to_set & 0xFF; + *(curr+idx-offset) = (value_to_set >> 8) & 0xFF; + *(curr+idx+1-offset) = value_to_set & 0xFF; } else { - *(curr+idx) = value_to_set & 0xFF; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF; + *(curr+idx-offset) = value_to_set & 0xFF; + *(curr+idx+1-offset) = (value_to_set >> 8) & 0xFF; } break; case 4 : if (cheat_manager_state.cheats[i].big_endian) { - *(curr+idx) = (value_to_set >> 24) & 0xFF; - *(curr+idx+1) = (value_to_set >> 16) & 0xFF; - *(curr+idx+2) = (value_to_set >> 8) & 0xFF; - *(curr+idx+3) = value_to_set & 0xFF; + *(curr+idx-offset) = (value_to_set >> 24) & 0xFF; + *(curr+idx+1-offset) = (value_to_set >> 16) & 0xFF; + *(curr+idx+2-offset) = (value_to_set >> 8) & 0xFF; + *(curr+idx+3-offset) = value_to_set & 0xFF; } else { - *(curr+idx) = value_to_set & 0xFF; - *(curr+idx+1) = (value_to_set >> 8) & 0xFF; - *(curr+idx+2) = (value_to_set >> 16) & 0xFF; - *(curr+idx+3) = (value_to_set >> 24) & 0xFF; + *(curr+idx-offset) = value_to_set & 0xFF; + *(curr+idx+1-offset) = (value_to_set >> 8) & 0xFF; + *(curr+idx+2-offset) = (value_to_set >> 16) & 0xFF; + *(curr+idx+3-offset) = (value_to_set >> 24) & 0xFF; } break; @@ -1314,7 +1437,7 @@ void cheat_manager_apply_retro_cheats(void) if (bits < 8) { unsigned bitpos; - unsigned char val = *(curr+idx); + unsigned char val = *(curr+idx-offset); for (bitpos = 0; bitpos < 8; bitpos++) { @@ -1327,13 +1450,13 @@ void cheat_manager_apply_retro_cheats(void) val = val | (((value_to_set>>bitpos)&0x01)< cheat_manager_state.num_matches-1) return; - if (!curr) + if (cheat_manager_state.num_memory_buffers == 0) return; cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits); @@ -1392,12 +1519,14 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig for (idx = start_idx; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { + offset = translate_address(idx, &curr) ; + switch (bytes_per_item ) { case 2 : curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256) + *(curr+idx+1) : - *(curr+idx) + (*(curr+idx+1)*256); + (*(curr+idx-offset)*256) + *(curr+idx+1-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256); if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256) + *(prev+idx+1) : @@ -1405,8 +1534,8 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig break; case 4 : curr_val = cheat_manager_state.big_endian ? - (*(curr+idx)*256*256*256) + (*(curr+idx+1)*256*256) + (*(curr+idx+2)*256) + *(curr+idx+3) : - *(curr+idx) + (*(curr+idx+1)*256) + (*(curr+idx+2)*256*256) + (*(curr+idx+3)*256*256*256); + (*(curr+idx-offset)*256*256*256) + (*(curr+idx+1-offset)*256*256) + (*(curr+idx+2-offset)*256) + *(curr+idx+3-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256) + (*(curr+idx+2-offset)*256*256) + (*(curr+idx+3-offset)*256*256*256); if (prev != NULL) prev_val = cheat_manager_state.big_endian ? (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : @@ -1414,7 +1543,7 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig break; case 1 : default : - curr_val = *(curr+idx); + curr_val = *(curr+idx-offset); if (prev != NULL) prev_val = *(prev+idx); break; diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index 1e0737bcbc..e941036a07 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -159,10 +159,12 @@ struct cheat_manager unsigned size; unsigned buf_size; unsigned total_memory_size ; - unsigned actual_memory_size ; uint8_t *curr_memory_buf ; uint8_t *prev_memory_buf ; uint8_t *matches ; + uint8_t **memory_buf_list ; + unsigned *memory_size_list ; + unsigned num_memory_buffers ; struct item_cheat working_cheat; unsigned match_idx ; unsigned match_action ; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index adb2d3d375..113e3495c9 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5367,7 +5367,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY); if ( setting ) - setting->max = cheat_manager_state.actual_memory_size>0?cheat_manager_state.actual_memory_size-1:0 ; + setting->max = cheat_manager_state.total_memory_size>0?cheat_manager_state.total_memory_size-1:0 ; menu_displaylist_parse_settings_enum(menu, info, @@ -5571,7 +5571,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) setting->max = cheat_manager_state.num_matches-1; setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY); if (setting) - setting->max = cheat_manager_state.actual_memory_size>0?cheat_manager_state.actual_memory_size-1:0 ; + setting->max = cheat_manager_state.total_memory_size>0?cheat_manager_state.total_memory_size-1:0 ; info->need_refresh = true; info->need_push = true; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 5431fa6df6..5ac6ca9464 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4985,7 +4985,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - menu_settings_list_current_add_range(list, list_info, 0, cheat_manager_state.actual_memory_size>0?cheat_manager_state.actual_memory_size-1:0, 1, true, true); + menu_settings_list_current_add_range(list, list_info, 0, cheat_manager_state.total_memory_size>0?cheat_manager_state.total_memory_size-1:0, 1, true, true); (*list)[list_info->index - 1].action_left = &setting_uint_action_left_with_refresh; (*list)[list_info->index - 1].action_right = &setting_uint_action_right_with_refresh; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_uint_cheat_browse_address; From 9e2d688e1dc056c61f420b7b393e9056a9bc1a08 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Oct 2018 01:26:54 +0200 Subject: [PATCH 0360/1292] Get rid of video_context_driver_get_context_data --- gfx/drivers/vulkan.c | 19 +++++++++---------- gfx/video_driver.c | 15 ++------------- gfx/video_driver.h | 2 -- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 859b37a2b6..3ac5d1fc12 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1136,24 +1136,23 @@ static void *vulkan_init(const video_info_t *video, vk_t *vk = (vk_t*)calloc(1, sizeof(*vk)); if (!vk) return NULL; - - vk->video = *video; - - ctx_driver = vulkan_get_context(vk); + ctx_driver = vulkan_get_context(vk); if (!ctx_driver) { RARCH_ERR("[Vulkan]: Failed to get Vulkan context.\n"); goto error; } - vk->ctx_driver = ctx_driver; + vk->video = *video; + vk->ctx_driver = ctx_driver; + video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); video_context_driver_get_video_size(&mode); - full_x = mode.width; - full_y = mode.height; - mode.width = 0; - mode.height = 0; + full_x = mode.width; + full_y = mode.height; + mode.width = 0; + mode.height = 0; RARCH_LOG("[Vulkan]: Detecting screen resolution %ux%u.\n", full_x, full_y); interval = video->vsync ? video->swap_interval : 0; @@ -1188,7 +1187,7 @@ static void *vulkan_init(const video_info_t *video, RARCH_LOG("[Vulkan]: Using resolution %ux%u\n", temp_width, temp_height); - video_context_driver_get_context_data(&vk->context); + *(void**)&vk->context = vk->ctx_driver->get_context_data(vk->ctx_data); vk->vsync = video->vsync; vk->fullscreen = video->fullscreen; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index cf5211f338..358737a0bf 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3273,15 +3273,6 @@ bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info) return true; } -bool video_context_driver_get_context_data(void *data) -{ - if (!current_video_context.get_context_data) - return false; - *(void**)data = current_video_context.get_context_data( - video_context_data); - return true; -} - bool video_context_driver_show_mouse(bool *bool_data) { if (!current_video_context.show_mouse) @@ -3384,15 +3375,13 @@ enum gfx_ctx_api video_context_driver_get_api(void) bool video_driver_has_windowed(void) { -#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) - return false; -#else +#if !(defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)) if (video_driver_data && current_video->has_windowed) return current_video->has_windowed(video_driver_data); else if (video_context_data && current_video_context.has_windowed) return current_video_context.has_windowed(video_context_data); - return false; #endif + return false; } bool video_driver_cached_frame_has_valid_framebuffer(void) diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 013df5745a..167b8687b4 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1181,8 +1181,6 @@ bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info); bool video_context_driver_get_refresh_rate(float *refresh_rate); -bool video_context_driver_get_context_data(void *data); - bool video_context_driver_show_mouse(bool *bool_data); bool video_context_driver_set_flags(gfx_ctx_flags_t *flags); From 9f74b05b13eb9875d9d7df55e533f45ed79a831d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Oct 2018 03:38:15 +0200 Subject: [PATCH 0361/1292] Add HAVE_QT ifdefs --- ui/drivers/ui_cocoa.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index 1e86b64667..c2d640fe5f 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -418,16 +418,29 @@ static char** waiting_argv; { int ret; unsigned sleep_ms = 0; +#ifdef HAVE_QT + const ui_application_t *application = ui_application_qt.process_events(); +#else const ui_application_t *application = ui_companion_driver_get_application_ptr(); +#endif if (application) application->process_events(); + ret = runloop_iterate(&sleep_ms); + if (ret == 1 && sleep_ms > 0) retro_sleep(sleep_ms); + task_queue_check(); + while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource); if (ret == -1) + { +#ifdef HAVE_QT + ui_application_qt.quit(); +#endif break; + } }while(1); main_exit(NULL); From 7717631909cf5195b747603165d9e5824de3f7ad Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Oct 2018 03:38:43 +0200 Subject: [PATCH 0362/1292] Buildfix --- ui/drivers/ui_cocoa.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index c2d640fe5f..33d1852c96 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -419,7 +419,7 @@ static char** waiting_argv; int ret; unsigned sleep_ms = 0; #ifdef HAVE_QT - const ui_application_t *application = ui_application_qt.process_events(); + const ui_application_t *application = &ui_application_qt; #else const ui_application_t *application = ui_companion_driver_get_application_ptr(); #endif From 9e90316da9a73d7682e12f3b9f22a1bedfef4a96 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Oct 2018 04:01:11 +0200 Subject: [PATCH 0363/1292] CXX_BUILD fixes --- managers/cheat_manager.c | 331 ++++++++++++++++++--------------------- 1 file changed, 152 insertions(+), 179 deletions(-) diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index de8892c30d..f0ce7643b4 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -127,30 +127,30 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw unsigned i; char buf[PATH_MAX_LENGTH]; char cheats_file[PATH_MAX_LENGTH]; - config_file_t *conf = NULL; + config_file_t *conf = NULL; unsigned int* data_ptrs[16] = { NULL}; - char* keys[16] = { - "cheat%u_handler", - "cheat%u_memory_search_size", - "cheat%u_cheat_type", - "cheat%u_value", - "cheat%u_address", - "cheat%u_address_bit_position", - "cheat%u_rumble_type", - "cheat%u_rumble_value", - "cheat%u_rumble_port", - "cheat%u_rumble_primary_strength", - "cheat%u_rumble_primary_duration", - "cheat%u_rumble_secondary_strength", - "cheat%u_rumble_secondary_duration", - "cheat%u_repeat_count", - "cheat%u_repeat_add_to_value", - "cheat%u_repeat_add_to_address", + char* keys[16] = { + (char*)"cheat%u_handler", + (char*)"cheat%u_memory_search_size", + (char*)"cheat%u_cheat_type", + (char*)"cheat%u_value", + (char*)"cheat%u_address", + (char*)"cheat%u_address_bit_position", + (char*)"cheat%u_rumble_type", + (char*)"cheat%u_rumble_value", + (char*)"cheat%u_rumble_port", + (char*)"cheat%u_rumble_primary_strength", + (char*)"cheat%u_rumble_primary_duration", + (char*)"cheat%u_rumble_secondary_strength", + (char*)"cheat%u_rumble_secondary_duration", + (char*)"cheat%u_repeat_count", + (char*)"cheat%u_repeat_add_to_value", + (char*)"cheat%u_repeat_add_to_address" }; buf[0] = cheats_file[0] = '\0'; - if ( (!cheat_manager_state.cheats) || cheat_manager_state.size==0 ) + if ((!cheat_manager_state.cheats) || cheat_manager_state.size==0) return false; if (!cheat_database) @@ -161,7 +161,7 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw fill_pathname_noext(cheats_file, buf, ".cht", sizeof(cheats_file)); } - if ( !overwrite ) + if (!overwrite) conf = config_file_new(cheats_file); else conf = config_file_new(NULL); @@ -235,18 +235,16 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw bool cheat_manager_copy_idx_to_working(unsigned idx) { - if ( (!cheat_manager_state.cheats) || (cheat_manager_state.size < idx+1)) - { + if ((!cheat_manager_state.cheats) || (cheat_manager_state.size < idx+1)) return false; - } memcpy(&(cheat_manager_state.working_cheat), &(cheat_manager_state.cheats[idx]), sizeof(struct item_cheat)); - if ( cheat_manager_state.cheats[idx].desc != NULL ) + if (cheat_manager_state.cheats[idx].desc) strlcpy(cheat_manager_state.working_desc, cheat_manager_state.cheats[idx].desc, CHEAT_DESC_SCRATCH_SIZE); else cheat_manager_state.working_desc[0] = '\0'; - if ( cheat_manager_state.cheats[idx].code != NULL ) + if (cheat_manager_state.cheats[idx].code) strlcpy(cheat_manager_state.working_code, cheat_manager_state.cheats[idx].code, CHEAT_CODE_SCRATCH_SIZE); else cheat_manager_state.working_code[0] = '\0'; @@ -255,16 +253,16 @@ bool cheat_manager_copy_idx_to_working(unsigned idx) } bool cheat_manager_copy_working_to_idx(unsigned idx) { - if ( (!cheat_manager_state.cheats) || (cheat_manager_state.size < idx+1)) + if ((!cheat_manager_state.cheats) || (cheat_manager_state.size < idx+1)) return false; memcpy(&(cheat_manager_state.cheats[idx]), &(cheat_manager_state.working_cheat), sizeof(struct item_cheat)); - if ( cheat_manager_state.cheats[idx].desc != NULL ) + if (cheat_manager_state.cheats[idx].desc) free(cheat_manager_state.cheats[idx].desc); cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc); - if ( cheat_manager_state.cheats[idx].code != NULL ) + if (cheat_manager_state.cheats[idx].code) free(cheat_manager_state.cheats[idx].code); cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code); @@ -418,13 +416,11 @@ bool cheat_manager_load(const char *path, bool append) cheat_manager_alloc_if_empty(); - if ( append ) + if (append) { orig_size = cheat_manager_get_size(); - if ( orig_size == 0) - { + if (orig_size == 0) cheat_manager_new(cheats); - } else { cheats = cheats + orig_size; @@ -485,9 +481,9 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) /* if size is decreasing, free the items that will be lost */ for (i = new_size; i < orig_size; i++) { - if ( cheat_manager_state.cheats[i].code != NULL ) + if (cheat_manager_state.cheats[i].code) free(cheat_manager_state.cheats[i].code); - if ( cheat_manager_state.cheats[i].desc != NULL ) + if (cheat_manager_state.cheats[i].desc) free(cheat_manager_state.cheats[i].desc); } @@ -529,25 +525,25 @@ void cheat_manager_free(void) { for (i = 0; i < cheat_manager_state.size; i++) { - if ( cheat_manager_state.cheats[i].desc != NULL ) + if (cheat_manager_state.cheats[i].desc) free(cheat_manager_state.cheats[i].desc); - if ( cheat_manager_state.cheats[i].code != NULL ) + if (cheat_manager_state.cheats[i].code) free(cheat_manager_state.cheats[i].code); } free(cheat_manager_state.cheats); } - if ( cheat_manager_state.prev_memory_buf ) + if (cheat_manager_state.prev_memory_buf) free(cheat_manager_state.prev_memory_buf); - if ( cheat_manager_state.matches ) + if (cheat_manager_state.matches) free(cheat_manager_state.matches); - if ( cheat_manager_state.memory_buf_list ) + if (cheat_manager_state.memory_buf_list) free(cheat_manager_state.memory_buf_list); - if ( cheat_manager_state.memory_size_list ) + if (cheat_manager_state.memory_size_list) free(cheat_manager_state.memory_size_list); cheat_manager_state.cheats = NULL; @@ -576,7 +572,7 @@ void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx) handle_idx, handle->cheats[handle_idx].state ? "ON" : "OFF", (handle->cheats[handle_idx].desc!=NULL) ? (handle->cheats[handle_idx].desc) : (handle->cheats[handle_idx].code) - ); + ); runloop_msg_queue_push(msg, 1, 180, true); RARCH_LOG("%s\n", msg); } @@ -584,7 +580,7 @@ void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx) void cheat_manager_toggle_index(unsigned i) { settings_t *settings = config_get_ptr(); - if (!cheat_manager_state.cheats || cheat_manager_state.size == 0 ) + if (!cheat_manager_state.cheats || cheat_manager_state.size == 0) return; cheat_manager_state.cheats[i].state = !cheat_manager_state.cheats[i].state; @@ -662,14 +658,15 @@ bool cheat_manager_get_game_specific_filename(char * cheat_filename, size_t max_ if (!settings || !global || !cheat_filename) return false; - if ( !core_get_system_info(&system_info) ) + if (!core_get_system_info(&system_info)) return false; core_name = system_info.library_name; game_name = path_basename(global->name.cheatfile); - if ( string_is_empty(settings->paths.path_cheat_database) || - string_is_empty(core_name) || string_is_empty(game_name) ) + if (string_is_empty(settings->paths.path_cheat_database) || + string_is_empty(core_name) || + string_is_empty(game_name)) return false; cheat_filename[0] = '\0'; @@ -690,7 +687,7 @@ void cheat_manager_load_game_specific_cheats() { char cheat_file[PATH_MAX_LENGTH]; - if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) + if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH)) cheat_manager_load(cheat_file,true); } @@ -698,7 +695,7 @@ void cheat_manager_save_game_specific_cheats() { char cheat_file[PATH_MAX_LENGTH]; - if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH) ) + if (cheat_manager_get_game_specific_filename(cheat_file, PATH_MAX_LENGTH)) cheat_manager_save(cheat_file, NULL, true); } @@ -718,25 +715,27 @@ bool cheat_manager_alloc_if_empty(void) int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) { + int i; retro_ctx_memory_info_t meminfo; - bool refresh = false; - bool is_search_initialization = (setting != NULL); - rarch_system_info_t *system = runloop_get_system_info(); - int i ; - unsigned offset = 0; + bool refresh = false; + bool is_search_initialization = (setting != NULL); + rarch_system_info_t *system = runloop_get_system_info(); + unsigned offset = 0; - cheat_manager_state.num_memory_buffers = 0 ; - cheat_manager_state.total_memory_size = 0 ; - cheat_manager_state.curr_memory_buf = NULL ; - if (cheat_manager_state.memory_buf_list != NULL) + cheat_manager_state.num_memory_buffers = 0; + cheat_manager_state.total_memory_size = 0; + cheat_manager_state.curr_memory_buf = NULL; + + if (cheat_manager_state.memory_buf_list) { - free(cheat_manager_state.memory_buf_list) ; - cheat_manager_state.memory_buf_list = NULL ; + free(cheat_manager_state.memory_buf_list); + cheat_manager_state.memory_buf_list = NULL; } - if (cheat_manager_state.memory_size_list != NULL) + + if (cheat_manager_state.memory_size_list) { - free(cheat_manager_state.memory_size_list) ; - cheat_manager_state.memory_size_list = NULL ; + free(cheat_manager_state.memory_size_list); + cheat_manager_state.memory_size_list = NULL; } if (system && system->mmaps.num_descriptors > 0) @@ -744,27 +743,27 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) for (i = 0; i < system->mmaps.num_descriptors; i++) { if ((system->mmaps.descriptors[i].core.flags & RETRO_MEMDESC_SYSTEM_RAM) != 0 && - system->mmaps.descriptors[i].core.ptr != NULL && + system->mmaps.descriptors[i].core.ptr && system->mmaps.descriptors[i].core.len > 0) { - cheat_manager_state.num_memory_buffers++ ; + cheat_manager_state.num_memory_buffers++; - if (cheat_manager_state.memory_buf_list == NULL) - cheat_manager_state.memory_buf_list = calloc(1, sizeof(uint8_t *)); + if (!cheat_manager_state.memory_buf_list) + cheat_manager_state.memory_buf_list = (uint8_t**)calloc(1, sizeof(uint8_t *)); else - cheat_manager_state.memory_buf_list = realloc(cheat_manager_state.memory_buf_list, sizeof(uint8_t *)*cheat_manager_state.num_memory_buffers); + cheat_manager_state.memory_buf_list = (uint8_t**)realloc(cheat_manager_state.memory_buf_list, sizeof(uint8_t *) * cheat_manager_state.num_memory_buffers); - if (cheat_manager_state.memory_size_list == NULL) - cheat_manager_state.memory_size_list = calloc(1, sizeof(unsigned)); + if (!cheat_manager_state.memory_size_list) + cheat_manager_state.memory_size_list = (unsigned*)calloc(1, sizeof(unsigned)); else - cheat_manager_state.memory_size_list = realloc(cheat_manager_state.memory_size_list, sizeof(unsigned)*cheat_manager_state.num_memory_buffers); + cheat_manager_state.memory_size_list = (unsigned*)realloc(cheat_manager_state.memory_size_list, sizeof(unsigned) * cheat_manager_state.num_memory_buffers); - cheat_manager_state.memory_buf_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.ptr ; - cheat_manager_state.memory_size_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.len ; - cheat_manager_state.total_memory_size += system->mmaps.descriptors[i].core.len ; + cheat_manager_state.memory_buf_list[cheat_manager_state.num_memory_buffers-1] = (uint8_t*)system->mmaps.descriptors[i].core.ptr; + cheat_manager_state.memory_size_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.len; + cheat_manager_state.total_memory_size += system->mmaps.descriptors[i].core.len; - if (cheat_manager_state.curr_memory_buf == NULL) - cheat_manager_state.curr_memory_buf = system->mmaps.descriptors[i].core.ptr; + if (!cheat_manager_state.curr_memory_buf) + cheat_manager_state.curr_memory_buf = (uint8_t*)system->mmaps.descriptors[i].core.ptr; } } } @@ -781,13 +780,15 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) if (meminfo.size == 0) return 0; - cheat_manager_state.memory_buf_list = calloc(1, sizeof(uint8_t *)); - cheat_manager_state.memory_size_list = calloc(1, sizeof(unsigned)); - cheat_manager_state.num_memory_buffers = 1 ; - cheat_manager_state.memory_buf_list[0] = meminfo.data ; - cheat_manager_state.memory_size_list[0] = (unsigned)meminfo.size ; - cheat_manager_state.total_memory_size = (unsigned)meminfo.size; - cheat_manager_state.curr_memory_buf = meminfo.data; + cheat_manager_state.memory_buf_list = (uint8_t**) + calloc(1, sizeof(uint8_t *)); + cheat_manager_state.memory_size_list = (unsigned*) + calloc(1, sizeof(unsigned)); + cheat_manager_state.num_memory_buffers = 1; + cheat_manager_state.memory_buf_list[0] = (uint8_t*)meminfo.data; + cheat_manager_state.memory_size_list[0] = (unsigned)meminfo.size; + cheat_manager_state.total_memory_size = (unsigned)meminfo.size; + cheat_manager_state.curr_memory_buf = (uint8_t*)meminfo.data; } @@ -801,10 +802,10 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) if (is_search_initialization) { - if (cheat_manager_state.prev_memory_buf != NULL) + if (cheat_manager_state.prev_memory_buf) { free(cheat_manager_state.prev_memory_buf); - cheat_manager_state.prev_memory_buf = NULL ; + cheat_manager_state.prev_memory_buf = NULL; } cheat_manager_state.prev_memory_buf = (uint8_t*) calloc(cheat_manager_state.total_memory_size, sizeof(uint8_t)); @@ -814,10 +815,10 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) return 0; } - if (cheat_manager_state.matches != NULL) + if (cheat_manager_state.matches) { free(cheat_manager_state.matches); - cheat_manager_state.matches = NULL ; + cheat_manager_state.matches = NULL; } cheat_manager_state.matches = (uint8_t*) calloc(cheat_manager_state.total_memory_size, sizeof(uint8_t)); @@ -831,12 +832,12 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) memset(cheat_manager_state.matches, 0xFF, cheat_manager_state.total_memory_size); - offset = 0 ; + offset = 0; - for ( i = 0 ; i < cheat_manager_state.num_memory_buffers ; i++) + for (i = 0; i < cheat_manager_state.num_memory_buffers; i++) { memcpy(cheat_manager_state.prev_memory_buf+offset, cheat_manager_state.memory_buf_list[i], cheat_manager_state.memory_size_list[i]); - offset += cheat_manager_state.memory_size_list[i] ; + offset += cheat_manager_state.memory_size_list[i]; } cheat_manager_state.memory_search_initialized = true; @@ -860,21 +861,21 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) static unsigned translate_address(unsigned address, unsigned char **curr) { - unsigned offset = 0 ; - unsigned i = 0 ; + unsigned offset = 0; + unsigned i = 0; - for (i = 0 ; i < cheat_manager_state.num_memory_buffers ; i++ ) + for (i = 0; i < cheat_manager_state.num_memory_buffers; i++) { - if ( (address >= offset) && (address < offset+cheat_manager_state.memory_size_list[i]) ) + if ((address >= offset) && (address < offset+cheat_manager_state.memory_size_list[i])) { - *curr = cheat_manager_state.memory_buf_list[i] ; - break ; + *curr = cheat_manager_state.memory_buf_list[i]; + break; } else - offset += cheat_manager_state.memory_size_list[i] ; + offset += cheat_manager_state.memory_size_list[i]; } - return offset ; + return offset; } static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int *bytes_per_item, unsigned int *mask, unsigned int *bits) @@ -882,47 +883,35 @@ static void cheat_manager_setup_search_meta(unsigned int bitsize, unsigned int * switch( bitsize) { case 0 : - { *bytes_per_item = 1; *bits = 1; *mask = 0x01; break; - } case 1 : - { *bytes_per_item = 1; *bits = 2; *mask = 0x03; break; - } case 2 : - { *bytes_per_item = 1; *bits = 4; *mask = 0x0F; break; - } case 3 : - { *bytes_per_item = 1; *bits = 8; *mask = 0xFF; break; - } case 4 : - { *bytes_per_item = 2; *bits = 8; *mask = 0xFFFF; break; - } case 5 : - { *bytes_per_item = 4; *bits = 8; *mask = 0xFFFFFFFF; break; - } } } @@ -992,12 +981,11 @@ int cheat_manager_search(enum cheat_search_type search_type) { unsigned byte_part; - offset = translate_address(idx, &curr) ; + offset = translate_address(idx, &curr); switch (bytes_per_item) { case 2 : - { curr_val = cheat_manager_state.big_endian ? (*(curr+idx-offset)*256) + *(curr+idx+1-offset) : *(curr+idx-offset) + (*(curr+idx+1-offset)*256); @@ -1005,9 +993,7 @@ int cheat_manager_search(enum cheat_search_type search_type) (*(prev+idx)*256) + *(prev+idx+1) : *(prev+idx) + (*(prev+idx+1)*256); break; - } case 4 : - { curr_val = cheat_manager_state.big_endian ? (*(curr+idx-offset)*256*256*256) + (*(curr+idx+1-offset)*256*256) + (*(curr+idx+2-offset)*256) + *(curr+idx+3-offset) : *(curr+idx-offset) + (*(curr+idx+1-offset)*256) + (*(curr+idx+2-offset)*256*256) + (*(curr+idx+3-offset)*256*256*256); @@ -1015,23 +1001,20 @@ int cheat_manager_search(enum cheat_search_type search_type) (*(prev+idx)*256*256*256) + (*(prev+idx+1)*256*256) + (*(prev+idx+2)*256) + *(prev+idx+3) : *(prev+idx) + (*(prev+idx+1)*256) + (*(prev+idx+2)*256*256) + (*(prev+idx+3)*256*256*256); break; - } case 1 : default : - { curr_val = *(curr-offset+idx); prev_val = *(prev+idx); break; - } } for (byte_part = 0; byte_part < 8/bits; byte_part++) { - unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask; - unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask; + unsigned int curr_subval = (curr_val >> (byte_part*bits)) & mask; + unsigned int prev_subval = (prev_val >> (byte_part*bits)) & mask; unsigned int prev_match; - if (bits < 8 ) + if (bits < 8) prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); else prev_match = *(cheat_manager_state.matches+idx); @@ -1042,53 +1025,53 @@ int cheat_manager_search(enum cheat_search_type search_type) switch (search_type) { case CHEAT_SEARCH_TYPE_EXACT : - match = ( curr_subval == cheat_manager_state.search_exact_value); + match = (curr_subval == cheat_manager_state.search_exact_value); break; case CHEAT_SEARCH_TYPE_LT : - match = ( curr_subval < prev_subval); + match = (curr_subval < prev_subval); break; case CHEAT_SEARCH_TYPE_GT : - match = ( curr_subval > prev_subval); + match = (curr_subval > prev_subval); break; case CHEAT_SEARCH_TYPE_LTE : - match = ( curr_subval <= prev_subval); + match = (curr_subval <= prev_subval); break; case CHEAT_SEARCH_TYPE_GTE : - match = ( curr_subval >= prev_subval); + match = (curr_subval >= prev_subval); break; case CHEAT_SEARCH_TYPE_EQ : - match = ( curr_subval == prev_subval); + match = (curr_subval == prev_subval); break; case CHEAT_SEARCH_TYPE_NEQ : - match = ( curr_subval != prev_subval); + match = (curr_subval != prev_subval); break; case CHEAT_SEARCH_TYPE_EQPLUS : - match = ( curr_subval == prev_subval+cheat_manager_state.search_eqplus_value); + match = (curr_subval == prev_subval+cheat_manager_state.search_eqplus_value); break; case CHEAT_SEARCH_TYPE_EQMINUS : - match = ( curr_subval == prev_subval-cheat_manager_state.search_eqminus_value); + match = (curr_subval == prev_subval-cheat_manager_state.search_eqminus_value); break; } - if (!match ) + if (!match) { - if ( bits < 8 ) + if (bits < 8) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & - (( ~(mask << (byte_part*bits))) & 0xFF ); + (( ~(mask << (byte_part*bits))) & 0xFF); else memset(cheat_manager_state.matches+idx,0,bytes_per_item); - if ( cheat_manager_state.num_matches > 0 ) + if (cheat_manager_state.num_matches > 0) cheat_manager_state.num_matches--; } } } } - offset = 0 ; + offset = 0; - for ( i = 0 ; i < cheat_manager_state.num_memory_buffers ; i++) + for (i = 0; i < cheat_manager_state.num_memory_buffers; i++) { memcpy(cheat_manager_state.prev_memory_buf+offset, cheat_manager_state.memory_buf_list[i], cheat_manager_state.memory_size_list[i]); - offset += cheat_manager_state.memory_size_list[i] ; + offset += cheat_manager_state.memory_size_list[i]; } snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_SEARCH_FOUND_MATCHES), cheat_manager_state.num_matches); @@ -1108,7 +1091,7 @@ bool cheat_manager_add_new_code(unsigned int memory_search_size, unsigned int ad { int new_size = cheat_manager_get_size() + 1; - if ( !cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO) ) + if (!cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO)) return false; cheat_manager_state.cheats[cheat_manager_state.size-1].address = address; @@ -1135,7 +1118,7 @@ int cheat_manager_add_matches(const char *path, unsigned int i = 0; unsigned char *curr = cheat_manager_state.curr_memory_buf; - if ( cheat_manager_state.num_matches + cheat_manager_state.size > 100 ) + if (cheat_manager_state.num_matches + cheat_manager_state.size > 100) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY), 1, 180, true); return 0; @@ -1144,9 +1127,9 @@ int cheat_manager_add_matches(const char *path, for (idx = 0; idx < cheat_manager_state.total_memory_size; idx = idx + bytes_per_item) { - offset = translate_address(idx, &curr) ; + offset = translate_address(idx, &curr); - switch ( bytes_per_item ) + switch (bytes_per_item) { case 2 : curr_val = cheat_manager_state.big_endian ? @@ -1167,13 +1150,13 @@ int cheat_manager_add_matches(const char *path, { unsigned int prev_match; - if (bits < 8 ) + if (bits < 8) { prev_match = *(cheat_manager_state.matches+idx) & (mask << (byte_part*bits)); if (prev_match) { if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)), - cheat_manager_state.big_endian, curr_val) ) + cheat_manager_state.big_endian, curr_val)) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL), 1, 180, true); return 0; @@ -1272,7 +1255,7 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu return; } - if (cheat->rumble_primary_end_time <= cpu_features_get_time_usec() ) + if (cheat->rumble_primary_end_time <= cpu_features_get_time_usec()) { if (cheat->rumble_primary_end_time != 0) input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_STRONG, 0); @@ -1290,9 +1273,7 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu cheat->rumble_secondary_end_time = 0; } else - { input_driver_set_rumble_state(cheat->rumble_port, RETRO_RUMBLE_WEAK, cheat->rumble_secondary_strength); - } } void cheat_manager_apply_retro_cheats(void) @@ -1308,7 +1289,7 @@ void cheat_manager_apply_retro_cheats(void) if ((!cheat_manager_state.cheats)) return; - for (i = 0; i < cheat_manager_state.size; i++ ) + for (i = 0; i < cheat_manager_state.size; i++) { unsigned char *curr; unsigned int idx; @@ -1337,35 +1318,29 @@ void cheat_manager_apply_retro_cheats(void) curr = cheat_manager_state.curr_memory_buf; idx = cheat_manager_state.cheats[i].address; - offset = translate_address(idx, &curr) ; + offset = translate_address(idx, &curr); switch (bytes_per_item) { case 2 : - { curr_val = cheat_manager_state.big_endian ? - (*(curr+idx-offset)*256) + *(curr+idx+1-offset) : - *(curr+idx-offset) + (*(curr+idx+1-offset)*256); + (*(curr+idx-offset)*256) + *(curr+idx+1-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256); break; - } case 4 : - { curr_val = cheat_manager_state.big_endian ? - (*(curr+idx-offset)*256*256*256) + (*(curr+idx+1-offset)*256*256) + (*(curr+idx+2-offset)*256) + *(curr+idx+3-offset) : - *(curr+idx-offset) + (*(curr+idx+1-offset)*256) + (*(curr+idx+2-offset)*256*256) + (*(curr+idx+3-offset)*256*256*256); + (*(curr+idx-offset)*256*256*256) + (*(curr+idx+1-offset)*256*256) + (*(curr+idx+2-offset)*256) + *(curr+idx+3-offset) : + *(curr+idx-offset) + (*(curr+idx+1-offset)*256) + (*(curr+idx+2-offset)*256*256) + (*(curr+idx+3-offset)*256*256*256); break; - } case 1 : default : - { curr_val = *(curr+idx-offset); break; - } } cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val); - switch (cheat_manager_state.cheats[i].cheat_type ) + switch (cheat_manager_state.cheats[i].cheat_type) { case CHEAT_TYPE_SET_TO_VALUE : set_value = true; @@ -1384,7 +1359,7 @@ void cheat_manager_apply_retro_cheats(void) run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_NEQ: - if (!(curr_val != cheat_manager_state.cheats[i].value )) + if (!(curr_val != cheat_manager_state.cheats[i].value)) run_cheat = false; break; case CHEAT_TYPE_RUN_NEXT_IF_LT: @@ -1399,7 +1374,7 @@ void cheat_manager_apply_retro_cheats(void) } if (set_value) { - for ( repeat_iter = 1; repeat_iter <= cheat_manager_state.cheats[i].repeat_count; repeat_iter++) + for (repeat_iter = 1; repeat_iter <= cheat_manager_state.cheats[i].repeat_count; repeat_iter++) { switch (bytes_per_item) { @@ -1441,7 +1416,7 @@ void cheat_manager_apply_retro_cheats(void) for (bitpos = 0; bitpos < 8; bitpos++) { - if ((address_mask>>bitpos)&0x01 ) + if ((address_mask>>bitpos)&0x01) { mask = (~(1< 0 ) + if (cheat_manager_state.num_matches > 0) cheat_manager_state.num_matches--; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); return; @@ -1621,19 +1594,19 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig *prev_value = prev_val; return; case CHEAT_MATCH_ACTION_TYPE_COPY : - if ( !cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, - cheat_manager_state.big_endian, curr_val) ) + if (!cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF, + cheat_manager_state.big_endian, curr_val)) runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true); else runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true); return; case CHEAT_MATCH_ACTION_TYPE_DELETE : - if ( bits < 8 ) + if (bits < 8) *(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) & - (( ~(mask << (byte_part*bits))) & 0xFF ); + (( ~(mask << (byte_part*bits))) & 0xFF); else memset(cheat_manager_state.matches+idx,0,bytes_per_item); - if ( cheat_manager_state.num_matches > 0 ) + if (cheat_manager_state.num_matches > 0) cheat_manager_state.num_matches--; runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true); return; From 778c3fff73bb221f2f98c662d981cce785fc862a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 15 Oct 2018 06:47:18 +0200 Subject: [PATCH 0364/1292] (GL) Use shader_driver directly --- gfx/drivers/gl.c | 33 +++++++++++++++++++-------------- gfx/video_driver.c | 2 +- gfx/video_driver.h | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index f447f2bb1b..f9b93604fd 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -214,8 +214,9 @@ static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info) glViewport(0, 0, width, height); /* Ensure that we reset the attrib array. */ - video_info->cb_shader_use(gl, - video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true); + if (video_info->shader_driver && video_info->shader_driver->use) + video_info->shader_driver->use(gl, + video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true); gl->coords.vertex = gl->overlay_vertex_coord; gl->coords.tex_coord = gl->overlay_tex_coord; @@ -584,19 +585,17 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video) static INLINE void gl_set_shader_viewports(gl_t *gl) { unsigned i, width, height; - video_shader_ctx_info_t shader_info; video_frame_info_t video_info; video_driver_build_info(&video_info); video_driver_get_size(&width, &height); - shader_info.data = gl; - shader_info.set_active = true; - for (i = 0; i < 2; i++) { - shader_info.idx = i; - video_shader_driver_use(&shader_info); + if (video_info.shader_driver && video_info.shader_driver->use) + video_info.shader_driver->use(gl, + video_info.shader_data, i, true); + gl_set_viewport(gl, &video_info, width, height, false, true); } @@ -781,8 +780,9 @@ static void gl_render_osd_background( video_driver_set_viewport(video_info->width, video_info->height, true, false); - video_info->cb_shader_use(gl, - video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true); + if (video_info->shader_driver && video_info->shader_driver->use) + video_info->shader_driver->use(gl, + video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true); video_driver_set_coords(&coords_data); @@ -881,8 +881,9 @@ static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info) glBindTexture(GL_TEXTURE_2D, gl->menu_texture); - video_info->cb_shader_use(gl, - video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true); + if (video_info->shader_driver && video_info->shader_driver->use) + video_info->shader_driver->use(gl, + video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true); gl->coords.vertices = 4; @@ -967,7 +968,9 @@ static bool gl_frame(void *data, const void *frame, if (gl->core_context_in_use && gl->renderchain_driver->bind_vao) gl->renderchain_driver->bind_vao(gl, gl->renderchain_data); - video_info->cb_shader_use(gl, video_info->shader_data, 1, true); + if (video_info->shader_driver && video_info->shader_driver->use) + video_info->shader_driver->use(gl, + video_info->shader_data, 1, true); #ifdef IOS /* Apparently the viewport is lost each frame, thanks Apple. */ @@ -1168,7 +1171,9 @@ static bool gl_frame(void *data, const void *frame, /* Reset state which could easily mess up libretro core. */ if (gl->hw_render_fbo_init) { - video_info->cb_shader_use(gl, video_info->shader_data, 0, true); + if (video_info->shader_driver && video_info->shader_driver->use) + video_info->shader_driver->use(gl, + video_info->shader_data, 0, true); glBindTexture(GL_TEXTURE_2D, 0); if (gl->renderchain_driver->disable_client_arrays) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 358737a0bf..2651ddb797 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2824,6 +2824,7 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->input_driver_nonblock_state = input_driver_is_nonblock_state(); video_info->context_data = video_context_data; + video_info->shader_driver = current_shader; video_info->shader_data = current_shader_data; video_info->cb_update_window_title = current_video_context.update_window_title; @@ -2831,7 +2832,6 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->cb_get_metrics = current_video_context.get_metrics; video_info->cb_set_resize = current_video_context.set_resize; - video_info->cb_shader_use = video_driver_cb_shader_use; video_info->cb_set_mvp = video_driver_cb_shader_set_mvp; video_info->userdata = video_driver_get_ptr(false); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 167b8687b4..ee2a567501 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -493,13 +493,13 @@ typedef struct video_frame_info float *value); bool (*cb_set_resize)(void*, unsigned, unsigned); - void (*cb_shader_use)(void *data, void *shader_data, unsigned index, bool set_active); bool (*cb_set_mvp)(void *data, void *shader_data, const void *mat_data); void *context_data; void *shader_data; void *userdata; + const shader_backend_t *shader_driver; } video_frame_info_t; typedef void (*update_window_title_cb)(void*, void*); From 6338039ac0c469420ed9a25cc3cc980501cc2b22 Mon Sep 17 00:00:00 2001 From: Alfrix Date: Mon, 15 Oct 2018 22:32:03 -0300 Subject: [PATCH 0365/1292] Move Privacy settings to User --- menu/menu_displaylist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 113e3495c9..ec5511e554 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -6331,6 +6331,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) break; case DISPLAYLIST_USER_SETTINGS_LIST: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_PRIVACY_SETTINGS, + PARSE_ACTION, false); if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_ACCOUNTS_LIST, @@ -6952,8 +6955,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_USER_SETTINGS, PARSE_ACTION, false); ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_DIRECTORY_SETTINGS, PARSE_ACTION, false); - ret = menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_PRIVACY_SETTINGS, PARSE_ACTION, false); info->need_push = true; break; case DISPLAYLIST_HORIZONTAL: From a92a27a23018de9056b8aa85f23e984e71c78a74 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 16 Oct 2018 10:30:57 -0400 Subject: [PATCH 0366/1292] gdi: ignore menu_shader_pipeline setting --- gfx/drivers/gdi_gfx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index 9caa715d27..b2c438961b 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -199,8 +199,9 @@ static bool gdi_gfx_frame(void *data, const void *frame, HWND hwnd = win32_get_window(); BITMAPINFO *info; - /* FIXME */ + /* FIXME: Force these settings off as they interfere with the rendering */ video_info->xmb_shadows_enable = false; + video_info->menu_shader_pipeline = 0; if (!frame || !frame_width || !frame_height) return true; From d0e083ac1882487e6ac2cff15f7f2c6a2f3fcff7 Mon Sep 17 00:00:00 2001 From: Tatsuya79 Date: Tue, 16 Oct 2018 19:14:19 +0200 Subject: [PATCH 0367/1292] Menu driver fallback: don't change menu for null video driver --- configuration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configuration.c b/configuration.c index 817b792cae..b24f242133 100644 --- a/configuration.c +++ b/configuration.c @@ -2362,7 +2362,8 @@ static bool check_menu_driver_compatibility(void) char *menu_driver = settings->arrays.menu_driver; if (string_is_equal (menu_driver, "rgui") || - string_is_equal(menu_driver, "null")) + string_is_equal(menu_driver, "null") || + string_is_equal(video_driver, "null")) return true; /* TODO/FIXME - maintenance hazard */ From 3f41cd533b986b5e30ea8d49b72cf438f42b1039 Mon Sep 17 00:00:00 2001 From: Themaister Date: Tue, 16 Oct 2018 23:25:31 +0200 Subject: [PATCH 0368/1292] Fix RGUI regression on Vulkan. --- gfx/common/vulkan_common.h | 1 + gfx/drivers/vulkan.c | 42 ++++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 10d6a1b1ba..4e7e24c9b9 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -501,6 +501,7 @@ static INLINE unsigned vulkan_format_to_bpp(VkFormat format) return 4; case VK_FORMAT_R4G4B4A4_UNORM_PACK16: + case VK_FORMAT_B4G4R4A4_UNORM_PACK16: case VK_FORMAT_R5G6B5_UNORM_PACK16: return 2; diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 3ac5d1fc12..a65ee5e477 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1779,6 +1779,30 @@ static bool vulkan_frame(void *data, const void *frame, vulkan_filter_chain_build_offscreen_passes( (vulkan_filter_chain_t*)vk->filter_chain, vk->cmd, &vk->vk_vp); + +#if defined(HAVE_MENU) + /* Upload menu texture. */ + if (vk->menu.enable) + { + if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE || + vk->menu.textures[vk->menu.last_index].buffer != VK_NULL_HANDLE) + { + struct vk_texture *optimal = &vk->menu.textures_optimal[vk->menu.last_index]; + struct vk_texture *texture = &vk->menu.textures[vk->menu.last_index]; + + if (optimal->memory != VK_NULL_HANDLE) + { + if (vk->menu.dirty[vk->menu.last_index]) + { + vulkan_copy_staging_to_dynamic(vk, vk->cmd, + optimal, texture); + vk->menu.dirty[vk->menu.last_index] = false; + } + } + } + } +#endif + /* Render to backbuffer. */ if (chain->backbuffer.image != VK_NULL_HANDLE && vk->context->has_acquired_swapchain) { @@ -1813,7 +1837,8 @@ static bool vulkan_frame(void *data, const void *frame, { menu_driver_frame(video_info); - if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE) + if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE || + vk->menu.textures[vk->menu.last_index].buffer != VK_NULL_HANDLE) { struct vk_draw_quad quad; struct vk_texture *optimal = &vk->menu.textures_optimal[vk->menu.last_index]; @@ -1823,16 +1848,7 @@ static bool vulkan_frame(void *data, const void *frame, quad.texture = &vk->menu.textures[vk->menu.last_index]; if (optimal->memory != VK_NULL_HANDLE) - { - if (vk->menu.dirty[vk->menu.last_index]) - { - vulkan_copy_staging_to_dynamic(vk, vk->cmd, - optimal, - quad.texture); - vk->menu.dirty[vk->menu.last_index] = false; - } quad.texture = optimal; - } quad.sampler = optimal->mipmap ? vk->samplers.mipmap_linear : vk->samplers.linear; @@ -2197,9 +2213,6 @@ static void vulkan_set_texture_frame(void *data, for (y = 0; y < height; y++, dst += texture->stride, src += stride) memcpy(dst, src, stride); - vulkan_sync_texture_to_gpu(vk, texture); - vkUnmapMemory(vk->context->device, texture->memory); - vk->menu.alpha = alpha; vk->menu.last_index = index; @@ -2212,7 +2225,10 @@ static void vulkan_set_texture_frame(void *data, NULL, rgb32 ? NULL : &br_swizzle, VULKAN_TEXTURE_DYNAMIC); } + else + vulkan_sync_texture_to_gpu(vk, texture); + vkUnmapMemory(vk->context->device, texture->memory); vk->menu.dirty[index] = true; } From 927c65a1ba459c7999802e3fec74dc2e05df3394 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 17 Oct 2018 04:57:47 +0200 Subject: [PATCH 0369/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index b308524723..53985e0b4d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ - SCANNER: Fix GDI disc scanning. - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. +- VULKAN: Fix RGUI crashing at startup. - WIIU: Initial netplay peer-to-peer support. Network information working. # 1.7.5 From 131d77875e16d2c8f4bb6f208c7275f71cc0b48e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 05:33:22 +0200 Subject: [PATCH 0370/1292] Create menu_displaylist_setting --- menu/drivers/materialui.c | 30 +++++++++++++++--------------- menu/drivers/xmb.c | 38 +++++++++++++++++++------------------- menu/menu_displaylist.c | 27 ++++++++++++--------------- menu/menu_displaylist.h | 5 +++-- 4 files changed, 49 insertions(+), 51 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 5d09674ade..fc216530e9 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -2074,7 +2074,7 @@ static int materialui_list_push(void *data, void *userdata, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) { entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #ifndef HAVE_DYNAMIC @@ -2084,39 +2084,39 @@ static int materialui_list_push(void *data, void *userdata, if (settings->bools.menu_show_load_core) { entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } } if (system->load_no_content) { entry.enum_idx = MENU_ENUM_LABEL_START_CORE; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_load_content) { entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_content_show_history) { entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #if defined(HAVE_NETWORKING) #ifdef HAVE_LAKKA entry.enum_idx = MENU_ENUM_LABEL_UPDATE_LAKKA; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #else { settings_t *settings = config_get_ptr(); if (settings->bools.menu_show_online_updater) { entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } } #endif @@ -2124,44 +2124,44 @@ static int materialui_list_push(void *data, void *userdata, if (settings->bools.menu_content_show_netplay) { entry.enum_idx = MENU_ENUM_LABEL_NETPLAY; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #endif if (settings->bools.menu_show_information) { entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #ifndef HAVE_DYNAMIC entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #endif if (settings->bools.menu_show_configurations) { entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_help) { entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #if !defined(IOS) entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #endif #if defined(HAVE_LAKKA) if (settings->bools.menu_show_reboot) { entry.enum_idx = MENU_ENUM_LABEL_REBOOT; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_shutdown) { entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #endif info->need_push = true; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1f0b9a92d3..922d7ce607 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -5309,13 +5309,13 @@ static int xmb_list_push(void *data, void *userdata, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) { entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (system->load_no_content) { entry.enum_idx = MENU_ENUM_LABEL_START_CORE; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #ifndef HAVE_DYNAMIC @@ -5325,7 +5325,7 @@ static int xmb_list_push(void *data, void *userdata, if (settings->bools.menu_show_load_core) { entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } } @@ -5334,7 +5334,7 @@ static int xmb_list_push(void *data, void *userdata, const struct retro_subsystem_info* subsystem = NULL; entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); subsystem = system->subsystem.data; @@ -5390,85 +5390,85 @@ static int xmb_list_push(void *data, void *userdata, } entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #ifdef HAVE_QT if (settings->bools.desktop_menu_enable) { entry.enum_idx = MENU_ENUM_LABEL_SHOW_WIMP; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #endif #if defined(HAVE_NETWORKING) if (settings->bools.menu_show_online_updater && !settings->bools.kiosk_mode_enable) { entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #endif if (!settings->bools.menu_content_show_settings && !string_is_empty(settings->paths.menu_content_show_settings_password)) { entry.enum_idx = MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.kiosk_mode_enable && !string_is_empty(settings->paths.kiosk_mode_password)) { entry.enum_idx = MENU_ENUM_LABEL_MENU_DISABLE_KIOSK_MODE; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_information) { entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #ifdef HAVE_LAKKA_SWITCH entry.enum_idx = MENU_ENUM_LABEL_SWITCH_CPU_PROFILE; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); entry.enum_idx = MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #endif #ifndef HAVE_DYNAMIC entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #endif if (settings->bools.menu_show_configurations && !settings->bools.kiosk_mode_enable) { entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_help) { entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #if !defined(IOS) if (settings->bools.menu_show_quit_retroarch) { entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #endif if (settings->bools.menu_show_reboot) { entry.enum_idx = MENU_ENUM_LABEL_REBOOT; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_shutdown) { entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } info->need_push = true; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ec5511e554..c05df58676 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4254,7 +4254,18 @@ void menu_displaylist_info_init(menu_displaylist_info_t *info) info->setting = NULL; } -bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) +bool menu_displaylist_setting(menu_displaylist_ctx_parse_entry_t *entry) +{ + if (menu_displaylist_parse_settings_enum(entry->data, + entry->info, + entry->enum_idx, + entry->parse_type, + entry->add_empty_entry) == -1) + return false; + return true; +} + +bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist_info_t *info) { size_t i; menu_ctx_displaylist_t disp_list; @@ -4263,7 +4274,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) bool use_filebrowser = false; unsigned count = 0; int ret = 0; - menu_displaylist_info_t *info = (menu_displaylist_info_t*)data; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return false; @@ -7391,19 +7401,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->need_push = true; } break; - case DISPLAYLIST_SETTING_ENUM: - { - menu_displaylist_ctx_parse_entry_t *entry = - (menu_displaylist_ctx_parse_entry_t*)data; - - if (menu_displaylist_parse_settings_enum(entry->data, - entry->info, - entry->enum_idx, - entry->parse_type, - entry->add_empty_entry) == -1) - return false; - } - break; case DISPLAYLIST_HELP: menu_entries_append_enum(info->list, info->path, info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0); diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 5c1ff8abaa..0ea063328d 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -60,7 +60,6 @@ enum menu_displaylist_ctl_state DISPLAYLIST_HELP_SCREEN_LIST, DISPLAYLIST_MAIN_MENU, DISPLAYLIST_GENERIC, - DISPLAYLIST_SETTING_ENUM, DISPLAYLIST_SETTINGS_ALL, DISPLAYLIST_HORIZONTAL, DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS, @@ -245,7 +244,9 @@ void menu_displaylist_info_free(menu_displaylist_info_t *info); void menu_displaylist_info_init(menu_displaylist_info_t *info); -bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data); +bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist_info_t *info); + +bool menu_displaylist_setting(menu_displaylist_ctx_parse_entry_t *entry); #ifdef HAVE_NETWORKING void netplay_refresh_rooms_menu(file_list_t *list); From 5017063a7e8ad8c18d94cfe0c512d2374ff7bd81 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 05:34:59 +0200 Subject: [PATCH 0371/1292] Fix stripes.c --- menu/drivers/stripes.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index c466ed5599..7dc34bfb8b 100755 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -4209,13 +4209,13 @@ static int stripes_list_push(void *data, void *userdata, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) { entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (system->load_no_content) { entry.enum_idx = MENU_ENUM_LABEL_START_CORE; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #ifndef HAVE_DYNAMIC @@ -4225,7 +4225,7 @@ static int stripes_list_push(void *data, void *userdata, if (settings->bools.menu_show_load_core) { entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } } @@ -4234,7 +4234,7 @@ static int stripes_list_push(void *data, void *userdata, const struct retro_subsystem_info* subsystem = NULL; entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); subsystem = system->subsystem.data; @@ -4290,68 +4290,68 @@ static int stripes_list_push(void *data, void *userdata, } entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #if defined(HAVE_NETWORKING) { settings_t *settings = config_get_ptr(); if (settings->bools.menu_show_online_updater && !settings->bools.kiosk_mode_enable) { entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } } #endif if (!settings->bools.menu_content_show_settings && !string_is_empty(settings->paths.menu_content_show_settings_password)) { entry.enum_idx = MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.kiosk_mode_enable && !string_is_empty(settings->paths.kiosk_mode_password)) { entry.enum_idx = MENU_ENUM_LABEL_MENU_DISABLE_KIOSK_MODE; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_information) { entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #ifndef HAVE_DYNAMIC entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); #endif if (settings->bools.menu_show_configurations && !settings->bools.kiosk_mode_enable) { entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } if (settings->bools.menu_show_help) { entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #if !defined(IOS) if (settings->bools.menu_show_quit_retroarch) { entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } #endif if (settings->bools.menu_show_reboot) { entry.enum_idx = MENU_ENUM_LABEL_REBOOT; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); } entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN; - menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + menu_displaylist_setting(&entry); info->need_push = true; ret = 0; } From e3e4abf8468aa6504b0ccc80f9a3a5dea503bae5 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 17 Oct 2018 05:44:05 +0200 Subject: [PATCH 0372/1292] Remove some unused variables --- managers/cheat_manager.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index f0ce7643b4..202d8af8bc 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -1115,7 +1115,6 @@ int cheat_manager_add_matches(const char *path, unsigned int curr_val = 0; unsigned int num_added = 0; unsigned int offset = 0; - unsigned int i = 0; unsigned char *curr = cheat_manager_state.curr_memory_buf; if (cheat_manager_state.num_matches + cheat_manager_state.size > 100) @@ -1472,7 +1471,6 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig unsigned int curr_val = 0; unsigned int prev_val = 0; unsigned int offset = 0; - unsigned int i = 0; unsigned char *curr = cheat_manager_state.curr_memory_buf; unsigned char *prev = cheat_manager_state.prev_memory_buf; unsigned int curr_match_idx = 0; From cf9341f2ea04b80bf1da7ebea22530392fd901cf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 05:45:43 +0200 Subject: [PATCH 0373/1292] Update libretro-common --- .../include/streams/file_stream_transforms.h | 4 ++++ .../streams/file_stream_transforms.c | 22 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libretro-common/include/streams/file_stream_transforms.h b/libretro-common/include/streams/file_stream_transforms.h index 17c17580e9..9cf15c599d 100644 --- a/libretro-common/include/streams/file_stream_transforms.h +++ b/libretro-common/include/streams/file_stream_transforms.h @@ -47,6 +47,7 @@ RETRO_BEGIN_DECLS #undef fprintf #undef ferror #undef feof +#undef fscanf #define fopen rfopen #define fclose rfclose @@ -61,6 +62,7 @@ RETRO_BEGIN_DECLS #define fprintf rfprintf #define ferror rferror #define feof rfeof +#define fscanf rfscanf #endif @@ -92,6 +94,8 @@ int rferror(RFILE* stream); int rfeof(RFILE* stream); +int rfscanf(RFILE * stream, const char * format, ...); + RETRO_END_DECLS #endif diff --git a/libretro-common/streams/file_stream_transforms.c b/libretro-common/streams/file_stream_transforms.c index fc1e1bd160..5a82f88c73 100644 --- a/libretro-common/streams/file_stream_transforms.c +++ b/libretro-common/streams/file_stream_transforms.c @@ -109,7 +109,7 @@ char *rfgets(char *buffer, int maxCount, RFILE* stream) int rfgetc(RFILE* stream) { - return filestream_getc(stream); + return filestream_getc(stream); } int64_t rfwrite(void const* buffer, @@ -131,11 +131,11 @@ int64_t rfflush(RFILE * stream) int rfprintf(RFILE * stream, const char * format, ...) { int result; - va_list vl; - va_start(vl, format); - result = filestream_vprintf(stream, format, vl); - va_end(vl); - return result; + va_list vl; + va_start(vl, format); + result = filestream_vprintf(stream, format, vl); + va_end(vl); + return result; } int rferror(RFILE* stream) @@ -147,3 +147,13 @@ int rfeof(RFILE* stream) { return filestream_eof(stream); } + +int rfscanf(RFILE * stream, const char * format, ...) +{ + int result; + va_list vl; + va_start(vl, format); + result = filestream_scanf(stream, format, vl); + va_end(vl); + return result; +} From ebd8e5bbc28bc02ceb54c239ca3e6461e2f3d527 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 06:20:22 +0200 Subject: [PATCH 0374/1292] Cleanup --- gfx/video_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 2651ddb797..c469a7d66f 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -671,11 +671,9 @@ retro_proc_address_t video_driver_get_proc_address(const char *sym) bool video_driver_set_shader(enum rarch_shader_type type, const char *path) { - bool ret = false; if (current_video->set_shader) - ret = current_video->set_shader(video_driver_data, type, path); - - return ret; + return current_video->set_shader(video_driver_data, type, path); + return false; } static void video_driver_filter_free(void) From 4692e95fd80eadf1014a96ef4cc2667a51d01f3d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 06:49:24 +0200 Subject: [PATCH 0375/1292] Refactor 'kill by tag' and 'kill by subject' --- menu/drivers/materialui.c | 2 +- menu/drivers/stripes.c | 6 +-- menu/drivers/xmb.c | 6 +-- menu/menu_animation.c | 105 +++++++++++++++++++------------------- menu/menu_animation.h | 8 +-- 5 files changed, 64 insertions(+), 63 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index fc216530e9..d86190dc1f 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -2752,7 +2752,7 @@ static void materialui_list_clear(file_list_t *list) subject.count = 2; subject.data = subjects; - menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_SUBJECT, &subject); + menu_animation_kill_by_subject(&subject); file_list_free_userdata(list, i); } diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index 7dc34bfb8b..cfea3c388d 100755 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -1177,7 +1177,7 @@ static void stripes_selection_pointer_changed( tag = (uintptr_t)selection_buf; - menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag); + menu_animation_kill_by_tag(&tag); menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &num); for (i = 0; i < end; i++) @@ -3830,7 +3830,7 @@ static void stripes_list_clear(file_list_t *list) { menu_animation_ctx_tag tag = (uintptr_t)list; - menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag); + menu_animation_kill_by_tag(&tag); stripes_free_list_nodes(list, false); } @@ -3846,7 +3846,7 @@ static void stripes_list_deep_copy(const file_list_t *src, file_list_t *dst, size_t i, j = 0; menu_animation_ctx_tag tag = (uintptr_t)dst; - menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag); + menu_animation_kill_by_tag(&tag); /* use true here because file_list_copy() doesn't free actiondata */ stripes_free_list_nodes(dst, true); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 922d7ce607..d649768f50 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1231,7 +1231,7 @@ static void xmb_selection_pointer_changed( tag = (uintptr_t)selection_buf; - menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag); + menu_animation_kill_by_tag(&tag); menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &num); for (i = 0; i < end; i++) @@ -4930,7 +4930,7 @@ static void xmb_list_clear(file_list_t *list) { menu_animation_ctx_tag tag = (uintptr_t)list; - menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag); + menu_animation_kill_by_tag(&tag); xmb_free_list_nodes(list, false); } @@ -4946,7 +4946,7 @@ static void xmb_list_deep_copy(const file_list_t *src, file_list_t *dst, size_t i, j = 0; menu_animation_ctx_tag tag = (uintptr_t)dst; - menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag); + menu_animation_kill_by_tag(&tag); /* use true here because file_list_copy() doesn't free actiondata */ xmb_free_list_nodes(dst, true); diff --git a/menu/menu_animation.c b/menu/menu_animation.c index 628c41013e..f31c143a22 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -617,6 +617,58 @@ bool menu_animation_is_active(void) return animation_is_active; } +bool menu_animation_kill_by_tag(menu_animation_ctx_tag *tag) +{ + unsigned i; + + if (!tag || *tag == (uintptr_t)-1) + return false; + + for (i = 0; i < anim.size; ++i) + { + if (anim.list[i].tag != *tag) + continue; + + anim.list[i].alive = false; + anim.list[i].subject = NULL; + + if (i < anim.first_dead) + anim.first_dead = i; + + anim.need_defrag = true; + } + + return true; +} + +void menu_animation_kill_by_subject(menu_animation_ctx_subject_t *subject) +{ + unsigned i, j, killed = 0; + float **sub = (float**)subject->data; + + for (i = 0; i < anim.size && killed < subject->count; ++i) + { + if (!anim.list[i].alive) + continue; + + for (j = 0; j < subject->count; ++j) + { + if (anim.list[i].subject != sub[j]) + continue; + + anim.list[i].alive = false; + anim.list[i].subject = NULL; + + if (i < anim.first_dead) + anim.first_dead = i; + + killed++; + anim.need_defrag = true; + break; + } + } +} + bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) { switch (state) @@ -653,59 +705,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) *ptr = delta_time; } break; - case MENU_ANIMATION_CTL_KILL_BY_TAG: - { - unsigned i; - menu_animation_ctx_tag *tag = (menu_animation_ctx_tag*)data; - - if (!tag || *tag == (uintptr_t)-1) - return false; - - for (i = 0; i < anim.size; ++i) - { - if (anim.list[i].tag != *tag) - continue; - - anim.list[i].alive = false; - anim.list[i].subject = NULL; - - if (i < anim.first_dead) - anim.first_dead = i; - - anim.need_defrag = true; - } - } - break; - case MENU_ANIMATION_CTL_KILL_BY_SUBJECT: - { - unsigned i, j, killed = 0; - menu_animation_ctx_subject_t *subject = - (menu_animation_ctx_subject_t*)data; - float **sub = (float**)subject->data; - - for (i = 0; i < anim.size && killed < subject->count; ++i) - { - if (!anim.list[i].alive) - continue; - - for (j = 0; j < subject->count; ++j) - { - if (anim.list[i].subject != sub[j]) - continue; - - anim.list[i].alive = false; - anim.list[i].subject = NULL; - - if (i < anim.first_dead) - anim.first_dead = i; - - killed++; - anim.need_defrag = true; - break; - } - } - } - break; case MENU_ANIMATION_CTL_NONE: default: break; diff --git a/menu/menu_animation.h b/menu/menu_animation.h index 2f6c8aefbb..8e63ee1ef2 100644 --- a/menu/menu_animation.h +++ b/menu/menu_animation.h @@ -34,9 +34,7 @@ enum menu_animation_ctl_state MENU_ANIMATION_CTL_DEINIT, MENU_ANIMATION_CTL_CLEAR_ACTIVE, MENU_ANIMATION_CTL_SET_ACTIVE, - MENU_ANIMATION_CTL_DELTA_TIME, - MENU_ANIMATION_CTL_KILL_BY_TAG, - MENU_ANIMATION_CTL_KILL_BY_SUBJECT + MENU_ANIMATION_CTL_DELTA_TIME }; enum menu_animation_easing_type @@ -130,6 +128,10 @@ void menu_animation_update_time(bool timedate_enable); bool menu_animation_is_active(void); +bool menu_animation_kill_by_tag(menu_animation_ctx_tag *tag); + +void menu_animation_kill_by_subject(menu_animation_ctx_subject_t *subject); + bool menu_animation_push(menu_animation_ctx_entry_t *entry); bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data); From 63eff7f236e929f3b8ad28fdf0c0ad092b688ab1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 06:55:49 +0200 Subject: [PATCH 0376/1292] Create menu_animation_get_delta_time --- menu/drivers/materialui.c | 5 +---- menu/drivers/stripes.c | 5 +---- menu/drivers/xmb.c | 5 +---- menu/menu_animation.c | 17 +++++++---------- menu/menu_animation.h | 5 +++-- menu/menu_input.c | 9 ++------- 6 files changed, 15 insertions(+), 31 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index d86190dc1f..752dc1caa8 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -650,7 +650,6 @@ static void materialui_compute_entries_box(materialui_handle_t* mui, int width) static void materialui_render(void *data, bool is_idle) { menu_animation_ctx_delta_t delta; - float delta_time; unsigned bottom, width, height, header_height; size_t i = 0; materialui_handle_t *mui = (materialui_handle_t*)data; @@ -669,9 +668,7 @@ static void materialui_render(void *data, bool is_idle) mui->need_compute = false; } - menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - - delta.current = delta_time; + delta.current = menu_animation_get_delta_time(); if (menu_animation_get_ideal_delta_time(&delta)) menu_animation_update(delta.ideal); diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index cfea3c388d..e72a569eba 100755 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -2657,7 +2657,6 @@ static void stripes_draw_items( static void stripes_render(void *data, bool is_idle) { size_t i; - float delta_time; menu_animation_ctx_delta_t delta; settings_t *settings = config_get_ptr(); stripes_handle_t *stripes = (stripes_handle_t*)data; @@ -2668,9 +2667,7 @@ static void stripes_render(void *data, bool is_idle) if (!stripes) return; - menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - - delta.current = delta_time; + delta.current = menu_animation_get_delta_time(); if (menu_animation_get_ideal_delta_time(&delta)) menu_animation_update(delta.ideal); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index d649768f50..2a5b13fb19 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2934,7 +2934,6 @@ static void xmb_draw_items( static void xmb_render(void *data, bool is_idle) { size_t i; - float delta_time; menu_animation_ctx_delta_t delta; settings_t *settings = config_get_ptr(); xmb_handle_t *xmb = (xmb_handle_t*)data; @@ -2945,9 +2944,7 @@ static void xmb_render(void *data, bool is_idle) if (!xmb) return; - menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - - delta.current = delta_time; + delta.current = menu_animation_get_delta_time(); if (menu_animation_get_ideal_delta_time(&delta)) menu_animation_update(delta.ideal); diff --git a/menu/menu_animation.c b/menu/menu_animation.c index f31c143a22..8cd9d140f8 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2014-2017 - Jean-André Santoni - * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2018 - Jean-André Santoni + * Copyright (C) 2011-2018 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -669,6 +669,11 @@ void menu_animation_kill_by_subject(menu_animation_ctx_subject_t *subject) } } +float menu_animation_get_delta_time(void) +{ + return delta_time; +} + bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) { switch (state) @@ -697,14 +702,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) case MENU_ANIMATION_CTL_SET_ACTIVE: animation_is_active = true; break; - case MENU_ANIMATION_CTL_DELTA_TIME: - { - float *ptr = (float*)data; - if (!ptr) - return false; - *ptr = delta_time; - } - break; case MENU_ANIMATION_CTL_NONE: default: break; diff --git a/menu/menu_animation.h b/menu/menu_animation.h index 8e63ee1ef2..71f31e9c6d 100644 --- a/menu/menu_animation.h +++ b/menu/menu_animation.h @@ -33,8 +33,7 @@ enum menu_animation_ctl_state MENU_ANIMATION_CTL_NONE = 0, MENU_ANIMATION_CTL_DEINIT, MENU_ANIMATION_CTL_CLEAR_ACTIVE, - MENU_ANIMATION_CTL_SET_ACTIVE, - MENU_ANIMATION_CTL_DELTA_TIME + MENU_ANIMATION_CTL_SET_ACTIVE }; enum menu_animation_easing_type @@ -134,6 +133,8 @@ void menu_animation_kill_by_subject(menu_animation_ctx_subject_t *subject); bool menu_animation_push(menu_animation_ctx_entry_t *entry); +float menu_animation_get_delta_time(void); + bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data); RETRO_END_DECLS diff --git a/menu/menu_input.c b/menu/menu_input.c index 98d1fc9ed4..1930307488 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -163,7 +163,6 @@ void menu_event_kb_set(bool down, enum retro_key key) unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_input) { menu_animation_ctx_delta_t delta; - float delta_time; /* Used for key repeat */ static float delay_timer = 0.0f; static float delay_count = 0.0f; @@ -236,9 +235,7 @@ unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_input) menu_driver_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL, &new_scroll_accel); - menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - - delta.current = delta_time; + delta.current = menu_animation_get_delta_time(); if (menu_animation_get_ideal_delta_time(&delta)) delay_count += delta.ideal; @@ -793,7 +790,7 @@ static int menu_input_pointer_post_iterate( if (abs(pointer_x - start_x) > (dpi / 10) || abs(pointer_y - start_y) > (dpi / 10)) { - float s, delta_time; + float s; menu_input_ctl(MENU_INPUT_CTL_SET_POINTER_DRAGGED, NULL); menu_input->pointer.dx = pointer_x - pointer_old_x; @@ -801,8 +798,6 @@ static int menu_input_pointer_post_iterate( pointer_old_x = pointer_x; pointer_old_y = pointer_y; - menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time); - s = menu_input->pointer.dy; menu_input->pointer.accel = (accel0 + accel1 + s) / 3; accel0 = accel1; From 3d731aec1943d2deca03d68077629e42491068cc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 07:36:46 +0200 Subject: [PATCH 0377/1292] Call network_init before processing the network information list --- menu/menu_displaylist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c05df58676..dd85bc88ab 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4845,6 +4845,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist case DISPLAYLIST_NETWORK_INFO: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); #if defined(HAVE_NETWORKING) && !defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX)) + network_init(); count = menu_displaylist_parse_network_info(info); #endif From 0abe42d9a4944e83fb59579dc27108e7be945cca Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Tue, 16 Oct 2018 22:40:13 -0700 Subject: [PATCH 0378/1292] Rewrite content search task == DETAILS In attempting to identify where netplay lobby errors were occuring, I found that the code which does the content search was pretty messy, so I've cleaned it up. - Search is now more efficient. Playlists are only iterated over once, instead of twice. - Error messages are more helpful - Eliminated goto abuse - code is easier to follow and has comments describing the logical flow. == TESTING Tested lightly locally, although hard to test thoroughly due to tight netplay requirements. --- tasks/task_netplay_find_content.c | 324 +++++++++++++++--------------- 1 file changed, 162 insertions(+), 162 deletions(-) diff --git a/tasks/task_netplay_find_content.c b/tasks/task_netplay_find_content.c index 816a9e0e2e..10ab3ef953 100644 --- a/tasks/task_netplay_find_content.c +++ b/tasks/task_netplay_find_content.c @@ -123,184 +123,184 @@ static void netplay_crc_scan_callback(void *task_data, free(state); } -static void task_netplay_crc_scan_handler(retro_task_t *task) -{ - size_t i, j; - netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state; - +static void begin_task(retro_task_t *task, const char *title) { task_set_progress(task, 0); task_free_title(task); - task_set_title(task, strdup("Looking for compatible content...")); + task_set_title(task, strdup(title)); task_set_finished(task, false); +} +static void finish_task(retro_task_t *task, const char *title) { + task_set_progress(task, 100); + task_free_title(task); + task_set_title(task, strdup(title)); + task_set_finished(task, true); +} + +static bool core_requires_content(netplay_crc_handle_t *state) { + return string_is_not_equal(state->content_path, "N/A"); +} + +/** + * Given a path to a content file, return the base name without the + * path or the file extension. + * + * e.g. /home/user/foo.rom => foo + */ +static void get_entry(char *entry, int len, const char *path) { + const char *buf = path_basename(path); + entry[0] = '\0'; + + strlcpy(entry, buf, len); + path_remove_extension(entry); +} + +/** + * Execute a search for compatible content for netplay. + * We prioritize a CRC match, if we have a CRC to match against. + * If we don't have a CRC, or if there's no CRC match found, fall + * back to a filename match and hope for the best. + */ +static void task_netplay_crc_scan_handler(retro_task_t *task) +{ + netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state; + + begin_task(task, "Looking for compatible content..."); + + /* start by checking cases that don't require a search */ + + /* the core doesn't have any content to match, so fast-succeed */ + if(!core_requires_content(state)) { + state->found = true; + state->contentless = true; + task_set_data(task, state); + finish_task(task, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)); + return; + } + + /* if this list is null, it means that RA failed to open the playlist directory */ if (!state->lpl_list) { - task_set_progress(task, 100); - task_free_title(task); - task_set_title(task, strdup("Playlist directory not found")); - task_set_finished(task, true); + finish_task(task, "Playlist directory not found"); free(state); return; } - if (state->lpl_list->size == 0 && - string_is_not_equal(state->content_path, "N/A")) - goto no_playlists; - - /* Core requires content */ - if (string_is_not_equal(state->content_path, "N/A")) - { - /* CRC matching */ - if (!string_is_equal(state->content_crc, "00000000|crc")) - { - char current[PATH_MAX_LENGTH]; - RARCH_LOG("[lobby] testing CRC matching for: %s\n", state->content_crc); - - snprintf(current, sizeof(current), "%X|crc", content_get_crc()); - RARCH_LOG("[lobby] current content crc: %s\n", current); - if (string_is_equal(current, state->content_crc)) - { - RARCH_LOG("[lobby] CRC match %s with currently loaded content\n", current); - strlcpy(state->content_path, "N/A", sizeof(state->content_path)); - state->found = true; - state->current = true; - task_set_data(task, state); - task_set_progress(task, 100); - task_free_title(task); - task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND))); - task_set_finished(task, true); - string_list_free(state->lpl_list); - return; - } - for (i = 0; i < state->lpl_list->size; i++) - { - playlist_t *playlist = NULL; - unsigned playlist_size = 0; - const char *lpl_path = state->lpl_list->elems[i].data; - - if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION))) - continue; - - playlist = playlist_init(lpl_path, 99999); - playlist_size = playlist_get_size(playlist); - - for (j = 0; j < playlist_size; j++) - { - const char *playlist_crc32 = NULL; - const char *playlist_path = NULL; - playlist_get_index(playlist, - j, &playlist_path, NULL, NULL, NULL, NULL, &playlist_crc32); - - if (string_is_equal(playlist_crc32, state->content_crc)) - { - RARCH_LOG("[lobby] CRC match %s\n", playlist_crc32); - strlcpy(state->content_path, playlist_path, sizeof(state->content_path)); - state->found = true; - task_set_data(task, state); - task_set_progress(task, 100); - task_free_title(task); - task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND))); - task_set_finished(task, true); - string_list_free(state->lpl_list); - free(playlist); - return; - } - - task_set_progress(task, (int)(j / playlist_size * 100.0)); - } - - free(playlist); - } - /* CRC matching failed, goto filename matching */ - if (!state->found) - { - RARCH_LOG("[lobby] CRC matching for: %s failed\n", state->content_crc); - goto filename_matching; - } - } - /* filename matching*/ - else - { -filename_matching: - RARCH_LOG("[lobby] testing filename matching for: %s\n", state->content_path); - for (i = 0; i < state->lpl_list->size; i++) - { - playlist_t *playlist = NULL; - unsigned playlist_size = 0; - const char *lpl_path = state->lpl_list->elems[i].data; - - if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION))) - continue; - - playlist = playlist_init(lpl_path, 99999); - playlist_size = playlist_get_size(playlist); - - for (j = 0; j < playlist_size; j++) - { - char entry[PATH_MAX_LENGTH]; - const char *playlist_path = NULL; - const char *buf = NULL; - - playlist_get_index(playlist, - j, &playlist_path, NULL, NULL, NULL, NULL, NULL); - - buf = path_basename(playlist_path); - entry[0] = '\0'; - - strlcpy(entry, buf, sizeof(entry)); - - path_remove_extension(entry); - - if ( !string_is_empty(entry) && - string_is_equal(entry, state->content_path) && - strstr(state->core_extensions, path_get_extension(playlist_path))) - { - RARCH_LOG("[lobby] filename match %s\n", playlist_path); - - strlcpy(state->content_path, playlist_path, sizeof(state->content_path)); - state->found = true; - task_set_data(task, state); - task_set_progress(task, 100); - task_free_title(task); - task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND))); - task_set_finished(task, true); - string_list_free(state->lpl_list); - free(playlist); - return; - } - - task_set_progress(task, (int)(j / playlist_size * 100.0)); - } - free(playlist); - } - - /* filename matching failed */ - if (!state->found) - RARCH_LOG("[lobby] filename matching for: %s failed\n", state->content_path); - } - } - /* Lobby reports core doesn't need content */ - else - { - state->found = true; - state->contentless = true; - task_set_data(task, state); - task_set_progress(task, 100); - task_free_title(task); - task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND))); - task_set_finished(task, true); + /* We opened the playlist directory, but there's nothing there. Nothing to do. */ + if(state->lpl_list->size == 0 && core_requires_content(state)) { + string_list_free(state->lpl_list); + finish_task(task, "There are no playlists available; cannot execute search"); + command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname); + free(state); return; } -no_playlists: + bool have_crc = !string_is_equal(state->content_crc, "00000000|crc"); + + /* if content is already loaded and the lobby gave us a CRC, check the loaded content first */ + if(have_crc && content_get_crc() > 0) { + char current[PATH_MAX_LENGTH]; + RARCH_LOG("[lobby] testing CRC matching for: %s\n", state->content_crc); + + snprintf(current, sizeof(current), "%X|crc", content_get_crc()); + RARCH_LOG("[lobby] current content crc: %s\n", current); + if (string_is_equal(current, state->content_crc)) { + RARCH_LOG("[lobby] CRC match %s with currently loaded content\n", current); + strlcpy(state->content_path, "N/A", sizeof(state->content_path)); + state->found = true; + state->current = true; + task_set_data(task, state); + finish_task(task, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)); + string_list_free(state->lpl_list); + return; + } + } + + /* now let's do the search */ + size_t i, j; + char *filename_match = NULL; + char entry[PATH_MAX_LENGTH]; + + + for(i = 0; i < state->lpl_list->size; i++) { + playlist_t *playlist = NULL; + unsigned playlist_size = 0; + const char *lpl_path = state->lpl_list->elems[i].data; + + /* skip files without .lpl file extension */ + if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION))) + continue; + + RARCH_LOG("Searching playlist: %s\n", lpl_path); + playlist = playlist_init(lpl_path, 99999); + playlist_size = playlist_get_size(playlist); + + for(j = 0; j < playlist_size; j++) { + const char *playlist_crc32 = NULL; + const char *playlist_path = NULL; + + playlist_get_index(playlist, j, &playlist_path, NULL, NULL, NULL, NULL, &playlist_crc32); + if(have_crc && string_is_equal(playlist_crc32, state->content_crc)) { + RARCH_LOG("[lobby] CRC match %s\n", playlist_crc32); + strlcpy(state->content_path, playlist_path, sizeof(state->content_path)); + state->found = true; + task_set_data(task, state); + finish_task(task, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)); + string_list_free(state->lpl_list); + free(playlist); + return; + } + + get_entry(entry, sizeof(entry), playlist_path); + + /* See if the filename is a match. The response depends on whether or not we are doing a CRC + * search. + * + * If we are doing a CRC search, we stow a copy of the filename match in filename_match, which + * we'll use as our match if the CRC search is exhausted without a match. + * + * Otherwise, on match we complete the task and mark it as successful immediately. + */ + if(string_is_empty(filename_match) && + !string_is_empty(entry) && + string_is_equal(entry, state->content_path) && + strstr(state->core_extensions, path_get_extension(playlist_path))) { + if(have_crc) { + filename_match = strdup(playlist_path); + } else { + RARCH_LOG("[lobby] filename match %s\n", playlist_path); + + strlcpy(state->content_path, playlist_path, sizeof(state->content_path)); + state->found = true; + task_set_data(task, state); + finish_task(task, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)); + string_list_free(state->lpl_list); + free(playlist); + return; + } + } + task_set_progress(task, (int)(j / playlist_size * 100.0)); + } + + free(playlist); + } + if(filename_match != NULL) { + RARCH_LOG("[lobby] CRC match failed; falling back to filename match %s\n", filename_match); + + strlcpy(state->content_path, filename_match, sizeof(state->content_path)); + state->found = true; + task_set_data(task, state); + finish_task(task, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND)); + string_list_free(state->lpl_list); + free(filename_match); + return; + } + + /* end of the line. no matches at all. */ string_list_free(state->lpl_list); - task_set_progress(task, 100); - task_free_title(task); - task_set_title(task, strdup("Content not found, try manual load or disconnect from host")); - task_set_finished(task, true); + finish_task(task, "Failed to locate matching content by either CRC or filename."); command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname); free(state); - return; } bool task_push_netplay_crc_scan(uint32_t crc, char* name, From 697d8a3ba402c9280bcb5f0ee097463e094a0e92 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 17 Oct 2018 07:42:01 +0200 Subject: [PATCH 0379/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 53985e0b4d..01287f3df7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. - VULKAN: Fix RGUI crashing at startup. +- WINDOWS/WSA: Network Information info is blank until first network operation. - WIIU: Initial netplay peer-to-peer support. Network information working. # 1.7.5 From 421e6178e5aa247fe0fabbbdb2a4757792c9c01d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Oct 2018 18:20:01 +0200 Subject: [PATCH 0380/1292] Buildfix --- managers/cheat_manager.c | 4 +-- tasks/task_netplay_find_content.c | 45 +++++++++++++++++++------------ 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 202d8af8bc..9e979d09f2 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -320,7 +320,7 @@ void cheat_manager_load_cb_second_pass(char *key, char *value) char cheat_num_str[20]; unsigned cheat_num; unsigned cheat_idx; - int idx = 5; + unsigned idx = 5; size_t key_length = 0; errno = 0; @@ -715,7 +715,7 @@ bool cheat_manager_alloc_if_empty(void) int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound) { - int i; + unsigned i; retro_ctx_memory_info_t meminfo; bool refresh = false; bool is_search_initialization = (setting != NULL); diff --git a/tasks/task_netplay_find_content.c b/tasks/task_netplay_find_content.c index 10ab3ef953..142893f45d 100644 --- a/tasks/task_netplay_find_content.c +++ b/tasks/task_netplay_find_content.c @@ -163,6 +163,10 @@ static void get_entry(char *entry, int len, const char *path) { */ static void task_netplay_crc_scan_handler(retro_task_t *task) { + size_t i, j; + char entry[PATH_MAX_LENGTH]; + char *filename_match = NULL; + bool have_crc = false; netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state; begin_task(task, "Looking for compatible content..."); @@ -195,16 +199,20 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) return; } - bool have_crc = !string_is_equal(state->content_crc, "00000000|crc"); + have_crc = !string_is_equal(state->content_crc, "00000000|crc"); /* if content is already loaded and the lobby gave us a CRC, check the loaded content first */ - if(have_crc && content_get_crc() > 0) { + if(have_crc && content_get_crc() > 0) + { char current[PATH_MAX_LENGTH]; + RARCH_LOG("[lobby] testing CRC matching for: %s\n", state->content_crc); snprintf(current, sizeof(current), "%X|crc", content_get_crc()); RARCH_LOG("[lobby] current content crc: %s\n", current); - if (string_is_equal(current, state->content_crc)) { + + if (string_is_equal(current, state->content_crc)) + { RARCH_LOG("[lobby] CRC match %s with currently loaded content\n", current); strlcpy(state->content_path, "N/A", sizeof(state->content_path)); state->found = true; @@ -217,15 +225,11 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) } /* now let's do the search */ - size_t i, j; - char *filename_match = NULL; - char entry[PATH_MAX_LENGTH]; - - - for(i = 0; i < state->lpl_list->size; i++) { - playlist_t *playlist = NULL; + for(i = 0; i < state->lpl_list->size; i++) + { + playlist_t *playlist = NULL; unsigned playlist_size = 0; - const char *lpl_path = state->lpl_list->elems[i].data; + const char *lpl_path = state->lpl_list->elems[i].data; /* skip files without .lpl file extension */ if (!strstr(lpl_path, file_path_str(FILE_PATH_LPL_EXTENSION))) @@ -235,12 +239,15 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) playlist = playlist_init(lpl_path, 99999); playlist_size = playlist_get_size(playlist); - for(j = 0; j < playlist_size; j++) { + for(j = 0; j < playlist_size; j++) + { const char *playlist_crc32 = NULL; const char *playlist_path = NULL; playlist_get_index(playlist, j, &playlist_path, NULL, NULL, NULL, NULL, &playlist_crc32); - if(have_crc && string_is_equal(playlist_crc32, state->content_crc)) { + + if(have_crc && string_is_equal(playlist_crc32, state->content_crc)) + { RARCH_LOG("[lobby] CRC match %s\n", playlist_crc32); strlcpy(state->content_path, playlist_path, sizeof(state->content_path)); state->found = true; @@ -264,10 +271,12 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) if(string_is_empty(filename_match) && !string_is_empty(entry) && string_is_equal(entry, state->content_path) && - strstr(state->core_extensions, path_get_extension(playlist_path))) { - if(have_crc) { + strstr(state->core_extensions, path_get_extension(playlist_path))) + { + if(have_crc) filename_match = strdup(playlist_path); - } else { + else + { RARCH_LOG("[lobby] filename match %s\n", playlist_path); strlcpy(state->content_path, playlist_path, sizeof(state->content_path)); @@ -284,7 +293,9 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) free(playlist); } - if(filename_match != NULL) { + + if(filename_match != NULL) + { RARCH_LOG("[lobby] CRC match failed; falling back to filename match %s\n", filename_match); strlcpy(state->content_path, filename_match, sizeof(state->content_path)); From 87467be496910d757835f8839e012c6ad69d426d Mon Sep 17 00:00:00 2001 From: meleu Date: Wed, 17 Oct 2018 16:37:41 -0300 Subject: [PATCH 0381/1292] added cheevos console ID for atari7800 --- cheevos/cheevos.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cheevos/cheevos.h b/cheevos/cheevos.h index 0e53cc0021..ec25ae0019 100644 --- a/cheevos/cheevos.h +++ b/cheevos/cheevos.h @@ -98,7 +98,8 @@ typedef enum CHEEVOS_CONSOLE_VIRTUAL_BOY = 28, CHEEVOS_CONSOLE_MSX = 29, CHEEVOS_CONSOLE_COMMODORE_64 = 30, - CHEEVOS_CONSOLE_ZX81 = 31 + CHEEVOS_CONSOLE_ZX81 = 31, + CHEEVOS_CONSOLE_ATARI_7800 = 51 } cheevos_console_t; enum From 9370123133bd44a9c2748315708a63ae7016c5ee Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Wed, 17 Oct 2018 19:36:18 -0700 Subject: [PATCH 0382/1292] fix: Post CMD_EVENT_QUIT directly to command queue --- ui/drivers/ui_cocoa.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index 33d1852c96..f454831e90 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -466,7 +466,7 @@ static char** waiting_argv; if (rarch_ctl(RARCH_CTL_IS_INITED, NULL)) reply = NSTerminateCancel; - ui_companion_event_command(CMD_EVENT_QUIT); + command_event(CMD_EVENT_QUIT, NULL); return reply; } From 0957017a32b3783a7cb1c85cfd1ae18d7f6fa291 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 18 Oct 2018 05:49:28 +0200 Subject: [PATCH 0383/1292] Update Dutch localization --- intl/msg_hash_nl.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index d33ee6965c..2c42e03c06 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -107,7 +107,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST_END, - "Accounts List Endpoint" + "Accounts Lijst Eindpunt" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_RETRO_ACHIEVEMENTS, @@ -180,7 +180,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MUTE, - "Audio Mute" + "Geluid uitzetten" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, @@ -220,7 +220,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE, - "Load Shader Presets Automatically" + "Laad Shader Presets Automatisch" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, @@ -2951,7 +2951,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER, MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN, "Preparing for content scan...") MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, - "Delete core") + "Verwijder core") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, "Remove this core from disk.") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, @@ -2963,15 +2963,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, "Modify the opacity of the framebuffer.") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, - "Favorites") + "Favorieten") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_FAVORITES, "Content which you have added to 'Favorites' will appear here.") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, - "Music") + "Muziek") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_MUSIC, "Music which has been previously played will appear here.") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_IMAGES, - "Image") + "Afbeeldingen") MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_IMAGES, "Images which have been previously viewed will appear here.") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, @@ -2987,11 +2987,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS_PASSWORD, "Set Password For Enabling Settings Tab") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") + "Voer wachtwoord in") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") + "Wachtwoord is correct.") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") + "Wachtwoord is incorrect.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, @@ -3178,7 +3178,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, "Volume") MSG_HASH(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, - "Current core") + "Huidige core") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_SEARCH_CLEAR, "Clear") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, @@ -3193,7 +3193,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, "Paused") MSG_HASH( MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, - "Enable Discord" + "Discord Inschakelen" ) MSG_HASH( MENU_ENUM_SUBLABEL_DISCORD_ALLOW, @@ -3229,7 +3229,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, - "X-Axis Centering" + "X-As Centering" ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, @@ -3245,19 +3245,19 @@ MSG_HASH( "Output Display ID") MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, - "Start Recording" + "Start Opname" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, - "Starts recording." + "Start met opnemen." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, - "Stop Recording" + "Stop Opname" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, - "Stops recording." + "Stop met opnemen." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, @@ -3306,16 +3306,16 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, "Streaming Mode") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, - "Title of Stream") + "Titel van Stream") MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, "Split Joy-Con" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, - "Reset To Defaults" + "Fabrieksinstellingen resetten" ) MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, - "Reset the current configuration to default values." + "Reset de instellingen aar fabrieksinstellingen." ) From ca0c1533e318398b6714eb92a6c8086d89e19ae6 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Wed, 17 Oct 2018 22:39:45 -0700 Subject: [PATCH 0384/1292] fix(cocoa): Suppress event propagation when event is not for RA window This is required when the Qt window is focused. Ideally, event handling should be reviewed and refactored such that this hack is not necessary. --- ui/drivers/ui_cocoa.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index f454831e90..b248d5ae9e 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -121,11 +121,18 @@ static void app_terminate(void) - (void)sendEvent:(NSEvent *)event { - NSEventType event_type; - cocoa_input_data_t *apple = NULL; [super sendEvent:event]; + + RetroArch_OSX *delegate = (RetroArch_OSX *)self.delegate; + if (event.window != delegate.window) { + // TODO(sgc): this is just a hack for the 1.7.5 release to + // ignore RA processing events that are not for the RA window. + // Ideally, we'de delegate `sendEvent` to the window listener + return; + } - event_type = event.type; + cocoa_input_data_t *apple = NULL; + NSEventType event_type = event.type; switch (event_type) { From edacf67e7545af5e2edce63efc16e6cd8c4b10c2 Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Thu, 18 Oct 2018 11:07:47 -0700 Subject: [PATCH 0385/1292] Capture CRC content for deferred-loading cores == DETAILS Fixes a bug where content CRC32 is not calculated when content loading is done by the core instead of libretro. This impacts the ability to do accurate content matching on netplay. This notably affects MAME, but is by no means limited to MAME. Change summary: - adds a method to the crc32 implementation that calculates crc32 for a file (as opposed to an in-memory buffer) - fix a minor bug that would print the "core will load its own content" right before attempting to load compressed content - in the actual "core will load its own content" path, calculate the CRC32 and log it before returning == TESTING Tested locally on OSX: - loaded content - started netplay - confirmed CRC showing in netplay data - verified CRC32 against external crc32 tool --- libretro-common/encodings/encoding_crc32.c | 17 +++++++++++++++++ libretro-common/include/encodings/crc32.h | 1 + libretro-common/streams/file_stream.c | 3 ++- tasks/task_content.c | 6 +++--- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/libretro-common/encodings/encoding_crc32.c b/libretro-common/encodings/encoding_crc32.c index 4775e76357..45800e82a6 100644 --- a/libretro-common/encodings/encoding_crc32.c +++ b/libretro-common/encodings/encoding_crc32.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include static const uint32_t crc32_table[256] = { 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, @@ -88,3 +90,18 @@ uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len) return crc ^ 0xffffffff; } + +uint32_t file_crc32(uint32_t crc, const char *path) { + if(path == NULL) + return 0; + + void *file_bytes = NULL; + int64_t file_len = 0; + + if(filestream_read_file(path, &file_bytes, &file_len)) { + crc = encoding_crc32(crc, (uint8_t *)file_bytes, file_len); + free(file_bytes); + return crc; + } + return 0; +} diff --git a/libretro-common/include/encodings/crc32.h b/libretro-common/include/encodings/crc32.h index 76fbb5475e..25e926276f 100644 --- a/libretro-common/include/encodings/crc32.h +++ b/libretro-common/include/encodings/crc32.h @@ -31,6 +31,7 @@ RETRO_BEGIN_DECLS uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len); +uint32_t file_crc32(uint32_t crc, const char *path); RETRO_END_DECLS diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 680a809ec5..b24102ff3b 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -482,7 +482,8 @@ int filestream_close(RFILE *stream) * * Read the contents of a file into @buf. * - * Returns: number of items read, -1 on error. + * Returns: 1 on success, 0 on failure + * In the error case, the dereferenced buf is set to NULL and the len is set to -1. */ int64_t filestream_read_file(const char *path, void **buf, int64_t *len) { diff --git a/tasks/task_content.c b/tasks/task_content.c index c2df099419..c366ab1673 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -603,9 +603,6 @@ static bool content_file_load( } else { - RARCH_LOG("%s\n", - msg_hash_to_str( - MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT)); #ifdef HAVE_COMPRESSION if ( !content_ctx->block_extract @@ -619,6 +616,9 @@ static bool content_file_load( goto error; #endif } + RARCH_LOG("%s\n", msg_hash_to_str(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT)); + content_rom_crc = file_crc32(0, path); + RARCH_LOG("CRC32: 0x%x .\n", (unsigned)content_rom_crc); } load_info.content = content; From 5353e29afa54ede24ab097647c8ca5a99b6a1095 Mon Sep 17 00:00:00 2001 From: LamboLighting Date: Thu, 18 Oct 2018 22:57:11 +0300 Subject: [PATCH 0386/1292] Update intl/msg_hash_el.h --- intl/msg_hash_el.h | 258 ++++++++++++++++++++++----------------------- 1 file changed, 129 insertions(+), 129 deletions(-) diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 3245125e2f..8343d39cda 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -8,7 +8,7 @@ MSG_HASH( ) MSG_HASH( MSG_NATIVE, - "Native" + "Ντόπιος" ) MSG_HASH( MSG_DEVICE_DISCONNECTED_FROM_PORT, @@ -692,7 +692,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CUSTOM_RATIO, - "Πρωτιμώμενη Αναλογία" + "Προτιμώμενη Αναλογία" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER, @@ -1060,7 +1060,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_BINDS, - "Input Hotkey Binds" + "Σύνδεση Πλήκτρων Εντολών" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_ICADE_ENABLE, @@ -1332,35 +1332,35 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, - "Display Overlay" + "Εμφάνιση Επικαλύμματος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, - "Hide Overlay In Menu" + "Απόκρυψη Επικαλύμματος Στο Μενού" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, - "Show Inputs On Overlay" + "Εμφάνιση Εισαγωγών Στο Επικάλλυμα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, - "Show Inputs Listen Port" + "Εμφάνιση Θύρας Εισαγωγών" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, - "Poll Type Behavior" + "Τύπος Συμπεριφοράς Συγκέντρωσης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, - "Early" + "Νωρίς" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, - "Late" + "Αργά" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, - "Normal" + "Φυσιολογικά" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_PREFER_FRONT_TOUCH, @@ -1924,7 +1924,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS, - "Adjust Bezels and Onscreen controls" + "Προσαρμογή Προσόψεων και Χειρισμών Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, @@ -1932,7 +1932,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, - "Adjust the Onscreen Notifications" + "Προσαρμόστε τις Ειδοποιήσεις Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, @@ -1948,7 +1948,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, - "Autoload Preferred Overlay" + "Αυτόματη Φόρτωση Προτιμώμενου Επικαλύμματος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, @@ -1956,23 +1956,23 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, - "Overlay Opacity" + "Διαφάνεια Επικαλύμματος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OVERLAY_PRESET, - "Overlay Preset" + "Προκαθορισμένο Επικάλλυμα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE, - "Overlay Scale" + "Κλίμακα Επικαλύμματος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, - "Onscreen Overlay" + "Επικάλλυμα Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, - "Use PAL60 Mode" + "Χρήση Λειτουργίας PAL60" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, @@ -2172,15 +2172,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORD_ENABLE, - "Enable Recording" + "Ενεργοποίηση Εγγραφής" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORD_PATH, - "Save Output Recording as..." + "Αποθήκευση Εγγραφής Ως..." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, - "Save Recordings in Output Dir" + "Αποθήκευση Εγγραφών στο Ευρετήριο Εξαγωγής" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_REMAP_FILE, @@ -2256,23 +2256,23 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_TOGGLE, - "Apply After Toggle" + "Εφαρμογή Μετά Την Ενεργοποίηση" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_LOAD, - "Auto-Apply Cheats During Game Load" + "Αυτόματη Εφαρμογή Απατών Κατά την Φόρτωση Παιχνιδιού" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, - "Rewind Granularity" + "Βαθμός Λεπτομέρειας Επιστροφής" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE, - "Rewind Buffer Size (MB)" + "Μέγεθος Ενδιάμεσης Μνήμης Επιστροφής (MB)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE_STEP, - "Rewind Buffer Size Step (MB)" + "Βήμα Μεγέθους Ενδιάμεσης Μνήμης Επιστροφής (MB)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, @@ -2376,7 +2376,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SAVE_STATE, - "Κατάσταση Αποθήκευσης" + "ποθήκευση Κατάστασης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, @@ -2520,7 +2520,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_STATE_SLOT, - "State Slot" + "Θέση Κατάστασης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_STATUS, @@ -2888,35 +2888,35 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, - "YYYY-MM-DD HH:MM:SS" + "ΧΧΧΧ-ΜΜ-ΗΗ ΩΩ:ΛΛ:ΔΔ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, - "YYYY-MM-DD HH:MM" + "ΧΧΧΧ-ΜΜ-ΗΗ ΩΩ:ΛΛ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, - "MM-DD-YYYY HH:MM" + "ΜΜ-ΗΗ-ΧΧΧΧ ΩΩ:ΛΛ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, - "HH:MM:SS" + "ΩΩ:ΛΛ:ΔΔ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, - "HH:MM" + "ΩΩ:ΛΛ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, - "DD/MM HH:MM" + "ΗΗ/ΜΜ ΩΩ:ΛΛ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, - "MM/DD HH:MM" + "ΜΜ/ΗΗ ΩΩ:ΛΛ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, - "HH:MM:SS (AM/PM)" + "ΩΩ:ΛΛ:ΔΔ (ΠΜ/ΜΜ)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_TITLE_COLOR, @@ -2936,15 +2936,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE, - "Show desktop menu on startup" + "Εμφάνιση μενού επιφάνειας εργασίας κατά την εκκίνηση" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE, - "Enable desktop menu (restart)" + "Ενεργοποίηση μενού επιφάνειας εργασίας (επανεκκίνηση)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, - "Menubar" + "Γραμμή Μενού" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, @@ -2952,11 +2952,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, - "Undo Load State" + "Αναίρεση Φόρτωσης Κατάστασης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE, - "Undo Save State" + "Αναίρεση Αποθήκευσης Κατάστασης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UNKNOWN, @@ -3056,11 +3056,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, - "Black Frame Insertion" + "Εισαγωγή Μαύρων Καρέ" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, - "Crop Overscan (Reload)" + "Περικοπή Υπερσάρωσης (Επαναφόρτωση)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, @@ -3100,7 +3100,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, - "Force-disable sRGB FBO" + "Εξαναγκασμένη απενεργοποίηση sRGB FBO" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, @@ -3132,15 +3132,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, - "Max swapchain images" + "Μέγιστες εικόνες swapchain" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, - "Notification X Position" + "Θέση Ειδοποιήσης X" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, - "Notification Y Position" + "Θέση Ειδοποιήσης Y" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, @@ -3156,11 +3156,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, - "Estimated Screen Framerate" + "Εκτιμόμενος Ρυθμός Καρέ Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_POLLED, - "Set Display-Reported Refresh Rate" + "Ορισμός Ρυθμού Ανανέωσης Βάση Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, @@ -3172,7 +3172,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, - "Integer Scale" + "Ακέραια Κλίμακα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, @@ -3216,15 +3216,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SMOOTH, - "Bilinear Filtering" + "Διγραμμικό Φιλτράρισμα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SOFT_FILTER, - "Soft Filter Enable" + "Ενεργοποίηση Απαλού Φίλτρου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SWAP_INTERVAL, - "Vertical Sync (Vsync) Swap Interval" + "Διάστημα Εναλλαγής Κάθετου Συγχρονισμόυ (Vsync)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_TAB, @@ -3240,23 +3240,23 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "Custom Aspect Ratio Height" + "Προτιμώμενο Ύψος Αναλογίας Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "Custom Aspect Ratio Width" + "Προτιμώμενο Πλάτος Αναλογίας Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, - "Custom Aspect Ratio X Pos." + "Προτιμώμενη Θέση Άξωνα X Αναλογίας Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, - "Custom Aspect Ratio Y Pos." + "Προτιμώμενη Θέση Άξωνα Y Αναλογίας Οθόνης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, - "Set VI Screen Width" + "Ορισμός Πλάτους Οθόνης VI" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, @@ -3588,7 +3588,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_FPS_SHOW, - "Εμφανίζει τον τρέχον ρυθμό καρέ ανά δευτερόλεπτο στην οθόνη." + "Εμφανίζει τον τρέχων ρυθμό καρέ ανά δευτερόλεπτο στην οθόνη." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, @@ -3652,7 +3652,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, - "Sets the window size relative to the core viewport size. Alternatively, you can set a window width and height below for a fixed window size." + "Ορισμός μεγέθους παραθύρου σε σχέση με το μέγεθος της οπτικής γωνίας του πυρήνα. Διαφορετικά, παρακάτω μπορείτε να ορίσετε το πλάτος και το ύψος του παραθύρου σε σταθερό μέγεθος." ) MSG_HASH( MENU_ENUM_SUBLABEL_USER_LANGUAGE, @@ -3660,15 +3660,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, - "Inserts a black frame inbetween frames. Useful for users with 120Hz screens who want to play 60Hz content to eliminate ghosting." + "Εισάγει ένα μαύρο καρέ ανάμεσα στα καρέ. Χρήσιμο για χρήστες με οθόνες 120Hz που θέλουν να παίξουν περιεχόμενο στα 60Hz χωρίς 'φαντάσματα' στην εικόνα." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, - "Reduces latency at the cost of a higher risk of video stuttering. Adds a delay after V-Sync (in ms)." + "Μειώνει την καθυστέρηση με μεγαλύτερο κίνδυνο για κολλήματα στο βίντεο. Προσθέτει μία επιβράδυνση μετά το V-Sync (σε ms)." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, - "Sets how many frames the CPU can run ahead of the GPU when using 'Hard GPU Sync'." + "Ορίζει πόσα καρέ μπορεί ο επεξεργαστής να βρίσκεται μπροστά από την κάρτα γραφικών όταν χρησιμοποιείται τον 'Σκληρό Συγχρονισμό Κάρτα Γραφικών'." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, @@ -3680,11 +3680,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, - "The accurate estimated refresh rate of the screen in Hz." + "Ο ακριβής εκτιμόμενος ρυθμός ανανέωσης της οθόνης σε Hz." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED, - "The refresh rate as reported by the display driver." + "Ο ρυθμός ανανέωσης όπως αναφέρεται από τον οδηγό οθόνης." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, @@ -3692,7 +3692,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_WIFI_SETTINGS, - "Scans for wireless networks and establishes connection." + "Σαρώνει για ασύρματα δίκτυα και δημιουργεί σύνδεση." ) MSG_HASH( MENU_ENUM_SUBLABEL_HELP_LIST, @@ -3704,7 +3704,7 @@ MSG_HASH( ) MSG_HASH( MSG_RESET_CORE_ASSOCIATION, - "Playlist entry core association has been reset." + "Ο σύνδεση με πυρήνα της λίστας αναπαραγωγής έχει επαναφερθεί." ) MSG_HASH( MSG_APPENDED_DISK, @@ -3868,7 +3868,7 @@ MSG_HASH( ) MSG_HASH( MSG_INDEX_FILE, - "index" + "ευρετηρίου" ) MSG_HASH( MSG_DOWNLOAD_FAILED, @@ -3968,7 +3968,7 @@ MSG_HASH( ) MSG_HASH( MSG_FAILED_TO_LOAD_OVERLAY, - "Failed to load overlay." + "Αποτυχία φόρτωσης επικαλλύματος." ) MSG_HASH( MSG_FAILED_TO_LOAD_STATE, @@ -4524,7 +4524,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, - "Allows any user to control the menu. If disabled, only User 1 can control the menu." + "Επιτρέπει σε οποιονδήποτε χρήστη να χειριστεί το μενού. Εάν απενεργοποιηθεί, μόνο ο Χρήστης 1 μπορεί να χειριστει το μενού." ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_VOLUME, @@ -4548,15 +4548,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, - "How far an axis must be tilted to result in a button press." + "Πόσο μακριά ένας άξωνας πρέπει να γείρει ώστε να οδηγήσει σε πάτημα κουμπιού." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, - "Amount of seconds to wait until proceeding to the next bind." + "Χρόνος αναμονής σε δευτερόλεπτα μέχρι την συνέχιση στην επόμενη σύνδεση πλήκτρων." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_BIND_HOLD, - "Amount of seconds to hold an input to bind it." + "Δευτερόλεπτα τα οποία χρειάζεται να κρατήσετε πατημένο κάποιο κουμπί μέχρι την σύνδεση του." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, @@ -4568,7 +4568,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_VSYNC, - "Synchronizes the output video of the graphics card to the refresh rate of the screen. Recommended." + "Συγχρονίζει την έξοδο βίντεο της κάρτας γραφικών με τον ρυθμό ανανέωσης της οθόνης. Προτείνεται." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, @@ -4584,8 +4584,8 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, - "Vertical refresh rate of your screen. Used to calculate a suitable audio input rate.\n" - "NOTE: This will be ignored if 'Threaded Video' is enabled." + "Ο κάθετος ρυθμός ανανέωσης της οθόνης. Χρησιμοποιείται για τον υπολογισμό του κατάλληλου ρυθμού εισαγωγής ήχου.\n" + "ΣΗΜΕΙΩΣΗ: Αυτή η επιλογή αγνοείται εάν έχετε ενεργοποιήσει το 'Threaded Video'." ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_ENABLE, @@ -4801,28 +4801,28 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, - "Cuts off a few pixels around the edges of the image customarily left blank by developers which sometimes also contain garbage pixels." + "Αφαιρεί μερικά pixel γύρω από την εικόνα όπου εθιμικά οι προγραμματιστές άφηναν κενά ή και που περιέχουν άχρηστα pixel." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, - "Adds a slight blur to the image to take the edge off of the hard pixel edges. This option has very little impact on performance." + "Προσθέτει μία μικρή θολούρα στην εικόνα ώστε να αφαιρέσει τις σκληρές γωνίες των pixel. Αυτή η επιλογή έχει πολύ μικρή επιρροή στην επίδοση." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "Apply a CPU-powered video filter.\n" - "NOTE: Might come at a high performance cost. Some video filters might only work for cores that use 32bit or 16bit color." + "Εφαρμόστε ένα φίλτρο βίντεο που λειτουργεί με τον επεξεργαστή.\n" + "ΣΗΜΕΙΩΣΗ: Μπορεί να έχει μεγάλο κόστος στην επίδοση. Μερικά φίλτρα βίντεο μπορεί να δουλεύουν μόνο με πυρήνες που χρησιμοποιούν 32bit ή 16bit χρώμα." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, - "Input the username of your RetroAchievements account." + "Εισάγεται το όνομα χρήστη του λογαριασμού σας στο RetroAchievements." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, - "Input the password of your RetroAchievements account." + "Εισάγεται τον κωδικό πρόσβασης του λογαριασμού σας στο RetroAchievements." ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, - "Input your user name here. This will be used for netplay sessions, among other things." + "Εισάγεται το όνομα χρήστη σας εδώ. Αυτό θα χρησιμοποιηθεί για συνεδρίες netplay ανάμεσα σε άλλα πράγματα." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, @@ -4850,11 +4850,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, - "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible." + "Ορίστε το προτιμώμενο πλάτος του παραθύρου απεικόνισης. Αφήνοντας το στο 0 θα επιχειρηθεί η κλίμακα του παραθύρου να είναι όσο το δυνατόν μεγαλύτερη." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, - "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible." + "Ορίστε το προτιμώμενο ύψος του παραθύρου απεικόνισης. Αφήνοντας το στο 0 θα επιχειρηθεί η κλίμακα του παραθύρου να είναι όσο το δυνατόν μεγαλύτερη." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, @@ -4878,15 +4878,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, - "Hide the overlay while inside the menu, and show it again when exiting the menu." + "Απόκρυψη του επικαλλύματος μέσα στο μενού και εμφάνιση του ξανά με την έξοδο από το μενού." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, - "Show keyboard/controller inputs on the onscreen overlay." + "Εμφάνιση εισαγωγών πληκτρολογίου/χειριστηρίου στο επικάλλυμα οθόνης." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, - "Select the port for the overlay to listen to if Show Inputs On Overlay is enabled." + "Επιλογή της θύρας για όταν είναι ενεργοποιημένη η επιλογή 'Εμφάνιση Εισαγωγών Στην Οθόνη'" ) MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, @@ -4894,7 +4894,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, - "Only scales video in integer steps. The base size depends on system-reported geometry and aspect ratio. If 'Force Aspect' is not set, X/Y will be integer scaled independently." + "Αλλαγή κλίμακας βίντεο σε ακέραια βήματα. Το βασικό μέγεθος εξαρτάται από την γεωμετρία και την κλίμακα οθόνης του συστήματος. Εάν η 'Εξαναγκασμένη Κλίμακα' δεν έχει οριστεί, οι άξωνες X/Y θα αλλάζουν κλίμακα ξεχωριστά." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, @@ -4954,7 +4954,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, - "Enable rewinding. This will take a performance hit when playing." + "Ενεργοποίηση επιστροφής. Η επίδοση θα πέσει κατά το παιχνίδι." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE, @@ -5115,11 +5115,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, - "Swap buttons for OK/Cancel. Disabled is the Japanese button orientation, enabled is the western orientation." + "Εναλλαγή πλήτρκων για Επιβεβαίωση/Ακύρωση. Απενεργοποιημένο είναι ο Ιαπωνικός προσανατολισμός, ενεργοποιημένος είναι ο δυτικός προσανατολισμός." ) MSG_HASH( MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO, - "If disabled, the content will keep running in the background when RetroArch's menu is toggled." + "Εάν απενεργοποιηθεί το περιεχόμενο θα συνεχίσει να τρέχει στο παρασκήνιο όταν το μενού του RetroArch είναι ανοικτό." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_DRIVER, @@ -5191,19 +5191,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_OPACITY, - "Opacity of all UI elements of the overlay." + "Διαφάνεια όλων των στοιχείων του επικαλλύματος." ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_SCALE, - "Scale of all UI elements of the overlay." + "Κλίμακα όλων των στοιχείων του επικαλλύματος." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE, - "Enable the overlay." + "Ενεργοποίηση του επικαλλύματος." ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_PRESET, - "Select an overlay from the file browser." + "Επιλογή ενός επικαλλύματος από τον περιηγητή αρχείων." ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, @@ -5307,7 +5307,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, - "Uses a custom swap interval for Vsync. Set this to effectively halve monitor refresh rate." + "Χρησιμοποιεί ένα προτιμώμενο διάστημα αλλαγής για το Vsync. Ορίστε αυτό ώστε να μειώσεται στο μισό τον ρυθμό ανανέωσης της οθόνης αποτελεσματικά." ) MSG_HASH( MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, @@ -5387,51 +5387,51 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, - "Captures an image of the screen." + "Καταγράφει μία εικόνα της οθόνης." ) MSG_HASH( MENU_ENUM_SUBLABEL_CLOSE_CONTENT, - "Closes the current content. Any unsaved changes might be lost." + "Κλείνει το τρέχον περιεχόμενο. Οποιεσδήποτε μη αποθηκευμένες αλλαγές μπορεί να χαθούν." ) MSG_HASH( MENU_ENUM_SUBLABEL_LOAD_STATE, - "Load a saved state from the currently selected slot." + "Φόρτωση μίας κατάστασης από την τρέχουσα θέση." ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVE_STATE, - "Save a state to the currently selected slot." + "Αποθήκευση μίας κατάστασης στην τρέχουσα θέση." ) MSG_HASH( MENU_ENUM_SUBLABEL_RESUME, - "Resume the currently running content and leave the Quick Menu." + "Συνέχιση εκτέλεσης του τρέχοντος περιεχομένου και έξοδος από το Γρήγορο Μενού." ) MSG_HASH( MENU_ENUM_SUBLABEL_RESUME_CONTENT, - "Resume the currently running content and leave the Quick Menu." + "Συνέχιση εκτέλεσης του τρέχοντος περιεχομένου και έξοδος από το Γρήγορο Μενού." ) MSG_HASH( MENU_ENUM_SUBLABEL_STATE_SLOT, - "Changes the currently selected state slot." + "Αλλάζει την τρέχουσα επιλεγμένη θέση κατάστασης." ) MSG_HASH( MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, - "If a state was loaded, content will go back to the state prior to loading." + "Εάν μία κατάσταση φορτώθηκε, το περιεχόμενο θα επιστρέψει στην κατάσταση πριν την φόρτωση." ) MSG_HASH( MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, - "If a state was overwritten, it will roll back to the previous save state." + "Εάν μία κατάσταση αντικαταστάθηκε, το περιεχόμενο θα επιστρέψει στην προηγούμενη κατάσταση αποθήκευσης." ) MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, - "RetroAchievements service. For more information, visit http://retroachievements.org" + "Υπηρεσία RetroAchievements. Για περισσότερες πληροφορίες επισκεφθείτε το http://retroachievements.org" ) MSG_HASH( MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, - "Manages currently configured accounts." + "Διαχειρίζεται τους τρέχοντες διαμορφωμένους λογαριασμούς." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_META_REWIND, - "Manages rewind settings." + "Διαχειρίζεται τις ρυθμίσεις επαναφοράς." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_DETAILS, @@ -5443,7 +5443,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_RESTART_CONTENT, - "Restarts the content from the beginning." + "Επανεκκινεί το περιεχόμενο από την αρχή." ) MSG_HASH( MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, @@ -5459,19 +5459,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, - "Set up cheat codes." + "Στήσιμο κωδικών απάτης." ) MSG_HASH( MENU_ENUM_SUBLABEL_SHADER_OPTIONS, - "Set up shaders to visually augment the image." + "Στήσιμο σκιάσεων για την οπτική βελτίωση της εικόνας." ) MSG_HASH( MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS, - "Change the controls for the currently running content." + "Αλλαγή χειρισμών για το τρέχον εκτελούμενο περιεχόμενο." ) MSG_HASH( MENU_ENUM_SUBLABEL_CORE_OPTIONS, - "Change the options for the currently running content." + "Αλλαγή επιλογών για το τρέχον εκτελούμενο περιεχόμενο." ) MSG_HASH( MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, @@ -5483,7 +5483,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, - "Allow the user to remove entries from collections." + "Επιτρέψτε στον χρήστη να καταργεί τις καταχωρήσεις από την συλλογή." ) MSG_HASH( MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, @@ -5684,11 +5684,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, - "Defines a directory where overlays are kept for easy access." + "Ορίζει ένα ευρετήριο όπου τα επικαλλύματα αποθηκεύονται για εύκολη πρόσβαση." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH, - "Cheat files are kept here." + "Τα αρχεία απάτης αποθηκεύονται εδώ." ) MSG_HASH( MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR, @@ -5780,7 +5780,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, - "Quickly access all relevant in-game settings." + "Γρήγορα πρόσβαση σε όλες τις σχετικές ρυθμίσεις παιχνιδιού." ) MSG_HASH( MENU_ENUM_SUBLABEL_CORE_INFORMATION, @@ -5792,19 +5792,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "Custom viewport height that is used if the Aspect Ratio is set to 'Custom'." + "Προτιμώμενο ύψος οπτικής γωνίας το οποίο χρησιμοποιείται εάν η Αναλογία Οθόνης είναι ορισμένη ως 'Προτιμώμενη'." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "Custom viewport width that is used if the Aspect Ratio is set to 'Custom'." + "Προτιμώμενο πλάτος οπτικής γωνίας το οποίο χρησιμοποιείται εάν η Αναλογία Οθόνης είναι ορισμένη ως 'Προτιμώμενη'." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, - "Custom viewport offset used for defining the X-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then." + "Προτιμώμενη απόκλειση οπτικής γωνίας για τον ορισμό της θέσης του άξωνα X της οπτικής γωνίας. Αυτό αγνοείται εάν έχεται ενεργοποιήσει την 'Ακέραια Κλίμακα'. Τότε θα κεντραριστεί αυτόματα." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, - "Custom viewport offset used for defining the Y-axis position of the viewport. These are ignored if 'Integer Scale' is enabled. It will be automatically centered then." + "Προτιμώμενη απόκλειση οπτικής γωνίας για τον ορισμό της θέσης του άξωνα Y της οπτικής γωνίας. Αυτό αγνοείται εάν έχεται ενεργοποιήσει την 'Ακέραια Κλίμακα'. Τότε θα κεντραριστεί αυτόματα." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, @@ -5976,15 +5976,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, - "Allow the user to rename entries in collections." + "Επιτρέψτε στον χρήστη να μετονομάζει τις καταχωρήσεις στην συλλογή." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, - "Allow to rename entries" + "Επίτρεψη μετονομασίας καταχωρήσεων" ) MSG_HASH( MENU_ENUM_SUBLABEL_RENAME_ENTRY, - "Rename the title of the entry." + "Μετονομασία του τίτλου αυτής της καταχώρησης." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, @@ -6264,7 +6264,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, - "Window Opacity" + "Διαφάνεια Παραθύρου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, @@ -6284,7 +6284,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, - "Show Window Decorations" + "Εμφάνιση Διακοσμητικών Παραθύρου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, @@ -7545,7 +7545,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, - "Το V-Sync είναι ενεργοποιημένο μέχρι η επίδοση να πέσει κάτω από τον στόχο ρυθμού ανανέωσης. Μπορεί να μιώσει τα κολλήματα όταν η επίδοση πέφτει χαμηλότερα από τον κανονικό χρόνο και μπορεί να είναι πιο αποδοτικό ενεργειακά." + "Το V-Sync είναι ενεργοποιημένο μέχρι η επίδοση να πέσει κάτω από τον στόχο ρυθμού ανανέωσης. Μπορεί να μειώσει τα κολλήματα όταν η επίδοση πέφτει χαμηλότερα από τον κανονικό χρόνο και μπορεί να είναι πιο αποδοτικό ενεργειακά." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, From 66e7c73193219122de20fcd77bd459948c93aa5d Mon Sep 17 00:00:00 2001 From: Themaister Date: Thu, 18 Oct 2018 23:37:45 +0200 Subject: [PATCH 0387/1292] Keep enable state the same after loading new overlay. --- gfx/drivers/vulkan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index a65ee5e477..140dbff7b7 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -2619,6 +2619,7 @@ static bool vulkan_overlay_load(void *data, const void *image_data, unsigned num_images) { unsigned i, j; + bool old_enabled; const struct texture_image *images = (const struct texture_image*)image_data; vk_t *vk = (vk_t*)data; @@ -2636,6 +2637,7 @@ static bool vulkan_overlay_load(void *data, #ifdef HAVE_THREADS slock_unlock(vk->context->queue_lock); #endif + old_enabled = vk->overlay.enable; vulkan_overlay_free(vk); vk->overlay.images = (struct vk_texture*) @@ -2663,6 +2665,7 @@ static bool vulkan_overlay_load(void *data, vk->overlay.vertex[4 * i + j].color = white; } + vk->overlay.enable = old_enabled; return true; error: From d03c0be71d4ec1920c9edb4f2f3b0fcab0fcc430 Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Thu, 18 Oct 2018 16:38:02 -0700 Subject: [PATCH 0388/1292] Rewrite file hasher to limit amount hashed == DETAILS Since the content file could potentially be huge, hashing the whole thing at runtime may take a really long time. Plus, it was loading the whole file into RAM at once. Now, we only load 1MB at a time and hash up to the first 64MB. == TESTING I don't have any large content files to test it with, but I tested it with a small one and confirmed that the hash was correct. --- libretro-common/encodings/encoding_crc32.c | 47 ++++++++++++++++++---- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/libretro-common/encodings/encoding_crc32.c b/libretro-common/encodings/encoding_crc32.c index 45800e82a6..4dd932db6a 100644 --- a/libretro-common/encodings/encoding_crc32.c +++ b/libretro-common/encodings/encoding_crc32.c @@ -91,17 +91,50 @@ uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len) return crc ^ 0xffffffff; } +#define CRC32_BUFFER_SIZE 1048576 +#define CRC32_MAX_MB 64 + +/** + * Calculate a CRC32 from the first part of the given file. + * "first part" being the first (CRC32_BUFFER_SIZE * CRC32_MAX_MB) + * bytes. + * TODO: maybe make these numbers configurable? + * + * Returns: the crc32, or 0 if there was an error. + */ uint32_t file_crc32(uint32_t crc, const char *path) { if(path == NULL) return 0; - void *file_bytes = NULL; - int64_t file_len = 0; + RFILE *file = NULL; + unsigned char *buf = NULL; + int i, nread; - if(filestream_read_file(path, &file_bytes, &file_len)) { - crc = encoding_crc32(crc, (uint8_t *)file_bytes, file_len); - free(file_bytes); - return crc; + file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0); + if(file == NULL) + goto error; + + buf = (char *)malloc(CRC32_BUFFER_SIZE); + if(buf == NULL) + goto error; + + for(i = 0; i < CRC32_MAX_MB; i++) { + nread = filestream_read(file, buf, CRC32_BUFFER_SIZE); + if(nread < 0) + goto error; + + crc = encoding_crc32(crc, buf, nread); + if(filestream_eof(file)) + break; } - return 0; + free(buf); + filestream_close(file); + return crc; + + error: + if(buf) + free(buf); + if(file) + filestream_close(file); + return 0; } From dc181968442d03c403610fe6636981438016f31b Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Thu, 18 Oct 2018 16:44:30 -0700 Subject: [PATCH 0389/1292] get rid of TODO --- libretro-common/encodings/encoding_crc32.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libretro-common/encodings/encoding_crc32.c b/libretro-common/encodings/encoding_crc32.c index 4dd932db6a..85881e521b 100644 --- a/libretro-common/encodings/encoding_crc32.c +++ b/libretro-common/encodings/encoding_crc32.c @@ -98,7 +98,6 @@ uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len) * Calculate a CRC32 from the first part of the given file. * "first part" being the first (CRC32_BUFFER_SIZE * CRC32_MAX_MB) * bytes. - * TODO: maybe make these numbers configurable? * * Returns: the crc32, or 0 if there was an error. */ From ab1242f368c1da053edacb68beaeb1c34dbc8136 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Thu, 18 Oct 2018 19:03:10 -0700 Subject: [PATCH 0390/1292] fix(cocoa): Move sendEvent implementation to RAWindow Introduced independent Info_Metal.plist and MainMenu_Metal.xib files, to avoid breaking earlier builds. --- pkg/apple/BaseConfig.xcconfig | 1 + pkg/apple/OSX/Info_Metal.plist | 49 +++ pkg/apple/OSX/en.lproj/MainMenu_Metal.xib | 342 ++++++++++++++++++ .../RetroArch_Metal.xcodeproj/project.pbxproj | 26 +- ui/drivers/ui_cocoa.m | 15 +- 5 files changed, 406 insertions(+), 27 deletions(-) create mode 100644 pkg/apple/OSX/Info_Metal.plist create mode 100644 pkg/apple/OSX/en.lproj/MainMenu_Metal.xib diff --git a/pkg/apple/BaseConfig.xcconfig b/pkg/apple/BaseConfig.xcconfig index d1386170a1..0ff10b6737 100644 --- a/pkg/apple/BaseConfig.xcconfig +++ b/pkg/apple/BaseConfig.xcconfig @@ -12,3 +12,4 @@ DEPS_DIR = $(SRCBASE)/deps HEADER_SEARCH_PATHS = $(inherited) $(SRCBASE) $(SRCBASE)/gfx/include $(SRCBASE)/libretro-common/include $(DEPS_DIR)/libFLAC/include $(DEPS_DIR)/7zip $(DEPS_DIR)/stb $(DEPS_DIR) $(DEPS_DIR)/SPIRV-Cross $(DEPS_DIR)/glslang $(DEPS_DIR)/glslang/glslang/glslang/Public $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent $(DEPS_DIR)/glslang/glslang/SPIRV $(DEPS_DIR)/glslang/glslang/glslang/OSDependent/Unix CLANG_CXX_LANGUAGE_STANDARD=c++11 CLANG_ENABLE_OBJC_ARC=YES +INFOPLIST_FILE = $(SRCROOT)/OSX/Info_Metal.plist diff --git a/pkg/apple/OSX/Info_Metal.plist b/pkg/apple/OSX/Info_Metal.plist new file mode 100644 index 0000000000..72c6354868 --- /dev/null +++ b/pkg/apple/OSX/Info_Metal.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + * + + CFBundleTypeName + All Files + CFBundleTypeRole + Viewer + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + retroarch + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.7.5 + CFBundleSignature + ???? + CFBundleVersion + 1.7.5 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSHighResolutionCapable + + NSHumanReadableCopyright + Copyright © 2018 RetroArch. All rights reserved. + NSMainNibFile + MainMenu_Metal + NSPrincipalClass + NSApplication + + diff --git a/pkg/apple/OSX/en.lproj/MainMenu_Metal.xib b/pkg/apple/OSX/en.lproj/MainMenu_Metal.xib new file mode 100644 index 0000000000..934ee76845 --- /dev/null +++ b/pkg/apple/OSX/en.lproj/MainMenu_Metal.xib @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index e4dcacd08a..471b781c50 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0502387C2179713000789627 /* MainMenu_Metal.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */; }; 05269A6220ABF20500C29F1E /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05269A6120ABF20500C29F1E /* MetalKit.framework */; }; 053FC26521433F2200D98D46 /* QtWidgets.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25721433F1800D98D46 /* QtWidgets.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 053FC270214340F500D98D46 /* QtGui.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25321433F1700D98D46 /* QtGui.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; @@ -14,7 +15,6 @@ 053FC272214341E000D98D46 /* QtConcurrent.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25521433F1700D98D46 /* QtConcurrent.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 053FC275214341F000D98D46 /* QtCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 053FC25421433F1700D98D46 /* QtCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 05422E3E2140C8DB00F09961 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; - 05422E3F2140C8DB00F09961 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 05422E402140C8DB00F09961 /* retroarch.icns in Resources */ = {isa = PBXBuildFile; fileRef = 84DD5EB71A89F1C7007336C1 /* retroarch.icns */; }; 05422E432140C8DB00F09961 /* griffin_glslang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753420A5678400646447 /* griffin_glslang.cpp */; }; 05422E442140C8DB00F09961 /* menu_pipeline.metal in Sources */ = {isa = PBXBuildFile; fileRef = 05770B9820E805160013DABC /* menu_pipeline.metal */; }; @@ -40,7 +40,6 @@ 05A8E23C20A63CF50084ABDA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A8E23B20A63CF50084ABDA /* QuartzCore.framework */; }; 05D7753520A567A400646447 /* griffin_cpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753320A5678300646447 /* griffin_cpp.cpp */; }; 05D7753720A567A700646447 /* griffin_glslang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753420A5678400646447 /* griffin_glslang.cpp */; }; - 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 5061C8A41AE47E510080AE14 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5061C8A31AE47E510080AE14 /* libz.dylib */; }; 509F0C9D1AA23AFC00619ECC /* griffin_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 509F0C9C1AA23AFC00619ECC /* griffin_objc.m */; }; 840222FC1A889EE2009AB261 /* griffin.c in Sources */ = {isa = PBXBuildFile; fileRef = 840222FB1A889EE2009AB261 /* griffin.c */; }; @@ -52,6 +51,7 @@ 84DD5EB51A89E737007336C1 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84DD5EB41A89E737007336C1 /* IOKit.framework */; }; 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */ = {isa = PBXBuildFile; fileRef = 84DD5EB71A89F1C7007336C1 /* retroarch.icns */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + A90209ED44A1161587F10CA4 /* MainMenu_Metal.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -534,7 +534,6 @@ 05F2874020F2BEEA00632D47 /* task_http.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_http.c; sourceTree = ""; }; 05F2874120F2BEEA00632D47 /* task_patch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_patch.c; sourceTree = ""; }; 089C165DFE840E0CC02AAC07 /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = OSX/en.lproj/InfoPlist.strings; sourceTree = ""; }; - 1DDD58150DA1D0A300B32029 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = OSX/en.lproj/MainMenu.xib; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 5061C8A31AE47E510080AE14 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 509F0C9C1AA23AFC00619ECC /* griffin_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = griffin_objc.m; path = ../../griffin/griffin_objc.m; sourceTree = ""; }; @@ -547,9 +546,10 @@ 84DD5EB21A89E6C0007336C1 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; 84DD5EB41A89E737007336C1 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = ../../../../../../System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 84DD5EB71A89F1C7007336C1 /* retroarch.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = retroarch.icns; path = ../../media/retroarch.icns; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = OSX/Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; }; A902040DE66D42F9EE47BFE3 /* MenuDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuDisplay.h; sourceTree = ""; }; + A90205FD4D5979BD8B7E4DD6 /* Info_Metal.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.info; name = Info_Metal.plist; path = OSX/Info_Metal.plist; sourceTree = ""; }; + A902065A41AEBECE594908C7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = OSX/en.lproj/MainMenu_Metal.xib; sourceTree = ""; }; A902070F2C43F222FD56A95A /* MenuDisplay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuDisplay.m; sourceTree = ""; }; A90207489289602F593626D5 /* QTConfig.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = QTConfig.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1445,9 +1445,9 @@ isa = PBXGroup; children = ( 84DD5EB71A89F1C7007336C1 /* retroarch.icns */, - 8D1107310486CEB800E47090 /* Info.plist */, + A90205FD4D5979BD8B7E4DD6 /* Info_Metal.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, - 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */, ); name = Resources; sourceTree = ""; @@ -1564,8 +1564,8 @@ buildActionMask = 2147483647; files = ( 05422E3E2140C8DB00F09961 /* InfoPlist.strings in Resources */, - 05422E3F2140C8DB00F09961 /* MainMenu.xib in Resources */, 05422E402140C8DB00F09961 /* retroarch.icns in Resources */, + 0502387C2179713000789627 /* MainMenu_Metal.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1574,8 +1574,8 @@ buildActionMask = 2147483647; files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, - 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */, + A90209ED44A1161587F10CA4 /* MainMenu_Metal.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1649,12 +1649,12 @@ name = InfoPlist.strings; sourceTree = ""; }; - 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */ = { isa = PBXVariantGroup; children = ( - 1DDD58150DA1D0A300B32029 /* MainMenu.xib */, + A902065A41AEBECE594908C7 /* en */, ); - name = MainMenu.xib; + name = MainMenu_Metal.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ @@ -1671,7 +1671,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "@rpath"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1693,7 +1692,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "@rpath"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1716,7 +1714,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; @@ -1734,7 +1731,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; - INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_BUNDLE_IDENTIFIER = "libretro.${PRODUCT_NAME:rfc1034identifier}"; diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index b248d5ae9e..2f52f5d06c 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -89,10 +89,10 @@ static void app_terminate(void) [[NSApplication sharedApplication] terminate:nil]; } -@interface RApplication : NSApplication +@interface RAWindow : NSWindow @end -@implementation RApplication +@implementation RAWindow #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define NSEventTypeKeyDown NSKeyDown @@ -119,18 +119,9 @@ static void app_terminate(void) #define NSEventModifierFlagNumericPad NSNumericPadKeyMask #endif -- (void)sendEvent:(NSEvent *)event -{ +- (void)sendEvent:(NSEvent *)event { [super sendEvent:event]; - RetroArch_OSX *delegate = (RetroArch_OSX *)self.delegate; - if (event.window != delegate.window) { - // TODO(sgc): this is just a hack for the 1.7.5 release to - // ignore RA processing events that are not for the RA window. - // Ideally, we'de delegate `sendEvent` to the window listener - return; - } - cocoa_input_data_t *apple = NULL; NSEventType event_type = event.type; From c55e65c895c71c4474130d13d6c7a4e727f3ac33 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 19 Oct 2018 07:41:41 +0200 Subject: [PATCH 0391/1292] Change this to vita2d --- configuration.c | 2 +- menu/drivers_display/menu_display_vita2d.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration.c b/configuration.c index b24f242133..676738e2f1 100644 --- a/configuration.c +++ b/configuration.c @@ -2376,7 +2376,7 @@ static bool check_menu_driver_compatibility(void) string_is_equal(video_driver, "gx2") || string_is_equal(video_driver, "vulkan") || string_is_equal(video_driver, "metal") || - string_is_equal(video_driver, "vita")) + string_is_equal(video_driver, "vita2d")) return true; return false; diff --git a/menu/drivers_display/menu_display_vita2d.c b/menu/drivers_display/menu_display_vita2d.c index e0edb878c1..d97b3f2437 100644 --- a/menu/drivers_display/menu_display_vita2d.c +++ b/menu/drivers_display/menu_display_vita2d.c @@ -247,7 +247,7 @@ menu_display_ctx_driver_t menu_display_ctx_vita2d = { menu_display_vita2d_get_default_tex_coords, menu_display_vita2d_font_init_first, MENU_VIDEO_DRIVER_VITA2D, - "menu_display_vita2d", + "vita2d", true, NULL, NULL From a1bc9805ced44b9751faa8a776b5c308b6a028b6 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 19 Oct 2018 07:44:24 +0200 Subject: [PATCH 0392/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 01287f3df7..b284e65319 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. - VULKAN: Fix RGUI crashing at startup. +- VULKANL Fix secondary screens in overlays not working. - WINDOWS/WSA: Network Information info is blank until first network operation. - WIIU: Initial netplay peer-to-peer support. Network information working. From 222e5faab8498a505ff2ccbd807b2a363f36d94f Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 19 Oct 2018 07:44:35 +0200 Subject: [PATCH 0393/1292] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index b284e65319..4552019215 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,7 +10,7 @@ - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. - VULKAN: Fix RGUI crashing at startup. -- VULKANL Fix secondary screens in overlays not working. +- VULKAN: Fix secondary screens in overlays not working. - WINDOWS/WSA: Network Information info is blank until first network operation. - WIIU: Initial netplay peer-to-peer support. Network information working. From 882a25326c6f24fc391854bdf4d42ac9a3bb02dd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 20 Oct 2018 03:04:53 +0200 Subject: [PATCH 0394/1292] Add ctr to the list too --- configuration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/configuration.c b/configuration.c index 676738e2f1..ceac27d6c2 100644 --- a/configuration.c +++ b/configuration.c @@ -2376,6 +2376,7 @@ static bool check_menu_driver_compatibility(void) string_is_equal(video_driver, "gx2") || string_is_equal(video_driver, "vulkan") || string_is_equal(video_driver, "metal") || + string_is_equal(video_driver, "ctr") || string_is_equal(video_driver, "vita2d")) return true; From 82c3103f82c4cb204294aa58ad6694fd5133184d Mon Sep 17 00:00:00 2001 From: Alfrix Date: Sat, 20 Oct 2018 09:50:06 -0300 Subject: [PATCH 0395/1292] Fix Wunused complains --- menu/menu_setting.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 5ac6ca9464..6bfe680545 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -632,6 +632,7 @@ static void setting_get_string_representation_uint_xmb_layout( } } +#ifdef HAVE_MATERIALUI static void setting_get_string_representation_uint_materialui_menu_color_theme( rarch_setting_t *setting, char *s, size_t len) @@ -680,6 +681,7 @@ static void setting_get_string_representation_uint_materialui_menu_color_theme( break; } } +#endif static void setting_get_string_representation_uint_xmb_menu_color_theme( rarch_setting_t *setting, @@ -765,6 +767,7 @@ static void setting_get_string_representation_uint_xmb_menu_color_theme( } } +#ifdef HAVE_SHADERPIPELINE static void setting_get_string_representation_uint_xmb_shader_pipeline( rarch_setting_t *setting, char *s, size_t len) @@ -809,6 +812,7 @@ static void setting_get_string_representation_uint_xmb_shader_pipeline( break; } } +#endif static void setting_get_string_representation_uint_video_monitor_index(rarch_setting_t *setting, char *s, size_t len) From 365fb4b4eb581c0b060f2a9ab5a6294fcc3098f9 Mon Sep 17 00:00:00 2001 From: DEX357 Date: Sat, 20 Oct 2018 20:36:59 +0200 Subject: [PATCH 0396/1292] Update msg_hash_pl.h --- intl/msg_hash_pl.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 26ed0fd143..6d529b1503 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3705,11 +3705,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, - "Record Quality" + "Jakość rekordu" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, - "Stream Quality" + "Jakość strumienia" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_STREAMING_URL, @@ -3717,7 +3717,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, - "UDP Stream Port" + "Port Strumienia UDP" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, @@ -3728,22 +3728,22 @@ MSG_HASH( "YouTube" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, - "Twitch Stream Key") + "Klucz strumienia Twitch") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, - "YouTube Stream Key") + "Klucz strumienia YouTube") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, - "Streaming Mode") + "Tryb przesyłania strumieniowego") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, - "Title of Stream") + "Tytuł strumienia") MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, - "Split Joy-Con" + "Podziel Joy-Con" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, - "Reset To Defaults" + "Przywróć domyślne" ) MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, - "Reset the current configuration to default values." + "Zresetuj bieżącą konfigurację do wartości domyślnych." ) From 726de8e447d9a688751b8e8373c7a91078e824a8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 21 Oct 2018 05:40:50 +0200 Subject: [PATCH 0397/1292] Apply diff to fix #6382 --- audio/audio_driver.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/audio/audio_driver.c b/audio/audio_driver.c index d0cc9d6497..cae227e790 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -796,6 +796,9 @@ size_t audio_driver_sample_batch(const int16_t *data, size_t frames) **/ void audio_driver_sample_rewind(int16_t left, int16_t right) { + if (audio_driver_rewind_ptr == 0) + return; + audio_driver_rewind_buf[--audio_driver_rewind_ptr] = right; audio_driver_rewind_buf[--audio_driver_rewind_ptr] = left; } @@ -819,7 +822,10 @@ size_t audio_driver_sample_batch_rewind(const int16_t *data, size_t frames) size_t samples = frames << 1; for (i = 0; i < samples; i++) - audio_driver_rewind_buf[--audio_driver_rewind_ptr] = data[i]; + { + if (audio_driver_rewind_ptr > 0) + audio_driver_rewind_buf[--audio_driver_rewind_ptr] = data[i]; + } return frames; } @@ -905,11 +911,13 @@ void audio_driver_setup_rewind(void) for (i = 0; i < audio_driver_data_ptr; i += 2) { - audio_driver_rewind_buf[--audio_driver_rewind_ptr] = - audio_driver_output_samples_conv_buf[i + 1]; + if (audio_driver_rewind_ptr > 0) + audio_driver_rewind_buf[--audio_driver_rewind_ptr] = + audio_driver_output_samples_conv_buf[i + 1]; - audio_driver_rewind_buf[--audio_driver_rewind_ptr] = - audio_driver_output_samples_conv_buf[i + 0]; + if (audio_driver_rewind_ptr > 0) + audio_driver_rewind_buf[--audio_driver_rewind_ptr] = + audio_driver_output_samples_conv_buf[i + 0]; } audio_driver_data_ptr = 0; From e5b9ca518764b9844e4e6925f4d64370ba814b73 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 21 Oct 2018 05:43:23 +0200 Subject: [PATCH 0398/1292] Silence code warnings --- libretro-common/encodings/encoding_crc32.c | 43 +++++++++++----------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/libretro-common/encodings/encoding_crc32.c b/libretro-common/encodings/encoding_crc32.c index 85881e521b..9724f3eff7 100644 --- a/libretro-common/encodings/encoding_crc32.c +++ b/libretro-common/encodings/encoding_crc32.c @@ -101,39 +101,40 @@ uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len) * * Returns: the crc32, or 0 if there was an error. */ -uint32_t file_crc32(uint32_t crc, const char *path) { - if(path == NULL) - return 0; - - RFILE *file = NULL; +uint32_t file_crc32(uint32_t crc, const char *path) +{ + unsigned i; + RFILE *file = NULL; unsigned char *buf = NULL; - int i, nread; + if (!path) + return 0; file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0); - if(file == NULL) + if (!file) goto error; - buf = (char *)malloc(CRC32_BUFFER_SIZE); - if(buf == NULL) - goto error; + buf = (unsigned char*)malloc(CRC32_BUFFER_SIZE); + if (!buf) + goto error; - for(i = 0; i < CRC32_MAX_MB; i++) { - nread = filestream_read(file, buf, CRC32_BUFFER_SIZE); - if(nread < 0) - goto error; + for(i = 0; i < CRC32_MAX_MB; i++) + { + int nread = filestream_read(file, buf, CRC32_BUFFER_SIZE); + if (nread < 0) + goto error; crc = encoding_crc32(crc, buf, nread); - if(filestream_eof(file)) + if (filestream_eof(file)) break; } free(buf); filestream_close(file); return crc; - error: - if(buf) - free(buf); - if(file) - filestream_close(file); - return 0; +error: + if (buf) + free(buf); + if (file) + filestream_close(file); + return 0; } From 1e6503c0d93d02e4de7943e11e95c01679a3cf3f Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Sun, 21 Oct 2018 15:57:05 -0700 Subject: [PATCH 0399/1292] fix(cocoa): Use RApplication for OpenGL --- ui/drivers/ui_cocoa.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index 2f52f5d06c..7d5330f2d6 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -88,11 +88,17 @@ static void app_terminate(void) { [[NSApplication sharedApplication] terminate:nil]; } - +#ifdef HAVE_METAL @interface RAWindow : NSWindow @end @implementation RAWindow +#else +@interface RApplication : NSApplication +@end + +@implementation RApplication +#endif #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define NSEventTypeKeyDown NSKeyDown From c17135df3e9dc9a5bfa37a20045fa09c4a628ca5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 23 Oct 2018 02:42:06 +0200 Subject: [PATCH 0400/1292] Revert "Use sceCtrlIsMultiControllerSupported to detect" This reverts commit ef10b7897dfbb56cd56735287896b08dfedd8365. --- input/drivers_joypad/psp_joypad.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index 943d4a0721..309a8a0f3c 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -34,6 +34,7 @@ #include #include #define PSP_MAX_PADS 4 +static int psp2_model; static SceCtrlPortInfo old_ctrl_info, curr_ctrl_info; static SceCtrlActuator actuators[PSP_MAX_PADS] = {0}; @@ -63,7 +64,7 @@ extern uint64_t lifecycle_state; static const char *psp_joypad_name(unsigned pad) { #ifdef VITA - if (!sceCtrlIsMultiControllerSupported()) + if (psp2_model != SCE_KERNEL_MODEL_VITATV) return "Vita Controller"; switch (curr_ctrl_info.port[pad + 1]) @@ -88,7 +89,8 @@ static bool psp_joypad_init(void *data) (void)data; #if defined(VITA) - if (!sceCtrlIsMultiControllerSupported()) + psp2_model = sceKernelGetModelForCDialog(); + if (psp2_model != SCE_KERNEL_MODEL_VITATV) { sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START); sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); @@ -190,7 +192,7 @@ static void psp_joypad_poll(void) #endif #ifdef VITA - if (!sceCtrlIsMultiControllerSupported()) + if (psp2_model != SCE_KERNEL_MODEL_VITATV) players_count = 1; else { @@ -235,7 +237,7 @@ static void psp_joypad_poll(void) SceCtrlData state_tmp; unsigned i = player; #if defined(VITA) - unsigned p = (sceCtrlIsMultiControllerSupported()) ? player + 1 : player; + unsigned p = (psp2_model == SCE_KERNEL_MODEL_VITATV) ? player + 1 : player; if (curr_ctrl_info.port[p] == SCE_CTRL_TYPE_UNPAIRED) continue; #elif defined(SN_TARGET_PSP2) @@ -259,7 +261,7 @@ static void psp_joypad_poll(void) continue; #endif #if defined(VITA) - if (!sceCtrlIsMultiControllerSupported() + if (psp2_model == SCE_KERNEL_MODEL_VITA && settings->bools.input_backtouch_enable) { unsigned i; @@ -330,7 +332,7 @@ static bool psp_joypad_rumble(unsigned pad, enum retro_rumble_effect effect, uint16_t strength) { #ifdef VITA - if (!sceCtrlIsMultiControllerSupported()) + if (psp2_model != SCE_KERNEL_MODEL_VITATV) return false; switch (effect) From ccceabc5410814ef6a6ad5413ae55211d6e40b31 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Tue, 23 Oct 2018 16:43:28 +0100 Subject: [PATCH 0401/1292] Added Makefile.classic_armv7_a7 --- Makefile.classic_armv7_a7 | 74 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Makefile.classic_armv7_a7 diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 new file mode 100644 index 0000000000..c635df8929 --- /dev/null +++ b/Makefile.classic_armv7_a7 @@ -0,0 +1,74 @@ +# Make sure you have patchelf installed (sudo apt-get install patchelf) to patch the binary for Hakchi. +# Might not be needed for your build but it's a useful tool and for safety it should be run anyway to +# ensure the SDL2 link isn't broken... + +# Classic Readme Variables ############ + +CLASSIC_MODS_VER := CLASSIC_MODS_Retroarch_Neo_v1_7_5b +CLASSIC_MODS_NAME := CLASSIC_MODS RetroArch 'Neo' v1.7.5b +MOD_CREATOR := TheOtherGuys +MOD_CATEGORY := RetroArch +GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`") + +# Platform dependant Variables ######## +HAKCHI_DIR := RA_Platform-Hakchi +HAKCHI_GIT := https://github.com/Classicmods/RA_Platform-Hakchi + +# General Shared Variables ############ +TARGET := retroarch +CC_V = arm-linux-gnueabihf-gcc-8 +CXX_V = arm-linux-gnueabihf-g++-8 +AS_V = arm-linux-gnueabihf-as +CC_AS_V = arm-linux-gnueabihf-gcc-8 + +all: $(TARGET) + +retroarch: + #Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7) + patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf) + ./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard + make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 -j #Cook it + patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary... + + #HAKCHI BUILD (NESC, SNESC) + @echo "** BUILDING CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **" + rm -fr /tmp/$(HAKCHI_DIR) + cd /tmp/; git clone $(HAKCHI_GIT) + cp retroarch /tmp/$(HAKCHI_DIR)/bin/retroarch + echo $$(echo "Built by: " $$USER @ $$(date) \\\\\\ Git Commit: $(GIT_COMMIT)) > /tmp/$(HAKCHI_DIR)/etc/libretro/retroarch_version + cp /tmp/$(HAKCHI_DIR)/readme.md /tmp/$(HAKCHI_DIR)/readme_COPY.md + printf "%s\n" \ + "---" \ + "Name: $(CLASSIC_MODS_NAME)" \ + "Creator: $(MOD_CREATOR)" \ + "Category: $(MOD_CATEGORY)" \ + "Version: $(CLASSIC_MODS_VER)" \ + "Built on: $(shell date)" \ + "Git commit: $(GIT_COMMIT)" \ + "---" > /tmp/$(HAKCHI_DIR)/readme.md + cat /tmp/$(HAKCHI_DIR)/readme_COPY.md >> /tmp/$(HAKCHI_DIR)/readme.md + rm /tmp/$(HAKCHI_DIR)/readme_COPY.md + @echo "** BUILDING CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **" + cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" * + mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod . + @echo "** BUILT CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **" +clean: + rm -rf obj-unix + rm -f *.d + rm -f *.o + rm -f audio/*.o + rm -f conf/*.o + rm -f gfx/*.o + rm -f gfx/drivers_font/*.o + rm -f gfx/drivers_font_renderer/*.o + rm -f gfx/drivers_context/*.o + rm -f gfx/py_state/*.o + rm -f compat/*.o + rm -f record/*.o + rm -f input/*.o + rm -f tools/*.o + rm -f $(BINDIR)/retroarch + rm -f $(BINDIR)/retroarch-joyconfig + rm -f $(PNDDIR)/readme.html + rm -f retroarch + rm -f $(CLASSIC_MODS_VER).hmod From 8d883bda4b5470ba9af34235f218bf4a84a8d954 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Tue, 23 Oct 2018 16:49:11 +0100 Subject: [PATCH 0402/1292] Removed old hakchi platform --- Makefile.nintendoc | 62 ---- hakchi/bin/retroarch-clover | 16 - hakchi/bin/retroarch-clover-child | 322 ------------------ hakchi/bin/retroarch-mini | 13 - hakchi/etc/libretro/core/CORES_GO_HERE.md | 0 .../libretro/info/CORE_INFO_FILES_GO_HERE.md | 0 .../etc/libretro/system/BIOS_FILES_GO_HERE.md | 0 hakchi/etc/preinit.d/be9af_retroarch | 18 - hakchi/etc/preinit.d/pe9af_retroarch | 1 - hakchi/install | 55 --- hakchi/readme.md | 49 --- 11 files changed, 536 deletions(-) delete mode 100644 Makefile.nintendoc delete mode 100644 hakchi/bin/retroarch-clover delete mode 100644 hakchi/bin/retroarch-clover-child delete mode 100644 hakchi/bin/retroarch-mini delete mode 100644 hakchi/etc/libretro/core/CORES_GO_HERE.md delete mode 100644 hakchi/etc/libretro/info/CORE_INFO_FILES_GO_HERE.md delete mode 100644 hakchi/etc/libretro/system/BIOS_FILES_GO_HERE.md delete mode 100644 hakchi/etc/preinit.d/be9af_retroarch delete mode 100644 hakchi/etc/preinit.d/pe9af_retroarch delete mode 100644 hakchi/install delete mode 100644 hakchi/readme.md diff --git a/Makefile.nintendoc b/Makefile.nintendoc deleted file mode 100644 index 4f971984a4..0000000000 --- a/Makefile.nintendoc +++ /dev/null @@ -1,62 +0,0 @@ -# Hakchi version added to ease confusion amongst Hakchi community due to messy past... -# -# Make sure you have readelf installed (sudo apt-get install readelf) to patch the binary -# Might not be needed for your build but it's a useful tool and for safety it should be -# run anyway to ensure the SDL2 link isn't broken... - -HAKCHI_VER := Hakchi_Retroarch_Neo_v1_7_3b -HAKCHI_NAME := "Hakchi RetroArch 'Neo' v1.7.3b -MOD_CREATOR := TheOtherGuys -MOD_CATEGORY := RetroArch - -HAKCHI_DIR := hakchi -TARGET := retroarch -GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`") - -all: $(TARGET) - -retroarch: - readelf -v #Check if you have readelf installed... (sudo apt-get install readelf) - ./configure --host=arm-linux-gnueabihf --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard - make -f Makefile -j HAVE_HAKCHI=1 - patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary... - #/usr/bin/arm-linux-gnueabihf-strip retroarch - rm -f $(HAKCHI_DIR)/bin/retroarch - cp retroarch $(HAKCHI_DIR)/bin/retroarch - echo $$(echo "Built by: " $$USER @ $$(date) \\\\\\ Git Commit: $(GIT_COMMIT)) > $(HAKCHI_DIR)/etc/libretro/retroarch_version - cp $(HAKCHI_DIR)/readme.md $(HAKCHI_DIR)/readme_COPY.md - printf "%s\n" \ - "---" \ - "Name: $(HAKCHI_VER)" \ - "Creator: $(MOD_CREATOR)" \ - "Category: $(MOD_CATEGORY)" \ - "Version: $(HAKCHI_VER)" \ - "Built on: $(shell date)" \ - "Git commit: $(GIT_COMMIT)" \ - "---" > $(HAKCHI_DIR)/readme.md - cat $(HAKCHI_DIR)/readme_COPY.md >> $(HAKCHI_DIR)/readme.md - rm $(HAKCHI_DIR)/readme_COPY.md - @echo "** BUILDING HAKCHI $(HAKCHI_VER) HMOD PACKAGE **" - cd $(HAKCHI_DIR)/; tar -czvf "$(HAKCHI_VER).hmod" * - mv $(HAKCHI_DIR)/$(HAKCHI_VER).hmod . - @echo "** BUILT HAKCHI $(HAKCHI_VER) HMOD PACKAGE **" -clean: - rm -f *.o - rm -f audio/*.o - rm -f conf/*.o - rm -f gfx/*.o - rm -f gfx/drivers_font/*.o - rm -f gfx/drivers_font_renderer/*.o - rm -f gfx/drivers_context/*.o - rm -f gfx/py_state/*.o - rm -f compat/*.o - rm -f record/*.o - rm -f input/*.o - rm -f tools/*.o - rm -f $(BINDIR)/retroarch - rm -f $(BINDIR)/retroarch-joyconfig - rm -f $(PNDDIR)/readme.html - rm -f retroarch - rm -f $(HAKCHI_DIR)/bin/retroarch - rm -f $(HAKCHI_VER).hmod - rm -f $(HAKCHI_DIR)/etc/libretro/retroarch_version diff --git a/hakchi/bin/retroarch-clover b/hakchi/bin/retroarch-clover deleted file mode 100644 index 4143555d4c..0000000000 --- a/hakchi/bin/retroarch-clover +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -source /etc/preinit -script_init - -uistop - -core="$1" -rom="$2" -shift 2 - -if [ -f "/bin/remote-exec" ]; then - echo retroarch-clover-child "$core" "\"$rom\"" ${1+"$@"} > /var/exec.flag -else - exec retroarch-clover-child "$core" "\"$rom\"" ${1+"$@"} -fi diff --git a/hakchi/bin/retroarch-clover-child b/hakchi/bin/retroarch-clover-child deleted file mode 100644 index f078f6ccfa..0000000000 --- a/hakchi/bin/retroarch-clover-child +++ /dev/null @@ -1,322 +0,0 @@ -#!/bin/sh - -source /etc/preinit -script_init - -#### Variable Definitions ################################################## - -HOME=/etc/libretro -corename="$1" -noprefix="${corename#km_}" -core="$HOME/core/${1}_libretro.so" -rom="$2" -filename="$(basename "$rom")" -id="${filename%.*}" -extension="${filename##*.}" -newrsram=/var/saves/retroarch -autosave="/var/cache/retroarch/$id.state.auto" -t_suffix=_time.txt -debug=0 -bezel_mode=0 -clovercon_file=/dev/clovercon1 -shift 2 - -while [ $# -gt 0 ]; do - [ "$1" == "--load-state-file" ] && load="$2" - [ "$1" == "--save-on-quit" ] && save="$2" - [ "$1" == "--rollback-input-dir" ] && load="$2/savestate" - [ "$1" == "--rollback-output-dir" ] && save="$2/savestate" - [ "$1" == "--save-screenshot-on-quit" ] && screenshot="$2" - [ "$1" == "--save-data-backing-file" ] && sram="$2" - [ "$1" == "--graphic-filter" ] && filter="$2" - [ "$1" == "--enable-crt-scanlines" ] && crt=1 - [ "$1" == "--video-mode" ] && [ "$2" == "crt-filter" ] && filter=crt720 && crt=1 - [ "$1" == "--video-mode" ] && [ "$2" == "keep-aspect-ratio" ] && filter=gpu720 - [ "$1" == "--video-mode" ] && [ "$2" == "pixel-perfect" ] && filter=ppu - [ "$1" == "--smooth43" ] && smooth43=1 - [ "$1" == "--no-smooth" ] && no_smooth=1 - [ "$1" == "--no-scanlines" ] && no_scanlines=1 - [ "$1" == "--bezel-mode" ] && bezel_mode=1 - [ "$1" == "--title-code" ] && title_code="$2" - [ "$1" == "--ra-extra" ] && extra="$2" - [ "$1" == "--ra-nosaves" ] && nosaves=1 - [ "$1" == "--load-time-path" ] && timefile_load="$2" - [ "$1" == "--save-time-path" ] && timefile_save="$2" - [ "$1" == "--replay-inputs" ] && demo=1 - [ "$1" == "--decorative-frame-path" ] && frame="$2" - [ "$1" == "--debug-usb" ] && debug=1 - [ "$1" == "--debug-nand" ] && debug=2 - [ "$1" == "--custom-loadscreen" ] && custom_loadscreen="$2" - shift -done - -#### Visuals ############################################################### - -#Retrospective fix for hakchi port splashes -if ! echo $corename | grep "prboom\|tyrquake\|cannonball"; then - umount "$rootfs/share/retroarch/assets/RAloading-min.png" -fi - -# Display Splash Screen -if [ ! -z "$custom_loadscreen" ]; then - decodepng "$rootfs/share/retroarch/assets/$custom_loadscreen" > /dev/fb0; -else - if [ -f "$mountpoint/media/hakchi/RA_loading_screens/$noprefix.png" ] && [ -f "$rootfs/share/retroarch/assets/RAloading-min.png" ]; then - decodepng "$mountpoint/media/hakchi/RA_loading_screens/$noprefix.png" > /dev/fb0; - else - if [ -f "$rootfs/share/retroarch/assets/core_loading_screens/$noprefix.png" ] && [ -f "$rootfs/share/retroarch/assets/RAloading-min.png" ]; then - decodepng "$rootfs/share/retroarch/assets/core_loading_screens/$noprefix.png" > /dev/fb0; - else - decodepng "$rootfs/share/retroarch/assets/RAloading-min.png" > /dev/fb0; - fi - fi -fi - -#### Network Mounting ###################################################### - -if [ -f "/media/hakchi/retroarch-mounted.cfg" ]; then - mv -f /media/hakchi/retroarch-mounted.cfg /etc/libretro/ -fi - -source /etc/libretro/retroarch-mounted.cfg -if [ "$ra_mount_enable" == "true" ] && [ ! -z "${ra_mount_address// }" ] && [ ! -d /var/mount ]; then - mkdir -p /var/mount - if [ ! -z "${ra_mount_user// }" ] && [ ! -z "${ra_mount_pass// }" ]; then - mount -t cifs -o user=$ra_mount_user,pass=$ra_mount_pass $ra_mount_address /var/mount - elif [ ! -z "${ra_mount_user// }" ] && [ -z "${ra_mount_pass// }" ]; then - mount -t cifs -o user=$ra_mount_user $ra_mount_address /var/mount - else - mount -t cifs $ra_mount_address /var/mount - fi -fi - -#### Saves and Configs ##################################################### - -[ ! -z "$demo" ] && load="$(dirname "$load")/savestate" - -# Create cache and /var/saves/retroarch directories -mkdir -p /var/cache/retroarch -mkdir -p "$newrsram" - -# Create a "cartridge.sram" file of 21B to avoid hakchi2 save-state manager from removing the folder -# Just in case we're going the "/var/saves/CLV-Z-RETROARCH" way -# if [ -f "/var/saves/CLV-Z-RETROARCH/cartridge.sram" ]; then - # [ "$(wc -c "/proc/sys/vm/overcommit_memory" - -[ -z "$timefile_save" ] && timefile_save="$load$t_suffix" -[ -z "$timefile_load" ] && timefile_load="$load$t_suffix" - -# Hold L button while starting a game to toggle bezel-mode for this game -if [ -e "$clovercon_file" ] && [ "$(cat $clovercon_file)" == "0004" ]; then - if [ "$bezel_mode" == "0" ]; then - sed -i "s/^Exec.*/& --bezel-mode/" "$gamepath/$title_code/$title_code.desktop" && bezel_mode=1 - else - sed -i "s/ --bezel-mode//g" "$gamepath/$title_code/$title_code.desktop" && bezel_mode=0 - fi -fi -# Hold R button while starting a game to toggle bezel-mode for this core -if [ -e "$clovercon_file" ] && [ "$(cat $clovercon_file)" == "0008" ]; then - [ ! -f "$HOME/bezel-core" ] && touch "$HOME/bezel-core" - if grep "^$corename$" "$HOME/bezel-core"; then - sed -i "/^$corename$/d" "$HOME/bezel-core" - else - echo "$corename" >> "$HOME/bezel-core" - fi -fi -[ -f "$HOME/bezel-core" ] && grep "^$corename$" "$HOME/bezel-core" && bezel_mode=1 - -# Smooth, border and scanlines -if [ "$bezel_mode" == "1" ]; then - [ "$filter" == "crt720" ] && overlay1=scanlines.png && overlay2="$frame.png" -else - [ "$filter" == "crt720" ] && overlay1=scanlines.png -fi -[ "$filter" == "crt720" ] && [ ! -z "$no_scanlines" ] || [ ! "$filter" == "crt720" ] && overlay1="$frame.png" -retroarch_watchdog --configEdit /etc/libretro/.config/retroarch/overlay/default.cfg overlay0_overlay "$overlay1" overlay0_desc0_overlay "$overlay2" -retroarch_watchdog --configEdit /etc/libretro/.config/retroarch/overlay/default_scanlines.cfg overlay0_desc0_overlay "$frame.png" - -ra_config_args="" -# Functions to make the rest easier -smooth(){ ra_config_args="$ra_config_args video_smooth $1"; } -overlay(){ ra_config_args="$ra_config_args input_overlay_enable $1"; } -overlay_file(){ ra_config_args="$ra_config_args input_overlay ~/.config/retroarch/overlay/$1"; } -int_scale(){ ra_config_args="$ra_config_args video_scale_integer $1"; } -ratio(){ ra_config_args="$ra_config_args aspect_ratio_index $1"; } -width(){ ra_config_args="$ra_config_args custom_viewport_width $1"; } -height(){ ra_config_args="$ra_config_args custom_viewport_height $1"; } -posx(){ ra_config_args="$ra_config_args custom_viewport_x $1"; } -posy(){ ra_config_args="$ra_config_args custom_viewport_y $1"; } - -# Smooth and bezel-mode -if [ "$bezel_mode" == "1" ]; then - [ "$filter" == "crt720" ] && width 877 && posx 201 - [ "$filter" == "gpu720" ] && smooth false && width 877 && posx 201 - [ "$filter" == "ppu" ] && smooth false && width 768 && posx 256 - ratio 22 && overlay true && overlay_file default.cfg && height 672 && posy 24 && int_scale true -fi -[ "$filter" == "crt720" ] && overlay true -[ "$filter" == "crt720" ] && [ -z "$no_smooth" ] && smooth true -[ "$filter" == "crt720" ] && [ ! -z "$no_smooth" ] && smooth false -[ "$filter" == "gpu720" ] && [ ! -z "$smooth43" ] && smooth true - -# Set config for standalone launch mode -if [ -z "${corename// }" ]; then - ra_config_args="$ra_config_args savefile_directory /var/saves/CLV-Z-RETROARCH" - ra_config_args="$ra_config_args savestate_directory /var/saves/CLV-Z-RASAVESTATES" - ra_config_args="$ra_config_args savestate_auto_save false" - ra_config_args="$ra_config_args savestate_auto_load false" - ra_config_args="$ra_config_args autosave_interval 0" -fi - -[ ! -z "$ra_config_args" ] && retroarch_watchdog --configEdit /etc/libretro/retroarch.cfg $ra_config_args - -#### Runtime ############################################################### - -if [ -f "/media/hakchi/RA_DEV_MODE" ]; then #Devmode Active (Record current session) - if [ -z "${corename// }" ]; then - rm -f /media/Development_RetroArch.log - echo "Pre RA load Core Temp: $(more /sys/devices/virtual/thermal/thermal_zone0/temp)" >> /media/Development_RA_temp.log - retroarch -c "$HOME/retroarch.cfg" -vf > /media/Development_RetroArch.log 2>&1 & - else - rm -f /media/Development_RetroArch.log - echo "Pre RA load Core Temp: $(more /sys/devices/virtual/thermal/thermal_zone0/temp)" >> /media/Development_RA_temp.log - retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" > /media/Development_RetroArch.log 2>&1 & - fi -else - if [ -z "${corename// }" ]; then - retroarch -c "$HOME/retroarch.cfg" -vf & - fi - if [ "$debug" == "0" ]; then #Default - retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" & - fi - if [ "$debug" == "1" ]; then #Verbose USB mode - retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" > "/media/${filename}_RetroArch.log" 2>&1 & - fi - if [ "$debug" == "2" ]; then #Verbose NAND mode - retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" > "/tmp/${filename}_RetroArch.log" 2>&1 & - fi -fi - -#### Watchdog ############################################################## - -# Set Watchdog Arguments -watchdog_args="$!" -# Demo mode enabled -[ ! -z "$demo" ] && watchdog_args="$watchdog_args --demo" -# Set Screenshot Args -[ ! -z "$screenshot" ] && [ -z "$nosaves" ] && watchdog_args="$watchdog_args --screenshot $screenshot" -# Load Time Played -[ -f "$timefile_load" ] && watchdog_args="$watchdog_args --time $(cat "$timefile_load")" -[ -z "$demo" ] && watchdog_args="$watchdog_args --timePath $timefile_save" - -# Create output folders -[ ! -z "$save" ] && mkdir -p "$(dirname "$save")" -[ ! -z "$sram" ] && mkdir -p "$(dirname "$sram")" -[ ! -z "$screenshot" ] && mkdir -p "$(dirname "$screenshot")" - -# Run retroarch watchdog -retroarch_watchdog $watchdog_args - -#### Cleanup ############################################################### - -# Saves! -[ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && gzip -f "$autosave" && mv -f "$autosave.gz" "$save" - -# Restore Retroarch Config -retroarch_watchdog --configRestore /etc/libretro/retroarch.cfg - -# Copy savestates to USB if any and delete cache folder -if [ -d "/media/hakchi" ] && ls "/var/cache/retroarch/$id".*[^auto]; then - [ ! -d "/media/data/ra_savestates/$title_code" ] && mkdir -p "/media/data/ra_savestates/$title_code" - cp "/var/cache/retroarch/$id".*[^auto] "/media/data/ra_savestates/$title_code" -fi -rm -rf /var/cache/retroarch/ - -#Remove network drive mount if Hakchi Mount mod is enabled -if [ ! -f "$rootfs/etc/hakchi_mount_mod" ]; then - umount "/var/mount" && rm -rf "/var/mount" -fi - -if [ -f "/media/hakchi/RA_DEV_MODE" ]; then #Devmode Active (Record current session) - echo "Post RA load Core Temp: $(more /sys/devices/virtual/thermal/thermal_zone0/temp)" >> /media/Development_RA_temp.log -fi - -# Back to the shell -uistart diff --git a/hakchi/bin/retroarch-mini b/hakchi/bin/retroarch-mini deleted file mode 100644 index a00ab31434..0000000000 --- a/hakchi/bin/retroarch-mini +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -source /etc/preinit -script_init - -uistop - -exec retroarch-clover-child -if [ -f "/bin/remote-exec" ]; then - echo retroarch-clover-child > /var/exec.flag -else - exec retroarch-clover-child -fi diff --git a/hakchi/etc/libretro/core/CORES_GO_HERE.md b/hakchi/etc/libretro/core/CORES_GO_HERE.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/hakchi/etc/libretro/info/CORE_INFO_FILES_GO_HERE.md b/hakchi/etc/libretro/info/CORE_INFO_FILES_GO_HERE.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/hakchi/etc/libretro/system/BIOS_FILES_GO_HERE.md b/hakchi/etc/libretro/system/BIOS_FILES_GO_HERE.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/hakchi/etc/preinit.d/be9af_retroarch b/hakchi/etc/preinit.d/be9af_retroarch deleted file mode 100644 index 871d348329..0000000000 --- a/hakchi/etc/preinit.d/be9af_retroarch +++ /dev/null @@ -1,18 +0,0 @@ -Hakchi_Libretro_Initialise(){ - if [ -z "$(mount | grep "/etc/libretro ")" ] && [ -d "$mountpoint/media/$modname" ] && [ "$cfg_usb_rw" == "y" ]; then - local externalPath="$mountpoint/media/data/ra_data" - local localPath="$rootfs/etc/libretro/.config/retroarch" - for ra_folders in database thumbnails playlists downloads; do - if [ ! -d "$externalPath/$ra_folders" ]; then - mkdir -p "$externalPath/$ra_folders" - copy "$localPath/$ra_folders" "$externalPath" - rm -rf "$localPath/$ra_folders/"* - fi - mount_bind "$externalPath/$ra_folders" "$localPath/$ra_folders" - overmount "${localPath#$rootfs}/$ra_folders" - done - unset ra_folders - fi - [ -f "$mountpoint/usr/bin/clover-kachikachi" ] && overmount /usr/bin/clover-kachikachi - [ -f "$mountpoint/usr/bin/clover-canoe-shvc" ] && overmount /usr/bin/clover-canoe-shvc -} diff --git a/hakchi/etc/preinit.d/pe9af_retroarch b/hakchi/etc/preinit.d/pe9af_retroarch deleted file mode 100644 index a05a2a8094..0000000000 --- a/hakchi/etc/preinit.d/pe9af_retroarch +++ /dev/null @@ -1 +0,0 @@ -Hakchi_Libretro_Initialise diff --git a/hakchi/install b/hakchi/install deleted file mode 100644 index a36083ccf8..0000000000 --- a/hakchi/install +++ /dev/null @@ -1,55 +0,0 @@ -echo "Grabbing old config variables..." -cheevos_username=$(grep -i "cheevos_username*" $rootfs/etc/libretro/retroarch.cfg) -cheevos_password=$(grep -i "cheevos_password*" $rootfs/etc/libretro/retroarch.cfg) -cheevos_token=$(grep -i "cheevos_token*" $rootfs/etc/libretro/retroarch.cfg) -netplay_nickname=$(grep -i "netplay_nickname*" $rootfs/etc/libretro/retroarch.cfg) -netplay_mitm_server=$(grep -i "netplay_mitm_server*" $rootfs/etc/libretro/retroarch.cfg) -netplay_ip_port=$(grep -i "netplay_ip_port*" $rootfs/etc/libretro/retroarch.cfg) -netplay_ip_address=$(grep -i "netplay_ip_address*" $rootfs/etc/libretro/retroarch.cfg) -netplay_password=$(grep -i "netplay_password*" $rootfs/etc/libretro/retroarch.cfg) -netplay_spectate_password=$(grep -i "netplay_spectate_password*" $rootfs/etc/libretro/retroarch.cfg) - -echo "Uninstalling old version of Hakchi RetroArch neo..." -var=$(hakchi pack_list | grep "Hakchi_Retroarch_Neo_") && hakchi pack_uninstall $var -echo "Uninstalled $var, Installing new version now..." - -transfer_default -chmod +x $rootfs/bin/* -chmod +x $rootfs/usr/bin/* -mkdir -p $rootfs/etc/libretro/system -[ -f "/newroot/usr/share/kachikachi/fds_bios.bin" ] && cp -f /newroot/usr/share/kachikachi/fds_bios.bin $rootfs/etc/libretro/system/disksys.rom -mkdir -p $rootfs/etc/options_menu/retroarch/default_files -copy $rootfs/etc/libretro/retroarch.cfg $rootfs/etc/options_menu/retroarch/default_files/ -copy $rootfs/etc/libretro/retroarch-core-options.cfg $rootfs/etc/options_menu/retroarch/default_files/ -loadscr_path=$rootfs/share/retroarch/assets/core_loading_screens -for arcade_loadscr in "$loadscr_path/fbalpha2012.png" "$loadscr_path/fbalpha2012_cps1.png" "$loadscr_path/fbalpha2012_cps2.png" "$loadscr_path/fbalpha2012_cps3.png" "$loadscr_path/fbalpha2012_neogeo.png" "$loadscr_path/fb_alpha.png" "$loadscr_path/mame2003.png" "$loadscr_path/mame2003_xtreme.png" "$loadscr_path/mame2010.png" "$loadscr_path/mame2014.png"; do - if [ ! -e "$arcade_loadscr" ]; then - ln -s "${loadscr_path#/newroot}/mame2000.png" "$arcade_loadscr" - fi -done -for snes_loadscr in "$loadscr_path/snes9x2002.png" "$loadscr_path/snes9x2005.png" "$loadscr_path/snes9x2010.png"; do - if [ ! -e "$snes_loadscr" ]; then - ln -s "${loadscr_path#/newroot}/snes9x.png" "$snes_loadscr" - fi -done -[ ! -e "$loadscr_path/fceumm.png" ] && ln -s ${loadscr_path#/newroot}/nestopia.png $loadscr_path/fceumm.png -[ ! -e "$loadscr_path/mupen64plus.png" ] && ln -s ${loadscr_path#/newroot}/glupen64.png $loadscr_path/mupen64plus.png -[ ! -e "$loadscr_path/genesis_plus_gx.png" ] && ln -s ${loadscr_path#/newroot}/picodrive.png $loadscr_path/genesis_plus_gx.png - - -echo "Reloading built in config..." -sed -i -e 's/cheevos_username = "[^"]*"/cheevos_username = "'$cheevos_username'"/g' $rootfs/etc/libretro/retroarch.cfg -sed -i -e 's/cheevos_password = "[^"]*"/cheevos_password = "'$cheevos_password'"/g' $rootfs/etc/libretro/retroarch.cfg -sed -i -e 's/cheevos_token = "[^"]*"/cheevos_token = "'$cheevos_token'"/g' $rootfs/etc/libretro/retroarch.cfg -sed -i -e 's/netplay_mitm_server = "[^"]*"/netplay_mitm_server = "'$netplay_mitm_server'"/g' $rootfs/etc/libretro/retroarch.cfg -sed -i -e 's/netplay_ip_port = "[^"]*"/netplay_ip_port = "'$netplay_ip_port'"/g' $rootfs/etc/libretro/retroarch.cfg -sed -i -e 's/netplay_ip_address = "[^"]*"/netplay_ip_address = "'$netplay_ip_address'"/g' $rootfs/etc/libretro/retroarch.cfg -sed -i -e 's/netplay_spectate_password = "[^"]*"/netplay_spectate_password = "'$netplay_spectate_password'"/g' $rootfs/etc/libretro/retroarch.cfg - -if [ "$cheevos_username" == "hakchiresources" ]; then - sed -i -e 's/cheevos_enable = "[^"]*"/cheevos_enable = "false"/g' $rootfs/etc/libretro/retroarch.cfg -fi - - -echo "Install complete!" -return 1 diff --git a/hakchi/readme.md b/hakchi/readme.md deleted file mode 100644 index 180962dd62..0000000000 --- a/hakchi/readme.md +++ /dev/null @@ -1,49 +0,0 @@ - -## New Release Overview video - -## Changelog - -### 1.7.3b - July 2018 - -**Please note: NES cores are no longer bundled with RA. You will need to download them seperately** - -**Please note: Standalone RetroArch Saves will be located in your saves under CLV-RETROARCH** - -- Huge amount of optimisation and streamlining reduced deployed package size by over half! (Complete RA now only ~5mb compared to ~12mb) -- RA Saves and savestates fully functional and working for all cores (that support them!) -- Launching RetroArch standalone now fully functional and working. Saves also supported. -- Switching roms within RetroArch standalone now supports saving. -- Stability fixes for intensive cores (N64, PSX) reducing the risk of C8 crashing. -- Added ability to now download and update cores directly from the RA menu via HakchiCloud! -- Added network storage support. You can now play entire rom sets and media directly from your networked drives! -- Playlist support now implemented. Add thousands of roms to your RetroArch GUI with boxart and thumbnails and launch the roms directly from the GUI (No GUI limit!) -- New layout look -- Saving mechanism reworked, better functionality and Hakchi Save Manager support. -- Loading and shutting down of RetroArch times reduced via optimisation. -- Fixed occasional C8 errors when launching RetroArch directly -- Holding R now enables bezel mode per core instead of individual games -- Numerous bug fixes - -### 1.7.3a - May 2018 - -- Built with preconfigured network and achievement support. (As soon as network connection is available, network and achievements are enabled.) -- New RetroArch binary 1.7.3 (completely overhauled audio mixer) -- Few RA bug fixes -- Default GUI is now changed to XMB with the purpose of using network and achievements. -- A few mapping issues Fixed for keyboard to gamepad -- Saves mame config properly (dip switches, etc.) -- Optimizations to avoid to many writes on NAND -- Boot sequence optimised -- Doom and Quake splash screen bug fixed. - -RetroArch and Retroarch Cores by libretro - -Hakchi RetroArch Neo main development by Swingflip, Bslenul and CompCom - -Hakchi by MadMonkey - -Special thanks to Team Hakchi Resources, Team Shinkansen and MadMonkey - -https://hakchiresources.com - -(c) 2016-2018 From 93ac62012d0dec0a3ad60e5425a895799f90ded9 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Tue, 23 Oct 2018 16:55:23 +0100 Subject: [PATCH 0403/1292] Cleaned up ARMV7A7 --- Makefile.classic_armv7_a7 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index c635df8929..0413cdb45b 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -4,9 +4,9 @@ # Classic Readme Variables ############ -CLASSIC_MODS_VER := CLASSIC_MODS_Retroarch_Neo_v1_7_5b -CLASSIC_MODS_NAME := CLASSIC_MODS RetroArch 'Neo' v1.7.5b -MOD_CREATOR := TheOtherGuys +CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_CMO +CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official CM Optimised) +MOD_CREATOR := Libretro + ClassicMods MOD_CATEGORY := RetroArch GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`") @@ -48,10 +48,10 @@ retroarch: "---" > /tmp/$(HAKCHI_DIR)/readme.md cat /tmp/$(HAKCHI_DIR)/readme_COPY.md >> /tmp/$(HAKCHI_DIR)/readme.md rm /tmp/$(HAKCHI_DIR)/readme_COPY.md - @echo "** BUILDING CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **" + @echo "** COMPRESSING $(CLASSIC_MODS_VER) HMOD PACKAGE **" cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" * mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod . - @echo "** BUILT CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **" + @echo "** BUILT CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **" clean: rm -rf obj-unix rm -f *.d From a8cb30b9c5f91b85a18651c74163a5b4bcdcfeb5 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Tue, 23 Oct 2018 17:16:15 +0100 Subject: [PATCH 0404/1292] Static compiling of ARMv7 CortexA7 --- Makefile.classic_armv7_a7 | 12 +++++++++++- Makefile.common | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index 0413cdb45b..eb04fde2f5 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -3,7 +3,6 @@ # ensure the SDL2 link isn't broken... # Classic Readme Variables ############ - CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_CMO CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official CM Optimised) MOD_CREATOR := Libretro + ClassicMods @@ -21,6 +20,10 @@ CXX_V = arm-linux-gnueabihf-g++-8 AS_V = arm-linux-gnueabihf-as CC_AS_V = arm-linux-gnueabihf-gcc-8 +# Libretro Defines #################### +HAVE_CLASSIC = 1 + + all: $(TARGET) retroarch: @@ -52,6 +55,13 @@ retroarch: cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" * mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod . @echo "** BUILT CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **" + + #COMMODORE 64 MINI BUILD (WIP) + + @echo "*********************************************************************" + @echo "*** Classic ARM7 Cortex A7 build and packages built successfully! ***" + @echo "****************** Winner, Winner, Chicken Dinner! ******************" + @echo "*********************************************************************" clean: rm -rf obj-unix rm -f *.d diff --git a/Makefile.common b/Makefile.common index 361de1abb5..67d0c6845e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -7,8 +7,9 @@ ifeq ($(HAVE_STACK_USAGE), 1) CFLAGS += -fstack-usage endif -ifeq ($(HAVE_HAKCHI), 1) -CFLAGS += -DHAVE_HAKCHI +ifeq ($(HAVE_CLASSIC), 1) + LDFLAGS += -static-libgcc -static-libstdc++ + CFLAGS += -DHAVE_CLASSIC endif ifeq ($(HAVE_GL_CONTEXT),) From 63d44c0ebcffb455cacf3f5a8aa8b6db3b4775f8 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Tue, 23 Oct 2018 17:17:07 +0100 Subject: [PATCH 0405/1292] Added cleanup to A7A7 --- Makefile.classic_armv7_a7 | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index eb04fde2f5..3c2b540fcf 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -55,6 +55,7 @@ retroarch: cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" * mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod . @echo "** BUILT CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **" + rm -fr /tmp/$(HAKCHI_DIR) #clean up tmp #COMMODORE 64 MINI BUILD (WIP) From eff5914fa24258d70fc71dc5ad1ca7ea87e5aa04 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Tue, 23 Oct 2018 17:28:23 +0100 Subject: [PATCH 0406/1292] Forgot the new brand name lol. --- Makefile.classic_armv7_a7 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index 3c2b540fcf..90c920fcdb 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -3,9 +3,9 @@ # ensure the SDL2 link isn't broken... # Classic Readme Variables ############ -CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_CMO -CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official CM Optimised) -MOD_CREATOR := Libretro + ClassicMods +CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_MMCO +CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official MMC Optimised) +MOD_CREATOR := Libretro + ModMyClassic MOD_CATEGORY := RetroArch GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`") From 49b657fce26543bd96710cb69ec45ef2b87ef758 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 24 Oct 2018 04:42:58 +0200 Subject: [PATCH 0407/1292] Menu Font Green/Blue Color can now be manipulated with the GUI --- menu/menu_setting.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 6bfe680545..59e5e4527f 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -7784,8 +7784,6 @@ static bool setting_append_list( general_write_handler, general_read_handler); (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; - (*list)[list_info->index - 1].get_string_representation = - &setting_get_string_representation_float_video_msg_color; menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); @@ -7800,8 +7798,6 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler); - (*list)[list_info->index - 1].get_string_representation = - &setting_get_string_representation_float_video_msg_color; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; menu_settings_list_current_add_range(list, list_info, 0, 255, 1, true, true); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED); From 183aede716a3c8a263dcfef82daf08c374282670 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 24 Oct 2018 04:44:29 +0200 Subject: [PATCH 0408/1292] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 4552019215..6dc971fd21 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ - LOCALIZATION: Update Italian translation. - LOCALIZATION: Update Simplified Chinese translation. - LOCALIZATION: Update Japanese translation. +- MENU: User Interface -> Appearance -> 'Menu Font Green/Blue Color' settings now work properly. - SCANNER: Fix GDI disc scanning. - SWITCH/LIBNX: Improve touch scaling calculation. - SWITCH: Proper button labels. From 07c45cadd18678695591509bb5a5f3d4d0b090f1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 24 Oct 2018 04:49:53 +0200 Subject: [PATCH 0409/1292] Only display CRT SwitchRes settings if video display server is implemented --- CHANGES.md | 1 + gfx/video_display_server.c | 9 ++++++++- gfx/video_display_server.h | 2 ++ menu/menu_displaylist.c | 8 +++++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6dc971fd21..ca75a843f5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ - LOCALIZATION: Update Italian translation. - LOCALIZATION: Update Simplified Chinese translation. - LOCALIZATION: Update Japanese translation. +- MENU: Only show CRT SwitchRes if video display server is implemented (Windows/Linux for now) - MENU: User Interface -> Appearance -> 'Menu Font Green/Blue Color' settings now work properly. - SCANNER: Fix GDI disc scanning. - SWITCH/LIBNX: Improve touch scaling calculation. diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index 653cd0d8ad..98fd57eca1 100644 --- a/gfx/video_display_server.c +++ b/gfx/video_display_server.c @@ -21,7 +21,14 @@ #include "../verbosity.h" static const video_display_server_t *current_display_server = NULL; -static void *current_display_server_data = NULL; +static void *current_display_server_data = NULL; + +const char *video_display_server_get_ident(void) +{ + if (!current_display_server) + return "null"; + return current_display_server->ident; +} void* video_display_server_init(void) { diff --git a/gfx/video_display_server.h b/gfx/video_display_server.h index 6f06228915..9a39100807 100644 --- a/gfx/video_display_server.h +++ b/gfx/video_display_server.h @@ -52,6 +52,8 @@ bool video_display_server_switch_resolution( const char *video_display_server_get_output_options(void); +const char *video_display_server_get_ident(void); + extern const video_display_server_t dispserv_win32; extern const video_display_server_t dispserv_x11; extern const video_display_server_t dispserv_null; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index dd85bc88ab..f7b00d07dc 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -78,6 +78,7 @@ #include "../frontend/frontend_driver.h" #include "../ui/ui_companion_driver.h" #include "../gfx/video_driver.h" +#include "../gfx/video_display_server.h" #include "../config.features.h" #include "../version_git.h" #include "../input/input_driver.h" @@ -6513,9 +6514,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist break; case DISPLAYLIST_VIDEO_SETTINGS_LIST: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_CRT_SWITCHRES_SETTINGS, - PARSE_ACTION, false); + if (!string_is_equal(video_display_server_get_ident(), "null")) + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_CRT_SWITCHRES_SETTINGS, + PARSE_ACTION, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE, PARSE_ONLY_BOOL, false); From ce873906fcddbc5fb0fa14f71469ae3d37b4ec16 Mon Sep 17 00:00:00 2001 From: natinusala Date: Wed, 24 Oct 2018 17:23:22 +0200 Subject: [PATCH 0410/1292] libnx: add multitouch to input driver --- .vscode/c_cpp_properties.json | 3 ++- input/drivers/switch_input.c | 36 +++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 2e6b11d97a..26319581dc 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -29,7 +29,8 @@ "includePath": [ "/usr/include", "/usr/local/include", - "${workspaceRoot}" + "${workspaceRoot}", + "${workspaceFolder}/libretro-common/include" ], "defines": [], "intelliSenseMode": "clang-x64", diff --git a/input/drivers/switch_input.c b/input/drivers/switch_input.c index 26cfd510d5..0176ed63bc 100644 --- a/input/drivers/switch_input.c +++ b/input/drivers/switch_input.c @@ -11,12 +11,14 @@ #ifdef HAVE_LIBNX #include + +#define MULTITOUCH_LIMIT 4 /* supports up to this many fingers at once */ +#define TOUCH_AXIS_MAX 0x7fff /* abstraction of pointer coords */ #endif #include "../input_driver.h" #define MAX_PADS 10 -#define TOUCH_AXIS_MAX 0x7fff /* abstraction of pointer coords */ /* TODO/FIXME - * fix game focus toggle */ @@ -27,16 +29,15 @@ typedef struct switch_input bool blocked; #ifdef HAVE_LIBNX - uint32_t touch_x; - uint32_t touch_y; - uint32_t touch_scale_x; uint32_t touch_scale_y; uint32_t touch_half_resolution_x; uint32_t touch_half_resolution_y; - bool touch_state; + bool touch_state[MULTITOUCH_LIMIT]; + uint32_t touch_x[MULTITOUCH_LIMIT]; + uint32_t touch_y[MULTITOUCH_LIMIT]; #endif } switch_input_t; @@ -50,15 +51,18 @@ static void switch_input_poll(void *data) #ifdef HAVE_LIBNX uint32_t touch_count = hidTouchCount(); - sw->touch_state = touch_count > 0; - - if (sw->touch_state) + for (int i = 0; i < MULTITOUCH_LIMIT; i++) { - touchPosition touch_position; - hidTouchRead(&touch_position, 0); + sw->touch_state[i] = touch_count > i; - sw->touch_x = touch_position.px; - sw->touch_y = touch_position.py; + if (sw->touch_state[i]) + { + touchPosition touch_position; + hidTouchRead(&touch_position, i); + + sw->touch_x[i] = touch_position.px; + sw->touch_y[i] = touch_position.py; + } } #endif } @@ -76,17 +80,17 @@ void calc_touch_scaling(switch_input_t *sw, uint32_t x, uint32_t y, uint32_t axi static int16_t switch_pointer_device_state(switch_input_t *sw, unsigned id, unsigned idx) { - if (idx != 0) + if (idx >= MULTITOUCH_LIMIT) return 0; switch (id) { case RETRO_DEVICE_ID_POINTER_PRESSED: - return sw->touch_state; + return sw->touch_state[idx]; case RETRO_DEVICE_ID_POINTER_X: - return ((sw->touch_x - sw->touch_half_resolution_x) * sw->touch_scale_x); + return ((sw->touch_x[idx] - sw->touch_half_resolution_x) * sw->touch_scale_x); case RETRO_DEVICE_ID_POINTER_Y: - return ((sw->touch_y - sw->touch_half_resolution_y) * sw->touch_scale_y); + return ((sw->touch_y[idx] - sw->touch_half_resolution_y) * sw->touch_scale_y); } return 0; From 75008d0a229e78ab56e7650a0b8999c124af6be1 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 13:11:55 +0100 Subject: [PATCH 0411/1292] Added Optimisation for A7A7 and fixed Classic platform --- Makefile.classic_armv7_a7 | 7 ++++--- Makefile.common | 40 ++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index 90c920fcdb..2058163cff 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -21,8 +21,9 @@ AS_V = arm-linux-gnueabihf-as CC_AS_V = arm-linux-gnueabihf-gcc-8 # Libretro Defines #################### -HAVE_CLASSIC = 1 - +#HAVE_CLASSIC = Classic Hook, disable some features +#HAVE_C_A7A7 = Classic Armv7 Cortex A7 optimisation override +#HAVE_HAKCHI = Hakchi Hook, change default configurations etc (TODO) all: $(TARGET) @@ -30,7 +31,7 @@ retroarch: #Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7) patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf) ./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard - make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 -j #Cook it + make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_HAKCHI=1 -j #Cook it patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary... #HAKCHI BUILD (NESC, SNESC) diff --git a/Makefile.common b/Makefile.common index 67d0c6845e..e59dfa94e8 100644 --- a/Makefile.common +++ b/Makefile.common @@ -7,11 +7,6 @@ ifeq ($(HAVE_STACK_USAGE), 1) CFLAGS += -fstack-usage endif -ifeq ($(HAVE_CLASSIC), 1) - LDFLAGS += -static-libgcc -static-libstdc++ - CFLAGS += -DHAVE_CLASSIC -endif - ifeq ($(HAVE_GL_CONTEXT),) HAVE_GL_CONTEXT=0 @@ -1840,3 +1835,38 @@ endif ifeq ($(HAVE_RPILED), 1) OBJ += led/drivers/led_rpi.o endif + +################################## +### Classic Platform specifics ### +###############WIP################ +# Help at https://modmyclassic.com/comp + +ifeq ($(HAVE_CLASSIC), 1) + CFLAGS += -DHAVE_CLASSIC +endif + +ifeq ($(HAVE_C_A7A7), 1) + C_A7A7_OPT = -Ofast \ + -fno-lto \ + -fdata-sections -ffunction-sections -Wl,--gc-sections \ + -fno-stack-protector -fno-ident -fomit-frame-pointer \ + -falign-functions=1 -falign-jumps=1 -falign-loops=1 \ + -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \ + -fmerge-all-constants -fno-math-errno \ + -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard + CFLAGS += $(C_A7A7_OPT) + CXXFLAGS += $(C_A7A7_OPT) + ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1) + CFLAGS += -march=armv7-a + else + CFLAGS += -march=armv7ve + # If gcc is 5.0 or later + ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1) + LDFLAGS += -static-libgcc -static-libstdc++ + endif +endif + +ifeq ($(HAVE_HAKCHI), 1) + CFLAGS += -DHAVE_HAKCHI +endif +################################## \ No newline at end of file From 5da7494bfc1cfaa4cce732ace73cb238e70b456b Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 13:15:41 +0100 Subject: [PATCH 0412/1292] whoops --- Makefile.common | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.common b/Makefile.common index e59dfa94e8..ff6ff02411 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1864,6 +1864,7 @@ ifeq ($(HAVE_C_A7A7), 1) ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1) LDFLAGS += -static-libgcc -static-libstdc++ endif + endif endif ifeq ($(HAVE_HAKCHI), 1) From c3bfab9285feb119af18cf9d685cebee187339b5 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 13:47:22 +0100 Subject: [PATCH 0413/1292] Finished up Classic Platform (hopefully) --- Makefile.classic_armv7_a7 | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index 2058163cff..8967b4b501 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -1,10 +1,15 @@ -# Make sure you have patchelf installed (sudo apt-get install patchelf) to patch the binary for Hakchi. -# Might not be needed for your build but it's a useful tool and for safety it should be run anyway to -# ensure the SDL2 link isn't broken... +# Building Prerequisites ############## +# arm-linux-gnueabihf-gcc-8 +# arm-linux-gnueabihf-g++-8 +# arm-linux-gnueabihf-as +# arm-linux-gnueabihf-strip +# patchelf +# bc # Classic Readme Variables ############ -CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_MMCO -CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official MMC Optimised) +CLASSIC_MODS_VER := Official_Retroarch_v1_7_5c_COptimised +CLASSIC_MODS_NAME := RetroArch v1.7.5c (Official Classic Optimised) +CLASSIC_VERSION := 1.7.5c (Classic Optimised) MOD_CREATOR := Libretro + ModMyClassic MOD_CATEGORY := RetroArch GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`") @@ -28,10 +33,15 @@ CC_AS_V = arm-linux-gnueabihf-gcc-8 all: $(TARGET) retroarch: + #Backup vanilla version files + ammend version + cp version.all version_BACKUP.all && cp version.dtd version_BACKUP.dtd + sed -i -e 's/RARCH_VERSION="[^"]*"/RARCH_VERSION="'$(CLASSIC_VERSION)'"/g' version.all + sed -i -e 's/ENTITY version "[^"]*"/ENTITY version "'$(CLASSIC_VERSION)'"/g' version.dtd #Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7) patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf) ./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_HAKCHI=1 -j #Cook it + arm-linux-gnueabihf-strip -v retroarch patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary... #HAKCHI BUILD (NESC, SNESC) @@ -59,7 +69,10 @@ retroarch: rm -fr /tmp/$(HAKCHI_DIR) #clean up tmp #COMMODORE 64 MINI BUILD (WIP) - + + #Clean down dirty files + rm -f version.all version.dtd + mv version_BACKUP.all version.all && mv version_BACKUP.dtd version.dtd @echo "*********************************************************************" @echo "*** Classic ARM7 Cortex A7 build and packages built successfully! ***" @echo "****************** Winner, Winner, Chicken Dinner! ******************" From e83ccbafe27e729eba1320399c7cf74e08ff94d3 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 14:20:20 +0100 Subject: [PATCH 0414/1292] Updated version and updated clean for A7A7 --- Makefile.classic_armv7_a7 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index 8967b4b501..9a94a26ec5 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -9,7 +9,7 @@ # Classic Readme Variables ############ CLASSIC_MODS_VER := Official_Retroarch_v1_7_5c_COptimised CLASSIC_MODS_NAME := RetroArch v1.7.5c (Official Classic Optimised) -CLASSIC_VERSION := 1.7.5c (Classic Optimised) +CLASSIC_VERSION := 1.7.5c \(Classic+\) MOD_CREATOR := Libretro + ModMyClassic MOD_CATEGORY := RetroArch GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`") @@ -35,11 +35,12 @@ all: $(TARGET) retroarch: #Backup vanilla version files + ammend version cp version.all version_BACKUP.all && cp version.dtd version_BACKUP.dtd - sed -i -e 's/RARCH_VERSION="[^"]*"/RARCH_VERSION="'$(CLASSIC_VERSION)'"/g' version.all - sed -i -e 's/ENTITY version "[^"]*"/ENTITY version "'$(CLASSIC_VERSION)'"/g' version.dtd + sed -i -e 's/RARCH_VERSION="[^"]*"/RARCH_VERSION="$(CLASSIC_VERSION)"/g' version.all + sed -i -e 's/PACKAGE_VERSION "[^"]*"/PACKAGE_VERSION "$(CLASSIC_VERSION)"/g' version.all + sed -i -e 's/ENTITY version "[^"]*"/ENTITY version "$(CLASSIC_VERSION)"/g' version.dtd #Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7) patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf) - ./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard + ./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard --disable-discord make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_HAKCHI=1 -j #Cook it arm-linux-gnueabihf-strip -v retroarch patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary... @@ -97,3 +98,6 @@ clean: rm -f $(PNDDIR)/readme.html rm -f retroarch rm -f $(CLASSIC_MODS_VER).hmod + rm -f version.all version.dtd + mv version_BACKUP.all version.all && mv version_BACKUP.dtd version.dtd + rm -f *_BACKUP* From a45f3a2d5949edce7ef537ee5415f76abd35e68f Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 16:30:07 +0100 Subject: [PATCH 0415/1292] Added MadMonkey's compression (and the fixes) --- libretro-common/dynamic/dylib.c | 278 +++++++++++++++++++++++++++++++- 1 file changed, 276 insertions(+), 2 deletions(-) diff --git a/libretro-common/dynamic/dylib.c b/libretro-common/dynamic/dylib.c index bc6be9fc40..e57ef62678 100644 --- a/libretro-common/dynamic/dylib.c +++ b/libretro-common/dynamic/dylib.c @@ -34,6 +34,270 @@ #include #endif +#if defined(__linux__) && !defined(ANDROID) +#define soramLoader +#endif + +#ifdef soramLoader +// stolen from here: https://x-c3ll.github.io/posts/fileless-memfd_create/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define debug_printf(...) //printf(__VA_ARGS__) + +typedef struct _soramHandle +{ + dylib_t handle; + char*soname; + int32_t ref; +} soramHandle_t; + +#define VECTOR_LIST_TYPE soramHandle_t +#define VECTOR_LIST_NAME soram +#include <../lists/vector_list.c> +typedef struct TYPE_NAME() soramList_t; +#undef VECTOR_LIST_TYPE +#undef VECTOR_LIST_NAME + +static soramList_t *soramList = 0; +static pthread_mutex_t soramMutex = PTHREAD_MUTEX_INITIALIZER; + +static soramHandle_t*soramFindName(const char*soname) +{ + size_t i; + if (soramList == 0) + return 0; + for (i = 0; i < soramList->count; ++i) + if (strcmp(soname, soramList->data[i].soname) == 0) + return &soramList->data[i]; + return 0; +} + +static soramHandle_t*soramFindHandle(dylib_t handle) +{ + size_t i; + if (soramList == 0) + return 0; + for (i = 0; i < soramList->count; ++i) + if (handle == soramList->data[i].handle) + return &soramList->data[i]; + return 0; +} + +static void soramAdd(const char*soname,dylib_t handle) +{ + soramHandle_t *so, _so; + if (soramList == 0) + soramList = soram_vector_list_new(); + so = soramFindHandle(0); + if (so == 0) + so = &_so; + so->handle = handle; + so->soname = strdup(soname); + so->ref = 1; + soram_vector_list_append(soramList, *so); +} + +static bool soramRemove(dylib_t handle) +{ + size_t i,count; + soramHandle_t *so = soramFindHandle(handle); + if (so == 0) + return 0; + if (--so->ref > 0) + return 1; +#ifndef NO_DLCLOSE + dlclose(so->handle); + free(so->soname); + so->handle = 0; + so->soname = 0; + count = 0; + for (i = 0; i < soramList->count; ++i) + if (soramList->data[i].ref > 0) + ++count; + if (count) + return 1; + soram_vector_list_free(soramList); + soramList = 0; +#endif + return 1; +} + +static void soramLock() +{ + pthread_mutex_lock(&soramMutex); +} + +static void soramUnlock() +{ + pthread_mutex_unlock(&soramMutex); +} + +// Wrapper to call memfd_create_cust syscall +static inline int memfd_create_cust(const char *pathname, int flags) +{ + return syscall(319, pathname, flags); +} + +// Returns a file descriptor where we can write our shared object +static int open_ramfs(const char *bname) +{ + int fd = memfd_create_cust(bname, 1); + if (fd < 0) + fd = shm_open(bname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + return fd; +} + +static int is_xz(const char *pathname) +{ + uint32_t buffer[2]; + FILE*hf=fopen(pathname, "rb"); + buffer[0] = 0; + if (hf) + { + if (fread(buffer, 1, 4, hf) != 4) + { + buffer[0] = 0; + } + fclose(hf); + } + return (ntohl(buffer[0]) == 0xfd377a58) ? 0 : -1; +} + +static int open_xz(const char *pathname,const char *bname) +{ + int status = -1; + size_t size = 0x1000, rchunk = 0, wchunk = 0; + char *buffer; + FILE *fp; + int fd; + + fd = open_ramfs(bname); + if (fd < 0) + return fd; + + buffer = (char*)malloc(size+8); + if (buffer) + { + snprintf(buffer, size, "xz -cd '%s'", pathname); + fp = popen(buffer, "re"); + if (fp != 0) + { + while (!feof(fp) && !ferror(fp)) + { + rchunk=TEMP_FAILURE_RETRY(fread(buffer, 1, size, fp)); + if (rchunk > 0) + { + wchunk=TEMP_FAILURE_RETRY(write(fd, buffer, rchunk)); + if (wchunk != rchunk) + break; + } + } + status = pclose(fp); + } + + free(buffer); + if ((status == 0) && (wchunk == rchunk)) + return fd; + } + + close(fd); + return -1; +} + +static int dlcallback(struct dl_phdr_info *info, size_t size, void *data) +{ + if (info && info->dlpi_name) + debug_printf("\t[+] %s\n", info->dlpi_name); + return 0; +} + +// Load the shared object +static dylib_t soramLoad(const char *pathname, int flag) +{ + char path[1024]; + char shmp[1024]; + void *handle; + ssize_t size; + char *dname, *bname; + soramHandle_t *so; + + if (is_xz(pathname) < 0) + return 0; + + dname = strdup(pathname); + if (dname == 0) + return 0; + bname = basename(dname); + + soramLock(); + so = soramFindName(bname); + if (so) + { + ++so->ref; + soramUnlock(); + free(dname); + return so->handle; + } + + debug_printf("[INFO] [dylib] soramLoad(%s)\n", pathname); + int fd = open_xz(pathname, bname); + if (fd < 0) + { + soramUnlock(); + free(dname); + return 0; + } + + snprintf(path, 1024, "/proc/self/fd/%d", fd); + handle = dlopen(path, flag); + size = readlink(path, shmp, 1024); + close(fd); + dl_iterate_phdr(dlcallback, 0); + if ((size > 9) && (memcmp(shmp, "/dev/shm/", 9) == 0)) + { + debug_printf("\t\tshm_unlink(%s) - ", bname); + errno = 0; + flag = shm_unlink(bname); + debug_printf("%d\n", errno); + if (flag < 0) + { + debug_printf("\t\t unlink(%s) - ", shmp); + errno = 0; + unlink(shmp); + debug_printf("%d\n", errno); + } + } + soramAdd(bname, handle); + soramUnlock(); + free(dname); + debug_printf("[INFO] [dylib] soramLoad(%s) - %s\n", pathname, handle?"ok":"fail"); + return handle; +} + +static bool soramUnload(dylib_t handle) +{ + bool ret; + soramLock(); + ret = soramRemove(handle); + soramUnlock(); + return ret; +} +#endif //soramLoader + /* Assume W-functions do not work below Win2K and Xbox platforms */ #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) @@ -93,7 +357,12 @@ dylib_t dylib_load(const char *path) } last_dyn_error[0] = 0; #else - dylib_t lib = dlopen(path, RTLD_LAZY); + dylib_t lib; +#ifdef soramLoader + lib = soramLoad(path, RTLD_LAZY); + if (!lib) +#endif + lib = dlopen(path, RTLD_LAZY); #endif return lib; } @@ -158,8 +427,13 @@ void dylib_close(dylib_t lib) set_dl_error(); last_dyn_error[0] = 0; #else +#ifdef soramLoader + if (soramUnload(lib) == 0) +#endif #ifndef NO_DLCLOSE - dlclose(lib); + dlclose(lib); +#else + ; #endif #endif } From 2a4f42aba0f673904a8cbe09bfec9399160150aa Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 16:45:15 +0100 Subject: [PATCH 0416/1292] Updated wording included link to support page incase/when help is required. --- Makefile.classic_armv7_a7 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index 9a94a26ec5..599c7cb8c2 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -1,3 +1,8 @@ +# This build was put together and is maintained by ModMyClassic.com for Libretro. +# The purpose is to have Libretro have a proper official build platform for classic consoles. +# If you need any help in building for the classics or have any questions then please visit +# https://modmyclassic.com/comp and we will help in any way possible! + # Building Prerequisites ############## # arm-linux-gnueabihf-gcc-8 # arm-linux-gnueabihf-g++-8 @@ -46,6 +51,7 @@ retroarch: patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary... #HAKCHI BUILD (NESC, SNESC) + #FYI this build was originally known as RetroArch 'Neo' for Hakchi. @echo "** BUILDING CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **" rm -fr /tmp/$(HAKCHI_DIR) cd /tmp/; git clone $(HAKCHI_GIT) @@ -99,5 +105,6 @@ clean: rm -f retroarch rm -f $(CLASSIC_MODS_VER).hmod rm -f version.all version.dtd - mv version_BACKUP.all version.all && mv version_BACKUP.dtd version.dtd + mv -f version_BACKUP.all version.all || echo "Backup Doesn't Exist - Ignoring..." + mv -f version_BACKUP.dtd version.dtd || echo "Backup Doesn't Exist - Ignoring..." rm -f *_BACKUP* From cff8c7741cfe1092edfa876ec891b3b33c5a5bfc Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 16:47:46 +0100 Subject: [PATCH 0417/1292] Fixed tabbing and grammar on Makefile for A7A7 --- Makefile.classic_armv7_a7 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7 index 599c7cb8c2..34dc715cb5 100644 --- a/Makefile.classic_armv7_a7 +++ b/Makefile.classic_armv7_a7 @@ -1,5 +1,5 @@ # This build was put together and is maintained by ModMyClassic.com for Libretro. -# The purpose is to have Libretro have a proper official build platform for classic consoles. +# The purpose is to give Libretro a proper "official" build platform for classic consoles. # If you need any help in building for the classics or have any questions then please visit # https://modmyclassic.com/comp and we will help in any way possible! @@ -105,6 +105,6 @@ clean: rm -f retroarch rm -f $(CLASSIC_MODS_VER).hmod rm -f version.all version.dtd - mv -f version_BACKUP.all version.all || echo "Backup Doesn't Exist - Ignoring..." - mv -f version_BACKUP.dtd version.dtd || echo "Backup Doesn't Exist - Ignoring..." + mv -f version_BACKUP.all version.all || echo "Backup Doesn't Exist - Ignoring..." + mv -f version_BACKUP.dtd version.dtd || echo "Backup Doesn't Exist - Ignoring..." rm -f *_BACKUP* From 6b96ff82dedbbb822f764941b3f3a764ec5845e9 Mon Sep 17 00:00:00 2001 From: Nay Slayer Date: Thu, 25 Oct 2018 19:40:24 +0300 Subject: [PATCH 0418/1292] Fix xmb.c and stripes.c menu drivers texture memory leak --- menu/drivers/stripes.c | 10 +++++----- menu/drivers/xmb.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index e72a569eba..54e25254d9 100755 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -897,7 +897,7 @@ static void stripes_update_thumbnail_path(void *data, unsigned i, char pos) } else if (filebrowser_get_type() != FILEBROWSER_NONE) { - stripes->thumbnail = 0; + video_driver_texture_unload(&stripes->thumbnail); goto end; } @@ -921,7 +921,7 @@ static void stripes_update_thumbnail_path(void *data, unsigned i, char pos) } else { - stripes->left_thumbnail = 0; + video_driver_texture_unload(&stripes->left_thumbnail); goto end; } } @@ -1075,7 +1075,7 @@ static void stripes_update_thumbnail_image(void *data) task_push_image_load(stripes->thumbnail_file_path, menu_display_handle_thumbnail_upload, NULL); else - stripes->thumbnail = 0; + video_driver_texture_unload(&stripes->thumbnail); free(stripes->thumbnail_file_path); stripes->thumbnail_file_path = NULL; @@ -1087,7 +1087,7 @@ static void stripes_update_thumbnail_image(void *data) task_push_image_load(stripes->left_thumbnail_file_path, menu_display_handle_left_thumbnail_upload, NULL); else - stripes->left_thumbnail = 0; + video_driver_texture_unload(&stripes->left_thumbnail); free(stripes->left_thumbnail_file_path); stripes->left_thumbnail_file_path = NULL; @@ -1136,7 +1136,7 @@ static void stripes_update_savestate_thumbnail_image(void *data) task_push_image_load(stripes->savestate_thumbnail_file_path, menu_display_handle_savestate_thumbnail_upload, NULL); else - stripes->savestate_thumbnail = 0; + video_driver_texture_unload(&stripes->savestate_thumbnail); } static unsigned stripes_get_system_tab(stripes_handle_t *stripes, unsigned i) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 2a5b13fb19..9a8025b9d3 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -948,7 +948,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i, char pos) } else if (filebrowser_get_type() != FILEBROWSER_NONE) { - xmb->thumbnail = 0; + video_driver_texture_unload(&xmb->thumbnail); goto end; } @@ -976,7 +976,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i, char pos) sizeof(new_path)); } else - xmb->left_thumbnail = 0; + video_driver_texture_unload(&xmb->left_thumbnail); goto end; } } @@ -1129,7 +1129,7 @@ static void xmb_update_thumbnail_image(void *data) task_push_image_load(xmb->thumbnail_file_path, menu_display_handle_thumbnail_upload, NULL); else - xmb->thumbnail = 0; + video_driver_texture_unload(&xmb->thumbnail); free(xmb->thumbnail_file_path); xmb->thumbnail_file_path = NULL; @@ -1141,7 +1141,7 @@ static void xmb_update_thumbnail_image(void *data) task_push_image_load(xmb->left_thumbnail_file_path, menu_display_handle_left_thumbnail_upload, NULL); else - xmb->left_thumbnail = 0; + video_driver_texture_unload(&xmb->left_thumbnail); free(xmb->left_thumbnail_file_path); xmb->left_thumbnail_file_path = NULL; @@ -1190,7 +1190,7 @@ static void xmb_update_savestate_thumbnail_image(void *data) task_push_image_load(xmb->savestate_thumbnail_file_path, menu_display_handle_savestate_thumbnail_upload, NULL); else - xmb->savestate_thumbnail = 0; + video_driver_texture_unload(&xmb->savestate_thumbnail); } static unsigned xmb_get_system_tab(xmb_handle_t *xmb, unsigned i) From 4a4d7f5e2f7c3a03faf8cef8a099b4c5fa2fa883 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Thu, 25 Oct 2018 18:48:10 +0100 Subject: [PATCH 0419/1292] Revert MM dynamic code for seperate PR and rework --- libretro-common/dynamic/dylib.c | 278 +------------------------------- 1 file changed, 2 insertions(+), 276 deletions(-) diff --git a/libretro-common/dynamic/dylib.c b/libretro-common/dynamic/dylib.c index e57ef62678..bc6be9fc40 100644 --- a/libretro-common/dynamic/dylib.c +++ b/libretro-common/dynamic/dylib.c @@ -34,270 +34,6 @@ #include #endif -#if defined(__linux__) && !defined(ANDROID) -#define soramLoader -#endif - -#ifdef soramLoader -// stolen from here: https://x-c3ll.github.io/posts/fileless-memfd_create/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define debug_printf(...) //printf(__VA_ARGS__) - -typedef struct _soramHandle -{ - dylib_t handle; - char*soname; - int32_t ref; -} soramHandle_t; - -#define VECTOR_LIST_TYPE soramHandle_t -#define VECTOR_LIST_NAME soram -#include <../lists/vector_list.c> -typedef struct TYPE_NAME() soramList_t; -#undef VECTOR_LIST_TYPE -#undef VECTOR_LIST_NAME - -static soramList_t *soramList = 0; -static pthread_mutex_t soramMutex = PTHREAD_MUTEX_INITIALIZER; - -static soramHandle_t*soramFindName(const char*soname) -{ - size_t i; - if (soramList == 0) - return 0; - for (i = 0; i < soramList->count; ++i) - if (strcmp(soname, soramList->data[i].soname) == 0) - return &soramList->data[i]; - return 0; -} - -static soramHandle_t*soramFindHandle(dylib_t handle) -{ - size_t i; - if (soramList == 0) - return 0; - for (i = 0; i < soramList->count; ++i) - if (handle == soramList->data[i].handle) - return &soramList->data[i]; - return 0; -} - -static void soramAdd(const char*soname,dylib_t handle) -{ - soramHandle_t *so, _so; - if (soramList == 0) - soramList = soram_vector_list_new(); - so = soramFindHandle(0); - if (so == 0) - so = &_so; - so->handle = handle; - so->soname = strdup(soname); - so->ref = 1; - soram_vector_list_append(soramList, *so); -} - -static bool soramRemove(dylib_t handle) -{ - size_t i,count; - soramHandle_t *so = soramFindHandle(handle); - if (so == 0) - return 0; - if (--so->ref > 0) - return 1; -#ifndef NO_DLCLOSE - dlclose(so->handle); - free(so->soname); - so->handle = 0; - so->soname = 0; - count = 0; - for (i = 0; i < soramList->count; ++i) - if (soramList->data[i].ref > 0) - ++count; - if (count) - return 1; - soram_vector_list_free(soramList); - soramList = 0; -#endif - return 1; -} - -static void soramLock() -{ - pthread_mutex_lock(&soramMutex); -} - -static void soramUnlock() -{ - pthread_mutex_unlock(&soramMutex); -} - -// Wrapper to call memfd_create_cust syscall -static inline int memfd_create_cust(const char *pathname, int flags) -{ - return syscall(319, pathname, flags); -} - -// Returns a file descriptor where we can write our shared object -static int open_ramfs(const char *bname) -{ - int fd = memfd_create_cust(bname, 1); - if (fd < 0) - fd = shm_open(bname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - return fd; -} - -static int is_xz(const char *pathname) -{ - uint32_t buffer[2]; - FILE*hf=fopen(pathname, "rb"); - buffer[0] = 0; - if (hf) - { - if (fread(buffer, 1, 4, hf) != 4) - { - buffer[0] = 0; - } - fclose(hf); - } - return (ntohl(buffer[0]) == 0xfd377a58) ? 0 : -1; -} - -static int open_xz(const char *pathname,const char *bname) -{ - int status = -1; - size_t size = 0x1000, rchunk = 0, wchunk = 0; - char *buffer; - FILE *fp; - int fd; - - fd = open_ramfs(bname); - if (fd < 0) - return fd; - - buffer = (char*)malloc(size+8); - if (buffer) - { - snprintf(buffer, size, "xz -cd '%s'", pathname); - fp = popen(buffer, "re"); - if (fp != 0) - { - while (!feof(fp) && !ferror(fp)) - { - rchunk=TEMP_FAILURE_RETRY(fread(buffer, 1, size, fp)); - if (rchunk > 0) - { - wchunk=TEMP_FAILURE_RETRY(write(fd, buffer, rchunk)); - if (wchunk != rchunk) - break; - } - } - status = pclose(fp); - } - - free(buffer); - if ((status == 0) && (wchunk == rchunk)) - return fd; - } - - close(fd); - return -1; -} - -static int dlcallback(struct dl_phdr_info *info, size_t size, void *data) -{ - if (info && info->dlpi_name) - debug_printf("\t[+] %s\n", info->dlpi_name); - return 0; -} - -// Load the shared object -static dylib_t soramLoad(const char *pathname, int flag) -{ - char path[1024]; - char shmp[1024]; - void *handle; - ssize_t size; - char *dname, *bname; - soramHandle_t *so; - - if (is_xz(pathname) < 0) - return 0; - - dname = strdup(pathname); - if (dname == 0) - return 0; - bname = basename(dname); - - soramLock(); - so = soramFindName(bname); - if (so) - { - ++so->ref; - soramUnlock(); - free(dname); - return so->handle; - } - - debug_printf("[INFO] [dylib] soramLoad(%s)\n", pathname); - int fd = open_xz(pathname, bname); - if (fd < 0) - { - soramUnlock(); - free(dname); - return 0; - } - - snprintf(path, 1024, "/proc/self/fd/%d", fd); - handle = dlopen(path, flag); - size = readlink(path, shmp, 1024); - close(fd); - dl_iterate_phdr(dlcallback, 0); - if ((size > 9) && (memcmp(shmp, "/dev/shm/", 9) == 0)) - { - debug_printf("\t\tshm_unlink(%s) - ", bname); - errno = 0; - flag = shm_unlink(bname); - debug_printf("%d\n", errno); - if (flag < 0) - { - debug_printf("\t\t unlink(%s) - ", shmp); - errno = 0; - unlink(shmp); - debug_printf("%d\n", errno); - } - } - soramAdd(bname, handle); - soramUnlock(); - free(dname); - debug_printf("[INFO] [dylib] soramLoad(%s) - %s\n", pathname, handle?"ok":"fail"); - return handle; -} - -static bool soramUnload(dylib_t handle) -{ - bool ret; - soramLock(); - ret = soramRemove(handle); - soramUnlock(); - return ret; -} -#endif //soramLoader - /* Assume W-functions do not work below Win2K and Xbox platforms */ #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) @@ -357,12 +93,7 @@ dylib_t dylib_load(const char *path) } last_dyn_error[0] = 0; #else - dylib_t lib; -#ifdef soramLoader - lib = soramLoad(path, RTLD_LAZY); - if (!lib) -#endif - lib = dlopen(path, RTLD_LAZY); + dylib_t lib = dlopen(path, RTLD_LAZY); #endif return lib; } @@ -427,13 +158,8 @@ void dylib_close(dylib_t lib) set_dl_error(); last_dyn_error[0] = 0; #else -#ifdef soramLoader - if (soramUnload(lib) == 0) -#endif #ifndef NO_DLCLOSE - dlclose(lib); -#else - ; + dlclose(lib); #endif #endif } From 158ddc0b2a927718e30849763a0ab90b1b468a5d Mon Sep 17 00:00:00 2001 From: natinusala Date: Tue, 18 Sep 2018 15:13:33 +0200 Subject: [PATCH 0420/1292] New menu driver : ozone (Nintendo Switch lookalike) --- .vscode/c_cpp_properties.json | 6 +- .vscode/settings.json | 6 +- Makefile.common | 11 + Makefile.libnx | 2 + cheevos-new/cheevos.c | 5 +- cheevos/cheevos.c | 5 +- configuration.c | 5 + griffin/griffin.c | 3 + menu/drivers/materialui.c | 8 - menu/drivers/ozone.c | 3038 +++++++++++++++++++++++++++++++++ menu/menu_animation.c | 4 +- menu/menu_animation.h | 3 +- menu/menu_driver.c | 22 +- menu/menu_driver.h | 5 + menu/menu_setting.c | 12 +- qb/config.libs.sh | 6 +- qb/config.params.sh | 1 + 17 files changed, 3118 insertions(+), 24 deletions(-) create mode 100644 menu/drivers/ozone.c diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 26319581dc..eec6a8bb70 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -30,7 +30,8 @@ "/usr/include", "/usr/local/include", "${workspaceRoot}", - "${workspaceFolder}/libretro-common/include" + "${workspaceFolder}/libretro-common/include", + "${workspaceRoot}/libretro-common/include" ], "defines": [], "intelliSenseMode": "clang-x64", @@ -51,7 +52,8 @@ "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt", - "${workspaceRoot}" + "${workspaceRoot}", + "${workspaceFolder}/libretro-common/include" ], "defines": [ "_DEBUG", diff --git a/.vscode/settings.json b/.vscode/settings.json index 148f4b83ea..c08df32eb9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,7 +22,11 @@ "ios": "c", "list": "c", "input_driver.h": "c", - "video_driver.h": "c" + "video_driver.h": "c", + "menu_driver.h": "c", + "file_path.h": "c", + "unordered_map": "c", + "unordered_set": "c" }, "C_Cpp.dimInactiveRegions": false, } \ No newline at end of file diff --git a/Makefile.common b/Makefile.common index ff6ff02411..73836d6fd1 100644 --- a/Makefile.common +++ b/Makefile.common @@ -677,12 +677,17 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1) ifeq ($(HAVE_STRIPES),) HAVE_STRIPES = 1 endif + + ifeq ($(HAVE_OZONE),) + HAVE_OZONE = 1 + endif else HAVE_ZARCH ?= 0 HAVE_MATERIALUI ?= 0 #HAVE_NUKLEAR ?= 0 HAVE_XMB ?= 0 HAVE_STRIPES ?= 0 + HAVE_OZONE ?= 0 endif ifeq ($(HAVE_RGUI), 1) @@ -714,6 +719,12 @@ ifeq ($(HAVE_XMB), 1) HAVE_MENU_COMMON = 1 endif +ifeq ($(HAVE_OZONE), 1) + OBJ += menu/drivers/ozone.o + DEFINES += -DHAVE_OZONE + HAVE_MENU_COMMON = 1 +endif + ifeq ($(HAVE_STRIPES), 1) OBJ += menu/drivers/stripes.o DEFINES += -DHAVE_STRIPES diff --git a/Makefile.libnx b/Makefile.libnx index d417ee1a5e..709f03364c 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -58,6 +58,7 @@ ifeq ($(HAVE_OPENGL), 1) HAVE_ZARCH = 0 HAVE_XMB = 1 + HAVE_OZONE = 0 HAVE_STRIPES = 0 HAVE_OVERLAY = 1 @@ -67,6 +68,7 @@ else HAVE_ZARCH = 0 HAVE_MATERIALUI = 0 HAVE_XMB = 0 + HAVE_OZONE = 0 HAVE_STRIPES = 0 endif diff --git a/cheevos-new/cheevos.c b/cheevos-new/cheevos.c index e67af93c59..3539db7938 100644 --- a/cheevos-new/cheevos.c +++ b/cheevos-new/cheevos.c @@ -1743,7 +1743,10 @@ found: { settings_t *settings = config_get_ptr(); - if (!string_is_equal(settings->arrays.menu_driver, "xmb") || + if (!( + string_is_equal(settings->arrays.menu_driver, "xmb") || + !string_is_equal(settings->arrays.menu_driver, "ozone") + ) || !settings->bools.cheevos_badges_enable) CORO_RET(); } diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index d6d1b36325..134e7e6513 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -3229,7 +3229,10 @@ found: { settings_t *settings = config_get_ptr(); - if (!string_is_equal(settings->arrays.menu_driver, "xmb") || + if (!( + string_is_equal(settings->arrays.menu_driver, "xmb") || + !string_is_equal(settings->arrays.menu_driver, "ozone") + ) || !settings->bools.cheevos_badges_enable) CORO_RET(); } diff --git a/configuration.c b/configuration.c index ceac27d6c2..7dfa178c30 100644 --- a/configuration.c +++ b/configuration.c @@ -288,6 +288,7 @@ enum menu_driver_enum MENU_XMB, MENU_STRIPES, MENU_NUKLEAR, + MENU_OZONE, MENU_NULL }; @@ -534,6 +535,8 @@ static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_NULL; static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XUI; #elif defined(HAVE_MATERIALUI) && defined(RARCH_MOBILE) static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_MATERIALUI; +#elif defined(HAVE_OZONE) && defined(HAVE_LIBNX) +static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_OZONE; #elif defined(HAVE_XMB) && !defined(_XBOX) static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XMB; #elif defined(HAVE_RGUI) @@ -1028,6 +1031,8 @@ const char *config_get_default_menu(void) return "rgui"; case MENU_XUI: return "xui"; + case MENU_OZONE: + return "ozone"; case MENU_MATERIALUI: return "glui"; case MENU_XMB: diff --git a/griffin/griffin.c b/griffin/griffin.c index d1be92b996..237ce3a9c5 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1264,6 +1264,9 @@ MENU #ifdef HAVE_XMB #include "../menu/drivers/xmb.c" #endif +#ifdef HAVE_OZONE +#include "../menu/drivers/ozone.c" +#endif #ifdef HAVE_STRIPES #include "../menu/drivers/stripes.c" diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 752dc1caa8..2c625ba881 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -183,14 +183,6 @@ typedef struct materialui_handle } materialui_handle_t; -static void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha) -{ - rgba[0] = rgba[4] = rgba[8] = rgba[12] = ((hex >> 16) & 0xFF) * (1.0f / 255.0f); /* r */ - rgba[1] = rgba[5] = rgba[9] = rgba[13] = ((hex >> 8 ) & 0xFF) * (1.0f / 255.0f); /* g */ - rgba[2] = rgba[6] = rgba[10] = rgba[14] = ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f); /* b */ - rgba[3] = rgba[7] = rgba[11] = rgba[15] = alpha; -} - static const char *materialui_texture_path(unsigned id) { switch (id) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c new file mode 100644 index 0000000000..a148d73112 --- /dev/null +++ b/menu/drivers/ozone.c @@ -0,0 +1,3038 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Brad Parker + * Copyright (C) 2018 - Alfredo Monclús + * Copyright (C) 2018 - natinusala + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include +#include + +#include "menu_generic.h" +#include "../menu_driver.h" +#include "../menu_animation.h" + +#include "../../configuration.h" + +#include "../../cheevos/badges.h" +#include "../../content.h" + +#include "../../core_info.h" +#include "../../core.h" + +#include "../../retroarch.h" +#include "../../verbosity.h" + +//TODO Handle translation for hardcoded strings (footer...) + +#define FONT_SIZE_FOOTER 18 +#define FONT_SIZE_TITLE 36 +#define FONT_SIZE_TIME 22 +#define FONT_SIZE_ENTRIES_LABEL 24 +#define FONT_SIZE_ENTRIES_SUBLABEL 18 +#define FONT_SIZE_SIDEBAR 24 + +#define ANIMATION_PUSH_ENTRY_DURATION 10 +#define ANIMATION_CURSOR_DURATION 8 + +#define ENTRIES_START_Y 127 + +static float ozone_pure_white[16] = { + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, +}; + +enum OZONE_TEXTURE { + OZONE_TEXTURE_RETROARCH = 0, + + OZONE_TEXTURE_LAST +}; + +static char *OZONE_TEXTURES_FILES[OZONE_TEXTURE_LAST] = { + "retroarch" +}; + +enum OZONE_THEME_TEXTURES { + OZONE_THEME_TEXTURE_BUTTON_A = 0, + OZONE_THEME_TEXTURE_BUTTON_B, + OZONE_THEME_TEXTURE_SWITCH, + + OZONE_THEME_TEXTURE_LAST +}; + +static char* OZONE_THEME_TEXTURES_FILES[OZONE_THEME_TEXTURE_LAST] = { + "button_a", + "button_b", + "switch", +}; + +enum OZONE_TAB_TEXTURES { + OZONE_TAB_TEXTURE_MAIN_MENU = 0, + OZONE_TAB_TEXTURE_SETTINGS, + OZONE_TAB_TEXTURE_HISTORY, + OZONE_TAB_TEXTURE_FAVORITES, + OZONE_TAB_TEXTURE_MUSIC, + OZONE_TAB_TEXTURE_VIDEO, + OZONE_TAB_TEXTURE_IMAGE, + OZONE_TAB_TEXTURE_NETWORK, + OZONE_TAB_TEXTURE_SCAN_CONTENT, + + OZONE_TAB_TEXTURE_LAST +}; + +static char *OZONE_TAB_TEXTURES_FILES[OZONE_TAB_TEXTURE_LAST] = { + "retroarch", + "settings", + "history", + "favorites", + "music", + "video", + "image", + "netplay", + "add" +}; + +enum +{ + OZONE_SYSTEM_TAB_MAIN = 0, + OZONE_SYSTEM_TAB_SETTINGS, + OZONE_SYSTEM_TAB_HISTORY, + OZONE_SYSTEM_TAB_FAVORITES, + OZONE_SYSTEM_TAB_MUSIC, +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + OZONE_SYSTEM_TAB_VIDEO, +#endif +#ifdef HAVE_IMAGEVIEWER + OZONE_SYSTEM_TAB_IMAGES, +#endif +#ifdef HAVE_NETWORKING + OZONE_SYSTEM_TAB_NETPLAY, +#endif + OZONE_SYSTEM_TAB_ADD, + + /* End of this enum - use the last one to determine num of possible tabs */ + OZONE_SYSTEM_TAB_LAST +}; + +static enum msg_hash_enums ozone_system_tabs_value[OZONE_SYSTEM_TAB_LAST] = { + MENU_ENUM_LABEL_VALUE_MAIN_MENU, + MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, + MENU_ENUM_LABEL_VALUE_HISTORY_TAB, + MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, + MENU_ENUM_LABEL_VALUE_MUSIC_TAB, +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + MENU_ENUM_LABEL_VALUE_VIDEO_TAB, +#endif +#ifdef HAVE_IMAGEVIEWER + MENU_ENUM_LABEL_VALUE_IMAGES_TAB, +#endif +#ifdef HAVE_NETWORKING + MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, +#endif + MENU_ENUM_LABEL_VALUE_ADD_TAB +}; + +static enum menu_settings_type ozone_system_tabs_type[OZONE_SYSTEM_TAB_LAST] = { + MENU_SETTINGS, + MENU_SETTINGS_TAB, + MENU_HISTORY_TAB, + MENU_FAVORITES_TAB, + MENU_MUSIC_TAB, +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + MENU_VIDEO_TAB, +#endif +#ifdef HAVE_IMAGEVIEWER + MENU_IMAGES_TAB, +#endif +#ifdef HAVE_NETWORKING + MENU_NETPLAY_TAB, +#endif + MENU_ADD_TAB +}; + +static enum msg_hash_enums ozone_system_tabs_idx[OZONE_SYSTEM_TAB_LAST] = { + MENU_ENUM_LABEL_MAIN_MENU, + MENU_ENUM_LABEL_SETTINGS_TAB, + MENU_ENUM_LABEL_HISTORY_TAB, + MENU_ENUM_LABEL_FAVORITES_TAB, + MENU_ENUM_LABEL_MUSIC_TAB, +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + MENU_ENUM_LABEL_VIDEO_TAB, +#endif +#ifdef HAVE_IMAGEVIEWER + MENU_ENUM_LABEL_IMAGES_TAB, +#endif +#ifdef HAVE_NETWORKING + MENU_ENUM_LABEL_NETPLAY_TAB, +#endif + MENU_ENUM_LABEL_ADD_TAB +}; + +enum +{ + OZONE_ENTRIES_ICONS_TEXTURE_MAIN_MENU = 0, + OZONE_ENTRIES_ICONS_TEXTURE_SETTINGS, + OZONE_ENTRIES_ICONS_TEXTURE_HISTORY, + OZONE_ENTRIES_ICONS_TEXTURE_FAVORITES, + OZONE_ENTRIES_ICONS_TEXTURE_MUSICS, +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + OZONE_ENTRIES_ICONS_TEXTURE_MOVIES, +#endif +#ifdef HAVE_NETWORKING + OZONE_ENTRIES_ICONS_TEXTURE_NETPLAY, + OZONE_ENTRIES_ICONS_TEXTURE_ROOM, + OZONE_ENTRIES_ICONS_TEXTURE_ROOM_LAN, + OZONE_ENTRIES_ICONS_TEXTURE_ROOM_RELAY, +#endif +#ifdef HAVE_IMAGEVIEWER + OZONE_ENTRIES_ICONS_TEXTURE_IMAGES, +#endif + OZONE_ENTRIES_ICONS_TEXTURE_SETTING, + OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING, + OZONE_ENTRIES_ICONS_TEXTURE_ARROW, + OZONE_ENTRIES_ICONS_TEXTURE_RUN, + OZONE_ENTRIES_ICONS_TEXTURE_CLOSE, + OZONE_ENTRIES_ICONS_TEXTURE_RESUME, + OZONE_ENTRIES_ICONS_TEXTURE_SAVESTATE, + OZONE_ENTRIES_ICONS_TEXTURE_LOADSTATE, + OZONE_ENTRIES_ICONS_TEXTURE_UNDO, + OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO, + OZONE_ENTRIES_ICONS_TEXTURE_WIFI, + OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS, + OZONE_ENTRIES_ICONS_TEXTURE_INPUT_REMAPPING_OPTIONS, + OZONE_ENTRIES_ICONS_TEXTURE_CHEAT_OPTIONS, + OZONE_ENTRIES_ICONS_TEXTURE_DISK_OPTIONS, + OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS, + OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENT_LIST, + OZONE_ENTRIES_ICONS_TEXTURE_SCREENSHOT, + OZONE_ENTRIES_ICONS_TEXTURE_RELOAD, + OZONE_ENTRIES_ICONS_TEXTURE_RENAME, + OZONE_ENTRIES_ICONS_TEXTURE_FILE, + OZONE_ENTRIES_ICONS_TEXTURE_FOLDER, + OZONE_ENTRIES_ICONS_TEXTURE_ZIP, + OZONE_ENTRIES_ICONS_TEXTURE_FAVORITE, + OZONE_ENTRIES_ICONS_TEXTURE_ADD_FAVORITE, + OZONE_ENTRIES_ICONS_TEXTURE_MUSIC, + OZONE_ENTRIES_ICONS_TEXTURE_IMAGE, + OZONE_ENTRIES_ICONS_TEXTURE_MOVIE, + OZONE_ENTRIES_ICONS_TEXTURE_CORE, + OZONE_ENTRIES_ICONS_TEXTURE_RDB, + OZONE_ENTRIES_ICONS_TEXTURE_CURSOR, + OZONE_ENTRIES_ICONS_TEXTURE_SWITCH_ON, + OZONE_ENTRIES_ICONS_TEXTURE_SWITCH_OFF, + OZONE_ENTRIES_ICONS_TEXTURE_CLOCK, + OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_FULL, + OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_CHARGING, + OZONE_ENTRIES_ICONS_TEXTURE_POINTER, + OZONE_ENTRIES_ICONS_TEXTURE_ADD, + OZONE_ENTRIES_ICONS_TEXTURE_KEY, + OZONE_ENTRIES_ICONS_TEXTURE_KEY_HOVER, + OZONE_ENTRIES_ICONS_TEXTURE_DIALOG_SLICE, + OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENTS, + OZONE_ENTRIES_ICONS_TEXTURE_AUDIO, + OZONE_ENTRIES_ICONS_TEXTURE_EXIT, + OZONE_ENTRIES_ICONS_TEXTURE_FRAMESKIP, + OZONE_ENTRIES_ICONS_TEXTURE_INFO, + OZONE_ENTRIES_ICONS_TEXTURE_HELP, + OZONE_ENTRIES_ICONS_TEXTURE_NETWORK, + OZONE_ENTRIES_ICONS_TEXTURE_POWER, + OZONE_ENTRIES_ICONS_TEXTURE_SAVING, + OZONE_ENTRIES_ICONS_TEXTURE_UPDATER, + OZONE_ENTRIES_ICONS_TEXTURE_VIDEO, + OZONE_ENTRIES_ICONS_TEXTURE_RECORD, + OZONE_ENTRIES_ICONS_TEXTURE_INPUT, + OZONE_ENTRIES_ICONS_TEXTURE_MIXER, + OZONE_ENTRIES_ICONS_TEXTURE_LOG, + OZONE_ENTRIES_ICONS_TEXTURE_OSD, + OZONE_ENTRIES_ICONS_TEXTURE_UI, + OZONE_ENTRIES_ICONS_TEXTURE_USER, + OZONE_ENTRIES_ICONS_TEXTURE_PRIVACY, + OZONE_ENTRIES_ICONS_TEXTURE_LATENCY, + OZONE_ENTRIES_ICONS_TEXTURE_DRIVERS, + OZONE_ENTRIES_ICONS_TEXTURE_PLAYLIST, + OZONE_ENTRIES_ICONS_TEXTURE_QUICKMENU, + OZONE_ENTRIES_ICONS_TEXTURE_REWIND, + OZONE_ENTRIES_ICONS_TEXTURE_OVERLAY, + OZONE_ENTRIES_ICONS_TEXTURE_OVERRIDE, + OZONE_ENTRIES_ICONS_TEXTURE_NOTIFICATIONS, + OZONE_ENTRIES_ICONS_TEXTURE_STREAM, + OZONE_ENTRIES_ICONS_TEXTURE_LAST +}; + +static unsigned ozone_system_tabs_icons[OZONE_SYSTEM_TAB_LAST] = { + OZONE_TAB_TEXTURE_MAIN_MENU, + OZONE_TAB_TEXTURE_SETTINGS, + OZONE_TAB_TEXTURE_HISTORY, + OZONE_TAB_TEXTURE_FAVORITES, + OZONE_TAB_TEXTURE_MUSIC, +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + OZONE_TAB_TEXTURE_VIDEO, +#endif +#ifdef HAVE_IMAGEVIEWER + OZONE_TAB_TEXTURE_IMAGE, +#endif +#ifdef HAVE_NETWORKING + OZONE_TAB_TEXTURE_NETWORK, +#endif + OZONE_TAB_TEXTURE_SCAN_CONTENT +}; + +#define HEX_R(hex) ((hex >> 16) & 0xFF) * (1.0f / 255.0f) +#define HEX_G(hex) ((hex >> 8 ) & 0xFF) * (1.0f / 255.0f) +#define HEX_B(hex) ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f) + +#define COLOR_HEX_TO_FLOAT(hex, alpha) { \ + HEX_R(hex), HEX_G(hex), HEX_B(hex), alpha, \ + HEX_R(hex), HEX_G(hex), HEX_B(hex), alpha, \ + HEX_R(hex), HEX_G(hex), HEX_B(hex), alpha, \ + HEX_R(hex), HEX_G(hex), HEX_B(hex), alpha \ +} + +#define COLOR_BACKGROUND(hex) hex, HEX_R(hex), HEX_G(hex), HEX_B(hex) + +static float ozone_sidebar_background_light[16] = { + 0.94, 0.94, 0.94, 1.00, + 0.94, 0.94, 0.94, 1.00, + 0.94, 0.94, 0.94, 1.00, + 0.94, 0.94, 0.94, 1.00, +}; + +static float ozone_sidebar_gradient_top_light[16] = { + 0.94, 0.94, 0.94, 1.00, + 0.94, 0.94, 0.94, 1.00, + 0.922, 0.922, 0.922, 1.00, + 0.922, 0.922, 0.922, 1.00, +}; + +static float ozone_sidebar_gradient_bottom_light[16] = { + 0.922, 0.922, 0.922, 1.00, + 0.922, 0.922, 0.922, 1.00, + 0.94, 0.94, 0.94, 1.00, + 0.94, 0.94, 0.94, 1.00, +}; + +static float ozone_sidebar_background_dark[16] = { + 0.2, 0.2, 0.2, 1.00, + 0.2, 0.2, 0.2, 1.00, + 0.2, 0.2, 0.2, 1.00, + 0.2, 0.2, 0.2, 1.00, +}; + +static float ozone_sidebar_gradient_top_dark[16] = { + 0.2, 0.2, 0.2, 1.00, + 0.2, 0.2, 0.2, 1.00, + 0.18, 0.18, 0.18, 1.00, + 0.18, 0.18, 0.18, 1.00, +}; + +static float ozone_sidebar_gradient_bottom_dark[16] = { + 0.18, 0.18, 0.18, 1.00, + 0.18, 0.18, 0.18, 1.00, + 0.2, 0.2, 0.2, 1.00, + 0.2, 0.2, 0.2, 1.00, +}; + +typedef struct ozone_theme +{ + //Background color + uint32_t background_rgb; + float background_r; + float background_g; + float background_b; + + //Float colors for quads and icons + float header_footer_separator[16]; + float text[16]; + float selection[16]; + float selection_border[16]; + float entries_border[16]; + float entries_icon[16]; + float text_selected[16]; + + //RGBA colors for text + uint32_t text_rgba; + uint32_t text_selected_rgba; + uint32_t text_sublabel_rgba; + + //Sidebar color + float *sidebar_background; + float *sidebar_top_gradient; + float *sidebar_bottom_gradient; + + const char *name; +} ozone_theme_t; + +ozone_theme_t ozone_theme_light = { + COLOR_BACKGROUND(0xEBEBEB), + + COLOR_HEX_TO_FLOAT(0x2B2B2B, 1.00), + COLOR_HEX_TO_FLOAT(0x333333, 1.00), + COLOR_HEX_TO_FLOAT(0xFFFFFF, 1.00), + COLOR_HEX_TO_FLOAT(0x10BEC5, 1.00), + COLOR_HEX_TO_FLOAT(0xCDCDCD, 1.00), + COLOR_HEX_TO_FLOAT(0x333333, 1.00), + COLOR_HEX_TO_FLOAT(0x374CFF, 1.00), + + 0x333333FF, + 0x374CFFFF, + 0x878787FF, + + ozone_sidebar_background_light, + ozone_sidebar_gradient_top_light, + ozone_sidebar_gradient_bottom_light, + + "light" +}; + +ozone_theme_t ozone_theme_dark = { + COLOR_BACKGROUND(0x2D2D2D), + + COLOR_HEX_TO_FLOAT(0xFFFFFF, 1.00), + COLOR_HEX_TO_FLOAT(0xFFFFFF, 1.00), + COLOR_HEX_TO_FLOAT(0x212227, 1.00), + COLOR_HEX_TO_FLOAT(0x2DA3CB, 1.00), + COLOR_HEX_TO_FLOAT(0x51514F, 1.00), + COLOR_HEX_TO_FLOAT(0xFFFFFF, 1.00), + COLOR_HEX_TO_FLOAT(0x00D9AE, 1.00), + + 0xFFFFFFFF, + 0x00FFC5FF, + 0x9F9FA1FF, + + ozone_sidebar_background_dark, + ozone_sidebar_gradient_top_dark, + ozone_sidebar_gradient_bottom_dark, + + "dark" +}; + +static ozone_theme_t *ozone_default_theme = &ozone_theme_light; + +typedef struct ozone_handle +{ + uint64_t frame_count; + + struct + { + font_data_t *footer; + font_data_t *title; + font_data_t *time; + font_data_t *entries_label; + font_data_t *entries_sublabel; + font_data_t *sidebar; + } fonts; + + struct + { + video_font_raster_block_t footer; + video_font_raster_block_t title; + video_font_raster_block_t time; + video_font_raster_block_t entries_label; + video_font_raster_block_t entries_sublabel; + video_font_raster_block_t sidebar; + } raster_blocks; + + menu_texture_item textures[OZONE_THEME_TEXTURE_LAST]; + menu_texture_item theme_textures[OZONE_THEME_TEXTURE_LAST]; + menu_texture_item icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_LAST]; + menu_texture_item tab_textures[OZONE_TAB_TEXTURE_LAST]; + + char title[PATH_MAX_LENGTH]; + + char assets_path[PATH_MAX_LENGTH]; + char png_path[PATH_MAX_LENGTH]; + char icons_path[PATH_MAX_LENGTH]; + char tab_path[PATH_MAX_LENGTH]; + char theme_path[PATH_MAX_LENGTH]; + + uint8_t system_tab_end; + uint8_t tabs[OZONE_SYSTEM_TAB_LAST]; + + size_t categories_selection_ptr; //active tab id + size_t categories_active_idx_old; + + bool cursor_in_sidebar; + bool cursor_in_sidebar_old; + + struct + { + float cursor_alpha; + float scroll_y; + + float list_alpha; + } animations; + + bool fade_direction; //false = left to right, true = right to left + + size_t selection; //currently selected entry + size_t selection_old; //previously selected entry (for fancy animation) + size_t selection_old_list; + + unsigned entries_height; + + int depth; + + bool draw_sidebar; + float sidebar_offset; + + unsigned title_font_glyph_width; + unsigned entry_font_glyph_width; + + ozone_theme_t *theme; + + struct { + float selection_border[16]; + float selection[16]; + float entries_border[16]; + float entries_icon[16]; + } theme_dynamic; + + bool need_compute; + + file_list_t *selection_buf_old; + + unsigned action; + bool draw_old_list; + float scroll_old; + + bool want_horizontal_animation; +} ozone_handle_t; + +/* If you change this struct, also + change ozone_alloc_node and + ozone_copy_node */ +typedef struct ozone_node +{ + unsigned height; + unsigned position_y; +} ozone_node_t; + +static const char *ozone_entries_icon_texture_path(ozone_handle_t *ozone, unsigned id) +{ + char *icon_name; + + switch (id) + { + case OZONE_ENTRIES_ICONS_TEXTURE_MAIN_MENU: +#if defined(HAVE_LAKKA) + icon_name = "lakka.png"; + break; +#else + icon_name = "retroarch.png"; + break; +#endif + case OZONE_ENTRIES_ICONS_TEXTURE_SETTINGS: + icon_name = "settings.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_HISTORY: + icon_name = "history.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_FAVORITES: + icon_name = "favorites.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ADD_FAVORITE: + icon_name = "add-favorite.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_MUSICS: + icon_name = "musics.png"; + break; +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + case OZONE_ENTRIES_ICONS_TEXTURE_MOVIES: + icon_name = "movies.png"; + break; +#endif +#ifdef HAVE_IMAGEVIEWER + case OZONE_ENTRIES_ICONS_TEXTURE_IMAGES: + icon_name = "images.png"; + break; +#endif + case OZONE_ENTRIES_ICONS_TEXTURE_SETTING: + icon_name = "setting.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING: + icon_name = "subsetting.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ARROW: + icon_name = "arrow.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_RUN: + icon_name = "run.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_CLOSE: + icon_name = "close.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_RESUME: + icon_name = "resume.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_CLOCK: + icon_name = "clock.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_FULL: + icon_name = "battery-full.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_CHARGING: + icon_name = "battery-charging.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_POINTER: + icon_name = "pointer.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_SAVESTATE: + icon_name = "savestate.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_LOADSTATE: + icon_name = "loadstate.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_UNDO: + icon_name = "undo.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO: + icon_name = "core-infos.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_WIFI: + icon_name = "wifi.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS: + icon_name = "core-options.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_REMAPPING_OPTIONS: + icon_name = "core-input-remapping-options.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_CHEAT_OPTIONS: + icon_name = "core-cheat-options.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_DISK_OPTIONS: + icon_name = "core-disk-options.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS: + icon_name = "core-shader-options.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENT_LIST: + icon_name = "achievement-list.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_SCREENSHOT: + icon_name = "screenshot.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_RELOAD: + icon_name = "reload.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_RENAME: + icon_name = "rename.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_FILE: + icon_name = "file.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_FOLDER: + icon_name = "folder.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ZIP: + icon_name = "zip.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_MUSIC: + icon_name = "music.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_FAVORITE: + icon_name = "favorites-content.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_IMAGE: + icon_name = "image.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_MOVIE: + icon_name = "movie.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_CORE: + icon_name = "core.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_RDB: + icon_name = "database.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_CURSOR: + icon_name = "cursor.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_SWITCH_ON: + icon_name = "on.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_SWITCH_OFF: + icon_name = "off.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ADD: + icon_name = "add.png"; + break; +#ifdef HAVE_NETWORKING + case OZONE_ENTRIES_ICONS_TEXTURE_NETPLAY: + icon_name = "netplay.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ROOM: + icon_name = "menu_room.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ROOM_LAN: + icon_name = "menu_room_lan.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ROOM_RELAY: + icon_name = "menu_room_relay.png"; + break; +#endif + case OZONE_ENTRIES_ICONS_TEXTURE_KEY: + icon_name = "key.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_KEY_HOVER: + icon_name = "key-hover.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_DIALOG_SLICE: + icon_name = "dialog-slice.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENTS: + icon_name = "menu_achievements.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_AUDIO: + icon_name = "menu_audio.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_DRIVERS: + icon_name = "menu_drivers.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_EXIT: + icon_name = "menu_exit.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_FRAMESKIP: + icon_name = "menu_frameskip.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_HELP: + icon_name = "menu_help.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_INFO: + icon_name = "menu_info.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_INPUT: + icon_name = "Libretro - Pad.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_LATENCY: + icon_name = "menu_latency.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_NETWORK: + icon_name = "menu_network.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_POWER: + icon_name = "menu_power.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_RECORD: + icon_name = "menu_record.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_SAVING: + icon_name = "menu_saving.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_UPDATER: + icon_name = "menu_updater.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_VIDEO: + icon_name = "menu_video.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_MIXER: + icon_name = "menu_mixer.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_LOG: + icon_name = "menu_log.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_OSD: + icon_name = "menu_osd.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_UI: + icon_name = "menu_ui.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_USER: + icon_name = "menu_user.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_PRIVACY: + icon_name = "menu_privacy.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_PLAYLIST: + icon_name = "menu_playlist.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_QUICKMENU: + icon_name = "menu_quickmenu.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_REWIND: + icon_name = "menu_rewind.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_OVERLAY: + icon_name = "menu_overlay.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_OVERRIDE: + icon_name = "menu_override.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_NOTIFICATIONS: + icon_name = "menu_notifications.png"; + break; + case OZONE_ENTRIES_ICONS_TEXTURE_STREAM: + icon_name = "menu_stream.png"; + break; + } + + char icon_fullpath[255]; + + fill_pathname_join( + icon_fullpath, + ozone->icons_path, + icon_name, + sizeof(icon_fullpath) + ); + + if (!filestream_exists(icon_fullpath)) + { + return "subsetting.png"; + } + else + return icon_name; +} + +static unsigned ozone_entries_icon_get_id(ozone_handle_t *ozone, + enum msg_hash_enums enum_idx, unsigned type, bool active) +{ + switch (enum_idx) + { + case MENU_ENUM_LABEL_CORE_OPTIONS: + case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE: + return OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS; + case MENU_ENUM_LABEL_ADD_TO_FAVORITES: + case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST: + return OZONE_ENTRIES_ICONS_TEXTURE_ADD_FAVORITE; + case MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION: + return OZONE_ENTRIES_ICONS_TEXTURE_UNDO; + case MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_INPUT_REMAPPING_OPTIONS; + case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_CHEAT_OPTIONS; + case MENU_ENUM_LABEL_DISK_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_DISK_OPTIONS; + case MENU_ENUM_LABEL_SHADER_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS; + case MENU_ENUM_LABEL_ACHIEVEMENT_LIST: + return OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENT_LIST; + case MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE: + return OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENT_LIST; + case MENU_ENUM_LABEL_SAVE_STATE: + return OZONE_ENTRIES_ICONS_TEXTURE_SAVESTATE; + case MENU_ENUM_LABEL_LOAD_STATE: + return OZONE_ENTRIES_ICONS_TEXTURE_LOADSTATE; + case MENU_ENUM_LABEL_PARENT_DIRECTORY: + case MENU_ENUM_LABEL_UNDO_LOAD_STATE: + case MENU_ENUM_LABEL_UNDO_SAVE_STATE: + return OZONE_ENTRIES_ICONS_TEXTURE_UNDO; + case MENU_ENUM_LABEL_TAKE_SCREENSHOT: + return OZONE_ENTRIES_ICONS_TEXTURE_SCREENSHOT; + case MENU_ENUM_LABEL_DELETE_ENTRY: + return OZONE_ENTRIES_ICONS_TEXTURE_CLOSE; + case MENU_ENUM_LABEL_RESTART_CONTENT: + return OZONE_ENTRIES_ICONS_TEXTURE_RELOAD; + case MENU_ENUM_LABEL_RENAME_ENTRY: + return OZONE_ENTRIES_ICONS_TEXTURE_RENAME; + case MENU_ENUM_LABEL_RESUME_CONTENT: + return OZONE_ENTRIES_ICONS_TEXTURE_RESUME; + case MENU_ENUM_LABEL_FAVORITES: + case MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST: + return OZONE_ENTRIES_ICONS_TEXTURE_FOLDER; + case MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR: + return OZONE_ENTRIES_ICONS_TEXTURE_RDB; + + + /* Menu collection submenus*/ + case MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST: + return OZONE_ENTRIES_ICONS_TEXTURE_ZIP; + case MENU_ENUM_LABEL_GOTO_FAVORITES: + return OZONE_ENTRIES_ICONS_TEXTURE_FAVORITE; + case MENU_ENUM_LABEL_GOTO_IMAGES: + return OZONE_ENTRIES_ICONS_TEXTURE_IMAGE; + case MENU_ENUM_LABEL_GOTO_VIDEO: + return OZONE_ENTRIES_ICONS_TEXTURE_MOVIE; + case MENU_ENUM_LABEL_GOTO_MUSIC: + return OZONE_ENTRIES_ICONS_TEXTURE_MUSIC; + case MENU_ENUM_LABEL_CONTENT_SETTINGS: + case MENU_ENUM_LABEL_UPDATE_ASSETS: + return OZONE_ENTRIES_ICONS_TEXTURE_QUICKMENU; + case MENU_ENUM_LABEL_START_CORE: + return OZONE_ENTRIES_ICONS_TEXTURE_RUN; + case MENU_ENUM_LABEL_CORE_LIST: + case MENU_ENUM_LABEL_CORE_SETTINGS: + case MENU_ENUM_LABEL_CORE_UPDATER_LIST: + return OZONE_ENTRIES_ICONS_TEXTURE_CORE; + case MENU_ENUM_LABEL_LOAD_CONTENT_LIST: + case MENU_ENUM_LABEL_SCAN_FILE: + return OZONE_ENTRIES_ICONS_TEXTURE_FILE; + case MENU_ENUM_LABEL_ONLINE_UPDATER: + case MENU_ENUM_LABEL_UPDATER_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_UPDATER; + case MENU_ENUM_LABEL_UPDATE_LAKKA: + return OZONE_ENTRIES_ICONS_TEXTURE_MAIN_MENU; + case MENU_ENUM_LABEL_UPDATE_CHEATS: + return OZONE_ENTRIES_ICONS_TEXTURE_CHEAT_OPTIONS; + case MENU_ENUM_LABEL_THUMBNAILS_UPDATER_LIST: + return OZONE_ENTRIES_ICONS_TEXTURE_IMAGE; + case MENU_ENUM_LABEL_UPDATE_OVERLAYS: + case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_OVERLAY; + case MENU_ENUM_LABEL_UPDATE_CG_SHADERS: + case MENU_ENUM_LABEL_UPDATE_GLSL_SHADERS: + case MENU_ENUM_LABEL_UPDATE_SLANG_SHADERS: + return OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS; + case MENU_ENUM_LABEL_INFORMATION: + case MENU_ENUM_LABEL_INFORMATION_LIST: + case MENU_ENUM_LABEL_SYSTEM_INFORMATION: + case MENU_ENUM_LABEL_UPDATE_CORE_INFO_FILES: + return OZONE_ENTRIES_ICONS_TEXTURE_INFO; + case MENU_ENUM_LABEL_UPDATE_DATABASES: + case MENU_ENUM_LABEL_DATABASE_MANAGER_LIST: + return OZONE_ENTRIES_ICONS_TEXTURE_RDB; + case MENU_ENUM_LABEL_CURSOR_MANAGER_LIST: + return OZONE_ENTRIES_ICONS_TEXTURE_CURSOR; + case MENU_ENUM_LABEL_HELP_LIST: + case MENU_ENUM_LABEL_HELP_CONTROLS: + case MENU_ENUM_LABEL_HELP_LOADING_CONTENT: + case MENU_ENUM_LABEL_HELP_SCANNING_CONTENT: + case MENU_ENUM_LABEL_HELP_WHAT_IS_A_CORE: + case MENU_ENUM_LABEL_HELP_CHANGE_VIRTUAL_GAMEPAD: + case MENU_ENUM_LABEL_HELP_AUDIO_VIDEO_TROUBLESHOOTING: + return OZONE_ENTRIES_ICONS_TEXTURE_HELP; + case MENU_ENUM_LABEL_QUIT_RETROARCH: + return OZONE_ENTRIES_ICONS_TEXTURE_EXIT; + /* Settings icons*/ + case MENU_ENUM_LABEL_DRIVER_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_DRIVERS; + case MENU_ENUM_LABEL_VIDEO_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_VIDEO; + case MENU_ENUM_LABEL_AUDIO_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_AUDIO; + case MENU_ENUM_LABEL_AUDIO_MIXER_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_MIXER; + case MENU_ENUM_LABEL_INPUT_SETTINGS: + case MENU_ENUM_LABEL_UPDATE_AUTOCONFIG_PROFILES: + return OZONE_ENTRIES_ICONS_TEXTURE_INPUT; + case MENU_ENUM_LABEL_LATENCY_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_LATENCY; + case MENU_ENUM_LABEL_SAVING_SETTINGS: + case MENU_ENUM_LABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE: + case MENU_ENUM_LABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR: + case MENU_ENUM_LABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME: + return OZONE_ENTRIES_ICONS_TEXTURE_SAVING; + case MENU_ENUM_LABEL_LOGGING_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_LOG; + case MENU_ENUM_LABEL_FRAME_THROTTLE_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_FRAMESKIP; + case MENU_ENUM_LABEL_QUICK_MENU_START_RECORDING: + case MENU_ENUM_LABEL_RECORDING_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_RECORD; + case MENU_ENUM_LABEL_QUICK_MENU_START_STREAMING: + return OZONE_ENTRIES_ICONS_TEXTURE_STREAM; + case MENU_ENUM_LABEL_QUICK_MENU_STOP_STREAMING: + case MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING: + return OZONE_ENTRIES_ICONS_TEXTURE_CLOSE; + case MENU_ENUM_LABEL_ONSCREEN_DISPLAY_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_OSD; + case MENU_ENUM_LABEL_SHOW_WIMP: + case MENU_ENUM_LABEL_USER_INTERFACE_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_UI; +#ifdef HAVE_LAKKA_SWITCH + case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: +#endif + case MENU_ENUM_LABEL_POWER_MANAGEMENT_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_POWER; + case MENU_ENUM_LABEL_RETRO_ACHIEVEMENTS_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENTS; + case MENU_ENUM_LABEL_NETWORK_INFORMATION: + case MENU_ENUM_LABEL_NETWORK_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_NETWORK; + case MENU_ENUM_LABEL_PLAYLIST_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_PLAYLIST; + case MENU_ENUM_LABEL_USER_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_USER; + case MENU_ENUM_LABEL_DIRECTORY_SETTINGS: + case MENU_ENUM_LABEL_SCAN_DIRECTORY: + return OZONE_ENTRIES_ICONS_TEXTURE_FOLDER; + case MENU_ENUM_LABEL_PRIVACY_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_PRIVACY; + + case MENU_ENUM_LABEL_REWIND_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_REWIND; + case MENU_ENUM_LABEL_QUICK_MENU_OVERRIDE_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_OVERRIDE; + case MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS: + return OZONE_ENTRIES_ICONS_TEXTURE_NOTIFICATIONS; +#ifdef HAVE_NETWORKING + case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST: + return OZONE_ENTRIES_ICONS_TEXTURE_RUN; + case MENU_ENUM_LABEL_NETPLAY_DISCONNECT: + return OZONE_ENTRIES_ICONS_TEXTURE_CLOSE; + case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT: + return OZONE_ENTRIES_ICONS_TEXTURE_ROOM; + case MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS: + return OZONE_ENTRIES_ICONS_TEXTURE_RELOAD; +#endif + default: + break; + } + + switch(type) + { + case FILE_TYPE_DIRECTORY: + return OZONE_ENTRIES_ICONS_TEXTURE_FOLDER; + case FILE_TYPE_PLAIN: + case FILE_TYPE_IN_CARCHIVE: + return OZONE_ENTRIES_ICONS_TEXTURE_FILE; + case FILE_TYPE_RPL_ENTRY: + return OZONE_ENTRIES_ICONS_TEXTURE_FILE; + case FILE_TYPE_SHADER: + case FILE_TYPE_SHADER_PRESET: + return OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS; + case FILE_TYPE_CARCHIVE: + return OZONE_ENTRIES_ICONS_TEXTURE_ZIP; + case FILE_TYPE_MUSIC: + return OZONE_ENTRIES_ICONS_TEXTURE_MUSIC; + case FILE_TYPE_IMAGE: + case FILE_TYPE_IMAGEVIEWER: + return OZONE_ENTRIES_ICONS_TEXTURE_IMAGE; + case FILE_TYPE_MOVIE: + return OZONE_ENTRIES_ICONS_TEXTURE_MOVIE; + case FILE_TYPE_CORE: + case FILE_TYPE_DIRECT_LOAD: + return OZONE_ENTRIES_ICONS_TEXTURE_CORE; + case FILE_TYPE_RDB: + return OZONE_ENTRIES_ICONS_TEXTURE_RDB; + case FILE_TYPE_CURSOR: + return OZONE_ENTRIES_ICONS_TEXTURE_CURSOR; + case FILE_TYPE_PLAYLIST_ENTRY: + case MENU_SETTING_ACTION_RUN: + return OZONE_ENTRIES_ICONS_TEXTURE_RUN; + case MENU_SETTING_ACTION_CLOSE: + return OZONE_ENTRIES_ICONS_TEXTURE_CLOSE; + case MENU_SETTING_ACTION_SAVESTATE: + return OZONE_ENTRIES_ICONS_TEXTURE_SAVESTATE; + case MENU_SETTING_ACTION_LOADSTATE: + return OZONE_ENTRIES_ICONS_TEXTURE_LOADSTATE; + case FILE_TYPE_RDB_ENTRY: + case MENU_SETTING_ACTION_CORE_INFORMATION: + return OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO; + case MENU_SETTING_ACTION_CORE_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS; + case MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_INPUT_REMAPPING_OPTIONS; + case MENU_SETTING_ACTION_CORE_CHEAT_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_CHEAT_OPTIONS; + case MENU_SETTING_ACTION_CORE_DISK_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_DISK_OPTIONS; + case MENU_SETTING_ACTION_CORE_SHADER_OPTIONS: + return OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS; + case MENU_SETTING_ACTION_SCREENSHOT: + return OZONE_ENTRIES_ICONS_TEXTURE_SCREENSHOT; + case MENU_SETTING_ACTION_DELETE_ENTRY: + return OZONE_ENTRIES_ICONS_TEXTURE_CLOSE; + case MENU_SETTING_ACTION_RESET: + return OZONE_ENTRIES_ICONS_TEXTURE_RELOAD; + case MENU_SETTING_ACTION_PAUSE_ACHIEVEMENTS: + return OZONE_ENTRIES_ICONS_TEXTURE_RESUME; + case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: + return OZONE_ENTRIES_ICONS_TEXTURE_RUN; + + case MENU_SETTING_GROUP: +#ifdef HAVE_LAKKA_SWITCH + case MENU_SET_SWITCH_BRIGHTNESS: +#endif + return OZONE_ENTRIES_ICONS_TEXTURE_SETTING; + case MENU_INFO_MESSAGE: + return OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO; + case MENU_WIFI: + return OZONE_ENTRIES_ICONS_TEXTURE_WIFI; +#ifdef HAVE_NETWORKING + case MENU_ROOM: + return OZONE_ENTRIES_ICONS_TEXTURE_ROOM; + case MENU_ROOM_LAN: + return OZONE_ENTRIES_ICONS_TEXTURE_ROOM_LAN; + case MENU_ROOM_RELAY: + return OZONE_ENTRIES_ICONS_TEXTURE_ROOM_RELAY; +#endif + case MENU_SETTING_ACTION: + if (ozone->depth <= 3) + return OZONE_ENTRIES_ICONS_TEXTURE_SETTING; + default: + return OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING; + } + +#ifdef HAVE_CHEEVOS + if ( + (type >= MENU_SETTINGS_CHEEVOS_START) && + (type < MENU_SETTINGS_NETPLAY_ROOMS_START) + ) + { + int new_id = type - MENU_SETTINGS_CHEEVOS_START; + if (get_badge_texture(new_id) != 0) + return get_badge_texture(new_id); + /* Should be replaced with placeholder badge icon. */ + return OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING; + } +#endif + + return OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING; +} + +static void ozone_draw_text( + video_frame_info_t *video_info, + ozone_handle_t *ozone, + const char *str, float x, + float y, + enum text_alignment text_align, + unsigned width, unsigned height, font_data_t* font, + uint32_t color) +{ + if ((color & 0x000000FF) == 0) + return; + + menu_display_draw_text(font, str, x, y, + width, height, color, text_align, 1.0f, + false, + 1.0); +} + +static void ozone_set_theme(ozone_handle_t *ozone, ozone_theme_t *theme) +{ + ozone->theme = theme; + + memcpy(ozone->theme_dynamic.selection_border, ozone->theme->selection_border, sizeof(ozone->theme_dynamic.selection_border)); + memcpy(ozone->theme_dynamic.selection, ozone->theme->selection, sizeof(ozone->theme_dynamic.selection)); + memcpy(ozone->theme_dynamic.entries_border, ozone->theme->entries_border, sizeof(ozone->theme_dynamic.entries_border)); + memcpy(ozone->theme_dynamic.entries_icon, ozone->theme->entries_icon, sizeof(ozone->theme_dynamic.entries_icon)); +} + +static void *ozone_init(void **userdata, bool video_is_threaded) +{ + unsigned width, height; + ozone_handle_t *ozone = NULL; + settings_t *settings = config_get_ptr(); + menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); + + if (!menu) + goto error; + + if (!menu_display_init_first_driver(video_is_threaded)) + goto error; + + video_driver_get_size(&width, &height); + + ozone = (ozone_handle_t*)calloc(1, sizeof(ozone_handle_t)); + + if (!ozone) + goto error; + + *userdata = ozone; + ozone->selection_buf_old = (file_list_t*)calloc(1, sizeof(file_list_t)); + ozone->want_horizontal_animation = false; + + ozone->system_tab_end = 0; + ozone->tabs[ozone->system_tab_end] = OZONE_SYSTEM_TAB_MAIN; + if (settings->bools.menu_content_show_settings && !settings->bools.kiosk_mode_enable) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_SETTINGS; + if (settings->bools.menu_content_show_favorites) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_FAVORITES; + if (settings->bools.menu_content_show_history) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_HISTORY; +#ifdef HAVE_IMAGEVIEWERe + if (settings->bools.menu_content_show_images) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_IMAGES; +#endif + if (settings->bools.menu_content_show_music) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_MUSIC; +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + if (settings->bools.menu_content_show_video) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_VIDEO; +#endif +#ifdef HAVE_NETWORKING + if (settings->bools.menu_content_show_netplay) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_NETPLAY; +#endif +#ifdef HAVE_LIBRETRODB + if (settings->bools.menu_content_show_add && !settings->bools.kiosk_mode_enable) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_ADD; +#endif + + menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); + + menu_display_set_width(width); + menu_display_set_height(height); + + menu_display_allocate_white_texture(); + + //Theme + //TODO Add theme override in settings +#ifdef HAVE_LIBNX + ColorSetId theme; + Result rc = setsysInitialize(); + + if (R_SUCCEEDED(rc)) + { + setsysGetColorSetId(&theme); + ozone_set_theme(ozone, theme == ColorSetId_Dark ? &ozone_theme_dark : &ozone_theme_light); + setsysExit(); + } + else + { + ozone_set_theme(ozone, ozone_default_theme); + } +#else + ozone_set_theme(ozone, ozone_default_theme); +#endif + + ozone->need_compute = false; + ozone->animations.scroll_y = 0.0f; + + //Assets path + fill_pathname_join( + ozone->assets_path, + settings->paths.directory_assets, + "ozone", + sizeof(ozone->assets_path) + ); + + //PNG path + fill_pathname_join( + ozone->png_path, + ozone->assets_path, + "png", + sizeof(ozone->png_path) + ); + + //Icons path + fill_pathname_join( + ozone->icons_path, + ozone->png_path, + "icons", + sizeof(ozone->icons_path) + ); + + //Sidebar path + fill_pathname_join( + ozone->tab_path, + ozone->png_path, + "sidebar", + sizeof(ozone->tab_path) + ); + + //Theme path + fill_pathname_join( + ozone->theme_path, + ozone->png_path, + ozone->theme->name, + sizeof(ozone->theme_path) + ); + + return menu; + +error: + if (menu) + free(menu); + + return NULL; +} + +static void ozone_free_node(ozone_node_t *node) +{ + if (!node) + return; + + free(node); +} + +static void ozone_free_list_nodes(file_list_t *list, bool actiondata) +{ + unsigned i, size = (unsigned)file_list_get_size(list); + + for (i = 0; i < size; ++i) + { + ozone_free_node((ozone_node_t*)file_list_get_userdata_at_offset(list, i)); + + /* file_list_set_userdata() doesn't accept NULL */ + list->list[i].userdata = NULL; + + if (actiondata) + file_list_free_actiondata(list, i); + } +} + +static void ozone_free(void *data) +{ + ozone_handle_t *ozone = (ozone_handle_t*) data; + + if (ozone) + { + video_coord_array_free(&ozone->raster_blocks.footer.carr); + video_coord_array_free(&ozone->raster_blocks.title.carr); + video_coord_array_free(&ozone->raster_blocks.time.carr); + video_coord_array_free(&ozone->raster_blocks.entries_label.carr); + video_coord_array_free(&ozone->raster_blocks.entries_sublabel.carr); + video_coord_array_free(&ozone->raster_blocks.sidebar.carr); + + font_driver_bind_block(NULL, NULL); + + if (ozone->selection_buf_old) + { + ozone_free_list_nodes(ozone->selection_buf_old, false); + file_list_free(ozone->selection_buf_old); + } + } +} + +static void ozone_context_reset(void *data, bool is_threaded) +{ + ozone_handle_t *ozone = (ozone_handle_t*) data; + + if (ozone) + { + //Fonts init + char font_path[PATH_MAX_LENGTH]; + + fill_pathname_join(font_path, ozone->assets_path, "Inter-UI-Regular.ttf", sizeof(font_path)); + ozone->fonts.footer = menu_display_font_file(font_path, FONT_SIZE_FOOTER, is_threaded); + ozone->fonts.entries_label = menu_display_font_file(font_path, FONT_SIZE_ENTRIES_LABEL, is_threaded); + ozone->fonts.entries_sublabel = menu_display_font_file(font_path, FONT_SIZE_ENTRIES_SUBLABEL, is_threaded); + ozone->fonts.time = menu_display_font_file(font_path, FONT_SIZE_TIME, is_threaded); + ozone->fonts.sidebar = menu_display_font_file(font_path, FONT_SIZE_SIDEBAR, is_threaded); + + fill_pathname_join(font_path, ozone->assets_path, "Inter-UI-Bold.ttf", sizeof(font_path)); + ozone->fonts.title = menu_display_font_file(font_path, FONT_SIZE_TITLE, is_threaded); + + ozone->title_font_glyph_width = font_driver_get_message_width(ozone->fonts.title, "a", 1, 1); + ozone->entry_font_glyph_width = font_driver_get_message_width(ozone->fonts.entries_label, "a", 1, 1); + + //Textures init + for (int i = 0; i < OZONE_TEXTURE_LAST; i++) + { + char filename[PATH_MAX_LENGTH]; + strcpy(filename, OZONE_TEXTURES_FILES[i]); + strcat(filename, ".png"); + + menu_display_reset_textures_list(filename, ozone->png_path, &ozone->textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } + + //Sidebar textures + for (int i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) + { + char filename[PATH_MAX_LENGTH]; + strcpy(filename, OZONE_TAB_TEXTURES_FILES[i]); + strcat(filename, ".png"); + + menu_display_reset_textures_list(filename, ozone->tab_path, &ozone->tab_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } + + //Theme textures + for (int i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + { + char filename[PATH_MAX_LENGTH]; + strcpy(filename, OZONE_THEME_TEXTURES_FILES[i]); + strcat(filename, ".png"); + + menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } + + //Icons textures init + for (int i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) + { + menu_display_reset_textures_list(ozone_entries_icon_texture_path(ozone, i), ozone->icons_path, &ozone->icons_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } + + menu_display_allocate_white_texture(); + + //State reset + ozone->frame_count = 0; + ozone->fade_direction = false; + ozone->cursor_in_sidebar = false; + ozone->cursor_in_sidebar_old = false; + ozone->draw_sidebar = true; + ozone->sidebar_offset = 0; + ozone->draw_old_list = false; + + //Animations + ozone->animations.cursor_alpha = 1.0f; + ozone->animations.scroll_y = 0.0f; + ozone->animations.list_alpha = 1.0f; + } +} + +static void ozone_collapse_end(void *userdata) +{ + ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone->draw_sidebar = false; +} + +static void ozone_context_destroy(void *data) +{ + ozone_handle_t *ozone = (ozone_handle_t*) data; + + if (!ozone) + return; + + //Theme + for (int i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + { + video_driver_texture_unload(&ozone->theme_textures[i]); + } + + //Icons + for (int i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) + { + video_driver_texture_unload(&ozone->icons_textures[i]); + } + + //Textures + for (int i = 0; i < OZONE_TEXTURE_LAST; i++) + { + video_driver_texture_unload(&ozone->textures[i]); + } + + //Icons + for (int i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) + { + video_driver_texture_unload(&ozone->tab_textures[i]); + } + + video_driver_texture_unload(&menu_display_white_texture); + + menu_display_font_free(ozone->fonts.footer); + menu_display_font_free(ozone->fonts.title); + menu_display_font_free(ozone->fonts.time); + menu_display_font_free(ozone->fonts.entries_label); + menu_display_font_free(ozone->fonts.entries_sublabel); + menu_display_font_free(ozone->fonts.sidebar); + + ozone->fonts.footer = NULL; + ozone->fonts.title = NULL; + ozone->fonts.time = NULL; + ozone->fonts.entries_label = NULL; + ozone->fonts.entries_sublabel = NULL; + ozone->fonts.sidebar = NULL; +} + +static void *ozone_list_get_entry(void *data, + enum menu_list_type type, unsigned i) +{ + size_t list_size = 0; + + switch (type) + { + case MENU_LIST_PLAIN: + { + file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); + list_size = menu_entries_get_stack_size(0); + if (i < list_size) + return (void*)&menu_stack->list[i]; + } + break; + case MENU_LIST_HORIZONTAL: + //TODO Sidebar + break; + default: + break; + } + + return NULL; +} + +static unsigned ozone_get_system_tab(ozone_handle_t *ozone, unsigned i) +{ + if (i <= ozone->system_tab_end) + { + return ozone->tabs[i]; + } + return UINT_MAX; +} + +static size_t ozone_list_get_size(void *data, enum menu_list_type type) +{ + ozone_handle_t *ozone = (ozone_handle_t*) data; + + if (!ozone) + return 0; + + switch (type) + { + case MENU_LIST_PLAIN: + return menu_entries_get_stack_size(0); + case MENU_LIST_HORIZONTAL: + //TODO Return horizontal list size + return 0; + case MENU_LIST_TABS: + return ozone->system_tab_end; + } + + return 0; +} + +static int ozone_list_push(void *data, void *userdata, + menu_displaylist_info_t *info, unsigned type) +{ + menu_displaylist_ctx_parse_entry_t entry; + int ret = -1; + unsigned i = 0; + core_info_list_t *list = NULL; + menu_handle_t *menu = (menu_handle_t*)data; + + switch (type) + { + case DISPLAYLIST_LOAD_CONTENT_LIST: + { + settings_t *settings = config_get_ptr(); + + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES), + msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES), + MENU_ENUM_LABEL_FAVORITES, + MENU_SETTING_ACTION, 0, 0); + + core_info_get_list(&list); + if (core_info_list_num_info_files(list)) + { + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST), + MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST, + MENU_SETTING_ACTION, 0, 0); + } + +#ifdef HAVE_LIBRETRODB + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), + MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST, + MENU_SETTING_ACTION, 0, 0); +#endif + + if (frontend_driver_parse_drive_list(info->list, true) != 0) + menu_entries_append_enum(info->list, "/", + msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), + MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR, + MENU_SETTING_ACTION, 0, 0); + + if (!settings->bools.kiosk_mode_enable) + { + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS), + MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS, + MENU_SETTING_ACTION, 0, 0); + } + + info->need_push = true; + info->need_refresh = true; + ret = 0; + } + break; + case DISPLAYLIST_MAIN_MENU: + { + settings_t *settings = config_get_ptr(); + rarch_system_info_t *system = runloop_get_system_info(); + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + entry.data = menu; + entry.info = info; + entry.parse_type = PARSE_ACTION; + entry.add_empty_entry = false; + + if (!string_is_empty(system->info.library_name) && + !string_is_equal(system->info.library_name, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) + { + entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS; + menu_displaylist_setting(&entry); + } + + if (system->load_no_content) + { + entry.enum_idx = MENU_ENUM_LABEL_START_CORE; + menu_displaylist_setting(&entry); + } + +#ifndef HAVE_DYNAMIC + if (frontend_driver_has_fork()) +#endif + { + if (settings->bools.menu_show_load_core) + { + entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST; + menu_displaylist_setting(&entry); + } + } + + if (settings->bools.menu_show_load_content) + { + const struct retro_subsystem_info* subsystem = NULL; + + entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; + menu_displaylist_setting(&entry); + + subsystem = system->subsystem.data; + + if (subsystem) + { + for (i = 0; i < (unsigned)system->subsystem.size; i++, subsystem++) + { + char s[PATH_MAX_LENGTH]; + if (content_get_subsystem() == i) + { + if (content_get_subsystem_rom_id() < subsystem->num_roms) + { + snprintf(s, sizeof(s), + "Load %s %s", + subsystem->desc, + i == content_get_subsystem() + ? "\u2605" : " "); + menu_entries_append_enum(info->list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), + MENU_ENUM_LABEL_SUBSYSTEM_ADD, + MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); + } + else + { + snprintf(s, sizeof(s), + "Start %s %s", + subsystem->desc, + i == content_get_subsystem() + ? "\u2605" : " "); + menu_entries_append_enum(info->list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_LOAD), + MENU_ENUM_LABEL_SUBSYSTEM_LOAD, + MENU_SETTINGS_SUBSYSTEM_LOAD, 0, 0); + } + } + else + { + snprintf(s, sizeof(s), + "Load %s %s", + subsystem->desc, + i == content_get_subsystem() + ? "\u2605" : " "); + menu_entries_append_enum(info->list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), + MENU_ENUM_LABEL_SUBSYSTEM_ADD, + MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); + } + } + } + } + + entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST; + menu_displaylist_setting(&entry); +#ifdef HAVE_QT + if (settings->bools.desktop_menu_enable) + { + entry.enum_idx = MENU_ENUM_LABEL_SHOW_WIMP; + menu_displaylist_setting(&entry); + } +#endif +#if defined(HAVE_NETWORKING) + if (settings->bools.menu_show_online_updater && !settings->bools.kiosk_mode_enable) + { + entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER; + menu_displaylist_setting(&entry); + } +#endif + if (!settings->bools.menu_content_show_settings && !string_is_empty(settings->paths.menu_content_show_settings_password)) + { + entry.enum_idx = MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS; + menu_displaylist_setting(&entry); + } + + if (settings->bools.kiosk_mode_enable && !string_is_empty(settings->paths.kiosk_mode_password)) + { + entry.enum_idx = MENU_ENUM_LABEL_MENU_DISABLE_KIOSK_MODE; + menu_displaylist_setting(&entry); + } + + if (settings->bools.menu_show_information) + { + entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST; + menu_displaylist_setting(&entry); + } + +#ifdef HAVE_LAKKA_SWITCH + entry.enum_idx = MENU_ENUM_LABEL_SWITCH_CPU_PROFILE; + menu_displaylist_setting(&entry); + + entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE; + menu_displaylist_setting(&entry); + + entry.enum_idx = MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL; + menu_displaylist_setting(&entry); +#endif + +#ifndef HAVE_DYNAMIC + entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH; + menu_displaylist_setting(&entry); +#endif + + if (settings->bools.menu_show_configurations && !settings->bools.kiosk_mode_enable) + { + entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS_LIST; + menu_displaylist_setting(&entry); + } + + if (settings->bools.menu_show_help) + { + entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST; + menu_displaylist_setting(&entry); + } + +#if !defined(IOS) + if (settings->bools.menu_show_quit_retroarch) + { + entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH; + menu_displaylist_setting(&entry); + } +#endif + + if (settings->bools.menu_show_reboot) + { + entry.enum_idx = MENU_ENUM_LABEL_REBOOT; + menu_displaylist_setting(&entry); + } + + if (settings->bools.menu_show_shutdown) + { + entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN; + menu_displaylist_setting(&entry); + } + + info->need_push = true; + ret = 0; + } + break; + } + return ret; +} + +static size_t ozone_list_get_selection(void *data) +{ + ozone_handle_t *ozone = (ozone_handle_t*)data; + + if (!ozone) + return 0; + + return ozone->categories_selection_ptr; +} + +static void ozone_list_clear(file_list_t *list) +{ + menu_animation_ctx_tag tag = (uintptr_t)list; + menu_animation_kill_by_tag(&tag); + + size_t i; + size_t size = list ? list->size : 0; + + ozone_free_list_nodes(list, false); +} + +static void ozone_list_free(file_list_t *list, size_t a, size_t b) +{ + ozone_list_clear(list); +} + +/* Compute new scroll position + * If the center of the currently selected entry is not in the middle + * And if we can scroll so that it's in the middle + * Then scroll + */ +static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozone_node_t *node) +{ + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + menu_animation_ctx_tag tag = (uintptr_t) selection_buf; + menu_animation_ctx_entry_t entry; + float new_scroll = 0; + + unsigned video_info_height; + video_driver_get_size(NULL, &video_info_height); + + float currentSelectionMiddleOnScreen = ENTRIES_START_Y + ozone->animations.scroll_y + node->position_y + node->height/2; + float bottom_boundary = video_info_height - 87 - 78; + float entries_middle = video_info_height/2; + + if (currentSelectionMiddleOnScreen != entries_middle) + { + new_scroll = ozone->animations.scroll_y - (currentSelectionMiddleOnScreen - entries_middle); + } + + if (new_scroll + ozone->entries_height < bottom_boundary) + new_scroll = -(78 + ozone->entries_height - bottom_boundary); + + if (new_scroll > 0) + new_scroll = 0; + + if (allow_animation) + { + //Cursor animation + ozone->animations.cursor_alpha = 0.0f; + + entry.cb = NULL; + entry.duration = ANIMATION_CURSOR_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->animations.cursor_alpha; + entry.tag = tag; + entry.target_value = 1.0f; + entry.userdata = NULL; + + menu_animation_push(&entry); + + //Scroll animation + entry.cb = NULL; + entry.duration = ANIMATION_CURSOR_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->animations.scroll_y; + entry.tag = tag; + entry.target_value = new_scroll; + entry.userdata = NULL; + + menu_animation_push(&entry); + } + else + { + ozone->selection_old = ozone->selection; + ozone->animations.cursor_alpha = 1.0f; + ozone->animations.scroll_y = new_scroll; + } +} + +static void ozone_compute_entries_position(ozone_handle_t *ozone) +{ + //Compute entries height and adjust scrolling if needed + size_t i; + menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); + + size_t entries_end = menu_entries_get_size(); + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + + unsigned video_info_height; + video_driver_get_size(NULL, &video_info_height); + + ozone->entries_height = 0; + + for (i = 0; i < entries_end; i++) + { + //Entry + menu_entry_t entry; + char entry_value[255]; + + entry_value[0] = '\0'; + + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)i, NULL, true); + menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); + + //Cache node + ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); + + if (!node) + continue; + + node->height = (entry.sublabel ? 100 : 60-8); + node->position_y = ozone->entries_height; + + ozone->entries_height += node->height; + + menu_entry_free(&entry); + } + + //Update scrolling + ozone->selection = menu_navigation_get_selection(); + ozone_update_scroll(ozone, false, (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, ozone->selection)); +} + +static void ozone_render(void *data, bool is_idle) +{ + size_t i; + unsigned end = (unsigned)menu_entries_get_size(); + menu_animation_ctx_delta_t delta; + + if (!data) + return; + + ozone_handle_t *ozone = (ozone_handle_t*) data; + + if (ozone->need_compute) + { + ozone_compute_entries_position(ozone); + ozone->need_compute = false; + } + + ozone->selection = menu_navigation_get_selection(); + + delta.current = menu_animation_get_delta_time(); + + if (menu_animation_get_ideal_delta_time(&delta)) + menu_animation_update(delta.ideal); + + //TODO Handle pointer & mouse + + menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); + + if (i >= end) + { + i = 0; + menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i); + } + + menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL); +} + +static void ozone_draw_icon( + video_frame_info_t *video_info, + unsigned icon_width, + unsigned icon_height, + uintptr_t texture, + float x, float y, + unsigned width, unsigned height, + float rotation, float scale_factor, + float *color) +{ + menu_display_ctx_rotate_draw_t rotate_draw; + menu_display_ctx_draw_t draw; + struct video_coords coords; + math_matrix_4x4 mymat; + + rotate_draw.matrix = &mymat; + rotate_draw.rotation = rotation; + rotate_draw.scale_x = scale_factor; + rotate_draw.scale_y = scale_factor; + rotate_draw.scale_z = 1; + rotate_draw.scale_enable = true; + + menu_display_rotate_z(&rotate_draw, video_info); + + coords.vertices = 4; + coords.vertex = NULL; + coords.tex_coord = NULL; + coords.lut_tex_coord = NULL; + coords.color = color ? (const float*)color : ozone_pure_white; + + draw.x = x; + draw.y = height - y - icon_height; + draw.width = icon_width; + draw.height = icon_height; + draw.scale_factor = scale_factor; + draw.rotation = rotation; + draw.coords = &coords; + draw.matrix_data = &mymat; + draw.texture = texture; + draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; + draw.pipeline.id = 0; + + menu_display_draw(&draw, video_info); +} + +static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_info) +{ + //Separator + menu_display_draw_quad(video_info, 30, 87, video_info->width - 60, 1, video_info->width, video_info->height, ozone->theme->header_footer_separator); + + //Title + char title[255]; + + menu_animation_ctx_ticker_t ticker; + + ticker.s = title; + ticker.len = (video_info->width - 128 - 47 - 130) / ozone->title_font_glyph_width; + ticker.idx = ozone->frame_count / 20; + ticker.str = ozone->title; + ticker.selected = true; + + menu_animation_ticker(&ticker); + + ozone_draw_text(video_info, ozone, title, 128, 20 + FONT_SIZE_TITLE, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.title, ozone->theme->text_rgba); + + //Icon + menu_display_blend_begin(video_info); + ozone_draw_icon(video_info, 60, 60, ozone->textures[OZONE_TEXTURE_RETROARCH], 47, 14, video_info->width, video_info->height, 0, 1, ozone->theme->entries_icon); + menu_display_blend_end(video_info); + + //Timedate + if (video_info->timedate_enable) + { + menu_display_ctx_datetime_t datetime; + char timedate[255]; + + timedate[0] = '\0'; + + datetime.s = timedate; + datetime.time_mode = 4; + datetime.len = sizeof(timedate); + + menu_display_timedate(&datetime); + + ozone_draw_text(video_info, ozone, timedate, video_info->width - 60, 30 + FONT_SIZE_TIME, TEXT_ALIGN_RIGHT, video_info->width, video_info->height, ozone->fonts.time, ozone->theme->text_rgba); + } +} + +static void ozone_color_alpha(float *color, float alpha) +{ + color[3] = color[7] = color[11] = color[15] = alpha; +} + +static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_info, settings_t *settings) +{ + //Separator + menu_display_draw_quad(video_info, 23, video_info->height - 78, video_info->width - 60, 1, video_info->width, video_info->height, ozone->theme->header_footer_separator); + + //Core title or Switch icon + char core_title[255]; + if (settings->bools.menu_core_enable && menu_entries_get_core_title(core_title, sizeof(core_title)) == 0) + { + ozone_draw_text(video_info, ozone, core_title, 59, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + } + else + { + ozone_draw_icon(video_info, 69, 30, ozone->theme_textures[OZONE_THEME_TEXTURE_SWITCH], 59, video_info->height - 52, video_info->width,video_info->height, 0, 1, NULL); + } + + //Buttons + menu_display_blend_begin(video_info); + ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + menu_display_blend_end(video_info); + + ozone_draw_text(video_info, ozone, "Back", video_info->width - 215, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + ozone_draw_text(video_info, ozone, "OK", video_info->width - 96, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + + menu_display_blend_end(video_info); +} + +//TODO Reduce sidebar width ? + +static void ozone_draw_cursor(ozone_handle_t *ozone, video_frame_info_t *video_info, unsigned x_offset, unsigned entry_width, size_t y, float alpha) +{ + ozone_color_alpha(ozone->theme_dynamic.selection_border, alpha); + ozone_color_alpha(ozone->theme_dynamic.selection, alpha); + + //Fill + menu_display_draw_quad(video_info, x_offset, y, entry_width, 70 - 10 - 10 - 3, video_info->width, video_info->height, ozone->theme_dynamic.selection); + + //Borders (can't do one single quad because of alpha) + menu_display_draw_quad(video_info, x_offset -3, y - 3, entry_width + 6, 3, video_info->width, video_info->height, ozone->theme_dynamic.selection_border); + menu_display_draw_quad(video_info, x_offset -3, y + 70 - 10 - 10 - 3, entry_width + 6, 3, video_info->width, video_info->height, ozone->theme_dynamic.selection_border); + menu_display_draw_quad(video_info, x_offset -3, y, 3, 70 - 10 - 3 - 6 - 4, video_info->width, video_info->height, ozone->theme_dynamic.selection_border); + menu_display_draw_quad(video_info, x_offset + entry_width, y, 3, 70 - 10 - 3 - 6 - 4, video_info->width, video_info->height, ozone->theme_dynamic.selection_border); +} + +static void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info) +{ + if (!ozone->draw_sidebar) + return; + + menu_display_scissor_begin(video_info, 0, 87, 408, video_info->height - 87 - 78); + + //Background + unsigned sidebar_height = video_info->height - 87 - 55 - 78; + + menu_display_draw_quad(video_info, ozone->sidebar_offset, 88, 408, 55/2, video_info->width, video_info->height, ozone->theme->sidebar_top_gradient); + menu_display_draw_quad(video_info, ozone->sidebar_offset, 88 + 55/2, 408, sidebar_height, video_info->width, video_info->height, ozone->theme->sidebar_background); + menu_display_draw_quad(video_info, ozone->sidebar_offset, 55*2 + sidebar_height, 408, 55/2 + 1, video_info->width, video_info->height, ozone->theme->sidebar_bottom_gradient); + + //Tabs + //TODO Scroll + unsigned selection_y = 0; + unsigned selection_old_y = 0; + + //y offset computation + size_t y = ENTRIES_START_Y - 10; + for (int i = 0; i < OZONE_SYSTEM_TAB_LAST; i++) + { + if (i == ozone->categories_selection_ptr) + selection_y = y; + if (i == ozone->categories_active_idx_old) + selection_old_y = y; + y += 65; + } + + //Cursor + if (ozone->cursor_in_sidebar) + ozone_draw_cursor(ozone, video_info, ozone->sidebar_offset + 41, 408-81, selection_y-8, ozone->animations.cursor_alpha); + + if (ozone->cursor_in_sidebar_old && ozone->categories_selection_ptr != ozone->categories_active_idx_old) + ozone_draw_cursor(ozone, video_info, ozone->sidebar_offset + 41, 408-81, selection_old_y-8, 1-ozone->animations.cursor_alpha); + + //Icons + y = ENTRIES_START_Y - 10; + menu_display_blend_begin(video_info); + //TODO Cache all the tabs data + for (int i = 0; i < OZONE_SYSTEM_TAB_LAST; i++) + { + bool selected = (ozone->categories_selection_ptr == i); + unsigned icon = ozone_system_tabs_icons[i]; + + //Icon + ozone_draw_icon(video_info, 40, 40, ozone->tab_textures[icon], ozone->sidebar_offset + 41 + 10, y - 5, video_info->width, video_info->height, 0, 1, (selected ? ozone->theme->text_selected : ozone->theme->entries_icon)); + + enum msg_hash_enums value_idx = ozone_system_tabs_value[i]; + const char *title = msg_hash_to_str(value_idx); + + //Text + ozone_draw_text(video_info, ozone, title, ozone->sidebar_offset + 115 - 10, y + FONT_SIZE_SIDEBAR, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.sidebar, (selected ? ozone->theme->text_selected_rgba : ozone->theme->text_rgba)); + + y += 65; + } + menu_display_blend_end(video_info); + + font_driver_flush(video_info->width, video_info->height, ozone->fonts.sidebar, video_info); + + menu_display_scissor_end(video_info); +} + +static void ozone_draw_entry_value(ozone_handle_t *ozone, video_frame_info_t *video_info, char *value, unsigned x, unsigned y, uint32_t alpha_uint32) +{ + if (string_is_empty(value)) + return; + + bool switch_is_on = true; + bool do_draw_text = false; + enum msg_file_type hash_type = msg_hash_to_file_type(msg_hash_calculate(value)); + + /* set switch_is_on */ + if (string_is_equal(value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || + (string_is_equal(value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) + { + switch_is_on = false; + do_draw_text = false; + } + else if (string_is_equal(value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || + (string_is_equal(value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) + { + switch_is_on = true; + do_draw_text = false; + } + else + { + switch (hash_type) + { + case FILE_TYPE_IN_CARCHIVE: + case FILE_TYPE_COMPRESSED: + case FILE_TYPE_MORE: + case FILE_TYPE_CORE: + case FILE_TYPE_DIRECT_LOAD: + case FILE_TYPE_RDB: + case FILE_TYPE_CURSOR: + case FILE_TYPE_PLAIN: + case FILE_TYPE_DIRECTORY: + case FILE_TYPE_MUSIC: + case FILE_TYPE_IMAGE: + case FILE_TYPE_MOVIE: + return; + default: + do_draw_text = true; + break; + } + } + + if (do_draw_text) + { + ozone_draw_text(video_info, ozone, value, x, y, TEXT_ALIGN_RIGHT, video_info->width, video_info->height, ozone->fonts.entries_label, (ozone->theme->text_selected_rgba & 0xFFFFFF00) | alpha_uint32); + } + else + { + ozone_draw_text(video_info, ozone, (switch_is_on ? "On" : "Off"), x, y, TEXT_ALIGN_RIGHT, video_info->width, video_info->height, ozone->fonts.entries_label, ((switch_is_on ? ozone->theme->text_selected_rgba : ozone->theme->text_sublabel_rgba) & 0xFFFFFF00) | alpha_uint32); + } +} + +static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_info, + unsigned selection, unsigned selection_old, + file_list_t *selection_buf, float alpha, float scroll_y) +{ + size_t i; + menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); + + size_t entries_end = file_list_get_size(selection_buf); + unsigned x_offset = 0; + + bool old_list = selection_buf == ozone->selection_buf_old; + + size_t y = ENTRIES_START_Y; + size_t selection_y = 0; + size_t old_selection_y = 0; + + float sidebar_offset = ozone->sidebar_offset/2.0f; + unsigned entry_width = video_info->width - 548; + + unsigned video_info_height; + video_driver_get_size(NULL, &video_info_height); + + float bottom_boundary = video_info_height - 87 - 78; + + float invert = (ozone->fade_direction) ? -1 : 1; + + float alpha_anim = old_list ? alpha : 1.0f - alpha; + + if (old_list) + alpha = 1.0f - alpha; + + if (alpha != 1.0f) + { + if (old_list) + x_offset = invert * -(alpha_anim * 120); //left + else + x_offset = invert * (alpha_anim * 120); //right + } + + x_offset += (unsigned) sidebar_offset; + + uint32_t alpha_uint32 = (uint32_t)(alpha*255.0f); + + //Borders layer + for (i = 0; i < entries_end; i++) + { + bool entry_selected = selection == i; + bool entry_old_selected = selection_old == i; + + if (entry_selected) + selection_y = y; + + if (entry_old_selected) + old_selection_y = y; + + ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); + + if (!node) + continue; + + if (y + scroll_y + node->height + 20 < ENTRIES_START_Y) + goto text_iterate; + else if (y + scroll_y - node->height - 20 > bottom_boundary) + goto text_iterate; + + ozone_color_alpha(ozone->theme_dynamic.entries_border, alpha); + + //Borders + menu_display_draw_quad(video_info, x_offset + 456-3, y - 3 + scroll_y, entry_width + 10 - 3 -1, 1, video_info->width, video_info->height, ozone->theme_dynamic.entries_border); + menu_display_draw_quad(video_info, x_offset + 456-3, y - 5 + 70 + 10 - 10 - 10 - 3 - 3 + scroll_y, entry_width + 10 - 3-1, 1, video_info->width, video_info->height, ozone->theme_dynamic.entries_border); + +text_iterate: + y += node->height; + } + + //Cursor(s) layer + if (!ozone->cursor_in_sidebar) + ozone_draw_cursor(ozone, video_info, x_offset + 456, entry_width, selection_y + scroll_y, ozone->animations.cursor_alpha * alpha); + + if (!ozone->cursor_in_sidebar_old && ozone->selection != ozone->selection_old) + ozone_draw_cursor(ozone, video_info, x_offset + 456, entry_width, old_selection_y + scroll_y, 1-ozone->animations.cursor_alpha * alpha); + + //Icons + text + y = ENTRIES_START_Y; + for (i = 0; i < entries_end; i++) + { + menu_entry_t entry; + char entry_value[255]; + + entry_value[0] = '\0'; + + bool entry_selected = selection == i; + ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); + + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)i, selection_buf, true); + menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); + + if (!node) + continue; + + if (y + scroll_y + node->height + 20 < ENTRIES_START_Y) + goto icons_iterate; + else if (y + scroll_y - node->height - 20 > bottom_boundary) + goto icons_iterate; + + //Icon + unsigned icon = ozone_entries_icon_get_id(ozone, entry.enum_idx, entry.type, entry_selected); + + ozone_color_alpha(ozone->theme_dynamic.entries_icon, alpha); + + menu_display_blend_begin(video_info); + ozone_draw_icon(video_info, 46, 46, ozone->icons_textures[icon], x_offset + 451+5+10, y + scroll_y, video_info->width, video_info->height, 0, 1, ozone->theme_dynamic.entries_icon); + menu_display_blend_end(video_info); + + char *entry_rich_label = NULL; + char rich_label[255]; + + entry_rich_label = menu_entry_get_rich_label(&entry); + + menu_animation_ctx_ticker_t ticker; + + ticker.idx = ozone->frame_count / 20; + ticker.s = rich_label; + ticker.str = entry_rich_label; + ticker.selected = entry_selected && !ozone->cursor_in_sidebar; + ticker.len = (entry_width - 60) / ozone->entry_font_glyph_width; + + menu_animation_ticker(&ticker); + + //Text + ozone_draw_text(video_info, ozone, rich_label, x_offset + 521, y + FONT_SIZE_ENTRIES_LABEL + 8 - 1 + scroll_y, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.entries_label, (ozone->theme->text_rgba & 0xFFFFFF00) | alpha_uint32); + ozone_draw_text(video_info, ozone, entry.sublabel, x_offset + 470, y + FONT_SIZE_ENTRIES_SUBLABEL + 80 - 20 - 3 + scroll_y, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.entries_sublabel, (ozone->theme->text_sublabel_rgba & 0xFFFFFF00) | alpha_uint32); + + //Value + char entry_value_ticker[255]; + + ticker.idx = ozone->frame_count / 20; + ticker.s = entry_value_ticker; + ticker.str = entry_value; + ticker.selected = entry_selected && !ozone->cursor_in_sidebar; + ticker.len = (entry_width - 60 - ((int)utf8len(entry_rich_label) * ozone->entry_font_glyph_width)) / ozone->entry_font_glyph_width; + + menu_animation_ticker(&ticker); + ozone_draw_entry_value(ozone, video_info, entry_value_ticker, x_offset + 426 + entry_width, y + FONT_SIZE_ENTRIES_LABEL + 8 - 1 + scroll_y,alpha_uint32); + + free(entry_rich_label); + +icons_iterate: + y += node->height; + menu_entry_free(&entry); + } + + //Text layer + font_driver_flush(video_info->width, video_info->height, ozone->fonts.entries_label, video_info); + font_driver_flush(video_info->width, video_info->height, ozone->fonts.entries_sublabel, video_info); +} + +static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation) +{ + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + menu_animation_ctx_tag tag = (uintptr_t) selection_buf; + + size_t new_selection = menu_navigation_get_selection(); + ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, new_selection); + + if (!node) + return; + + if (ozone->selection != new_selection) + { + ozone->selection_old = ozone->selection; + ozone->selection = new_selection; + + ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; + + menu_animation_kill_by_tag(&tag); + + ozone_update_scroll(ozone, allow_animation, node); + } +} + +static void ozone_navigation_clear(void *data, bool pending_push) +{ + ozone_handle_t *ozone = (ozone_handle_t*)data; + if (!pending_push) + ozone_selection_changed(ozone, true); +} + +static void ozone_navigation_pointer_changed(void *data) +{ + ozone_handle_t *ozone = (ozone_handle_t*)data; + ozone_selection_changed(ozone, true); +} + +static void ozone_navigation_set(void *data, bool scroll) +{ + ozone_handle_t *ozone = (ozone_handle_t*)data; + ozone_selection_changed(ozone, true); +} + +static void ozone_navigation_alphabet(void *data, size_t *unused) +{ + ozone_handle_t *ozone = (ozone_handle_t*)data; + ozone_selection_changed(ozone, true); +} + +static void ozone_frame(void *data, video_frame_info_t *video_info) +{ + ozone_handle_t* ozone = (ozone_handle_t*) data; + + if (!ozone) + return; + + settings_t *settings = config_get_ptr(); + + ozone->frame_count++; + + menu_display_set_viewport(video_info->width, video_info->height); + + //Clear first layer of text + font_driver_bind_block(ozone->fonts.footer, &ozone->raster_blocks.footer); + font_driver_bind_block(ozone->fonts.title, &ozone->raster_blocks.title); + font_driver_bind_block(ozone->fonts.time, &ozone->raster_blocks.time); + font_driver_bind_block(ozone->fonts.entries_label, &ozone->raster_blocks.entries_label); + font_driver_bind_block(ozone->fonts.entries_sublabel, &ozone->raster_blocks.entries_sublabel); + font_driver_bind_block(ozone->fonts.sidebar, &ozone->raster_blocks.sidebar); + + ozone->raster_blocks.footer.carr.coords.vertices = 0; + ozone->raster_blocks.title.carr.coords.vertices = 0; + ozone->raster_blocks.time.carr.coords.vertices = 0; + ozone->raster_blocks.entries_label.carr.coords.vertices = 0; + ozone->raster_blocks.entries_sublabel.carr.coords.vertices = 0; + ozone->raster_blocks.sidebar.carr.coords.vertices = 0; + + //Background + menu_display_ctx_clearcolor_t clearcolor; + + clearcolor.r = ozone->theme->background_r; + clearcolor.g = ozone->theme->background_g; + clearcolor.b = ozone->theme->background_b; + clearcolor.a = 1.0f; + + menu_display_clear_color(&clearcolor, video_info); + + //Header, footer + ozone_draw_header(ozone, video_info); + ozone_draw_footer(ozone, video_info, settings); + + //Sidebar + ozone_draw_sidebar(ozone, video_info); + + //Menu entries + menu_display_scissor_begin(video_info, ozone->sidebar_offset + 408, 87, video_info->width - 408 + (-ozone->sidebar_offset), video_info->height - 87 - 78); + + //Current list + ozone_draw_entries(ozone, video_info, ozone->selection, ozone->selection_old, menu_entries_get_selection_buf_ptr(0), ozone->animations.list_alpha, ozone->animations.scroll_y); + + //Old list + if (ozone->draw_old_list) + ozone_draw_entries(ozone, video_info, ozone->selection_old_list, ozone->selection_old_list, ozone->selection_buf_old, ozone->animations.list_alpha, ozone->scroll_old); + + menu_display_scissor_end(video_info); + + //Flush first layer of text + font_driver_flush(video_info->width, video_info->height, ozone->fonts.footer, video_info); + font_driver_flush(video_info->width, video_info->height, ozone->fonts.title, video_info); + font_driver_flush(video_info->width, video_info->height, ozone->fonts.time, video_info); + + font_driver_bind_block(ozone->fonts.footer, NULL); + font_driver_bind_block(ozone->fonts.title, NULL); + font_driver_bind_block(ozone->fonts.time, NULL); + font_driver_bind_block(ozone->fonts.entries_label, NULL); + + menu_display_unset_viewport(video_info->width, video_info->height); +} + +static void ozone_set_header(ozone_handle_t *ozone) +{ + //TODO Set title of playlist if in a playlist + + menu_entries_get_title(ozone->title, sizeof(ozone->title)); +} + +static void ozone_animation_end(void *userdata) +{ + ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone->draw_old_list = false; +} + +static void ozone_list_open(ozone_handle_t *ozone) +{ + if (!ozone->want_horizontal_animation) + { + ozone->want_horizontal_animation = true; + return; + } + ozone->draw_old_list = true; + + struct menu_animation_ctx_entry entry; + + //Left/right animation + ozone->animations.list_alpha = 0.0f; + + entry.cb = ozone_animation_end; + entry.duration = ANIMATION_PUSH_ENTRY_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->animations.list_alpha; + entry.tag = (uintptr_t) NULL; + entry.target_value = 1.0f; + entry.userdata = ozone; + + menu_animation_push(&entry); + + //Sidebar animation + if (ozone->depth == 1) + { + ozone->draw_sidebar = true; + + entry.cb = NULL; + entry.duration = ANIMATION_PUSH_ENTRY_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->sidebar_offset; + entry.tag = (uintptr_t) NULL; + entry.target_value = 0.0f; + entry.userdata = NULL; + + menu_animation_push(&entry); + } + else if (ozone->depth > 1) + { + struct menu_animation_ctx_entry entry; + + entry.cb = ozone_collapse_end; + entry.duration = ANIMATION_PUSH_ENTRY_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->sidebar_offset; + entry.tag = (uintptr_t) NULL; + entry.target_value = -408.0f; + entry.userdata = (void*) ozone; + + menu_animation_push(&entry); + } +} + +static void ozone_populate_entries(void *data, const char *path, const char *label, unsigned k) +{ + ozone_handle_t *ozone = (ozone_handle_t*) data; + + if (!ozone) + return; + + ozone_set_header(ozone); + + if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL)) + { + menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); + //TODO Update thumbnails + ozone_selection_changed(ozone, false); + return; + } + + ozone->need_compute = true; + ozone->fade_direction = ozone->action == MENU_ACTION_CANCEL; + + ozone->depth = (int)ozone_list_get_size(ozone, MENU_LIST_PLAIN); + + if (ozone->categories_selection_ptr == ozone->categories_active_idx_old) + { + ozone_list_open(ozone); + } +} + +static void ozone_change_tab(ozone_handle_t *ozone, enum msg_hash_enums tab, enum menu_settings_type type) +{ + file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); + size_t stack_size; + menu_ctx_list_t list_info; + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + size_t selection = menu_navigation_get_selection(); + menu_file_list_cbs_t *cbs = selection_buf ? + (menu_file_list_cbs_t*)file_list_get_actiondata_at_offset(selection_buf, + selection) : NULL; + + list_info.type = MENU_LIST_HORIZONTAL; + list_info.action = MENU_ACTION_LEFT; + + stack_size = menu_stack->size; + + if (menu_stack->list[stack_size - 1].label) + free(menu_stack->list[stack_size - 1].label); + menu_stack->list[stack_size - 1].label = NULL; + + menu_stack->list[stack_size - 1].label = + strdup(msg_hash_to_str(tab)); + menu_stack->list[stack_size - 1].type = + type; + + menu_driver_list_cache(&list_info); + + if (cbs && cbs->action_content_list_switch) + cbs->action_content_list_switch(selection_buf, menu_stack, "", "", 0); +} + +static void ozone_go_to_sidebar(ozone_handle_t *ozone, uintptr_t tag) +{ + ozone->selection_old = ozone->selection; + ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; + ozone->cursor_in_sidebar = true; + + //Cursor animation + ozone->animations.cursor_alpha = 0.0f; + + struct menu_animation_ctx_entry entry; + + entry.cb = NULL; + entry.duration = ANIMATION_CURSOR_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->animations.cursor_alpha; + entry.tag = tag; + entry.target_value = 1.0f; + entry.userdata = NULL; + + menu_animation_push(&entry); +} + +static void ozone_leave_sidebar(ozone_handle_t *ozone, uintptr_t tag) +{ + ozone->categories_active_idx_old = ozone->categories_selection_ptr; + ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; + ozone->cursor_in_sidebar = false; + + //Cursor animation + ozone->animations.cursor_alpha = 0.0f; + + struct menu_animation_ctx_entry entry; + + entry.cb = NULL; + entry.duration = ANIMATION_CURSOR_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->animations.cursor_alpha; + entry.tag = tag; + entry.target_value = 1.0f; + entry.userdata = NULL; + + menu_animation_push(&entry); +} + +static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action action) +{ + ozone_handle_t *ozone = (ozone_handle_t*) userdata; + + if (!ozone) + return generic_menu_iterate(menu, userdata, action); + + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + + menu_animation_ctx_tag tag = (uintptr_t)selection_buf; + int new_selection; + struct menu_animation_ctx_entry entry; + + enum menu_action new_action = action; + + //Inputs override + switch (action) + { + case MENU_ACTION_DOWN: + if (!ozone->cursor_in_sidebar) + break; + + tag = (uintptr_t)ozone; + + new_selection = (ozone->categories_selection_ptr + 1); + + if (new_selection >= ozone->system_tab_end + 2) //TODO Check against actual tabs count and not just system tabs + new_selection = 0; + + if (ozone->categories_selection_ptr != new_selection) + { + ozone->categories_active_idx_old = ozone->categories_selection_ptr; + ozone->categories_selection_ptr = new_selection; + + ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; + + menu_animation_kill_by_tag(&tag); + } + + //Cursor animation + ozone->animations.cursor_alpha = 0.0f; + + entry.cb = NULL; + entry.duration = ANIMATION_CURSOR_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->animations.cursor_alpha; + entry.tag = tag; + entry.target_value = 1.0f; + entry.userdata = NULL; + + menu_animation_push(&entry); + + ozone_change_tab(ozone, ozone_system_tabs_idx[new_selection], ozone_system_tabs_type[new_selection]); + + new_action = MENU_ACTION_NOOP; + break; + case MENU_ACTION_UP: + if (!ozone->cursor_in_sidebar) + break; + + tag = (uintptr_t)ozone; + + new_selection = ozone->categories_selection_ptr - 1; + + if (new_selection < 0) + new_selection = ozone->system_tab_end + 1; //TODO Set this to actual tabs count and not just system tabs + + if (ozone->categories_selection_ptr != new_selection) + { + ozone->categories_active_idx_old = ozone->categories_selection_ptr; + ozone->categories_selection_ptr = new_selection; + + ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; + + menu_animation_kill_by_tag(&tag); + } + + //Cursor animation + ozone->animations.cursor_alpha = 0.0f; + + entry.cb = NULL; + entry.duration = ANIMATION_CURSOR_DURATION; + entry.easing_enum = EASING_OUT_QUAD; + entry.subject = &ozone->animations.cursor_alpha; + entry.tag = tag; + entry.target_value = 1.0f; + entry.userdata = NULL; + + menu_animation_push(&entry); + + ozone_change_tab(ozone, ozone_system_tabs_idx[new_selection], ozone_system_tabs_type[new_selection]); + + new_action = MENU_ACTION_NOOP; + break; + case MENU_ACTION_LEFT: + if (ozone->cursor_in_sidebar) + { + new_action = MENU_ACTION_NOOP; + break; + } + else if (ozone->depth > 1) + { + break; + } + + + ozone_go_to_sidebar(ozone, tag); + + new_action = MENU_ACTION_NOOP; + break; + case MENU_ACTION_RIGHT: + if (!ozone->cursor_in_sidebar) + { + if (ozone->depth == 1) + new_action = MENU_ACTION_NOOP; + break; + } + + ozone_leave_sidebar(ozone, tag); + + new_action = MENU_ACTION_NOOP; + break; + case MENU_ACTION_OK: + if (ozone->cursor_in_sidebar) + { + ozone_leave_sidebar(ozone, tag); + new_action = MENU_ACTION_NOOP; + break; + } + + break; + case MENU_ACTION_CANCEL: + if (ozone->cursor_in_sidebar) + { + new_action = MENU_ACTION_NOOP; + break; + } + + if (menu_entries_get_stack_size(0) == 1) + { + ozone_go_to_sidebar(ozone, tag); + new_action = MENU_ACTION_NOOP; + } + break; + default: + break; + } + + ozone->action = new_action; + + return generic_menu_iterate(menu, userdata, new_action); +} + +//TODO Fancy toggle animation + +static void ozone_toggle(void *userdata, bool menu_on) +{ + ozone_handle_t *ozone = (ozone_handle_t*) userdata; + if (!menu_on) + { + menu_display_ctx_clearcolor_t clearcolor; + + clearcolor.r = 0.0f; + clearcolor.g = 0.0f; + clearcolor.b = 0.0f; + clearcolor.a = 1.0f; + + menu_display_clear_color(&clearcolor, NULL); + } + + bool tmp = !menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL); + + if (tmp) + menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); + else + menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); + + if (ozone->depth == 1) + { + ozone->draw_sidebar = true; + ozone->sidebar_offset = 0.0f; + } +} + +static bool ozone_menu_init_list(void *data) +{ + menu_displaylist_info_t info; + + file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + + menu_displaylist_info_init(&info); + + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)); + info.exts = + strdup(file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); + info.type_default = FILE_TYPE_PLAIN; + info.enum_idx = MENU_ENUM_LABEL_MAIN_MENU; + + menu_entries_append_enum(menu_stack, info.path, + info.label, + MENU_ENUM_LABEL_MAIN_MENU, + info.type, info.flags, 0); + + info.list = selection_buf; + + if (!menu_displaylist_ctl(DISPLAYLIST_MAIN_MENU, &info)) + goto error; + + info.need_push = true; + + if (!menu_displaylist_process(&info)) + goto error; + + menu_displaylist_info_free(&info); + return true; + +error: + menu_displaylist_info_free(&info); + return false; +} + +static ozone_node_t *ozone_alloc_node() +{ + ozone_node_t *node = (ozone_node_t*)malloc(sizeof(*node)); + + node->height = 0; + node->position_y = 0; + + return node; +} + +static ozone_node_t *ozone_copy_node(const ozone_node_t *old_node) +{ + ozone_node_t *new_node = (ozone_node_t*)malloc(sizeof(*new_node)); + + *new_node = *old_node; + + return new_node; +} + +static void ozone_list_insert(void *userdata, + file_list_t *list, + const char *path, + const char *fullpath, + const char *label, + size_t list_size, + unsigned type) +{ + ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_node_t *node = NULL; + int i = (int)list_size; + + if (!ozone || !list) + return; + + ozone->need_compute = true; + + node = (ozone_node_t*)file_list_get_userdata_at_offset(list, i); + + if (!node) + node = ozone_alloc_node(); + + if (!node) + { + RARCH_ERR("ozone node could not be allocated.\n"); + return; + } + + file_list_set_userdata(list, i, node); +} + +static void ozone_list_deep_copy(const file_list_t *src, file_list_t *dst, + size_t first, size_t last) +{ + size_t i, j = 0; + menu_animation_ctx_tag tag = (uintptr_t)dst; + + menu_animation_kill_by_tag(&tag); + + /* use true here because file_list_copy() doesn't free actiondata */ + ozone_free_list_nodes(dst, true); + + file_list_clear(dst); + file_list_reserve(dst, (last + 1) - first); + + for (i = first; i <= last; ++i) + { + struct item_file *d = &dst->list[j]; + struct item_file *s = &src->list[i]; + + void *src_udata = s->userdata; + void *src_adata = s->actiondata; + + *d = *s; + d->alt = string_is_empty(d->alt) ? NULL : strdup(d->alt); + d->path = string_is_empty(d->path) ? NULL : strdup(d->path); + d->label = string_is_empty(d->label) ? NULL : strdup(d->label); + + if (src_udata) + file_list_set_userdata(dst, j, (void*)ozone_copy_node((const ozone_node_t*)src_udata)); + + if (src_adata) + { + void *data = malloc(sizeof(menu_file_list_cbs_t)); + memcpy(data, src_adata, sizeof(menu_file_list_cbs_t)); + file_list_set_actiondata(dst, j, data); + } + + ++j; + } + + dst->size = j; +} + +static void ozone_list_cache(void *data, + enum menu_list_type type, unsigned action) +{ + ozone_handle_t *ozone = (ozone_handle_t*)data; + + if (!ozone) + return; + + ozone->need_compute = true; + + ozone->selection_old_list = ozone->selection; + ozone->scroll_old = ozone->animations.scroll_y; + + //Deep copy visible elements + unsigned first = 0; + unsigned last = 0; + + unsigned video_info_height; + video_driver_get_size(NULL, &video_info_height); + size_t y = ENTRIES_START_Y; + int i; + size_t entries_end = menu_entries_get_size(); + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + float bottom_boundary = video_info_height - 87 - 78; + for (i = 0; i < entries_end; i++) + { + ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); + + if (!node) + continue; + + if (y + ozone->animations.scroll_y + node->height + 20 < ENTRIES_START_Y) + { + first++; + goto text_iterate; + } + else if (y + ozone->animations.scroll_y - node->height - 20 > bottom_boundary) + { + goto text_iterate; + } + + last++; +text_iterate: + y += node->height; + } + + last -= 1; + + ozone_list_deep_copy(selection_buf, ozone->selection_buf_old, first, last); +} + +static void ozone_refresh_consoles_list(ozone_handle_t *ozone) +{ + menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); + //TODO Refresh consoles list (= horizontal list) +} + +static int ozone_environ_cb(enum menu_environ_cb type, void *data, void *userdata) +{ + ozone_handle_t *ozone = (ozone_handle_t*) userdata; + + if (!ozone) + return -1; + + switch (type) + { + case MENU_ENVIRON_RESET_HORIZONTAL_LIST: + ozone_refresh_consoles_list(ozone); + break; + default: + return -1; + } + + return 0; +} + +menu_ctx_driver_t menu_ctx_ozone = { + NULL, //set_texture + NULL, //render_messagebox + ozone_menu_iterate, + ozone_render, + ozone_frame, + ozone_init, + ozone_free, + ozone_context_reset, + ozone_context_destroy, + ozone_populate_entries, + ozone_toggle, + ozone_navigation_clear, + ozone_navigation_pointer_changed, + ozone_navigation_pointer_changed, + ozone_navigation_set, + ozone_navigation_pointer_changed, + ozone_navigation_alphabet, + ozone_navigation_alphabet, + ozone_menu_init_list, + ozone_list_insert, + NULL, //list_prepend + ozone_list_free, + ozone_list_clear, + ozone_list_cache, + ozone_list_push, + ozone_list_get_selection, + ozone_list_get_size, + ozone_list_get_entry, + NULL, //list_set_selection, + NULL, //bind_init + NULL, //load_image + "ozone", + ozone_environ_cb, + NULL, //pointer_tap + NULL, //update_thumbnail_path + NULL, //update_thumbnail_image + NULL, //set_thumbnail_system + NULL, //set_thumbnail_content + menu_display_osk_ptr_at_pos, + NULL, //update_savestate_thumbnail_path + NULL //update_savestate_thumbnail_image +}; \ No newline at end of file diff --git a/menu/menu_animation.c b/menu/menu_animation.c index 8cd9d140f8..68c6260fbb 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -40,6 +40,7 @@ struct tween uintptr_t tag; easing_cb easing; tween_cb cb; + void *userdata; }; struct menu_animation @@ -326,6 +327,7 @@ bool menu_animation_push(menu_animation_ctx_entry_t *entry) t.subject = entry->subject; t.tag = entry->tag; t.cb = entry->cb; + t.userdata = entry->userdata; t.easing = NULL; switch (entry->easing_enum) @@ -519,7 +521,7 @@ bool menu_animation_update(float delta_time) anim.need_defrag = true; if (tween->cb) - tween->cb(); + tween->cb(tween->userdata); } if (tween->running_since < tween->duration) diff --git a/menu/menu_animation.h b/menu/menu_animation.h index 71f31e9c6d..6983237719 100644 --- a/menu/menu_animation.h +++ b/menu/menu_animation.h @@ -26,7 +26,7 @@ RETRO_BEGIN_DECLS typedef float (*easing_cb) (float, float, float, float); -typedef void (*tween_cb) (void); +typedef void (*tween_cb) (void*); enum menu_animation_ctl_state { @@ -106,6 +106,7 @@ typedef struct menu_animation_ctx_entry float target_value; float *subject; tween_cb cb; + void *userdata; } menu_animation_ctx_entry_t; typedef struct menu_animation_ctx_ticker diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 0ec43c8325..d8331f51a8 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -78,6 +78,9 @@ typedef struct menu_ctx_load_image /* Menu drivers */ static const menu_ctx_driver_t *menu_ctx_drivers[] = { +#if defined(HAVE_OZONE) + &menu_ctx_ozone, +#endif #if defined(HAVE_XUI) &menu_ctx_xui, #endif @@ -445,7 +448,6 @@ font_data_t *menu_display_font( bool is_threaded) { char fontpath[PATH_MAX_LENGTH]; - font_data_t *font_data = NULL; if (!menu_disp) return NULL; @@ -455,6 +457,16 @@ font_data_t *menu_display_font( fill_pathname_application_special( fontpath, sizeof(fontpath), type); + return menu_display_font_file(fontpath, font_size, is_threaded); +} + +font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_threaded) +{ + if (!menu_disp) + return NULL; + + font_data_t *font_data = NULL; + if (!menu_disp->font_init_first((void**)&font_data, video_driver_get_ptr(false), fontpath, font_size, is_threaded)) @@ -2626,3 +2638,11 @@ void menu_navigation_set_selection(size_t val) { menu_driver_selection_ptr = val; } + +void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha) +{ + rgba[0] = rgba[4] = rgba[8] = rgba[12] = ((hex >> 16) & 0xFF) * (1.0f / 255.0f); /* r */ + rgba[1] = rgba[5] = rgba[9] = rgba[13] = ((hex >> 8 ) & 0xFF) * (1.0f / 255.0f); /* g */ + rgba[2] = rgba[6] = rgba[10] = rgba[14] = ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f); /* b */ + rgba[3] = rgba[7] = rgba[11] = rgba[15] = alpha; +} diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 0110f9ef21..917265740f 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -812,6 +812,8 @@ font_data_t *menu_display_font( float font_size, bool video_is_threaded); +font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_threaded); + void menu_display_reset_textures_list( const char *texture_path, const char *iconpath, @@ -826,6 +828,8 @@ bool menu_display_driver_exists(const char *s); void menu_driver_destroy(void); +void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha); + extern uintptr_t menu_display_white_texture; extern menu_display_ctx_driver_t menu_display_ctx_gl; @@ -846,6 +850,7 @@ extern menu_display_ctx_driver_t menu_display_ctx_switch; extern menu_display_ctx_driver_t menu_display_ctx_sixel; extern menu_display_ctx_driver_t menu_display_ctx_null; +extern menu_ctx_driver_t menu_ctx_ozone; extern menu_ctx_driver_t menu_ctx_xui; extern menu_ctx_driver_t menu_ctx_rgui; extern menu_ctx_driver_t menu_ctx_mui; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 59e5e4527f..5361a70302 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3530,7 +3530,7 @@ static bool setting_append_list( parent_group); } - if (string_is_not_equal(settings->arrays.menu_driver, "xmb")) + if (string_is_not_equal(settings->arrays.menu_driver, "xmb") && string_is_not_equal(settings->arrays.menu_driver, "ozone")) { CONFIG_ACTION( list, list_info, @@ -7616,7 +7616,7 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); - if (string_is_equal(settings->arrays.menu_driver, "xmb")) + if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone")) { CONFIG_BOOL( list, list_info, @@ -8055,8 +8055,8 @@ static bool setting_append_list( SD_FLAG_NONE); #endif -#ifdef HAVE_XMB - if (string_is_equal(settings->arrays.menu_driver, "xmb")) +#if defined(HAVE_XMB) || defined(HAVE_OZONE) + if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone")) { CONFIG_BOOL( list, list_info, @@ -8302,7 +8302,7 @@ static bool setting_append_list( general_read_handler, SD_FLAG_ADVANCED); - if (string_is_equal(settings->arrays.menu_driver, "xmb")) + if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone")) { CONFIG_UINT( list, list_info, @@ -9040,7 +9040,7 @@ static bool setting_append_list( SD_FLAG_NONE ); - if (string_is_equal(settings->arrays.menu_driver, "xmb")) + if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone")) CONFIG_BOOL( list, list_info, &settings->bools.cheevos_badges_enable, diff --git a/qb/config.libs.sh b/qb/config.libs.sh index d0d94da004..a679058d35 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -518,7 +518,8 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH" HAVE_XMB=no HAVE_STRIPES=no HAVE_ZARCH=no - die : 'Notice: RGUI not available, MaterialUI, XMB and ZARCH will also be disabled.' + HAVE_OZONE=no + die : 'Notice: RGUI not available, MaterialUI, XMB, Ozone and ZARCH will also be disabled.' elif [ "$HAVE_OPENGL" = 'no' ] && [ "$HAVE_OPENGLES" = 'no' ] && [ "$HAVE_VULKAN" = 'no' ]; then if [ "$OS" = 'Win32' ]; then HAVE_SHADERPIPELINE=no @@ -531,7 +532,8 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH" HAVE_XMB=no HAVE_STRIPES=no HAVE_ZARCH=no - die : 'Notice: Hardware rendering context not available, XMB, MaterialUI and ZARCH will also be disabled.' + HAVE_OZONE=no + die : 'Notice: Hardware rendering context not available, XMB, MaterialUI, Ozone and ZARCH will also be disabled.' fi fi fi diff --git a/qb/config.params.sh b/qb/config.params.sh index 1e097b8f0c..34a83081ca 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -10,6 +10,7 @@ HAVE_LIBRETRODB=yes # Libretrodb support HAVE_RGUI=yes # RGUI menu HAVE_MATERIALUI=auto # MaterialUI menu HAVE_XMB=auto # XMB menu +HAVE_OZONE=no # Ozone menu HAVE_STRIPES=no # Stripes menu HAVE_ZARCH=no # Zarch menu HAVE_NUKLEAR=no # Nuklear menu From a4d75e3dd8137048d1622edb47b059512e61a0dd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 02:57:50 +0200 Subject: [PATCH 0421/1292] C89 buildfix --- menu/menu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index d8331f51a8..9191323e0d 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -462,11 +462,10 @@ font_data_t *menu_display_font( font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_threaded) { + font_data_t *font_data = NULL; if (!menu_disp) return NULL; - font_data_t *font_data = NULL; - if (!menu_disp->font_init_first((void**)&font_data, video_driver_get_ptr(false), fontpath, font_size, is_threaded)) From 2fd2649eb87ea0b4fe116ecec5dc0d4882cb27ac Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 04:40:43 +0200 Subject: [PATCH 0422/1292] Fix ton of C89 warnings/errors --- intl/msg_hash_el.c | 90 ++++---- menu/drivers/ozone.c | 507 +++++++++++++++++++++---------------------- 2 files changed, 302 insertions(+), 295 deletions(-) diff --git a/intl/msg_hash_el.c b/intl/msg_hash_el.c index fe0dd74863..54e449bbc4 100644 --- a/intl/msg_hash_el.c +++ b/intl/msg_hash_el.c @@ -109,16 +109,22 @@ int menu_hash_get_help_el_enum(enum msg_hash_enums msg, char *s, size_t len) "Εναλλαγή λειτουργίας παιχνιδιού/παρακολούθησης Netplay."); break; case RARCH_ENABLE_HOTKEY: - snprintf(s, len, + { + /* Work around C89 limitations */ + const char *t = "Ενεργοποίηση άλλων πλήκτρων εντολών. \n" " \n" "Εάν αυτό το πλήκτρο είναι συνδεδεμένο είτε με\n" "ένα πληκτρολόγιο ή κάποιο κουμπί χειριστιερίου, \n" - "όλα τα υπόλοιπα κουμπιά εντολών θα ενεργοποιηθούν μόνο \n" + "όλα τα υπόλοιπα κουμπιά εντολών θα ενεργοποιηθούν μόνο \n"; + const char *u = "εάν και αυτό είναι πατημένο την ίδια στιγμή. \n" " \n" "Διαφορετικά, όλα τα κουμπιά εντολών πληκτρολογίου \n" - "μπορούν να απενεργοποιηθούν από τον χρήστη."); + "μπορούν να απενεργοποιηθούν από τον χρήστη."; + strlcpy(s, t, len); + strlcat(s, u, len); + } break; case RARCH_VOLUME_UP: snprintf(s, len, @@ -238,18 +244,25 @@ int menu_hash_get_help_el_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "Κωδικός για τον λογαριασμό σας στο Retro Achievements."); break; case MENU_ENUM_LABEL_USER_LANGUAGE: - snprintf(s, len, "Τοπικοποίηση του μενού και όλων των μηνυμάτων \n" - "ανάλογα με την γλώσσα που έχετε επιλέξει \n" - "εδώ. \n" - " \n" - "Χρειάζεται επανεκκίνηση για να ενεργοποιηθούν \n" - "οι αλλαγές. \n" - " \n" - "Σημείωση: πιθανόν να μην έχουν εφαρμοστεί \n" - "όλες οι γλώσσες. \n" - " \n" - "Σε περίπτωση που μία γλώσσα δεν έχει εφαρμοστεί, \n" - "χρησιμοποιούμε τα Αγγλικά."); + { + /* Work around C89 limitations */ + const char *t = + "Τοπικοποίηση του μενού και όλων των μηνυμάτων \n" + "ανάλογα με την γλώσσα που έχετε επιλέξει \n" + "εδώ. \n" + " \n" + "Χρειάζεται επανεκκίνηση για να ενεργοποιηθούν \n" + "οι αλλαγές. \n"; + const char *u = + " \n" + "Σημείωση: πιθανόν να μην έχουν εφαρμοστεί \n" + "όλες οι γλώσσες. \n" + " \n" + "Σε περίπτωση που μία γλώσσα δεν έχει εφαρμοστεί, \n" + "χρησιμοποιούμε τα Αγγλικά."; + strlcpy(s, t, len); + strlcat(s, u, len); + } break; case MENU_ENUM_LABEL_VIDEO_FONT_PATH: snprintf(s, len, "Αλλαγή της γραμματοσειράς που χρησιμοποιείται \n" @@ -658,35 +671,36 @@ int menu_hash_get_help_el_enum(enum msg_hash_enums msg, char *s, size_t len) "Welcome to RetroArch\n" ); break; - case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: { - /* Work around C89 limitations */ - char u[501]; - const char *t = - "RetroArch relies on an unique form of\n" - "audio/video synchronization where it needs to be\n" - "calibrated against the refresh rate of your\n" - "display for best performance results.\n" - " \n" - "If you experience any audio crackling or video\n" - "tearing, usually it means that you need to\n" - "calibrate the settings. Some choices below:\n" - " \n"; - snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ + case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: + { + /* Work around C89 limitations */ + char u[501]; + const char *t = + "RetroArch relies on an unique form of\n" + "audio/video synchronization where it needs to be\n" + "calibrated against the refresh rate of your\n" + "display for best performance results.\n" + " \n" + "If you experience any audio crackling or video\n" + "tearing, usually it means that you need to\n" + "calibrate the settings. Some choices below:\n" + " \n"; + snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ "a) Go to '%s' -> '%s', and enable\n" - "'Threaded Video'. Refresh rate will not matter\n" - "in this mode, framerate will be higher,\n" - "but video might be less smooth.\n" - "b) Go to '%s' -> '%s', and look at\n" - "'%s'. Let it run for\n" - "2048 frames, then press 'OK'.", + "'Threaded Video'. Refresh rate will not matter\n" + "in this mode, framerate will be higher,\n" + "but video might be less smooth.\n" + "b) Go to '%s' -> '%s', and look at\n" + "'%s'. Let it run for\n" + "2048 frames, then press 'OK'.", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)); - strlcpy(s, t, len); - strlcat(s, u, len); - } + strlcpy(s, t, len); + strlcat(s, u, len); + } break; case MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: snprintf(s, len, diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index a148d73112..719c737621 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -2,8 +2,8 @@ * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2014-2017 - Jean-André Santoni * Copyright (C) 2016-2017 - Brad Parker - * Copyright (C) 2018 - Alfredo Monclús - * Copyright (C) 2018 - natinusala + * Copyright (C) 2018 - Alfredo Monclús + * Copyright (C) 2018 - natinusala * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -37,7 +37,7 @@ #include "../../retroarch.h" #include "../../verbosity.h" -//TODO Handle translation for hardcoded strings (footer...) +/* TODO Handle translation for hardcoded strings (footer...) */ #define FONT_SIZE_FOOTER 18 #define FONT_SIZE_TITLE 36 @@ -304,7 +304,7 @@ static unsigned ozone_system_tabs_icons[OZONE_SYSTEM_TAB_LAST] = { HEX_R(hex), HEX_G(hex), HEX_B(hex), alpha \ } -#define COLOR_BACKGROUND(hex) hex, HEX_R(hex), HEX_G(hex), HEX_B(hex) +#define OZONE_COLOR_BACKGROUND(hex) hex, HEX_R(hex), HEX_G(hex), HEX_B(hex) static float ozone_sidebar_background_light[16] = { 0.94, 0.94, 0.94, 1.00, @@ -350,13 +350,13 @@ static float ozone_sidebar_gradient_bottom_dark[16] = { typedef struct ozone_theme { - //Background color + /* Background color */ uint32_t background_rgb; float background_r; float background_g; float background_b; - //Float colors for quads and icons + /* Float colors for quads and icons */ float header_footer_separator[16]; float text[16]; float selection[16]; @@ -365,12 +365,12 @@ typedef struct ozone_theme float entries_icon[16]; float text_selected[16]; - //RGBA colors for text + /* RGBA colors for text */ uint32_t text_rgba; uint32_t text_selected_rgba; uint32_t text_sublabel_rgba; - //Sidebar color + /* Sidebar color */ float *sidebar_background; float *sidebar_top_gradient; float *sidebar_bottom_gradient; @@ -379,7 +379,7 @@ typedef struct ozone_theme } ozone_theme_t; ozone_theme_t ozone_theme_light = { - COLOR_BACKGROUND(0xEBEBEB), + OZONE_COLOR_BACKGROUND(0xEBEBEB), COLOR_HEX_TO_FLOAT(0x2B2B2B, 1.00), COLOR_HEX_TO_FLOAT(0x333333, 1.00), @@ -401,7 +401,7 @@ ozone_theme_t ozone_theme_light = { }; ozone_theme_t ozone_theme_dark = { - COLOR_BACKGROUND(0x2D2D2D), + OZONE_COLOR_BACKGROUND(0x2D2D2D), COLOR_HEX_TO_FLOAT(0xFFFFFF, 1.00), COLOR_HEX_TO_FLOAT(0xFFFFFF, 1.00), @@ -464,7 +464,7 @@ typedef struct ozone_handle uint8_t system_tab_end; uint8_t tabs[OZONE_SYSTEM_TAB_LAST]; - size_t categories_selection_ptr; //active tab id + size_t categories_selection_ptr; /* active tab id */ size_t categories_active_idx_old; bool cursor_in_sidebar; @@ -478,10 +478,10 @@ typedef struct ozone_handle float list_alpha; } animations; - bool fade_direction; //false = left to right, true = right to left + bool fade_direction; /* false = left to right, true = right to left */ - size_t selection; //currently selected entry - size_t selection_old; //previously selected entry (for fancy animation) + size_t selection; /* currently selected entry */ + size_t selection_old; /* previously selected entry (for fancy animation) */ size_t selection_old_list; unsigned entries_height; @@ -525,7 +525,8 @@ typedef struct ozone_node static const char *ozone_entries_icon_texture_path(ozone_handle_t *ozone, unsigned id) { - char *icon_name; + char icon_fullpath[255]; + char *icon_name = NULL; switch (id) { @@ -782,7 +783,6 @@ static const char *ozone_entries_icon_texture_path(ozone_handle_t *ozone, unsign break; } - char icon_fullpath[255]; fill_pathname_join( icon_fullpath, @@ -1118,9 +1118,13 @@ static void ozone_set_theme(ozone_handle_t *ozone, ozone_theme_t *theme) static void *ozone_init(void **userdata, bool video_is_threaded) { unsigned width, height; +#ifdef HAVE_LIBNX + Result rc; + ColorSetId theme; +#endif ozone_handle_t *ozone = NULL; - settings_t *settings = config_get_ptr(); - menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); + settings_t *settings = config_get_ptr(); + menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) goto error; @@ -1173,12 +1177,10 @@ static void *ozone_init(void **userdata, bool video_is_threaded) menu_display_allocate_white_texture(); - //Theme - //TODO Add theme override in settings + /* Theme */ + /* TODO Add theme override in settings */ #ifdef HAVE_LIBNX - ColorSetId theme; - Result rc = setsysInitialize(); - + rc = setsysInitialize(); if (R_SUCCEEDED(rc)) { setsysGetColorSetId(&theme); @@ -1196,7 +1198,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) ozone->need_compute = false; ozone->animations.scroll_y = 0.0f; - //Assets path + /* Assets path */ fill_pathname_join( ozone->assets_path, settings->paths.directory_assets, @@ -1204,7 +1206,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) sizeof(ozone->assets_path) ); - //PNG path + /* PNG path */ fill_pathname_join( ozone->png_path, ozone->assets_path, @@ -1212,7 +1214,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) sizeof(ozone->png_path) ); - //Icons path + /* Icons path */ fill_pathname_join( ozone->icons_path, ozone->png_path, @@ -1220,7 +1222,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) sizeof(ozone->icons_path) ); - //Sidebar path + /* Sidebar path */ fill_pathname_join( ozone->tab_path, ozone->png_path, @@ -1228,7 +1230,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) sizeof(ozone->tab_path) ); - //Theme path + /* Theme path */ fill_pathname_join( ozone->theme_path, ozone->png_path, @@ -1298,7 +1300,8 @@ static void ozone_context_reset(void *data, bool is_threaded) if (ozone) { - //Fonts init + /* Fonts init */ + unsigned i; char font_path[PATH_MAX_LENGTH]; fill_pathname_join(font_path, ozone->assets_path, "Inter-UI-Regular.ttf", sizeof(font_path)); @@ -1314,8 +1317,8 @@ static void ozone_context_reset(void *data, bool is_threaded) ozone->title_font_glyph_width = font_driver_get_message_width(ozone->fonts.title, "a", 1, 1); ozone->entry_font_glyph_width = font_driver_get_message_width(ozone->fonts.entries_label, "a", 1, 1); - //Textures init - for (int i = 0; i < OZONE_TEXTURE_LAST; i++) + /* Textures init */ + for (i = 0; i < OZONE_TEXTURE_LAST; i++) { char filename[PATH_MAX_LENGTH]; strcpy(filename, OZONE_TEXTURES_FILES[i]); @@ -1324,8 +1327,8 @@ static void ozone_context_reset(void *data, bool is_threaded) menu_display_reset_textures_list(filename, ozone->png_path, &ozone->textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); } - //Sidebar textures - for (int i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) + /* Sidebar textures */ + for (i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) { char filename[PATH_MAX_LENGTH]; strcpy(filename, OZONE_TAB_TEXTURES_FILES[i]); @@ -1334,8 +1337,8 @@ static void ozone_context_reset(void *data, bool is_threaded) menu_display_reset_textures_list(filename, ozone->tab_path, &ozone->tab_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); } - //Theme textures - for (int i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + /* Theme textures */ + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) { char filename[PATH_MAX_LENGTH]; strcpy(filename, OZONE_THEME_TEXTURES_FILES[i]); @@ -1344,15 +1347,13 @@ static void ozone_context_reset(void *data, bool is_threaded) menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); } - //Icons textures init - for (int i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) - { + /* Icons textures init */ + for (i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) menu_display_reset_textures_list(ozone_entries_icon_texture_path(ozone, i), ozone->icons_path, &ozone->icons_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); - } menu_display_allocate_white_texture(); - //State reset + /* State reset */ ozone->frame_count = 0; ozone->fade_direction = false; ozone->cursor_in_sidebar = false; @@ -1361,7 +1362,7 @@ static void ozone_context_reset(void *data, bool is_threaded) ozone->sidebar_offset = 0; ozone->draw_old_list = false; - //Animations + /* Animations */ ozone->animations.cursor_alpha = 1.0f; ozone->animations.scroll_y = 0.0f; ozone->animations.list_alpha = 1.0f; @@ -1376,34 +1377,27 @@ static void ozone_collapse_end(void *userdata) static void ozone_context_destroy(void *data) { + unsigned i; ozone_handle_t *ozone = (ozone_handle_t*) data; if (!ozone) return; - //Theme - for (int i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) - { + /* Theme */ + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) video_driver_texture_unload(&ozone->theme_textures[i]); - } - //Icons - for (int i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) - { + /* Icons */ + for (i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) video_driver_texture_unload(&ozone->icons_textures[i]); - } - //Textures - for (int i = 0; i < OZONE_TEXTURE_LAST; i++) - { + /* Textures */ + for (i = 0; i < OZONE_TEXTURE_LAST; i++) video_driver_texture_unload(&ozone->textures[i]); - } - //Icons - for (int i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) - { + /* Icons */ + for (i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) video_driver_texture_unload(&ozone->tab_textures[i]); - } video_driver_texture_unload(&menu_display_white_texture); @@ -1438,7 +1432,7 @@ static void *ozone_list_get_entry(void *data, } break; case MENU_LIST_HORIZONTAL: - //TODO Sidebar + /* TODO Sidebar */ break; default: break; @@ -1447,14 +1441,14 @@ static void *ozone_list_get_entry(void *data, return NULL; } +#if 0 static unsigned ozone_get_system_tab(ozone_handle_t *ozone, unsigned i) { if (i <= ozone->system_tab_end) - { return ozone->tabs[i]; - } return UINT_MAX; } +#endif static size_t ozone_list_get_size(void *data, enum menu_list_type type) { @@ -1468,7 +1462,7 @@ static size_t ozone_list_get_size(void *data, enum menu_list_type type) case MENU_LIST_PLAIN: return menu_entries_get_stack_size(0); case MENU_LIST_HORIZONTAL: - //TODO Return horizontal list size + /* TODO Return horizontal list size */ return 0; case MENU_LIST_TABS: return ozone->system_tab_end; @@ -1739,9 +1733,6 @@ static void ozone_list_clear(file_list_t *list) menu_animation_ctx_tag tag = (uintptr_t)list; menu_animation_kill_by_tag(&tag); - size_t i; - size_t size = list ? list->size : 0; - ozone_free_list_nodes(list, false); } @@ -1760,19 +1751,18 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); menu_animation_ctx_tag tag = (uintptr_t) selection_buf; menu_animation_ctx_entry_t entry; - float new_scroll = 0; - + float new_scroll = 0, entries_middle; + float bottom_boundary, current_selection_middle_onscreen; unsigned video_info_height; + video_driver_get_size(NULL, &video_info_height); - float currentSelectionMiddleOnScreen = ENTRIES_START_Y + ozone->animations.scroll_y + node->position_y + node->height/2; - float bottom_boundary = video_info_height - 87 - 78; - float entries_middle = video_info_height/2; + current_selection_middle_onscreen = ENTRIES_START_Y + ozone->animations.scroll_y + node->position_y + node->height / 2; + bottom_boundary = video_info_height - 87 - 78; + entries_middle = video_info_height/2; - if (currentSelectionMiddleOnScreen != entries_middle) - { - new_scroll = ozone->animations.scroll_y - (currentSelectionMiddleOnScreen - entries_middle); - } + if (current_selection_middle_onscreen != entries_middle) + new_scroll = ozone->animations.scroll_y - (current_selection_middle_onscreen - entries_middle); if (new_scroll + ozone->entries_height < bottom_boundary) new_scroll = -(78 + ozone->entries_height - bottom_boundary); @@ -1782,7 +1772,7 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo if (allow_animation) { - //Cursor animation + /* Cursor animation */ ozone->animations.cursor_alpha = 0.0f; entry.cb = NULL; @@ -1795,7 +1785,7 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo menu_animation_push(&entry); - //Scroll animation + /* Scroll animation */ entry.cb = NULL; entry.duration = ANIMATION_CURSOR_DURATION; entry.easing_enum = EASING_OUT_QUAD; @@ -1816,23 +1806,26 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo static void ozone_compute_entries_position(ozone_handle_t *ozone) { - //Compute entries height and adjust scrolling if needed - size_t i; + unsigned video_info_height; + /* Compute entries height and adjust scrolling if needed */ + size_t i, entries_end; + file_list_t *selection_buf = NULL; + menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); - size_t entries_end = menu_entries_get_size(); - file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + entries_end = menu_entries_get_size(); + selection_buf = menu_entries_get_selection_buf_ptr(0); - unsigned video_info_height; video_driver_get_size(NULL, &video_info_height); ozone->entries_height = 0; for (i = 0; i < entries_end; i++) { - //Entry + /* Entry */ menu_entry_t entry; char entry_value[255]; + ozone_node_t *node = NULL; entry_value[0] = '\0'; @@ -1840,8 +1833,8 @@ static void ozone_compute_entries_position(ozone_handle_t *ozone) menu_entry_get(&entry, 0, (unsigned)i, NULL, true); menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); - //Cache node - ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); + /* Cache node */ + node = (ozone_node_t*)file_list_get_userdata_at_offset(selection_buf, i); if (!node) continue; @@ -1854,7 +1847,7 @@ static void ozone_compute_entries_position(ozone_handle_t *ozone) menu_entry_free(&entry); } - //Update scrolling + /* Update scrolling */ ozone->selection = menu_navigation_get_selection(); ozone_update_scroll(ozone, false, (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, ozone->selection)); } @@ -1862,14 +1855,12 @@ static void ozone_compute_entries_position(ozone_handle_t *ozone) static void ozone_render(void *data, bool is_idle) { size_t i; - unsigned end = (unsigned)menu_entries_get_size(); menu_animation_ctx_delta_t delta; - + unsigned end = (unsigned)menu_entries_get_size(); + ozone_handle_t *ozone = (ozone_handle_t*)data; if (!data) return; - ozone_handle_t *ozone = (ozone_handle_t*) data; - if (ozone->need_compute) { ozone_compute_entries_position(ozone); @@ -1883,7 +1874,7 @@ static void ozone_render(void *data, bool is_idle) if (menu_animation_get_ideal_delta_time(&delta)) menu_animation_update(delta.ideal); - //TODO Handle pointer & mouse + /* TODO Handle pointer & mouse */ menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); @@ -1943,14 +1934,13 @@ static void ozone_draw_icon( static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_info) { - //Separator - menu_display_draw_quad(video_info, 30, 87, video_info->width - 60, 1, video_info->width, video_info->height, ozone->theme->header_footer_separator); - - //Title char title[255]; - menu_animation_ctx_ticker_t ticker; + /* Separator */ + menu_display_draw_quad(video_info, 30, 87, video_info->width - 60, 1, video_info->width, video_info->height, ozone->theme->header_footer_separator); + + /* Title */ ticker.s = title; ticker.len = (video_info->width - 128 - 47 - 130) / ozone->title_font_glyph_width; ticker.idx = ozone->frame_count / 20; @@ -1961,12 +1951,12 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i ozone_draw_text(video_info, ozone, title, 128, 20 + FONT_SIZE_TITLE, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.title, ozone->theme->text_rgba); - //Icon + /* Icon */ menu_display_blend_begin(video_info); ozone_draw_icon(video_info, 60, 60, ozone->textures[OZONE_TEXTURE_RETROARCH], 47, 14, video_info->width, video_info->height, 0, 1, ozone->theme->entries_icon); menu_display_blend_end(video_info); - //Timedate + /* Timedate */ if (video_info->timedate_enable) { menu_display_ctx_datetime_t datetime; @@ -1991,21 +1981,17 @@ static void ozone_color_alpha(float *color, float alpha) static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_info, settings_t *settings) { - //Separator + char core_title[255]; + /* Separator */ menu_display_draw_quad(video_info, 23, video_info->height - 78, video_info->width - 60, 1, video_info->width, video_info->height, ozone->theme->header_footer_separator); - //Core title or Switch icon - char core_title[255]; + /* Core title or Switch icon */ if (settings->bools.menu_core_enable && menu_entries_get_core_title(core_title, sizeof(core_title)) == 0) - { ozone_draw_text(video_info, ozone, core_title, 59, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); - } else - { ozone_draw_icon(video_info, 69, 30, ozone->theme_textures[OZONE_THEME_TEXTURE_SWITCH], 59, video_info->height - 52, video_info->width,video_info->height, 0, 1, NULL); - } - //Buttons + /* Buttons */ menu_display_blend_begin(video_info); ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); @@ -2017,17 +2003,17 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i menu_display_blend_end(video_info); } -//TODO Reduce sidebar width ? +/* TODO Reduce sidebar width ? */ static void ozone_draw_cursor(ozone_handle_t *ozone, video_frame_info_t *video_info, unsigned x_offset, unsigned entry_width, size_t y, float alpha) { ozone_color_alpha(ozone->theme_dynamic.selection_border, alpha); ozone_color_alpha(ozone->theme_dynamic.selection, alpha); - //Fill + /* Fill */ menu_display_draw_quad(video_info, x_offset, y, entry_width, 70 - 10 - 10 - 3, video_info->width, video_info->height, ozone->theme_dynamic.selection); - //Borders (can't do one single quad because of alpha) + /* Borders (can't do one single quad because of alpha) */ menu_display_draw_quad(video_info, x_offset -3, y - 3, entry_width + 6, 3, video_info->width, video_info->height, ozone->theme_dynamic.selection_border); menu_display_draw_quad(video_info, x_offset -3, y + 70 - 10 - 10 - 3, entry_width + 6, 3, video_info->width, video_info->height, ozone->theme_dynamic.selection_border); menu_display_draw_quad(video_info, x_offset -3, y, 3, 70 - 10 - 3 - 6 - 4, video_info->width, video_info->height, ozone->theme_dynamic.selection_border); @@ -2036,26 +2022,29 @@ static void ozone_draw_cursor(ozone_handle_t *ozone, video_frame_info_t *video_i static void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info) { + size_t y; + unsigned i, sidebar_height; + unsigned selection_y = 0; + unsigned selection_old_y = 0; + if (!ozone->draw_sidebar) return; menu_display_scissor_begin(video_info, 0, 87, 408, video_info->height - 87 - 78); - //Background - unsigned sidebar_height = video_info->height - 87 - 55 - 78; + /* Background */ + sidebar_height = video_info->height - 87 - 55 - 78; menu_display_draw_quad(video_info, ozone->sidebar_offset, 88, 408, 55/2, video_info->width, video_info->height, ozone->theme->sidebar_top_gradient); menu_display_draw_quad(video_info, ozone->sidebar_offset, 88 + 55/2, 408, sidebar_height, video_info->width, video_info->height, ozone->theme->sidebar_background); menu_display_draw_quad(video_info, ozone->sidebar_offset, 55*2 + sidebar_height, 408, 55/2 + 1, video_info->width, video_info->height, ozone->theme->sidebar_bottom_gradient); - //Tabs - //TODO Scroll - unsigned selection_y = 0; - unsigned selection_old_y = 0; + /* Tabs */ + /* TODO Scroll */ - //y offset computation - size_t y = ENTRIES_START_Y - 10; - for (int i = 0; i < OZONE_SYSTEM_TAB_LAST; i++) + /* y offset computation */ + y = ENTRIES_START_Y - 10; + for (i = 0; i < OZONE_SYSTEM_TAB_LAST; i++) { if (i == ozone->categories_selection_ptr) selection_y = y; @@ -2064,29 +2053,32 @@ static void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_ y += 65; } - //Cursor + /* Cursor */ if (ozone->cursor_in_sidebar) ozone_draw_cursor(ozone, video_info, ozone->sidebar_offset + 41, 408-81, selection_y-8, ozone->animations.cursor_alpha); if (ozone->cursor_in_sidebar_old && ozone->categories_selection_ptr != ozone->categories_active_idx_old) ozone_draw_cursor(ozone, video_info, ozone->sidebar_offset + 41, 408-81, selection_old_y-8, 1-ozone->animations.cursor_alpha); - //Icons + /* Icons */ y = ENTRIES_START_Y - 10; menu_display_blend_begin(video_info); - //TODO Cache all the tabs data - for (int i = 0; i < OZONE_SYSTEM_TAB_LAST; i++) - { - bool selected = (ozone->categories_selection_ptr == i); - unsigned icon = ozone_system_tabs_icons[i]; + /* TODO Cache all the tabs data */ - //Icon + for (i = 0; i < OZONE_SYSTEM_TAB_LAST; i++) + { + enum msg_hash_enums value_idx; + const char *title = NULL; + bool selected = (ozone->categories_selection_ptr == i); + unsigned icon = ozone_system_tabs_icons[i]; + + /* Icon */ ozone_draw_icon(video_info, 40, 40, ozone->tab_textures[icon], ozone->sidebar_offset + 41 + 10, y - 5, video_info->width, video_info->height, 0, 1, (selected ? ozone->theme->text_selected : ozone->theme->entries_icon)); - enum msg_hash_enums value_idx = ozone_system_tabs_value[i]; - const char *title = msg_hash_to_str(value_idx); + value_idx = ozone_system_tabs_value[i]; + title = msg_hash_to_str(value_idx); - //Text + /* Text */ ozone_draw_text(video_info, ozone, title, ozone->sidebar_offset + 115 - 10, y + FONT_SIZE_SIDEBAR, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.sidebar, (selected ? ozone->theme->text_selected_rgba : ozone->theme->text_rgba)); y += 65; @@ -2100,12 +2092,14 @@ static void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_ static void ozone_draw_entry_value(ozone_handle_t *ozone, video_frame_info_t *video_info, char *value, unsigned x, unsigned y, uint32_t alpha_uint32) { + enum msg_file_type hash_type; + bool switch_is_on = true; + bool do_draw_text = false; + if (string_is_empty(value)) return; - bool switch_is_on = true; - bool do_draw_text = false; - enum msg_file_type hash_type = msg_hash_to_file_type(msg_hash_calculate(value)); + hash_type = msg_hash_to_file_type(msg_hash_calculate(value)); /* set switch_is_on */ if (string_is_equal(value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || @@ -2157,29 +2151,28 @@ static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_ unsigned selection, unsigned selection_old, file_list_t *selection_buf, float alpha, float scroll_y) { - size_t i; - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); - - size_t entries_end = file_list_get_size(selection_buf); - unsigned x_offset = 0; - - bool old_list = selection_buf == ozone->selection_buf_old; - - size_t y = ENTRIES_START_Y; - size_t selection_y = 0; + bool old_list; + uint32_t alpha_uint32; + size_t i, y, entries_end; + float sidebar_offset, bottom_boundary, invert, alpha_anim; + unsigned video_info_height, entry_width; + unsigned x_offset = 0; + size_t selection_y = 0; size_t old_selection_y = 0; - float sidebar_offset = ozone->sidebar_offset/2.0f; - unsigned entry_width = video_info->width - 548; + menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); + + entries_end = file_list_get_size(selection_buf); + old_list = selection_buf == ozone->selection_buf_old; + y = ENTRIES_START_Y; + sidebar_offset = ozone->sidebar_offset / 2.0f; + entry_width = video_info->width - 548; - unsigned video_info_height; video_driver_get_size(NULL, &video_info_height); - float bottom_boundary = video_info_height - 87 - 78; - - float invert = (ozone->fade_direction) ? -1 : 1; - - float alpha_anim = old_list ? alpha : 1.0f - alpha; + bottom_boundary = video_info_height - 87 - 78; + invert = (ozone->fade_direction) ? -1 : 1; + alpha_anim = old_list ? alpha : 1.0f - alpha; if (old_list) alpha = 1.0f - alpha; @@ -2187,28 +2180,27 @@ static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_ if (alpha != 1.0f) { if (old_list) - x_offset = invert * -(alpha_anim * 120); //left + x_offset = invert * -(alpha_anim * 120); /* left */ else - x_offset = invert * (alpha_anim * 120); //right + x_offset = invert * (alpha_anim * 120); /* right */ } - x_offset += (unsigned) sidebar_offset; + x_offset += (unsigned) sidebar_offset; + alpha_uint32 = (uint32_t)(alpha*255.0f); - uint32_t alpha_uint32 = (uint32_t)(alpha*255.0f); - - //Borders layer + /* Borders layer */ for (i = 0; i < entries_end; i++) { - bool entry_selected = selection == i; + bool entry_selected = selection == i; bool entry_old_selected = selection_old == i; - + ozone_node_t *node = NULL; if (entry_selected) selection_y = y; if (entry_old_selected) old_selection_y = y; - ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); + node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); if (!node) continue; @@ -2220,7 +2212,7 @@ static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_ ozone_color_alpha(ozone->theme_dynamic.entries_border, alpha); - //Borders + /* Borders */ menu_display_draw_quad(video_info, x_offset + 456-3, y - 3 + scroll_y, entry_width + 10 - 3 -1, 1, video_info->width, video_info->height, ozone->theme_dynamic.entries_border); menu_display_draw_quad(video_info, x_offset + 456-3, y - 5 + 70 + 10 - 10 - 10 - 3 - 3 + scroll_y, entry_width + 10 - 3-1, 1, video_info->width, video_info->height, ozone->theme_dynamic.entries_border); @@ -2228,24 +2220,30 @@ text_iterate: y += node->height; } - //Cursor(s) layer + /* Cursor(s) layer */ if (!ozone->cursor_in_sidebar) ozone_draw_cursor(ozone, video_info, x_offset + 456, entry_width, selection_y + scroll_y, ozone->animations.cursor_alpha * alpha); if (!ozone->cursor_in_sidebar_old && ozone->selection != ozone->selection_old) ozone_draw_cursor(ozone, video_info, x_offset + 456, entry_width, old_selection_y + scroll_y, 1-ozone->animations.cursor_alpha * alpha); - //Icons + text + /* Icons + text */ y = ENTRIES_START_Y; for (i = 0; i < entries_end; i++) { + unsigned icon; menu_entry_t entry; + menu_animation_ctx_ticker_t ticker; char entry_value[255]; + char rich_label[255]; + char entry_value_ticker[255]; + ozone_node_t *node = NULL; + char *entry_rich_label = NULL; + bool entry_selected = false; - entry_value[0] = '\0'; - - bool entry_selected = selection == i; - ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); + entry_value[0] = '\0'; + entry_selected = selection == i; + node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)i, selection_buf, true); @@ -2259,8 +2257,8 @@ text_iterate: else if (y + scroll_y - node->height - 20 > bottom_boundary) goto icons_iterate; - //Icon - unsigned icon = ozone_entries_icon_get_id(ozone, entry.enum_idx, entry.type, entry_selected); + /* Icon */ + icon = ozone_entries_icon_get_id(ozone, entry.enum_idx, entry.type, entry_selected); ozone_color_alpha(ozone->theme_dynamic.entries_icon, alpha); @@ -2268,12 +2266,9 @@ text_iterate: ozone_draw_icon(video_info, 46, 46, ozone->icons_textures[icon], x_offset + 451+5+10, y + scroll_y, video_info->width, video_info->height, 0, 1, ozone->theme_dynamic.entries_icon); menu_display_blend_end(video_info); - char *entry_rich_label = NULL; - char rich_label[255]; entry_rich_label = menu_entry_get_rich_label(&entry); - menu_animation_ctx_ticker_t ticker; ticker.idx = ozone->frame_count / 20; ticker.s = rich_label; @@ -2283,12 +2278,11 @@ text_iterate: menu_animation_ticker(&ticker); - //Text + /* Text */ ozone_draw_text(video_info, ozone, rich_label, x_offset + 521, y + FONT_SIZE_ENTRIES_LABEL + 8 - 1 + scroll_y, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.entries_label, (ozone->theme->text_rgba & 0xFFFFFF00) | alpha_uint32); ozone_draw_text(video_info, ozone, entry.sublabel, x_offset + 470, y + FONT_SIZE_ENTRIES_SUBLABEL + 80 - 20 - 3 + scroll_y, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.entries_sublabel, (ozone->theme->text_sublabel_rgba & 0xFFFFFF00) | alpha_uint32); - //Value - char entry_value_ticker[255]; + /* Value */ ticker.idx = ozone->frame_count / 20; ticker.s = entry_value_ticker; @@ -2306,7 +2300,7 @@ icons_iterate: menu_entry_free(&entry); } - //Text layer + /* Text layer */ font_driver_flush(video_info->width, video_info->height, ozone->fonts.entries_label, video_info); font_driver_flush(video_info->width, video_info->height, ozone->fonts.entries_sublabel, video_info); } @@ -2362,18 +2356,18 @@ static void ozone_navigation_alphabet(void *data, size_t *unused) static void ozone_frame(void *data, video_frame_info_t *video_info) { + menu_display_ctx_clearcolor_t clearcolor; ozone_handle_t* ozone = (ozone_handle_t*) data; + settings_t *settings = config_get_ptr(); if (!ozone) return; - settings_t *settings = config_get_ptr(); - ozone->frame_count++; menu_display_set_viewport(video_info->width, video_info->height); - //Clear first layer of text + /* Clear first layer of text */ font_driver_bind_block(ozone->fonts.footer, &ozone->raster_blocks.footer); font_driver_bind_block(ozone->fonts.title, &ozone->raster_blocks.title); font_driver_bind_block(ozone->fonts.time, &ozone->raster_blocks.time); @@ -2388,8 +2382,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) ozone->raster_blocks.entries_sublabel.carr.coords.vertices = 0; ozone->raster_blocks.sidebar.carr.coords.vertices = 0; - //Background - menu_display_ctx_clearcolor_t clearcolor; + /* Background */ clearcolor.r = ozone->theme->background_r; clearcolor.g = ozone->theme->background_g; @@ -2398,26 +2391,26 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) menu_display_clear_color(&clearcolor, video_info); - //Header, footer + /* Header, footer */ ozone_draw_header(ozone, video_info); ozone_draw_footer(ozone, video_info, settings); - //Sidebar + /* Sidebar */ ozone_draw_sidebar(ozone, video_info); - //Menu entries + /* Menu entries */ menu_display_scissor_begin(video_info, ozone->sidebar_offset + 408, 87, video_info->width - 408 + (-ozone->sidebar_offset), video_info->height - 87 - 78); - //Current list + /* Current list */ ozone_draw_entries(ozone, video_info, ozone->selection, ozone->selection_old, menu_entries_get_selection_buf_ptr(0), ozone->animations.list_alpha, ozone->animations.scroll_y); - //Old list + /* Old list */ if (ozone->draw_old_list) ozone_draw_entries(ozone, video_info, ozone->selection_old_list, ozone->selection_old_list, ozone->selection_buf_old, ozone->animations.list_alpha, ozone->scroll_old); menu_display_scissor_end(video_info); - //Flush first layer of text + /* Flush first layer of text */ font_driver_flush(video_info->width, video_info->height, ozone->fonts.footer, video_info); font_driver_flush(video_info->width, video_info->height, ozone->fonts.title, video_info); font_driver_flush(video_info->width, video_info->height, ozone->fonts.time, video_info); @@ -2432,7 +2425,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) static void ozone_set_header(ozone_handle_t *ozone) { - //TODO Set title of playlist if in a playlist + /* TODO Set title of playlist if in a playlist */ menu_entries_get_title(ozone->title, sizeof(ozone->title)); } @@ -2445,16 +2438,17 @@ static void ozone_animation_end(void *userdata) static void ozone_list_open(ozone_handle_t *ozone) { + struct menu_animation_ctx_entry entry; + if (!ozone->want_horizontal_animation) { ozone->want_horizontal_animation = true; return; } + ozone->draw_old_list = true; - struct menu_animation_ctx_entry entry; - - //Left/right animation + /* Left/right animation */ ozone->animations.list_alpha = 0.0f; entry.cb = ozone_animation_end; @@ -2467,7 +2461,7 @@ static void ozone_list_open(ozone_handle_t *ozone) menu_animation_push(&entry); - //Sidebar animation + /* Sidebar animation */ if (ozone->depth == 1) { ozone->draw_sidebar = true; @@ -2510,7 +2504,8 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL)) { menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); - //TODO Update thumbnails + + /* TODO Update thumbnails */ ozone_selection_changed(ozone, false); return; } @@ -2559,15 +2554,15 @@ static void ozone_change_tab(ozone_handle_t *ozone, enum msg_hash_enums tab, enu static void ozone_go_to_sidebar(ozone_handle_t *ozone, uintptr_t tag) { - ozone->selection_old = ozone->selection; - ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; - ozone->cursor_in_sidebar = true; - - //Cursor animation - ozone->animations.cursor_alpha = 0.0f; - struct menu_animation_ctx_entry entry; + ozone->selection_old = ozone->selection; + ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; + ozone->cursor_in_sidebar = true; + + /* Cursor animation */ + ozone->animations.cursor_alpha = 0.0f; + entry.cb = NULL; entry.duration = ANIMATION_CURSOR_DURATION; entry.easing_enum = EASING_OUT_QUAD; @@ -2581,15 +2576,15 @@ static void ozone_go_to_sidebar(ozone_handle_t *ozone, uintptr_t tag) static void ozone_leave_sidebar(ozone_handle_t *ozone, uintptr_t tag) { - ozone->categories_active_idx_old = ozone->categories_selection_ptr; - ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; - ozone->cursor_in_sidebar = false; - - //Cursor animation - ozone->animations.cursor_alpha = 0.0f; - struct menu_animation_ctx_entry entry; + ozone->categories_active_idx_old = ozone->categories_selection_ptr; + ozone->cursor_in_sidebar_old = ozone->cursor_in_sidebar; + ozone->cursor_in_sidebar = false; + + /* Cursor animation */ + ozone->animations.cursor_alpha = 0.0f; + entry.cb = NULL; entry.duration = ANIMATION_CURSOR_DURATION; entry.easing_enum = EASING_OUT_QUAD; @@ -2603,20 +2598,21 @@ static void ozone_leave_sidebar(ozone_handle_t *ozone, uintptr_t tag) static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_action action) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + int new_selection; + struct menu_animation_ctx_entry entry; + enum menu_action new_action; + menu_animation_ctx_tag tag; + file_list_t *selection_buf = NULL; + ozone_handle_t *ozone = (ozone_handle_t*) userdata; if (!ozone) return generic_menu_iterate(menu, userdata, action); - file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + selection_buf = menu_entries_get_selection_buf_ptr(0); + tag = (uintptr_t)selection_buf; + new_action = action; - menu_animation_ctx_tag tag = (uintptr_t)selection_buf; - int new_selection; - struct menu_animation_ctx_entry entry; - - enum menu_action new_action = action; - - //Inputs override + /* Inputs override */ switch (action) { case MENU_ACTION_DOWN: @@ -2627,7 +2623,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act new_selection = (ozone->categories_selection_ptr + 1); - if (new_selection >= ozone->system_tab_end + 2) //TODO Check against actual tabs count and not just system tabs + if (new_selection >= ozone->system_tab_end + 2) /* TODO Check against actual tabs count and not just system tabs */ new_selection = 0; if (ozone->categories_selection_ptr != new_selection) @@ -2640,7 +2636,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act menu_animation_kill_by_tag(&tag); } - //Cursor animation + /* Cursor animation */ ozone->animations.cursor_alpha = 0.0f; entry.cb = NULL; @@ -2666,7 +2662,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act new_selection = ozone->categories_selection_ptr - 1; if (new_selection < 0) - new_selection = ozone->system_tab_end + 1; //TODO Set this to actual tabs count and not just system tabs + new_selection = ozone->system_tab_end + 1; /* TODO Set this to actual tabs count and not just system tabs */ if (ozone->categories_selection_ptr != new_selection) { @@ -2678,7 +2674,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act menu_animation_kill_by_tag(&tag); } - //Cursor animation + /* Cursor animation */ ozone->animations.cursor_alpha = 0.0f; entry.cb = NULL; @@ -2702,10 +2698,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act break; } else if (ozone->depth > 1) - { break; - } - ozone_go_to_sidebar(ozone, tag); @@ -2754,10 +2747,11 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act return generic_menu_iterate(menu, userdata, new_action); } -//TODO Fancy toggle animation +/* TODO Fancy toggle animation */ static void ozone_toggle(void *userdata, bool menu_on) { + bool tmp = false; ozone_handle_t *ozone = (ozone_handle_t*) userdata; if (!menu_on) { @@ -2771,7 +2765,7 @@ static void ozone_toggle(void *userdata, bool menu_on) menu_display_clear_color(&clearcolor, NULL); } - bool tmp = !menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL); + tmp = !menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL); if (tmp) menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); @@ -2892,9 +2886,8 @@ static void ozone_list_deep_copy(const file_list_t *src, file_list_t *dst, { struct item_file *d = &dst->list[j]; struct item_file *s = &src->list[i]; - - void *src_udata = s->userdata; - void *src_adata = s->actiondata; + void *src_udata = s->userdata; + void *src_adata = s->actiondata; *d = *s; d->alt = string_is_empty(d->alt) ? NULL : strdup(d->alt); @@ -2920,27 +2913,29 @@ static void ozone_list_deep_copy(const file_list_t *src, file_list_t *dst, static void ozone_list_cache(void *data, enum menu_list_type type, unsigned action) { - ozone_handle_t *ozone = (ozone_handle_t*)data; + size_t y, entries_end; + unsigned i; + unsigned video_info_height; + float bottom_boundary; + unsigned first = 0; + unsigned last = 0; + file_list_t *selection_buf = NULL; + ozone_handle_t *ozone = (ozone_handle_t*)data; if (!ozone) return; - ozone->need_compute = true; + ozone->need_compute = true; + ozone->selection_old_list = ozone->selection; + ozone->scroll_old = ozone->animations.scroll_y; - ozone->selection_old_list = ozone->selection; - ozone->scroll_old = ozone->animations.scroll_y; - - //Deep copy visible elements - unsigned first = 0; - unsigned last = 0; - - unsigned video_info_height; + /* Deep copy visible elements */ video_driver_get_size(NULL, &video_info_height); - size_t y = ENTRIES_START_Y; - int i; - size_t entries_end = menu_entries_get_size(); - file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); - float bottom_boundary = video_info_height - 87 - 78; + y = ENTRIES_START_Y; + entries_end = menu_entries_get_size(); + selection_buf = menu_entries_get_selection_buf_ptr(0); + bottom_boundary = video_info_height - 87 - 78; + for (i = 0; i < entries_end; i++) { ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); @@ -2954,9 +2949,7 @@ static void ozone_list_cache(void *data, goto text_iterate; } else if (y + ozone->animations.scroll_y - node->height - 20 > bottom_boundary) - { goto text_iterate; - } last++; text_iterate: @@ -2971,7 +2964,7 @@ text_iterate: static void ozone_refresh_consoles_list(ozone_handle_t *ozone) { menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); - //TODO Refresh consoles list (= horizontal list) + /* TODO Refresh consoles list (= horizontal list) */ } static int ozone_environ_cb(enum menu_environ_cb type, void *data, void *userdata) @@ -2994,8 +2987,8 @@ static int ozone_environ_cb(enum menu_environ_cb type, void *data, void *userdat } menu_ctx_driver_t menu_ctx_ozone = { - NULL, //set_texture - NULL, //render_messagebox + NULL, /* set_texture */ + NULL, /* render_messagebox */ ozone_menu_iterate, ozone_render, ozone_frame, @@ -3014,7 +3007,7 @@ menu_ctx_driver_t menu_ctx_ozone = { ozone_navigation_alphabet, ozone_menu_init_list, ozone_list_insert, - NULL, //list_prepend + NULL, /* list_prepend */ ozone_list_free, ozone_list_clear, ozone_list_cache, @@ -3022,17 +3015,17 @@ menu_ctx_driver_t menu_ctx_ozone = { ozone_list_get_selection, ozone_list_get_size, ozone_list_get_entry, - NULL, //list_set_selection, - NULL, //bind_init - NULL, //load_image + NULL, /* list_set_selection */ + NULL, /* bind_init */ + NULL, /* load_image */ "ozone", ozone_environ_cb, - NULL, //pointer_tap - NULL, //update_thumbnail_path - NULL, //update_thumbnail_image - NULL, //set_thumbnail_system - NULL, //set_thumbnail_content + NULL, /* pointer_tap */ + NULL, /* update_thumbnail_path */ + NULL, /* update_thumbnail_image */ + NULL, /* set_thumbnail_system */ + NULL, /* set_thumbnail_content */ menu_display_osk_ptr_at_pos, - NULL, //update_savestate_thumbnail_path - NULL //update_savestate_thumbnail_image -}; \ No newline at end of file + NULL, /* update_savestate_thumbnail_path */ + NULL /* update_savestate_thumbnail_image */ +}; From 199bc744b3e3bdd78e79a8944575481d54caf7da Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 04:47:12 +0200 Subject: [PATCH 0423/1292] (Ozone) Use strlcpy/strlcat --- menu/drivers/ozone.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 719c737621..5aa6a1859f 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -79,7 +79,7 @@ enum OZONE_THEME_TEXTURES { static char* OZONE_THEME_TEXTURES_FILES[OZONE_THEME_TEXTURE_LAST] = { "button_a", "button_b", - "switch", + "switch" }; enum OZONE_TAB_TEXTURES { @@ -1321,8 +1321,8 @@ static void ozone_context_reset(void *data, bool is_threaded) for (i = 0; i < OZONE_TEXTURE_LAST; i++) { char filename[PATH_MAX_LENGTH]; - strcpy(filename, OZONE_TEXTURES_FILES[i]); - strcat(filename, ".png"); + strlcpy(filename, OZONE_TEXTURES_FILES[i], sizeof(filename)); + strlcat(filename, ".png", sizeof(filename)); menu_display_reset_textures_list(filename, ozone->png_path, &ozone->textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); } @@ -1331,8 +1331,8 @@ static void ozone_context_reset(void *data, bool is_threaded) for (i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) { char filename[PATH_MAX_LENGTH]; - strcpy(filename, OZONE_TAB_TEXTURES_FILES[i]); - strcat(filename, ".png"); + strlcpy(filename, OZONE_TAB_TEXTURES_FILES[i], sizeof(filename)); + strlcat(filename, ".png", sizeof(filename)); menu_display_reset_textures_list(filename, ozone->tab_path, &ozone->tab_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); } @@ -1341,8 +1341,8 @@ static void ozone_context_reset(void *data, bool is_threaded) for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) { char filename[PATH_MAX_LENGTH]; - strcpy(filename, OZONE_THEME_TEXTURES_FILES[i]); - strcat(filename, ".png"); + strlcpy(filename, OZONE_THEME_TEXTURES_FILES[i], sizeof(filename)); + strlcat(filename, ".png", sizeof(filename)); menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); } From 9b72a3337c85572b7c0d8bb8a2760755a179093d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 05:29:28 +0200 Subject: [PATCH 0424/1292] (Dutch) Update Dutch translation (Ozone) Update hardcoded label --- intl/msg_hash_nl.h | 20 ++++++++++++++++---- menu/drivers/ozone.c | 4 +++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 2c42e03c06..8bbd21ab6e 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -527,6 +527,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_FALSE, "Niet waar") MSG_HASH(MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, "Maximale afspeelsnelheid") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, + "Favorieten" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_SHOW, "Framerate weergeven") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, @@ -1174,6 +1178,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, "Start Scherm Weergeven") MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, "Rechtse Analog Stick") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, + "Toevoegen aan Favorieten" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, + "Toevoegen aan Favorieten" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN, "Run") MSG_HASH(MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE, @@ -1533,7 +1545,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, "Post Filter Opname Activeren") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, - "Vertical Refresh Rate") + "Verticale Refresh Rate") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, "Geschatte Scherm Framerate") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_POLLED, @@ -1589,9 +1601,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, "Windowed Fullscreen Mode") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, - "Window Width") + "Window Breedte") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, - "Window Height") + "Window Hoogte") MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, "Wi-Fi Driver") MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, @@ -3105,7 +3117,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, MSG_HASH(MSG_SCANNING_OF_FILE_FINISHED, "Scanning of file finished") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, - "Audio Resampler Quality") + "Audio Resampler Kwaliteit") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, "Lower this value to favor performance/lower latency over audio quality, increase if you want better audio quality at the expense of performance/lower latency.") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 5aa6a1859f..c42d387e90 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -2143,7 +2143,9 @@ static void ozone_draw_entry_value(ozone_handle_t *ozone, video_frame_info_t *vi } else { - ozone_draw_text(video_info, ozone, (switch_is_on ? "On" : "Off"), x, y, TEXT_ALIGN_RIGHT, video_info->width, video_info->height, ozone->fonts.entries_label, ((switch_is_on ? ozone->theme->text_selected_rgba : ozone->theme->text_sublabel_rgba) & 0xFFFFFF00) | alpha_uint32); + ozone_draw_text(video_info, ozone, (switch_is_on ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)), + x, y, TEXT_ALIGN_RIGHT, video_info->width, video_info->height, ozone->fonts.entries_label, + ((switch_is_on ? ozone->theme->text_selected_rgba : ozone->theme->text_sublabel_rgba) & 0xFFFFFF00) | alpha_uint32); } } From 622bef1f7a8c22b2f25fa02938b4557ce161ec43 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 05:48:44 +0200 Subject: [PATCH 0425/1292] Dehardcode some more strings --- intl/msg_hash_ar.h | 4 ++++ intl/msg_hash_chs.h | 4 ++++ intl/msg_hash_cht.h | 4 ++++ intl/msg_hash_de.h | 4 ++++ intl/msg_hash_el.h | 6 +++++- intl/msg_hash_eo.h | 4 ++++ intl/msg_hash_es.h | 4 ++++ intl/msg_hash_fr.h | 4 ++++ intl/msg_hash_it.h | 4 ++++ intl/msg_hash_ja.h | 4 ++++ intl/msg_hash_ko.h | 4 ++++ intl/msg_hash_nl.h | 4 ++++ intl/msg_hash_pl.h | 4 ++++ intl/msg_hash_pt_br.h | 4 ++++ intl/msg_hash_pt_pt.h | 4 ++++ intl/msg_hash_ru.h | 4 ++++ intl/msg_hash_us.h | 4 ++++ intl/msg_hash_vn.h | 4 ++++ menu/drivers/ozone.c | 4 ++-- msg_hash.h | 1 + 20 files changed, 76 insertions(+), 3 deletions(-) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index e47f4ba0c0..079ffd8eff 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3674,3 +3674,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 70ab24efab..23e1fda66c 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -4693,3 +4693,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "将当前配置文件的所有设置恢复为默认。" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 41a56ad911..5ab5d0ffd8 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3450,3 +3450,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index a9eccfa635..a89fc2a391 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3586,3 +3586,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Setzt die momentane Konfiguration auf die Standardwerte zurück." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 8343d39cda..ae135a288a 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -7674,4 +7674,8 @@ MSG_HASH( MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Επαναφορά της τρέχουσας διαμόρφωσης στις προεπιλεγμένες ρυθμίσεις." - ) \ No newline at end of file + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 763b4cf48e..520a48c0e2 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3325,3 +3325,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 6c40ffa0c1..6c034d9292 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7613,3 +7613,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 772a6a0c57..9dbc67b5ae 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3484,3 +3484,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 6cad54ff30..b0f56210f9 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3544,3 +3544,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reimposta la configurazione corrente ai valori predefiniti." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 66f0aa5dc1..f84b29b3ab 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3993,3 +3993,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "現在の設定をデフォルトの値に戻します。" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index dab570bc6b..18a66cbcd7 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3445,3 +3445,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 8bbd21ab6e..d82696f30c 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3331,3 +3331,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset de instellingen aar fabrieksinstellingen." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "Oke" + ) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 6d529b1503..e566952638 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3747,3 +3747,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Zresetuj bieżącą konfigurację do wartości domyślnych." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index cf21f460b4..a5ef3d98b4 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7707,3 +7707,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Restaura a configuração atual para os valores padrão." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 63b4a10704..823cd0252d 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3411,3 +3411,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 40e25890a3..1f5e2e6710 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3614,3 +3614,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 6b4c968fcd..2dfb3ff14a 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7707,3 +7707,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index d03dd162d4..0cb6d32bce 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3482,3 +3482,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, "Reset the current configuration to default values." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index c42d387e90..c0b6970b85 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1997,8 +1997,8 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); menu_display_blend_end(video_info); - ozone_draw_text(video_info, ozone, "Back", video_info->width - 215, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); - ozone_draw_text(video_info, ozone, "OK", video_info->width - 96, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + ozone_draw_text(video_info, ozone, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK), video_info->width - 215, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + ozone_draw_text(video_info, ozone, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK), video_info->width - 96, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); menu_display_blend_end(video_info); } diff --git a/msg_hash.h b/msg_hash.h index 49a6ae1d41..84f87a94b8 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -909,6 +909,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP, MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN, MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM, + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START, MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO, From 75d36ebc1f672cee3197f6ec33a0b72f7f19a924 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 06:18:56 +0200 Subject: [PATCH 0426/1292] (Ozone) Button legend now responds to 'Menu Swap OK/Cancel' setting --- gfx/video_driver.c | 1 + gfx/video_driver.h | 1 + menu/drivers/ozone.c | 47 ++++++++++++++++++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index c469a7d66f..42316c54c7 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2748,6 +2748,7 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->scale_integer = settings->bools.video_scale_integer; video_info->aspect_ratio_idx = settings->uints.video_aspect_ratio_idx; video_info->post_filter_record = settings->bools.video_post_filter_record; + video_info->input_menu_swap_ok_cancel_buttons = settings->bools.input_menu_swap_ok_cancel_buttons; video_info->max_swapchain_images = settings->uints.video_max_swapchain_images; video_info->windowed_fullscreen = settings->bools.video_windowed_fullscreen; video_info->fullscreen = settings->bools.video_fullscreen || retroarch_is_forced_fullscreen(); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index ee2a567501..de028e4900 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -404,6 +404,7 @@ typedef struct video_info typedef struct video_frame_info { + bool input_menu_swap_ok_cancel_buttons; bool input_driver_nonblock_state; bool shared_context; bool black_frame_insertion; diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index c0b6970b85..8fdc2d8c88 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1992,13 +1992,48 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i ozone_draw_icon(video_info, 69, 30, ozone->theme_textures[OZONE_THEME_TEXTURE_SWITCH], 59, video_info->height - 52, video_info->width,video_info->height, 0, 1, NULL); /* Buttons */ - menu_display_blend_begin(video_info); - ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); - ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); - menu_display_blend_end(video_info); - ozone_draw_text(video_info, ozone, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK), video_info->width - 215, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); - ozone_draw_text(video_info, ozone, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK), video_info->width - 96, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + { + unsigned back_width = 215; + unsigned back_height = 49; + unsigned ok_width = 96; + unsigned ok_height = 49; + bool do_swap = video_info->input_menu_swap_ok_cancel_buttons; + + if (do_swap) + { + back_width = 96; + back_height = 49; + ok_width = 215; + ok_height = 49; + } + + menu_display_blend_begin(video_info); + + if (do_swap) + { + ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + } + else + { + ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + } + + menu_display_blend_end(video_info); + + ozone_draw_text(video_info, ozone, + do_swap ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK) : + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK), + video_info->width - back_width, video_info->height - back_height + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + ozone_draw_text(video_info, ozone, + do_swap ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK) : + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK), + video_info->width - ok_width, video_info->height - ok_height + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); + } menu_display_blend_end(video_info); } From b1c9b4919a2edfd569356c5a592151ca985e68e2 Mon Sep 17 00:00:00 2001 From: LamboLighting Date: Sat, 27 Oct 2018 11:41:56 +0300 Subject: [PATCH 0427/1292] Update Greek Translation More updates. Most of the basic menu has been translated. --- intl/msg_hash_el.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 8343d39cda..f2a5ba4e20 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -1184,27 +1184,27 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, - "Cheat index -" + "Κατάλογος απάτης -" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_PLUS, - "Cheat index +" + "Κατάλογος απάτης +" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_TOGGLE, - "Cheat toggle" + "Απάτες" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_EJECT_TOGGLE, - "Disk eject toggle" + "Εξαγωγή δίσκου" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, - "Disk next" + "Επόμενος δίσκος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, - "Disk prev" + "Προηγούμενος δίσκος" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, @@ -1212,11 +1212,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_HOLD_KEY, - "Fast forward hold" + "Παύση γρήγορης κίνησης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_KEY, - "Fast forward toggle" + "Γρήγορη κίνηση" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, @@ -1228,19 +1228,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, - "Grab mouse toggle" + "Κλείδωμα ποντικιού" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, - "Game focus toggle" + "Εστίαση παιχνιδιού" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, - "Desktop menu toggle" + "Μενού επιφάνειας" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, - "Load state" + "Φόρτωση κατάστασης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, @@ -1256,7 +1256,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, - "Netplay toggle play/spectate mode" + "Εναλλαγή κατάστασης παιχνιδιού/θεατή Netplay" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, @@ -1264,7 +1264,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, - "Overlay next" + "Επόμενο επικάλλυμα" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, @@ -1276,7 +1276,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, - "Reset game" + "Επαναφορά παιχνιδιού" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, @@ -1292,7 +1292,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, - "Save state" + "Αποθήκευση κατάστασης" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, @@ -1316,11 +1316,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, - "Savestate slot -" + "Θέση κατάστασης αποθήκευσης -" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, - "Savestate slot +" + "Θέση κατάστασης αποθήκευσης +" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, @@ -4404,7 +4404,7 @@ MSG_HASH( ) MSG_HASH( MSG_FAST_FORWARD, - "Fast forward." + "Γρήγορη κίνηση." ) MSG_HASH( MSG_SLOW_MOTION_REWIND, @@ -4520,7 +4520,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, - "Influence how input polling is done inside RetroArch. Setting it to 'Early' or 'Late' can result in less latency, depending on your configuration." + "Επιρροή του πως γίνεται η συγκέντρωση εισόδου μέσα στο RetroArch. Ο ορισμός σε 'Νωρίς' ή 'Αργά' μπορεί να έχει ως αποτέλεσμα μικρότερη καθυστέρηση με τις ρυθμίσεις σας." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, From f50b18414928200e8b13a2872bbc9c425698d854 Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 14:31:26 +0200 Subject: [PATCH 0428/1292] ozone: build it for libnx platform, don't set it as default yet --- Makefile.libnx | 2 +- configuration.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.libnx b/Makefile.libnx index 709f03364c..22fc9ccc76 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -58,7 +58,7 @@ ifeq ($(HAVE_OPENGL), 1) HAVE_ZARCH = 0 HAVE_XMB = 1 - HAVE_OZONE = 0 + HAVE_OZONE = 1 HAVE_STRIPES = 0 HAVE_OVERLAY = 1 diff --git a/configuration.c b/configuration.c index 7dfa178c30..1ab4bb23fe 100644 --- a/configuration.c +++ b/configuration.c @@ -535,8 +535,8 @@ static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_NULL; static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XUI; #elif defined(HAVE_MATERIALUI) && defined(RARCH_MOBILE) static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_MATERIALUI; -#elif defined(HAVE_OZONE) && defined(HAVE_LIBNX) -static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_OZONE; +/* #elif defined(HAVE_OZONE) && defined(HAVE_LIBNX) +static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_OZONE; */ #elif defined(HAVE_XMB) && !defined(_XBOX) static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XMB; #elif defined(HAVE_RGUI) From 8e37ad858aedcf05278fd42439b4f677d5e167cb Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 14:42:47 +0200 Subject: [PATCH 0429/1292] ozone: fix horizontal animation on libnx --- menu/drivers/ozone.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 8fdc2d8c88..cee9c6058e 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -2040,7 +2040,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i /* TODO Reduce sidebar width ? */ -static void ozone_draw_cursor(ozone_handle_t *ozone, video_frame_info_t *video_info, unsigned x_offset, unsigned entry_width, size_t y, float alpha) +static void ozone_draw_cursor(ozone_handle_t *ozone, video_frame_info_t *video_info, int x_offset, unsigned entry_width, size_t y, float alpha) { ozone_color_alpha(ozone->theme_dynamic.selection_border, alpha); ozone_color_alpha(ozone->theme_dynamic.selection, alpha); @@ -2193,7 +2193,7 @@ static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_ size_t i, y, entries_end; float sidebar_offset, bottom_boundary, invert, alpha_anim; unsigned video_info_height, entry_width; - unsigned x_offset = 0; + int x_offset = 0; size_t selection_y = 0; size_t old_selection_y = 0; @@ -2222,7 +2222,7 @@ static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_ x_offset = invert * (alpha_anim * 120); /* right */ } - x_offset += (unsigned) sidebar_offset; + x_offset += (int) sidebar_offset; alpha_uint32 = (uint32_t)(alpha*255.0f); /* Borders layer */ From 52ab4a58a215e83640343007e358fe73896a2d6c Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 14:51:19 +0200 Subject: [PATCH 0430/1292] ozone: fix tabs wrapping --- menu/drivers/ozone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index cee9c6058e..fd77e559f9 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -2660,7 +2660,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act new_selection = (ozone->categories_selection_ptr + 1); - if (new_selection >= ozone->system_tab_end + 2) /* TODO Check against actual tabs count and not just system tabs */ + if (new_selection > ozone->system_tab_end) /* TODO Check against actual tabs count and not just system tabs */ new_selection = 0; if (ozone->categories_selection_ptr != new_selection) @@ -2699,7 +2699,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act new_selection = ozone->categories_selection_ptr - 1; if (new_selection < 0) - new_selection = ozone->system_tab_end + 1; /* TODO Set this to actual tabs count and not just system tabs */ + new_selection = ozone->system_tab_end; /* TODO Set this to actual tabs count and not just system tabs */ if (ozone->categories_selection_ptr != new_selection) { From 624698d2d9b47fde24a0e275cea5a5a04d07fa29 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 16:50:48 +0200 Subject: [PATCH 0431/1292] (Ozone) Add menu color theme --- configuration.c | 3 +++ configuration.h | 1 + gfx/video_driver.c | 1 + gfx/video_driver.h | 1 + intl/msg_hash_ar.h | 14 ++++++++++ intl/msg_hash_chs.h | 14 ++++++++++ intl/msg_hash_cht.h | 14 ++++++++++ intl/msg_hash_de.h | 14 ++++++++++ intl/msg_hash_el.h | 16 ++++++++++++ intl/msg_hash_eo.h | 14 ++++++++++ intl/msg_hash_es.h | 16 ++++++++++++ intl/msg_hash_fr.h | 14 ++++++++++ intl/msg_hash_it.h | 14 ++++++++++ intl/msg_hash_ja.h | 14 ++++++++++ intl/msg_hash_ko.h | 14 ++++++++++ intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_nl.h | 14 ++++++++++ intl/msg_hash_pl.h | 14 ++++++++++ intl/msg_hash_pt_br.h | 16 ++++++++++++ intl/msg_hash_pt_pt.h | 14 ++++++++++ intl/msg_hash_ru.h | 14 ++++++++++ intl/msg_hash_us.h | 16 ++++++++++++ intl/msg_hash_vn.h | 16 ++++++++++++ menu/cbs/menu_cbs_sublabel.c | 4 +++ menu/drivers/ozone.c | 46 ++++++++++++++++++++++++--------- menu/menu_displaylist.c | 4 +++ menu/menu_setting.c | 50 ++++++++++++++++++++++++++++++++++++ msg_hash.h | 6 ++++- 28 files changed, 367 insertions(+), 13 deletions(-) diff --git a/configuration.c b/configuration.c index 1ab4bb23fe..4b391bcd2a 100644 --- a/configuration.c +++ b/configuration.c @@ -1603,6 +1603,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, #endif SETTING_UINT("materialui_menu_color_theme", &settings->uints.menu_materialui_color_theme, true, MATERIALUI_THEME_BLUE, false); SETTING_UINT("menu_shader_pipeline", &settings->uints.menu_xmb_shader_pipeline, true, menu_shader_pipeline, false); +#ifdef HAVE_OZONE + SETTING_UINT("ozone_menu_color_theme", &settings->uints.menu_ozone_color_theme, true, 0, false); +#endif #endif SETTING_UINT("audio_out_rate", &settings->uints.audio_out_rate, true, out_rate, false); SETTING_UINT("custom_viewport_width", &settings->video_viewport_custom.width, false, 0 /* TODO */, false); diff --git a/configuration.h b/configuration.h index ec4dc7dce4..be17dcdbd3 100644 --- a/configuration.h +++ b/configuration.h @@ -407,6 +407,7 @@ typedef struct settings unsigned menu_xmb_theme; unsigned menu_xmb_color_theme; unsigned menu_materialui_color_theme; + unsigned menu_ozone_color_theme; unsigned menu_font_color_red; unsigned menu_font_color_green; unsigned menu_font_color_blue; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 42316c54c7..d7824f6429 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2786,6 +2786,7 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->menu_footer_opacity = settings->floats.menu_footer_opacity; video_info->menu_header_opacity = settings->floats.menu_header_opacity; video_info->materialui_color_theme = settings->uints.menu_materialui_color_theme; + video_info->ozone_color_theme = settings->uints.menu_ozone_color_theme; video_info->menu_shader_pipeline = settings->uints.menu_xmb_shader_pipeline; video_info->xmb_theme = settings->uints.menu_xmb_theme; video_info->xmb_color_theme = settings->uints.menu_xmb_color_theme; diff --git a/gfx/video_driver.h b/gfx/video_driver.h index de028e4900..4c151afbbb 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -445,6 +445,7 @@ typedef struct video_frame_info unsigned xmb_color_theme; unsigned menu_shader_pipeline; unsigned materialui_color_theme; + unsigned ozone_color_theme; unsigned custom_vp_width; unsigned custom_vp_height; unsigned custom_vp_full_width; diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 079ffd8eff..735fc4b348 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3678,3 +3678,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Menu Color Theme") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 23e1fda66c..372b064faa 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -4697,3 +4697,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "菜单颜色主题") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 5ab5d0ffd8..823e6ef5d7 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3454,3 +3454,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "選單顏色主題") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index a89fc2a391..83af071a0f 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3590,3 +3590,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Menü-Farbschema") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index bd005db366..90c17e6578 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -7679,3 +7679,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Χρώμα Θέματος Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 520a48c0e2..e5bd3a414f 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3329,3 +3329,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Menu Color Theme") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 6c034d9292..eee1deba98 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7617,3 +7617,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Tema de color del menú" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 9dbc67b5ae..d4ac5377df 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3488,3 +3488,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Couleur du thème du menu") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index b0f56210f9..22cd3dea9c 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3548,3 +3548,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Colore del tema di Menu ") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index f84b29b3ab..c055952a4e 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3997,3 +3997,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "メニューの色テーマ") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 18a66cbcd7..799a1ee190 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3449,3 +3449,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "메뉴 테마 색상") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 1be69e735f..3e5b127709 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -643,6 +643,8 @@ MSG_HASH(MENU_ENUM_LABEL_MAIN_MENU, "main_menu") MSG_HASH(MENU_ENUM_LABEL_MANAGEMENT, "database_settings") +MSG_HASH(MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME, + "ozone_menu_color_theme") MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME, "materialui_menu_color_theme") MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index d82696f30c..0fa9f7584c 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3335,3 +3335,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "Oke" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Menu Kleur Thema") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index e566952638..76598fcfec 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3751,3 +3751,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Kolor menu") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index a5ef3d98b4..c7dd694772 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7711,3 +7711,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Tema de Cor do Menu" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 823cd0252d..eb15d1330e 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3415,3 +3415,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Tema da cor do menu") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 1f5e2e6710..c597017496 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3618,3 +3618,17 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Цветовая тема меню") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 2dfb3ff14a..7978149985 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7711,3 +7711,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Menu Color Theme" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 0cb6d32bce..0adedcd8be 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3486,3 +3486,19 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, "OK" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Menu Color Theme" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 8953602cbd..214dd3fbe2 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -374,6 +374,7 @@ default_sublabel_macro(action_bind_sublabel_xmb_icon_theme, default_sublabel_macro(action_bind_sublabel_xmb_shadows_enable, MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE) default_sublabel_macro(action_bind_sublabel_xmb_vertical_thumbnails, MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS) default_sublabel_macro(action_bind_sublabel_menu_color_theme, MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME) +default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE) @@ -1075,6 +1076,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity); break; + case MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_menu_color_theme); + break; case MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME: case MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_color_theme); diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index fd77e559f9..a403750cf5 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -422,6 +422,7 @@ ozone_theme_t ozone_theme_dark = { "dark" }; +static unsigned last_color_theme = 0; static ozone_theme_t *ozone_default_theme = &ozone_theme_light; typedef struct ozone_handle @@ -1105,26 +1106,43 @@ static void ozone_draw_text( 1.0); } -static void ozone_set_theme(ozone_handle_t *ozone, ozone_theme_t *theme) +static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) { + ozone_theme_t *theme = ozone_default_theme; + + if (!ozone) + return; + + switch (color_theme) + { + case 1: + theme = &ozone_theme_dark; + break; + case 0: + default: + break; + } + ozone->theme = theme; memcpy(ozone->theme_dynamic.selection_border, ozone->theme->selection_border, sizeof(ozone->theme_dynamic.selection_border)); memcpy(ozone->theme_dynamic.selection, ozone->theme->selection, sizeof(ozone->theme_dynamic.selection)); memcpy(ozone->theme_dynamic.entries_border, ozone->theme->entries_border, sizeof(ozone->theme_dynamic.entries_border)); memcpy(ozone->theme_dynamic.entries_icon, ozone->theme->entries_icon, sizeof(ozone->theme_dynamic.entries_icon)); + + last_color_theme = color_theme; } static void *ozone_init(void **userdata, bool video_is_threaded) { - unsigned width, height; #ifdef HAVE_LIBNX Result rc; ColorSetId theme; #endif - ozone_handle_t *ozone = NULL; - settings_t *settings = config_get_ptr(); - menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); + unsigned width, height, color_theme = 0; + ozone_handle_t *ozone = NULL; + settings_t *settings = config_get_ptr(); + menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) goto error; @@ -1183,19 +1201,19 @@ static void *ozone_init(void **userdata, bool video_is_threaded) rc = setsysInitialize(); if (R_SUCCEEDED(rc)) { + color_theme = (theme == ColorSetId_Dark) ? 1 : 0; setsysGetColorSetId(&theme); - ozone_set_theme(ozone, theme == ColorSetId_Dark ? &ozone_theme_dark : &ozone_theme_light); + ozone_set_color_theme(ozone, color_theme); setsysExit(); } else - { - ozone_set_theme(ozone, ozone_default_theme); - } -#else - ozone_set_theme(ozone, ozone_default_theme); #endif + { + color_theme = settings->uints.menu_ozone_color_theme; + ozone_set_color_theme(ozone, color_theme); + } - ozone->need_compute = false; + ozone->need_compute = false; ozone->animations.scroll_y = 0.0f; /* Assets path */ @@ -2396,10 +2414,14 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) menu_display_ctx_clearcolor_t clearcolor; ozone_handle_t* ozone = (ozone_handle_t*) data; settings_t *settings = config_get_ptr(); + unsigned color_theme = video_info->ozone_color_theme; if (!ozone) return; + if (color_theme != last_color_theme) + ozone_set_color_theme(ozone, color_theme); + ozone->frame_count++; menu_display_set_viewport(video_info->width, video_info->height); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index f7b00d07dc..b4c3d6c3a0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5968,6 +5968,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME, PARSE_ONLY_UINT, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME, + PARSE_ONLY_UINT, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_MATERIALUI_ICONS_ENABLE, PARSE_ONLY_BOOL, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 5361a70302..88f8e3d739 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -683,6 +683,7 @@ static void setting_get_string_representation_uint_materialui_menu_color_theme( } #endif +#ifdef HAVE_XMB static void setting_get_string_representation_uint_xmb_menu_color_theme( rarch_setting_t *setting, char *s, size_t len) @@ -766,6 +767,34 @@ static void setting_get_string_representation_uint_xmb_menu_color_theme( break; } } +#endif + + + +#ifdef HAVE_OZONE +static void setting_get_string_representation_uint_ozone_menu_color_theme( + rarch_setting_t *setting, + char *s, size_t len) +{ + if (!setting) + return; + + switch (*setting->value.target.unsigned_integer) + { + case 1: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK), len); + break; + case 0: + default: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE), len); + break; + } +} +#endif #ifdef HAVE_SHADERPIPELINE static void setting_get_string_representation_uint_xmb_shader_pipeline( @@ -8287,6 +8316,27 @@ static bool setting_append_list( } #endif +#ifdef HAVE_OZONE + if (string_is_equal(settings->arrays.menu_driver, "ozone")) + { + CONFIG_UINT( + list, list_info, + &settings->uints.menu_ozone_color_theme, + MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME, + MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + 0, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_uint_ozone_menu_color_theme; + menu_settings_list_current_add_range(list, list_info, 0, 1, 1, true, true); + } +#endif + CONFIG_BOOL( list, list_info, &settings->bools.menu_show_start_screen, diff --git a/msg_hash.h b/msg_hash.h index 84f87a94b8..7a6f2722bd 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -467,6 +467,9 @@ enum msg_hash_enums MENU_LABEL(MATERIALUI_ICONS_ENABLE), + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME, MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED, MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_FLATUI, @@ -813,7 +816,6 @@ enum msg_hash_enums MENU_LABEL(XMB_LAYOUT), MENU_LABEL(XMB_THEME), MENU_LABEL(XMB_MAIN_MENU_ENABLE_SETTINGS), - MENU_LABEL(XMB_MENU_COLOR_THEME), MENU_LABEL(XMB_SHADOWS_ENABLE), MENU_LABEL(CONTENT_SHOW_REWIND), MENU_LABEL(CONTENT_SHOW_LATENCY), @@ -835,6 +837,8 @@ enum msg_hash_enums MENU_LABEL(TIMEDATE_ENABLE), MENU_LABEL(TIMEDATE_STYLE), MENU_LABEL(BATTERY_LEVEL_ENABLE), + MENU_LABEL(XMB_MENU_COLOR_THEME), + MENU_LABEL(OZONE_MENU_COLOR_THEME), MENU_LABEL(MATERIALUI_MENU_COLOR_THEME), MENU_LABEL(QUICK_MENU_OVERRIDE_OPTIONS), MENU_LABEL(QUICK_MENU_SHOW_TAKE_SCREENSHOT), From 689e612af83ebd92d25f2e813dec993188d09a60 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 17:10:53 +0200 Subject: [PATCH 0432/1292] (Ozone) Add 'Use System Preferred Color Theme' (enabled for Switch) --- config.def.h | 6 ++++++ configuration.c | 1 + configuration.h | 2 ++ intl/msg_hash_ar.h | 4 ++++ intl/msg_hash_chs.h | 4 ++++ intl/msg_hash_cht.h | 4 ++++ intl/msg_hash_de.h | 4 ++++ intl/msg_hash_el.h | 4 ++++ intl/msg_hash_eo.h | 4 ++++ intl/msg_hash_es.h | 4 ++++ intl/msg_hash_fr.h | 4 ++++ intl/msg_hash_it.h | 4 ++++ intl/msg_hash_ja.h | 4 ++++ intl/msg_hash_ko.h | 4 ++++ intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_nl.h | 4 ++++ intl/msg_hash_pl.h | 4 ++++ intl/msg_hash_pt_br.h | 4 ++++ intl/msg_hash_pt_pt.h | 4 ++++ intl/msg_hash_ru.h | 4 ++++ intl/msg_hash_us.h | 4 ++++ intl/msg_hash_vn.h | 4 ++++ menu/cbs/menu_cbs_sublabel.c | 4 ++++ menu/drivers/ozone.c | 33 +++++++++++++++++++-------------- menu/menu_displaylist.c | 4 ++++ menu/menu_setting.c | 22 ++++++++++++++++++++++ msg_hash.h | 1 + 27 files changed, 133 insertions(+), 14 deletions(-) diff --git a/config.def.h b/config.def.h index a656c49fe6..80a10a7f61 100644 --- a/config.def.h +++ b/config.def.h @@ -266,6 +266,12 @@ static const float default_input_overlay_opacity = 0.7f; static bool default_block_config_read = true; +#ifdef HAVE_LIBNX +static bool menu_use_preferred_system_color_theme = true; +#else +static bool menu_use_preferred_system_color_theme = false; +#endif + static bool quick_menu_show_take_screenshot = true; static bool quick_menu_show_save_load_state = true; static bool quick_menu_show_undo_save_load_state = true; diff --git a/configuration.c b/configuration.c index 4b391bcd2a..a9b64bc8cc 100644 --- a/configuration.c +++ b/configuration.c @@ -1387,6 +1387,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("quick_menu_show_save_content_dir_overrides", &settings->bools.quick_menu_show_save_content_dir_overrides, true, quick_menu_show_save_content_dir_overrides, false); SETTING_BOOL("quick_menu_show_information", &settings->bools.quick_menu_show_information, true, quick_menu_show_information, false); SETTING_BOOL("kiosk_mode_enable", &settings->bools.kiosk_mode_enable, true, kiosk_mode_enable, false); + SETTING_BOOL("menu_use_preferred_system_color_theme", &settings->bools.menu_use_preferred_system_color_theme, true, menu_use_preferred_system_color_theme, false); SETTING_BOOL("content_show_settings", &settings->bools.menu_content_show_settings, true, content_show_settings, false); SETTING_BOOL("content_show_favorites", &settings->bools.menu_content_show_favorites, true, content_show_favorites, false); #ifdef HAVE_IMAGEVIEWER diff --git a/configuration.h b/configuration.h index be17dcdbd3..eae90fc0b8 100644 --- a/configuration.h +++ b/configuration.h @@ -175,6 +175,8 @@ typedef struct settings bool menu_content_show_history; bool menu_content_show_add; bool menu_content_show_playlists; + bool menu_use_preferred_system_color_theme; + bool menu_preferred_system_color_theme_set; bool menu_unified_controls; bool quick_menu_show_take_screenshot; bool quick_menu_show_save_load_state; diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 735fc4b348..04343e17f2 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3692,3 +3692,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 372b064faa..ba01b8d8fc 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -4711,3 +4711,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 823e6ef5d7..b7b82260ce 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3468,3 +3468,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 83af071a0f..3c7745ff02 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3604,3 +3604,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 90c17e6578..a028ad0c3c 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -7695,3 +7695,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index e5bd3a414f..efe536b4ae 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3343,3 +3343,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index eee1deba98..3b76bc16d4 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7633,3 +7633,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index d4ac5377df..a5725ffe38 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3502,3 +3502,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 22cd3dea9c..ef28f825b8 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3562,3 +3562,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index c055952a4e..11abb76f1a 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -4011,3 +4011,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 799a1ee190..0ca5f38017 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3463,3 +3463,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 3e5b127709..fdd436f410 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1725,3 +1725,5 @@ MSG_HASH(MENU_ENUM_LABEL_STREAMING_TITLE, "streaming_title") MSG_HASH(MENU_ENUM_LABEL_RESET_TO_DEFAULT_CONFIG, "reset_to_default_config") +MSG_HASH(MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "menu_use_preferred_system_color_theme") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 0fa9f7584c..117ed1478a 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3349,3 +3349,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 76598fcfec..ce60cab76a 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3765,3 +3765,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index c7dd694772..29df5966e6 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7727,3 +7727,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index eb15d1330e..82959c4f57 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3429,3 +3429,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index c597017496..8df4fd9f6e 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3632,3 +3632,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 7978149985..98f684f272 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7727,3 +7727,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 0adedcd8be..7546e1f6a4 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3502,3 +3502,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 214dd3fbe2..c4ff5f6cf5 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -375,6 +375,7 @@ default_sublabel_macro(action_bind_sublabel_xmb_shadows_enable, default_sublabel_macro(action_bind_sublabel_xmb_vertical_thumbnails, MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS) default_sublabel_macro(action_bind_sublabel_menu_color_theme, MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME) +default_sublabel_macro(action_bind_sublabel_menu_use_preferred_system_color_theme, MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE) @@ -1076,6 +1077,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity); break; + case MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_use_preferred_system_color_theme); + break; case MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_menu_color_theme); break; diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index a403750cf5..e25d2606bb 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1135,17 +1135,14 @@ static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) static void *ozone_init(void **userdata, bool video_is_threaded) { -#ifdef HAVE_LIBNX - Result rc; - ColorSetId theme; -#endif + bool fallback_color_theme = false; unsigned width, height, color_theme = 0; ozone_handle_t *ozone = NULL; settings_t *settings = config_get_ptr(); menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) - goto error; + return false; if (!menu_display_init_first_driver(video_is_threaded)) goto error; @@ -1196,18 +1193,26 @@ static void *ozone_init(void **userdata, bool video_is_threaded) menu_display_allocate_white_texture(); /* Theme */ - /* TODO Add theme override in settings */ -#ifdef HAVE_LIBNX - rc = setsysInitialize(); - if (R_SUCCEEDED(rc)) + if (settings->bools.menu_use_preferred_system_color_theme) { - color_theme = (theme == ColorSetId_Dark) ? 1 : 0; - setsysGetColorSetId(&theme); - ozone_set_color_theme(ozone, color_theme); - setsysExit(); +#ifdef HAVE_LIBNX + if (R_SUCCEEDED(setsysInitialize())) + { + ColorSetId theme; + setsysGetColorSetId(&theme); + color_theme = (theme == ColorSetId_Dark) ? 1 : 0; + ozone_set_color_theme(ozone, color_theme); + settings->bools.menu_preferred_system_color_theme_set = true; + setsysExit(); + } + else + fallback_color_theme = true; +#endif } else -#endif + fallback_color_theme = true; + + if (fallback_color_theme) { color_theme = settings->uints.menu_ozone_color_theme; ozone_set_color_theme(ozone, color_theme); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b4c3d6c3a0..e6bf685225 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5988,6 +5988,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY, PARSE_ONLY_FLOAT, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + PARSE_ONLY_BOOL, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_THUMBNAILS, PARSE_ONLY_UINT, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 88f8e3d739..35fcd92743 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -776,9 +776,13 @@ static void setting_get_string_representation_uint_ozone_menu_color_theme( rarch_setting_t *setting, char *s, size_t len) { + settings_t *settings = config_get_ptr(); if (!setting) return; + if (settings->bools.menu_preferred_system_color_theme_set) + strlcpy(s, "System default", len); + switch (*setting->value.target.unsigned_integer) { case 1: @@ -7916,6 +7920,24 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 0, XMB_THEME_LAST-1, 1, true, true); } #endif + if (string_is_equal(settings->arrays.menu_driver, "ozone")) + { + CONFIG_BOOL( + list, list_info, + &settings->bools.menu_use_preferred_system_color_theme, + MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + menu_show_load_core, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + } + CONFIG_BOOL( list, list_info, &settings->bools.menu_show_load_core, diff --git a/msg_hash.h b/msg_hash.h index 7a6f2722bd..0642ca9abe 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -460,6 +460,7 @@ enum msg_hash_enums MENU_LABEL(MENU_WALLPAPER_OPACITY), MENU_LABEL(MENU_FRAMEBUFFER_OPACITY), + MENU_LABEL(MENU_USE_PREFERRED_SYSTEM_COLOR_THEME), MENU_ENUM_LABEL_VALUE_CONFIG, MENU_ENUM_LABEL_VALUE_OVERLAY, From c00d3e809aa7f9ac085906f31aa8c01581426405 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Oct 2018 17:11:43 +0200 Subject: [PATCH 0433/1292] (Ozone) Fix default value for 'Use Preferred System Color Theme' --- menu/menu_setting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 35fcd92743..fd23fdcc53 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -7927,7 +7927,7 @@ static bool setting_append_list( &settings->bools.menu_use_preferred_system_color_theme, MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - menu_show_load_core, + menu_use_preferred_system_color_theme, MENU_ENUM_LABEL_VALUE_OFF, MENU_ENUM_LABEL_VALUE_ON, &group_info, From d7be8c4cf22abfea3f7184c9773ad179e47268fe Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 17:25:13 +0200 Subject: [PATCH 0434/1292] ozone: fix tabs wrapping, again --- menu/drivers/ozone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index e25d2606bb..52366b3214 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -2687,7 +2687,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act new_selection = (ozone->categories_selection_ptr + 1); - if (new_selection > ozone->system_tab_end) /* TODO Check against actual tabs count and not just system tabs */ + if (new_selection >= OZONE_SYSTEM_TAB_LAST) /* TODO Check against actual tabs count and not just system tabs */ new_selection = 0; if (ozone->categories_selection_ptr != new_selection) @@ -2726,7 +2726,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act new_selection = ozone->categories_selection_ptr - 1; if (new_selection < 0) - new_selection = ozone->system_tab_end; /* TODO Set this to actual tabs count and not just system tabs */ + new_selection = OZONE_SYSTEM_TAB_LAST-1; /* TODO Set this to actual tabs count and not just system tabs */ if (ozone->categories_selection_ptr != new_selection) { From 4c5c2170b65a9e84e6d41118212f630875db4228 Mon Sep 17 00:00:00 2001 From: p-sam Date: Tue, 9 Oct 2018 21:39:48 +0000 Subject: [PATCH 0435/1292] libnx: call retroarch_main_quit on exit --- frontend/drivers/platform_switch.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 166640ee21..603f9ba13d 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -62,10 +62,19 @@ static uint32_t *splashData = NULL; static bool psmInitialized = false; +static AppletHookCookie applet_hook_cookie; + #ifdef NXLINK extern bool nxlink_connected; #endif +static void on_applet_hook(AppletHookType hook, void* param) { + if(hook == AppletHookType_OnExitRequest) { + RARCH_LOG("Got AppletHook OnExitRequest, exiting.\n"); + retroarch_main_quit(); + } +} + #endif /* HAVE_LIBNX */ static void get_first_valid_core(char *path_return) @@ -209,6 +218,7 @@ static void frontend_switch_deinit(void *data) #ifndef HAVE_OPENGL gfxExit(); #endif + appletUnlockExit(); #endif } @@ -609,6 +619,8 @@ static void frontend_switch_init(void *data) #ifdef HAVE_LIBNX nifmInitialize(); + appletLockExit(); + appletHook(&applet_hook_cookie, on_applet_hook, NULL); #ifndef HAVE_OPENGL /* Init Resolution before initDefault */ gfxInitResolution(1280, 720); From b56da6919ca704b58dbc233fd9a2b0c171da6f39 Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 19:13:18 +0200 Subject: [PATCH 0436/1292] Convert msg_hash_el.h to LF --- intl/msg_hash_el.h | 15403 ++++++++++++++++++++++--------------------- 1 file changed, 7702 insertions(+), 7701 deletions(-) diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index a028ad0c3c..ede7afaa57 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -1,7701 +1,7702 @@ -MSG_HASH( - MSG_COMPILER, - "Μεταγλωττιστής" - ) -MSG_HASH( - MSG_UNKNOWN_COMPILER, - "Άγνωστος Μεταγλωττιστής" - ) -MSG_HASH( - MSG_NATIVE, - "Ντόπιος" - ) -MSG_HASH( - MSG_DEVICE_DISCONNECTED_FROM_PORT, - "Η συσκευή αποσυνδέθηκε από την θύρα" - ) -MSG_HASH( - MSG_UNKNOWN_NETPLAY_COMMAND_RECEIVED, - "Λήφθηκε άγνωστη εντολή netplay" - ) -MSG_HASH( - MSG_FILE_ALREADY_EXISTS_SAVING_TO_BACKUP_BUFFER, - "Το αρχείο υπάρχει ήδη. Αποθήκευση σε εφεδρική ενδιάμεση μνήμη." - ) -MSG_HASH( - MSG_GOT_CONNECTION_FROM, - "Λήφθηκε σύνδεση από: \"%s\"" - ) -MSG_HASH( - MSG_GOT_CONNECTION_FROM_NAME, - "Λήφθηκε σύνδεση από: \"%s (%s)\"" - ) -MSG_HASH( - MSG_PUBLIC_ADDRESS, - "Δημόσια διεύθυνση" - ) -MSG_HASH( - MSG_NO_ARGUMENTS_SUPPLIED_AND_NO_MENU_BUILTIN, - "Δεν παρασχέθηκε διαφωνία και δεν υπάρχει ενσωματωμένο μενού, εμφάνιση βοήθειας..." - ) -MSG_HASH( - MSG_SETTING_DISK_IN_TRAY, - "Τοποθέτηση δίσκου στην μονάδα δίσκου" - ) -MSG_HASH( - MSG_WAITING_FOR_CLIENT, - "Αναμονή για πελάτη ..." - ) -MSG_HASH( - MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME, - "Αποσυνδεθήκατε από το παιχνίδι" - ) -MSG_HASH( - MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, - "Έχετε συνδεθεί ως παίκτης %u" - ) -MSG_HASH( - MSG_NETPLAY_YOU_HAVE_JOINED_WITH_INPUT_DEVICES_S, - "Έχετε συνδεθεί με συσκευές εισόδου %.*s" - ) -MSG_HASH( - MSG_NETPLAY_PLAYER_S_LEFT, - "Ο παίκτης %.*s αποσυνδέθηκε από το παιχνίδι" - ) -MSG_HASH( - MSG_NETPLAY_S_HAS_JOINED_AS_PLAYER_N, - "%.*s συνδέθηκε ως παίκτης %u" - ) -MSG_HASH( - MSG_NETPLAY_S_HAS_JOINED_WITH_INPUT_DEVICES_S, - "%.*s συνδέθηκε με συσκευές εισόδου %.*s" - ) -MSG_HASH( - MSG_NETPLAY_NOT_RETROARCH, - "Η προσπάθεια σύνδεσης netplay απέτυχε επειδή ο συμπέκτης δεν χρησιμοποιεί το RetroArch ή χρησιμοποιεί πιο παλιά έκδοση." - ) -MSG_HASH( - MSG_NETPLAY_OUT_OF_DATE, - "Ο συμπαίκτης χρησιμοποιεί πιο παλιά έκδοση RetroArch. Αδύνατη η σύνδεση." - ) -MSG_HASH( - MSG_NETPLAY_DIFFERENT_VERSIONS, - "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Ο συμπαίκτης netplay χρησιμοποιεί διαφορετική έκδοση του RetroArch. Εάν προκύψουν προβλήματα χρησιμοποιήστε την ίδια έκδοση." - ) -MSG_HASH( - MSG_NETPLAY_DIFFERENT_CORES, - "Ο συμπαίκτης netplay χρησιμοποιεί διαφορειτκό πυρήνα. Αδύνατη η σύνδεση." - ) -MSG_HASH( - MSG_NETPLAY_DIFFERENT_CORE_VERSIONS, - "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Ο συμπαίκτης netplay χρησιμοποιεί διαφορετική έκδοση του πυρήνα. Εάν προκύψουν προβλήματα χρησιμοποιήστε την ίδια έκδοση." - ) -MSG_HASH( - MSG_NETPLAY_ENDIAN_DEPENDENT, - "Αυτός ο πυρήνας δεν υποστηρίζει σύνδεση διαφορετικών πλατφόρμων για netplay ανάμεσα σε αυτά τα συστήματα" - ) -MSG_HASH( - MSG_NETPLAY_PLATFORM_DEPENDENT, - "Αυτός ο πυρήνας δεν υποστηρίζει σύνδεση διαφορετικών πλατφόρμων για netplay" - ) -MSG_HASH( - MSG_NETPLAY_ENTER_PASSWORD, - "Εισάγετε κωδικό διακομιστή netplay:" - ) -MSG_HASH( - MSG_NETPLAY_INCORRECT_PASSWORD, - "Λάθος κωδικός" - ) -MSG_HASH( - MSG_NETPLAY_SERVER_NAMED_HANGUP, - "\"%s\" αποσυνδέθηκε" - ) -MSG_HASH( - MSG_NETPLAY_SERVER_HANGUP, - "Ένας πελάτης netplay έχει αποσυνδεθεί" - ) -MSG_HASH( - MSG_NETPLAY_CLIENT_HANGUP, - "Αποσύνδεση netplay" - ) -MSG_HASH( - MSG_NETPLAY_CANNOT_PLAY_UNPRIVILEGED, - "Δεν έχετε άδεια για να παίξετε" - ) -MSG_HASH( - MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS, - "Δεν υπάρχουν κενές θέσεις παικτών" - ) -MSG_HASH( - MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE, - "Οι συσκευές εισόδου που ζητήθηκαν δεν είναι διαθέσιμες" - ) -MSG_HASH( - MSG_NETPLAY_CANNOT_PLAY, - "Δεν μπορεί να γίνει αλλαγή σε κατάσταση παιχνιδιού" - ) -MSG_HASH( - MSG_NETPLAY_PEER_PAUSED, - "Ο συμπαίκτης netplay \"%s\" έκανε παύση" - ) -MSG_HASH( - MSG_NETPLAY_CHANGED_NICK, - "Το ψευδώνυμο σας άλλαξε σε \"%s\"" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, - "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SETTINGS, - "Προσαρμόζει τις εμφανισιακές ρυθμίσεις της οθόνης του μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, - "Σκληρός συγχρονισμός επεξεργαστή και κάρτας γραφικών. Μειώνει την καθυστέρηση με τίμημα την επίδοση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_THREADED, - "Βελτιώνει την επίδοση με τίμημα την καθυστέρηση και περισσότερα κολλήματα στο βίντεο. Χρησιμοποιείστε μόνο εάν δεν μπορείτε να αποκτήσετε πλήρη ταχύτητα με άλλον τρόπο." - ) -MSG_HASH( - MSG_AUDIO_VOLUME, - "Ένταση ήχου" - ) -MSG_HASH( - MSG_AUTODETECT, - "Αυτόματη ανίχνευση" - ) -MSG_HASH( - MSG_AUTOLOADING_SAVESTATE_FROM, - "Αυτόματη φόρτωση κατάστασης αποθήκευσης από" - ) -MSG_HASH( - MSG_CAPABILITIES, - "Ικανότητες" - ) -MSG_HASH( - MSG_CONNECTING_TO_NETPLAY_HOST, - "Σύνδεση με εξυπηρετητή netplay" - ) -MSG_HASH( - MSG_CONNECTING_TO_PORT, - "Σύνδεση στην θύρα" - ) -MSG_HASH( - MSG_CONNECTION_SLOT, - "Θέση σύνδεσης" - ) -MSG_HASH( - MSG_SORRY_UNIMPLEMENTED_CORES_DONT_DEMAND_CONTENT_NETPLAY, - "Συγγνώμη, μη εφαρμοσμένο: πυρήνες που δεν απαιτούν περιεχόμενο δεν μπορούν να συμμετέχουν στο netplay." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_PASSWORD, - "Κωδικός" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_SETTINGS, - "Επιτεύγματα Λογαριασμού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME, - "Όνομα Χρήστη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST, - "Λογαριασμοί" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST_END, - "Accounts List Endpoint" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_RETRO_ACHIEVEMENTS, - "RetroAchievements" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST, - "Επιτεύγματα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_PAUSE, - "Παύση Σκληροπυρηνικής Λειτουργίας Επιτευγμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_RESUME, - "Συνέχιση Σκληροπυρηνικής Λειτουργίας Επιτευγμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE, - "Επιτεύγματα (Σκληροπυρηνικά)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST, - "Σάρωση Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONFIGURATIONS_LIST, - "Διαμορφώσεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_TAB, - "Εισαγωγή περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, - "Δωμάτια Netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ASK_ARCHIVE, - "Ερώτηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY, - "Εργαλεία" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_BLOCK_FRAMES, - "Φραγή Καρέ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_DEVICE, - "Συσκευή Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_DRIVER, - "Οδηγός Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_DSP_PLUGIN, - "Πρόσθετο Ήχου DSP" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE, - "Ενεργοποίηση Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR, - "Φίλτρα Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TURBO_DEADZONE_LIST, - "Turbo/Νεκρή Ζώνη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_LATENCY, - "Καθυστέρηση Ήχου (ms)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW, - "Μέγιστη Χρονική Διαστρέβλωση Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_MUTE, - "Σίγαση Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, - "Συχνότητα Εξόδου Ήχου (Hz)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_RATE_CONTROL_DELTA, - "Δυναμικός Έλεγχος Βαθμού Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER, - "Οδηγός Επαναδειγματολήπτη Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS, - "Ήχος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_SYNC, - "Συγχρονισμός Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME, - "Ένταση Ήχου (dB)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_EXCLUSIVE_MODE, - "Αποκλειστική Λειτουργία WASAPI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_FLOAT_FORMAT, - "Ασταθής Μορφή WASAPI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_SH_BUFFER_LENGTH, - "Μήκος Κοινόχρηστης Ενδιάμεσης Μνήμης WASAPI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, - "Διάστημα Αυτόματης Αποθήκευσης SaveRAM" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, - "Φόρτωση Αρχείων Παράκαμψης Αυτόματα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUTO_REMAPS_ENABLE, - "Φόρτωση Αρχείων Αναδιοργάνωσης Πλήτρκων Αυτόματα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE, - "Φόρτωση Προεπιλογών Σκιάσεων Αυτόματα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, - "Πίσω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM, - "Επιβεβαίωση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO, - "Πληροφορίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT, - "Έξοδος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN, - "Μετακίνηση Προς Τα Κάτω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP, - "Μετακίνηση Προς Τα Πάνω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START, - "Εκκίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD, - "Ενεργοποίηση/Απενεργοποίηση Πληκτρολογίου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU, - "Ενεργοποίηση/Απενεργοποίηση Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS, - "Βασικός χειρισμός μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_CONFIRM, - "Επιβεβαίωση/ΟΚ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_INFO, - "Πληροφορίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_QUIT, - "Έξοδος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_SCROLL_UP, - "Μετακίνηση Προς Τα Πάνω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_START, - "Προεπιλογές" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_KEYBOARD, - "Ενεργοποίηση/Απενεργοποίηση Πληκτρολογίου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_MENU, - "Ενεργοποίηση/Απενεργοποίηση Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BLOCK_SRAM_OVERWRITE, - "Απενεργοποίηση αντικατάστασης SaveRAM κατά την φάση φόρτωσης κατάστασης αποθήκευσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BLUETOOTH_ENABLE, - "Ενεργοποίηση Bluetooth" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BUILDBOT_ASSETS_URL, - "Σύνδεσμος Εργαλείων του Buildbot" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, - "Κρυφή Μνήμη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CAMERA_ALLOW, - "Επίτρεψη Κάμερας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER, - "Οδηγός Κάμερας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT, - "Απάτη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_CHANGES, - "Εφαρμογή Αλλαγών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_START_SEARCH, - "Έναρξη Αναζήτησης Για Νέους Κωδικούς Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_CONTINUE_SEARCH, - "Συνέχιση Αναζήτησης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH, - "Αρχεία Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_FILE, - "Αρχείο Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD, - "Φόρτωση Αρχείου Απάτης (Αντικατάσταση)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD_APPEND, - "Φόρτωση Αρχείου Απάτης (Προσάρτηση)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS, - "Αποθήκευση Αρχείου Απάτης Ως" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_NUM_PASSES, - "Φορές Περάσματος Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_DESCRIPTION, - "Περιγραφή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_HARDCORE_MODE_ENABLE, - "Σκληροπυρηνική Λειτουργία" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_LEADERBOARDS_ENABLE, - "Κατατάξεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_BADGES_ENABLE, - "Εμβλήματα Επιτευγμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ACHIEVEMENTS, - "Κλειδωμένα Επιτεύγματα:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY, - "Κλειδωμένο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_SETTINGS, - "RetroAchievements" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_TEST_UNOFFICIAL, - "Δοκιμή Ανεπίσημων Επιτευγμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS, - "Ξεκλειδωμένα Επιτεύγματα:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY, - "Ξεκλείδωτο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, - "Σκληροπυρηνικό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_VERBOSE_ENABLE, - "Βερμπαλιστική Λειτουργία" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_AUTO_SCREENSHOT, - "Αυτόματο Στιγμιότυπο Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT, - "Κλείσιμο Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONFIG, - "Διαμόρφωση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONFIGURATIONS, - "Φόρτωση Διαμορφώσεων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS, - "Διαμόρφωση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT, - "Απόθηκευση Διαμόρφωσης στην Έξοδο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST, - "Συλλογές" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY, - "Βάσεις Δεδομένων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_DIR, - "Περιεχόμενο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, - "Μέγεθος Λίστας Ιστορικού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, - "Επίτρεψη αφαίρεσης καταχωρήσεων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, - "Γρήγορο Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIR, - "Λήψεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY, - "Λήψεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS, - "Απάτες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_COUNTERS, - "Μετρητές Πυρήνων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_ENABLE, - "Εμφάνιση ονόματος πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFORMATION, - "Πληροφορίες πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS, - "Δημιουργοί" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES, - "Κατηγορίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_LABEL, - "Επιγραφή πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_NAME, - "Όνομα πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE, - "Firmware(s)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES, - "Άδεια(ες)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS, - "Άδειες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS, - "Υποστηριζόμενες επεκτάσεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_MANUFACTURER, - "Κατασκευαστής συστήματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_NAME, - "Όνομα συστήματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS, - "Χειρισμοί" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_LIST, - "Φόρτωση Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_OPTIONS, - "Επιλογές" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_SETTINGS, - "Πυρήνας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_SET_SUPPORTS_NO_CONTENT_ENABLE, - "Αυτόματη Έναρξη Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, - "Αυτόματη εξαγωγή ληφθέντος συμπιεσμένου αρχείου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_UPDATER_BUILDBOT_URL, - "Σύνδεσμος Buildbot Πυρήνων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST, - "Ενημέρωση Πυρήνων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_UPDATER_SETTINGS, - "Ενημερωτής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CPU_ARCHITECTURE, - "Αρχιτεκτονική Επεξεργαστή:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CPU_CORES, - "Πυρήνες Επεξεργαστή:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY, - "Δρομείς" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CURSOR_MANAGER, - "Διαχειριστής Δρομέα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CUSTOM_RATIO, - "Προτιμώμενη Αναλογία" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER, - "Διαχειριστής Βάσης Δεδομένων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_SELECTION, - "Επιλογή Βάσης Δεδομένων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DELETE_ENTRY, - "Κατάργηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FAVORITES, - "Ευρετήριο έναρξης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, - "<Ευρετήριο περιεχομένων>" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, - "<Προκαθορισμένο>" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, - "<Κανένα>" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, - "Το ευρετήριο δεν βρέθηκε." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, - "Ευρετήρια" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, - "Disk Cycle Tray Status" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, - "Disk Image Append" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISK_INDEX, - "Disk Index" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, - "Disk Control" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DONT_CARE, - "Don't care" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST, - "Λήψεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE, - "Λήψη Πυρήνα..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT, - "Λήψη Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_ENABLE, - "DPI Override Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE, - "DPI Override" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS, - "Οδηγοί" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN, - "Φόρτωση Dummy στο Κλείσιμο Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHECK_FOR_MISSING_FIRMWARE, - "Έλεγχος για απών Firmware Πριν την Φόρτωση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, - "Δυναμικό Φόντο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, - "Δυναμικά Φόντα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_ENABLE, - "Ενεργοποίηση Επιτευγμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, - "Χρώμα καταχώρησης μενού όταν το ποντίκι βρίσκεται από πάνω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, - "Χρώμα καταχώρησης μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FALSE, - "Ψευδές" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, - "Μέγιστη Ταχύτητα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, - "Αγαπημένα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FPS_SHOW, - "Προβολή Ρυθμού Καρέ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, - "Περιορισμός Μέγιστης Ταχύτητας Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VRR_RUNLOOP_ENABLE, - "Συγχρονισμός με τον Ακριβή Ρυθμό Καρέ του Περιεχομένου (G-Sync, FreeSync)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS, - "Περιορισμός Καρέ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, - "Frontend Counters" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS, - "Φόρτωση Επιλογών Πυρήνα Βάση Συγκεκριμένου Περιεχομένου Αυτόματα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE, - "Δημιουργία αρχείου επιλογών παιχνιδιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE, - "Αποθήκευση αρχείου επιλογών παιχνιδιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP, - "Βοήθεια" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING, - "Αντιμετώπιση Προβλημάτων Ήχου/Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD, - "Αλλαγή Επικαλύμματος Εικονικού Χειριστηρίου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP_CONTROLS, - "Βασικός Χειρισμός Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP_LIST, - "Βοήθεια" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP_LOADING_CONTENT, - "Φόρτωση Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT, - "Σάρωση Για Περιεχόμενο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HELP_WHAT_IS_A_CORE, - "Τι Είναι Ο Πυρήνας;" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HISTORY_LIST_ENABLE, - "Ενεργοποίηση Λίστας Ιστορικού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HISTORY_TAB, - "Ιστορικό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU, - "Οριζόντιο Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_IMAGES_TAB, - "Εικόνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INFORMATION, - "Πληροφορίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INFORMATION_LIST, - "Πληροφορίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE, - "Τύπος Αναλογικού Σε Ψηφιακό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU, - "Όλοι Οι Χρήστες Χειρίζονται Το Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X, - "Αριστερό Αναλογικό X" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_MINUS, - "Αριστερό Αναλογικό X- (αριστερά)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_PLUS, - "Αριστερό Αναλογικό X+ (δεξιά)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y, - "Αριστερό Αναλογικό Y" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_MINUS, - "Αριστερό Αναλογικό Y- (πάνω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_PLUS, - "Αριστερό Αναλογικό Y+ (κάτω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X, - "Δεξί Αναλογικό X" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_MINUS, - "Δεξί Αναλογικό X- (αριστερά)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_PLUS, - "Δεξί Αναλογικό X+ (δεξιά)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y, - "Δεξί Αναλογικό Y" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_MINUS, - "Δεξί Αναλογικό Y- (πάνω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_PLUS, - "Δεξί Αναλογικό Y+ (κάτω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_TRIGGER, - "Σκανδάλη Όπλου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_RELOAD, - "Γέμισμα Όπλου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_A, - "Όπλο Aux A" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_B, - "Όπλο Aux B" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_C, - "Όπλο Aux C" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_START, - "Όπλο Start" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_SELECT, - "Όπλο Select" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_UP, - "Όπλο D-pad Πάνω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_DOWN, - "Όπλο D-pad Κάτω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_LEFT, - "Όπλο D-pad Αριστερά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_RIGHT, - "Όπλο D-pad Δεξιά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, - "Ενεργοποίηση Αυτόματης Διαμόρφωσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, - "Νεκρή Ζώνη Αναλογικού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, - "Εναλλαγή Κουμπιών Επιβεβαίωσης & Ακύρωσης Στο Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, - "Σύνδεση Όλων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL, - "Επαναφορά Συνδέσεων Όλων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT, - "Λήξη Χρόνου Σύνδεσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_BIND_HOLD, - "Κράτημα Σύνδεσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_HIDE_UNBOUND, - "Hide Unbound Core Input Descriptors" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_LABEL_SHOW, - "Display Input Descriptor Labels" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX, - "Κατάλογος Συσκευών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE, - "Τύπος Συσκευής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX, - "Κατάλογος Ποντικιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DRIVER, - "Οδηγός Εισαγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DUTY_CYCLE, - "Duty Cycle" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_BINDS, - "Σύνδεση Πλήκτρων Εντολών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_ICADE_ENABLE, - "Keyboard Gamepad Mapping Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_A, - "Κουμπί A (δεξιά)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B, - "Κουμπί B (κάτω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_DOWN, - "D-pad κάτω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L2, - "Κουμπί L2 (σκανδάλι)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L3, - "Κουμπί L3 (αντίχειρας)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L, - "Κουμπί L (πίσω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_LEFT, - "D-pad αριστερό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R2, - "Κουμπί R2 (σκανδάλι)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R3, - "Κουμπί R3 (αντίχειρας)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R, - "Κουμπί R (πίσω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_RIGHT, - "D-pad δεξί" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_SELECT, - "Κουμπί Select" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_START, - "Κουμπί Start" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_UP, - "D-pad πάνω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_X, - "Κουμπί X (πάνω)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_Y, - "Κουμπί Y (αριστερό)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_KEY, - "(Κουμπί: %s)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_LEFT, - "Ποντίκι 1" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_RIGHT, - "Ποντίκι 2" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_MIDDLE, - "Ποντίκι 3" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON4, - "Ποντίκι 4" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON5, - "Ποντίκι 5" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_UP, - "Ροδέλα Πάνω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_DOWN, - "Ροδέλα Κάτω" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_UP, - "Ροδέλα Αριστερά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_DOWN, - "Ροδέλα Δεξιά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE, - "Keyboard Gamepad Mapping Type" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS, - "Μέγιστοι Χρήστες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, - "Συνδιασμός Πλήκτρων Χειριστηρίου για Άνοιγμα Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, - "Κατάλογος απάτης -" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_PLUS, - "Κατάλογος απάτης +" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_TOGGLE, - "Απάτες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_EJECT_TOGGLE, - "Εξαγωγή δίσκου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, - "Επόμενος δίσκος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, - "Προηγούμενος δίσκος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, - "Ενεργοποίηση πλήκτρων εντολών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_HOLD_KEY, - "Παύση γρήγορης κίνησης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_KEY, - "Γρήγορη κίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, - "Frameadvance" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, - "Πλήρης οθόνη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, - "Κλείδωμα ποντικιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, - "Εστίαση παιχνιδιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, - "Μενού επιφάνειας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, - "Φόρτωση κατάστασης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, - "Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_BSV_RECORD_TOGGLE, - "Input replay movie record toggle" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, - "Σίγαση Ήχου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, - "Εναλλαγή κατάστασης παιχνιδιού/θεατή Netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, - "Πληκτρολόγιο οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, - "Επόμενο επικάλλυμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, - "Παύση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, - "Έξοδος από το RetroArch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, - "Επαναφορά παιχνιδιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, - "Επιστροφή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_DETAILS, - "Λεπτομέρειες Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_SEARCH, - "Start or Continue Cheat Search" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, - "Αποθήκευση κατάστασης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, - "Λήψη Στιγμιότυπου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, - "Επόμενη σκίαση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, - "Προηγούμενη σκίαση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_HOLD_KEY, - "Παύση αργής κίνησης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_KEY, - "Αργή κίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, - "Θέση κατάστασης αποθήκευσης -" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, - "Θέση κατάστασης αποθήκευσης +" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, - "Ένταση -" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, - "Ένταση +" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, - "Εμφάνιση Επικαλύμματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, - "Απόκρυψη Επικαλύμματος Στο Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, - "Εμφάνιση Εισαγωγών Στο Επικάλλυμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, - "Εμφάνιση Θύρας Εισαγωγών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, - "Τύπος Συμπεριφοράς Συγκέντρωσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, - "Νωρίς" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, - "Αργά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, - "Φυσιολογικά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_PREFER_FRONT_TOUCH, - "Prefer Front Touch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, - "Input Remapping" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, - "Remap Binds Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG, - "Αποθήκευση Αυτόματης Διαμόρφωσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS, - "Εισαγωγή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE, - "Ενεργοποίηση Μικρού Πληκτρολογίου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_TOUCH_ENABLE, - "Ενεργοποίηση Αφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_TURBO_ENABLE, - "Ενεργοποίηση Turbo" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, - "Turbo Period" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS, - "Σύνδεση Πλήκτρων Εισόδου Χρήστη %u" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LATENCY_SETTINGS, - "Καθυστέρηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INTERNAL_STORAGE_STATUS, - "Internal storage status" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, - "Input Autoconfig" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_JOYPAD_DRIVER, - "Οδηγός Joypad" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LAKKA_SERVICES, - "Υπηρεσίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_CHINESE_SIMPLIFIED, - "Chinese (Simplified)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_CHINESE_TRADITIONAL, - "Chinese (Traditional)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_DUTCH, - "Dutch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_ENGLISH, - "English" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_ESPERANTO, - "Esperanto" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_FRENCH, - "French" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_GERMAN, - "German" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_ITALIAN, - "Italian" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_JAPANESE, - "Japanese" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_KOREAN, - "Korean" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_POLISH, - "Polish" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_BRAZIL, - "Portuguese (Brazil)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_PORTUGAL, - "Portuguese (Portugal)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_RUSSIAN, - "Russian" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_SPANISH, - "Spanish" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, - "Vietnamese" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_ARABIC, - "Arabic" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_GREEK, - "Ελληνικά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, - "Αριστερό Αναλογικό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, - "Πυρήνας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, - "Πληροφορίες Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LIBRETRO_LOG_LEVEL, - "Core Logging Level" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LINEAR, - "Γραμμικός" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOAD_ARCHIVE, - "Φόρτωση Αρχείου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY, - "Φόρτωση Πρόσφατου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST, - "Φόρτωση Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOAD_STATE, - "Φόρτωση Κατάστασης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOCATION_ALLOW, - "Επίτρεψη Τοποθεσίας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER, - "Οδηγός Τοποθεσίας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOGGING_SETTINGS, - "Αρχείο Καταγραφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LOG_VERBOSITY, - "Logging Verbosity" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MAIN_MENU, - "Κεντρικό Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MANAGEMENT, - "Ρυθμίσεις Βάσης Δεδομένων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME, - "Χρώμα Θέματος Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE, - "Μπλε" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE_GREY, - "Μπλε Γκρι" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_DARK_BLUE, - "Σκούρο Μπλε" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_GREEN, - "Πράσινο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_NVIDIA_SHIELD, - "Shield" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED, - "Κόκκινο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW, - "Κίτρινο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_FOOTER_OPACITY, - "Footer Opacity" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY, - "Header Opacity" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_DRIVER, - "Οδηγός Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE, - "Throttle Menu Framerate" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, - "Ρυθμίσεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, - "Menu Linear Filter" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, - "Horizontal Animation" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, - "Εμφάνιση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, - "Φόντο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY, - "Background opacity" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MISSING, - "Λείπει" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MORE, - "..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MOUSE_ENABLE, - "Υποστήριξη Ποντικιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MULTIMEDIA_SETTINGS, - "Πολυμέσα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MUSIC_TAB, - "Μουσική" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, - "Φιλτράρισμα άγνωστων επεκτάσεων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NAVIGATION_WRAPAROUND, - "Navigation Wrap-Around" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NEAREST, - "Κοντινότερο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY, - "Netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_ALLOW_SLAVES, - "Allow Slave-Mode Clients" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, - "Netplay Check Frames" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, - "Input Latency Frames" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, - "Input Latency Frames Range" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, - "Netplay Delay Frames" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, - "Disconnect from netplay host" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, - "Ενεργοποίηση Netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, - "Σύνδεση σε οικοδεσπότη netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, - "Έναρξη netplay ως οικοδεσπότης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, - "Λήξη netplay ως οικοδεσπότης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, - "Διέυθυνση Διακομιστή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, - "Σάρωση τοπικού δικτύου Scan local network" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, - "Netplay Client Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_NICKNAME, - "Όνομα Χρήστη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, - "Κωδικός Διακομιστή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_PUBLIC_ANNOUNCE, - "Δημόσια Ανακοίνωση Netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_REQUEST_DEVICE_I, - "Request Device %u" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_REQUIRE_SLAVES, - "Disallow Non-Slave-Mode Clients" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, - "Ρυθμίσεις Netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG, - "Analog Input Sharing" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_MAX, - "Μέγιστο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_AVERAGE, - "Μέσος Όρος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL, - "Digital Input Sharing" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_OR, - "Κοινοποίηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_XOR, - "Grapple" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_VOTE, - "Ψήφος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NONE, - "Κανείς" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NO_PREFERENCE, - "Καμία προτίμηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_START_AS_SPECTATOR, - "Netplay Spectator Mode" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_STATELESS_MODE, - "Netplay Stateless Mode" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATE_PASSWORD, - "Server Spectate-Only Password" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATOR_MODE_ENABLE, - "Netplay Spectator Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_TCP_UDP_PORT, - "Netplay TCP Port" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_NAT_TRAVERSAL, - "Netplay NAT Traversal" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETWORK_CMD_ENABLE, - "Network Commands" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETWORK_CMD_PORT, - "Network Command Port" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION, - "Πληροφορίες Δικτύου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_ENABLE, - "Χειριστήριο Δικτύου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_PORT, - "Network Remote Base Port" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETWORK_SETTINGS, - "Δίκτυο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO, - "Όχι" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NONE, - "Τίποτα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE, - "Μ/Δ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY, - "Δεν υπάρχουν επιτεύγματα προς προβολή." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_CORE, - "Κανένας Πυρήνας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE, - "Δεν υπάρχουν διαθέσιμοι πυρήνες." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_CORE_INFORMATION_AVAILABLE, - "Δεν υπάρχουν διαθέσιμες πληροφορίες πυρήνα." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE, - "Δεν υπάρχουν διαθέσιμες επιλογές πυρήνα." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY, - "Δεν υπάρχουν καταχωρήσεις προς εμφάνιση." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_HISTORY_AVAILABLE, - "Δεν υπάρχει διαθέσιμο ιστορικό." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE, - "Δεν υπάρχουν διαθέσιμες πληροφορίες." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_ITEMS, - "Δεν υπάρχουν αντικείμενα." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_NETPLAY_HOSTS_FOUND, - "Δεν βρέθηκαν εξυπηρετητές netplay." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_NETWORKS_FOUND, - "Δεν βρέθηκαν δίκτυα." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS, - "No performance counters." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_PLAYLISTS, - "Δεν βρέθηκαν λίστες αναπαραγωγής." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, - "Δεν υπάρχουν διαθέσιμες καταχωρήσεις στην λίστα αναπαραγωγής." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, - "Δεν βρέθηκαν ρυθμίσεις." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, - "Δεν βρέθηκαν παράμετροι σκίασης." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OFF, - "OFF" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ON, - "ON" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ONLINE, - "Online" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER, - "Διαδικτυακός Ενημερωτής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, - "Οθόνη Απεικόνισης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, - "Επικάλλυμα Οθόνης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS, - "Προσαρμογή Προσόψεων και Χειρισμών Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, - "Ειδοποιήσεις Οθόνης Απεικόνισης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, - "Προσαρμόστε τις Ειδοποιήσεις Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, - "Περιήγηση Αρχείου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OPTIONAL, - "Προεραιτικό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OVERLAY, - "Επικάλλυμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, - "Αυτόματη Φόρτωση Προτιμώμενου Επικαλύμματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, - "Επικάλλυμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, - "Διαφάνεια Επικαλύμματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OVERLAY_PRESET, - "Προκαθορισμένο Επικάλλυμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE, - "Κλίμακα Επικαλύμματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, - "Επικάλλυμα Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, - "Χρήση Λειτουργίας PAL60" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, - "Προηγούμενο ευρετήριο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO, - "Παύση όταν ενεργοποιείται το μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PAUSE_NONACTIVE, - "Μην εκτελείτε στο παρασκήνιο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PERFCNT_ENABLE, - "Performance Counters" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB, - "Λίστες Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, - "Λίστα Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, - "Λίστες Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, - "Υποστήριξη Αφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PORT, - "Θύρα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PRESENT, - "Present" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, - "Ιδιωτικότητα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, - "MIDI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, - "Έξοδος από RetroArch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, - "Analog supported" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_BBFC_RATING, - "BBFC Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CERO_RATING, - "CERO Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_COOP, - "Co-op supported" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CRC32, - "CRC32" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION, - "Description" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DEVELOPER, - "Developer" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_ISSUE, - "Edge Magazine Issue" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_RATING, - "Edge Magazine Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_REVIEW, - "Edge Magazine Review" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ELSPA_RATING, - "ELSPA Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ENHANCEMENT_HW, - "Enhancement Hardware" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ESRB_RATING, - "ESRB Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FAMITSU_MAGAZINE_RATING, - "Famitsu Magazine Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FRANCHISE, - "Franchise" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE, - "Genre" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_MD5, - "MD5" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME, - "Όνομα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ORIGIN, - "Origin" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PEGI_RATING, - "PEGI Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PUBLISHER, - "Publisher" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_MONTH, - "Releasedate Month" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_YEAR, - "Releasedate Year" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RUMBLE, - "Rumble supported" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL, - "Serial" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SHA1, - "SHA1" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, - "Έναρξη Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, - "TGDB Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REBOOT, - "Επανεκκίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, - "Recording Config" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, - "Recording Output" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORDING_SETTINGS, - "Εγγραφή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, - "Custom Record Config" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, - "Custom Stream Config" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, - "Οδηγός Εγγραφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIDI_DRIVER, - "Οδηγός MIDI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORD_ENABLE, - "Ενεργοποίηση Εγγραφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORD_PATH, - "Αποθήκευση Εγγραφής Ως..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, - "Αποθήκευση Εγγραφών στο Ευρετήριο Εξαγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE, - "Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE_LOAD, - "Load Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CORE, - "Save Core Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CONTENT_DIR, - "Save Content Directory Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_GAME, - "Save Game Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CORE, - "Delete Core Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_GAME, - "Delete Game Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CONTENT_DIR, - "Delete Game Content Directory Remap File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REQUIRED, - "Απαραίτητο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RESTART_CONTENT, - "Επανεκκίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RESTART_RETROARCH, - "Επανεκκίνηση RetroArch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RESUME, - "Συνέχιση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RESUME_CONTENT, - "Συνέχιση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RETROKEYBOARD, - "RetroKeyboard" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RETROPAD, - "RetroPad" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RETROPAD_WITH_ANALOG, - "RetroPad με Αναλογικό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, - "Επιτεύγματα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, - "Ενεργοποίηση Επιστροφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_TOGGLE, - "Εφαρμογή Μετά Την Ενεργοποίηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_LOAD, - "Αυτόματη Εφαρμογή Απατών Κατά την Φόρτωση Παιχνιδιού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, - "Βαθμός Λεπτομέρειας Επιστροφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE, - "Μέγεθος Ενδιάμεσης Μνήμης Επιστροφής (MB)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE_STEP, - "Βήμα Μεγέθους Ενδιάμεσης Μνήμης Επιστροφής (MB)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, - "Επιστροφή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SETTINGS, - "Ρυθμίσεις Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_DETAILS_SETTINGS, - "Λεπτομέρειες Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_SETTINGS, - "Έναρξη ή Συνέχιση Αναζήτησης Απάτης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, - "Περιηγητής Αρχείων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, - "Config" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, - "Εμφάνιση Αρχικής Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, - "Δεξί Αναλογικό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, - "Προσθήκη στα Αγαπημένα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, - "Προσθήκη στα Αγαπημένα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION, - "Επαναφορά Συσχέτισης Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RUN, - "Εκκίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RUN_MUSIC, - "Εκκίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE, - "Ενεργοποίηση SAMBA" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, - "Αρχείο Αποθήκευσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_INDEX, - "Save State Auto Index" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, - "Auto Load State" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, - "Auto Save State" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, - "Savestate" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, - "Savestate Thumbnails" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, - "Αποθήκευση Τρέχουσας Διαμόρφωσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, - "Save Core Overrides" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, - "Save Content Directory Overrides" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, - "Save Game Overrides" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVE_NEW_CONFIG, - "Αποθήκευση Νέας Διαμόρφωσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVE_STATE, - "ποθήκευση Κατάστασης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, - "Αποθήκευση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY, - "Σάρωση Ευρετηρίου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SCAN_FILE, - "Σάρωση αρχείου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY, - "<Σάρωση Αυτού Του Ευρετηρίου>" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, - "Στιγμιότυπο Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, - "Ανάλυση Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SEARCH, - "Αναζήτηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SECONDS, - "δευτερόλεπτα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SETTINGS, - "Ρυθμίσεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, - "Ρυθμίσεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER, - "Σκίαση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES, - "Εφαμοργή Αλλαγών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS, - "Σκιάσεις" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, - "Κορδέλλα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, - "Κορδέλλα (απλοποιημένη)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SIMPLE_SNOW, - "Απλό Χιόνι" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW, - "Χιόνι" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHOW_ADVANCED_SETTINGS, - "Εμφάνιση Ρυθμίσεων Για Προχωρημένους" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES, - "Εμφάνιση Κρυφών Αρχείων και Φακέλων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHUTDOWN, - "Τερματισμός" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO, - "Slow-Motion Ratio" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RUN_AHEAD_ENABLED, - "Run-Ahead to Reduce Latency" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RUN_AHEAD_FRAMES, - "Number of Frames to Run Ahead" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RUN_AHEAD_SECONDARY_INSTANCE, - "RunAhead Use Second Instance" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RUN_AHEAD_HIDE_WARNINGS, - "RunAhead Hide Warnings" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE, - "Sort Saves In Folders" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE, - "Sort Savestates In Folders" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVESTATES_IN_CONTENT_DIR_ENABLE, - "Write Savestates to Content Dir" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SAVEFILES_IN_CONTENT_DIR_ENABLE, - "Write Saves to Content Dir" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEMFILES_IN_CONTENT_DIR_ENABLE, - "System Files are in Content Dir" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SCREENSHOTS_IN_CONTENT_DIR_ENABLE, - "Write Screenshots to Content Dir" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SSH_ENABLE, - "Ενεργοποίηση SSH" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_START_CORE, - "Έναρξη Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, - "Έναρξη Απομακρυσμένου RetroPad" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, - "Έναρξη Επεξεργαστή Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STATE_SLOT, - "Θέση Κατάστασης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STATUS, - "Κατάσταση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STDIN_CMD_ENABLE, - "Εντολές stdin" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SUPPORTED_CORES, - "Προτεινόμενοι πυρήνες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE, - "Αναστολή Προφύλαξης Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_BGM_ENABLE, - "System BGM Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY, - "Σύστημα/BIOS" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION, - "Πληροφορίες Συστήματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_7ZIP_SUPPORT, - "Υποστήριξη 7zip" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ALSA_SUPPORT, - "Υποστήριξη ALSA" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE, - "Ημερομηνία Κατασκευής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CG_SUPPORT, - "Υποστήριξη Cg" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COCOA_SUPPORT, - "Υποστήριξη Cocoa" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COMMAND_IFACE_SUPPORT, - "Υποστήριξη Γραμμής Εντολών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CORETEXT_SUPPORT, - "Υποστήριξη CoreText" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES, - "Χαρακτηριστικά Επεξεργαστή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_DPI, - "DPI Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_HEIGHT, - "Ύψος Οθόνης (mm)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_WIDTH, - "Πλάτος Οθόνης (mm)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DSOUND_SUPPORT, - "Υποστήριξη DirectSound" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WASAPI_SUPPORT, - "Υποστήριξη WASAPI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYLIB_SUPPORT, - "Υποστήριξη δυναμικής βιβλιοθήκης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, - "Δυναμική φόρτωση κατά την εκτέλεση της βιβλιοθήκης libretro" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT, - "Υποστήριξη EGL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FBO_SUPPORT, - "Υποστήριξη OpenGL/Direct3D render-to-texture (multi-pass shaders)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FFMPEG_SUPPORT, - "Υποστήριξη FFmpeg" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FREETYPE_SUPPORT, - "Υποστήριξη FreeType" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_STB_TRUETYPE_SUPPORT, - "Υποστήριξη STB TrueType" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER, - "Αναγνωριστικό λειτουργικού συστήματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_NAME, - "Όνομα λειτουργικού συστήματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_OS, - "Λειτουργικό Σύστημα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION, - "Έκδοση Git" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GLSL_SUPPORT, - "Υποστήριξη GLSL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_HLSL_SUPPORT, - "Υποστήριξη HLSL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_JACK_SUPPORT, - "Υποστήριξη JACK" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_KMS_SUPPORT, - "Υποστήριξη KMS/EGL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LAKKA_VERSION, - "Έκδοση Lakka" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBRETRODB_SUPPORT, - "Υποστήριξη LibretroDB" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBUSB_SUPPORT, - "Υποστήριξη Libusb" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBXML2_SUPPORT, - "Υποστήριξη ανάλυσης libxml2 XML" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETPLAY_SUPPORT, - "Υποστήριξη Netplay (peer-to-peer)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_COMMAND_IFACE_SUPPORT, - "Υποστήριξη Γραμμής Εντολών Δικτύου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_REMOTE_SUPPORT, - "Υποστήριξη Χειριστηρίου Δικτύου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENAL_SUPPORT, - "Υποστήριξη OpenAL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGLES_SUPPORT, - "Υποστήριξη OpenGL ES" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGL_SUPPORT, - "Υποστήριξη OpenGL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENSL_SUPPORT, - "Υποστήριξη OpenSL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENVG_SUPPORT, - "Υποστήριξη OpenVG" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OSS_SUPPORT, - "Υποστήριξη OSS" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OVERLAY_SUPPORT, - "Υποστήριξη Επικαλλυμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE, - "Πηγή ρεύματος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED, - "Φορτισμένο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGING, - "Φορτίζει" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING, - "Ξεφορτίζει" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_NO_SOURCE, - "Καμία πηγή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PULSEAUDIO_SUPPORT, - "Υποστήριξη PulseAudio" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PYTHON_SUPPORT, - "Υποστήριξη Python (υποστήριξη script στις σκιάσεις)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RBMP_SUPPORT, - "Υποστήριξη BMP (RBMP)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETRORATING_LEVEL, - "Επίπεδο RetroRating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RJPEG_SUPPORT, - "Υποστήριξη JPEG (RJPEG)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ROARAUDIO_SUPPORT, - "Υποστήριξη RoarAudio" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RPNG_SUPPORT, - "Υποστήριξη PNG (RPNG)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RSOUND_SUPPORT, - "Υποστήριξη RSound" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RTGA_SUPPORT, - "Υποστήριξη TGA (RTGA)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL2_SUPPORT, - "Υποστήριξη SDL2" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_IMAGE_SUPPORT, - "Υποστήριξη Εικόνων SDL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_SUPPORT, - "Υποστήριξη SDL1.2" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SLANG_SUPPORT, - "Υποστήριξη Slang" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_THREADING_SUPPORT, - "Υποστήριξη Threading" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_UDEV_SUPPORT, - "Υποστήριξη Udev" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_V4L2_SUPPORT, - "Υποστήριξη Video4Linux2" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER, - "Οδηγός video context" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VULKAN_SUPPORT, - "Υποστήριξη Vulkan" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_METAL_SUPPORT, - "Υποστήριξη Metal" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WAYLAND_SUPPORT, - "Υποστήριξη Wayland" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_X11_SUPPORT, - "Υποστήριξη X11" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XAUDIO2_SUPPORT, - "Υποστήριξη XAudio2" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XVIDEO_SUPPORT, - "Υποστήριξη XVideo" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT, - "Υποστήριξη Zlib" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT, - "Λήψη Στιγμιότυπου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, - "Threaded tasks" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_THUMBNAILS, - "Σκίτσα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LEFT_THUMBNAILS, - "Σκίτσα Αριστερά" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_VERTICAL_THUMBNAILS, - "Thumbnails Vertical Disposition" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, - "Σκίτσα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST, - "Ενημερωτής Σκίτσων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, - "Εξώφυλλα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS, - "Στιγμιότυπα Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS, - "Οθόνες Τίτλων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, - "Εμφάνιση ημερομηνίας / ώρας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE, - "Στυλ ημερομηνίας / ώρας" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_TIMEDATE_STYLE, - "Αλλάζει το στυλ της τρέχουσας ημερομηνίας ή και ώρας που φαίνεται μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, - "ΧΧΧΧ-ΜΜ-ΗΗ ΩΩ:ΛΛ:ΔΔ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, - "ΧΧΧΧ-ΜΜ-ΗΗ ΩΩ:ΛΛ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, - "ΜΜ-ΗΗ-ΧΧΧΧ ΩΩ:ΛΛ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, - "ΩΩ:ΛΛ:ΔΔ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, - "ΩΩ:ΛΛ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, - "ΗΗ/ΜΜ ΩΩ:ΛΛ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, - "ΜΜ/ΗΗ ΩΩ:ΛΛ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, - "ΩΩ:ΛΛ:ΔΔ (ΠΜ/ΜΜ)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TITLE_COLOR, - "Χρώμα τίτλου μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TRUE, - "Αληθές" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, - "UI Companion Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, - "UI Companion Start On Boot" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE, - "Εμφάνιση μενού επιφάνειας εργασίας κατά την εκκίνηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE, - "Ενεργοποίηση μενού επιφάνειας εργασίας (επανεκκίνηση)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, - "Γραμμή Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, - "Αδυναμία ανάγνωσης συμπιεσμένου αρχείου." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, - "Αναίρεση Φόρτωσης Κατάστασης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE, - "Αναίρεση Αποθήκευσης Κατάστασης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UNKNOWN, - "Άγνωστο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATER_SETTINGS, - "Ενημερωτής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_ASSETS, - "Ενημέρωση Βασικών Στοιχείων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES, - "Ενημέρωση Προφίλ Joypad" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, - "Ενημέρωση των Σκιάσεων Cg" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS, - "Ενημέρωση Απατών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, - "Ενημέρωση Αρχείων Πληροφοριών Πυρήνων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES, - "Ενημέρωση Βάσεων Δεδομένων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_GLSL_SHADERS, - "Ενημέρωση Σκιάσεων GLSL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_LAKKA, - "Ενημέρωση Lakka" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_OVERLAYS, - "Ενημέρωση Επικαλλυμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UPDATE_SLANG_SHADERS, - "Ενημέρωση Σκιάσεων Slang" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_USER, - "Χρήστης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_KEYBOARD, - "Kbd" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS, - "Διεπαφή Χρήστη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_USER_LANGUAGE, - "Γλώσσα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_USER_SETTINGS, - "Χρήστης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER, - "Χρήση Ενσωματωμένου Προβολέα Εικόνων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_USE_BUILTIN_PLAYER, - "Χρήση Ενσωματωμένου Αναπαραγωγέα Πολυμέσων Use Builtin Media Player" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, - "<Χρήση αυτού του ευρετηρίου>" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, - "Επίτρεψη περιστροφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO, - "Διαμόρφωση Αναλογίας Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, - "Αυτόματη Αναλογία Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, - "Αναλογία Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, - "Εισαγωγή Μαύρων Καρέ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, - "Περικοπή Υπερσάρωσης (Επαναφόρτωση)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, - "Disable Desktop Composition" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER, - "Οδηγός Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FILTER, - "Φίλτρο Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR, - "Φίλτρο Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_FLICKER, - "Flicker filter" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FONT_ENABLE, - "Ενεργοποίηση Ειδοποιήσεων Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, - "Γραμματοσειρά Ειδοποιήσεων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE, - "Μέγεθος Γραμματοσειράς" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_ASPECT, - "Εξαναγκασμένη αναλογία απεικόνισης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, - "Εξαναγκασμένη απενεργοποίηση sRGB FBO" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, - "Καθυστέρηση Καρέ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN, - "Έναρξη σε Κατάσταση Πλήρης Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA, - "Gamma Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD, - "Χρήση Εγγραφής Κάρτας Γραφικών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_GPU_SCREENSHOT, - "Ενεργοποίηση Στιγμιότυπου Οθόνης Κάρτας Γραφικών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC, - "Σκληρός Συγχρονισμός Κάρτας Γραφικών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES, - "Σκληρός Συγχρονισμός Καρέ Κάρτας Γραφικών" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, - "Μέγιστες εικόνες swapchain" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, - "Θέση Ειδοποιήσης X" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, - "Θέση Ειδοποιήσης Y" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, - "Ένδειξη Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, - "Use Post Filter Recording" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, - "Κάθετος Ρυθμός Ανανέωσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, - "Εκτιμόμενος Ρυθμός Καρέ Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_POLLED, - "Ορισμός Ρυθμού Ανανέωσης Βάση Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, - "Περιστροφή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, - "Κλίμακα Παραθύρου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, - "Ακέραια Κλίμακα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, - "Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, - "Σκίαση Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, - "Shader Passes" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, - "Shader Parameters" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, - "Load Shader Preset" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, - "Save Shader Preset As" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, - "Save Core Preset" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT, - "Save Content Directory Preset" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, - "Save Game Preset" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT, - "Enable Hardware Shared Context" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SMOOTH, - "Διγραμμικό Φιλτράρισμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SOFT_FILTER, - "Ενεργοποίηση Απαλού Φίλτρου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_SWAP_INTERVAL, - "Διάστημα Εναλλαγής Κάθετου Συγχρονισμόυ (Vsync)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_TAB, - "Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, - "Threaded Video" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER, - "Deflicker" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "Προτιμώμενο Ύψος Αναλογίας Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "Προτιμώμενο Πλάτος Αναλογίας Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, - "Προτιμώμενη Θέση Άξωνα X Αναλογίας Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, - "Προτιμώμενη Θέση Άξωνα Y Αναλογίας Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, - "Ορισμός Πλάτους Οθόνης VI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, - "Vertical Sync (Vsync)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, - "Παράθυρο Πλήρης Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, - "Πλάτος Παραθύρου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, - "Ύψος Παραθύρου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_X, - "Πλάτος Πλήρης Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y, - "Ύψος Πλήρης Οθόνης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, - "Οδηγός Wi-Fi" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, - "Wi-Fi" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, - "Menu Alpha Factor" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, - "Γραμματοσειρά Μενού Κόκκινο Χρώμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, - "Γραμματοσειρά Μενού Πράσινο Χρώμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, - "Γραμματοσειρά Μενού Μπλε Χρώμα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_FONT, - "Γραμματοσειρά Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_CUSTOM, - "Custom" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_FLATUI, - "FlatUI" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME, - "Μονόχρωμο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED, - "Μονόχρωμο Ανεστραμμένο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_SYSTEMATIC, - "Systematic" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_NEOACTIVE, - "NeoActive" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_PIXEL, - "Pixel" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, - "RetroActive" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROSYSTEM, - "Retrosystem" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, - "Dot-Art" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_AUTOMATIC, - "Automatic" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, - "Χρώμα Θέματος Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, - "Πράσινο Μήλο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK, - "Σκούρο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LIGHT, - "Φωτεινό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MORNING_BLUE, - "Πρωινό Μπλε" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE, - "Σκούρο Μωβ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE, - "Μπλε Ηλεκτρίκ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN, - "Χρυσαφί" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED, - "Legacy Κόκκινο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE, - "Μεσωνύκτιο Μπλε" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_PLAIN, - "Απλό" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA, - "Κάτω Από Την Θάλασσα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED, - "Ηφαιστιακό Κόκκινο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, - "Menu Shader Pipeline" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR, - "Menu Scale Factor" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, - "Ενεργοποίηση Σκιών Εικονιδίων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY, - "Προβολή Καρτέλας Ιστορικού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD, - "Προβολή Καρτέλας Εισαγωγής Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS, - "Προβολή Καρτέλας Λίστας Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES, - "Προβολή Καρτέλας Αγαπημένων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES, - "Προβολή Καρτέλας Εικόνων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_MUSIC, - "Προβολή Καρτέλας Μουσικής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS, - "Προβολή Καρτέλας Ρυθμίσεων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_VIDEO, - "Προβολή Καρτέλας Βίντεο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_NETPLAY, - "Προβολή Καρτέλας Netplay" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_LAYOUT, - "Διάταξη Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_THEME, - "Θέμα Εικόνων Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_YES, - "Ναι" - ) -MSG_HASH( - MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO, - "Shader Preset" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, - "Ενεργοποίηση ή απενεργοποίηση επιτευγμάτων. Για περισσότερες πληροφορίες επισκεφθείτε http://retroachievements.org" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, - "Enable or disable unofficial achievements and/or beta features for testing purposes." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, - "Enable or disable savestates, cheats, rewind, pause, and slow-motion for all games." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, - "Enable or disable in-game leaderboards. Has no effect if Hardcore Mode is disabled." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, - "Enable or disable badge display in the Achievement List." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, - "Enable or disable OSD verbosity for achievements." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, - "Automatically take a screenshot when an achievement is triggered." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, - "Αλλαγή οδηγών που χρησιμοποιούνται από το σύστημα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, - "Αλλαγή ρυθμίσεων επιτευγμάτων." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_SETTINGS, - "Αλλαγή ρυθμίσεων πυρήνα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RECORDING_SETTINGS, - "Αλλαγή ρυθμίσεων εγγραφής." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS, - "Αλλαγή επικάλλυψης οθόνης και επικάλλυψης πληκτρολογίου και ρυθμίσεις ειδοποιήσεων οθόνης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS, - "Αλλαγή ρυθμίσεων επιστροφής, γρήγορης κίνησης και αργής κίνησης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVING_SETTINGS, - "Αλλαγή ρυθμίσεων αποθήκευσης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LOGGING_SETTINGS, - "Αλλαγή ρυθμίσεων αρχείου καταγραφής." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_USER_INTERFACE_SETTINGS, - "Αλλαγή ρυθμίσεων περιβάλλοντος χρήστη." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_USER_SETTINGS, - "Αλλαγή ρυθμίσεων λογαριασμού, ονόματος χρήστη και γλώσσας." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, - "Αλλαγή ρυθμίσεων ιδιοτηκότητας." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIDI_SETTINGS, - "Αλλαγή ρυθμίσεων MIDI." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, - "Αλλαγή προκαθορισμένων ευρετηρίων όπου βρίσκονται τα αρχεία." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, - "Αλλαγή ρυθμίσεων λιστών αναπαραγωγής." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, - "Αλλαγή ρυθμίσεων εξυπηρετητή και δικτύου." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST, - "Σάρωση περιεχομένου και προσθήκη στην βάση δεδομένων." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_SETTINGS, - "Αλλαγή ρυθμίσεων εξόδου ήχου." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_BLUETOOTH_ENABLE, - "Ενεργοποίηση ή απενεργοποίηση bluetooth." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT, - "Αποθήκευση αλλαγών στο αρχείο διαμόρφωσης κατά την έξοδο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS, - "Αλλαγή προκαθορισμένων ρυθμίσεων των αρχείων διαμόρφωσης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, - "Διαχειρισμός και δημιουργία αρχείων διαμόρφωσης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CPU_CORES, - "Αριθμός πυρήνων που έχει ο επεξεργαστής." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_FPS_SHOW, - "Εμφανίζει τον τρέχων ρυθμό καρέ ανά δευτερόλεπτο στην οθόνη." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, - "Διαμόρφωση ρυθμίσεων πλήκτρων εντολών." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, - "Συνδιασμός κουμπιών χειριστηρίου για την εμφάνιση του μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_SETTINGS, - "Αλλαγή ρυθμίσεων χειριστηρίου, πληκτρολογίου και ποντικιού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, - "Διαμόρφωση χειρισμών για αυτόν τον χρήστη." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LATENCY_SETTINGS, - "Αλλαγή ρυθμίσεων συσχετιζόμενες με το βίντεο, τον ήχο και την καθυστέρηση εισαγωγής." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LOG_VERBOSITY, - "Ενεργοποίηση ή απενεργοποίηση αρχείων καταγραφής στο τερματικό." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY, - "Συμμετοχή ή δημιουργία μίας συνεδρίας netplay." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, - "Αναζήτηση για και σύνδεση με οικοδεσπότη netplay στο τοπικό δίκτυο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, - "Εμφάνιση πληροφοριών συστήματος." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ONLINE_UPDATER, - "Κατεβάστε πρόσθετα, στοιχεία και περιεχόμενο για το RetroArch." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAMBA_ENABLE, - "Enable or disable network sharing of your folders." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SERVICES_SETTINGS, - "Manage operating system level services." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SHOW_HIDDEN_FILES, - "Show hidden files/directories inside the file browser." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SSH_ENABLE, - "Enable or disable remote command line access." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, - "Αποτρέπει την προφύλαξη οθόνης του συστήματος από το να ενεργοποιηθεί." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, - "Ορισμός μεγέθους παραθύρου σε σχέση με το μέγεθος της οπτικής γωνίας του πυρήνα. Διαφορετικά, παρακάτω μπορείτε να ορίσετε το πλάτος και το ύψος του παραθύρου σε σταθερό μέγεθος." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_USER_LANGUAGE, - "Ορίζει την γλώσσα του περιβάλλοντος." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, - "Εισάγει ένα μαύρο καρέ ανάμεσα στα καρέ. Χρήσιμο για χρήστες με οθόνες 120Hz που θέλουν να παίξουν περιεχόμενο στα 60Hz χωρίς 'φαντάσματα' στην εικόνα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, - "Μειώνει την καθυστέρηση με μεγαλύτερο κίνδυνο για κολλήματα στο βίντεο. Προσθέτει μία επιβράδυνση μετά το V-Sync (σε ms)." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, - "Ορίζει πόσα καρέ μπορεί ο επεξεργαστής να βρίσκεται μπροστά από την κάρτα γραφικών όταν χρησιμοποιείται τον 'Σκληρό Συγχρονισμό Κάρτα Γραφικών'." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, - "Tells the video driver to explicitly use a specified buffering mode." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, - "Επιλέγει ποιά οθόνη θα χρησιμοποιηθεί." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, - "Ο ακριβής εκτιμόμενος ρυθμός ανανέωσης της οθόνης σε Hz." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED, - "Ο ρυθμός ανανέωσης όπως αναφέρεται από τον οδηγό οθόνης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, - "Αλλαγή ρυθμίσεων εξόδου βίντεο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_WIFI_SETTINGS, - "Σαρώνει για ασύρματα δίκτυα και δημιουργεί σύνδεση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_HELP_LIST, - "Μάθετε περισσότερα για το πως λειτουργεί το πρόγραμμα." - ) -MSG_HASH( - MSG_ADDED_TO_FAVORITES, - "Προστέθηκε στα αγαπημένα" - ) -MSG_HASH( - MSG_RESET_CORE_ASSOCIATION, - "Ο σύνδεση με πυρήνα της λίστας αναπαραγωγής έχει επαναφερθεί." - ) -MSG_HASH( - MSG_APPENDED_DISK, - "Appended disk" - ) -MSG_HASH( - MSG_APPLICATION_DIR, - "Application Dir" - ) -MSG_HASH( - MSG_APPLYING_CHEAT, - "Applying cheat changes." - ) -MSG_HASH( - MSG_APPLYING_SHADER, - "Applying shader" - ) -MSG_HASH( - MSG_AUDIO_MUTED, - "Ο ήχος απενεργοποιήθηκε." - ) -MSG_HASH( - MSG_AUDIO_UNMUTED, - "Ο ήχος ενεργοποιήθηκε." - ) -MSG_HASH( - MSG_AUTOCONFIG_FILE_ERROR_SAVING, - "Error saving autoconf file." - ) -MSG_HASH( - MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY, - "Autoconfig file saved successfully." - ) -MSG_HASH( - MSG_AUTOSAVE_FAILED, - "Could not initialize autosave." - ) -MSG_HASH( - MSG_AUTO_SAVE_STATE_TO, - "Auto save state to" - ) -MSG_HASH( - MSG_BLOCKING_SRAM_OVERWRITE, - "Blocking SRAM Overwrite" - ) -MSG_HASH( - MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, - "Bringing up command interface on port" - ) -MSG_HASH( - MSG_BYTES, - "bytes" - ) -MSG_HASH( - MSG_CANNOT_INFER_NEW_CONFIG_PATH, - "Cannot infer new config path. Use current time." - ) -MSG_HASH( - MSG_CHEEVOS_HARDCORE_MODE_ENABLE, - "Achievements Hardcore Mode Enabled, savestate & rewind were disabled." - ) -MSG_HASH( - MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, - "Comparing with known magic numbers..." - ) -MSG_HASH( - MSG_COMPILED_AGAINST_API, - "Compiled against API" - ) -MSG_HASH( - MSG_CONFIG_DIRECTORY_NOT_SET, - "Config directory not set. Cannot save new config." - ) -MSG_HASH( - MSG_CONNECTED_TO, - "Συνδέθηκε με" - ) -MSG_HASH( - MSG_CONTENT_CRC32S_DIFFER, - "Content CRC32s differ. Cannot use different games." - ) -MSG_HASH( - MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, - "Content loading skipped. Implementation will load it on its own." - ) -MSG_HASH( - MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, - "Core does not support save states." - ) -MSG_HASH( - MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, - "Core options file created successfully." - ) -MSG_HASH( - MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, - "Could not find any next driver" - ) -MSG_HASH( - MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM, - "Could not find compatible system." - ) -MSG_HASH( - MSG_COULD_NOT_FIND_VALID_DATA_TRACK, - "Could not find valid data track" - ) -MSG_HASH( - MSG_COULD_NOT_OPEN_DATA_TRACK, - "could not open data track" - ) -MSG_HASH( - MSG_COULD_NOT_READ_CONTENT_FILE, - "Could not read content file" - ) -MSG_HASH( - MSG_COULD_NOT_READ_MOVIE_HEADER, - "Could not read movie header." - ) -MSG_HASH( - MSG_COULD_NOT_READ_STATE_FROM_MOVIE, - "Could not read state from movie." - ) -MSG_HASH( - MSG_CRC32_CHECKSUM_MISMATCH, - "CRC32 checksum mismatch between content file and saved content checksum in replay file header. Replay highly likely to desync on playback." - ) -MSG_HASH( - MSG_CUSTOM_TIMING_GIVEN, - "Custom timing given" - ) -MSG_HASH( - MSG_DECOMPRESSION_ALREADY_IN_PROGRESS, - "Decompression already in progress." - ) -MSG_HASH( - MSG_DECOMPRESSION_FAILED, - "Decompression failed." - ) -MSG_HASH( - MSG_DETECTED_VIEWPORT_OF, - "Detected viewport of" - ) -MSG_HASH( - MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, - "Did not find a valid content patch." - ) -MSG_HASH( - MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, - "Disconnect device from a valid port." - ) -MSG_HASH( - MSG_DISK_CLOSED, - "Closed" - ) -MSG_HASH( - MSG_DISK_EJECTED, - "Ejected" - ) -MSG_HASH( - MSG_DOWNLOADING, - "Γίνεται λήψη" - ) -MSG_HASH( - MSG_INDEX_FILE, - "ευρετηρίου" - ) -MSG_HASH( - MSG_DOWNLOAD_FAILED, - "Η λήψη απέτυχε" - ) -MSG_HASH( - MSG_ERROR, - "Πρόβλημα" - ) -MSG_HASH( - MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT, - "Libretro core requires content, but nothing was provided." - ) -MSG_HASH( - MSG_ERROR_LIBRETRO_CORE_REQUIRES_SPECIAL_CONTENT, - "Libretro core requires special content, but none were provided." - ) -MSG_HASH( - MSG_ERROR_PARSING_ARGUMENTS, - "Error parsing arguments." - ) -MSG_HASH( - MSG_ERROR_SAVING_CORE_OPTIONS_FILE, - "Error saving core options file." - ) -MSG_HASH( - MSG_ERROR_SAVING_REMAP_FILE, - "Error saving remap file." - ) -MSG_HASH( - MSG_ERROR_REMOVING_REMAP_FILE, - "Error removing remap file." - ) -MSG_HASH( - MSG_ERROR_SAVING_SHADER_PRESET, - "Error saving shader preset." - ) -MSG_HASH( - MSG_EXTERNAL_APPLICATION_DIR, - "External Application Dir" - ) -MSG_HASH( - MSG_EXTRACTING, - "Γίνεται εξαγωγή" - ) -MSG_HASH( - MSG_EXTRACTING_FILE, - "Γίνεται εξαγωγή αρχείου" - ) -MSG_HASH( - MSG_FAILED_SAVING_CONFIG_TO, - "Failed saving config to" - ) -MSG_HASH( - MSG_FAILED_TO, - "Failed to" - ) -MSG_HASH( - MSG_FAILED_TO_ACCEPT_INCOMING_SPECTATOR, - "Failed to accept incoming spectator." - ) -MSG_HASH( - MSG_FAILED_TO_ALLOCATE_MEMORY_FOR_PATCHED_CONTENT, - "Failed to allocate memory for patched content..." - ) -MSG_HASH( - MSG_FAILED_TO_APPLY_SHADER, - "Failed to apply shader." - ) -MSG_HASH( - MSG_FAILED_TO_BIND_SOCKET, - "Failed to bind socket." - ) -MSG_HASH( - MSG_FAILED_TO_CREATE_THE_DIRECTORY, - "Failed to create the directory." - ) -MSG_HASH( - MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE, - "Failed to extract content from compressed file" - ) -MSG_HASH( - MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT, - "Failed to get nickname from client." - ) -MSG_HASH( - MSG_FAILED_TO_LOAD, - "Failed to load" - ) -MSG_HASH( - MSG_FAILED_TO_LOAD_CONTENT, - "Failed to load content" - ) -MSG_HASH( - MSG_FAILED_TO_LOAD_MOVIE_FILE, - "Failed to load movie file" - ) -MSG_HASH( - MSG_FAILED_TO_LOAD_OVERLAY, - "Αποτυχία φόρτωσης επικαλλύματος." - ) -MSG_HASH( - MSG_FAILED_TO_LOAD_STATE, - "Failed to load state from" - ) -MSG_HASH( - MSG_FAILED_TO_OPEN_LIBRETRO_CORE, - "Failed to open libretro core" - ) -MSG_HASH( - MSG_FAILED_TO_PATCH, - "Failed to patch" - ) -MSG_HASH( - MSG_FAILED_TO_RECEIVE_HEADER_FROM_CLIENT, - "Failed to receive header from client." - ) -MSG_HASH( - MSG_FAILED_TO_RECEIVE_NICKNAME, - "Failed to receive nickname." - ) -MSG_HASH( - MSG_FAILED_TO_RECEIVE_NICKNAME_FROM_HOST, - "Failed to receive nickname from host." - ) -MSG_HASH( - MSG_FAILED_TO_RECEIVE_NICKNAME_SIZE_FROM_HOST, - "Failed to receive nickname size from host." - ) -MSG_HASH( - MSG_FAILED_TO_RECEIVE_SRAM_DATA_FROM_HOST, - "Failed to receive SRAM data from host." - ) -MSG_HASH( - MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY, - "Failed to remove disk from tray." - ) -MSG_HASH( - MSG_FAILED_TO_REMOVE_TEMPORARY_FILE, - "Failed to remove temporary file" - ) -MSG_HASH( - MSG_FAILED_TO_SAVE_SRAM, - "Failed to save SRAM" - ) -MSG_HASH( - MSG_FAILED_TO_SAVE_STATE_TO, - "Failed to save state to" - ) -MSG_HASH( - MSG_FAILED_TO_SEND_NICKNAME, - "Failed to send nickname." - ) -MSG_HASH( - MSG_FAILED_TO_SEND_NICKNAME_SIZE, - "Failed to send nickname size." - ) -MSG_HASH( - MSG_FAILED_TO_SEND_NICKNAME_TO_CLIENT, - "Failed to send nickname to client." - ) -MSG_HASH( - MSG_FAILED_TO_SEND_NICKNAME_TO_HOST, - "Failed to send nickname to host." - ) -MSG_HASH( - MSG_FAILED_TO_SEND_SRAM_DATA_TO_CLIENT, - "Failed to send SRAM data to client." - ) -MSG_HASH( - MSG_FAILED_TO_START_AUDIO_DRIVER, - "Failed to start audio driver. Will continue without audio." - ) -MSG_HASH( - MSG_FAILED_TO_START_MOVIE_RECORD, - "Failed to start movie record." - ) -MSG_HASH( - MSG_FAILED_TO_START_RECORDING, - "Failed to start recording." - ) -MSG_HASH( - MSG_FAILED_TO_TAKE_SCREENSHOT, - "Failed to take screenshot." - ) -MSG_HASH( - MSG_FAILED_TO_UNDO_LOAD_STATE, - "Failed to undo load state." - ) -MSG_HASH( - MSG_FAILED_TO_UNDO_SAVE_STATE, - "Failed to undo save state." - ) -MSG_HASH( - MSG_FAILED_TO_UNMUTE_AUDIO, - "Failed to unmute audio." - ) -MSG_HASH( - MSG_FATAL_ERROR_RECEIVED_IN, - "Fatal error received in" - ) -MSG_HASH( - MSG_FILE_NOT_FOUND, - "Το αρχείο δεν βρέθηκε" - ) -MSG_HASH( - MSG_FOUND_AUTO_SAVESTATE_IN, - "Found auto savestate in" - ) -MSG_HASH( - MSG_FOUND_DISK_LABEL, - "Found disk label" - ) -MSG_HASH( - MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, - "Found first data track on file" - ) -MSG_HASH( - MSG_FOUND_LAST_STATE_SLOT, - "Found last state slot" - ) -MSG_HASH( - MSG_FOUND_SHADER, - "Found shader" - ) -MSG_HASH( - MSG_FRAMES, - "Καρέ" - ) -MSG_HASH( - MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT, - "Per-Game Options: game-specific core options found at" - ) -MSG_HASH( - MSG_GOT_INVALID_DISK_INDEX, - "Got invalid disk index." - ) -MSG_HASH( - MSG_GRAB_MOUSE_STATE, - "Grab mouse state" - ) -MSG_HASH( - MSG_GAME_FOCUS_ON, - "Game focus on" - ) -MSG_HASH( - MSG_GAME_FOCUS_OFF, - "Game focus off" - ) -MSG_HASH( - MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING, - "Libretro core is hardware rendered. Must use post-shaded recording as well." - ) -MSG_HASH( - MSG_INFLATED_CHECKSUM_DID_NOT_MATCH_CRC32, - "Inflated checksum did not match CRC32." - ) -MSG_HASH( - MSG_INPUT_CHEAT, - "Εισαγωγή Απάτης" - ) -MSG_HASH( - MSG_INPUT_CHEAT_FILENAME, - "Input Cheat Filename" - ) -MSG_HASH( - MSG_INPUT_PRESET_FILENAME, - "Input Preset Filename" - ) -MSG_HASH( - MSG_INPUT_RENAME_ENTRY, - "Rename Title" - ) -MSG_HASH( - MSG_INTERFACE, - "Αντάπτορας Δικτύου" - ) -MSG_HASH( - MSG_INTERNAL_STORAGE, - "Εσωτερική Μνήμη Αποθήκευσης" - ) -MSG_HASH( - MSG_REMOVABLE_STORAGE, - "Αφαιρούμενο Μέσο Αποθήκευσης" - ) -MSG_HASH( - MSG_INVALID_NICKNAME_SIZE, - "Μη έγκυρο μέγεθος ψευδώνυμου." - ) -MSG_HASH( - MSG_IN_BYTES, - "σε bytes" - ) -MSG_HASH( - MSG_IN_GIGABYTES, - "σε gigabytes" - ) -MSG_HASH( - MSG_IN_MEGABYTES, - "σε megabytes" - ) -MSG_HASH( - MSG_LIBRETRO_ABI_BREAK, - "is compiled against a different version of libretro than this libretro implementation." - ) -MSG_HASH( - MSG_LIBRETRO_FRONTEND, - "Frontend for libretro" - ) -MSG_HASH( - MSG_LOADED_STATE_FROM_SLOT, - "Loaded state from slot #%d." - ) -MSG_HASH( - MSG_LOADED_STATE_FROM_SLOT_AUTO, - "Loaded state from slot #-1 (auto)." - ) -MSG_HASH( - MSG_LOADING, - "Γίνεται φόρτωση" - ) -MSG_HASH( - MSG_FIRMWARE, - "One or more firmware files are missing" - ) -MSG_HASH( - MSG_LOADING_CONTENT_FILE, - "Loading content file" - ) -MSG_HASH( - MSG_LOADING_HISTORY_FILE, - "Loading history file" - ) -MSG_HASH( - MSG_LOADING_STATE, - "Loading state" - ) -MSG_HASH( - MSG_MEMORY, - "Μνήμη" - ) -MSG_HASH( - MSG_MOVIE_FILE_IS_NOT_A_VALID_BSV1_FILE, - "Input replay movie file is not a valid BSV1 file." - ) -MSG_HASH( - MSG_MOVIE_FORMAT_DIFFERENT_SERIALIZER_VERSION, - "Input replay movie format seems to have a different serializer version. Will most likely fail." - ) -MSG_HASH( - MSG_MOVIE_PLAYBACK_ENDED, - "Input replay movie playback ended." - ) -MSG_HASH( - MSG_MOVIE_RECORD_STOPPED, - "Stopping movie record." - ) -MSG_HASH( - MSG_NETPLAY_FAILED, - "Failed to initialize netplay." - ) -MSG_HASH( - MSG_NO_CONTENT_STARTING_DUMMY_CORE, - "No content, starting dummy core." - ) -MSG_HASH( - MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET, - "No save state has been overwritten yet." - ) -MSG_HASH( - MSG_NO_STATE_HAS_BEEN_LOADED_YET, - "No state has been loaded yet." - ) -MSG_HASH( - MSG_OVERRIDES_ERROR_SAVING, - "Error saving overrides." - ) -MSG_HASH( - MSG_OVERRIDES_SAVED_SUCCESSFULLY, - "Overrides saved successfully." - ) -MSG_HASH( - MSG_PAUSED, - "Παύση." - ) -MSG_HASH( - MSG_PROGRAM, - "RetroArch" - ) -MSG_HASH( - MSG_READING_FIRST_DATA_TRACK, - "Reading first data track..." - ) -MSG_HASH( - MSG_RECEIVED, - "ελήφθη" - ) -MSG_HASH( - MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, - "Recording terminated due to resize." - ) -MSG_HASH( - MSG_RECORDING_TO, - "Εγγραφή σε" - ) -MSG_HASH( - MSG_REDIRECTING_CHEATFILE_TO, - "Redirecting cheat file to" - ) -MSG_HASH( - MSG_REDIRECTING_SAVEFILE_TO, - "Redirecting save file to" - ) -MSG_HASH( - MSG_REDIRECTING_SAVESTATE_TO, - "Redirecting savestate to" - ) -MSG_HASH( - MSG_REMAP_FILE_SAVED_SUCCESSFULLY, - "Remap file saved successfully." - ) -MSG_HASH( - MSG_REMAP_FILE_REMOVED_SUCCESSFULLY, - "Remap file removed successfully." - ) -MSG_HASH( - MSG_REMOVED_DISK_FROM_TRAY, - "Removed disk from tray." - ) -MSG_HASH( - MSG_REMOVING_TEMPORARY_CONTENT_FILE, - "Removing temporary content file" - ) -MSG_HASH( - MSG_RESET, - "Reset" - ) -MSG_HASH( - MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, - "Restarting recording due to driver reinit." - ) -MSG_HASH( - MSG_RESTORED_OLD_SAVE_STATE, - "Restored old save state." - ) -MSG_HASH( - MSG_RESTORING_DEFAULT_SHADER_PRESET_TO, - "Shaders: restoring default shader preset to" - ) -MSG_HASH( - MSG_REVERTING_SAVEFILE_DIRECTORY_TO, - "Reverting savefile directory to" - ) -MSG_HASH( - MSG_REVERTING_SAVESTATE_DIRECTORY_TO, - "Reverting savestate directory to" - ) -MSG_HASH( - MSG_REWINDING, - "Rewinding." - ) -MSG_HASH( - MSG_REWIND_INIT, - "Initializing rewind buffer with size" - ) -MSG_HASH( - MSG_REWIND_INIT_FAILED, - "Failed to initialize rewind buffer. Rewinding will be disabled." - ) -MSG_HASH( - MSG_REWIND_INIT_FAILED_THREADED_AUDIO, - "Implementation uses threaded audio. Cannot use rewind." - ) -MSG_HASH( - MSG_REWIND_REACHED_END, - "Reached end of rewind buffer." - ) -MSG_HASH( - MSG_SAVED_NEW_CONFIG_TO, - "Saved new config to" - ) -MSG_HASH( - MSG_SAVED_STATE_TO_SLOT, - "Saved state to slot #%d." - ) -MSG_HASH( - MSG_SAVED_STATE_TO_SLOT_AUTO, - "Saved state to slot #-1 (auto)." - ) -MSG_HASH( - MSG_SAVED_SUCCESSFULLY_TO, - "Saved successfully to" - ) -MSG_HASH( - MSG_SAVING_RAM_TYPE, - "Saving RAM type" - ) -MSG_HASH( - MSG_SAVING_STATE, - "Saving state" - ) -MSG_HASH( - MSG_SCANNING, - "Σάρωση" - ) -MSG_HASH( - MSG_SCANNING_OF_DIRECTORY_FINISHED, - "Η σάρωση του ευρετηρίου ολοκληρώθηκε" - ) -MSG_HASH( - MSG_SENDING_COMMAND, - "Αποστολή εντολής" - ) -MSG_HASH( - MSG_SEVERAL_PATCHES_ARE_EXPLICITLY_DEFINED, - "Several patches are explicitly defined, ignoring all..." - ) -MSG_HASH( - MSG_SHADER, - "Σκίαση" - ) -MSG_HASH( - MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, - "Shader preset saved successfully." - ) -MSG_HASH( - MSG_SKIPPING_SRAM_LOAD, - "Skipping SRAM load." - ) -MSG_HASH( - MSG_SLOW_MOTION, - "Αργή κίνηση." - ) -MSG_HASH( - MSG_FAST_FORWARD, - "Γρήγορη κίνηση." - ) -MSG_HASH( - MSG_SLOW_MOTION_REWIND, - "Slow motion rewind." - ) -MSG_HASH( - MSG_SRAM_WILL_NOT_BE_SAVED, - "SRAM will not be saved." - ) -MSG_HASH( - MSG_STARTING_MOVIE_PLAYBACK, - "Starting movie playback." - ) -MSG_HASH( - MSG_STARTING_MOVIE_RECORD_TO, - "Starting movie record to" - ) -MSG_HASH( - MSG_STATE_SIZE, - "State size" - ) -MSG_HASH( - MSG_STATE_SLOT, - "State slot" - ) -MSG_HASH( - MSG_TAKING_SCREENSHOT, - "Taking screenshot." - ) -MSG_HASH( - MSG_TO, - "to" - ) -MSG_HASH( - MSG_UNDID_LOAD_STATE, - "Undid load state." - ) -MSG_HASH( - MSG_UNDOING_SAVE_STATE, - "Undoing save state" - ) -MSG_HASH( - MSG_UNKNOWN, - "Άγνωστο" - ) -MSG_HASH( - MSG_UNPAUSED, - "Unpaused." - ) -MSG_HASH( - MSG_UNRECOGNIZED_COMMAND, - "Unrecognized command" - ) -MSG_HASH( - MSG_USING_CORE_NAME_FOR_NEW_CONFIG, - "Using core name for new config." - ) -MSG_HASH( - MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED, - "Using libretro dummy core. Skipping recording." - ) -MSG_HASH( - MSG_VALUE_CONNECT_DEVICE_FROM_A_VALID_PORT, - "Connect device from a valid port." - ) -MSG_HASH( - MSG_VALUE_DISCONNECTING_DEVICE_FROM_PORT, - "Disconnecting device from port" - ) -MSG_HASH( - MSG_VALUE_REBOOTING, - "Επανεκκίνηση..." - ) -MSG_HASH( - MSG_VALUE_SHUTTING_DOWN, - "Τερματισμός λειτουργίας..." - ) -MSG_HASH( - MSG_VERSION_OF_LIBRETRO_API, - "Έκδοση του libretro API" - ) -MSG_HASH( - MSG_VIEWPORT_SIZE_CALCULATION_FAILED, - "Viewport size calculation failed! Will continue using raw data. This will probably not work right ..." - ) -MSG_HASH( - MSG_VIRTUAL_DISK_TRAY, - "virtual disk tray." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_LATENCY, - "Επιθυμητή καθυστέρηση ήχου σε milliseconds. Ίσως να μην τηρηθεί εάν ο οδηγός ήχου δεν μπορεί να παρέχει την επιλεγμένη καθυστέρηση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_MUTE, - "Σίγαση/κατάργηση σίγασης ήχου." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, - "Helps smooth out imperfections in timing when synchronizing audio and video. Be aware that if disabled, proper synchronization is nearly impossible to obtain." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CAMERA_ALLOW, - "Allow or disallow camera access by cores." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LOCATION_ALLOW, - "Allow or disallow location services access by cores." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_MAX_USERS, - "Μέγιστος αριθμός χρηστών που υποστηρίζεται από το RetroArch." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, - "Επιρροή του πως γίνεται η συγκέντρωση εισόδου μέσα στο RetroArch. Ο ορισμός σε 'Νωρίς' ή 'Αργά' μπορεί να έχει ως αποτέλεσμα μικρότερη καθυστέρηση με τις ρυθμίσεις σας." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, - "Επιτρέπει σε οποιονδήποτε χρήστη να χειριστεί το μενού. Εάν απενεργοποιηθεί, μόνο ο Χρήστης 1 μπορεί να χειριστει το μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_VOLUME, - "Ένταση ήχου (σε dB). Το 0 είναι η φυσιολογική ένταση και δεν εφαρμόζεται gain." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_WASAPI_EXCLUSIVE_MODE, - "Allow the WASAPI driver to take exclusive control of the audio device. If disabled, it will use shared mode instead." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_WASAPI_FLOAT_FORMAT, - "Use float format for the WASAPI driver, if supported by your audio device." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH, - "The intermediate buffer length (in frames) when using the WASAPI driver in shared mode." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_SYNC, - "Συγχρονισμός ήχου. Προτείνεται." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, - "Πόσο μακριά ένας άξωνας πρέπει να γείρει ώστε να οδηγήσει σε πάτημα κουμπιού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, - "Χρόνος αναμονής σε δευτερόλεπτα μέχρι την συνέχιση στην επόμενη σύνδεση πλήκτρων." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_BIND_HOLD, - "Δευτερόλεπτα τα οποία χρειάζεται να κρατήσετε πατημένο κάποιο κουμπί μέχρι την σύνδεση του." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, - "Describes the period when turbo-enabled buttons are toggled. Numbers are described in frames." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE, - "Describes how long the period of a turbo-enabled button should be. Numbers are described in frames." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_VSYNC, - "Συγχρονίζει την έξοδο βίντεο της κάρτας γραφικών με τον ρυθμό ανανέωσης της οθόνης. Προτείνεται." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, - "Allow cores to set rotation. When disabled, rotation requests are ignored. Useful for setups where one manually rotates the screen." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, - "Some cores might have a shutdown feature. If enabled, it will prevent the core from shutting RetroArch down. Instead, it loads a dummy core." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, - "Check if all the required firmware is present before attempting to load content." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, - "Ο κάθετος ρυθμός ανανέωσης της οθόνης. Χρησιμοποιείται για τον υπολογισμό του κατάλληλου ρυθμού εισαγωγής ήχου.\n" - "ΣΗΜΕΙΩΣΗ: Αυτή η επιλογή αγνοείται εάν έχετε ενεργοποιήσει το 'Threaded Video'." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_ENABLE, - "Ενεργοποίηση εξόδου ήχου." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW, - "The maximum change in audio input rate. Increasing this enables very large changes in timing at the cost of an inaccurate audio pitch (e.g., running PAL cores on NTSC displays)." - ) -MSG_HASH( - MSG_FAILED, - "failed" - ) -MSG_HASH( - MSG_SUCCEEDED, - "succeeded" - ) -MSG_HASH( - MSG_DEVICE_NOT_CONFIGURED, - "not configured" - ) -MSG_HASH( - MSG_DEVICE_NOT_CONFIGURED_FALLBACK, - "not configured, using fallback" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST, - "Database Cursor List" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DEVELOPER, - "Database - Filter : Developer" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PUBLISHER, - "Database - Filter : Publisher" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISABLED, - "Disabled" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ENABLED, - "Enabled" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_PATH, - "Content History Path" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ORIGIN, - "Database - Filter : Origin" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_FRANCHISE, - "Database - Filter : Franchise" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ESRB_RATING, - "Database - Filter : ESRB Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ELSPA_RATING, - "Database - Filter : ELSPA Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PEGI_RATING, - "Database - Filter : PEGI Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_CERO_RATING, - "Database - Filter : CERO Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_BBFC_RATING, - "Database - Filter : BBFC Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_MAX_USERS, - "Database - Filter : Max Users" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_MONTH, - "Database - Filter : Releasedate By Month" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_YEAR, - "Database - Filter : Releasedate By Year" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_ISSUE, - "Database - Filter : Edge Magazine Issue" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_RATING, - "Database - Filter : Edge Magazine Rating" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DATABASE_INFO, - "Πληροφορίες Βάσης Δεδομένων" - ) -MSG_HASH( - MSG_WIFI_SCAN_COMPLETE, - "Η σάρωση του Wi-Fi ολοκληρώθηκε." - ) -MSG_HASH( - MSG_SCANNING_WIRELESS_NETWORKS, - "Σάρωση ασύρματων δικτύων..." - ) -MSG_HASH( - MSG_NETPLAY_LAN_SCAN_COMPLETE, - "Οκληρώθηκε η σάρωση Netplay." - ) -MSG_HASH( - MSG_NETPLAY_LAN_SCANNING, - "Σάρωση για οικοδεσπότες netplay..." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, - "Παύση παιχνιδιού όταν το RetroArch δεν είναι το ενεργό παράθυρο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, - "Enable or disable composition." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, - "Ενεργοποίηση ή απενεργοποίηση λίστας πρόσφατων για παιχνίδια, εικόνες, μουσική και βίντεο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, - "Περιορισμός καταχωρήσεων στην λίστα πρόσφατων για παιχνίδια, εικόνες, μουσική και βίντεο." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, - "Ενοποιημένος Χειρισμός Μενού" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, - "Χρήση του ίδιου χειρισμού για το μενού και το παιχνίδι. Εφαρμόζεται στο πληκτρολόγιο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, - "Εμφάνιση μηνυμάτων οθόνης." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETWORK_USER_REMOTE_ENABLE, - "User %d Remote Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BATTERY_LEVEL_ENABLE, - "Εμφάνιση επιπέδου μπαταρίας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SELECT_FILE, - "Επιλογή Αρχείου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SELECT_FROM_COLLECTION, - "Επιλογή Από Συλλογή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FILTER, - "Φίλτρα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SCALE, - "Κλίμακα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, - "Netplay will start when content is loaded." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, - "Couldn't find a suitable core or content file, load manually." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, - "Browse URL" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BROWSE_URL, - "URL Path" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BROWSE_START, - "Έναρξη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, - "Bokeh" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOWFLAKE, - "Χιονονιφάδα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, - "Ανανέωση Λίστας Δωματίων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME, - "Ψευδώνυμο: %s" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, - "Ψευδώνυμο (lan): %s" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, - "Βρέθηκε συμβατό περιεχόμενο" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, - "Αφαιρεί μερικά pixel γύρω από την εικόνα όπου εθιμικά οι προγραμματιστές άφηναν κενά ή και που περιέχουν άχρηστα pixel." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, - "Προσθέτει μία μικρή θολούρα στην εικόνα ώστε να αφαιρέσει τις σκληρές γωνίες των pixel. Αυτή η επιλογή έχει πολύ μικρή επιρροή στην επίδοση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FILTER, - "Εφαρμόστε ένα φίλτρο βίντεο που λειτουργεί με τον επεξεργαστή.\n" - "ΣΗΜΕΙΩΣΗ: Μπορεί να έχει μεγάλο κόστος στην επίδοση. Μερικά φίλτρα βίντεο μπορεί να δουλεύουν μόνο με πυρήνες που χρησιμοποιούν 32bit ή 16bit χρώμα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, - "Εισάγεται το όνομα χρήστη του λογαριασμού σας στο RetroAchievements." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, - "Εισάγεται τον κωδικό πρόσβασης του λογαριασμού σας στο RetroAchievements." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, - "Εισάγεται το όνομα χρήστη σας εδώ. Αυτό θα χρησιμοποιηθεί για συνεδρίες netplay ανάμεσα σε άλλα πράγματα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, - "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_LIST, - "Επιλέξτε ποιον πυρήνα θα χρησιμοποιήστε." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, - "Επιλέξτε ποιο περιεχόμενο θα ξεκινήσετε." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, - "Εμφάνιση ανταπτόρων δικτύου και τις συσχετιζόμενες διευθύνσεις IP." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, - "Εμφάνιση πληροφοριών για την συγκεκριμένη συσκευή." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUIT_RETROARCH, - "Έξοδος από το πρόγραμμα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, - "Ορίστε το προτιμώμενο πλάτος του παραθύρου απεικόνισης. Αφήνοντας το στο 0 θα επιχειρηθεί η κλίμακα του παραθύρου να είναι όσο το δυνατόν μεγαλύτερη." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, - "Ορίστε το προτιμώμενο ύψος του παραθύρου απεικόνισης. Αφήνοντας το στο 0 θα επιχειρηθεί η κλίμακα του παραθύρου να είναι όσο το δυνατόν μεγαλύτερη." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, - "Specify custom X axis position for onscreen text." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, - "Specify custom Y axis position for onscreen text." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, - "Specify the font size in points." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, - "Απόκρυψη του επικαλλύματος μέσα στο μενού και εμφάνιση του ξανά με την έξοδο από το μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, - "Εμφάνιση εισαγωγών πληκτρολογίου/χειριστηρίου στο επικάλλυμα οθόνης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, - "Επιλογή της θύρας για όταν είναι ενεργοποιημένη η επιλογή 'Εμφάνιση Εισαγωγών Στην Οθόνη'" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, - "Το σαρωμένο περιεχόμενο θα εμφανίζεται εδώ." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, - "Αλλαγή κλίμακας βίντεο σε ακέραια βήματα. Το βασικό μέγεθος εξαρτάται από την γεωμετρία και την κλίμακα οθόνης του συστήματος. Εάν η 'Εξαναγκασμένη Κλίμακα' δεν έχει οριστεί, οι άξωνες X/Y θα αλλάζουν κλίμακα ξεχωριστά." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, - "Screenshots output of GPU shaded material if available." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_ROTATION, - "Forces a certain rotation of the screen. The rotation is added to rotations which the core sets." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FORCE_SRGB_DISABLE, - "Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows have video problems with sRGB FBO support if this is enabled. Enabling this can work around it." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, - "Έναρξη σε πλήρη οθόνη. Μπορεί να αλλάξει κατά την εκτέλεση. Μπορεί να παρακαμπτεί από έναν διακόπτη γραμμής τερματικού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, - "Εάν χρησιμοποιηθεί πλήρης οθόνη προτιμήστε την κατάσταση παραθύρου πλήρης οθόνης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD, - "Records output of GPU shaded material if available." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX, - "When making a savestate, save state index is automatically increased before it is saved. When loading content, the index will be set to the highest existing index." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE, - "Block Save RAM from being overwritten when loading save states. Might potentially lead to buggy games." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO, - "The maximum rate at which content will be run when using fast forward (e.g., 5.0x for 60 fps content = 300 fps cap). If set to 0.0x, fastforward ratio is unlimited (no FPS cap)." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, - "When in slow motion, content will slow down by the factor specified/set." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RUN_AHEAD_ENABLED, - "Run core logic one or more frames ahead then load the state back to reduce perceived input lag." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RUN_AHEAD_FRAMES, - "The number of frames to run ahead. Causes gameplay issues such as jitter if you exceed the number of lag frames internal to the game." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RUN_AHEAD_SECONDARY_INSTANCE, - "Use a second instance of the RetroArch core to run ahead. Prevents audio problems due to loading state." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RUN_AHEAD_HIDE_WARNINGS, - "Hides the warning message that appears when using RunAhead and the core does not support savestates." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_REWIND_ENABLE, - "Ενεργοποίηση επιστροφής. Η επίδοση θα πέσει κατά το παιχνίδι." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE, - "Apply cheat immediately after toggling." -) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD, - "Auto-apply cheats when game loads." -) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_REPEAT_COUNT, - "The number of times the cheat will be applied. Use with the other two Iteration options to affect large areas of memory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_ADDRESS, - "After each 'Number of Iterations' the Memory Address will be increased by this number times the 'Memory Search Size'." -) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE, - "After each 'Number of Iterations' the Value will be increased by this amount." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, - "When rewinding a defined number of frames, you can rewind several frames at a time, increasing the rewind speed." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE, - "The amount of memory (in MB) to reserve for the rewind buffer. Increasing this will increase the amount of rewind history." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE_STEP, - "Each time you increase or decrease the rewind buffer size value via this UI it will change by this amount" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_IDX, - "Index position in list." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_ADDRESS_BIT_POSITION, - "Address bitmask when Memory Search Size < 8-bit." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_MATCH_IDX, - "Select the match to view." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_START_OR_CONT, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_START_OR_RESTART, - "Αριστερά/Δεξιά για αλλαγή μεγέθους bit" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EXACT, - "Αριστερά/Δεξιά για αλλαγή τιμής" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LT, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GT, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LTE, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GTE, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQ, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_NEQ, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQPLUS, - "Αριστερά/Δεξιά για αλλαγή τιμής" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQMINUS, - "Αριστερά/Δεξιά για αλλαγή τιμής" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_ADD_MATCHES, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_VIEW_MATCHES, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_CREATE_OPTION, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_DELETE_OPTION, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_TOP, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_BOTTOM, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_DELETE_ALL, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_RELOAD_CHEATS, - "" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_BIG_ENDIAN, - "Big endian : 258 = 0x0102,\n" - "Little endian : 258 = 0x0201" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, - "Sets log level for cores. If a log level issued by a core is below this value, it is ignored." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PERFCNT_ENABLE, - "Enable performance counters for RetroArch (and cores)." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, - "Automatically makes a savestate at the end of RetroArch's runtime. RetroArch will automatically load this savestate if 'Auto Load State' is enabled." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_LOAD, - "Automatically load the auto save state on startup." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVESTATE_THUMBNAIL_ENABLE, - "Show thumbnails of save states inside the menu." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUTOSAVE_INTERVAL, - "Autosaves the non-volatile Save RAM at a regular interval. This is disabled by default unless set otherwise. The interval is measured in seconds. A value of 0 disables autosave." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, - "If enabled, overrides the input binds with the remapped binds set for the current core." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, - "Enable input auto-detection. Will attempt to autoconfigure joypads, Plug-and-Play style." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, - "Εναλλαγή πλήτρκων για Επιβεβαίωση/Ακύρωση. Απενεργοποιημένο είναι ο Ιαπωνικός προσανατολισμός, ενεργοποιημένος είναι ο δυτικός προσανατολισμός." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO, - "Εάν απενεργοποιηθεί το περιεχόμενο θα συνεχίσει να τρέχει στο παρασκήνιο όταν το μενού του RetroArch είναι ανοικτό." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_DRIVER, - "Οδηγός βίντεο προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_DRIVER, - "Οδηγός ήχου προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DRIVER, - "Οδηγός Εισόδου προς χρήση. Ανάλογα με τον οδηγό βίντεο, ίσως αλλάξει αναγκαστικά ο οδηγός εισαγωγής." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_JOYPAD_DRIVER, - "Οδηγός Joypad προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_DRIVER, - "Οδηγός Επαναδειγματολήπτη Ήχου προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CAMERA_DRIVER, - "Οδηγός Κάμερας προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LOCATION_DRIVER, - "Οδηγός Τοποθεσίας προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_DRIVER, - "Οδηγός Μενού προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RECORD_DRIVER, - "Οδηγός Εγγραφής προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIDI_DRIVER, - "Οδηγός MIDI προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_WIFI_DRIVER, - "Οδηγός Wi-Fi προς χρήση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, - "Filter files being shown in filebrowser by supported extensions." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_WALLPAPER, - "Select an image to set as menu wallpaper." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPER, - "Dynamically load a new wallpaper depending on context." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_DEVICE, - "Παράκαμψη της προκαθορισμένης συσκευής ήχου που χρησιμοποιεί ο οδηγός ήχου. Αυτή η επιλογή εξαρτάται από τον οδηγό." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN, - "Πρόσθετο ήχου DSP που επεξεργάζεται τον ήχο πριν αποσταλεί στον οδηγό." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_OUTPUT_RATE, - "Audio output sample rate." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_OVERLAY_OPACITY, - "Διαφάνεια όλων των στοιχείων του επικαλλύματος." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_OVERLAY_SCALE, - "Κλίμακα όλων των στοιχείων του επικαλλύματος." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE, - "Ενεργοποίηση του επικαλλύματος." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_OVERLAY_PRESET, - "Επιλογή ενός επικαλλύματος από τον περιηγητή αρχείων." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, - "The address of the host to connect to." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT, - "The port of the host IP address. Can be either a TCP or UDP port." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_PASSWORD, - "The password for connecting to the netplay host. Used only in host mode." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, - "Whether to announce netplay games publicly. If unset, clients must manually connect rather than using the public lobby." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, - "The password for connecting to the netplay host with only spectator privileges. Used only in host mode." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_START_AS_SPECTATOR, - "Whether to start netplay in spectator mode." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_ALLOW_SLAVES, - "Whether to allow connections in slave mode. Slave-mode clients require very little processing power on either side, but will suffer significantly from network latency." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_REQUIRE_SLAVES, - "Whether to disallow connections not in slave mode. Not recommended except for very fast networks with very weak machines." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_STATELESS_MODE, - "Whether to run netplay in a mode not requiring save states. If set to true, a very fast network is required, but no rewinding is performed, so there will be no netplay jitter." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_CHECK_FRAMES, - "The frequency in frames with which netplay will verify that the host and client are in sync." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_NAT_TRAVERSAL, - "When hosting, attempt to listen for connections from the public Internet, using UPnP or similar technologies to escape LANs." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_STDIN_CMD_ENABLE, - "Enable stdin command interface." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MOUSE_ENABLE, - "Enable mouse controls inside the menu." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_POINTER_ENABLE, - "Enable touch controls inside the menu." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_THUMBNAILS, - "Type of thumbnail to display." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LEFT_THUMBNAILS, - "Type of thumbnail to display at the left." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS, - "Display the left thumbnail under the right one, on the right side of the screen." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_TIMEDATE_ENABLE, - "Εμφάνιση τρέχουσας ημερομηνίας ή και ώρας μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_BATTERY_LEVEL_ENABLE, - "Εμφάνιση τρέχουσας μπαταρίας μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND, - "Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, - "Ενεργοποιεί το netplay ως οικοδεσπότης (εξυπηρετητής)." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, - "Ενεργοποιεί το netplay ως πελάτης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, - "Αποσυνδέει μία ενεργή σύνδεση Netplay." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, - "Σαρώνει ένα ευρετήριο για συμβατά αρχεία και τα προσθέτει στην συλλογή." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SCAN_FILE, - "Σαρώνει ένα συμβατό αρχείο και το προσθέτει στην συλλογή." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, - "Χρησιμοποιεί ένα προτιμώμενο διάστημα αλλαγής για το Vsync. Ορίστε αυτό ώστε να μειώσεται στο μισό τον ρυθμό ανανέωσης της οθόνης αποτελεσματικά." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, - "Sort save files in folders named after the core used." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, - "Sort save states in folders named after the core used." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_REQUEST_DEVICE_I, - "Request to play with the given input device." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, - "URL to core updater directory on the Libretro buildbot." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_BUILDBOT_ASSETS_URL, - "URL to assets updater directory on the Libretro buildbot." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, - "After downloading, automatically extract files contained in the downloaded archives." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, - "Σάρωση για νέα δωμάτια." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DELETE_ENTRY, - "Κατάργηση αυτής της καταχώρησης από την συλλογή." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INFORMATION, - "View more information about the content." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES, - "Προσθήκη καταχώρησης στα αγαπημένα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST, - "Προσθήκη καταχώρησης στα αγαπημένα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RUN, - "Έναρξη περιεχομένου." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS, - "Προσαρμογή ρυθμίσεων εξερευνητή αρχείου." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE, - "Enable customized controls by default at startup." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUTO_OVERRIDES_ENABLE, - "Enable customized configuration by default at startup." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_GAME_SPECIFIC_OPTIONS, - "Enable customized core options by default at startup." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_ENABLE, - "Εμφανίζει το όνομα του τρέχων πυρήνα μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DATABASE_MANAGER, - "Προβολή βάσεων δεδομένων." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CURSOR_MANAGER, - "Προβολή προηγούμενων αναζητήσεων." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, - "Καταγράφει μία εικόνα της οθόνης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CLOSE_CONTENT, - "Κλείνει το τρέχον περιεχόμενο. Οποιεσδήποτε μη αποθηκευμένες αλλαγές μπορεί να χαθούν." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LOAD_STATE, - "Φόρτωση μίας κατάστασης από την τρέχουσα θέση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVE_STATE, - "Αποθήκευση μίας κατάστασης στην τρέχουσα θέση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RESUME, - "Συνέχιση εκτέλεσης του τρέχοντος περιεχομένου και έξοδος από το Γρήγορο Μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RESUME_CONTENT, - "Συνέχιση εκτέλεσης του τρέχοντος περιεχομένου και έξοδος από το Γρήγορο Μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_STATE_SLOT, - "Αλλάζει την τρέχουσα επιλεγμένη θέση κατάστασης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, - "Εάν μία κατάσταση φορτώθηκε, το περιεχόμενο θα επιστρέψει στην κατάσταση πριν την φόρτωση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, - "Εάν μία κατάσταση αντικαταστάθηκε, το περιεχόμενο θα επιστρέψει στην προηγούμενη κατάσταση αποθήκευσης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, - "Υπηρεσία RetroAchievements. Για περισσότερες πληροφορίες επισκεφθείτε το http://retroachievements.org" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, - "Διαχειρίζεται τους τρέχοντες διαμορφωμένους λογαριασμούς." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_META_REWIND, - "Διαχειρίζεται τις ρυθμίσεις επαναφοράς." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_DETAILS, - "Manages cheat details settings." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_SEARCH, - "Start or continue a cheat code search." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RESTART_CONTENT, - "Επανεκκινεί το περιεχόμενο από την αρχή." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, - "Saves an override configuration file which will apply for all content loaded with this core. Will take precedence over the main configuration." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, - "Saves an override configuration file which will apply for all content loaded from the same directory as the current file. Will take precedence over the main configuration." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, - "Saves an override configuration file which will apply for the current content only. Will take precedence over the main configuration." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, - "Στήσιμο κωδικών απάτης." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SHADER_OPTIONS, - "Στήσιμο σκιάσεων για την οπτική βελτίωση της εικόνας." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS, - "Αλλαγή χειρισμών για το τρέχον εκτελούμενο περιεχόμενο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_OPTIONS, - "Αλλαγή επιλογών για το τρέχον εκτελούμενο περιεχόμενο." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, - "Show advanced settings for power users (hidden by default)." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, - "Perform tasks on a separate thread." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, - "Επιτρέψτε στον χρήστη να καταργεί τις καταχωρήσεις από την συλλογή." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, - "Sets the System directory. Cores can query for this directory to load BIOSes, system-specific configs, etc." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RGUI_BROWSER_DIRECTORY, - "Sets start directory for the filebrowser." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_DIR, - "Usually set by developers who bundle libretro/RetroArch apps to point to assets." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPERS_DIRECTORY, - "Directory to store wallpapers dynamically loaded by the menu depending on context." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, - "Supplementary thumbnails (boxarts/misc. images, etc.) are stored here." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, - "Sets start directory for menu configuration browser." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, - "The number of frames of input latency for netplay to use to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of noticeable input lag." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, - "The range of frames of input latency that may be used to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of unpredictable input lag." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DISK_CYCLE_TRAY_STATUS, - "Cycle the current disk. If the disk is inserted, it will eject the disk. If the disk has not been inserted, it will be inserted. " - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DISK_INDEX, - "Change the disk index." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DISK_OPTIONS, - "Disk image management." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND, - "Select a disk image to insert." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE, - "Makes sure the framerate is capped while inside the menu." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VRR_RUNLOOP_ENABLE, - "No deviation from core requested timing. Use for Variable Refresh Rate screens, G-Sync, FreeSync." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_LAYOUT, - "Select a different layout for the XMB interface." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_THEME, - "Select a different theme for the icon. Changes will take effect after you restart the program." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, - "Enable drop shadows for all icons. This will have a minor performance hit." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, - "Select a different background color gradient theme." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, - "Modify the opacity of the background wallpaper." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, - "Select a different background color gradient theme." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, - "Select an animated background effect. Can be GPU-intensive depending on the effect. If performance is unsatisfactory, either turn this off or revert to a simpler effect." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_FONT, - "Select a different main font to be used by the menu." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES, - "Προβολή καρτέλας αγαπημένων μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, - "Προβολή καρτέλας εικόνων μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_MUSIC, - "Προβολή καρτέλας μουσικής μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO, - "Προβολή καρτέλας βίντεο μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_NETPLAY, - "Προβολή καρτέλας netplay μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS, - "Προβολή καρτέλας ρυθμίσεων μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY, - "Προβολή καρτέλας πρόσφατου ιστορικού μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD, - "Προβολή καρτέλας εισαγωγής περιεχομένου μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS, - "Προβολή καρτέλας λίστας αναπαραγωγής μέσα στο μενού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN, - "Προβολή οθόνης εκκίνησης στο μενού. Τίθεται αυτόματα σε αρνητικό μετά την πρώτη εκκίνηση του προγράμματος." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY, - "Modify the opacity of the header graphic." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MATERIALUI_MENU_FOOTER_OPACITY, - "Modify the opacity of the footer graphic." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DPI_OVERRIDE_ENABLE, - "The menu normally scales itself dynamically. If you want to set a specific scaling size instead, enable this." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, - "Set the custom scaling size here.\n" - "NOTE: You have to enable 'DPI Override' for this scaling size to take effect." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, - "Save all downloaded files to this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_REMAPPING_DIRECTORY, - "Save all remapped controls to this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LIBRETRO_DIR_PATH, - "Directory where the program searches for content/cores." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_LIBRETRO_INFO_PATH, - "Application/core information files are stored here." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_JOYPAD_AUTOCONFIG_DIR, - "If a joypad is plugged in, that joypad will be autoconfigured if a config file corresponding to it is present inside this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PLAYLIST_DIRECTORY, - "Save all collections to this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CACHE_DIRECTORY, - "If set to a directory, content which is temporarily extracted (e.g. from archives) will be extracted to this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CURSOR_DIRECTORY, - "Saved queries are stored to this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_DATABASE_DIRECTORY, - "Databases are stored to this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ASSETS_DIRECTORY, - "This location is queried by default when menu interfaces try to look for loadable assets, etc." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, - "Save all save files to this directory. If not set, will try to save inside the content file's working directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, - "Save all save states to this directory. If not set, will try to save inside the content file's working directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, - "Directory to dump screenshots to." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, - "Ορίζει ένα ευρετήριο όπου τα επικαλλύματα αποθηκεύονται για εύκολη πρόσβαση." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH, - "Τα αρχεία απάτης αποθηκεύονται εδώ." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR, - "Directory where audio DSP filter files are kept." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR, - "Directory where CPU-based video filter files are kept." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_DIR, - "Defines a directory where GPU-based video shader files are kept for easy access." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RECORDING_OUTPUT_DIRECTORY, - "Recordings will be dumped to this directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RECORDING_CONFIG_DIRECTORY, - "Recording configurations will be kept here." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_FONT_PATH, - "Select a different font for onscreen notifications." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SHADER_APPLY_CHANGES, - "Changes to the shader configuration will take effect immediately. Use this if you changed the amount of shader passes, filtering, FBO scale, etc." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_NUM_PASSES, - "Increase or decrease the amount of shader pipeline passes. You can bind a separate shader to each pipeline pass and configure its scale and filtering." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET, - "Load a shader preset. The shader pipeline will be automatically set-up." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, - "Save the current shader settings as a new shader preset." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE, - "Save the current shader settings as the default settings for this application/core." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_PARENT, - "Save the current shader settings as the default settings for all files in the current content directory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME, - "Save the current shader settings as the default settings for the content." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS, - "Modifies the current shader directly. Changes will not be saved to the preset file." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_PARAMETERS, - "Modifies the shader preset itself currently used in the menu." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_NUM_PASSES, - "Increase or decrease the amount of cheats." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES, - "Cheat changes will take effect immediately." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_START_SEARCH, - "Start search for a new cheat. Number of bits can be changed." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_CONTINUE_SEARCH, - "Continue search for a new cheat." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD, - "Load a cheat file and replace existing cheats." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD_APPEND, - "Load a cheat file and append to existing cheats." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CHEAT_FILE_SAVE_AS, - "Save current cheats as a save file." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, - "Γρήγορα πρόσβαση σε όλες τις σχετικές ρυθμίσεις παιχνιδιού." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_INFORMATION, - "View information pertaining to the application/core." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, - "Floating point value for video aspect ratio (width / height), used if the Aspect Ratio is set to 'Config'." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, - "Προτιμώμενο ύψος οπτικής γωνίας το οποίο χρησιμοποιείται εάν η Αναλογία Οθόνης είναι ορισμένη ως 'Προτιμώμενη'." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, - "Προτιμώμενο πλάτος οπτικής γωνίας το οποίο χρησιμοποιείται εάν η Αναλογία Οθόνης είναι ορισμένη ως 'Προτιμώμενη'." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, - "Προτιμώμενη απόκλειση οπτικής γωνίας για τον ορισμό της θέσης του άξωνα X της οπτικής γωνίας. Αυτό αγνοείται εάν έχεται ενεργοποιήσει την 'Ακέραια Κλίμακα'. Τότε θα κεντραριστεί αυτόματα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, - "Προτιμώμενη απόκλειση οπτικής γωνίας για τον ορισμό της θέσης του άξωνα Y της οπτικής γωνίας. Αυτό αγνοείται εάν έχεται ενεργοποιήσει την 'Ακέραια Κλίμακα'. Τότε θα κεντραριστεί αυτόματα." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, - "Χρήση Εξυπηρετητή Αναμετάδοσης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, - "Forward netplay connections through a man-in-the-middle server. Useful if the host is behind a firewall or has NAT/UPnP problems." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, - "Τοποθεσία Εξυπηρετητή Αναμετάδοσης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, - "Choose a specific relay server to use. Geographically closer locations tend to have lower latency." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, - "Προσθήκη στον μίκτη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_PLAY, - "Προσθήκη στον μίκτη και αναπαραγωγή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION, - "Προσθήκη στον μίκτη" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION_AND_PLAY, - "Προσθήκη στον μίκτη και αναπαραγωγή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FILTER_BY_CURRENT_CORE, - "Φιλτράρισμα με βάση τον τρέχων πυρήνα" - ) -MSG_HASH( - MSG_AUDIO_MIXER_VOLUME, - "Γενική ένταση μίκτη ήχου" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_MIXER_VOLUME, - "Γενική ένταση μίκτη ήχου (σε dB). Το 0 είναι η φυσιολογική ένταση και δεν εφαρμόζεται gain." /*Need a good translation for gain if there's any*/ - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, - "Επίπεδο Έντασης Μίκτη Ήχου (dB)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE, - "Σίγαση Μίκτη Ήχου" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, - "Σίγαση/κατάργηση σίγασης μίκτη ήχου." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, - "Προβολή Διαδικτυακού Ενημερωτή" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, - "Εμφάνιση/απόκρυψη της επιλογής 'Διαδικτυακού Ενημερωτή'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS, - "Προβολές" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS, - "Προβολή ή απόκρυψη στοιχείων στην οθόνη του μενού." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER, - "Προβολή Ενημερωτή Πυρήνων" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER, - "Εμφάνιση/απόκρυψη της ικανότητας ενημέρωσης πυρήνων (και πληροφοριακών αρχείων πυρήνων)." - ) -MSG_HASH( - MSG_PREPARING_FOR_CONTENT_SCAN, - "Προετοιμασία για σάρωση περιεχομένου..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CORE_DELETE, - "Διαγραφή πυρήνα" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CORE_DELETE, - "Κατάργηση αυτού του πυρήνα από τον δίσκο." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, - "Framebuffer Opacity" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, - "Modify the opacity of the framebuffer." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, - "Αγαπημένα" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_GOTO_FAVORITES, - "Περιεχόμενο που έχετε προσθέσει στα 'Αγαπημένα' θα εμφανίζεται εδώ." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, - "Μουσική" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_GOTO_MUSIC, - "Μουσική που έχει προηγουμένως αναπαραχθεί θα εμφανίζονται εδώ." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_GOTO_IMAGES, - "Εικόνα" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_GOTO_IMAGES, - "Εικόνες που έχουν προηγουμένως προβληθεί θα εμφανίζονται εδώ." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, - "Βίντεο" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_GOTO_VIDEO, - "Βίντεο που έχουν προηγουμένως αναπαραχθεί θα εμφανίζονται εδώ." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, - "Εικονίδια Μενού" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, - "Ενεργοποίηση/Απενεργοποίηση των εικονιδίων που εμφανίζονται στα αριστερά των καταχωρήσεων του μενού." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Ενεργοποίηση Καρτέλας Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS_PASSWORD, - "Ορισμός Κωδικού Για Την Ενεργοποίηση Της Καρτέλας Ρυθμίσεων" - ) -MSG_HASH( - MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Εισαγωγή Κωδικού" - ) -MSG_HASH( - MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Σωστός κωδικός." - ) -MSG_HASH( - MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Λανθασμένος κωδικός." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Ενεργοποιεί την καρτέλα Ρυθμίσεις. Χρειάζεται επανεκκίνηση για να εμφανιστεί η καρτέλα." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, - "Επιτρέψτε στον χρήστη να μετονομάζει τις καταχωρήσεις στην συλλογή." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, - "Επίτρεψη μετονομασίας καταχωρήσεων" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RENAME_ENTRY, - "Μετονομασία του τίτλου αυτής της καταχώρησης." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, - "Μετονομασία" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, - "Προβολή Φόρτωσης Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE, - "Εμφάνιση/απόκρυψη της επιλογής 'Φόρτωση Πυρήνα'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CONTENT, - "Προβολή Φόρτωσης Περιεχομένου" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT, - "Εμφάνιση/απόκρυψη της επιλογής 'Φόρτωση Περιεχομένου'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION, - "Προβολή Πληροφοριών" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION, - "Εμφάνιση/απόκρυψη της επιλογής 'Πληροφορίες'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS, - "Προβολή Διαμορφώσεων" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS, - "Εμφάνιση/απόκρυψη της επιλογής 'Διαμορφώσεις'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, - "Προβολή Βοήθειας" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, - "Εμφάνιση/απόκρυψη της επιλογής 'Βοήθεια'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, - "Προβολή Εξόδου RetroArch" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, - "Εμφάνιση/απόκρυψη της επιλογής 'Έξοδος από RetroArch'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, - "Προβολή Επανεκκίνησης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, - "Εμφάνιση/απόκρυψη της επιλογής 'Επανεκκίνηση'." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_SHOW_SHUTDOWN, - "Show Shutdown" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_SHOW_SHUTDOWN, - "Show/hide the 'Shutdown' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS, - "Γρήγορο Μενού" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS, - "Show or hide elements on the Quick Menu screen." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT, - "Show Take Screenshot" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT, - "Show/hide the 'Take Screenshot' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE, - "Show Save/Load State" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE, - "Show/hide the options for saving/loading state." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, - "Show Undo Save/Load State" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, - "Show/hide the options for undoing save/load state." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, - "Show Add to Favorites" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, - "Show/hide the 'Add to Favorites' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, - "Show Options" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, - "Show/hide the 'Options' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CONTROLS, - "Show Controls" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS, - "Show/hide the 'Controls' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS, - "Show Cheats" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS, - "Show/hide the 'Cheats' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS, - "Show Shaders" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS, - "Show/hide the 'Shaders' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, - "Show Save Core Overrides" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, - "Show/hide the 'Save Core Overrides' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, - "Show Save Game Overrides" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, - "Show/hide the 'Save Game Overrides' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, - "Show Information" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, - "Show/hide the 'Information' option." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE, - "Notification Background Enable" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED, - "Notification Background Red Color" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN, - "Notification Background Green Color" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE, - "Notification Background Blue Color" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY, - "Notification Background Opacity" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, - "Disable Kiosk Mode" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, - "Disables kiosk mode. A restart is required for the change to take full effect." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, - "Ενεργοποίηση Λειτουργίας Κιόσκι" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, - "Protects the setup by hiding all configuration related settings." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, - "Set Password For Disabling Kiosk Mode" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, - "Supplying a password when enabling kiosk mode makes it possible to later disable it from the menu, by going to the Main Menu, selecting Disable Kiosk Mode and entering the password." - ) -MSG_HASH( - MSG_INPUT_KIOSK_MODE_PASSWORD, - "Εισαγωγή Κωδικού" - ) -MSG_HASH( - MSG_INPUT_KIOSK_MODE_PASSWORD_OK, - "Σωστός κωδικός." - ) -MSG_HASH( - MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, - "Λανθασμένος κωδικός." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED, - "Notification Red Color" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, - "Notification Green Color" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, - "Notification Blue Color" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, - "Show frame count on FPS display" - ) -MSG_HASH( - MSG_CONFIG_OVERRIDE_LOADED, - "Configuration override loaded." - ) -MSG_HASH( - MSG_GAME_REMAP_FILE_LOADED, - "Game remap file loaded." - ) -MSG_HASH( - MSG_CORE_REMAP_FILE_LOADED, - "Core remap file loaded." - ) -MSG_HASH( - MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES, - "RunAhead has been disabled because this core does not support save states." - ) -MSG_HASH( - MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, - "Failed to save state. RunAhead has been disabled." - ) -MSG_HASH( - MSG_RUNAHEAD_FAILED_TO_LOAD_STATE, - "Failed to load state. RunAhead has been disabled." - ) -MSG_HASH( - MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, - "Failed to create second instance. RunAhead will now use only one instance." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, - "Automatically add content to playlist" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, - "Automatically scans loaded content so they appear inside playlists." - ) -MSG_HASH( - MSG_SCANNING_OF_FILE_FINISHED, - "Scanning of file finished" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, - "Διαφάνεια Παραθύρου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, - "Ποιότητα Επαναδειγματολήπτη Ήχου" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, - "Ελαττώστε αυτή την τιμή για καλύτερη επίδοση/χαμηλότερη καθυστέρηση αντί ποιότητας ήχου, αυξήστε εάν θέλετε καλύτερη ποιότητα με κόστος στην επίδοση/χαμηλότερη καθυστέρηση." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, - "Watch shader files for changes" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, - "Auto-apply changes made to shader files on disk." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, - "Εμφάνιση Διακοσμητικών Παραθύρου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, - "Εμφάνιση Στατιστικών" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_STATISTICS_SHOW, - "Εμφάνιση τεχνικών στατιστικών στην οθόνη." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_ENABLE, - "Enable border filler" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, - "Enable border filler thickness" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, - "Enable background filler thickness" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, - "Για οθόνες CRT μόνο. Προσπαθεί να χρησιμοποιήσει την ακριβή ανάλυση πυρήνα/παιχνιδιού και ρυθμού ανανέωσης." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, - "CRT SwitchRes" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, - "Switch among native and ultrawide super resolutions." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, - "Σούπερ Ανάλυση CRT" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, - "Προβολή Ρυθμίσεων Επιστροφής" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, - "Εμφάνιση/απόκρυψη επιλογών Επιστροφής." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_LATENCY, - "Εμφάνιση/απόκρυψη επιλογών Καθυστέρησης." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_LATENCY, - "Προβολή Ρυθμίσεων Καθυστέρησης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS, - "Εμφάνιση/απόκρυψη επιλογών Επικαλλυμάτων." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, - "Προβολή Ρυθμίσεων Επικαλλυμάτων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, - "Ενεργοποίηση ήχου μενού" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, - "Ενεργοποίηση ή απενεργοποίηση ήχου μενού." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, - "Ρυθμίσεις Μίκτη" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, - "Εμφάνιση και/ή επεξεργασία ρυθμίσεων μίκτη." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_INFO, - "Πληροφορίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_FILE, - "&File" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE, - "&Load Core..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE, - "&Unload Core" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT, - "E&xit" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT, - "&Edit" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH, - "&Search" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW, - "&View" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS, - "Closed Docks" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_SHADER_PARAMS, - "Shader Parameters" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS, - "&Options..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_DOCK_POSITIONS, - "Remember dock positions:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_GEOMETRY, - "Remember window geometry:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_LAST_TAB, - "Remember last content browser tab:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME, - "Θέμα:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_SYSTEM_DEFAULT, - "" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_DARK, - "Σκούρο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_CUSTOM, - "Custom..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_TITLE, - "Επιλογές" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_TOOLS, - "&Tools" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_HELP, - "&Help" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT, - "Σχετικά με το RetroArch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_DOCUMENTATION, - "Εγχειρίδιο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE, - "Load Custom Core..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE, - "Φόρτωση Πυρήνα΄" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_LOADING_CORE, - "Φόρτωση Πυρήνα..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_NAME, - "Όνομα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION, - "Έκδοση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS, - "Λίστες Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER, - "File Browser" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_TOP, - "Top" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_UP, - "Up" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER, - "Content Browser" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART, - "Boxart" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT, - "Screenshot" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN, - "Title Screen" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ALL_PLAYLISTS, - "All Playlists" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CORE, - "Core" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CORE_INFO, - "Core Info" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CORE_SELECTION_ASK, - "" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_INFORMATION, - "Information" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_WARNING, - "Warning" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ERROR, - "Error" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR, - "Network Error" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_RESTART_TO_TAKE_EFFECT, - "Please restart the program for the changes to take effect." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_LOG, - "Log" - ) -#ifdef HAVE_QT -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SCAN_FINISHED, - "Scan Finished.

    \n" - "In order for content to be correctly scanned, you must:\n" - "
    • have a compatible core already downloaded
    • \n" - "
    • have \"Core Info Files\" updated via Online Updater
    • \n" - "
    • have \"Databases\" updated via Online Updater
    • \n" - "
    • restart RetroArch if any of the above was just done
    \n" - "Finally, the content must match existing databases from here. If it is still not working, consider submitting a bug report." - ) -#endif -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SHOW_WIMP, - "Εμφάνιση Μενού Επιφάνεις Εργασίας" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_SHOW_WIMP, - "Opens the desktop menu if closed." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN, - "Don't show this again" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_STOP, - "Στοπ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ASSOCIATE_CORE, - "Associate Core" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_HIDDEN_PLAYLISTS, - "Hidden Playlists" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_HIDE, - "Hide" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_HIGHLIGHT_COLOR, - "Highlight color:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CHOOSE, - "&Choose..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SELECT_COLOR, - "Select Color" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SELECT_THEME, - "Select Theme" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME, - "Custom Theme" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_FILE_PATH_IS_BLANK, - "File path is blank." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY, - "File is empty." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED, - "Could not open file for reading." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_FILE_WRITE_OPEN_FAILED, - "Could not open file for writing." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST, - "File does not exist." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST, - "Suggest loaded core first:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ZOOM, - "Zoom" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_VIEW, - "View" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_ICONS, - "Icons" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST, - "List" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, - "Overrides" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, - "Options for overriding the global configuration." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, - "Will start playback of the audio stream. Once finished, it will remove the current audio stream from memory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, - "Will start playback of the audio stream. Once finished, it will loop and play the track again from the beginning." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, - "Will start playback of the audio stream. Once finished, it will jump to the next audio stream in sequential order and repeat this behavior. Useful as an album playback mode." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, - "This will stop playback of the audio stream, but not remove it from memory. You can start playing it again by selecting 'Play'." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, - "This will stop playback of the audio stream and remove it entirely from memory." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, - "Adjust the volume of the audio stream." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ADD_TO_MIXER, - "Add this audio track to an available audio stream slot. If no slots are currently available, it will be ignored." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, - "Add this audio track to an available audio stream slot and play it. If no slots are currently available, it will be ignored." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, - "Αναπαραγωγή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, - "Αναπαραγωγή (Looped)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL, - "Αναπαραγωγή (Sequential)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, - "Στοπ" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, - "Κατάργηση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, - "Ένταση" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, - "Τρέχων πυρήνας" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_SEARCH_CLEAR, - "Clear" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ACHIEVEMENT_PAUSE, - "Pause achievements for current session (This action will enable savestates, cheats, rewind, pause, and slow-motion)." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_ACHIEVEMENT_RESUME, - "Resume achievements for current session (This action will disable savestates, cheats, rewind, pause, and slow-motion and reset the current game)." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, - "In-Menu" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME, - "In-Game" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED, - "In-Game (Paused)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING, - "Playing" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, - "Paused" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, - "Ενεργοποίηση Discord Rich Presence" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_DISCORD_ALLOW, - "Ενεργοποίηση ή απενεργοποίηση υποστήριξης Discord Rich Presence.\n" - "ΣΗΜΕΙΩΣΗ: Δεν θα δουλέψει με την έκδοση του περιηγητή, μόνο με την τοπικά εγκατεστημένη." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIDI_INPUT, - "Είσοδος" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIDI_INPUT, - "Επιλογή συσκευής εισόδου." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIDI_OUTPUT, - "Έξοδος" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIDI_OUTPUT, - "Επιλογή συσκευής εξόδου." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_MIDI_VOLUME, - "Ένταση" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_MIDI_VOLUME, - "Ορισμός έντασης εξόδου (%)." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, - "Διαχείριση Ενέργειας" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, - "Αλλαγή ρυθμίσεων διαχείρισης ενέργειας." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, - "Κατάσταση Συνεχούς Επίδοσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MPV_SUPPORT, - "Υποστήριξη mpv" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_IDX, - "Index" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_MATCH_IDX, - "View Match #" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_MATCH, - "Match Address: %08X Mask: %02X" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_COPY_MATCH, - "Create Code Match #" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_MATCH, - "Delete Match #" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_BROWSE_MEMORY, - "Browse Address: %08X" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_DESC, - "Πληροφορίες" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_STATE, - "Ενεργοποιημένο" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_CODE, - "Κωδικός" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_HANDLER, - "Handler" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_MEMORY_SEARCH_SIZE, - "Memory Search Size" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_TYPE, - "Τύπος" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_VALUE, - "Τιμή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS, - "Memory Address" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS_BIT_POSITION, - "Memory Address Mask" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_TYPE, - "Rumble When Memory" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_VALUE, - "Rumble Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PORT, - "Rumble Port" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_STRENGTH, - "Rumble Primary Strength" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_DURATION, - "Rumble Primary Duration (ms)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_STRENGTH, - "Rumble Secondary Strength" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_DURATION, - "Rumble Secondary Duration (ms)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_COUNT, - "Number of Iterations" -) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_VALUE, - "Value Increase Each Iteration" -) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_ADDRESS, - "Address Increase Each Iteration" -) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_AFTER, - "Add New Cheat After This One" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BEFORE, - "Add New Cheat Before This One" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_COPY_AFTER, - "Copy This Cheat After" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_COPY_BEFORE, - "Copy This Cheat Before" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_DELETE, - "Delete This Cheat" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_EMU, - "Emulator" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_RETRO, - "RetroArch" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_DISABLED, - "" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_SET_TO_VALUE, - "Set To Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_INCREASE_VALUE, - "Increase By Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_DECREASE_VALUE, - "Decrease By Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_EQ, - "Run next cheat if value = memory" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_NEQ, - "Run next cheat if value != memory" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_LT, - "Run next cheat if value < memory" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_GT, - "Run next cheat if value > memory" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED, - "" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_CHANGES, - "Changes" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_DOES_NOT_CHANGE, - "Does Not Change" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE, - "Increases" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE, - "Decreases" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_EQ_VALUE, - "= Rumble Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_NEQ_VALUE, - "!= Rumble Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_LT_VALUE, - "< Rumble Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_GT_VALUE, - "> Rumble Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE_BY_VALUE, - "Increases by Rumble Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE_BY_VALUE, - "Decreases by Rumble Value" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_1, - "1-bit, max value = 0x01" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_2, - "2-bit, max value = 0x03" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_4, - "4-bit, max value = 0x0F" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_8, - "8-bit, max value = 0xFF" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_16, - "16-bit, max value = 0xFFFF" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_32, - "32-bit, max value = 0xFFFFFFFF" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_0, - "1" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_1, - "2" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_2, - "3" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_3, - "4" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_4, - "5" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_5, - "6" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_6, - "7" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_7, - "8" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_8, - "9" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_9, - "10" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_10, - "11" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_11, - "12" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_12, - "13" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_13, - "14" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_14, - "15" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_15, - "16" - ) -MSG_HASH( - MENU_ENUM_LABEL_RUMBLE_PORT_16, - "All" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_CONT, - "Start or Continue Cheat Search" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_RESTART, - "Start or Restart Cheat Search" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EXACT, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LT, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GT, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQ, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GTE, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LTE, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_NEQ, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQPLUS, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQMINUS, - "Search Memory For Values" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES, - "Add the %u Matches to Your List" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_VIEW_MATCHES, - "View the List of %u Matches" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_CREATE_OPTION, - "Create Code From This Match" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_OPTION, - "Delete This Match" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_TOP, - "Add New Code to Top" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BOTTOM, - "Add New Code to Bottom" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_ALL, - "Delete All Codes" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_RELOAD_CHEATS, - "Reload Game-Specific Cheats" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL, - "Equal to %u (%X)" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL, - "Less Than Before" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL, - "Greater Than Before" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL, - "Less Than or Equal To Before" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL, - "Greater Than or Equal To Before" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL, - "Equal to Before" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL, - "Not Equal to Before" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL, - "Equal to Before+%u (%X)" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL, - "Equal to Before-%u (%X)" - ) -MSG_HASH( - MENU_ENUM_LABEL_CHEAT_SEARCH_SETTINGS, - "Start or Continue Cheat Search" - ) -MSG_HASH( - MSG_CHEAT_INIT_SUCCESS, - "Successfully started cheat search" - ) -MSG_HASH( - MSG_CHEAT_INIT_FAIL, - "Failed to start cheat search" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_NOT_INITIALIZED, - "Searching has not been initialized/started" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_FOUND_MATCHES, - "New match count = %u" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEAT_BIG_ENDIAN, - "Big Endian" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS, - "Added %u matches" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL, - "Failed to add matches" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS, - "Created code from match" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_ADD_MATCH_FAIL, - "Failed to create code" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS, - "Deleted match" - ) -MSG_HASH( - MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY, - "Not enough room. The total number of cheats you can have is 100." - ) -MSG_HASH( - MSG_CHEAT_ADD_TOP_SUCCESS, - "New cheat added to top of list." - ) -MSG_HASH( - MSG_CHEAT_ADD_BOTTOM_SUCCESS, - "New cheat added to bottom of list." - ) -MSG_HASH( - MSG_CHEAT_DELETE_ALL_INSTRUCTIONS, - "Press right five times to delete all cheats." - ) -MSG_HASH( - MSG_CHEAT_DELETE_ALL_SUCCESS, - "All cheats deleted." - ) -MSG_HASH( - MSG_CHEAT_ADD_BEFORE_SUCCESS, - "New cheat added before this one." - ) -MSG_HASH( - MSG_CHEAT_ADD_AFTER_SUCCESS, - "New cheat added after this one." - ) -MSG_HASH( - MSG_CHEAT_COPY_BEFORE_SUCCESS, - "Cheat copied before this one." - ) -MSG_HASH( - MSG_CHEAT_COPY_AFTER_SUCCESS, - "Cheat copied after this one." - ) -MSG_HASH( - MSG_CHEAT_DELETE_SUCCESS, - "Cheat deleted." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PROGRESS, - "Progress:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_LIST_MAX_COUNT, - "\"All Playlists\" max list entries:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_GRID_MAX_COUNT, - "\"All Playlists\" max grid entries:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SHOW_HIDDEN_FILES, - "Εμφάνιση κρυφών αρχείων και φακέλων:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_NEW_PLAYLIST, - "Νέα Λίστα Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ENTER_NEW_PLAYLIST_NAME, - "Please enter the new playlist name:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DELETE_PLAYLIST, - "Διαγραφή Λίστας Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_RENAME_PLAYLIST, - "Μετονομασία Λίστας Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST, - "Are you sure you want to delete the playlist \"%1\"?" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_QUESTION, - "Question" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_DELETE_FILE, - "Could not delete file." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE, - "Could not rename file." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_GATHERING_LIST_OF_FILES, - "Gathering list of files..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ADDING_FILES_TO_PLAYLIST, - "Adding files to playlist..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY, - "Playlist Entry" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_NAME, - "Όνομα:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH, - "Path:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_CORE, - "Πυρήνας:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_DATABASE, - "Database:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS, - "Extensions:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS_PLACEHOLDER, - "(space-separated; includes all by default)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_FILTER_INSIDE_ARCHIVES, - "Filter inside archives" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS, - "(used to find thumbnails)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM, - "Are you sure you want to delete the item \"%1\"?" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, - "Please choose a single playlist first." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DELETE, - "Delete" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY, - "Add Entry..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ADD_FILES, - "Add File(s)..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER, - "Add Folder..." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_EDIT, - "Edit" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SELECT_FILES, - "Select Files" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER, - "Select Folder" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE, - "" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY, - "Error updating playlist entry." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS, - "Please fill out all required fields." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_NIGHTLY, - "Update RetroArch (nightly)" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FINISHED, - "RetroArch updated successfully. Please restart the application for the changes to take effect." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FAILED, - "Update failed." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT_CONTRIBUTORS, - "Contributors" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CURRENT_SHADER, - "Current shader" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MOVE_DOWN, - "Move Down" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MOVE_UP, - "Move Up" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_LOAD, - "Load" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SAVE, - "Save" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_REMOVE, - "Remove" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_APPLY, - "Apply" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SHADER_ADD_PASS, - "Add Pass" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES, - "Clear All Passes" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_SHADER_NO_PASSES, - "No shader passes." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_RESET_PASS, - "Reset Pass" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_RESET_ALL_PASSES, - "Reset All Passes" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_RESET_PARAMETER, - "Reset Parameter" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_THUMBNAIL, - "Download thumbnail" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALREADY_IN_PROGRESS, - "A download is already in progress." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST, - "Start on playlist:" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS, - "Λήψη Όλων των Σκίτσων" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_ENTIRE_SYSTEM, - "Όλο το Σύστημα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_THIS_PLAYLIST, - "Αυτή η Λίστα Αναπαραγωγής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_PACK_DOWNLOADED_SUCCESSFULLY, - "Επιτυχής λήψη σκίτσων." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_PLAYLIST_THUMBNAIL_PROGRESS, - "Πέτυχαν: %1 Απέτυχαν: %2" - ) -MSG_HASH( - MSG_DEVICE_CONFIGURED_IN_PORT, - "Διαμορφώθηκε στην θύρα:" - ) -MSG_HASH( - MSG_FAILED_TO_SET_DISK, - "Αποτυχία ορισμού δίσκου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QT_CORE_OPTIONS, - "Επιλογές Πυρήνα" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_ADAPTIVE_VSYNC, - "Προσαρμοστικό Vsync" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, - "Το V-Sync είναι ενεργοποιημένο μέχρι η επίδοση να πέσει κάτω από τον στόχο ρυθμού ανανέωσης. Μπορεί να μειώσει τα κολλήματα όταν η επίδοση πέφτει χαμηλότερα από τον κανονικό χρόνο και μπορεί να είναι πιο αποδοτικό ενεργειακά." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, - "CRT SwitchRes" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, - "Εξαγωγή ντόπιων, χαμηλής ανάλυσης σημάτων για χρήση με οθόνες CRT." - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, - "Εναλλάξτε μεταξύ αυτών των επιλογών εάν η εικόνα δεν είναι σωστά κεντραρισμένη στην οθόνη." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, - "Κεντράρισμα Άξωνα Χ" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Χρήση προσαρμοσμένου ρυθμού ανανέωσης προσδιορισμένου στο αρχείο διαμόρφωσης εάν χρειάζεται." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, - "Χρήση Προσαρμοσμένου Ρυθμού Ανανέωσης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "Επιλέξτε την θύρα εξόδου που είναι συνδεδεμένη με την οθόνη CRT." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, - "ID Οθόνης Εξόδου" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, - "Έναρξη Εγγραφής" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, - "Ξεκινάει την εγγραφή." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, - "Τέλος Εγγραφής" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, - "Σταματάει την εγγραφή." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, - "Έναρξη Απευθείας Μετάδοσης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_START_STREAMING, - "Ξεκινάει την απευθείας μετάδοση." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, - "Τέλος Απευθείας Μετάδοσης" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, - "Σταματάει την απευθείας μετάδοση." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_RECORDING_TOGGLE, - "Εγγραφή" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, - "Απευθείας Μετάδοση" - ) -MSG_HASH( - MSG_CHEEVOS_HARDCORE_MODE_DISABLED, - "A savestate was loaded, Achievements Hardcore Mode disabled for the current session. Restart to enable hardcore mode." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, - "Ποιότητα Εγγραφής" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, - "Ποιότητα Απευθείας Μετάδοσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STREAMING_URL, - "Σύνδεσμος Απευθείας Μετάδοσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, - "Θύρα UDP Απευθείας Μετάδοσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, - "Twitch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, - "YouTube" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, - "Κλειδί Απευθείας Μετάδοσης Twitch" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, - "Κλειδί Απευθείας Μετάδοσης YouTube" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STREAMING_MODE, - "Μέσο Απευθείας Μετάδοσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, - "Τίτλος Απευθείας Μετάδοσης" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, - "Χωριστά Joy-Con" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, - "Επαναφορά Προεπιλογών" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, - "Επαναφορά της τρέχουσας διαμόρφωσης στις προεπιλεγμένες ρυθμίσεις." - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, - "OK" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, - "Χρώμα Θέματος Μενού" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, - "Basic White" - ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, - "Basic Black" - ) -MSG_HASH( - MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, - "Select a different color theme." - ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use preferred system color theme") -MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") +MSG_HASH( + MSG_COMPILER, + "Μεταγλωττιστής" + ) +MSG_HASH( + MSG_UNKNOWN_COMPILER, + "Άγνωστος Μεταγλωττιστής" + ) +MSG_HASH( + MSG_NATIVE, + "Ντόπιος" + ) +MSG_HASH( + MSG_DEVICE_DISCONNECTED_FROM_PORT, + "Η συσκευή αποσυνδέθηκε από την θύρα" + ) +MSG_HASH( + MSG_UNKNOWN_NETPLAY_COMMAND_RECEIVED, + "Λήφθηκε άγνωστη εντολή netplay" + ) +MSG_HASH( + MSG_FILE_ALREADY_EXISTS_SAVING_TO_BACKUP_BUFFER, + "Το αρχείο υπάρχει ήδη. Αποθήκευση σε εφεδρική ενδιάμεση μνήμη." + ) +MSG_HASH( + MSG_GOT_CONNECTION_FROM, + "Λήφθηκε σύνδεση από: \"%s\"" + ) +MSG_HASH( + MSG_GOT_CONNECTION_FROM_NAME, + "Λήφθηκε σύνδεση από: \"%s (%s)\"" + ) +MSG_HASH( + MSG_PUBLIC_ADDRESS, + "Δημόσια διεύθυνση" + ) +MSG_HASH( + MSG_NO_ARGUMENTS_SUPPLIED_AND_NO_MENU_BUILTIN, + "Δεν παρασχέθηκε διαφωνία και δεν υπάρχει ενσωματωμένο μενού, εμφάνιση βοήθειας..." + ) +MSG_HASH( + MSG_SETTING_DISK_IN_TRAY, + "Τοποθέτηση δίσκου στην μονάδα δίσκου" + ) +MSG_HASH( + MSG_WAITING_FOR_CLIENT, + "Αναμονή για πελάτη ..." + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME, + "Αποσυνδεθήκατε από το παιχνίδι" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N, + "Έχετε συνδεθεί ως παίκτης %u" + ) +MSG_HASH( + MSG_NETPLAY_YOU_HAVE_JOINED_WITH_INPUT_DEVICES_S, + "Έχετε συνδεθεί με συσκευές εισόδου %.*s" + ) +MSG_HASH( + MSG_NETPLAY_PLAYER_S_LEFT, + "Ο παίκτης %.*s αποσυνδέθηκε από το παιχνίδι" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_AS_PLAYER_N, + "%.*s συνδέθηκε ως παίκτης %u" + ) +MSG_HASH( + MSG_NETPLAY_S_HAS_JOINED_WITH_INPUT_DEVICES_S, + "%.*s συνδέθηκε με συσκευές εισόδου %.*s" + ) +MSG_HASH( + MSG_NETPLAY_NOT_RETROARCH, + "Η προσπάθεια σύνδεσης netplay απέτυχε επειδή ο συμπέκτης δεν χρησιμοποιεί το RetroArch ή χρησιμοποιεί πιο παλιά έκδοση." + ) +MSG_HASH( + MSG_NETPLAY_OUT_OF_DATE, + "Ο συμπαίκτης χρησιμοποιεί πιο παλιά έκδοση RetroArch. Αδύνατη η σύνδεση." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_VERSIONS, + "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Ο συμπαίκτης netplay χρησιμοποιεί διαφορετική έκδοση του RetroArch. Εάν προκύψουν προβλήματα χρησιμοποιήστε την ίδια έκδοση." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORES, + "Ο συμπαίκτης netplay χρησιμοποιεί διαφορειτκό πυρήνα. Αδύνατη η σύνδεση." + ) +MSG_HASH( + MSG_NETPLAY_DIFFERENT_CORE_VERSIONS, + "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Ο συμπαίκτης netplay χρησιμοποιεί διαφορετική έκδοση του πυρήνα. Εάν προκύψουν προβλήματα χρησιμοποιήστε την ίδια έκδοση." + ) +MSG_HASH( + MSG_NETPLAY_ENDIAN_DEPENDENT, + "Αυτός ο πυρήνας δεν υποστηρίζει σύνδεση διαφορετικών πλατφόρμων για netplay ανάμεσα σε αυτά τα συστήματα" + ) +MSG_HASH( + MSG_NETPLAY_PLATFORM_DEPENDENT, + "Αυτός ο πυρήνας δεν υποστηρίζει σύνδεση διαφορετικών πλατφόρμων για netplay" + ) +MSG_HASH( + MSG_NETPLAY_ENTER_PASSWORD, + "Εισάγετε κωδικό διακομιστή netplay:" + ) +MSG_HASH( + MSG_NETPLAY_INCORRECT_PASSWORD, + "Λάθος κωδικός" + ) +MSG_HASH( + MSG_NETPLAY_SERVER_NAMED_HANGUP, + "\"%s\" αποσυνδέθηκε" + ) +MSG_HASH( + MSG_NETPLAY_SERVER_HANGUP, + "Ένας πελάτης netplay έχει αποσυνδεθεί" + ) +MSG_HASH( + MSG_NETPLAY_CLIENT_HANGUP, + "Αποσύνδεση netplay" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_UNPRIVILEGED, + "Δεν έχετε άδεια για να παίξετε" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NO_SLOTS, + "Δεν υπάρχουν κενές θέσεις παικτών" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY_NOT_AVAILABLE, + "Οι συσκευές εισόδου που ζητήθηκαν δεν είναι διαθέσιμες" + ) +MSG_HASH( + MSG_NETPLAY_CANNOT_PLAY, + "Δεν μπορεί να γίνει αλλαγή σε κατάσταση παιχνιδιού" + ) +MSG_HASH( + MSG_NETPLAY_PEER_PAUSED, + "Ο συμπαίκτης netplay \"%s\" έκανε παύση" + ) +MSG_HASH( + MSG_NETPLAY_CHANGED_NICK, + "Το ψευδώνυμο σας άλλαξε σε \"%s\"" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHARED_CONTEXT, + "Give hardware-rendered cores their own private context. Avoids having to assume hardware state changes inbetween frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SETTINGS, + "Προσαρμόζει τις εμφανισιακές ρυθμίσεις της οθόνης του μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC, + "Σκληρός συγχρονισμός επεξεργαστή και κάρτας γραφικών. Μειώνει την καθυστέρηση με τίμημα την επίδοση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_THREADED, + "Βελτιώνει την επίδοση με τίμημα την καθυστέρηση και περισσότερα κολλήματα στο βίντεο. Χρησιμοποιείστε μόνο εάν δεν μπορείτε να αποκτήσετε πλήρη ταχύτητα με άλλον τρόπο." + ) +MSG_HASH( + MSG_AUDIO_VOLUME, + "Ένταση ήχου" + ) +MSG_HASH( + MSG_AUTODETECT, + "Αυτόματη ανίχνευση" + ) +MSG_HASH( + MSG_AUTOLOADING_SAVESTATE_FROM, + "Αυτόματη φόρτωση κατάστασης αποθήκευσης από" + ) +MSG_HASH( + MSG_CAPABILITIES, + "Ικανότητες" + ) +MSG_HASH( + MSG_CONNECTING_TO_NETPLAY_HOST, + "Σύνδεση με εξυπηρετητή netplay" + ) +MSG_HASH( + MSG_CONNECTING_TO_PORT, + "Σύνδεση στην θύρα" + ) +MSG_HASH( + MSG_CONNECTION_SLOT, + "Θέση σύνδεσης" + ) +MSG_HASH( + MSG_SORRY_UNIMPLEMENTED_CORES_DONT_DEMAND_CONTENT_NETPLAY, + "Συγγνώμη, μη εφαρμοσμένο: πυρήνες που δεν απαιτούν περιεχόμενο δεν μπορούν να συμμετέχουν στο netplay." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_PASSWORD, + "Κωδικός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_SETTINGS, + "Επιτεύγματα Λογαριασμού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_USERNAME, + "Όνομα Χρήστη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST, + "Λογαριασμοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_LIST_END, + "Accounts List Endpoint" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_RETRO_ACHIEVEMENTS, + "RetroAchievements" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST, + "Επιτεύγματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_PAUSE, + "Παύση Σκληροπυρηνικής Λειτουργίας Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_RESUME, + "Συνέχιση Σκληροπυρηνικής Λειτουργίας Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE, + "Επιτεύγματα (Σκληροπυρηνικά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST, + "Σάρωση Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATIONS_LIST, + "Διαμορφώσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TAB, + "Εισαγωγή περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_TAB, + "Δωμάτια Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ASK_ARCHIVE, + "Ερώτηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ASSETS_DIRECTORY, + "Εργαλεία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_BLOCK_FRAMES, + "Φραγή Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DEVICE, + "Συσκευή Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DRIVER, + "Οδηγός Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_DSP_PLUGIN, + "Πρόσθετο Ήχου DSP" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE, + "Ενεργοποίηση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_FILTER_DIR, + "Φίλτρα Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TURBO_DEADZONE_LIST, + "Turbo/Νεκρή Ζώνη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_LATENCY, + "Καθυστέρηση Ήχου (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MAX_TIMING_SKEW, + "Μέγιστη Χρονική Διαστρέβλωση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MUTE, + "Σίγαση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_OUTPUT_RATE, + "Συχνότητα Εξόδου Ήχου (Hz)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RATE_CONTROL_DELTA, + "Δυναμικός Έλεγχος Βαθμού Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_DRIVER, + "Οδηγός Επαναδειγματολήπτη Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS, + "Ήχος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_SYNC, + "Συγχρονισμός Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_VOLUME, + "Ένταση Ήχου (dB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_EXCLUSIVE_MODE, + "Αποκλειστική Λειτουργία WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_FLOAT_FORMAT, + "Ασταθής Μορφή WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_WASAPI_SH_BUFFER_LENGTH, + "Μήκος Κοινόχρηστης Ενδιάμεσης Μνήμης WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTOSAVE_INTERVAL, + "Διάστημα Αυτόματης Αποθήκευσης SaveRAM" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_OVERRIDES_ENABLE, + "Φόρτωση Αρχείων Παράκαμψης Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_REMAPS_ENABLE, + "Φόρτωση Αρχείων Αναδιοργάνωσης Πλήτρκων Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE, + "Φόρτωση Προεπιλογών Σκιάσεων Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, + "Πίσω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM, + "Επιβεβαίωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT, + "Έξοδος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN, + "Μετακίνηση Προς Τα Κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP, + "Μετακίνηση Προς Τα Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START, + "Εκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD, + "Ενεργοποίηση/Απενεργοποίηση Πληκτρολογίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU, + "Ενεργοποίηση/Απενεργοποίηση Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS, + "Βασικός χειρισμός μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_CONFIRM, + "Επιβεβαίωση/ΟΚ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_INFO, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_QUIT, + "Έξοδος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_SCROLL_UP, + "Μετακίνηση Προς Τα Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_START, + "Προεπιλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_KEYBOARD, + "Ενεργοποίηση/Απενεργοποίηση Πληκτρολογίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_ENUM_CONTROLS_TOGGLE_MENU, + "Ενεργοποίηση/Απενεργοποίηση Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BLOCK_SRAM_OVERWRITE, + "Απενεργοποίηση αντικατάστασης SaveRAM κατά την φάση φόρτωσης κατάστασης αποθήκευσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BLUETOOTH_ENABLE, + "Ενεργοποίηση Bluetooth" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BUILDBOT_ASSETS_URL, + "Σύνδεσμος Εργαλείων του Buildbot" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CACHE_DIRECTORY, + "Κρυφή Μνήμη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CAMERA_ALLOW, + "Επίτρεψη Κάμερας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CAMERA_DRIVER, + "Οδηγός Κάμερας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT, + "Απάτη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_CHANGES, + "Εφαρμογή Αλλαγών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_SEARCH, + "Έναρξη Αναζήτησης Για Νέους Κωδικούς Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CONTINUE_SEARCH, + "Συνέχιση Αναζήτησης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DATABASE_PATH, + "Αρχεία Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE, + "Αρχείο Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD, + "Φόρτωση Αρχείου Απάτης (Αντικατάσταση)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_LOAD_APPEND, + "Φόρτωση Αρχείου Απάτης (Προσάρτηση)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS, + "Αποθήκευση Αρχείου Απάτης Ως" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_NUM_PASSES, + "Φορές Περάσματος Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_DESCRIPTION, + "Περιγραφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_HARDCORE_MODE_ENABLE, + "Σκληροπυρηνική Λειτουργία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LEADERBOARDS_ENABLE, + "Κατατάξεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_BADGES_ENABLE, + "Εμβλήματα Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ACHIEVEMENTS, + "Κλειδωμένα Επιτεύγματα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY, + "Κλειδωμένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_SETTINGS, + "RetroAchievements" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_TEST_UNOFFICIAL, + "Δοκιμή Ανεπίσημων Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS, + "Ξεκλειδωμένα Επιτεύγματα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY, + "Ξεκλείδωτο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, + "Σκληροπυρηνικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_VERBOSE_ENABLE, + "Βερμπαλιστική Λειτουργία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_AUTO_SCREENSHOT, + "Αυτόματο Στιγμιότυπο Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT, + "Κλείσιμο Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIG, + "Διαμόρφωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATIONS, + "Φόρτωση Διαμορφώσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS, + "Διαμόρφωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONFIG_SAVE_ON_EXIT, + "Απόθηκευση Διαμόρφωσης στην Έξοδο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST, + "Συλλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_DATABASE_DIRECTORY, + "Βάσεις Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_DIR, + "Περιεχόμενο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_SIZE, + "Μέγεθος Λίστας Ιστορικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_REMOVE, + "Επίτρεψη αφαίρεσης καταχωρήσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS, + "Γρήγορο Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIR, + "Λήψεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY, + "Λήψεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_CHEAT_OPTIONS, + "Απάτες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_COUNTERS, + "Μετρητές Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_ENABLE, + "Εμφάνιση ονόματος πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFORMATION, + "Πληροφορίες πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS, + "Δημιουργοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES, + "Κατηγορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_LABEL, + "Επιγραφή πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_NAME, + "Όνομα πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE, + "Firmware(s)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES, + "Άδεια(ες)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS, + "Άδειες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS, + "Υποστηριζόμενες επεκτάσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_MANUFACTURER, + "Κατασκευαστής συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_NAME, + "Όνομα συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS, + "Χειρισμοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_LIST, + "Φόρτωση Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_OPTIONS, + "Επιλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_SETTINGS, + "Πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_SET_SUPPORTS_NO_CONTENT_ENABLE, + "Αυτόματη Έναρξη Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, + "Αυτόματη εξαγωγή ληφθέντος συμπιεσμένου αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_BUILDBOT_URL, + "Σύνδεσμος Buildbot Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_LIST, + "Ενημέρωση Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_UPDATER_SETTINGS, + "Ενημερωτής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CPU_ARCHITECTURE, + "Αρχιτεκτονική Επεξεργαστή:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CPU_CORES, + "Πυρήνες Επεξεργαστή:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CURSOR_DIRECTORY, + "Δρομείς" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CURSOR_MANAGER, + "Διαχειριστής Δρομέα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CUSTOM_RATIO, + "Προτιμώμενη Αναλογία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_MANAGER, + "Διαχειριστής Βάσης Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_SELECTION, + "Επιλογή Βάσης Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DELETE_ENTRY, + "Κατάργηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FAVORITES, + "Ευρετήριο έναρξης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT, + "<Ευρετήριο περιεχομένων>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, + "<Προκαθορισμένο>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, + "<Κανένα>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, + "Το ευρετήριο δεν βρέθηκε." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, + "Ευρετήρια" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, + "Disk Cycle Tray Status" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, + "Disk Image Append" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_INDEX, + "Disk Index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISK_OPTIONS, + "Disk Control" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DONT_CARE, + "Don't care" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST, + "Λήψεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE, + "Λήψη Πυρήνα..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE_CONTENT, + "Λήψη Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_ENABLE, + "DPI Override Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE, + "DPI Override" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DRIVER_SETTINGS, + "Οδηγοί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DUMMY_ON_CORE_SHUTDOWN, + "Φόρτωση Dummy στο Κλείσιμο Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHECK_FOR_MISSING_FIRMWARE, + "Έλεγχος για απών Firmware Πριν την Φόρτωση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, + "Δυναμικό Φόντο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPERS_DIRECTORY, + "Δυναμικά Φόντα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_ENABLE, + "Ενεργοποίηση Επιτευγμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, + "Χρώμα καταχώρησης μενού όταν το ποντίκι βρίσκεται από πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, + "Χρώμα καταχώρησης μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FALSE, + "Ψευδές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, + "Μέγιστη Ταχύτητα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, + "Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FPS_SHOW, + "Προβολή Ρυθμού Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, + "Περιορισμός Μέγιστης Ταχύτητας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VRR_RUNLOOP_ENABLE, + "Συγχρονισμός με τον Ακριβή Ρυθμό Καρέ του Περιεχομένου (G-Sync, FreeSync)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS, + "Περιορισμός Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS, + "Frontend Counters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS, + "Φόρτωση Επιλογών Πυρήνα Βάση Συγκεκριμένου Περιεχομένου Αυτόματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_CREATE, + "Δημιουργία αρχείου επιλογών παιχνιδιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE, + "Αποθήκευση αρχείου επιλογών παιχνιδιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP, + "Βοήθεια" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING, + "Αντιμετώπιση Προβλημάτων Ήχου/Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD, + "Αλλαγή Επικαλύμματος Εικονικού Χειριστηρίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_CONTROLS, + "Βασικός Χειρισμός Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_LIST, + "Βοήθεια" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_LOADING_CONTENT, + "Φόρτωση Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT, + "Σάρωση Για Περιεχόμενο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HELP_WHAT_IS_A_CORE, + "Τι Είναι Ο Πυρήνας;" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HISTORY_LIST_ENABLE, + "Ενεργοποίηση Λίστας Ιστορικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HISTORY_TAB, + "Ιστορικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU, + "Οριζόντιο Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_IMAGES_TAB, + "Εικόνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INFORMATION, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INFORMATION_LIST, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE, + "Τύπος Αναλογικού Σε Ψηφιακό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU, + "Όλοι Οι Χρήστες Χειρίζονται Το Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X, + "Αριστερό Αναλογικό X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_MINUS, + "Αριστερό Αναλογικό X- (αριστερά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_PLUS, + "Αριστερό Αναλογικό X+ (δεξιά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y, + "Αριστερό Αναλογικό Y" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_MINUS, + "Αριστερό Αναλογικό Y- (πάνω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_PLUS, + "Αριστερό Αναλογικό Y+ (κάτω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X, + "Δεξί Αναλογικό X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_MINUS, + "Δεξί Αναλογικό X- (αριστερά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X_PLUS, + "Δεξί Αναλογικό X+ (δεξιά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y, + "Δεξί Αναλογικό Y" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_MINUS, + "Δεξί Αναλογικό Y- (πάνω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_PLUS, + "Δεξί Αναλογικό Y+ (κάτω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_TRIGGER, + "Σκανδάλη Όπλου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_RELOAD, + "Γέμισμα Όπλου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_A, + "Όπλο Aux A" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_B, + "Όπλο Aux B" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_C, + "Όπλο Aux C" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_START, + "Όπλο Start" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_SELECT, + "Όπλο Select" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_UP, + "Όπλο D-pad Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_DOWN, + "Όπλο D-pad Κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_LEFT, + "Όπλο D-pad Αριστερά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_RIGHT, + "Όπλο D-pad Δεξιά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, + "Ενεργοποίηση Αυτόματης Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, + "Νεκρή Ζώνη Αναλογικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, + "Εναλλαγή Κουμπιών Επιβεβαίωσης & Ακύρωσης Στο Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, + "Σύνδεση Όλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL, + "Επαναφορά Συνδέσεων Όλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT, + "Λήξη Χρόνου Σύνδεσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_BIND_HOLD, + "Κράτημα Σύνδεσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_HIDE_UNBOUND, + "Hide Unbound Core Input Descriptors" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DESCRIPTOR_LABEL_SHOW, + "Display Input Descriptor Labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX, + "Κατάλογος Συσκευών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE, + "Τύπος Συσκευής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX, + "Κατάλογος Ποντικιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DRIVER, + "Οδηγός Εισαγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_DUTY_CYCLE, + "Duty Cycle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_BINDS, + "Σύνδεση Πλήκτρων Εντολών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_ICADE_ENABLE, + "Keyboard Gamepad Mapping Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_A, + "Κουμπί A (δεξιά)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B, + "Κουμπί B (κάτω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_DOWN, + "D-pad κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L2, + "Κουμπί L2 (σκανδάλι)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L3, + "Κουμπί L3 (αντίχειρας)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_L, + "Κουμπί L (πίσω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_LEFT, + "D-pad αριστερό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R2, + "Κουμπί R2 (σκανδάλι)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R3, + "Κουμπί R3 (αντίχειρας)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_R, + "Κουμπί R (πίσω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_RIGHT, + "D-pad δεξί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_SELECT, + "Κουμπί Select" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_START, + "Κουμπί Start" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_UP, + "D-pad πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_X, + "Κουμπί X (πάνω)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_Y, + "Κουμπί Y (αριστερό)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_KEY, + "(Κουμπί: %s)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_LEFT, + "Ποντίκι 1" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_RIGHT, + "Ποντίκι 2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_MIDDLE, + "Ποντίκι 3" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON4, + "Ποντίκι 4" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_BUTTON5, + "Ποντίκι 5" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_UP, + "Ροδέλα Πάνω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_WHEEL_DOWN, + "Ροδέλα Κάτω" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_UP, + "Ροδέλα Αριστερά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_DOWN, + "Ροδέλα Δεξιά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE, + "Keyboard Gamepad Mapping Type" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS, + "Μέγιστοι Χρήστες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Συνδιασμός Πλήκτρων Χειριστηρίου για Άνοιγμα Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, + "Κατάλογος απάτης -" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_PLUS, + "Κατάλογος απάτης +" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_TOGGLE, + "Απάτες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_EJECT_TOGGLE, + "Εξαγωγή δίσκου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_NEXT, + "Επόμενος δίσκος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_DISK_PREV, + "Προηγούμενος δίσκος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, + "Ενεργοποίηση πλήκτρων εντολών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_HOLD_KEY, + "Παύση γρήγορης κίνησης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_KEY, + "Γρήγορη κίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, + "Frameadvance" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, + "Πλήρης οθόνη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, + "Κλείδωμα ποντικιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, + "Εστίαση παιχνιδιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, + "Μενού επιφάνειας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, + "Φόρτωση κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, + "Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_BSV_RECORD_TOGGLE, + "Input replay movie record toggle" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, + "Σίγαση Ήχου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, + "Εναλλαγή κατάστασης παιχνιδιού/θεατή Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, + "Πληκτρολόγιο οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, + "Επόμενο επικάλλυμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, + "Παύση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, + "Έξοδος από το RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, + "Επαναφορά παιχνιδιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, + "Επιστροφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_DETAILS, + "Λεπτομέρειες Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_SEARCH, + "Start or Continue Cheat Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, + "Αποθήκευση κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, + "Λήψη Στιγμιότυπου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, + "Επόμενη σκίαση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, + "Προηγούμενη σκίαση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_HOLD_KEY, + "Παύση αργής κίνησης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_KEY, + "Αργή κίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, + "Θέση κατάστασης αποθήκευσης -" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, + "Θέση κατάστασης αποθήκευσης +" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, + "Ένταση -" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, + "Ένταση +" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, + "Εμφάνιση Επικαλύμματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, + "Απόκρυψη Επικαλύμματος Στο Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "Εμφάνιση Εισαγωγών Στο Επικάλλυμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "Εμφάνιση Θύρας Εισαγωγών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, + "Τύπος Συμπεριφοράς Συγκέντρωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, + "Νωρίς" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, + "Αργά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, + "Φυσιολογικά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_PREFER_FRONT_TOUCH, + "Prefer Front Touch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY, + "Input Remapping" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, + "Remap Binds Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG, + "Αποθήκευση Αυτόματης Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS, + "Εισαγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE, + "Ενεργοποίηση Μικρού Πληκτρολογίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_TOUCH_ENABLE, + "Ενεργοποίηση Αφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_TURBO_ENABLE, + "Ενεργοποίηση Turbo" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, + "Turbo Period" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS, + "Σύνδεση Πλήκτρων Εισόδου Χρήστη %u" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LATENCY_SETTINGS, + "Καθυστέρηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INTERNAL_STORAGE_STATUS, + "Internal storage status" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR, + "Input Autoconfig" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_JOYPAD_DRIVER, + "Οδηγός Joypad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LAKKA_SERVICES, + "Υπηρεσίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_CHINESE_SIMPLIFIED, + "Chinese (Simplified)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_CHINESE_TRADITIONAL, + "Chinese (Traditional)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_DUTCH, + "Dutch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ENGLISH, + "English" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ESPERANTO, + "Esperanto" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_FRENCH, + "French" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_GERMAN, + "German" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ITALIAN, + "Italian" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_JAPANESE, + "Japanese" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_KOREAN, + "Korean" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_POLISH, + "Polish" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_BRAZIL, + "Portuguese (Brazil)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_PORTUGUESE_PORTUGAL, + "Portuguese (Portugal)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_RUSSIAN, + "Russian" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_SPANISH, + "Spanish" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, + "Vietnamese" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_ARABIC, + "Arabic" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LANG_GREEK, + "Ελληνικά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, + "Αριστερό Αναλογικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, + "Πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, + "Πληροφορίες Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LIBRETRO_LOG_LEVEL, + "Core Logging Level" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LINEAR, + "Γραμμικός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_ARCHIVE, + "Φόρτωση Αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY, + "Φόρτωση Πρόσφατου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST, + "Φόρτωση Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOAD_STATE, + "Φόρτωση Κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOCATION_ALLOW, + "Επίτρεψη Τοποθεσίας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOCATION_DRIVER, + "Οδηγός Τοποθεσίας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOGGING_SETTINGS, + "Αρχείο Καταγραφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LOG_VERBOSITY, + "Logging Verbosity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MAIN_MENU, + "Κεντρικό Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MANAGEMENT, + "Ρυθμίσεις Βάσης Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME, + "Χρώμα Θέματος Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE, + "Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE_GREY, + "Μπλε Γκρι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_DARK_BLUE, + "Σκούρο Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_GREEN, + "Πράσινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_NVIDIA_SHIELD, + "Shield" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED, + "Κόκκινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW, + "Κίτρινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_FOOTER_OPACITY, + "Footer Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_HEADER_OPACITY, + "Header Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_DRIVER, + "Οδηγός Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_ENUM_THROTTLE_FRAMERATE, + "Throttle Menu Framerate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS, + "Ρυθμίσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_LINEAR_FILTER, + "Menu Linear Filter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_HORIZONTAL_ANIMATION, + "Horizontal Animation" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SETTINGS, + "Εμφάνιση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, + "Φόντο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY, + "Background opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MISSING, + "Λείπει" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MORE, + "..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MOUSE_ENABLE, + "Υποστήριξη Ποντικιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MULTIMEDIA_SETTINGS, + "Πολυμέσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MUSIC_TAB, + "Μουσική" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, + "Φιλτράρισμα άγνωστων επεκτάσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NAVIGATION_WRAPAROUND, + "Navigation Wrap-Around" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NEAREST, + "Κοντινότερο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY, + "Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ALLOW_SLAVES, + "Allow Slave-Mode Clients" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_CHECK_FRAMES, + "Netplay Check Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "Input Latency Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "Input Latency Frames Range" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_DELAY_FRAMES, + "Netplay Delay Frames" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT, + "Disconnect from netplay host" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, + "Ενεργοποίηση Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, + "Σύνδεση σε οικοδεσπότη netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, + "Έναρξη netplay ως οικοδεσπότης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Λήξη netplay ως οικοδεσπότης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, + "Διέυθυνση Διακομιστή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, + "Σάρωση τοπικού δικτύου Scan local network" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, + "Netplay Client Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_NICKNAME, + "Όνομα Χρήστη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_PASSWORD, + "Κωδικός Διακομιστή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_PUBLIC_ANNOUNCE, + "Δημόσια Ανακοίνωση Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_REQUEST_DEVICE_I, + "Request Device %u" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_REQUIRE_SLAVES, + "Disallow Non-Slave-Mode Clients" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SETTINGS, + "Ρυθμίσεις Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG, + "Analog Input Sharing" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_MAX, + "Μέγιστο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_ANALOG_AVERAGE, + "Μέσος Όρος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL, + "Digital Input Sharing" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_OR, + "Κοινοποίηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_XOR, + "Grapple" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_DIGITAL_VOTE, + "Ψήφος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NONE, + "Κανείς" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SHARE_NO_PREFERENCE, + "Καμία προτίμηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_START_AS_SPECTATOR, + "Netplay Spectator Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_STATELESS_MODE, + "Netplay Stateless Mode" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATE_PASSWORD, + "Server Spectate-Only Password" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_SPECTATOR_MODE_ENABLE, + "Netplay Spectator Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_TCP_UDP_PORT, + "Netplay TCP Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_NAT_TRAVERSAL, + "Netplay NAT Traversal" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_CMD_ENABLE, + "Network Commands" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_CMD_PORT, + "Network Command Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION, + "Πληροφορίες Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_ENABLE, + "Χειριστήριο Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_REMOTE_PORT, + "Network Remote Base Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_SETTINGS, + "Δίκτυο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO, + "Όχι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NONE, + "Τίποτα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE, + "Μ/Δ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY, + "Δεν υπάρχουν επιτεύγματα προς προβολή." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORE, + "Κανένας Πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE, + "Δεν υπάρχουν διαθέσιμοι πυρήνες." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORE_INFORMATION_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες πληροφορίες πυρήνα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες επιλογές πυρήνα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY, + "Δεν υπάρχουν καταχωρήσεις προς εμφάνιση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_HISTORY_AVAILABLE, + "Δεν υπάρχει διαθέσιμο ιστορικό." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες πληροφορίες." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_ITEMS, + "Δεν υπάρχουν αντικείμενα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_NETPLAY_HOSTS_FOUND, + "Δεν βρέθηκαν εξυπηρετητές netplay." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_NETWORKS_FOUND, + "Δεν βρέθηκαν δίκτυα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS, + "No performance counters." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_PLAYLISTS, + "Δεν βρέθηκαν λίστες αναπαραγωγής." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, + "Δεν υπάρχουν διαθέσιμες καταχωρήσεις στην λίστα αναπαραγωγής." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, + "Δεν βρέθηκαν ρυθμίσεις." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS, + "Δεν βρέθηκαν παράμετροι σκίασης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OFF, + "OFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ON, + "ON" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONLINE, + "Online" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER, + "Διαδικτυακός Ενημερωτής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, + "Οθόνη Απεικόνισης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS, + "Επικάλλυμα Οθόνης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS, + "Προσαρμογή Προσόψεων και Χειρισμών Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS, + "Ειδοποιήσεις Οθόνης Απεικόνισης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, + "Προσαρμόστε τις Ειδοποιήσεις Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE, + "Περιήγηση Αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OPTIONAL, + "Προεραιτικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY, + "Επικάλλυμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED, + "Αυτόματη Φόρτωση Προτιμώμενου Επικαλύμματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, + "Επικάλλυμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_OPACITY, + "Διαφάνεια Επικαλύμματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_PRESET, + "Προκαθορισμένο Επικάλλυμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_SCALE, + "Κλίμακα Επικαλύμματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS, + "Επικάλλυμα Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PAL60_ENABLE, + "Χρήση Λειτουργίας PAL60" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY, + "Προηγούμενο ευρετήριο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PAUSE_LIBRETRO, + "Παύση όταν ενεργοποιείται το μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PAUSE_NONACTIVE, + "Μην εκτελείτε στο παρασκήνιο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PERFCNT_ENABLE, + "Performance Counters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB, + "Λίστες Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, + "Λίστα Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, + "Λίστες Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, + "Υποστήριξη Αφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PORT, + "Θύρα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PRESENT, + "Present" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, + "Ιδιωτικότητα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, + "MIDI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, + "Έξοδος από RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, + "Analog supported" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_BBFC_RATING, + "BBFC Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CERO_RATING, + "CERO Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_COOP, + "Co-op supported" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CRC32, + "CRC32" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION, + "Description" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DEVELOPER, + "Developer" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_ISSUE, + "Edge Magazine Issue" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_RATING, + "Edge Magazine Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_EDGE_MAGAZINE_REVIEW, + "Edge Magazine Review" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ELSPA_RATING, + "ELSPA Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ENHANCEMENT_HW, + "Enhancement Hardware" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ESRB_RATING, + "ESRB Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FAMITSU_MAGAZINE_RATING, + "Famitsu Magazine Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_FRANCHISE, + "Franchise" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE, + "Genre" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_MD5, + "MD5" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME, + "Όνομα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ORIGIN, + "Origin" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PEGI_RATING, + "PEGI Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_PUBLISHER, + "Publisher" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_MONTH, + "Releasedate Month" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RELEASE_YEAR, + "Releasedate Year" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_RUMBLE, + "Rumble supported" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL, + "Serial" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SHA1, + "SHA1" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_START_CONTENT, + "Έναρξη Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RDB_ENTRY_TGDB_RATING, + "TGDB Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REBOOT, + "Επανεκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORDING_CONFIG_DIRECTORY, + "Recording Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORDING_OUTPUT_DIRECTORY, + "Recording Output" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORDING_SETTINGS, + "Εγγραφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_CONFIG, + "Custom Record Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAM_CONFIG, + "Custom Stream Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_DRIVER, + "Οδηγός Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_DRIVER, + "Οδηγός MIDI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_ENABLE, + "Ενεργοποίηση Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_PATH, + "Αποθήκευση Εγγραφής Ως..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY, + "Αποθήκευση Εγγραφών στο Ευρετήριο Εξαγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE, + "Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_LOAD, + "Load Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CORE, + "Save Core Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CONTENT_DIR, + "Save Content Directory Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_GAME, + "Save Game Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CORE, + "Delete Core Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_GAME, + "Delete Game Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CONTENT_DIR, + "Delete Game Content Directory Remap File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REQUIRED, + "Απαραίτητο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESTART_CONTENT, + "Επανεκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESTART_RETROARCH, + "Επανεκκίνηση RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESUME, + "Συνέχιση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESUME_CONTENT, + "Συνέχιση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETROKEYBOARD, + "RetroKeyboard" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETROPAD, + "RetroPad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETROPAD_WITH_ANALOG, + "RetroPad με Αναλογικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, + "Επιτεύγματα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, + "Ενεργοποίηση Επιστροφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_TOGGLE, + "Εφαρμογή Μετά Την Ενεργοποίηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_LOAD, + "Αυτόματη Εφαρμογή Απατών Κατά την Φόρτωση Παιχνιδιού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, + "Βαθμός Λεπτομέρειας Επιστροφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE, + "Μέγεθος Ενδιάμεσης Μνήμης Επιστροφής (MB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_BUFFER_SIZE_STEP, + "Βήμα Μεγέθους Ενδιάμεσης Μνήμης Επιστροφής (MB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, + "Επιστροφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SETTINGS, + "Ρυθμίσεις Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DETAILS_SETTINGS, + "Λεπτομέρειες Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_SETTINGS, + "Έναρξη ή Συνέχιση Αναζήτησης Απάτης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, + "Περιηγητής Αρχείων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, + "Config" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, + "Εμφάνιση Αρχικής Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, + "Δεξί Αναλογικό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, + "Προσθήκη στα Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, + "Προσθήκη στα Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION, + "Επαναφορά Συσχέτισης Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN, + "Εκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_MUSIC, + "Εκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE, + "Ενεργοποίηση SAMBA" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY, + "Αρχείο Αποθήκευσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_INDEX, + "Save State Auto Index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_LOAD, + "Auto Load State" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_AUTO_SAVE, + "Auto Save State" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_DIRECTORY, + "Savestate" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATE_THUMBNAIL_ENABLE, + "Savestate Thumbnails" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG, + "Αποθήκευση Τρέχουσας Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, + "Save Core Overrides" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, + "Save Content Directory Overrides" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, + "Save Game Overrides" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_NEW_CONFIG, + "Αποθήκευση Νέας Διαμόρφωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVE_STATE, + "ποθήκευση Κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS, + "Αποθήκευση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY, + "Σάρωση Ευρετηρίου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCAN_FILE, + "Σάρωση αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY, + "<Σάρωση Αυτού Του Ευρετηρίου>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY, + "Στιγμιότυπο Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, + "Ανάλυση Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SEARCH, + "Αναζήτηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SECONDS, + "δευτερόλεπτα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SETTINGS, + "Ρυθμίσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, + "Ρυθμίσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER, + "Σκίαση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_APPLY_CHANGES, + "Εφαμοργή Αλλαγών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS, + "Σκιάσεις" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, + "Κορδέλλα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, + "Κορδέλλα (απλοποιημένη)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SIMPLE_SNOW, + "Απλό Χιόνι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOW, + "Χιόνι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHOW_ADVANCED_SETTINGS, + "Εμφάνιση Ρυθμίσεων Για Προχωρημένους" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHOW_HIDDEN_FILES, + "Εμφάνιση Κρυφών Αρχείων και Φακέλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHUTDOWN, + "Τερματισμός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SLOWMOTION_RATIO, + "Slow-Motion Ratio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_ENABLED, + "Run-Ahead to Reduce Latency" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_FRAMES, + "Number of Frames to Run Ahead" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_SECONDARY_INSTANCE, + "RunAhead Use Second Instance" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUN_AHEAD_HIDE_WARNINGS, + "RunAhead Hide Warnings" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE, + "Sort Saves In Folders" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE, + "Sort Savestates In Folders" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVESTATES_IN_CONTENT_DIR_ENABLE, + "Write Savestates to Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SAVEFILES_IN_CONTENT_DIR_ENABLE, + "Write Saves to Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEMFILES_IN_CONTENT_DIR_ENABLE, + "System Files are in Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCREENSHOTS_IN_CONTENT_DIR_ENABLE, + "Write Screenshots to Content Dir" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SSH_ENABLE, + "Ενεργοποίηση SSH" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_START_CORE, + "Έναρξη Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_START_NET_RETROPAD, + "Έναρξη Απομακρυσμένου RetroPad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, + "Έναρξη Επεξεργαστή Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STATE_SLOT, + "Θέση Κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STATUS, + "Κατάσταση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STDIN_CMD_ENABLE, + "Εντολές stdin" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SUPPORTED_CORES, + "Προτεινόμενοι πυρήνες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SUSPEND_SCREENSAVER_ENABLE, + "Αναστολή Προφύλαξης Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_BGM_ENABLE, + "System BGM Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_DIRECTORY, + "Σύστημα/BIOS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFORMATION, + "Πληροφορίες Συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_7ZIP_SUPPORT, + "Υποστήριξη 7zip" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ALSA_SUPPORT, + "Υποστήριξη ALSA" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE, + "Ημερομηνία Κατασκευής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CG_SUPPORT, + "Υποστήριξη Cg" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COCOA_SUPPORT, + "Υποστήριξη Cocoa" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COMMAND_IFACE_SUPPORT, + "Υποστήριξη Γραμμής Εντολών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CORETEXT_SUPPORT, + "Υποστήριξη CoreText" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES, + "Χαρακτηριστικά Επεξεργαστή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_DPI, + "DPI Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_HEIGHT, + "Ύψος Οθόνης (mm)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DISPLAY_METRIC_MM_WIDTH, + "Πλάτος Οθόνης (mm)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DSOUND_SUPPORT, + "Υποστήριξη DirectSound" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WASAPI_SUPPORT, + "Υποστήριξη WASAPI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYLIB_SUPPORT, + "Υποστήριξη δυναμικής βιβλιοθήκης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT, + "Δυναμική φόρτωση κατά την εκτέλεση της βιβλιοθήκης libretro" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT, + "Υποστήριξη EGL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FBO_SUPPORT, + "Υποστήριξη OpenGL/Direct3D render-to-texture (multi-pass shaders)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FFMPEG_SUPPORT, + "Υποστήριξη FFmpeg" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FREETYPE_SUPPORT, + "Υποστήριξη FreeType" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_STB_TRUETYPE_SUPPORT, + "Υποστήριξη STB TrueType" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER, + "Αναγνωριστικό λειτουργικού συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_NAME, + "Όνομα λειτουργικού συστήματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_OS, + "Λειτουργικό Σύστημα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION, + "Έκδοση Git" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GLSL_SUPPORT, + "Υποστήριξη GLSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_HLSL_SUPPORT, + "Υποστήριξη HLSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_JACK_SUPPORT, + "Υποστήριξη JACK" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_KMS_SUPPORT, + "Υποστήριξη KMS/EGL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LAKKA_VERSION, + "Έκδοση Lakka" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBRETRODB_SUPPORT, + "Υποστήριξη LibretroDB" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBUSB_SUPPORT, + "Υποστήριξη Libusb" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBXML2_SUPPORT, + "Υποστήριξη ανάλυσης libxml2 XML" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETPLAY_SUPPORT, + "Υποστήριξη Netplay (peer-to-peer)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_COMMAND_IFACE_SUPPORT, + "Υποστήριξη Γραμμής Εντολών Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_REMOTE_SUPPORT, + "Υποστήριξη Χειριστηρίου Δικτύου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENAL_SUPPORT, + "Υποστήριξη OpenAL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGLES_SUPPORT, + "Υποστήριξη OpenGL ES" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGL_SUPPORT, + "Υποστήριξη OpenGL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENSL_SUPPORT, + "Υποστήριξη OpenSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENVG_SUPPORT, + "Υποστήριξη OpenVG" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OSS_SUPPORT, + "Υποστήριξη OSS" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OVERLAY_SUPPORT, + "Υποστήριξη Επικαλλυμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE, + "Πηγή ρεύματος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED, + "Φορτισμένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGING, + "Φορτίζει" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING, + "Ξεφορτίζει" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_NO_SOURCE, + "Καμία πηγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PULSEAUDIO_SUPPORT, + "Υποστήριξη PulseAudio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PYTHON_SUPPORT, + "Υποστήριξη Python (υποστήριξη script στις σκιάσεις)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RBMP_SUPPORT, + "Υποστήριξη BMP (RBMP)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETRORATING_LEVEL, + "Επίπεδο RetroRating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RJPEG_SUPPORT, + "Υποστήριξη JPEG (RJPEG)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ROARAUDIO_SUPPORT, + "Υποστήριξη RoarAudio" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RPNG_SUPPORT, + "Υποστήριξη PNG (RPNG)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RSOUND_SUPPORT, + "Υποστήριξη RSound" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RTGA_SUPPORT, + "Υποστήριξη TGA (RTGA)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL2_SUPPORT, + "Υποστήριξη SDL2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_IMAGE_SUPPORT, + "Υποστήριξη Εικόνων SDL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_SUPPORT, + "Υποστήριξη SDL1.2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SLANG_SUPPORT, + "Υποστήριξη Slang" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_THREADING_SUPPORT, + "Υποστήριξη Threading" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_UDEV_SUPPORT, + "Υποστήριξη Udev" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_V4L2_SUPPORT, + "Υποστήριξη Video4Linux2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER, + "Οδηγός video context" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VULKAN_SUPPORT, + "Υποστήριξη Vulkan" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_METAL_SUPPORT, + "Υποστήριξη Metal" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WAYLAND_SUPPORT, + "Υποστήριξη Wayland" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_X11_SUPPORT, + "Υποστήριξη X11" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XAUDIO2_SUPPORT, + "Υποστήριξη XAudio2" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XVIDEO_SUPPORT, + "Υποστήριξη XVideo" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT, + "Υποστήριξη Zlib" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TAKE_SCREENSHOT, + "Λήψη Στιγμιότυπου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THREADED_DATA_RUNLOOP_ENABLE, + "Threaded tasks" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAILS, + "Σκίτσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_LEFT_THUMBNAILS, + "Σκίτσα Αριστερά" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_VERTICAL_THUMBNAILS, + "Thumbnails Vertical Disposition" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY, + "Σκίτσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAILS_UPDATER_LIST, + "Ενημερωτής Σκίτσων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, + "Εξώφυλλα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS, + "Στιγμιότυπα Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS, + "Οθόνες Τίτλων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, + "Εμφάνιση ημερομηνίας / ώρας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE, + "Στυλ ημερομηνίας / ώρας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_STYLE, + "Αλλάζει το στυλ της τρέχουσας ημερομηνίας ή και ώρας που φαίνεται μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HMS, + "ΧΧΧΧ-ΜΜ-ΗΗ ΩΩ:ΛΛ:ΔΔ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_YMD_HM, + "ΧΧΧΧ-ΜΜ-ΗΗ ΩΩ:ΛΛ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MDYYYY, + "ΜΜ-ΗΗ-ΧΧΧΧ ΩΩ:ΛΛ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HMS, + "ΩΩ:ΛΛ:ΔΔ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_HM, + "ΩΩ:ΛΛ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_DM_HM, + "ΗΗ/ΜΜ ΩΩ:ΛΛ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_MD_HM, + "ΜΜ/ΗΗ ΩΩ:ΛΛ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TIMEDATE_STYLE_AM_PM, + "ΩΩ:ΛΛ:ΔΔ (ΠΜ/ΜΜ)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TITLE_COLOR, + "Χρώμα τίτλου μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TRUE, + "Αληθές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, + "UI Companion Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, + "UI Companion Start On Boot" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE, + "Εμφάνιση μενού επιφάνειας εργασίας κατά την εκκίνηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE, + "Ενεργοποίηση μενού επιφάνειας εργασίας (επανεκκίνηση)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, + "Γραμμή Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, + "Αδυναμία ανάγνωσης συμπιεσμένου αρχείου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNDO_LOAD_STATE, + "Αναίρεση Φόρτωσης Κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNDO_SAVE_STATE, + "Αναίρεση Αποθήκευσης Κατάστασης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UNKNOWN, + "Άγνωστο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATER_SETTINGS, + "Ενημερωτής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_ASSETS, + "Ενημέρωση Βασικών Στοιχείων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES, + "Ενημέρωση Προφίλ Joypad" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS, + "Ενημέρωση των Σκιάσεων Cg" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS, + "Ενημέρωση Απατών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES, + "Ενημέρωση Αρχείων Πληροφοριών Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES, + "Ενημέρωση Βάσεων Δεδομένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_GLSL_SHADERS, + "Ενημέρωση Σκιάσεων GLSL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_LAKKA, + "Ενημέρωση Lakka" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_OVERLAYS, + "Ενημέρωση Επικαλλυμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UPDATE_SLANG_SHADERS, + "Ενημέρωση Σκιάσεων Slang" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER, + "Χρήστης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_KEYBOARD, + "Kbd" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS, + "Διεπαφή Χρήστη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER_LANGUAGE, + "Γλώσσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USER_SETTINGS, + "Χρήστης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER, + "Χρήση Ενσωματωμένου Προβολέα Εικόνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USE_BUILTIN_PLAYER, + "Χρήση Ενσωματωμένου Αναπαραγωγέα Πολυμέσων Use Builtin Media Player" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY, + "<Χρήση αυτού του ευρετηρίου>" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE, + "Επίτρεψη περιστροφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO, + "Διαμόρφωση Αναλογίας Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_AUTO, + "Αυτόματη Αναλογία Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX, + "Αναλογία Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION, + "Εισαγωγή Μαύρων Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_CROP_OVERSCAN, + "Περικοπή Υπερσάρωσης (Επαναφόρτωση)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_DISABLE_COMPOSITION, + "Disable Desktop Composition" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER, + "Οδηγός Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FILTER, + "Φίλτρο Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR, + "Φίλτρο Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_FLICKER, + "Flicker filter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FONT_ENABLE, + "Ενεργοποίηση Ειδοποιήσεων Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, + "Γραμματοσειρά Ειδοποιήσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FONT_SIZE, + "Μέγεθος Γραμματοσειράς" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_ASPECT, + "Εξαναγκασμένη αναλογία απεικόνισης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE, + "Εξαναγκασμένη απενεργοποίηση sRGB FBO" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY, + "Καθυστέρηση Καρέ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN, + "Έναρξη σε Κατάσταση Πλήρης Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA, + "Gamma Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD, + "Χρήση Εγγραφής Κάρτας Γραφικών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_GPU_SCREENSHOT, + "Ενεργοποίηση Στιγμιότυπου Οθόνης Κάρτας Γραφικών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC, + "Σκληρός Συγχρονισμός Κάρτας Γραφικών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES, + "Σκληρός Συγχρονισμός Καρέ Κάρτας Γραφικών" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Μέγιστες εικόνες swapchain" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_X, + "Θέση Ειδοποιήσης X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_POS_Y, + "Θέση Ειδοποιήσης Y" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MONITOR_INDEX, + "Ένδειξη Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_POST_FILTER_RECORD, + "Use Post Filter Recording" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE, + "Κάθετος Ρυθμός Ανανέωσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO, + "Εκτιμόμενος Ρυθμός Καρέ Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_POLLED, + "Ορισμός Ρυθμού Ανανέωσης Βάση Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION, + "Περιστροφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, + "Κλίμακα Παραθύρου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, + "Ακέραια Κλίμακα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS, + "Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, + "Σκίαση Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_NUM_PASSES, + "Shader Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, + "Shader Parameters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, + "Load Shader Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_AS, + "Save Shader Preset As" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE, + "Save Core Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_PARENT, + "Save Content Directory Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME, + "Save Game Preset" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT, + "Enable Hardware Shared Context" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SMOOTH, + "Διγραμμικό Φιλτράρισμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SOFT_FILTER, + "Ενεργοποίηση Απαλού Φίλτρου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_SWAP_INTERVAL, + "Διάστημα Εναλλαγής Κάθετου Συγχρονισμόυ (Vsync)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_TAB, + "Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_THREADED, + "Threaded Video" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER, + "Deflicker" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + "Προτιμώμενο Ύψος Αναλογίας Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_WIDTH, + "Προτιμώμενο Πλάτος Αναλογίας Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_X, + "Προτιμώμενη Θέση Άξωνα X Αναλογίας Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_CUSTOM_Y, + "Προτιμώμενη Θέση Άξωνα Y Αναλογίας Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VI_WIDTH, + "Ορισμός Πλάτους Οθόνης VI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_VSYNC, + "Vertical Sync (Vsync)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOWED_FULLSCREEN, + "Παράθυρο Πλήρης Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, + "Πλάτος Παραθύρου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, + "Ύψος Παραθύρου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_X, + "Πλάτος Πλήρης Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN_Y, + "Ύψος Πλήρης Οθόνης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_WIFI_DRIVER, + "Οδηγός Wi-Fi" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, + "Wi-Fi" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, + "Menu Alpha Factor" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, + "Γραμματοσειρά Μενού Κόκκινο Χρώμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, + "Γραμματοσειρά Μενού Πράσινο Χρώμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, + "Γραμματοσειρά Μενού Μπλε Χρώμα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_FONT, + "Γραμματοσειρά Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_CUSTOM, + "Custom" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_FLATUI, + "FlatUI" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME, + "Μονόχρωμο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED, + "Μονόχρωμο Ανεστραμμένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_SYSTEMATIC, + "Systematic" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_NEOACTIVE, + "NeoActive" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_PIXEL, + "Pixel" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, + "RetroActive" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROSYSTEM, + "Retrosystem" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, + "Dot-Art" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_AUTOMATIC, + "Automatic" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, + "Χρώμα Θέματος Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, + "Πράσινο Μήλο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK, + "Σκούρο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LIGHT, + "Φωτεινό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MORNING_BLUE, + "Πρωινό Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE, + "Σκούρο Μωβ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE, + "Μπλε Ηλεκτρίκ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN, + "Χρυσαφί" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED, + "Legacy Κόκκινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE, + "Μεσωνύκτιο Μπλε" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_PLAIN, + "Απλό" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA, + "Κάτω Από Την Θάλασσα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED, + "Ηφαιστιακό Κόκκινο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, + "Menu Shader Pipeline" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR, + "Menu Scale Factor" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, + "Ενεργοποίηση Σκιών Εικονιδίων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY, + "Προβολή Καρτέλας Ιστορικού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD, + "Προβολή Καρτέλας Εισαγωγής Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS, + "Προβολή Καρτέλας Λίστας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES, + "Προβολή Καρτέλας Αγαπημένων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES, + "Προβολή Καρτέλας Εικόνων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_MUSIC, + "Προβολή Καρτέλας Μουσικής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS, + "Προβολή Καρτέλας Ρυθμίσεων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_VIDEO, + "Προβολή Καρτέλας Βίντεο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_NETPLAY, + "Προβολή Καρτέλας Netplay" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_LAYOUT, + "Διάταξη Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_THEME, + "Θέμα Εικόνων Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_YES, + "Ναι" + ) +MSG_HASH( + MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_TWO, + "Shader Preset" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_ENABLE, + "Ενεργοποίηση ή απενεργοποίηση επιτευγμάτων. Για περισσότερες πληροφορίες επισκεφθείτε http://retroachievements.org" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, + "Enable or disable unofficial achievements and/or beta features for testing purposes." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, + "Enable or disable savestates, cheats, rewind, pause, and slow-motion for all games." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, + "Enable or disable in-game leaderboards. Has no effect if Hardcore Mode is disabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, + "Enable or disable badge display in the Achievement List." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, + "Enable or disable OSD verbosity for achievements." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, + "Automatically take a screenshot when an achievement is triggered." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DRIVER_SETTINGS, + "Αλλαγή οδηγών που χρησιμοποιούνται από το σύστημα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS, + "Αλλαγή ρυθμίσεων επιτευγμάτων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_SETTINGS, + "Αλλαγή ρυθμίσεων πυρήνα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORDING_SETTINGS, + "Αλλαγή ρυθμίσεων εγγραφής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS, + "Αλλαγή επικάλλυψης οθόνης και επικάλλυψης πληκτρολογίου και ρυθμίσεις ειδοποιήσεων οθόνης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS, + "Αλλαγή ρυθμίσεων επιστροφής, γρήγορης κίνησης και αργής κίνησης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVING_SETTINGS, + "Αλλαγή ρυθμίσεων αποθήκευσης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOGGING_SETTINGS, + "Αλλαγή ρυθμίσεων αρχείου καταγραφής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_USER_INTERFACE_SETTINGS, + "Αλλαγή ρυθμίσεων περιβάλλοντος χρήστη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_USER_SETTINGS, + "Αλλαγή ρυθμίσεων λογαριασμού, ονόματος χρήστη και γλώσσας." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PRIVACY_SETTINGS, + "Αλλαγή ρυθμίσεων ιδιοτηκότητας." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_SETTINGS, + "Αλλαγή ρυθμίσεων MIDI." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS, + "Αλλαγή προκαθορισμένων ευρετηρίων όπου βρίσκονται τα αρχεία." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS, + "Αλλαγή ρυθμίσεων λιστών αναπαραγωγής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETWORK_SETTINGS, + "Αλλαγή ρυθμίσεων εξυπηρετητή και δικτύου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST, + "Σάρωση περιεχομένου και προσθήκη στην βάση δεδομένων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_SETTINGS, + "Αλλαγή ρυθμίσεων εξόδου ήχου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BLUETOOTH_ENABLE, + "Ενεργοποίηση ή απενεργοποίηση bluetooth." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT, + "Αποθήκευση αλλαγών στο αρχείο διαμόρφωσης κατά την έξοδο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS, + "Αλλαγή προκαθορισμένων ρυθμίσεων των αρχείων διαμόρφωσης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST, + "Διαχειρισμός και δημιουργία αρχείων διαμόρφωσης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CPU_CORES, + "Αριθμός πυρήνων που έχει ο επεξεργαστής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FPS_SHOW, + "Εμφανίζει τον τρέχων ρυθμό καρέ ανά δευτερόλεπτο στην οθόνη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, + "Διαμόρφωση ρυθμίσεων πλήκτρων εντολών." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, + "Συνδιασμός κουμπιών χειριστηρίου για την εμφάνιση του μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_SETTINGS, + "Αλλαγή ρυθμίσεων χειριστηρίου, πληκτρολογίου και ποντικιού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_USER_BINDS, + "Διαμόρφωση χειρισμών για αυτόν τον χρήστη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LATENCY_SETTINGS, + "Αλλαγή ρυθμίσεων συσχετιζόμενες με το βίντεο, τον ήχο και την καθυστέρηση εισαγωγής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOG_VERBOSITY, + "Ενεργοποίηση ή απενεργοποίηση αρχείων καταγραφής στο τερματικό." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY, + "Συμμετοχή ή δημιουργία μίας συνεδρίας netplay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_LAN_SCAN_SETTINGS, + "Αναζήτηση για και σύνδεση με οικοδεσπότη netplay στο τοπικό δίκτυο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INFORMATION_LIST_LIST, + "Εμφάνιση πληροφοριών συστήματος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ONLINE_UPDATER, + "Κατεβάστε πρόσθετα, στοιχεία και περιεχόμενο για το RetroArch." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAMBA_ENABLE, + "Enable or disable network sharing of your folders." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SERVICES_SETTINGS, + "Manage operating system level services." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHOW_HIDDEN_FILES, + "Show hidden files/directories inside the file browser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SSH_ENABLE, + "Enable or disable remote command line access." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE, + "Αποτρέπει την προφύλαξη οθόνης του συστήματος από το να ενεργοποιηθεί." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE, + "Ορισμός μεγέθους παραθύρου σε σχέση με το μέγεθος της οπτικής γωνίας του πυρήνα. Διαφορετικά, παρακάτω μπορείτε να ορίσετε το πλάτος και το ύψος του παραθύρου σε σταθερό μέγεθος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_USER_LANGUAGE, + "Ορίζει την γλώσσα του περιβάλλοντος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_BLACK_FRAME_INSERTION, + "Εισάγει ένα μαύρο καρέ ανάμεσα στα καρέ. Χρήσιμο για χρήστες με οθόνες 120Hz που θέλουν να παίξουν περιεχόμενο στα 60Hz χωρίς 'φαντάσματα' στην εικόνα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY, + "Μειώνει την καθυστέρηση με μεγαλύτερο κίνδυνο για κολλήματα στο βίντεο. Προσθέτει μία επιβράδυνση μετά το V-Sync (σε ms)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES, + "Ορίζει πόσα καρέ μπορεί ο επεξεργαστής να βρίσκεται μπροστά από την κάρτα γραφικών όταν χρησιμοποιείται τον 'Σκληρό Συγχρονισμό Κάρτα Γραφικών'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES, + "Tells the video driver to explicitly use a specified buffering mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX, + "Επιλέγει ποιά οθόνη θα χρησιμοποιηθεί." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO, + "Ο ακριβής εκτιμόμενος ρυθμός ανανέωσης της οθόνης σε Hz." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED, + "Ο ρυθμός ανανέωσης όπως αναφέρεται από τον οδηγό οθόνης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SETTINGS, + "Αλλαγή ρυθμίσεων εξόδου βίντεο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_WIFI_SETTINGS, + "Σαρώνει για ασύρματα δίκτυα και δημιουργεί σύνδεση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_HELP_LIST, + "Μάθετε περισσότερα για το πως λειτουργεί το πρόγραμμα." + ) +MSG_HASH( + MSG_ADDED_TO_FAVORITES, + "Προστέθηκε στα αγαπημένα" + ) +MSG_HASH( + MSG_RESET_CORE_ASSOCIATION, + "Ο σύνδεση με πυρήνα της λίστας αναπαραγωγής έχει επαναφερθεί." + ) +MSG_HASH( + MSG_APPENDED_DISK, + "Appended disk" + ) +MSG_HASH( + MSG_APPLICATION_DIR, + "Application Dir" + ) +MSG_HASH( + MSG_APPLYING_CHEAT, + "Applying cheat changes." + ) +MSG_HASH( + MSG_APPLYING_SHADER, + "Applying shader" + ) +MSG_HASH( + MSG_AUDIO_MUTED, + "Ο ήχος απενεργοποιήθηκε." + ) +MSG_HASH( + MSG_AUDIO_UNMUTED, + "Ο ήχος ενεργοποιήθηκε." + ) +MSG_HASH( + MSG_AUTOCONFIG_FILE_ERROR_SAVING, + "Error saving autoconf file." + ) +MSG_HASH( + MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY, + "Autoconfig file saved successfully." + ) +MSG_HASH( + MSG_AUTOSAVE_FAILED, + "Could not initialize autosave." + ) +MSG_HASH( + MSG_AUTO_SAVE_STATE_TO, + "Auto save state to" + ) +MSG_HASH( + MSG_BLOCKING_SRAM_OVERWRITE, + "Blocking SRAM Overwrite" + ) +MSG_HASH( + MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT, + "Bringing up command interface on port" + ) +MSG_HASH( + MSG_BYTES, + "bytes" + ) +MSG_HASH( + MSG_CANNOT_INFER_NEW_CONFIG_PATH, + "Cannot infer new config path. Use current time." + ) +MSG_HASH( + MSG_CHEEVOS_HARDCORE_MODE_ENABLE, + "Achievements Hardcore Mode Enabled, savestate & rewind were disabled." + ) +MSG_HASH( + MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, + "Comparing with known magic numbers..." + ) +MSG_HASH( + MSG_COMPILED_AGAINST_API, + "Compiled against API" + ) +MSG_HASH( + MSG_CONFIG_DIRECTORY_NOT_SET, + "Config directory not set. Cannot save new config." + ) +MSG_HASH( + MSG_CONNECTED_TO, + "Συνδέθηκε με" + ) +MSG_HASH( + MSG_CONTENT_CRC32S_DIFFER, + "Content CRC32s differ. Cannot use different games." + ) +MSG_HASH( + MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, + "Content loading skipped. Implementation will load it on its own." + ) +MSG_HASH( + MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, + "Core does not support save states." + ) +MSG_HASH( + MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, + "Core options file created successfully." + ) +MSG_HASH( + MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, + "Could not find any next driver" + ) +MSG_HASH( + MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM, + "Could not find compatible system." + ) +MSG_HASH( + MSG_COULD_NOT_FIND_VALID_DATA_TRACK, + "Could not find valid data track" + ) +MSG_HASH( + MSG_COULD_NOT_OPEN_DATA_TRACK, + "could not open data track" + ) +MSG_HASH( + MSG_COULD_NOT_READ_CONTENT_FILE, + "Could not read content file" + ) +MSG_HASH( + MSG_COULD_NOT_READ_MOVIE_HEADER, + "Could not read movie header." + ) +MSG_HASH( + MSG_COULD_NOT_READ_STATE_FROM_MOVIE, + "Could not read state from movie." + ) +MSG_HASH( + MSG_CRC32_CHECKSUM_MISMATCH, + "CRC32 checksum mismatch between content file and saved content checksum in replay file header. Replay highly likely to desync on playback." + ) +MSG_HASH( + MSG_CUSTOM_TIMING_GIVEN, + "Custom timing given" + ) +MSG_HASH( + MSG_DECOMPRESSION_ALREADY_IN_PROGRESS, + "Decompression already in progress." + ) +MSG_HASH( + MSG_DECOMPRESSION_FAILED, + "Decompression failed." + ) +MSG_HASH( + MSG_DETECTED_VIEWPORT_OF, + "Detected viewport of" + ) +MSG_HASH( + MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, + "Did not find a valid content patch." + ) +MSG_HASH( + MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, + "Disconnect device from a valid port." + ) +MSG_HASH( + MSG_DISK_CLOSED, + "Closed" + ) +MSG_HASH( + MSG_DISK_EJECTED, + "Ejected" + ) +MSG_HASH( + MSG_DOWNLOADING, + "Γίνεται λήψη" + ) +MSG_HASH( + MSG_INDEX_FILE, + "ευρετηρίου" + ) +MSG_HASH( + MSG_DOWNLOAD_FAILED, + "Η λήψη απέτυχε" + ) +MSG_HASH( + MSG_ERROR, + "Πρόβλημα" + ) +MSG_HASH( + MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT, + "Libretro core requires content, but nothing was provided." + ) +MSG_HASH( + MSG_ERROR_LIBRETRO_CORE_REQUIRES_SPECIAL_CONTENT, + "Libretro core requires special content, but none were provided." + ) +MSG_HASH( + MSG_ERROR_PARSING_ARGUMENTS, + "Error parsing arguments." + ) +MSG_HASH( + MSG_ERROR_SAVING_CORE_OPTIONS_FILE, + "Error saving core options file." + ) +MSG_HASH( + MSG_ERROR_SAVING_REMAP_FILE, + "Error saving remap file." + ) +MSG_HASH( + MSG_ERROR_REMOVING_REMAP_FILE, + "Error removing remap file." + ) +MSG_HASH( + MSG_ERROR_SAVING_SHADER_PRESET, + "Error saving shader preset." + ) +MSG_HASH( + MSG_EXTERNAL_APPLICATION_DIR, + "External Application Dir" + ) +MSG_HASH( + MSG_EXTRACTING, + "Γίνεται εξαγωγή" + ) +MSG_HASH( + MSG_EXTRACTING_FILE, + "Γίνεται εξαγωγή αρχείου" + ) +MSG_HASH( + MSG_FAILED_SAVING_CONFIG_TO, + "Failed saving config to" + ) +MSG_HASH( + MSG_FAILED_TO, + "Failed to" + ) +MSG_HASH( + MSG_FAILED_TO_ACCEPT_INCOMING_SPECTATOR, + "Failed to accept incoming spectator." + ) +MSG_HASH( + MSG_FAILED_TO_ALLOCATE_MEMORY_FOR_PATCHED_CONTENT, + "Failed to allocate memory for patched content..." + ) +MSG_HASH( + MSG_FAILED_TO_APPLY_SHADER, + "Failed to apply shader." + ) +MSG_HASH( + MSG_FAILED_TO_BIND_SOCKET, + "Failed to bind socket." + ) +MSG_HASH( + MSG_FAILED_TO_CREATE_THE_DIRECTORY, + "Failed to create the directory." + ) +MSG_HASH( + MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE, + "Failed to extract content from compressed file" + ) +MSG_HASH( + MSG_FAILED_TO_GET_NICKNAME_FROM_CLIENT, + "Failed to get nickname from client." + ) +MSG_HASH( + MSG_FAILED_TO_LOAD, + "Failed to load" + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_CONTENT, + "Failed to load content" + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_MOVIE_FILE, + "Failed to load movie file" + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_OVERLAY, + "Αποτυχία φόρτωσης επικαλλύματος." + ) +MSG_HASH( + MSG_FAILED_TO_LOAD_STATE, + "Failed to load state from" + ) +MSG_HASH( + MSG_FAILED_TO_OPEN_LIBRETRO_CORE, + "Failed to open libretro core" + ) +MSG_HASH( + MSG_FAILED_TO_PATCH, + "Failed to patch" + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_HEADER_FROM_CLIENT, + "Failed to receive header from client." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_NICKNAME, + "Failed to receive nickname." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_NICKNAME_FROM_HOST, + "Failed to receive nickname from host." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_NICKNAME_SIZE_FROM_HOST, + "Failed to receive nickname size from host." + ) +MSG_HASH( + MSG_FAILED_TO_RECEIVE_SRAM_DATA_FROM_HOST, + "Failed to receive SRAM data from host." + ) +MSG_HASH( + MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY, + "Failed to remove disk from tray." + ) +MSG_HASH( + MSG_FAILED_TO_REMOVE_TEMPORARY_FILE, + "Failed to remove temporary file" + ) +MSG_HASH( + MSG_FAILED_TO_SAVE_SRAM, + "Failed to save SRAM" + ) +MSG_HASH( + MSG_FAILED_TO_SAVE_STATE_TO, + "Failed to save state to" + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME, + "Failed to send nickname." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME_SIZE, + "Failed to send nickname size." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME_TO_CLIENT, + "Failed to send nickname to client." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_NICKNAME_TO_HOST, + "Failed to send nickname to host." + ) +MSG_HASH( + MSG_FAILED_TO_SEND_SRAM_DATA_TO_CLIENT, + "Failed to send SRAM data to client." + ) +MSG_HASH( + MSG_FAILED_TO_START_AUDIO_DRIVER, + "Failed to start audio driver. Will continue without audio." + ) +MSG_HASH( + MSG_FAILED_TO_START_MOVIE_RECORD, + "Failed to start movie record." + ) +MSG_HASH( + MSG_FAILED_TO_START_RECORDING, + "Failed to start recording." + ) +MSG_HASH( + MSG_FAILED_TO_TAKE_SCREENSHOT, + "Failed to take screenshot." + ) +MSG_HASH( + MSG_FAILED_TO_UNDO_LOAD_STATE, + "Failed to undo load state." + ) +MSG_HASH( + MSG_FAILED_TO_UNDO_SAVE_STATE, + "Failed to undo save state." + ) +MSG_HASH( + MSG_FAILED_TO_UNMUTE_AUDIO, + "Failed to unmute audio." + ) +MSG_HASH( + MSG_FATAL_ERROR_RECEIVED_IN, + "Fatal error received in" + ) +MSG_HASH( + MSG_FILE_NOT_FOUND, + "Το αρχείο δεν βρέθηκε" + ) +MSG_HASH( + MSG_FOUND_AUTO_SAVESTATE_IN, + "Found auto savestate in" + ) +MSG_HASH( + MSG_FOUND_DISK_LABEL, + "Found disk label" + ) +MSG_HASH( + MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, + "Found first data track on file" + ) +MSG_HASH( + MSG_FOUND_LAST_STATE_SLOT, + "Found last state slot" + ) +MSG_HASH( + MSG_FOUND_SHADER, + "Found shader" + ) +MSG_HASH( + MSG_FRAMES, + "Καρέ" + ) +MSG_HASH( + MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT, + "Per-Game Options: game-specific core options found at" + ) +MSG_HASH( + MSG_GOT_INVALID_DISK_INDEX, + "Got invalid disk index." + ) +MSG_HASH( + MSG_GRAB_MOUSE_STATE, + "Grab mouse state" + ) +MSG_HASH( + MSG_GAME_FOCUS_ON, + "Game focus on" + ) +MSG_HASH( + MSG_GAME_FOCUS_OFF, + "Game focus off" + ) +MSG_HASH( + MSG_HW_RENDERED_MUST_USE_POSTSHADED_RECORDING, + "Libretro core is hardware rendered. Must use post-shaded recording as well." + ) +MSG_HASH( + MSG_INFLATED_CHECKSUM_DID_NOT_MATCH_CRC32, + "Inflated checksum did not match CRC32." + ) +MSG_HASH( + MSG_INPUT_CHEAT, + "Εισαγωγή Απάτης" + ) +MSG_HASH( + MSG_INPUT_CHEAT_FILENAME, + "Input Cheat Filename" + ) +MSG_HASH( + MSG_INPUT_PRESET_FILENAME, + "Input Preset Filename" + ) +MSG_HASH( + MSG_INPUT_RENAME_ENTRY, + "Rename Title" + ) +MSG_HASH( + MSG_INTERFACE, + "Αντάπτορας Δικτύου" + ) +MSG_HASH( + MSG_INTERNAL_STORAGE, + "Εσωτερική Μνήμη Αποθήκευσης" + ) +MSG_HASH( + MSG_REMOVABLE_STORAGE, + "Αφαιρούμενο Μέσο Αποθήκευσης" + ) +MSG_HASH( + MSG_INVALID_NICKNAME_SIZE, + "Μη έγκυρο μέγεθος ψευδώνυμου." + ) +MSG_HASH( + MSG_IN_BYTES, + "σε bytes" + ) +MSG_HASH( + MSG_IN_GIGABYTES, + "σε gigabytes" + ) +MSG_HASH( + MSG_IN_MEGABYTES, + "σε megabytes" + ) +MSG_HASH( + MSG_LIBRETRO_ABI_BREAK, + "is compiled against a different version of libretro than this libretro implementation." + ) +MSG_HASH( + MSG_LIBRETRO_FRONTEND, + "Frontend for libretro" + ) +MSG_HASH( + MSG_LOADED_STATE_FROM_SLOT, + "Loaded state from slot #%d." + ) +MSG_HASH( + MSG_LOADED_STATE_FROM_SLOT_AUTO, + "Loaded state from slot #-1 (auto)." + ) +MSG_HASH( + MSG_LOADING, + "Γίνεται φόρτωση" + ) +MSG_HASH( + MSG_FIRMWARE, + "One or more firmware files are missing" + ) +MSG_HASH( + MSG_LOADING_CONTENT_FILE, + "Loading content file" + ) +MSG_HASH( + MSG_LOADING_HISTORY_FILE, + "Loading history file" + ) +MSG_HASH( + MSG_LOADING_STATE, + "Loading state" + ) +MSG_HASH( + MSG_MEMORY, + "Μνήμη" + ) +MSG_HASH( + MSG_MOVIE_FILE_IS_NOT_A_VALID_BSV1_FILE, + "Input replay movie file is not a valid BSV1 file." + ) +MSG_HASH( + MSG_MOVIE_FORMAT_DIFFERENT_SERIALIZER_VERSION, + "Input replay movie format seems to have a different serializer version. Will most likely fail." + ) +MSG_HASH( + MSG_MOVIE_PLAYBACK_ENDED, + "Input replay movie playback ended." + ) +MSG_HASH( + MSG_MOVIE_RECORD_STOPPED, + "Stopping movie record." + ) +MSG_HASH( + MSG_NETPLAY_FAILED, + "Failed to initialize netplay." + ) +MSG_HASH( + MSG_NO_CONTENT_STARTING_DUMMY_CORE, + "No content, starting dummy core." + ) +MSG_HASH( + MSG_NO_SAVE_STATE_HAS_BEEN_OVERWRITTEN_YET, + "No save state has been overwritten yet." + ) +MSG_HASH( + MSG_NO_STATE_HAS_BEEN_LOADED_YET, + "No state has been loaded yet." + ) +MSG_HASH( + MSG_OVERRIDES_ERROR_SAVING, + "Error saving overrides." + ) +MSG_HASH( + MSG_OVERRIDES_SAVED_SUCCESSFULLY, + "Overrides saved successfully." + ) +MSG_HASH( + MSG_PAUSED, + "Παύση." + ) +MSG_HASH( + MSG_PROGRAM, + "RetroArch" + ) +MSG_HASH( + MSG_READING_FIRST_DATA_TRACK, + "Reading first data track..." + ) +MSG_HASH( + MSG_RECEIVED, + "ελήφθη" + ) +MSG_HASH( + MSG_RECORDING_TERMINATED_DUE_TO_RESIZE, + "Recording terminated due to resize." + ) +MSG_HASH( + MSG_RECORDING_TO, + "Εγγραφή σε" + ) +MSG_HASH( + MSG_REDIRECTING_CHEATFILE_TO, + "Redirecting cheat file to" + ) +MSG_HASH( + MSG_REDIRECTING_SAVEFILE_TO, + "Redirecting save file to" + ) +MSG_HASH( + MSG_REDIRECTING_SAVESTATE_TO, + "Redirecting savestate to" + ) +MSG_HASH( + MSG_REMAP_FILE_SAVED_SUCCESSFULLY, + "Remap file saved successfully." + ) +MSG_HASH( + MSG_REMAP_FILE_REMOVED_SUCCESSFULLY, + "Remap file removed successfully." + ) +MSG_HASH( + MSG_REMOVED_DISK_FROM_TRAY, + "Removed disk from tray." + ) +MSG_HASH( + MSG_REMOVING_TEMPORARY_CONTENT_FILE, + "Removing temporary content file" + ) +MSG_HASH( + MSG_RESET, + "Reset" + ) +MSG_HASH( + MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, + "Restarting recording due to driver reinit." + ) +MSG_HASH( + MSG_RESTORED_OLD_SAVE_STATE, + "Restored old save state." + ) +MSG_HASH( + MSG_RESTORING_DEFAULT_SHADER_PRESET_TO, + "Shaders: restoring default shader preset to" + ) +MSG_HASH( + MSG_REVERTING_SAVEFILE_DIRECTORY_TO, + "Reverting savefile directory to" + ) +MSG_HASH( + MSG_REVERTING_SAVESTATE_DIRECTORY_TO, + "Reverting savestate directory to" + ) +MSG_HASH( + MSG_REWINDING, + "Rewinding." + ) +MSG_HASH( + MSG_REWIND_INIT, + "Initializing rewind buffer with size" + ) +MSG_HASH( + MSG_REWIND_INIT_FAILED, + "Failed to initialize rewind buffer. Rewinding will be disabled." + ) +MSG_HASH( + MSG_REWIND_INIT_FAILED_THREADED_AUDIO, + "Implementation uses threaded audio. Cannot use rewind." + ) +MSG_HASH( + MSG_REWIND_REACHED_END, + "Reached end of rewind buffer." + ) +MSG_HASH( + MSG_SAVED_NEW_CONFIG_TO, + "Saved new config to" + ) +MSG_HASH( + MSG_SAVED_STATE_TO_SLOT, + "Saved state to slot #%d." + ) +MSG_HASH( + MSG_SAVED_STATE_TO_SLOT_AUTO, + "Saved state to slot #-1 (auto)." + ) +MSG_HASH( + MSG_SAVED_SUCCESSFULLY_TO, + "Saved successfully to" + ) +MSG_HASH( + MSG_SAVING_RAM_TYPE, + "Saving RAM type" + ) +MSG_HASH( + MSG_SAVING_STATE, + "Saving state" + ) +MSG_HASH( + MSG_SCANNING, + "Σάρωση" + ) +MSG_HASH( + MSG_SCANNING_OF_DIRECTORY_FINISHED, + "Η σάρωση του ευρετηρίου ολοκληρώθηκε" + ) +MSG_HASH( + MSG_SENDING_COMMAND, + "Αποστολή εντολής" + ) +MSG_HASH( + MSG_SEVERAL_PATCHES_ARE_EXPLICITLY_DEFINED, + "Several patches are explicitly defined, ignoring all..." + ) +MSG_HASH( + MSG_SHADER, + "Σκίαση" + ) +MSG_HASH( + MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, + "Shader preset saved successfully." + ) +MSG_HASH( + MSG_SKIPPING_SRAM_LOAD, + "Skipping SRAM load." + ) +MSG_HASH( + MSG_SLOW_MOTION, + "Αργή κίνηση." + ) +MSG_HASH( + MSG_FAST_FORWARD, + "Γρήγορη κίνηση." + ) +MSG_HASH( + MSG_SLOW_MOTION_REWIND, + "Slow motion rewind." + ) +MSG_HASH( + MSG_SRAM_WILL_NOT_BE_SAVED, + "SRAM will not be saved." + ) +MSG_HASH( + MSG_STARTING_MOVIE_PLAYBACK, + "Starting movie playback." + ) +MSG_HASH( + MSG_STARTING_MOVIE_RECORD_TO, + "Starting movie record to" + ) +MSG_HASH( + MSG_STATE_SIZE, + "State size" + ) +MSG_HASH( + MSG_STATE_SLOT, + "State slot" + ) +MSG_HASH( + MSG_TAKING_SCREENSHOT, + "Taking screenshot." + ) +MSG_HASH( + MSG_TO, + "to" + ) +MSG_HASH( + MSG_UNDID_LOAD_STATE, + "Undid load state." + ) +MSG_HASH( + MSG_UNDOING_SAVE_STATE, + "Undoing save state" + ) +MSG_HASH( + MSG_UNKNOWN, + "Άγνωστο" + ) +MSG_HASH( + MSG_UNPAUSED, + "Unpaused." + ) +MSG_HASH( + MSG_UNRECOGNIZED_COMMAND, + "Unrecognized command" + ) +MSG_HASH( + MSG_USING_CORE_NAME_FOR_NEW_CONFIG, + "Using core name for new config." + ) +MSG_HASH( + MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED, + "Using libretro dummy core. Skipping recording." + ) +MSG_HASH( + MSG_VALUE_CONNECT_DEVICE_FROM_A_VALID_PORT, + "Connect device from a valid port." + ) +MSG_HASH( + MSG_VALUE_DISCONNECTING_DEVICE_FROM_PORT, + "Disconnecting device from port" + ) +MSG_HASH( + MSG_VALUE_REBOOTING, + "Επανεκκίνηση..." + ) +MSG_HASH( + MSG_VALUE_SHUTTING_DOWN, + "Τερματισμός λειτουργίας..." + ) +MSG_HASH( + MSG_VERSION_OF_LIBRETRO_API, + "Έκδοση του libretro API" + ) +MSG_HASH( + MSG_VIEWPORT_SIZE_CALCULATION_FAILED, + "Viewport size calculation failed! Will continue using raw data. This will probably not work right ..." + ) +MSG_HASH( + MSG_VIRTUAL_DISK_TRAY, + "virtual disk tray." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_LATENCY, + "Επιθυμητή καθυστέρηση ήχου σε milliseconds. Ίσως να μην τηρηθεί εάν ο οδηγός ήχου δεν μπορεί να παρέχει την επιλεγμένη καθυστέρηση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MUTE, + "Σίγαση/κατάργηση σίγασης ήχου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RATE_CONTROL_DELTA, + "Helps smooth out imperfections in timing when synchronizing audio and video. Be aware that if disabled, proper synchronization is nearly impossible to obtain." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CAMERA_ALLOW, + "Allow or disallow camera access by cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOCATION_ALLOW, + "Allow or disallow location services access by cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_MAX_USERS, + "Μέγιστος αριθμός χρηστών που υποστηρίζεται από το RetroArch." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR, + "Επιρροή του πως γίνεται η συγκέντρωση εισόδου μέσα στο RetroArch. Ο ορισμός σε 'Νωρίς' ή 'Αργά' μπορεί να έχει ως αποτέλεσμα μικρότερη καθυστέρηση με τις ρυθμίσεις σας." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU, + "Επιτρέπει σε οποιονδήποτε χρήστη να χειριστεί το μενού. Εάν απενεργοποιηθεί, μόνο ο Χρήστης 1 μπορεί να χειριστει το μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_VOLUME, + "Ένταση ήχου (σε dB). Το 0 είναι η φυσιολογική ένταση και δεν εφαρμόζεται gain." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_EXCLUSIVE_MODE, + "Allow the WASAPI driver to take exclusive control of the audio device. If disabled, it will use shared mode instead." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_FLOAT_FORMAT, + "Use float format for the WASAPI driver, if supported by your audio device." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH, + "The intermediate buffer length (in frames) when using the WASAPI driver in shared mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_SYNC, + "Συγχρονισμός ήχου. Προτείνεται." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD, + "Πόσο μακριά ένας άξωνας πρέπει να γείρει ώστε να οδηγήσει σε πάτημα κουμπιού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT, + "Χρόνος αναμονής σε δευτερόλεπτα μέχρι την συνέχιση στην επόμενη σύνδεση πλήκτρων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_BIND_HOLD, + "Δευτερόλεπτα τα οποία χρειάζεται να κρατήσετε πατημένο κάποιο κουμπί μέχρι την σύνδεση του." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD, + "Describes the period when turbo-enabled buttons are toggled. Numbers are described in frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE, + "Describes how long the period of a turbo-enabled button should be. Numbers are described in frames." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VSYNC, + "Συγχρονίζει την έξοδο βίντεο της κάρτας γραφικών με τον ρυθμό ανανέωσης της οθόνης. Προτείνεται." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE, + "Allow cores to set rotation. When disabled, rotation requests are ignored. Useful for setups where one manually rotates the screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN, + "Some cores might have a shutdown feature. If enabled, it will prevent the core from shutting RetroArch down. Instead, it loads a dummy core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE, + "Check if all the required firmware is present before attempting to load content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE, + "Ο κάθετος ρυθμός ανανέωσης της οθόνης. Χρησιμοποιείται για τον υπολογισμό του κατάλληλου ρυθμού εισαγωγής ήχου.\n" + "ΣΗΜΕΙΩΣΗ: Αυτή η επιλογή αγνοείται εάν έχετε ενεργοποιήσει το 'Threaded Video'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_ENABLE, + "Ενεργοποίηση εξόδου ήχου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW, + "The maximum change in audio input rate. Increasing this enables very large changes in timing at the cost of an inaccurate audio pitch (e.g., running PAL cores on NTSC displays)." + ) +MSG_HASH( + MSG_FAILED, + "failed" + ) +MSG_HASH( + MSG_SUCCEEDED, + "succeeded" + ) +MSG_HASH( + MSG_DEVICE_NOT_CONFIGURED, + "not configured" + ) +MSG_HASH( + MSG_DEVICE_NOT_CONFIGURED_FALLBACK, + "not configured, using fallback" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST, + "Database Cursor List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DEVELOPER, + "Database - Filter : Developer" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PUBLISHER, + "Database - Filter : Publisher" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISABLED, + "Disabled" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ENABLED, + "Enabled" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_PATH, + "Content History Path" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ORIGIN, + "Database - Filter : Origin" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_FRANCHISE, + "Database - Filter : Franchise" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ESRB_RATING, + "Database - Filter : ESRB Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ELSPA_RATING, + "Database - Filter : ELSPA Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PEGI_RATING, + "Database - Filter : PEGI Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_CERO_RATING, + "Database - Filter : CERO Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_BBFC_RATING, + "Database - Filter : BBFC Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_MAX_USERS, + "Database - Filter : Max Users" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_MONTH, + "Database - Filter : Releasedate By Month" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_RELEASEDATE_BY_YEAR, + "Database - Filter : Releasedate By Year" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_ISSUE, + "Database - Filter : Edge Magazine Issue" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_EDGE_MAGAZINE_RATING, + "Database - Filter : Edge Magazine Rating" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DATABASE_INFO, + "Πληροφορίες Βάσης Δεδομένων" + ) +MSG_HASH( + MSG_WIFI_SCAN_COMPLETE, + "Η σάρωση του Wi-Fi ολοκληρώθηκε." + ) +MSG_HASH( + MSG_SCANNING_WIRELESS_NETWORKS, + "Σάρωση ασύρματων δικτύων..." + ) +MSG_HASH( + MSG_NETPLAY_LAN_SCAN_COMPLETE, + "Οκληρώθηκε η σάρωση Netplay." + ) +MSG_HASH( + MSG_NETPLAY_LAN_SCANNING, + "Σάρωση για οικοδεσπότες netplay..." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE, + "Παύση παιχνιδιού όταν το RetroArch δεν είναι το ενεργό παράθυρο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION, + "Enable or disable composition." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, + "Ενεργοποίηση ή απενεργοποίηση λίστας πρόσφατων για παιχνίδια, εικόνες, μουσική και βίντεο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, + "Περιορισμός καταχωρήσεων στην λίστα πρόσφατων για παιχνίδια, εικόνες, μουσική και βίντεο." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Ενοποιημένος Χειρισμός Μενού" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, + "Χρήση του ίδιου χειρισμού για το μενού και το παιχνίδι. Εφαρμόζεται στο πληκτρολόγιο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FONT_ENABLE, + "Εμφάνιση μηνυμάτων οθόνης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETWORK_USER_REMOTE_ENABLE, + "User %d Remote Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BATTERY_LEVEL_ENABLE, + "Εμφάνιση επιπέδου μπαταρίας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SELECT_FILE, + "Επιλογή Αρχείου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SELECT_FROM_COLLECTION, + "Επιλογή Από Συλλογή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FILTER, + "Φίλτρα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SCALE, + "Κλίμακα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED, + "Netplay will start when content is loaded." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_LOAD_CONTENT_MANUALLY, + "Couldn't find a suitable core or content file, load manually." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_URL_LIST, + "Browse URL" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_URL, + "URL Path" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BROWSE_START, + "Έναρξη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, + "Bokeh" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOWFLAKE, + "Χιονονιφάδα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, + "Ανανέωση Λίστας Δωματίων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME, + "Ψευδώνυμο: %s" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, + "Ψευδώνυμο (lan): %s" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND, + "Βρέθηκε συμβατό περιεχόμενο" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_CROP_OVERSCAN, + "Αφαιρεί μερικά pixel γύρω από την εικόνα όπου εθιμικά οι προγραμματιστές άφηναν κενά ή και που περιέχουν άχρηστα pixel." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SMOOTH, + "Προσθέτει μία μικρή θολούρα στην εικόνα ώστε να αφαιρέσει τις σκληρές γωνίες των pixel. Αυτή η επιλογή έχει πολύ μικρή επιρροή στην επίδοση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FILTER, + "Εφαρμόστε ένα φίλτρο βίντεο που λειτουργεί με τον επεξεργαστή.\n" + "ΣΗΜΕΙΩΣΗ: Μπορεί να έχει μεγάλο κόστος στην επίδοση. Μερικά φίλτρα βίντεο μπορεί να δουλεύουν μόνο με πυρήνες που χρησιμοποιούν 32bit ή 16bit χρώμα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, + "Εισάγεται το όνομα χρήστη του λογαριασμού σας στο RetroAchievements." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, + "Εισάγεται τον κωδικό πρόσβασης του λογαριασμού σας στο RetroAchievements." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, + "Εισάγεται το όνομα χρήστη σας εδώ. Αυτό θα χρησιμοποιηθεί για συνεδρίες netplay ανάμεσα σε άλλα πράγματα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, + "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_LIST, + "Επιλέξτε ποιον πυρήνα θα χρησιμοποιήστε." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, + "Επιλέξτε ποιο περιεχόμενο θα ξεκινήσετε." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, + "Εμφάνιση ανταπτόρων δικτύου και τις συσχετιζόμενες διευθύνσεις IP." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, + "Εμφάνιση πληροφοριών για την συγκεκριμένη συσκευή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUIT_RETROARCH, + "Έξοδος από το πρόγραμμα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, + "Ορίστε το προτιμώμενο πλάτος του παραθύρου απεικόνισης. Αφήνοντας το στο 0 θα επιχειρηθεί η κλίμακα του παραθύρου να είναι όσο το δυνατόν μεγαλύτερη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, + "Ορίστε το προτιμώμενο ύψος του παραθύρου απεικόνισης. Αφήνοντας το στο 0 θα επιχειρηθεί η κλίμακα του παραθύρου να είναι όσο το δυνατόν μεγαλύτερη." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, + "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, + "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, + "Specify custom X axis position for onscreen text." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, + "Specify custom Y axis position for onscreen text." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE, + "Specify the font size in points." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, + "Απόκρυψη του επικαλλύματος μέσα στο μενού και εμφάνιση του ξανά με την έξοδο από το μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS, + "Εμφάνιση εισαγωγών πληκτρολογίου/χειριστηρίου στο επικάλλυμα οθόνης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT, + "Επιλογή της θύρας για όταν είναι ενεργοποιημένη η επιλογή 'Εμφάνιση Εισαγωγών Στην Οθόνη'" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, + "Το σαρωμένο περιεχόμενο θα εμφανίζεται εδώ." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, + "Αλλαγή κλίμακας βίντεο σε ακέραια βήματα. Το βασικό μέγεθος εξαρτάται από την γεωμετρία και την κλίμακα οθόνης του συστήματος. Εάν η 'Εξαναγκασμένη Κλίμακα' δεν έχει οριστεί, οι άξωνες X/Y θα αλλάζουν κλίμακα ξεχωριστά." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT, + "Screenshots output of GPU shaded material if available." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ROTATION, + "Forces a certain rotation of the screen. The rotation is added to rotations which the core sets." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FORCE_SRGB_DISABLE, + "Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows have video problems with sRGB FBO support if this is enabled. Enabling this can work around it." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN, + "Έναρξη σε πλήρη οθόνη. Μπορεί να αλλάξει κατά την εκτέλεση. Μπορεί να παρακαμπτεί από έναν διακόπτη γραμμής τερματικού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN, + "Εάν χρησιμοποιηθεί πλήρης οθόνη προτιμήστε την κατάσταση παραθύρου πλήρης οθόνης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_GPU_RECORD, + "Records output of GPU shaded material if available." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_INDEX, + "When making a savestate, save state index is automatically increased before it is saved. When loading content, the index will be set to the highest existing index." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE, + "Block Save RAM from being overwritten when loading save states. Might potentially lead to buggy games." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO, + "The maximum rate at which content will be run when using fast forward (e.g., 5.0x for 60 fps content = 300 fps cap). If set to 0.0x, fastforward ratio is unlimited (no FPS cap)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO, + "When in slow motion, content will slow down by the factor specified/set." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_ENABLED, + "Run core logic one or more frames ahead then load the state back to reduce perceived input lag." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_FRAMES, + "The number of frames to run ahead. Causes gameplay issues such as jitter if you exceed the number of lag frames internal to the game." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_SECONDARY_INSTANCE, + "Use a second instance of the RetroArch core to run ahead. Prevents audio problems due to loading state." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN_AHEAD_HIDE_WARNINGS, + "Hides the warning message that appears when using RunAhead and the core does not support savestates." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_ENABLE, + "Ενεργοποίηση επιστροφής. Η επίδοση θα πέσει κατά το παιχνίδι." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE, + "Apply cheat immediately after toggling." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD, + "Auto-apply cheats when game loads." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_COUNT, + "The number of times the cheat will be applied. Use with the other two Iteration options to affect large areas of memory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_ADDRESS, + "After each 'Number of Iterations' the Memory Address will be increased by this number times the 'Memory Search Size'." +) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE, + "After each 'Number of Iterations' the Value will be increased by this amount." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, + "When rewinding a defined number of frames, you can rewind several frames at a time, increasing the rewind speed." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE, + "The amount of memory (in MB) to reserve for the rewind buffer. Increasing this will increase the amount of rewind history." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_REWIND_BUFFER_SIZE_STEP, + "Each time you increase or decrease the rewind buffer size value via this UI it will change by this amount" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_IDX, + "Index position in list." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADDRESS_BIT_POSITION, + "Address bitmask when Memory Search Size < 8-bit." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_MATCH_IDX, + "Select the match to view." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_OR_CONT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_OR_RESTART, + "Αριστερά/Δεξιά για αλλαγή μεγέθους bit" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EXACT, + "Αριστερά/Δεξιά για αλλαγή τιμής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GT, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_LTE, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_GTE, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQ, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_NEQ, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQPLUS, + "Αριστερά/Δεξιά για αλλαγή τιμής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_SEARCH_EQMINUS, + "Αριστερά/Δεξιά για αλλαγή τιμής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_MATCHES, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_VIEW_MATCHES, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_CREATE_OPTION, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DELETE_OPTION, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_TOP, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_BOTTOM, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DELETE_ALL, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_RELOAD_CHEATS, + "" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_BIG_ENDIAN, + "Big endian : 258 = 0x0102,\n" + "Little endian : 258 = 0x0201" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LIBRETRO_LOG_LEVEL, + "Sets log level for cores. If a log level issued by a core is below this value, it is ignored." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PERFCNT_ENABLE, + "Enable performance counters for RetroArch (and cores)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_SAVE, + "Automatically makes a savestate at the end of RetroArch's runtime. RetroArch will automatically load this savestate if 'Auto Load State' is enabled." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_AUTO_LOAD, + "Automatically load the auto save state on startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_THUMBNAIL_ENABLE, + "Show thumbnails of save states inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTOSAVE_INTERVAL, + "Autosaves the non-volatile Save RAM at a regular interval. This is disabled by default unless set otherwise. The interval is measured in seconds. A value of 0 disables autosave." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_REMAP_BINDS_ENABLE, + "If enabled, overrides the input binds with the remapped binds set for the current core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, + "Enable input auto-detection. Will attempt to autoconfigure joypads, Plug-and-Play style." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, + "Εναλλαγή πλήτρκων για Επιβεβαίωση/Ακύρωση. Απενεργοποιημένο είναι ο Ιαπωνικός προσανατολισμός, ενεργοποιημένος είναι ο δυτικός προσανατολισμός." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO, + "Εάν απενεργοποιηθεί το περιεχόμενο θα συνεχίσει να τρέχει στο παρασκήνιο όταν το μενού του RetroArch είναι ανοικτό." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_DRIVER, + "Οδηγός βίντεο προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DRIVER, + "Οδηγός ήχου προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_DRIVER, + "Οδηγός Εισόδου προς χρήση. Ανάλογα με τον οδηγό βίντεο, ίσως αλλάξει αναγκαστικά ο οδηγός εισαγωγής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_JOYPAD_DRIVER, + "Οδηγός Joypad προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_DRIVER, + "Οδηγός Επαναδειγματολήπτη Ήχου προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CAMERA_DRIVER, + "Οδηγός Κάμερας προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOCATION_DRIVER, + "Οδηγός Τοποθεσίας προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_DRIVER, + "Οδηγός Μενού προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORD_DRIVER, + "Οδηγός Εγγραφής προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_DRIVER, + "Οδηγός MIDI προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_WIFI_DRIVER, + "Οδηγός Wi-Fi προς χρήση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE, + "Filter files being shown in filebrowser by supported extensions." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_WALLPAPER, + "Select an image to set as menu wallpaper." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPER, + "Dynamically load a new wallpaper depending on context." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DEVICE, + "Παράκαμψη της προκαθορισμένης συσκευής ήχου που χρησιμοποιεί ο οδηγός ήχου. Αυτή η επιλογή εξαρτάται από τον οδηγό." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_DSP_PLUGIN, + "Πρόσθετο ήχου DSP που επεξεργάζεται τον ήχο πριν αποσταλεί στον οδηγό." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_OUTPUT_RATE, + "Audio output sample rate." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_OPACITY, + "Διαφάνεια όλων των στοιχείων του επικαλλύματος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_SCALE, + "Κλίμακα όλων των στοιχείων του επικαλλύματος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE, + "Ενεργοποίηση του επικαλλύματος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_PRESET, + "Επιλογή ενός επικαλλύματος από τον περιηγητή αρχείων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, + "The address of the host to connect to." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT, + "The port of the host IP address. Can be either a TCP or UDP port." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_PASSWORD, + "The password for connecting to the netplay host. Used only in host mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE, + "Whether to announce netplay games publicly. If unset, clients must manually connect rather than using the public lobby." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_SPECTATE_PASSWORD, + "The password for connecting to the netplay host with only spectator privileges. Used only in host mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_START_AS_SPECTATOR, + "Whether to start netplay in spectator mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ALLOW_SLAVES, + "Whether to allow connections in slave mode. Slave-mode clients require very little processing power on either side, but will suffer significantly from network latency." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REQUIRE_SLAVES, + "Whether to disallow connections not in slave mode. Not recommended except for very fast networks with very weak machines." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_STATELESS_MODE, + "Whether to run netplay in a mode not requiring save states. If set to true, a very fast network is required, but no rewinding is performed, so there will be no netplay jitter." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_CHECK_FRAMES, + "The frequency in frames with which netplay will verify that the host and client are in sync." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_NAT_TRAVERSAL, + "When hosting, attempt to listen for connections from the public Internet, using UPnP or similar technologies to escape LANs." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_STDIN_CMD_ENABLE, + "Enable stdin command interface." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MOUSE_ENABLE, + "Enable mouse controls inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_POINTER_ENABLE, + "Enable touch controls inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_THUMBNAILS, + "Type of thumbnail to display." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LEFT_THUMBNAILS, + "Type of thumbnail to display at the left." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS, + "Display the left thumbnail under the right one, on the right side of the screen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_TIMEDATE_ENABLE, + "Εμφάνιση τρέχουσας ημερομηνίας ή και ώρας μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BATTERY_LEVEL_ENABLE, + "Εμφάνιση τρέχουσας μπαταρίας μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NAVIGATION_WRAPAROUND, + "Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_HOST, + "Ενεργοποιεί το netplay ως οικοδεσπότης (εξυπηρετητής)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_ENABLE_CLIENT, + "Ενεργοποιεί το netplay ως πελάτης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_DISCONNECT, + "Αποσυνδέει μία ενεργή σύνδεση Netplay." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SCAN_DIRECTORY, + "Σαρώνει ένα ευρετήριο για συμβατά αρχεία και τα προσθέτει στην συλλογή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SCAN_FILE, + "Σαρώνει ένα συμβατό αρχείο και το προσθέτει στην συλλογή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SWAP_INTERVAL, + "Χρησιμοποιεί ένα προτιμώμενο διάστημα αλλαγής για το Vsync. Ορίστε αυτό ώστε να μειώσεται στο μισό τον ρυθμό ανανέωσης της οθόνης αποτελεσματικά." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SORT_SAVEFILES_ENABLE, + "Sort save files in folders named after the core used." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SORT_SAVESTATES_ENABLE, + "Sort save states in folders named after the core used." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REQUEST_DEVICE_I, + "Request to play with the given input device." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_UPDATER_BUILDBOT_URL, + "URL to core updater directory on the Libretro buildbot." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_BUILDBOT_ASSETS_URL, + "URL to assets updater directory on the Libretro buildbot." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_UPDATER_AUTO_EXTRACT_ARCHIVE, + "After downloading, automatically extract files contained in the downloaded archives." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_REFRESH_ROOMS, + "Σάρωση για νέα δωμάτια." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DELETE_ENTRY, + "Κατάργηση αυτής της καταχώρησης από την συλλογή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INFORMATION, + "View more information about the content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES, + "Προσθήκη καταχώρησης στα αγαπημένα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST, + "Προσθήκη καταχώρησης στα αγαπημένα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUN, + "Έναρξη περιεχομένου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS, + "Προσαρμογή ρυθμίσεων εξερευνητή αρχείου." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE, + "Enable customized controls by default at startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTO_OVERRIDES_ENABLE, + "Enable customized configuration by default at startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GAME_SPECIFIC_OPTIONS, + "Enable customized core options by default at startup." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_ENABLE, + "Εμφανίζει το όνομα του τρέχων πυρήνα μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DATABASE_MANAGER, + "Προβολή βάσεων δεδομένων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CURSOR_MANAGER, + "Προβολή προηγούμενων αναζητήσεων." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, + "Καταγράφει μία εικόνα της οθόνης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CLOSE_CONTENT, + "Κλείνει το τρέχον περιεχόμενο. Οποιεσδήποτε μη αποθηκευμένες αλλαγές μπορεί να χαθούν." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LOAD_STATE, + "Φόρτωση μίας κατάστασης από την τρέχουσα θέση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_STATE, + "Αποθήκευση μίας κατάστασης στην τρέχουσα θέση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESUME, + "Συνέχιση εκτέλεσης του τρέχοντος περιεχομένου και έξοδος από το Γρήγορο Μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESUME_CONTENT, + "Συνέχιση εκτέλεσης του τρέχοντος περιεχομένου και έξοδος από το Γρήγορο Μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_STATE_SLOT, + "Αλλάζει την τρέχουσα επιλεγμένη θέση κατάστασης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, + "Εάν μία κατάσταση φορτώθηκε, το περιεχόμενο θα επιστρέψει στην κατάσταση πριν την φόρτωση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_UNDO_SAVE_STATE, + "Εάν μία κατάσταση αντικαταστάθηκε, το περιεχόμενο θα επιστρέψει στην προηγούμενη κατάσταση αποθήκευσης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACCOUNTS_RETRO_ACHIEVEMENTS, + "Υπηρεσία RetroAchievements. Για περισσότερες πληροφορίες επισκεφθείτε το http://retroachievements.org" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACCOUNTS_LIST, + "Διαχειρίζεται τους τρέχοντες διαμορφωμένους λογαριασμούς." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_META_REWIND, + "Διαχειρίζεται τις ρυθμίσεις επαναφοράς." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_DETAILS, + "Manages cheat details settings." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_META_CHEAT_SEARCH, + "Start or continue a cheat code search." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESTART_CONTENT, + "Επανεκκινεί το περιεχόμενο από την αρχή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CORE, + "Saves an override configuration file which will apply for all content loaded with this core. Will take precedence over the main configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_CONTENT_DIR, + "Saves an override configuration file which will apply for all content loaded from the same directory as the current file. Will take precedence over the main configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVE_CURRENT_CONFIG_OVERRIDE_GAME, + "Saves an override configuration file which will apply for the current content only. Will take precedence over the main configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_CHEAT_OPTIONS, + "Στήσιμο κωδικών απάτης." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHADER_OPTIONS, + "Στήσιμο σκιάσεων για την οπτική βελτίωση της εικόνας." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_INPUT_REMAPPING_OPTIONS, + "Αλλαγή χειρισμών για το τρέχον εκτελούμενο περιεχόμενο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_OPTIONS, + "Αλλαγή επιλογών για το τρέχον εκτελούμενο περιεχόμενο." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHOW_ADVANCED_SETTINGS, + "Show advanced settings for power users (hidden by default)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_THREADED_DATA_RUNLOOP_ENABLE, + "Perform tasks on a separate thread." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_REMOVE, + "Επιτρέψτε στον χρήστη να καταργεί τις καταχωρήσεις από την συλλογή." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SYSTEM_DIRECTORY, + "Sets the System directory. Cores can query for this directory to load BIOSes, system-specific configs, etc." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RGUI_BROWSER_DIRECTORY, + "Sets start directory for the filebrowser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_DIR, + "Usually set by developers who bundle libretro/RetroArch apps to point to assets." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DYNAMIC_WALLPAPERS_DIRECTORY, + "Directory to store wallpapers dynamically loaded by the menu depending on context." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_THUMBNAILS_DIRECTORY, + "Supplementary thumbnails (boxarts/misc. images, etc.) are stored here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RGUI_CONFIG_DIRECTORY, + "Sets start directory for menu configuration browser." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN, + "The number of frames of input latency for netplay to use to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of noticeable input lag." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_INPUT_LATENCY_FRAMES_RANGE, + "The range of frames of input latency that may be used to hide network latency. Reduces jitter and makes netplay less CPU-intensive, at the expense of unpredictable input lag." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_CYCLE_TRAY_STATUS, + "Cycle the current disk. If the disk is inserted, it will eject the disk. If the disk has not been inserted, it will be inserted. " + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_INDEX, + "Change the disk index." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_OPTIONS, + "Disk image management." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND, + "Select a disk image to insert." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE, + "Makes sure the framerate is capped while inside the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VRR_RUNLOOP_ENABLE, + "No deviation from core requested timing. Use for Variable Refresh Rate screens, G-Sync, FreeSync." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_LAYOUT, + "Select a different layout for the XMB interface." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_THEME, + "Select a different theme for the icon. Changes will take effect after you restart the program." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_SHADOWS_ENABLE, + "Enable drop shadows for all icons. This will have a minor performance hit." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, + "Select a different background color gradient theme." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, + "Modify the opacity of the background wallpaper." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, + "Select a different background color gradient theme." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, + "Select an animated background effect. Can be GPU-intensive depending on the effect. If performance is unsatisfactory, either turn this off or revert to a simpler effect." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_FONT, + "Select a different main font to be used by the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES, + "Προβολή καρτέλας αγαπημένων μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES, + "Προβολή καρτέλας εικόνων μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_MUSIC, + "Προβολή καρτέλας μουσικής μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO, + "Προβολή καρτέλας βίντεο μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_NETPLAY, + "Προβολή καρτέλας netplay μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS, + "Προβολή καρτέλας ρυθμίσεων μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_HISTORY, + "Προβολή καρτέλας πρόσφατου ιστορικού μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_ADD, + "Προβολή καρτέλας εισαγωγής περιεχομένου μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_PLAYLISTS, + "Προβολή καρτέλας λίστας αναπαραγωγής μέσα στο μενού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN, + "Προβολή οθόνης εκκίνησης στο μενού. Τίθεται αυτόματα σε αρνητικό μετά την πρώτη εκκίνηση του προγράμματος." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY, + "Modify the opacity of the header graphic." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_MENU_FOOTER_OPACITY, + "Modify the opacity of the footer graphic." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DPI_OVERRIDE_ENABLE, + "The menu normally scales itself dynamically. If you want to set a specific scaling size instead, enable this." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DPI_OVERRIDE_VALUE, + "Set the custom scaling size here.\n" + "NOTE: You have to enable 'DPI Override' for this scaling size to take effect." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_ASSETS_DIRECTORY, + "Save all downloaded files to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_REMAPPING_DIRECTORY, + "Save all remapped controls to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LIBRETRO_DIR_PATH, + "Directory where the program searches for content/cores." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_LIBRETRO_INFO_PATH, + "Application/core information files are stored here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_JOYPAD_AUTOCONFIG_DIR, + "If a joypad is plugged in, that joypad will be autoconfigured if a config file corresponding to it is present inside this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_DIRECTORY, + "Save all collections to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CACHE_DIRECTORY, + "If set to a directory, content which is temporarily extracted (e.g. from archives) will be extracted to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CURSOR_DIRECTORY, + "Saved queries are stored to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_DATABASE_DIRECTORY, + "Databases are stored to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ASSETS_DIRECTORY, + "This location is queried by default when menu interfaces try to look for loadable assets, etc." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVEFILE_DIRECTORY, + "Save all save files to this directory. If not set, will try to save inside the content file's working directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY, + "Save all save states to this directory. If not set, will try to save inside the content file's working directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY, + "Directory to dump screenshots to." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, + "Ορίζει ένα ευρετήριο όπου τα επικαλλύματα αποθηκεύονται για εύκολη πρόσβαση." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_DATABASE_PATH, + "Τα αρχεία απάτης αποθηκεύονται εδώ." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR, + "Directory where audio DSP filter files are kept." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR, + "Directory where CPU-based video filter files are kept." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_DIR, + "Defines a directory where GPU-based video shader files are kept for easy access." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORDING_OUTPUT_DIRECTORY, + "Recordings will be dumped to this directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RECORDING_CONFIG_DIRECTORY, + "Recording configurations will be kept here." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_FONT_PATH, + "Select a different font for onscreen notifications." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHADER_APPLY_CHANGES, + "Changes to the shader configuration will take effect immediately. Use this if you changed the amount of shader passes, filtering, FBO scale, etc." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_NUM_PASSES, + "Increase or decrease the amount of shader pipeline passes. You can bind a separate shader to each pipeline pass and configure its scale and filtering." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET, + "Load a shader preset. The shader pipeline will be automatically set-up." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_AS, + "Save the current shader settings as a new shader preset." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_CORE, + "Save the current shader settings as the default settings for this application/core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_PARENT, + "Save the current shader settings as the default settings for all files in the current content directory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_SAVE_GAME, + "Save the current shader settings as the default settings for the content." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PARAMETERS, + "Modifies the current shader directly. Changes will not be saved to the preset file." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_SHADER_PRESET_PARAMETERS, + "Modifies the shader preset itself currently used in the menu." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_NUM_PASSES, + "Increase or decrease the amount of cheats." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES, + "Cheat changes will take effect immediately." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_START_SEARCH, + "Start search for a new cheat. Number of bits can be changed." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_CONTINUE_SEARCH, + "Continue search for a new cheat." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD, + "Load a cheat file and replace existing cheats." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD_APPEND, + "Load a cheat file and append to existing cheats." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEAT_FILE_SAVE_AS, + "Save current cheats as a save file." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SETTINGS, + "Γρήγορα πρόσβαση σε όλες τις σχετικές ρυθμίσεις παιχνιδιού." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_INFORMATION, + "View information pertaining to the application/core." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ASPECT_RATIO, + "Floating point value for video aspect ratio (width / height), used if the Aspect Ratio is set to 'Config'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT, + "Προτιμώμενο ύψος οπτικής γωνίας το οποίο χρησιμοποιείται εάν η Αναλογία Οθόνης είναι ορισμένη ως 'Προτιμώμενη'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH, + "Προτιμώμενο πλάτος οπτικής γωνίας το οποίο χρησιμοποιείται εάν η Αναλογία Οθόνης είναι ορισμένη ως 'Προτιμώμενη'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X, + "Προτιμώμενη απόκλειση οπτικής γωνίας για τον ορισμό της θέσης του άξωνα X της οπτικής γωνίας. Αυτό αγνοείται εάν έχεται ενεργοποιήσει την 'Ακέραια Κλίμακα'. Τότε θα κεντραριστεί αυτόματα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y, + "Προτιμώμενη απόκλειση οπτικής γωνίας για τον ορισμό της θέσης του άξωνα Y της οπτικής γωνίας. Αυτό αγνοείται εάν έχεται ενεργοποιήσει την 'Ακέραια Κλίμακα'. Τότε θα κεντραριστεί αυτόματα." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_USE_MITM_SERVER, + "Χρήση Εξυπηρετητή Αναμετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER, + "Forward netplay connections through a man-in-the-middle server. Useful if the host is behind a firewall or has NAT/UPnP problems." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER, + "Τοποθεσία Εξυπηρετητή Αναμετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER, + "Choose a specific relay server to use. Geographically closer locations tend to have lower latency." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER, + "Προσθήκη στον μίκτη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_PLAY, + "Προσθήκη στον μίκτη και αναπαραγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION, + "Προσθήκη στον μίκτη" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION_AND_PLAY, + "Προσθήκη στον μίκτη και αναπαραγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FILTER_BY_CURRENT_CORE, + "Φιλτράρισμα με βάση τον τρέχων πυρήνα" + ) +MSG_HASH( + MSG_AUDIO_MIXER_VOLUME, + "Γενική ένταση μίκτη ήχου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MIXER_VOLUME, + "Γενική ένταση μίκτη ήχου (σε dB). Το 0 είναι η φυσιολογική ένταση και δεν εφαρμόζεται gain." /*Need a good translation for gain if there's any*/ + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, + "Επίπεδο Έντασης Μίκτη Ήχου (dB)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE, + "Σίγαση Μίκτη Ήχου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, + "Σίγαση/κατάργηση σίγασης μίκτη ήχου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, + "Προβολή Διαδικτυακού Ενημερωτή" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, + "Εμφάνιση/απόκρυψη της επιλογής 'Διαδικτυακού Ενημερωτή'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS, + "Προβολές" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS, + "Προβολή ή απόκρυψη στοιχείων στην οθόνη του μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER, + "Προβολή Ενημερωτή Πυρήνων" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER, + "Εμφάνιση/απόκρυψη της ικανότητας ενημέρωσης πυρήνων (και πληροφοριακών αρχείων πυρήνων)." + ) +MSG_HASH( + MSG_PREPARING_FOR_CONTENT_SCAN, + "Προετοιμασία για σάρωση περιεχομένου..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CORE_DELETE, + "Διαγραφή πυρήνα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CORE_DELETE, + "Κατάργηση αυτού του πυρήνα από τον δίσκο." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, + "Framebuffer Opacity" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, + "Modify the opacity of the framebuffer." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, + "Αγαπημένα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_FAVORITES, + "Περιεχόμενο που έχετε προσθέσει στα 'Αγαπημένα' θα εμφανίζεται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_MUSIC, + "Μουσική" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_MUSIC, + "Μουσική που έχει προηγουμένως αναπαραχθεί θα εμφανίζονται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_IMAGES, + "Εικόνα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_IMAGES, + "Εικόνες που έχουν προηγουμένως προβληθεί θα εμφανίζονται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, + "Βίντεο" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_GOTO_VIDEO, + "Βίντεο που έχουν προηγουμένως αναπαραχθεί θα εμφανίζονται εδώ." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, + "Εικονίδια Μενού" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, + "Ενεργοποίηση/Απενεργοποίηση των εικονιδίων που εμφανίζονται στα αριστερά των καταχωρήσεων του μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Ενεργοποίηση Καρτέλας Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS_PASSWORD, + "Ορισμός Κωδικού Για Την Ενεργοποίηση Της Καρτέλας Ρυθμίσεων" + ) +MSG_HASH( + MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Εισαγωγή Κωδικού" + ) +MSG_HASH( + MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Σωστός κωδικός." + ) +MSG_HASH( + MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Λανθασμένος κωδικός." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Ενεργοποιεί την καρτέλα Ρυθμίσεις. Χρειάζεται επανεκκίνηση για να εμφανιστεί η καρτέλα." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, + "Επιτρέψτε στον χρήστη να μετονομάζει τις καταχωρήσεις στην συλλογή." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, + "Επίτρεψη μετονομασίας καταχωρήσεων" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RENAME_ENTRY, + "Μετονομασία του τίτλου αυτής της καταχώρησης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, + "Μετονομασία" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, + "Προβολή Φόρτωσης Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE, + "Εμφάνιση/απόκρυψη της επιλογής 'Φόρτωση Πυρήνα'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CONTENT, + "Προβολή Φόρτωσης Περιεχομένου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT, + "Εμφάνιση/απόκρυψη της επιλογής 'Φόρτωση Περιεχομένου'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION, + "Προβολή Πληροφοριών" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION, + "Εμφάνιση/απόκρυψη της επιλογής 'Πληροφορίες'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS, + "Προβολή Διαμορφώσεων" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS, + "Εμφάνιση/απόκρυψη της επιλογής 'Διαμορφώσεις'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP, + "Προβολή Βοήθειας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, + "Εμφάνιση/απόκρυψη της επιλογής 'Βοήθεια'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, + "Προβολή Εξόδου RetroArch" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, + "Εμφάνιση/απόκρυψη της επιλογής 'Έξοδος από RetroArch'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, + "Προβολή Επανεκκίνησης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT, + "Εμφάνιση/απόκρυψη της επιλογής 'Επανεκκίνηση'." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SHOW_SHUTDOWN, + "Show Shutdown" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SHOW_SHUTDOWN, + "Show/hide the 'Shutdown' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS, + "Γρήγορο Μενού" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS, + "Show or hide elements on the Quick Menu screen." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT, + "Show Take Screenshot" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT, + "Show/hide the 'Take Screenshot' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE, + "Show Save/Load State" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE, + "Show/hide the options for saving/loading state." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, + "Show Undo Save/Load State" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, + "Show/hide the options for undoing save/load state." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, + "Show Add to Favorites" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, + "Show/hide the 'Add to Favorites' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, + "Show Options" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, + "Show/hide the 'Options' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CONTROLS, + "Show Controls" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS, + "Show/hide the 'Controls' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS, + "Show Cheats" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS, + "Show/hide the 'Cheats' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS, + "Show Shaders" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS, + "Show/hide the 'Shaders' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, + "Show Save Core Overrides" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES, + "Show/hide the 'Save Core Overrides' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, + "Show Save Game Overrides" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES, + "Show/hide the 'Save Game Overrides' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION, + "Show Information" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION, + "Show/hide the 'Information' option." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE, + "Notification Background Enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_RED, + "Notification Background Red Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_GREEN, + "Notification Background Green Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_BLUE, + "Notification Background Blue Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY, + "Notification Background Opacity" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE, + "Disable Kiosk Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE, + "Disables kiosk mode. A restart is required for the change to take full effect." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_ENABLE_KIOSK_MODE, + "Ενεργοποίηση Λειτουργίας Κιόσκι" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_ENABLE_KIOSK_MODE, + "Protects the setup by hiding all configuration related settings." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, + "Set Password For Disabling Kiosk Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, + "Supplying a password when enabling kiosk mode makes it possible to later disable it from the menu, by going to the Main Menu, selecting Disable Kiosk Mode and entering the password." + ) +MSG_HASH( + MSG_INPUT_KIOSK_MODE_PASSWORD, + "Εισαγωγή Κωδικού" + ) +MSG_HASH( + MSG_INPUT_KIOSK_MODE_PASSWORD_OK, + "Σωστός κωδικός." + ) +MSG_HASH( + MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, + "Λανθασμένος κωδικός." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_RED, + "Notification Red Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, + "Notification Green Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, + "Notification Blue Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, + "Show frame count on FPS display" + ) +MSG_HASH( + MSG_CONFIG_OVERRIDE_LOADED, + "Configuration override loaded." + ) +MSG_HASH( + MSG_GAME_REMAP_FILE_LOADED, + "Game remap file loaded." + ) +MSG_HASH( + MSG_CORE_REMAP_FILE_LOADED, + "Core remap file loaded." + ) +MSG_HASH( + MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES, + "RunAhead has been disabled because this core does not support save states." + ) +MSG_HASH( + MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, + "Failed to save state. RunAhead has been disabled." + ) +MSG_HASH( + MSG_RUNAHEAD_FAILED_TO_LOAD_STATE, + "Failed to load state. RunAhead has been disabled." + ) +MSG_HASH( + MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, + "Failed to create second instance. RunAhead will now use only one instance." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists." + ) +MSG_HASH( + MSG_SCANNING_OF_FILE_FINISHED, + "Scanning of file finished" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY, + "Διαφάνεια Παραθύρου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY, + "Ποιότητα Επαναδειγματολήπτη Ήχου" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY, + "Ελαττώστε αυτή την τιμή για καλύτερη επίδοση/χαμηλότερη καθυστέρηση αντί ποιότητας ήχου, αυξήστε εάν θέλετε καλύτερη ποιότητα με κόστος στην επίδοση/χαμηλότερη καθυστέρηση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, + "Watch shader files for changes" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, + "Auto-apply changes made to shader files on disk." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, + "Εμφάνιση Διακοσμητικών Παραθύρου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, + "Εμφάνιση Στατιστικών" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_STATISTICS_SHOW, + "Εμφάνιση τεχνικών στατιστικών στην οθόνη." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_ENABLE, + "Enable border filler" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, + "Enable border filler thickness" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, + "Enable background filler thickness" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, + "Για οθόνες CRT μόνο. Προσπαθεί να χρησιμοποιήσει την ακριβή ανάλυση πυρήνα/παιχνιδιού και ρυθμού ανανέωσης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, + "CRT SwitchRes" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, + "Switch among native and ultrawide super resolutions." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, + "Σούπερ Ανάλυση CRT" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, + "Προβολή Ρυθμίσεων Επιστροφής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, + "Εμφάνιση/απόκρυψη επιλογών Επιστροφής." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_LATENCY, + "Εμφάνιση/απόκρυψη επιλογών Καθυστέρησης." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_LATENCY, + "Προβολή Ρυθμίσεων Καθυστέρησης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS, + "Εμφάνιση/απόκρυψη επιλογών Επικαλλυμάτων." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, + "Προβολή Ρυθμίσεων Επικαλλυμάτων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, + "Ενεργοποίηση ήχου μενού" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, + "Ενεργοποίηση ή απενεργοποίηση ήχου μενού." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, + "Ρυθμίσεις Μίκτη" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, + "Εμφάνιση και/ή επεξεργασία ρυθμίσεων μίκτη." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_INFO, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE, + "&File" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE, + "&Load Core..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE, + "&Unload Core" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT, + "E&xit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT, + "&Edit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH, + "&Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW, + "&View" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS, + "Closed Docks" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_SHADER_PARAMS, + "Shader Parameters" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS, + "&Options..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_DOCK_POSITIONS, + "Remember dock positions:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_GEOMETRY, + "Remember window geometry:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_LAST_TAB, + "Remember last content browser tab:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME, + "Θέμα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_SYSTEM_DEFAULT, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_DARK, + "Σκούρο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_CUSTOM, + "Custom..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_TITLE, + "Επιλογές" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_TOOLS, + "&Tools" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP, + "&Help" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT, + "Σχετικά με το RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_DOCUMENTATION, + "Εγχειρίδιο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE, + "Load Custom Core..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE, + "Φόρτωση Πυρήνα΄" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOADING_CORE, + "Φόρτωση Πυρήνα..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_NAME, + "Όνομα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION, + "Έκδοση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS, + "Λίστες Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER, + "File Browser" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_TOP, + "Top" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_UP, + "Up" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER, + "Content Browser" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART, + "Boxart" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT, + "Screenshot" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN, + "Title Screen" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ALL_PLAYLISTS, + "All Playlists" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE, + "Core" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_INFO, + "Core Info" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_SELECTION_ASK, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_INFORMATION, + "Information" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_WARNING, + "Warning" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ERROR, + "Error" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR, + "Network Error" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESTART_TO_TAKE_EFFECT, + "Please restart the program for the changes to take effect." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOG, + "Log" + ) +#ifdef HAVE_QT +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SCAN_FINISHED, + "Scan Finished.

    \n" + "In order for content to be correctly scanned, you must:\n" + "
    • have a compatible core already downloaded
    • \n" + "
    • have \"Core Info Files\" updated via Online Updater
    • \n" + "
    • have \"Databases\" updated via Online Updater
    • \n" + "
    • restart RetroArch if any of the above was just done
    \n" + "Finally, the content must match existing databases from here. If it is still not working, consider submitting a bug report." + ) +#endif +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SHOW_WIMP, + "Εμφάνιση Μενού Επιφάνεις Εργασίας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SHOW_WIMP, + "Opens the desktop menu if closed." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN, + "Don't show this again" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_STOP, + "Στοπ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ASSOCIATE_CORE, + "Associate Core" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_HIDDEN_PLAYLISTS, + "Hidden Playlists" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_HIDE, + "Hide" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_HIGHLIGHT_COLOR, + "Highlight color:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CHOOSE, + "&Choose..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_COLOR, + "Select Color" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_THEME, + "Select Theme" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME, + "Custom Theme" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_PATH_IS_BLANK, + "File path is blank." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY, + "File is empty." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED, + "Could not open file for reading." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_WRITE_OPEN_FAILED, + "Could not open file for writing." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST, + "File does not exist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST, + "Suggest loaded core first:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ZOOM, + "Zoom" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_VIEW, + "View" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_ICONS, + "Icons" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST, + "List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, + "Overrides" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_OVERRIDE_OPTIONS, + "Options for overriding the global configuration." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY, + "Will start playback of the audio stream. Once finished, it will remove the current audio stream from memory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_LOOPED, + "Will start playback of the audio stream. Once finished, it will loop and play the track again from the beginning." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_PLAY_SEQUENTIAL, + "Will start playback of the audio stream. Once finished, it will jump to the next audio stream in sequential order and repeat this behavior. Useful as an album playback mode." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_STOP, + "This will stop playback of the audio stream, but not remove it from memory. You can start playing it again by selecting 'Play'." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_REMOVE, + "This will stop playback of the audio stream and remove it entirely from memory." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIXER_ACTION_VOLUME, + "Adjust the volume of the audio stream." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_MIXER, + "Add this audio track to an available audio stream slot. If no slots are currently available, it will be ignored." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, + "Add this audio track to an available audio stream slot and play it. If no slots are currently available, it will be ignored." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, + "Αναπαραγωγή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, + "Αναπαραγωγή (Looped)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL, + "Αναπαραγωγή (Sequential)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, + "Στοπ" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, + "Κατάργηση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, + "Ένταση" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, + "Τρέχων πυρήνας" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_SEARCH_CLEAR, + "Clear" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACHIEVEMENT_PAUSE, + "Pause achievements for current session (This action will enable savestates, cheats, rewind, pause, and slow-motion)." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_ACHIEVEMENT_RESUME, + "Resume achievements for current session (This action will disable savestates, cheats, rewind, pause, and slow-motion and reset the current game)." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, + "In-Menu" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME, + "In-Game" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED, + "In-Game (Paused)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING, + "Playing" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, + "Paused" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, + "Ενεργοποίηση Discord Rich Presence" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_DISCORD_ALLOW, + "Ενεργοποίηση ή απενεργοποίηση υποστήριξης Discord Rich Presence.\n" + "ΣΗΜΕΙΩΣΗ: Δεν θα δουλέψει με την έκδοση του περιηγητή, μόνο με την τοπικά εγκατεστημένη." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_INPUT, + "Είσοδος" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_INPUT, + "Επιλογή συσκευής εισόδου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_OUTPUT, + "Έξοδος" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_OUTPUT, + "Επιλογή συσκευής εξόδου." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MIDI_VOLUME, + "Ένταση" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MIDI_VOLUME, + "Ορισμός έντασης εξόδου (%)." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, + "Διαχείριση Ενέργειας" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, + "Αλλαγή ρυθμίσεων διαχείρισης ενέργειας." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, + "Κατάσταση Συνεχούς Επίδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MPV_SUPPORT, + "Υποστήριξη mpv" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_IDX, + "Index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MATCH_IDX, + "View Match #" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MATCH, + "Match Address: %08X Mask: %02X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_MATCH, + "Create Code Match #" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_MATCH, + "Delete Match #" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_BROWSE_MEMORY, + "Browse Address: %08X" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DESC, + "Πληροφορίες" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_STATE, + "Ενεργοποιημένο" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CODE, + "Κωδικός" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_HANDLER, + "Handler" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_MEMORY_SEARCH_SIZE, + "Memory Search Size" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_TYPE, + "Τύπος" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_VALUE, + "Τιμή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS, + "Memory Address" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADDRESS_BIT_POSITION, + "Memory Address Mask" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_TYPE, + "Rumble When Memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_VALUE, + "Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PORT, + "Rumble Port" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_STRENGTH, + "Rumble Primary Strength" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_PRIMARY_DURATION, + "Rumble Primary Duration (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_STRENGTH, + "Rumble Secondary Strength" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RUMBLE_SECONDARY_DURATION, + "Rumble Secondary Duration (ms)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_COUNT, + "Number of Iterations" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_VALUE, + "Value Increase Each Iteration" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_ADDRESS, + "Address Increase Each Iteration" +) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_AFTER, + "Add New Cheat After This One" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BEFORE, + "Add New Cheat Before This One" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_AFTER, + "Copy This Cheat After" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_COPY_BEFORE, + "Copy This Cheat Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE, + "Delete This Cheat" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_EMU, + "Emulator" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_RETRO, + "RetroArch" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_DISABLED, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_SET_TO_VALUE, + "Set To Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_INCREASE_VALUE, + "Increase By Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_DECREASE_VALUE, + "Decrease By Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_EQ, + "Run next cheat if value = memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_NEQ, + "Run next cheat if value != memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_LT, + "Run next cheat if value < memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_TYPE_RUN_NEXT_IF_GT, + "Run next cheat if value > memory" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DISABLED, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_CHANGES, + "Changes" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DOES_NOT_CHANGE, + "Does Not Change" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE, + "Increases" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE, + "Decreases" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_EQ_VALUE, + "= Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_NEQ_VALUE, + "!= Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_LT_VALUE, + "< Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_GT_VALUE, + "> Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_INCREASE_BY_VALUE, + "Increases by Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_TYPE_DECREASE_BY_VALUE, + "Decreases by Rumble Value" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_1, + "1-bit, max value = 0x01" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_2, + "2-bit, max value = 0x03" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_4, + "4-bit, max value = 0x0F" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_8, + "8-bit, max value = 0xFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_16, + "16-bit, max value = 0xFFFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_MEMORY_SIZE_32, + "32-bit, max value = 0xFFFFFFFF" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_0, + "1" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_1, + "2" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_2, + "3" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_3, + "4" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_4, + "5" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_5, + "6" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_6, + "7" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_7, + "8" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_8, + "9" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_9, + "10" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_10, + "11" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_11, + "12" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_12, + "13" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_13, + "14" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_14, + "15" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_15, + "16" + ) +MSG_HASH( + MENU_ENUM_LABEL_RUMBLE_PORT_16, + "All" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_CONT, + "Start or Continue Cheat Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_START_OR_RESTART, + "Start or Restart Cheat Search" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EXACT, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LT, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GT, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQ, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_GTE, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_LTE, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_NEQ, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQPLUS, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_EQMINUS, + "Search Memory For Values" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES, + "Add the %u Matches to Your List" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_VIEW_MATCHES, + "View the List of %u Matches" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_CREATE_OPTION, + "Create Code From This Match" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_OPTION, + "Delete This Match" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_TOP, + "Add New Code to Top" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BOTTOM, + "Add New Code to Bottom" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_ALL, + "Delete All Codes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_RELOAD_CHEATS, + "Reload Game-Specific Cheats" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL, + "Equal to %u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL, + "Less Than Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL, + "Greater Than Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL, + "Less Than or Equal To Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL, + "Greater Than or Equal To Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL, + "Equal to Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL, + "Not Equal to Before" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL, + "Equal to Before+%u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL, + "Equal to Before-%u (%X)" + ) +MSG_HASH( + MENU_ENUM_LABEL_CHEAT_SEARCH_SETTINGS, + "Start or Continue Cheat Search" + ) +MSG_HASH( + MSG_CHEAT_INIT_SUCCESS, + "Successfully started cheat search" + ) +MSG_HASH( + MSG_CHEAT_INIT_FAIL, + "Failed to start cheat search" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_NOT_INITIALIZED, + "Searching has not been initialized/started" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_FOUND_MATCHES, + "New match count = %u" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEAT_BIG_ENDIAN, + "Big Endian" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_SUCCESS, + "Added %u matches" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_FAIL, + "Failed to add matches" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS, + "Created code from match" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADD_MATCH_FAIL, + "Failed to create code" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS, + "Deleted match" + ) +MSG_HASH( + MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY, + "Not enough room. The total number of cheats you can have is 100." + ) +MSG_HASH( + MSG_CHEAT_ADD_TOP_SUCCESS, + "New cheat added to top of list." + ) +MSG_HASH( + MSG_CHEAT_ADD_BOTTOM_SUCCESS, + "New cheat added to bottom of list." + ) +MSG_HASH( + MSG_CHEAT_DELETE_ALL_INSTRUCTIONS, + "Press right five times to delete all cheats." + ) +MSG_HASH( + MSG_CHEAT_DELETE_ALL_SUCCESS, + "All cheats deleted." + ) +MSG_HASH( + MSG_CHEAT_ADD_BEFORE_SUCCESS, + "New cheat added before this one." + ) +MSG_HASH( + MSG_CHEAT_ADD_AFTER_SUCCESS, + "New cheat added after this one." + ) +MSG_HASH( + MSG_CHEAT_COPY_BEFORE_SUCCESS, + "Cheat copied before this one." + ) +MSG_HASH( + MSG_CHEAT_COPY_AFTER_SUCCESS, + "Cheat copied after this one." + ) +MSG_HASH( + MSG_CHEAT_DELETE_SUCCESS, + "Cheat deleted." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PROGRESS, + "Progress:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_LIST_MAX_COUNT, + "\"All Playlists\" max list entries:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_GRID_MAX_COUNT, + "\"All Playlists\" max grid entries:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SHOW_HIDDEN_FILES, + "Εμφάνιση κρυφών αρχείων και φακέλων:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_NEW_PLAYLIST, + "Νέα Λίστα Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ENTER_NEW_PLAYLIST_NAME, + "Please enter the new playlist name:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DELETE_PLAYLIST, + "Διαγραφή Λίστας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RENAME_PLAYLIST, + "Μετονομασία Λίστας Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST, + "Are you sure you want to delete the playlist \"%1\"?" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_QUESTION, + "Question" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_DELETE_FILE, + "Could not delete file." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE, + "Could not rename file." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_GATHERING_LIST_OF_FILES, + "Gathering list of files..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADDING_FILES_TO_PLAYLIST, + "Adding files to playlist..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY, + "Playlist Entry" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_NAME, + "Όνομα:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH, + "Path:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_CORE, + "Πυρήνας:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_DATABASE, + "Database:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS, + "Extensions:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_EXTENSIONS_PLACEHOLDER, + "(space-separated; includes all by default)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_FILTER_INSIDE_ARCHIVES, + "Filter inside archives" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS, + "(used to find thumbnails)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM, + "Are you sure you want to delete the item \"%1\"?" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, + "Please choose a single playlist first." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DELETE, + "Delete" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY, + "Add Entry..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_FILES, + "Add File(s)..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER, + "Add Folder..." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_EDIT, + "Edit" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_FILES, + "Select Files" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER, + "Select Folder" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE, + "" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY, + "Error updating playlist entry." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS, + "Please fill out all required fields." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_NIGHTLY, + "Update RetroArch (nightly)" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FINISHED, + "RetroArch updated successfully. Please restart the application for the changes to take effect." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FAILED, + "Update failed." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT_CONTRIBUTORS, + "Contributors" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CURRENT_SHADER, + "Current shader" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MOVE_DOWN, + "Move Down" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MOVE_UP, + "Move Up" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_LOAD, + "Load" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SAVE, + "Save" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_REMOVE, + "Remove" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_APPLY, + "Apply" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_ADD_PASS, + "Add Pass" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_CLEAR_ALL_PASSES, + "Clear All Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_SHADER_NO_PASSES, + "No shader passes." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_PASS, + "Reset Pass" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_ALL_PASSES, + "Reset All Passes" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_RESET_PARAMETER, + "Reset Parameter" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_THUMBNAIL, + "Download thumbnail" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALREADY_IN_PROGRESS, + "A download is already in progress." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST, + "Start on playlist:" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS, + "Λήψη Όλων των Σκίτσων" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_ENTIRE_SYSTEM, + "Όλο το Σύστημα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS_THIS_PLAYLIST, + "Αυτή η Λίστα Αναπαραγωγής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_PACK_DOWNLOADED_SUCCESSFULLY, + "Επιτυχής λήψη σκίτσων." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_PLAYLIST_THUMBNAIL_PROGRESS, + "Πέτυχαν: %1 Απέτυχαν: %2" + ) +MSG_HASH( + MSG_DEVICE_CONFIGURED_IN_PORT, + "Διαμορφώθηκε στην θύρα:" + ) +MSG_HASH( + MSG_FAILED_TO_SET_DISK, + "Αποτυχία ορισμού δίσκου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QT_CORE_OPTIONS, + "Επιλογές Πυρήνα" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_ADAPTIVE_VSYNC, + "Προσαρμοστικό Vsync" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, + "Το V-Sync είναι ενεργοποιημένο μέχρι η επίδοση να πέσει κάτω από τον στόχο ρυθμού ανανέωσης. Μπορεί να μειώσει τα κολλήματα όταν η επίδοση πέφτει χαμηλότερα από τον κανονικό χρόνο και μπορεί να είναι πιο αποδοτικό ενεργειακά." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, + "CRT SwitchRes" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCHRES_SETTINGS, + "Εξαγωγή ντόπιων, χαμηλής ανάλυσης σημάτων για χρήση με οθόνες CRT." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_X_AXIS_CENTERING, + "Εναλλάξτε μεταξύ αυτών των επιλογών εάν η εικόνα δεν είναι σωστά κεντραρισμένη στην οθόνη." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_X_AXIS_CENTERING, + "Κεντράρισμα Άξωνα Χ" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, + "Χρήση προσαρμοσμένου ρυθμού ανανέωσης προσδιορισμένου στο αρχείο διαμόρφωσης εάν χρειάζεται." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_USE_CUSTOM_REFRESH_RATE, + "Χρήση Προσαρμοσμένου Ρυθμού Ανανέωσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, + "Επιλέξτε την θύρα εξόδου που είναι συνδεδεμένη με την οθόνη CRT." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_OUTPUT_DISPLAY_ID, + "ID Οθόνης Εξόδου" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, + "Έναρξη Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, + "Ξεκινάει την εγγραφή." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, + "Τέλος Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, + "Σταματάει την εγγραφή." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_STREAMING, + "Έναρξη Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_START_STREAMING, + "Ξεκινάει την απευθείας μετάδοση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_STREAMING, + "Τέλος Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_STREAMING, + "Σταματάει την απευθείας μετάδοση." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_RECORDING_TOGGLE, + "Εγγραφή" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_STREAMING_TOGGLE, + "Απευθείας Μετάδοση" + ) +MSG_HASH( + MSG_CHEEVOS_HARDCORE_MODE_DISABLED, + "A savestate was loaded, Achievements Hardcore Mode disabled for the current session. Restart to enable hardcore mode." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_QUALITY, + "Ποιότητα Εγγραφής" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_STREAM_QUALITY, + "Ποιότητα Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_URL, + "Σύνδεσμος Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_UDP_STREAM_PORT, + "Θύρα UDP Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_TWITCH, + "Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_ACCOUNTS_YOUTUBE, + "YouTube" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, + "Κλειδί Απευθείας Μετάδοσης Twitch" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, + "Κλειδί Απευθείας Μετάδοσης YouTube" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Μέσο Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, + "Τίτλος Απευθείας Μετάδοσης" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON, + "Χωριστά Joy-Con" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG, + "Επαναφορά Προεπιλογών" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESET_TO_DEFAULT_CONFIG, + "Επαναφορά της τρέχουσας διαμόρφωσης στις προεπιλεγμένες ρυθμίσεις." + ) + +MSG_HASH( + MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK, + "OK" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, + "Χρώμα Θέματος Μενού" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, + "Basic White" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, + "Basic Black" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, + "Select a different color theme." + ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") From c9a5156e5d32c1580399cbcbdb6aa0ec7b04f1a6 Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 19:19:52 +0200 Subject: [PATCH 0437/1292] ozone: fix on the fly theme setting --- intl/msg_hash_ar.h | 2 +- intl/msg_hash_chs.h | 2 +- intl/msg_hash_cht.h | 2 +- intl/msg_hash_de.h | 2 +- intl/msg_hash_el.h | 2 +- intl/msg_hash_eo.h | 2 +- intl/msg_hash_es.h | 2 +- intl/msg_hash_fr.h | 2 +- intl/msg_hash_it.h | 2 +- intl/msg_hash_ja.h | 2 +- intl/msg_hash_ko.h | 2 +- intl/msg_hash_nl.h | 2 +- intl/msg_hash_pl.h | 2 +- intl/msg_hash_pt_br.h | 2 +- intl/msg_hash_pt_pt.h | 2 +- intl/msg_hash_ru.h | 2 +- intl/msg_hash_us.h | 2 +- intl/msg_hash_vn.h | 2 +- menu/drivers/ozone.c | 98 +++++++++++++++++++++++++++++++++---------- 19 files changed, 93 insertions(+), 41 deletions(-) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 04343e17f2..8b2c710329 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3695,4 +3695,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index ba01b8d8fc..a02caeeaa6 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -4714,4 +4714,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index b7b82260ce..1fb9e5dba5 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3471,4 +3471,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 3c7745ff02..2637884ab6 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3607,4 +3607,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index ede7afaa57..d6277e1154 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -7699,4 +7699,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index efe536b4ae..e2f0ebe25b 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3346,4 +3346,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 3b76bc16d4..0dc0ecaff4 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7636,4 +7636,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index a5725ffe38..748d6aee42 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3505,4 +3505,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index ef28f825b8..028ca74cc1 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3565,4 +3565,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 11abb76f1a..49e80b63d2 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -4014,4 +4014,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 0ca5f38017..0cae872621 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3466,4 +3466,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 117ed1478a..94093064a7 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3352,4 +3352,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index ce60cab76a..1a278f4484 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3768,4 +3768,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 29df5966e6..41fe5e2788 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7730,4 +7730,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 82959c4f57..68626e9a45 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3432,4 +3432,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 8df4fd9f6e..36145db042 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3635,4 +3635,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 98f684f272..9189992a5b 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7730,4 +7730,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 7546e1f6a4..6f4a5c5cf3 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3505,4 +3505,4 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's default color theme (if one is set).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 52366b3214..5cfd2a35a1 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -422,8 +422,9 @@ ozone_theme_t ozone_theme_dark = { "dark" }; -static unsigned last_color_theme = 0; -static ozone_theme_t *ozone_default_theme = &ozone_theme_light; +static unsigned last_color_theme = 0; +static bool last_use_preferred_system_color_theme = false; +static ozone_theme_t *ozone_default_theme = &ozone_theme_light; typedef struct ozone_handle { @@ -1106,6 +1107,40 @@ static void ozone_draw_text( 1.0); } +static void ozone_set_theme_path(ozone_handle_t *ozone) +{ + fill_pathname_join( + ozone->theme_path, + ozone->png_path, + ozone->theme->name, + sizeof(ozone->theme_path) + ); +} + +static void ozone_unload_theme_textures(ozone_handle_t *ozone) +{ + int i; + + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + video_driver_texture_unload(&ozone->theme_textures[i]); +} + +static void ozone_reset_theme_textures(ozone_handle_t *ozone) +{ + int i; + + ozone_set_theme_path(ozone); + + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + { + char filename[PATH_MAX_LENGTH]; + strlcpy(filename, OZONE_THEME_TEXTURES_FILES[i], sizeof(filename)); + strlcat(filename, ".png", sizeof(filename)); + + menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } +} + static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) { ozone_theme_t *theme = ozone_default_theme; @@ -1130,6 +1165,9 @@ static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) memcpy(ozone->theme_dynamic.entries_border, ozone->theme->entries_border, sizeof(ozone->theme_dynamic.entries_border)); memcpy(ozone->theme_dynamic.entries_icon, ozone->theme->entries_icon, sizeof(ozone->theme_dynamic.entries_icon)); + ozone_unload_theme_textures(ozone); + ozone_reset_theme_textures(ozone); + last_color_theme = color_theme; } @@ -1202,6 +1240,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) setsysGetColorSetId(&theme); color_theme = (theme == ColorSetId_Dark) ? 1 : 0; ozone_set_color_theme(ozone, color_theme); + settings->uints.menu_ozone_color_theme = color_theme; settings->bools.menu_preferred_system_color_theme_set = true; setsysExit(); } @@ -1253,13 +1292,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) sizeof(ozone->tab_path) ); - /* Theme path */ - fill_pathname_join( - ozone->theme_path, - ozone->png_path, - ozone->theme->name, - sizeof(ozone->theme_path) - ); + last_use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme; return menu; @@ -1361,14 +1394,7 @@ static void ozone_context_reset(void *data, bool is_threaded) } /* Theme textures */ - for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) - { - char filename[PATH_MAX_LENGTH]; - strlcpy(filename, OZONE_THEME_TEXTURES_FILES[i], sizeof(filename)); - strlcat(filename, ".png", sizeof(filename)); - - menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); - } + ozone_reset_theme_textures(ozone); /* Icons textures init */ for (i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) @@ -1407,8 +1433,7 @@ static void ozone_context_destroy(void *data) return; /* Theme */ - for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) - video_driver_texture_unload(&ozone->theme_textures[i]); + ozone_unload_theme_textures(ozone); /* Icons */ for (i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) @@ -2414,6 +2439,23 @@ static void ozone_navigation_alphabet(void *data, size_t *unused) ozone_selection_changed(ozone, true); } +static unsigned ozone_get_system_theme() +{ + unsigned ret = 0; +#ifdef HAVE_LIBNX + if (R_SUCCEEDED(setsysInitialize())) + { + ColorSetId theme; + setsysGetColorSetId(&theme); + ret = (theme == ColorSetId_Dark) ? 1 : 0; + setsysExit(); + } + + return ret; +#endif + return 0; +} + static void ozone_frame(void *data, video_frame_info_t *video_info) { menu_display_ctx_clearcolor_t clearcolor; @@ -2424,14 +2466,25 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) if (!ozone) return; - if (color_theme != last_color_theme) - ozone_set_color_theme(ozone, color_theme); + /* Change theme on the fly */ + if (color_theme != last_color_theme || last_use_preferred_system_color_theme != settings->bools.menu_use_preferred_system_color_theme) + { + if (!settings->bools.menu_use_preferred_system_color_theme) + ozone_set_color_theme(ozone, color_theme); + else + { + video_info->ozone_color_theme = ozone_get_system_theme(); + ozone_set_color_theme(ozone, video_info->ozone_color_theme); + } + + last_use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme; + } ozone->frame_count++; menu_display_set_viewport(video_info->width, video_info->height); - /* Clear first layer of text */ + /* Clear text */ font_driver_bind_block(ozone->fonts.footer, &ozone->raster_blocks.footer); font_driver_bind_block(ozone->fonts.title, &ozone->raster_blocks.title); font_driver_bind_block(ozone->fonts.time, &ozone->raster_blocks.time); @@ -2447,7 +2500,6 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) ozone->raster_blocks.sidebar.carr.coords.vertices = 0; /* Background */ - clearcolor.r = ozone->theme->background_r; clearcolor.g = ozone->theme->background_g; clearcolor.b = ozone->theme->background_b; From efb71fc38ef1bd64b1441240d2bea7233cd511b7 Mon Sep 17 00:00:00 2001 From: M4xw Date: Sat, 27 Oct 2018 19:27:24 +0200 Subject: [PATCH 0438/1292] [LIBNX] Initialize HID anyway, might fix randomly having no controls --- input/drivers/switch_input.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/input/drivers/switch_input.c b/input/drivers/switch_input.c index 0176ed63bc..2c48642b2e 100644 --- a/input/drivers/switch_input.c +++ b/input/drivers/switch_input.c @@ -137,6 +137,10 @@ static void switch_input_free_input(void *data) sw->joypad->destroy(); free(sw); + +#ifdef HAVE_LIBNX + hidExit(); +#endif } static void* switch_input_init(const char *joypad_driver) @@ -145,6 +149,10 @@ static void* switch_input_init(const char *joypad_driver) if (!sw) return NULL; +#ifdef HAVE_LIBNX + hidInitialize(); +#endif + sw->joypad = input_joypad_init_driver(joypad_driver, sw); #ifdef HAVE_LIBNX From 67ed8d3986e3de505e8d0ff473147df5d30e9730 Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 19:24:19 +0200 Subject: [PATCH 0439/1292] ozone: fix entries centering --- menu/drivers/ozone.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 5cfd2a35a1..ef945c1b9c 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1120,7 +1120,7 @@ static void ozone_set_theme_path(ozone_handle_t *ozone) static void ozone_unload_theme_textures(ozone_handle_t *ozone) { int i; - + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) video_driver_texture_unload(&ozone->theme_textures[i]); } @@ -2241,7 +2241,7 @@ static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_ size_t i, y, entries_end; float sidebar_offset, bottom_boundary, invert, alpha_anim; unsigned video_info_height, entry_width; - int x_offset = 0; + int x_offset = 22; size_t selection_y = 0; size_t old_selection_y = 0; @@ -2265,9 +2265,9 @@ static void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_ if (alpha != 1.0f) { if (old_list) - x_offset = invert * -(alpha_anim * 120); /* left */ + x_offset += invert * -(alpha_anim * 120); /* left */ else - x_offset = invert * (alpha_anim * 120); /* right */ + x_offset += invert * (alpha_anim * 120); /* right */ } x_offset += (int) sidebar_offset; From 7d058e61b55aed3056e15e4303e0fb94d616a4cb Mon Sep 17 00:00:00 2001 From: natinusala Date: Sat, 27 Oct 2018 23:08:20 +0200 Subject: [PATCH 0440/1292] ozone: load textures for every theme (#7498 workaround) --- menu/drivers/ozone.c | 73 ++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index ef945c1b9c..63a001895c 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -375,6 +375,8 @@ typedef struct ozone_theme float *sidebar_top_gradient; float *sidebar_bottom_gradient; + menu_texture_item textures[OZONE_THEME_TEXTURE_LAST]; + const char *name; } ozone_theme_t; @@ -397,6 +399,8 @@ ozone_theme_t ozone_theme_light = { ozone_sidebar_gradient_top_light, ozone_sidebar_gradient_bottom_light, + {0}, + "light" }; @@ -419,9 +423,17 @@ ozone_theme_t ozone_theme_dark = { ozone_sidebar_gradient_top_dark, ozone_sidebar_gradient_bottom_dark, + {0}, + "dark" }; +ozone_theme_t *ozone_themes[] = { + &ozone_theme_light, + &ozone_theme_dark +}; + +static unsigned ozone_themes_count = sizeof(ozone_themes) / sizeof(ozone_themes[0]); static unsigned last_color_theme = 0; static bool last_use_preferred_system_color_theme = false; static ozone_theme_t *ozone_default_theme = &ozone_theme_light; @@ -451,7 +463,6 @@ typedef struct ozone_handle } raster_blocks; menu_texture_item textures[OZONE_THEME_TEXTURE_LAST]; - menu_texture_item theme_textures[OZONE_THEME_TEXTURE_LAST]; menu_texture_item icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_LAST]; menu_texture_item tab_textures[OZONE_TAB_TEXTURE_LAST]; @@ -461,7 +472,6 @@ typedef struct ozone_handle char png_path[PATH_MAX_LENGTH]; char icons_path[PATH_MAX_LENGTH]; char tab_path[PATH_MAX_LENGTH]; - char theme_path[PATH_MAX_LENGTH]; uint8_t system_tab_end; uint8_t tabs[OZONE_SYSTEM_TAB_LAST]; @@ -1107,38 +1117,46 @@ static void ozone_draw_text( 1.0); } -static void ozone_set_theme_path(ozone_handle_t *ozone) -{ - fill_pathname_join( - ozone->theme_path, - ozone->png_path, - ozone->theme->name, - sizeof(ozone->theme_path) - ); -} - static void ozone_unload_theme_textures(ozone_handle_t *ozone) { int i; + int j; - for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) - video_driver_texture_unload(&ozone->theme_textures[i]); + for (j = 0; j < ozone_themes_count; j++) + { + ozone_theme_t *theme = ozone_themes[j]; + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + video_driver_texture_unload(&theme->textures[i]); + } } static void ozone_reset_theme_textures(ozone_handle_t *ozone) { int i; + int j; + char theme_path[255]; - ozone_set_theme_path(ozone); - - for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + for (j = 0; j < ozone_themes_count; j++) { - char filename[PATH_MAX_LENGTH]; - strlcpy(filename, OZONE_THEME_TEXTURES_FILES[i], sizeof(filename)); - strlcat(filename, ".png", sizeof(filename)); + ozone_theme_t *theme = ozone_themes[j]; - menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + fill_pathname_join( + theme_path, + ozone->png_path, + theme->name, + sizeof(theme_path) + ); + + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + { + char filename[PATH_MAX_LENGTH]; + strlcpy(filename, OZONE_THEME_TEXTURES_FILES[i], sizeof(filename)); + strlcat(filename, ".png", sizeof(filename)); + + menu_display_reset_textures_list(filename, theme_path, &theme->textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } } + } static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) @@ -1165,9 +1183,6 @@ static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) memcpy(ozone->theme_dynamic.entries_border, ozone->theme->entries_border, sizeof(ozone->theme_dynamic.entries_border)); memcpy(ozone->theme_dynamic.entries_icon, ozone->theme->entries_icon, sizeof(ozone->theme_dynamic.entries_icon)); - ozone_unload_theme_textures(ozone); - ozone_reset_theme_textures(ozone); - last_color_theme = color_theme; } @@ -2037,7 +2052,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i if (settings->bools.menu_core_enable && menu_entries_get_core_title(core_title, sizeof(core_title)) == 0) ozone_draw_text(video_info, ozone, core_title, 59, video_info->height - 49 + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba); else - ozone_draw_icon(video_info, 69, 30, ozone->theme_textures[OZONE_THEME_TEXTURE_SWITCH], 59, video_info->height - 52, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 69, 30, ozone->theme->textures[OZONE_THEME_TEXTURE_SWITCH], 59, video_info->height - 52, video_info->width,video_info->height, 0, 1, NULL); /* Buttons */ @@ -2060,13 +2075,13 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i if (do_swap) { - ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); - ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 25, 25, ozone->theme->textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 25, 25, ozone->theme->textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); } else { - ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); - ozone_draw_icon(video_info, 25, 25, ozone->theme_textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 25, 25, ozone->theme->textures[OZONE_THEME_TEXTURE_BUTTON_B], video_info->width - 251, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); + ozone_draw_icon(video_info, 25, 25, ozone->theme->textures[OZONE_THEME_TEXTURE_BUTTON_A], video_info->width - 133, video_info->height - 49, video_info->width,video_info->height, 0, 1, NULL); } menu_display_blend_end(video_info); From 32766f00179ccb0397471af573ecbd1400b26790 Mon Sep 17 00:00:00 2001 From: radius Date: Thu, 25 Oct 2018 18:00:32 -0500 Subject: [PATCH 0441/1292] [content] CRC calculation for needs_fullpath should be within else block --- tasks/task_content.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index c366ab1673..8966aecf33 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -615,10 +615,11 @@ static bool content_file_load( error_string)) goto error; #endif + RARCH_LOG("%s\n", msg_hash_to_str(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT)); + content_rom_crc = file_crc32(0, path); + RARCH_LOG("CRC32: 0x%x .\n", (unsigned)content_rom_crc); + } - RARCH_LOG("%s\n", msg_hash_to_str(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT)); - content_rom_crc = file_crc32(0, path); - RARCH_LOG("CRC32: 0x%x .\n", (unsigned)content_rom_crc); } load_info.content = content; From 8f2b91d95e5ea373ff9202c93d57d7f9ab58e471 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 28 Oct 2018 19:39:09 -0500 Subject: [PATCH 0442/1292] [cheevos] fix badges --- menu/drivers/xmb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 9a8025b9d3..8f9bc09ec2 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2531,9 +2531,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, return xmb->textures.list[XMB_TEXTURE_ROOM_RELAY]; #endif case MENU_SETTING_ACTION: - if (xmb->depth <= 3) + if (xmb->depth == 3) return xmb->textures.list[XMB_TEXTURE_SETTING]; - default: return xmb->textures.list[XMB_TEXTURE_SUBSETTING]; } From e31c4f541a3224a088d6fffe57e2a2643abd91ab Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 29 Oct 2018 04:04:03 +0100 Subject: [PATCH 0443/1292] Simplify init_subsystem function --- tasks/task_content.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index 8966aecf33..76352399ea 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -658,7 +658,8 @@ error: static const struct retro_subsystem_info *content_file_init_subsystem( - content_information_ctx_t *content_ctx, + const struct retro_subsystem_info *subsystem_data, + size_t subsystem_size, char **error_string, bool *ret) { @@ -666,7 +667,7 @@ retro_subsystem_info *content_file_init_subsystem( char *msg = (char*)malloc(1024 * sizeof(char)); struct string_list *subsystem = path_get_subsystem_list(); const struct retro_subsystem_info *special = libretro_find_subsystem_info( - content_ctx->subsystem.data, content_ctx->subsystem.size, + subsystem_data, subsystem_size, path_get(RARCH_PATH_SUBSYSTEM)); msg[0] = '\0'; @@ -794,7 +795,8 @@ static bool content_file_init( ? true : false; const struct retro_subsystem_info *special = path_is_empty(RARCH_PATH_SUBSYSTEM) - ? NULL : content_file_init_subsystem(content_ctx, error_string, &ret); + ? NULL : content_file_init_subsystem(content_ctx->subsystem.data, + content_ctx->subsystem.size, error_string, &ret); if ( !ret || !content_file_init_set_attribs(content, special, content_ctx, error_string)) return false; From 305a07a3f31cb883f21b1c03fc0f17f76d80573b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 29 Oct 2018 04:43:05 +0100 Subject: [PATCH 0444/1292] Create some variables for size --- tasks/task_content.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index 76352399ea..8b7d8ebd12 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -423,9 +423,10 @@ static bool load_content_from_compressed_archive( if (!ret || new_path_len < 0) { - char *str = (char*)malloc(1024 * sizeof(char)); + size_t path_size = 1024 * sizeof(char); + char *str = (char*)malloc(path_size); snprintf(str, - 1024 * sizeof(char), + path_size, "%s \"%s\".\n", msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE), path); @@ -501,9 +502,10 @@ static bool content_file_init_extract( PATH_MAX_LENGTH * sizeof(char) )) { - char *str = (char*)malloc(1024 * sizeof(char)); + size_t path_size = 1024 * sizeof(char); + char *str = (char*)malloc(path_size); - snprintf(str, 1024 * sizeof(char), + snprintf(str, path_size, "%s: %s.\n", msg_hash_to_str( MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE), @@ -554,7 +556,7 @@ static bool content_file_load( unsigned i; retro_ctx_load_content_info_t load_info; size_t msg_size = 1024 * sizeof(char); - char *msg = (char*)malloc(1024 * sizeof(char)); + char *msg = (char*)malloc(msg_size); msg[0] = '\0'; @@ -664,7 +666,7 @@ retro_subsystem_info *content_file_init_subsystem( bool *ret) { size_t path_size = 1024 * sizeof(char); - char *msg = (char*)malloc(1024 * sizeof(char)); + char *msg = (char*)malloc(path_size); struct string_list *subsystem = path_get_subsystem_list(); const struct retro_subsystem_info *special = libretro_find_subsystem_info( subsystem_data, subsystem_size, From e6dfa35f9d109805ed3c1d2086f37a2a27cca1dc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 29 Oct 2018 04:48:22 +0100 Subject: [PATCH 0445/1292] (task_content.c) More cleanups --- tasks/task_content.c | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index 8b7d8ebd12..1945cd372a 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -386,9 +386,10 @@ static bool load_content_from_compressed_archive( { union string_list_elem_attr attributes; int64_t new_path_len = 0; - size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *new_basedir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + size_t new_basedir_size = PATH_MAX_LENGTH * sizeof(char); + size_t new_path_size = PATH_MAX_LENGTH * sizeof(char); + char *new_basedir = (char*)malloc(new_basedir_size); + char *new_path = (char*)malloc(new_path_size); bool ret = false; new_path[0] = '\0'; @@ -399,8 +400,7 @@ static bool load_content_from_compressed_archive( " Now extracting to temporary directory.\n"); if (!string_is_empty(content_ctx->directory_cache)) - strlcpy(new_basedir, content_ctx->directory_cache, - path_size); + strlcpy(new_basedir, content_ctx->directory_cache, new_basedir_size); if (string_is_empty(new_basedir) || !path_is_directory(new_basedir)) { @@ -408,15 +408,14 @@ static bool load_content_from_compressed_archive( "cache directory was not set or found. " "Setting cache directory to directory " "derived by basename...\n"); - fill_pathname_basedir(new_basedir, path, - path_size); + fill_pathname_basedir(new_basedir, path, new_basedir_size); } new_path[0] = '\0'; new_basedir[0] = '\0'; fill_pathname_join(new_path, new_basedir, - path_basename(path), path_size); + path_basename(path), new_path_size); ret = file_archive_compressed_read(path, NULL, new_path, &new_path_len); @@ -479,27 +478,28 @@ static bool content_file_init_extract( continue; { - char *temp_content = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - const char *valid_ext = special ? + size_t temp_content_size = PATH_MAX_LENGTH * sizeof(char); + size_t new_path_size = PATH_MAX_LENGTH * sizeof(char); + char *temp_content = (char*)malloc(temp_content_size); + const char *valid_ext = special ? special->roms[i].valid_extensions : content_ctx->valid_extensions; - new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + new_path = (char*)malloc(new_path_size); temp_content[0] = new_path[0] = '\0'; if (!string_is_empty(path)) - strlcpy(temp_content, path, - PATH_MAX_LENGTH * sizeof(char)); + strlcpy(temp_content, path, temp_content_size); if (!valid_ext || !file_archive_extract_file( temp_content, - PATH_MAX_LENGTH * sizeof(char), + temp_content_size, valid_ext, !string_is_empty(content_ctx->directory_cache) ? content_ctx->directory_cache : NULL, new_path, - PATH_MAX_LENGTH * sizeof(char) + new_path_size )) { size_t path_size = 1024 * sizeof(char); @@ -896,7 +896,8 @@ static bool task_load_content(content_ctx_info_t *content_info, /* Push entry to top of history playlist */ if (is_inited || contentless) { - char *tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + size_t tmp_size = PATH_MAX_LENGTH * sizeof(char); + char *tmp = (char*)malloc(tmp_size); rarch_system_info_t *sys_info = runloop_get_system_info(); const char *path_content = path_get(RARCH_PATH_CONTENT); struct retro_system_info *info = sys_info ? &sys_info->info : NULL; @@ -904,15 +905,14 @@ static bool task_load_content(content_ctx_info_t *content_info, tmp[0] = '\0'; if (!string_is_empty(path_content)) - strlcpy(tmp, path_content, PATH_MAX_LENGTH * sizeof(char)); + strlcpy(tmp, path_content, tmp_size); if (!launched_from_menu) { /* Path can be relative here. * Ensure we're pushing absolute path. */ if (!string_is_empty(tmp)) - path_resolve_realpath(tmp, - PATH_MAX_LENGTH * sizeof(char)); + path_resolve_realpath(tmp, tmp_size); } #ifdef HAVE_MENU @@ -1024,7 +1024,7 @@ static bool firmware_update_status( bool set_missing_firmware = false; core_info_t *core_info = NULL; size_t s_size = PATH_MAX_LENGTH * sizeof(char); - char *s = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + char *s = (char*)malloc(s_size); core_info_get_current_core(&core_info); @@ -1802,10 +1802,10 @@ void content_set_subsystem(unsigned idx) /* Add a rom to the subsystem rom buffer */ void content_add_subsystem(const char* path) { - pending_subsystem_roms[pending_subsystem_rom_id] = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + size_t pending_size = PATH_MAX_LENGTH * sizeof(char); + pending_subsystem_roms[pending_subsystem_rom_id] = (char*)malloc(pending_size); - strlcpy(pending_subsystem_roms[pending_subsystem_rom_id], path, - PATH_MAX_LENGTH * sizeof(char)); + strlcpy(pending_subsystem_roms[pending_subsystem_rom_id], path, pending_size); RARCH_LOG("[subsystem] subsystem id: %d subsystem ident: %s rom id: %d, rom path: %s\n", pending_subsystem_id, pending_subsystem_ident, pending_subsystem_rom_id, pending_subsystem_roms[pending_subsystem_rom_id]); From 03dac742cb692f48e81ccad42ab9fa4c9c82c729 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 29 Oct 2018 04:59:54 +0100 Subject: [PATCH 0446/1292] (task_content.c) Some more cleanups --- tasks/task_content.c | 54 +++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index 1945cd372a..b628075b36 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -452,12 +452,14 @@ error: return false; } +/* Try to extract all content we're going to load if appropriate. */ + static bool content_file_init_extract( struct string_list *content, content_information_ctx_t *content_ctx, const struct retro_subsystem_info *special, - union string_list_elem_attr *attr, - char **error_string + char **error_string, + union string_list_elem_attr *attr ) { unsigned i; @@ -725,16 +727,16 @@ error: return NULL; } -static bool content_file_init_set_attribs( +static void content_file_init_set_attribs( struct string_list *content, const struct retro_subsystem_info *special, content_information_ctx_t *content_ctx, - char **error_string) + char **error_string, + union string_list_elem_attr *attr) { - union string_list_elem_attr attr; struct string_list *subsystem = path_get_subsystem_list(); - attr.i = 0; + attr->i = 0; if (!path_is_empty(RARCH_PATH_SUBSYSTEM) && special) { @@ -742,11 +744,11 @@ static bool content_file_init_set_attribs( for (i = 0; i < subsystem->size; i++) { - attr.i = special->roms[i].block_extract; - attr.i |= special->roms[i].need_fullpath << 1; - attr.i |= special->roms[i].required << 2; + attr->i = special->roms[i].block_extract; + attr->i |= special->roms[i].need_fullpath << 1; + attr->i |= special->roms[i].required << 2; - string_list_append(content, subsystem->elems[i].data, attr); + string_list_append(content, subsystem->elems[i].data, *attr); } } else @@ -756,26 +758,20 @@ static bool content_file_init_set_attribs( content_get_status(&contentless, &is_inited); - attr.i = content_ctx->block_extract; - attr.i |= content_ctx->need_fullpath << 1; - attr.i |= (!contentless) << 2; + attr->i = content_ctx->block_extract; + attr->i |= content_ctx->need_fullpath << 1; + attr->i |= (!contentless) << 2; if (path_is_empty(RARCH_PATH_CONTENT) && contentless && content_ctx->set_supports_no_game_enable) - string_list_append(content, "", attr); + string_list_append(content, "", *attr); else { if (!path_is_empty(RARCH_PATH_CONTENT)) - string_list_append(content, path_get(RARCH_PATH_CONTENT), attr); + string_list_append(content, path_get(RARCH_PATH_CONTENT), *attr); } } - -#ifdef HAVE_COMPRESSION - /* Try to extract all content we're going to load if appropriate. */ - content_file_init_extract(content, content_ctx, special, &attr, error_string); -#endif - return true; } /** @@ -791,6 +787,7 @@ static bool content_file_init( struct string_list *content, char **error_string) { + union string_list_elem_attr attr; struct retro_game_info *info = NULL; bool ret = path_is_empty(RARCH_PATH_SUBSYSTEM) @@ -799,10 +796,15 @@ static bool content_file_init( path_is_empty(RARCH_PATH_SUBSYSTEM) ? NULL : content_file_init_subsystem(content_ctx->subsystem.data, content_ctx->subsystem.size, error_string, &ret); - if ( !ret || - !content_file_init_set_attribs(content, special, content_ctx, error_string)) + + if (!ret) return false; + content_file_init_set_attribs(content, special, content_ctx, error_string, &attr); +#ifdef HAVE_COMPRESSION + content_file_init_extract(content, content_ctx, special, error_string, &attr); +#endif + if (content->size > 0) info = (struct retro_game_info*) calloc(content->size, sizeof(*info)); @@ -821,7 +823,7 @@ static bool content_file_init( free(info); } - else if (special == NULL) + else if (!special) { *error_string = strdup(msg_hash_to_str(MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT)); ret = false; @@ -885,11 +887,7 @@ static bool task_load_content(content_ctx_info_t *content_info, bool is_inited = false; if (!content_load(content_info)) - { return false; - } - - content_get_status(&contentless, &is_inited); From 6c51c4458b5df4480786890077de86601356ec14 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 29 Oct 2018 07:38:26 +0100 Subject: [PATCH 0447/1292] Cleanups --- retroarch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/retroarch.c b/retroarch.c index 4a286e30e7..a9aa568754 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1204,8 +1204,8 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir) if (string_is_empty(core_name) || string_is_empty(game_name)) return false; - core_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - config_directory = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + core_path = (char*)malloc(str_size); + config_directory = (char*)malloc(str_size); config_directory[0] = core_path[0] = '\0'; fill_pathname_application_special(config_directory, @@ -1479,8 +1479,8 @@ void rarch_menu_running_finished(void) **/ static bool rarch_game_specific_options(char **output) { - char *game_path = (char*)malloc(8192 * sizeof(char)); size_t game_path_size = 8192 * sizeof(char); + char *game_path = (char*)malloc(game_path_size); game_path[0] ='\0'; From 51430e9e5fff85b455eaa97448dd79b09e6cfff3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 30 Oct 2018 08:21:32 +0100 Subject: [PATCH 0448/1292] Add runloop_get_libretro_system_info --- menu/menu_entries.c | 22 ++++++++++------------ paths.c | 13 +++++++------ retroarch.c | 6 ++++++ retroarch.h | 2 ++ tasks/task_content.c | 3 +-- tasks/task_netplay_find_content.c | 9 +++++---- 6 files changed, 31 insertions(+), 24 deletions(-) diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 4d28437d98..6cfd04c5b5 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -396,15 +396,14 @@ int menu_entries_get_title(char *s, size_t len) int menu_entries_get_core_name(char *s, size_t len) { - rarch_system_info_t *info = runloop_get_system_info(); - struct retro_system_info *system = &info->info; + struct retro_system_info *system = runloop_get_libretro_system_info(); const char *core_name = NULL; if (system) core_name = system->library_name; - if (string_is_empty(core_name) && info) - core_name = info->info.library_name; + if (string_is_empty(core_name) && system) + core_name = system->library_name; if (string_is_empty(core_name)) core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE); @@ -417,10 +416,9 @@ int menu_entries_get_core_name(char *s, size_t len) * (shown at the top of the UI). */ int menu_entries_get_core_title(char *s, size_t len) { - const char *core_name = NULL; - const char *core_version = NULL; - rarch_system_info_t *info = runloop_get_system_info(); - struct retro_system_info *system = &info->info; + const char *core_name = NULL; + const char *core_version = NULL; + struct retro_system_info *system = runloop_get_libretro_system_info(); #if _MSC_VER == 1200 const char *extra_version = " msvc6"; #elif _MSC_VER == 1300 @@ -451,13 +449,13 @@ int menu_entries_get_core_title(char *s, size_t len) core_version = system->library_version; } - if (string_is_empty(core_name) && info) - core_name = info->info.library_name; + if (string_is_empty(core_name) && system) + core_name = system->library_name; if (string_is_empty(core_name)) core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE); - if (!core_version && info) - core_version = info->info.library_version; + if (!core_version && system) + core_version = system->library_version; if (!core_version) core_version = ""; diff --git a/paths.c b/paths.c index 7ad604b80b..978ee0e5cf 100644 --- a/paths.c +++ b/paths.c @@ -67,6 +67,7 @@ void path_set_redirect(void) const char *old_savefile_dir = dir_get(RARCH_DIR_SAVEFILE); const char *old_savestate_dir = dir_get(RARCH_DIR_SAVESTATE); rarch_system_info_t *info = runloop_get_system_info(); + struct retro_system_info *system = runloop_get_libretro_system_info(); settings_t *settings = config_get_ptr(); new_savefile_dir[0] = new_savestate_dir[0] = '\0'; @@ -76,10 +77,10 @@ void path_set_redirect(void) strlcpy(new_savefile_dir, old_savefile_dir, path_size); strlcpy(new_savestate_dir, old_savestate_dir, path_size); - if (info && !string_is_empty(info->info.library_name)) + if (system && !string_is_empty(system->library_name)) { #ifdef HAVE_MENU - if (!string_is_equal(info->info.library_name, + if (!string_is_equal(system->library_name, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) #endif check_library_name = true; @@ -94,7 +95,7 @@ void path_set_redirect(void) fill_pathname_join( new_savefile_dir, old_savefile_dir, - info->info.library_name, + system->library_name, path_size); /* If path doesn't exist, try to create it, @@ -121,7 +122,7 @@ void path_set_redirect(void) fill_pathname_join( new_savestate_dir, old_savestate_dir, - info->info.library_name, + system->library_name, path_size); /* If path doesn't exist, try to create it. @@ -173,7 +174,7 @@ void path_set_redirect(void) { fill_pathname_dir(global->name.savefile, !string_is_empty(path_main_basename) ? path_main_basename : - info ? info->info.library_name : NULL, + system ? system->library_name : NULL, file_path_str(FILE_PATH_SRM_EXTENSION), sizeof(global->name.savefile)); RARCH_LOG("%s \"%s\".\n", @@ -185,7 +186,7 @@ void path_set_redirect(void) { fill_pathname_dir(global->name.savestate, !string_is_empty(path_main_basename) ? path_main_basename : - info ? info->info.library_name : NULL, + system ? system->library_name : NULL, file_path_str(FILE_PATH_STATE_EXTENSION), sizeof(global->name.savestate)); RARCH_LOG("%s \"%s\".\n", diff --git a/retroarch.c b/retroarch.c index a9aa568754..6b7dc50420 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3593,3 +3593,9 @@ rarch_system_info_t *runloop_get_system_info(void) { return &runloop_system; } + +struct retro_system_info *runloop_get_libretro_system_info(void) +{ + struct retro_system_info *system = &runloop_system.info; + return system; +} diff --git a/retroarch.h b/retroarch.h index 596dce7d54..a3667fde88 100644 --- a/retroarch.h +++ b/retroarch.h @@ -387,6 +387,8 @@ bool retroarch_is_on_main_thread(void); rarch_system_info_t *runloop_get_system_info(void); +struct retro_system_info *runloop_get_libretro_system_info(void); + #ifdef HAVE_THREADS void runloop_msg_queue_lock(void); diff --git a/tasks/task_content.c b/tasks/task_content.c index b628075b36..ed56c69771 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -896,9 +896,8 @@ static bool task_load_content(content_ctx_info_t *content_info, { size_t tmp_size = PATH_MAX_LENGTH * sizeof(char); char *tmp = (char*)malloc(tmp_size); - rarch_system_info_t *sys_info = runloop_get_system_info(); const char *path_content = path_get(RARCH_PATH_CONTENT); - struct retro_system_info *info = sys_info ? &sys_info->info : NULL; + struct retro_system_info *info = runloop_get_libretro_system_info(); tmp[0] = '\0'; diff --git a/tasks/task_netplay_find_content.c b/tasks/task_netplay_find_content.c index 142893f45d..1f53758d41 100644 --- a/tasks/task_netplay_find_content.c +++ b/tasks/task_netplay_find_content.c @@ -56,8 +56,6 @@ static void netplay_crc_scan_callback(void *task_data, { netplay_crc_handle_t *state = (netplay_crc_handle_t*)task_data; content_ctx_info_t content_info = {0}; - rarch_system_info_t *info = runloop_get_system_info(); - struct retro_system_info *system = &info->info; if (!state) return; @@ -69,6 +67,8 @@ static void netplay_crc_scan_callback(void *task_data, if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path) && !state->contentless && !state->current) { + struct retro_system_info *system = runloop_get_libretro_system_info(); + RARCH_LOG("[lobby] loading core %s with content file %s\n", state->core_path, state->content_path); @@ -89,13 +89,14 @@ static void netplay_crc_scan_callback(void *task_data, if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path) && state->contentless) { - content_ctx_info_t content_info = {0}; + content_ctx_info_t content_info = {0}; + struct retro_system_info *system = runloop_get_libretro_system_info(); RARCH_LOG("[lobby] loading contentless core %s\n", state->core_path); command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname); - if (!string_is_equal(info->info.library_name, state->core_name)) + if (!string_is_equal(system->library_name, state->core_name)) task_push_load_new_core(state->core_path, NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL); From a662b62d192787543f504f4535da523991c906ba Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 30 Oct 2018 17:11:07 +0100 Subject: [PATCH 0449/1292] Use runloop_get_libretro_system_info in more places - clean some code up --- command.c | 17 ++-- menu/cbs/menu_cbs_deferred_push.c | 40 ++++---- menu/cbs/menu_cbs_get_value.c | 5 - menu/cbs/menu_cbs_ok.c | 18 ++-- menu/drivers/materialui.c | 16 +--- menu/menu_displaylist.c | 133 +++++++++++++-------------- menu/menu_entries.c | 15 +-- menu/widgets/menu_filebrowser.c | 3 +- network/netplay/netplay_discovery.c | 9 +- network/netplay/netplay_frontend.c | 22 ++--- network/netplay/netplay_handshake.c | 23 +++-- paths.c | 1 - tasks/task_content.c | 20 ++-- ui/drivers/qt/coreoptionsdialog.cpp | 3 +- ui/drivers/qt/shaderparamsdialog.cpp | 33 +++---- ui/drivers/qt/ui_qt_window.cpp | 18 ++-- ui/drivers/ui_cocoa.m | 16 +--- 17 files changed, 169 insertions(+), 223 deletions(-) diff --git a/command.c b/command.c index 5bee7d0d08..a87a52e1e4 100644 --- a/command.c +++ b/command.c @@ -2445,17 +2445,12 @@ TODO: Add a setting for these tweaks */ break; case CMD_EVENT_ADD_TO_FAVORITES: { - global_t *global = global_get_ptr(); - rarch_system_info_t *sys_info = runloop_get_system_info(); - const char *core_name = NULL; - const char *core_path = NULL; - const char *label = NULL; - - if (sys_info) - { - core_name = sys_info->info.library_name; - core_path = path_get(RARCH_PATH_CORE); - } + /* TODO/FIXME - does path_get(RARCH_PATH_CORE) depend on the system info struct? Investigate */ + global_t *global = global_get_ptr(); + struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *label = NULL; + const char *core_path = system ? path_get(RARCH_PATH_CORE) : NULL; + const char *core_name = system ? system->library_name : NULL; if (!string_is_empty(global->name.label)) label = global->name.label; diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 656c995a8c..6d9e29574d 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -349,8 +349,6 @@ static int general_push(menu_displaylist_info_t *info, char *newstring2 = NULL; core_info_list_t *list = NULL; menu_handle_t *menu = NULL; - rarch_system_info_t *system = runloop_get_system_info(); - struct retro_system_info *system_menu = &system->info; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return menu_cbs_exit(); @@ -406,32 +404,35 @@ static int general_push(menu_displaylist_info_t *info, switch (id) { case PUSH_ARCHIVE_OPEN: - - if (system_menu && system_menu->valid_extensions) { - if (*system_menu->valid_extensions) - strlcpy(newstring2, system_menu->valid_extensions, + struct retro_system_info *system = runloop_get_libretro_system_info(); + if (system && system->valid_extensions) + { + if (*system->valid_extensions) + strlcpy(newstring2, system->valid_extensions, + PATH_MAX_LENGTH * sizeof(char)); + } + else + { + strlcpy(newstring2, system->valid_extensions, PATH_MAX_LENGTH * sizeof(char)); - } - else - { - strlcpy(newstring2, system->valid_extensions, - PATH_MAX_LENGTH * sizeof(char)); + } } break; case PUSH_DEFAULT: { - bool new_exts_allocated = false; - char *new_exts = NULL; + bool new_exts_allocated = false; + char *new_exts = NULL; + struct retro_system_info *system = runloop_get_libretro_system_info(); if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR) { } - else if (system_menu && system_menu->valid_extensions) + else if (system && system->valid_extensions) { - if (*system_menu->valid_extensions) + if (*system->valid_extensions) { - new_exts = strdup(system_menu->valid_extensions); + new_exts = strdup(system->valid_extensions); new_exts_allocated = true; } } @@ -478,16 +479,17 @@ static int general_push(menu_displaylist_info_t *info, size_t path_size = PATH_MAX_LENGTH * sizeof(char); char *newstring = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); struct string_list *str_list2 = string_list_new(); + struct retro_system_info *system = runloop_get_libretro_system_info(); newstring[0] = '\0'; attr.i = 0; - if (system_menu && system_menu->valid_extensions) + if (system && system->valid_extensions) { - if (!string_is_empty(system_menu->valid_extensions)) + if (!string_is_empty(system->valid_extensions)) { unsigned x; - struct string_list *str_list = string_split(system_menu->valid_extensions, "|"); + struct string_list *str_list = string_split(system->valid_extensions, "|"); for (x = 0; x < str_list->size; x++) { diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 0795677572..a5ccd31733 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1091,11 +1091,6 @@ static void menu_action_setting_disp_set_label_core_option_create( const char *path, char *s2, size_t len2) { - rarch_system_info_t *system = runloop_get_system_info(); - - if (!system) - return; - *s = '\0'; *w = 19; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 5d4c54541a..0bb2c2d503 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2211,15 +2211,12 @@ static int generic_action_ok_shader_preset_save(const char *path, char directory[PATH_MAX_LENGTH]; char file[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH]; - settings_t *settings = config_get_ptr(); - const char *core_name = NULL; - rarch_system_info_t *info = runloop_get_system_info(); + settings_t *settings = config_get_ptr(); + struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *core_name = system ? system->library_name : NULL; directory[0] = file[0] = tmp[0] = '\0'; - if (info) - core_name = info->info.library_name; - if (!string_is_empty(core_name)) { fill_pathname_join( @@ -2296,15 +2293,12 @@ static int generic_action_ok_remap_file_operation(const char *path, char directory[PATH_MAX_LENGTH]; char file[PATH_MAX_LENGTH]; char content_dir[PATH_MAX_LENGTH]; - settings_t *settings = config_get_ptr(); - const char *core_name = NULL; - rarch_system_info_t *info = runloop_get_system_info(); + settings_t *settings = config_get_ptr(); + struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *core_name = system ? system->library_name : NULL; directory[0] = file[0] = '\0'; - if (info) - core_name = info->info.library_name; - if (!string_is_empty(core_name)) fill_pathname_join( directory, diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 2c625ba881..7d1b6c5c49 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1016,23 +1016,13 @@ static size_t materialui_list_get_size(void *data, enum menu_list_type type) static int materialui_get_core_title(char *s, size_t len) { settings_t *settings = config_get_ptr(); - rarch_system_info_t *info = runloop_get_system_info(); - struct retro_system_info *system = &info->info; - - const char *core_name = system->library_name; - const char *core_version = system->library_version; + struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *core_name = system ? system->library_name : NULL; + const char *core_version = system ? system->library_version : NULL; if (!settings->bools.menu_core_enable) return -1; - if (info) - { - if (string_is_empty(core_name)) - core_name = info->info.library_name; - if (!core_version) - core_version = info->info.library_version; - } - if (string_is_empty(core_name)) core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE); if (!core_version) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e6bf685225..f141d903cc 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2936,14 +2936,14 @@ static int menu_displaylist_parse_horizontal_content_actions( static int menu_displaylist_parse_information_list( menu_displaylist_info_t *info) { - core_info_t *core_info = NULL; - rarch_system_info_t *system = runloop_get_system_info(); + core_info_t *core_info = NULL; + struct retro_system_info *system = runloop_get_libretro_system_info(); core_info_get_current_core(&core_info); if ( system && - (!string_is_empty(system->info.library_name) && - !string_is_equal(system->info.library_name, + (!string_is_empty(system->library_name) && + !string_is_equal(system->library_name, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE)) ) && core_info && core_info->config_data @@ -3293,8 +3293,9 @@ static int menu_displaylist_parse_options_remappings( menu_handle_t *menu, menu_displaylist_info_t *info) { + unsigned device; unsigned p, retro_id; - rarch_system_info_t *system = NULL; + settings_t *settings = config_get_ptr(); unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS)); for (p = 0; p < max_users; p++) @@ -3364,76 +3365,69 @@ static int menu_displaylist_parse_options_remappings( MENU_SETTING_ACTION, 0, 0); } - system = runloop_get_system_info(); - - if (system) + for (p = 0; p < max_users; p++) { - settings_t *settings = config_get_ptr(); - unsigned device; - for (p = 0; p < max_users; p++) + device = settings->uints.input_libretro_device[p]; + device &= RETRO_DEVICE_MASK; + + if (device == RETRO_DEVICE_JOYPAD || device == RETRO_DEVICE_ANALOG) { - device = settings->uints.input_libretro_device[p]; - device &= RETRO_DEVICE_MASK; - - if (device == RETRO_DEVICE_JOYPAD || device == RETRO_DEVICE_ANALOG) + for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 8; retro_id++) { - for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 8; retro_id++) - { - char desc_label[64]; - char descriptor[255]; - const struct retro_keybind *auto_bind = NULL; - const struct retro_keybind *keybind = NULL; + char desc_label[64]; + char descriptor[255]; + const struct retro_keybind *auto_bind = NULL; + const struct retro_keybind *keybind = NULL; - keybind = &input_config_binds[p][retro_id]; - auto_bind = (const struct retro_keybind*) - input_config_get_bind_auto(p, retro_id); + keybind = &input_config_binds[p][retro_id]; + auto_bind = (const struct retro_keybind*) + input_config_get_bind_auto(p, retro_id); - input_config_get_bind_string(descriptor, + input_config_get_bind_string(descriptor, keybind, auto_bind, sizeof(descriptor)); - if(!strstr(descriptor, "Auto")) - { - const struct retro_keybind *keyptr = - &input_config_binds[p][retro_id]; + if(!strstr(descriptor, "Auto")) + { + const struct retro_keybind *keyptr = + &input_config_binds[p][retro_id]; - snprintf(desc_label, sizeof(desc_label), "%s %s", msg_hash_to_str(keyptr->enum_idx), descriptor); - strlcpy(descriptor, desc_label, sizeof(descriptor)); - } - - menu_entries_append_enum(info->list, descriptor, "", - MSG_UNKNOWN, - MENU_SETTINGS_INPUT_DESC_BEGIN + - (p * (RARCH_FIRST_CUSTOM_BIND + 8)) + retro_id, 0, 0); + snprintf(desc_label, sizeof(desc_label), "%s %s", msg_hash_to_str(keyptr->enum_idx), descriptor); + strlcpy(descriptor, desc_label, sizeof(descriptor)); } + + menu_entries_append_enum(info->list, descriptor, "", + MSG_UNKNOWN, + MENU_SETTINGS_INPUT_DESC_BEGIN + + (p * (RARCH_FIRST_CUSTOM_BIND + 8)) + retro_id, 0, 0); } - else if (device == RETRO_DEVICE_KEYBOARD) + } + else if (device == RETRO_DEVICE_KEYBOARD) + { + for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++) { - for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++) - { - char descriptor[255]; - const struct retro_keybind *auto_bind = NULL; - const struct retro_keybind *keybind = NULL; + char descriptor[255]; + const struct retro_keybind *auto_bind = NULL; + const struct retro_keybind *keybind = NULL; - keybind = &input_config_binds[p][retro_id]; - auto_bind = (const struct retro_keybind*) - input_config_get_bind_auto(p, retro_id); + keybind = &input_config_binds[p][retro_id]; + auto_bind = (const struct retro_keybind*) + input_config_get_bind_auto(p, retro_id); - input_config_get_bind_string(descriptor, + input_config_get_bind_string(descriptor, keybind, auto_bind, sizeof(descriptor)); - if(!strstr(descriptor, "Auto")) - { - const struct retro_keybind *keyptr = - &input_config_binds[p][retro_id]; + if(!strstr(descriptor, "Auto")) + { + const struct retro_keybind *keyptr = + &input_config_binds[p][retro_id]; - strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor)); - } - - menu_entries_append_enum(info->list, descriptor, "", - MSG_UNKNOWN, - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + - (p * RARCH_FIRST_CUSTOM_BIND) + retro_id, 0, 0); + strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor)); } + + menu_entries_append_enum(info->list, descriptor, "", + MSG_UNKNOWN, + MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + + (p * RARCH_FIRST_CUSTOM_BIND) + retro_id, 0, 0); } } } @@ -4893,8 +4887,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist if (cores_names_size == 0) { - rarch_system_info_t *system_info = runloop_get_system_info(); - struct retro_system_info *system = &system_info->info; + struct retro_system_info *system = runloop_get_libretro_system_info(); const char *core_name = system ? system->library_name : NULL; if (!path_is_empty(RARCH_PATH_CORE)) @@ -5008,12 +5001,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist 0); { - const char *core_name = NULL; - rarch_system_info_t *system_info = runloop_get_system_info(); - struct retro_system_info *system = &system_info->info; - - if (system) - core_name = system->library_name; + struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *core_name = system ? system->library_name : NULL; if (!string_is_empty(core_name)) file_list_set_alt_at_offset(info->list, 0, @@ -7325,19 +7314,21 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); { settings_t *settings = config_get_ptr(); - rarch_system_info_t *system = runloop_get_system_info(); + rarch_system_info_t *sys_info = runloop_get_system_info(); - if (system) + if (sys_info) { - if (!string_is_empty(system->info.library_name) && - !string_is_equal(system->info.library_name, + struct retro_system_info *system = runloop_get_libretro_system_info(); + + if (!string_is_empty(system->library_name) && + !string_is_equal(system->library_name, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_CONTENT_SETTINGS, PARSE_ACTION, false); - if (system->load_no_content) + if (sys_info->load_no_content) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_START_CORE, PARSE_ACTION, false); } diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 6cfd04c5b5..91f6723c80 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -416,9 +416,9 @@ int menu_entries_get_core_name(char *s, size_t len) * (shown at the top of the UI). */ int menu_entries_get_core_title(char *s, size_t len) { - const char *core_name = NULL; - const char *core_version = NULL; struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *core_name = system ? system->library_name : NULL; + const char *core_version = system ? system->library_version : NULL; #if _MSC_VER == 1200 const char *extra_version = " msvc6"; #elif _MSC_VER == 1300 @@ -443,19 +443,8 @@ int menu_entries_get_core_title(char *s, size_t len) const char *extra_version = ""; #endif - if (system) - { - core_name = system->library_name; - core_version = system->library_version; - } - - if (string_is_empty(core_name) && system) - core_name = system->library_name; if (string_is_empty(core_name)) core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE); - - if (!core_version && system) - core_version = system->library_version; if (!core_version) core_version = ""; diff --git a/menu/widgets/menu_filebrowser.c b/menu/widgets/menu_filebrowser.c index 635f527f2a..89fe44c091 100644 --- a/menu/widgets/menu_filebrowser.c +++ b/menu/widgets/menu_filebrowser.c @@ -65,7 +65,6 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data) unsigned files_count = 0; unsigned dirs_count = 0; settings_t *settings = config_get_ptr(); - rarch_system_info_t *system = runloop_get_system_info(); enum menu_displaylist_ctl_state type = (enum menu_displaylist_ctl_state) type_data; const char *path = info ? info->path : NULL; @@ -84,6 +83,7 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data) str_list = file_archive_get_file_list(path, info->exts); else { + rarch_system_info_t *system = runloop_get_system_info(); const struct retro_subsystem_info *subsystem = system->subsystem.data + content_get_subsystem(); if (subsystem) @@ -94,6 +94,7 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data) { if (filebrowser_types == FILEBROWSER_SELECT_FILE_SUBSYSTEM) { + rarch_system_info_t *system = runloop_get_system_info(); const struct retro_subsystem_info *subsystem = system->subsystem.data + content_get_subsystem(); diff --git a/network/netplay/netplay_discovery.c b/network/netplay/netplay_discovery.c index fa998ad9b6..0b347ca548 100644 --- a/network/netplay/netplay_discovery.c +++ b/network/netplay/netplay_discovery.c @@ -244,7 +244,6 @@ bool netplay_lan_ad_server(netplay_t *netplay) struct timeval tmp_tv = {0}; struct sockaddr their_addr; socklen_t addr_size; - rarch_system_info_t *info = NULL; unsigned k = 0; char reply_addr[NETPLAY_HOST_STR_LEN], port_str[6]; struct addrinfo *our_addr, hints = {0}; @@ -308,11 +307,11 @@ bool netplay_lan_ad_server(netplay_t *netplay) if (strstr(interfaces.entries[k].host, sub) && !strstr(interfaces.entries[k].host, "127.0.0.1")) { + struct retro_system_info *info = runloop_get_libretro_system_info(); + RARCH_LOG ("[discovery] query received on common interface: %s/%s (theirs / ours) \n", reply_addr, interfaces.entries[k].host); - info = runloop_get_system_info(); - /* Now build our response */ content_crc = content_get_crc(); @@ -335,9 +334,9 @@ bool netplay_lan_ad_server(netplay_t *netplay) if (info) { - strlcpy(ad_packet_buffer.core, info->info.library_name, + strlcpy(ad_packet_buffer.core, info->library_name, NETPLAY_HOST_STR_LEN); - strlcpy(ad_packet_buffer.core_version, info->info.library_version, + strlcpy(ad_packet_buffer.core_version, info->library_version, NETPLAY_HOST_STR_LEN); } diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index c0981d7067..6da9b1dee9 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -852,25 +852,25 @@ void netplay_get_architecture(char *frontend_architecture, size_t size) static void netplay_announce(void) { char buf [2048]; - char url [2048] = "http://lobby.libretro.com/add/"; - char *username = NULL; - char *corename = NULL; - char *gamename = NULL; - char *coreversion = NULL; - char *frontend_ident = NULL; - settings_t *settings = config_get_ptr(); - rarch_system_info_t *system = runloop_get_system_info(); - uint32_t content_crc = content_get_crc(); char frontend_architecture[PATH_MAX_LENGTH]; + char url [2048] = "http://lobby.libretro.com/add/"; + char *username = NULL; + char *corename = NULL; + char *gamename = NULL; + char *coreversion = NULL; + char *frontend_ident = NULL; + settings_t *settings = config_get_ptr(); + struct retro_system_info *system = runloop_get_libretro_system_info(); + uint32_t content_crc = content_get_crc(); netplay_get_architecture(frontend_architecture, sizeof(frontend_architecture)); net_http_urlencode(&username, settings->paths.username); - net_http_urlencode(&corename, system->info.library_name); + net_http_urlencode(&corename, system->library_name); net_http_urlencode(&gamename, !string_is_empty(path_basename(path_get(RARCH_PATH_BASENAME))) ? path_basename(path_get(RARCH_PATH_BASENAME)) : "N/A"); - net_http_urlencode(&coreversion, system->info.library_version); + net_http_urlencode(&coreversion, system->library_version); net_http_urlencode(&frontend_ident, frontend_architecture); buf[0] = '\0'; diff --git a/network/netplay/netplay_handshake.c b/network/netplay/netplay_handshake.c index 021b51d35c..7b52bbb9c9 100644 --- a/network/netplay/netplay_handshake.c +++ b/network/netplay/netplay_handshake.c @@ -500,20 +500,20 @@ bool netplay_handshake_info(netplay_t *netplay, struct netplay_connection *connection) { struct info_buf_s info_buf; - uint32_t content_crc = 0; - rarch_system_info_t *core_info = runloop_get_system_info(); + uint32_t content_crc = 0; + struct retro_system_info *system = runloop_get_libretro_system_info(); memset(&info_buf, 0, sizeof(info_buf)); info_buf.cmd[0] = htonl(NETPLAY_CMD_INFO); info_buf.cmd[1] = htonl(sizeof(info_buf) - 2*sizeof(uint32_t)); /* Get our core info */ - if (core_info) + if (system) { strlcpy(info_buf.core_name, - core_info->info.library_name, sizeof(info_buf.core_name)); + system->library_name, sizeof(info_buf.core_name)); strlcpy(info_buf.core_version, - core_info->info.library_version, sizeof(info_buf.core_version)); + system->library_version, sizeof(info_buf.core_version)); } else { @@ -836,9 +836,9 @@ bool netplay_handshake_pre_info(netplay_t *netplay, struct info_buf_s info_buf; uint32_t cmd_size; ssize_t recvd; - uint32_t content_crc = 0; - const char *dmsg = NULL; - rarch_system_info_t *core_info = runloop_get_system_info(); + uint32_t content_crc = 0; + const char *dmsg = NULL; + struct retro_system_info *system = runloop_get_libretro_system_info(); RECV(&info_buf, sizeof(info_buf.cmd)) {} @@ -876,11 +876,10 @@ bool netplay_handshake_pre_info(netplay_t *netplay, } /* Check the core info */ - - if (core_info) + if (system) { if (strncmp(info_buf.core_name, - core_info->info.library_name, sizeof(info_buf.core_name))) + system->library_name, sizeof(info_buf.core_name))) { /* Wrong core! */ dmsg = msg_hash_to_str(MSG_NETPLAY_DIFFERENT_CORES); @@ -890,7 +889,7 @@ bool netplay_handshake_pre_info(netplay_t *netplay, return false; } if (strncmp(info_buf.core_version, - core_info->info.library_version, sizeof(info_buf.core_version))) + system->library_version, sizeof(info_buf.core_version))) { dmsg = msg_hash_to_str(MSG_NETPLAY_DIFFERENT_CORE_VERSIONS); RARCH_WARN("%s\n", dmsg); diff --git a/paths.c b/paths.c index 978ee0e5cf..b956989638 100644 --- a/paths.c +++ b/paths.c @@ -66,7 +66,6 @@ void path_set_redirect(void) global_t *global = global_get_ptr(); const char *old_savefile_dir = dir_get(RARCH_DIR_SAVEFILE); const char *old_savestate_dir = dir_get(RARCH_DIR_SAVESTATE); - rarch_system_info_t *info = runloop_get_system_info(); struct retro_system_info *system = runloop_get_libretro_system_info(); settings_t *settings = config_get_ptr(); diff --git a/tasks/task_content.c b/tasks/task_content.c index ed56c69771..5747236df6 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1526,6 +1526,8 @@ static bool task_load_content_callback(content_ctx_info_t *content_info, if (sys_info) { + struct retro_system_info *system = runloop_get_libretro_system_info(); + content_ctx.history_list_enable = settings->bools.history_list_enable; content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable; @@ -1533,11 +1535,11 @@ static bool task_load_content_callback(content_ctx_info_t *content_info, content_ctx.directory_system = strdup(settings->paths.directory_system); if (!string_is_empty(settings->paths.directory_cache)) content_ctx.directory_cache = strdup(settings->paths.directory_cache); - if (!string_is_empty(sys_info->info.valid_extensions)) - content_ctx.valid_extensions = strdup(sys_info->info.valid_extensions); + if (!string_is_empty(system->valid_extensions)) + content_ctx.valid_extensions = strdup(system->valid_extensions); - content_ctx.block_extract = sys_info->info.block_extract; - content_ctx.need_fullpath = sys_info->info.need_fullpath; + content_ctx.block_extract = system->block_extract; + content_ctx.need_fullpath = system->need_fullpath; content_ctx.subsystem.data = sys_info->subsystem.data; content_ctx.subsystem.size = sys_info->subsystem.size; @@ -1918,6 +1920,8 @@ bool content_init(void) if (sys_info) { + struct retro_system_info *system = runloop_get_libretro_system_info(); + content_ctx.history_list_enable = settings->bools.history_list_enable; content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable; @@ -1925,11 +1929,11 @@ bool content_init(void) content_ctx.directory_system = strdup(settings->paths.directory_system); if (!string_is_empty(settings->paths.directory_cache)) content_ctx.directory_cache = strdup(settings->paths.directory_cache); - if (!string_is_empty(sys_info->info.valid_extensions)) - content_ctx.valid_extensions = strdup(sys_info->info.valid_extensions); + if (!string_is_empty(system->valid_extensions)) + content_ctx.valid_extensions = strdup(system->valid_extensions); - content_ctx.block_extract = sys_info->info.block_extract; - content_ctx.need_fullpath = sys_info->info.need_fullpath; + content_ctx.block_extract = system->block_extract; + content_ctx.need_fullpath = system->need_fullpath; content_ctx.subsystem.data = sys_info->subsystem.data; content_ctx.subsystem.size = sys_info->subsystem.size; diff --git a/ui/drivers/qt/coreoptionsdialog.cpp b/ui/drivers/qt/coreoptionsdialog.cpp index d50adc84e9..8841cf05e5 100644 --- a/ui/drivers/qt/coreoptionsdialog.cpp +++ b/ui/drivers/qt/coreoptionsdialog.cpp @@ -222,10 +222,11 @@ void CoreOptionsDialog::buildLayout() if (settings->bools.game_specific_options) { - rarch_system_info_t *system = runloop_get_system_info(); QString contentLabel; QString label; + rarch_system_info_t *system = runloop_get_system_info(); + /* TODO/FIXME - why have this check here? system is not used */ if (system) contentLabel = QFileInfo(path_get(RARCH_PATH_BASENAME)).completeBaseName(); diff --git a/ui/drivers/qt/shaderparamsdialog.cpp b/ui/drivers/qt/shaderparamsdialog.cpp index 65dba88c28..332fbe64b5 100644 --- a/ui/drivers/qt/shaderparamsdialog.cpp +++ b/ui/drivers/qt/shaderparamsdialog.cpp @@ -724,15 +724,12 @@ void ShaderParamsDialog::saveShaderPreset(const char *path, unsigned action_type char directory[PATH_MAX_LENGTH]; char file[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH]; - settings_t *settings = config_get_ptr(); - const char *core_name = NULL; - rarch_system_info_t *info = runloop_get_system_info(); + settings_t *settings = config_get_ptr(); + struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *core_name = system ? system->library_name : NULL; directory[0] = file[0] = tmp[0] = '\0'; - if (info) - core_name = info->info.library_name; - if (!string_is_empty(core_name)) { fill_pathname_join( @@ -757,17 +754,15 @@ void ShaderParamsDialog::saveShaderPreset(const char *path, unsigned action_type fill_pathname_join(file, directory, core_name, sizeof(file)); break; case SHADER_PRESET_SAVE_GAME: - { - const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); - fill_pathname_join(file, directory, game_name, sizeof(file)); - break; - } + { + const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); + fill_pathname_join(file, directory, game_name, sizeof(file)); + break; + } case SHADER_PRESET_SAVE_PARENT: - { fill_pathname_parent_dir_name(tmp, path_get(RARCH_PATH_BASENAME), sizeof(tmp)); fill_pathname_join(file, directory, tmp, sizeof(file)); break; - } case SHADER_PRESET_SAVE_NORMAL: default: if (!string_is_empty(path)) @@ -821,13 +816,13 @@ void ShaderParamsDialog::onShaderClearAllPassesClicked() void ShaderParamsDialog::onShaderRemovePassClicked() { #ifdef HAVE_MENU - QAction *action = qobject_cast(sender()); - QVariant passVariant; - struct video_shader *menu_shader = NULL; - struct video_shader *video_shader = NULL; - int pass = 0; int i; - bool ok = false; + QVariant passVariant; + QAction *action = qobject_cast(sender()); + struct video_shader *menu_shader = NULL; + struct video_shader *video_shader = NULL; + int pass = 0; + bool ok = false; getShaders(&menu_shader, &video_shader); diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index c85a89d76d..712137f68d 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -1,6 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2018 - Brad Parker + * Copyright (C) 2018 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -1297,7 +1297,7 @@ QVector > MainWindow::getCoreInfo() { QHash hash; - hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_NAME)) + ":"; + hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_NAME)) + ":"; hash["value"] = core_info->systemname; infoList.append(hash); @@ -1307,7 +1307,7 @@ QVector > MainWindow::getCoreInfo() { QHash hash; - hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_MANUFACTURER)) + ":"; + hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SYSTEM_MANUFACTURER)) + ":"; hash["value"] = core_info->system_manufacturer; infoList.append(hash); @@ -2778,10 +2778,10 @@ void MainWindow::onStopClicked() void MainWindow::setCurrentCoreLabel() { - rarch_system_info_t *system = runloop_get_system_info(); - bool update = false; - QString libraryName = system->info.library_name; - const char *no_core_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE); + bool update = false; + struct retro_system_info *system = runloop_get_libretro_system_info(); + QString libraryName = system->library_name; + const char *no_core_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE); if (m_statusLabel->text().isEmpty() || (m_currentCore != no_core_str && libraryName.isEmpty())) { @@ -2793,8 +2793,8 @@ void MainWindow::setCurrentCoreLabel() { if (m_currentCore != libraryName && !libraryName.isEmpty()) { - m_currentCore = system->info.library_name; - m_currentCoreVersion = (string_is_empty(system->info.library_version) ? "" : system->info.library_version); + m_currentCore = system->library_name; + m_currentCoreVersion = (string_is_empty(system->library_version) ? "" : system->library_version); update = true; } } diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index 7d5330f2d6..a709ae1223 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -480,13 +480,9 @@ static char** waiting_argv; { if (filenames.count == 1 && [filenames objectAtIndex:0]) { - rarch_system_info_t *info = runloop_get_system_info(); - struct retro_system_info *system = &info->info; + struct retro_system_info *system = runloop_get_libretro_system_info(); NSString *__core = [filenames objectAtIndex:0]; - const char *core_name = NULL; - - if (system) - core_name = system->library_name; + const char *core_name = system ? system->library_name : NULL; if (core_name) { @@ -556,12 +552,8 @@ static void open_document_handler(ui_browser_window_state_t *state, bool result) if (!result) return; - rarch_system_info_t *info = runloop_get_system_info(); - struct retro_system_info *system = &info->info; - const char *core_name = NULL; - - if (system) - core_name = system->library_name; + struct retro_system_info *system = runloop_get_libretro_system_info(); + const char *core_name = system ? system->library_name : NULL; path_set(RARCH_PATH_CONTENT, state->result); From e2888aa5a26db20d4ccd978fafffe5c204cc8a13 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 30 Oct 2018 17:25:28 +0100 Subject: [PATCH 0450/1292] Apply madmonkeys' diff --- dynamic.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/dynamic.c b/dynamic.c index e1bd95e018..5663445c31 100644 --- a/dynamic.c +++ b/dynamic.c @@ -374,14 +374,6 @@ bool libretro_get_system_info(const char *path, memcpy(info, &dummy_info, sizeof(*info)); - if (!string_is_empty(dummy_info.library_name)) - info->library_name = strdup(dummy_info.library_name); - if (!string_is_empty(dummy_info.library_version)) - info->library_version = strdup(dummy_info.library_version); - - if (dummy_info.valid_extensions) - info->valid_extensions = strdup(dummy_info.valid_extensions); - #ifdef HAVE_DYNAMIC dylib_close(lib); #endif @@ -709,10 +701,6 @@ static bool load_symbols(enum rarch_core_type type, struct retro_core_t *current **/ bool init_libretro_sym(enum rarch_core_type type, struct retro_core_t *current_core) { - /* Guarantee that we can do "dirty" casting. - * Every OS that this program supports should pass this. */ - retro_assert(sizeof(void*) == sizeof(void (*)(void))); - if (!load_symbols(type, current_core)) return false; @@ -1381,8 +1369,13 @@ bool rarch_environment_cb(unsigned cmd, void *data) /* Old ABI. Don't copy garbage. */ if (cmd & RETRO_ENVIRONMENT_EXPERIMENTAL) + { memcpy(hwr, cb, offsetof(struct retro_hw_render_callback, stencil)); + memset(hwr + offsetof(struct retro_hw_render_callback, stencil), + 0, sizeof(*cb) - offsetof(struct retro_hw_render_callback, stencil)); + + } else memcpy(hwr, cb, sizeof(*cb)); break; @@ -1581,9 +1574,10 @@ bool rarch_environment_cb(unsigned cmd, void *data) struct retro_subsystem_info *info_ptr = NULL; free(system->subsystem.data); system->subsystem.data = NULL; + system->subsystem.size = 0; info_ptr = (struct retro_subsystem_info*) - calloc(i, sizeof(*info_ptr)); + malloc(i * sizeof(*info_ptr)); if (!info_ptr) return false; @@ -1619,6 +1613,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) free(system->ports.data); system->ports.data = NULL; + system->ports.size = 0; info_ptr = (struct retro_controller_info*)calloc(i, sizeof(*info_ptr)); if (!info_ptr) @@ -1643,6 +1638,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) RARCH_LOG("Environ SET_MEMORY_MAPS.\n"); free((void*)system->mmaps.descriptors); + system->mmaps.descriptors = 0; system->mmaps.num_descriptors = 0; descriptors = (rarch_memory_descriptor_t*) calloc(mmaps->num_descriptors, From 6cec123fc366c525541c9cf47bf7a8e2f52f4826 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 30 Oct 2018 18:24:37 +0100 Subject: [PATCH 0451/1292] Try this instead --- dynamic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dynamic.c b/dynamic.c index 5663445c31..bf2136e9dc 100644 --- a/dynamic.c +++ b/dynamic.c @@ -318,6 +318,10 @@ static dylib_t libretro_get_system_info_lib(const char *path, } #endif +static char current_library_name[1024]; +static char current_library_version[1024]; +static char current_valid_extensions[1024]; + /** * libretro_get_system_info: * @path : Path to libretro library. @@ -374,6 +378,24 @@ bool libretro_get_system_info(const char *path, memcpy(info, &dummy_info, sizeof(*info)); + current_library_name[0] = '\0'; + current_library_version[0] = '\0'; + current_valid_extensions[0] = '\0'; + + if (!string_is_empty(dummy_info.library_name)) + strlcpy(current_library_name, + dummy_info.library_name, sizeof(current_library_name)); + if (!string_is_empty(dummy_info.library_version)) + strlcpy(current_library_version, + dummy_info.library_version, sizeof(current_library_version)); + if (dummy_info.valid_extensions) + strlcpy(current_valid_extensions, + dummy_info.valid_extensions, sizeof(current_valid_extensions)); + + info->library_name = current_library_name; + info->library_version = current_library_name; + info->valid_extensions = current_valid_extensions; + #ifdef HAVE_DYNAMIC dylib_close(lib); #endif From 7c93a0934e897a98a3053495cc313605094c2ddf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 30 Oct 2018 19:32:52 +0100 Subject: [PATCH 0452/1292] (Cocoa) Dehardcode some strings --- ui/drivers/ui_cocoa.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index a709ae1223..bf917f53cf 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -505,7 +505,7 @@ static char** waiting_argv; { ui_msg_window_state msg_window_state; msg_window_state.text = strdup("Cannot open multiple files"); - msg_window_state.title = strdup("RetroArch"); + msg_window_state.title = strdup(msg_hash_to_str(MSG_PROGRAM)); msg_window->information(&msg_window_state); free(msg_window_state.text); @@ -577,8 +577,8 @@ static void open_document_handler(ui_browser_window_state_t *state, bool result) settings_t *settings = config_get_ptr(); browser_state.filters = strdup("dylib"); - browser_state.filters_title = strdup("Core"); - browser_state.title = strdup("Load Core"); + browser_state.filters_title = strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_SETTINGS)); + browser_state.title = strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_LIST)); browser_state.startdir = strdup(settings->paths.directory_libretro); bool result = browser->open(&browser_state); @@ -604,7 +604,7 @@ static void open_document_handler(ui_browser_window_state_t *state, bool result) if (!startdir.length) startdir = BOXSTRING("/"); - browser_state.title = strdup("Load Content"); + browser_state.title = strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST)); browser_state.startdir = strdup([startdir UTF8String]); bool result = browser->open(&browser_state); From a552f26f76e622a952d33bb565b7a1edb9864fa9 Mon Sep 17 00:00:00 2001 From: natinusala Date: Wed, 31 Oct 2018 12:02:24 +0100 Subject: [PATCH 0453/1292] Don't link WIP menu drivers by default --- Makefile.common | 28 ++++++++++++++-------------- Makefile.libnx | 2 -- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Makefile.common b/Makefile.common index 73836d6fd1..f7017a98bc 100644 --- a/Makefile.common +++ b/Makefile.common @@ -658,9 +658,9 @@ endif # XMB and MaterialUI are always enabled if supported and not explicitly disabled ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1) - ifeq ($(HAVE_ZARCH),) - HAVE_ZARCH = 1 - endif + #ifeq ($(HAVE_ZARCH),) + #HAVE_ZARCH = 1 + #endif ifeq ($(HAVE_MATERIALUI),) HAVE_MATERIALUI = 1 @@ -674,20 +674,20 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1) HAVE_XMB = 1 endif - ifeq ($(HAVE_STRIPES),) - HAVE_STRIPES = 1 - endif + #ifeq ($(HAVE_STRIPES),) + #HAVE_STRIPES = 1 + #endif - ifeq ($(HAVE_OZONE),) - HAVE_OZONE = 1 - endif + #ifeq ($(HAVE_OZONE),) + #HAVE_OZONE = 1 + #endif else - HAVE_ZARCH ?= 0 + HAVE_ZARCH ?= 0 HAVE_MATERIALUI ?= 0 - #HAVE_NUKLEAR ?= 0 - HAVE_XMB ?= 0 - HAVE_STRIPES ?= 0 - HAVE_OZONE ?= 0 + HAVE_NUKLEAR ?= 0 + HAVE_XMB ?= 0 + HAVE_STRIPES ?= 0 + HAVE_OZONE ?= 0 endif ifeq ($(HAVE_RGUI), 1) diff --git a/Makefile.libnx b/Makefile.libnx index 22fc9ccc76..689d8f6d47 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -56,10 +56,8 @@ ifeq ($(HAVE_OPENGL), 1) HAVE_RGUI = 1 HAVE_MATERIALUI = 1 - HAVE_ZARCH = 0 HAVE_XMB = 1 HAVE_OZONE = 1 - HAVE_STRIPES = 0 HAVE_OVERLAY = 1 else From 49082a8c806c9eac4977396a2879dbad7cb76dc8 Mon Sep 17 00:00:00 2001 From: natinusala Date: Thu, 1 Nov 2018 01:55:05 +0100 Subject: [PATCH 0454/1292] libnx: enable video recording --- frontend/drivers/platform_switch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 603f9ba13d..756c9b8151 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -630,6 +630,9 @@ static void frontend_switch_init(void *data) gfxConfigureTransform(0); #endif /* HAVE_OPENGL */ + + appletInitializeGamePlayRecording(); + #ifdef NXLINK socketInitializeDefault(); nxlink_connected = nxlinkStdio() != -1; From 01864b4f6e8d4e1ac599f762c9ba17d8f5801d2f Mon Sep 17 00:00:00 2001 From: theheroGAC Date: Thu, 1 Nov 2018 09:25:36 +0100 Subject: [PATCH 0455/1292] Update msg_hash_it.h --- intl/msg_hash_it.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 028ca74cc1..3b428891f5 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3552,17 +3552,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, "Colore del tema di Menu ") MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, - "Basic White" + "Bianco Basic " ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, - "Basic Black" + "Nero Basic" ) MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, - "Select a different color theme." + "Seleziona un tema con colorazione diversa." ) MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use preferred system color theme") + "Usa la colorazione preferita di sistema") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's color theme (if any) - overrides theme settings.") + "Utilizza la colorazione dei temi del sistema operativo (se presente) - impostazioni del tema di override.") From f92f5366b13af7c56c0df63ab5cb8a01bee6aad1 Mon Sep 17 00:00:00 2001 From: DEX357 Date: Thu, 1 Nov 2018 13:54:14 +0100 Subject: [PATCH 0456/1292] Update msg_hash_pl.h --- intl/msg_hash_pl.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 1a278f4484..7aeab8ae6e 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3755,17 +3755,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, "Kolor menu") MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, - "Basic White" + "podstawowy odcień bieli" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, - "Basic Black" + "podstawowy odcień czerni" ) MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, - "Select a different color theme." + "Wybierz inny motyw koloru." ) MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use preferred system color theme") + "Użyj preferowanego motywu kolorystycznego systemu") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, - "Use your operating system's color theme (if any) - overrides theme settings.") + "Użyj motywu kolorystycznego systemu operacyjnego (jeśli jest dostępny) - zastępuje ustawienia kompozycji.") From 62cf1d6c37687629ec45a1e712bffcdb80d7af30 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 2 Nov 2018 11:18:54 +0100 Subject: [PATCH 0457/1292] (NL) Update Dutch --- intl/msg_hash_nl.h | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 94093064a7..7e9d5c85e7 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -940,9 +940,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Connect to Netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, - "Begin hosting") + "Begin met hosten") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, - "Eindig netplay host") + "Stop met hosten") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server Adres") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, @@ -2350,7 +2350,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_BOKEH, MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_SNOWFLAKE, "Sneeuwvlok") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS, - "Refresh Room List") + "Room Lijst Vernieuwen") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME, "Nickname: %s") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN, @@ -2368,7 +2368,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME, MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD, "Input the password of your Retro Achievements account.") MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_NICKNAME, - "Input your user name here. This will be used for netplay sessions, among other things.") + "Voer hier je gebruikersnaam in. Dit zal o.a. gebruikt worden voor netplay sessies.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD, "Capture the image after filters (but not shaders) are applied. Your video will look as fancy as what you see on your screen.") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_LIST, @@ -2378,7 +2378,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_INFORMATION, "Show network interface(s) and associated IP addresses.") MSG_HASH(MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, - "Show information specific to the device.") + "Laat apparaat-specifieke informatie zien.") MSG_HASH(MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "Sluit het programma af.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, @@ -2399,7 +2399,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU, "Hide the overlay while inside the menu, and show it again when exiting the menu.") MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_COLLECTION_LIST, - "Scanned content will appear here." + "Gescande inhoud zal hier getoond worden." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER, @@ -2559,19 +2559,19 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_OPACITY, - "Opacity of all UI elements of the overlay." + "Doorzichtigheid van alle UI elementen van de overlay." ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_SCALE, - "Scale of all UI elements of the overlay." + "Schalering van alle UI elements van de overlay." ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE, - "Enable the overlay." + "Activeer de overlay." ) MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_PRESET, - "Select an overlay from the file browser." + "Selecteer een overlay d.m.v. bestands beheerder." ) MSG_HASH( MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS, @@ -2900,7 +2900,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES, "Cheat changes will take effect immediately.") MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_FILE_LOAD, - "Load a cheat file." + "Laad een cheat bestand." ) MSG_HASH( MENU_ENUM_SUBLABEL_CHEAT_FILE_SAVE_AS, @@ -2944,7 +2944,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME, - "Audio Mixer Volume Level (dB)" + "Audio Mixer Volume Niveau (dB)" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE, @@ -2965,13 +2965,13 @@ MSG_HASH(MSG_PREPARING_FOR_CONTENT_SCAN, MSG_HASH(MENU_ENUM_LABEL_VALUE_CORE_DELETE, "Verwijder core") MSG_HASH(MENU_ENUM_SUBLABEL_CORE_DELETE, - "Remove this core from disk.") + "Verwijder deze core permanent.") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, "Rename the title of the entry.") MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY, "Rename") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FRAMEBUFFER_OPACITY, - "Framebuffer Opacity") + "Framebuffer Doorzichtigheid") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY, "Modify the opacity of the framebuffer.") MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES, @@ -2991,7 +2991,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_GOTO_VIDEO, MSG_HASH(MENU_ENUM_SUBLABEL_GOTO_VIDEO, "Videos which have been previously played will appear here.") MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, - "Menu Icons") + "Menu Iconen") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, @@ -3105,7 +3105,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD, MSG_HASH(MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD, "Supplying a password when enabling kiosk mode makes it possible to later disable it from the menu, by going to the Main Menu, selecting Disable Kiosk Mode and entering the password.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD, - "Enter Password") + "Voer Wachtwoord In") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Wachtwoord correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, @@ -3180,13 +3180,13 @@ MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_MIXER_AND_PLAY, MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY, "Play") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED, - "Play (Looped)") + "Afspelen (Loop)") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL, - "Play (Sequential)") + "Afspelen (Sequentieel)") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP, "Stop") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE, - "Remove") + "Verwijderen") MSG_HASH(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME, "Volume") MSG_HASH(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE, @@ -3198,11 +3198,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_MENU, MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME, "In-Game") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED, - "In-Game (Paused)") + "In-Game (Gepauzeerd)") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING, - "Playing") + "Afspelen") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED, - "Paused") + "Gepauzeerd") MSG_HASH( MENU_ENUM_LABEL_VALUE_DISCORD_ALLOW, "Discord Inschakelen" @@ -3212,7 +3212,7 @@ MSG_HASH( "Enable or disable Discord support. Will not work with the browser version, only native desktop client." ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POWER_MANAGEMENT_SETTINGS, - "Power Management") + "Energiebeheer") MSG_HASH(MENU_ENUM_SUBLABEL_POWER_MANAGEMENT_SETTINGS, "Change power management settings.") MSG_HASH(MENU_ENUM_LABEL_VALUE_SUSTAINED_PERFORMANCE_MODE, @@ -3339,11 +3339,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, "Menu Kleur Thema") MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, - "Basic White" + "Wit" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, - "Basic Black" + "Zwart" ) MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, From ad6f89129064d17c4e3c4080e3df82911cbb7b3f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 2 Nov 2018 15:18:29 +0100 Subject: [PATCH 0458/1292] Hide MIDI settings if driver is set to null --- intl/msg_hash_nl.h | 54 ++++++++++++++++++++++----------------------- menu/menu_setting.c | 19 +++++++++------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 7e9d5c85e7..86ab943faa 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -486,9 +486,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, "") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, - "Directory niet gevonden.") + "Map niet gevonden.") MSG_HASH(MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS, - "Directory") + "Map") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS, "Disk Cycle Tray Status") MSG_HASH(MENU_ENUM_LABEL_VALUE_DISK_IMAGE_APPEND, @@ -708,7 +708,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_HORIZ_WHEEL_DOWN, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE, "Keyboard Gamepad Mapping Type") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS, - "Maximaal Aantal Gebruikers") + "Maximum Aantal Gebruikers") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, "Menu Schakelaar Gamepad Combo") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS, @@ -754,15 +754,15 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, "Reset game") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, - "Rewind") + "Terugspoelen") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, "Save state") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, - "Take screenshot") + "Schermafdruk maken") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_NEXT, - "Next shader") + "Volgende shader") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SHADER_PREV, - "Previous shader") + "Vorige shader") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION_HOLD_KEY, "Slow motion") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, @@ -778,7 +778,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU, "Verberg Overlay In Menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR, - "Poll Type Behavior") + "Poll Type Gedrag") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, "Vroeg") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, @@ -848,7 +848,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, "Arabic") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, - "Linkse Analoog Stick") + "Linkse Analoge Stick") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, "Core") MSG_HASH(MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, @@ -994,7 +994,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_ITEMS, MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PERFORMANCE_COUNTERS, "Geen prestatie tellers.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLISTS, - "No playlists.") + "Geen afspeellijsten.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE, "Geen afspeellijst items beschikbaar.") MSG_HASH(MENU_ENUM_LABEL_VALUE_NO_SETTINGS_FOUND, @@ -1058,9 +1058,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PRESENT, MSG_HASH(MENU_ENUM_LABEL_VALUE_PRIVACY_SETTINGS, "Privacy") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, - "Sluit RetroArch") + "RetroArch Afsluiten") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, - "Analog supported") + "Analoge besturing ondersteund") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_BBFC_RATING, "BBFC Rating") MSG_HASH(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_CERO_RATING, @@ -1177,7 +1177,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_CONFIG_DIRECTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_SHOW_START_SCREEN, "Start Scherm Weergeven") MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG, - "Rechtse Analog Stick") + "Rechtse Analoge Stick") MSG_HASH( MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, "Toevoegen aan Favorieten" @@ -1611,11 +1611,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_WIFI_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, "Menu Alpha Factor") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED, - "Menu Font Red Color") + "Menu Font Rode Kleur") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN, - "Menu Font Green Color") + "Menu Font Groene Kleur") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE, - "Menu Font Blue Color") + "Menu Font Blauwe Kleur") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_FONT, "Menu Font") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_CUSTOM, @@ -1821,13 +1821,13 @@ MSG_HASH(MSG_COMPILED_AGAINST_API, MSG_HASH(MSG_CONFIG_DIRECTORY_NOT_SET, "Config directory not set. Cannot save new config.") MSG_HASH(MSG_CONNECTED_TO, - "Connected to") + "Verbonden met") MSG_HASH(MSG_CONTENT_CRC32S_DIFFER, "Content CRC32s differ. Cannot use different games.") MSG_HASH(MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT, "Content loading skipped. Implementation will load it on its own.") MSG_HASH(MSG_CORE_DOES_NOT_SUPPORT_SAVESTATES, - "Core does not support save states.") + "Core heeft geen save state ondersteuning.") MSG_HASH(MSG_CORE_OPTIONS_FILE_CREATED_SUCCESSFULLY, "Core options file created successfully.") MSG_HASH(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER, @@ -1859,7 +1859,7 @@ MSG_HASH(MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH, MSG_HASH(MSG_DISCONNECT_DEVICE_FROM_A_VALID_PORT, "Disconnect device from a valid port.") MSG_HASH(MSG_DISK_CLOSED, - "Closed") + "Gesloten") MSG_HASH(MSG_DISK_EJECTED, "Ejected") MSG_HASH(MSG_DOWNLOADING, @@ -1867,15 +1867,15 @@ MSG_HASH(MSG_DOWNLOADING, MSG_HASH(MSG_DOWNLOAD_FAILED, "Download mislukt") MSG_HASH(MSG_ERROR, - "Error") + "Fout") MSG_HASH(MSG_ERROR_LIBRETRO_CORE_REQUIRES_CONTENT, "Libretro core heeft inhoud nodig, maar dat werd niet gegeven.") MSG_HASH(MSG_ERROR_LIBRETRO_CORE_REQUIRES_SPECIAL_CONTENT, "Libretro core heeft speciaal inhoud nodig, maar dat werd niet gegeven.") MSG_HASH(MSG_ERROR_PARSING_ARGUMENTS, - "Error parsing arguments.") + "Fout opgetreden tijdens het verwerken van de argumenten.") MSG_HASH(MSG_ERROR_SAVING_CORE_OPTIONS_FILE, - "Error saving core options file.") + "Fout opgetreden tijdens het opslaan van core opties bestand.") MSG_HASH(MSG_ERROR_SAVING_REMAP_FILE, "Fout is opgetreden tijdens het opslaan van remap bestand.") MSG_HASH(MSG_ERROR_SAVING_SHADER_PRESET, @@ -1887,7 +1887,7 @@ MSG_HASH(MSG_EXTRACTING, MSG_HASH(MSG_EXTRACTING_FILE, "Uitpakken van bestand") MSG_HASH(MSG_FAILED_SAVING_CONFIG_TO, - "Fout is opgetrijdens tijdens het opslaan van configuratie naar ") + "Fout is opgetreden tijdens het opslaan van configuratie naar ") MSG_HASH(MSG_FAILED_TO, "Failed to") MSG_HASH(MSG_FAILED_TO_ACCEPT_INCOMING_SPECTATOR, @@ -1973,7 +1973,7 @@ MSG_HASH(MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, MSG_HASH(MSG_FOUND_LAST_STATE_SLOT, "Found last state slot") MSG_HASH(MSG_FOUND_SHADER, - "Found shader") + "Shader gevonden") MSG_HASH(MSG_FRAMES, "Frames") MSG_HASH(MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT, @@ -2085,7 +2085,7 @@ MSG_HASH(MSG_REVERTING_SAVEFILE_DIRECTORY_TO, MSG_HASH(MSG_REVERTING_SAVESTATE_DIRECTORY_TO, "Reverting savestate directory to") MSG_HASH(MSG_REWINDING, - "Rewinding.") + "Terugspoelen.") MSG_HASH(MSG_REWIND_INIT, "Initializing rewind buffer with size") MSG_HASH(MSG_REWIND_INIT_FAILED, @@ -2093,7 +2093,7 @@ MSG_HASH(MSG_REWIND_INIT_FAILED, MSG_HASH(MSG_REWIND_INIT_FAILED_THREADED_AUDIO, "Implementation uses threaded audio. Cannot use rewind.") MSG_HASH(MSG_REWIND_REACHED_END, - "Reached end of rewind buffer.") + "Einde bereikt van terugspoel buffer.") MSG_HASH(MSG_SAVED_NEW_CONFIG_TO, "Saved new config to") MSG_HASH(MSG_SAVED_STATE_TO_SLOT, @@ -3154,7 +3154,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, "Enable or disable menu sound.") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, - "Mixer Settings") + "Mixer Instellingen") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, "View and/or modify audio mixer settings.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_OVERRIDE_OPTIONS, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index fd23fdcc53..a18666d49f 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4074,14 +4074,17 @@ static bool setting_append_list( &subgroup_info, parent_group); - CONFIG_ACTION( - list, list_info, - MENU_ENUM_LABEL_MIDI_SETTINGS, - MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, - &group_info, - &subgroup_info, - parent_group); - settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); + if (string_is_not_equal(settings->arrays.midi_driver, "null")) + { + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_MIDI_SETTINGS, + MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, + &group_info, + &subgroup_info, + parent_group); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); + } for (user = 0; user < MAX_USERS; user++) setting_append_list_input_player_options(list, list_info, parent_group, user); From 1aded41b338ca1a606e2c111bf9019197c78c95b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 2 Nov 2018 15:29:29 +0100 Subject: [PATCH 0459/1292] Add more localized strings --- intl/msg_hash_ar.h | 10 ++++++++++ intl/msg_hash_chs.h | 10 ++++++++++ intl/msg_hash_cht.h | 10 ++++++++++ intl/msg_hash_de.h | 10 ++++++++++ intl/msg_hash_el.h | 10 ++++++++++ intl/msg_hash_eo.h | 10 ++++++++++ intl/msg_hash_es.h | 10 ++++++++++ intl/msg_hash_fr.h | 10 ++++++++++ intl/msg_hash_it.h | 10 ++++++++++ intl/msg_hash_ja.h | 10 ++++++++++ intl/msg_hash_ko.h | 10 ++++++++++ intl/msg_hash_nl.h | 10 ++++++++++ intl/msg_hash_pl.h | 10 ++++++++++ intl/msg_hash_pt_br.h | 10 ++++++++++ intl/msg_hash_pt_pt.h | 10 ++++++++++ intl/msg_hash_ru.h | 10 ++++++++++ intl/msg_hash_us.h | 10 ++++++++++ intl/msg_hash_vn.h | 10 ++++++++++ menu/menu_setting.c | 10 +++++----- msg_hash.h | 5 +++++ 20 files changed, 190 insertions(+), 5 deletions(-) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 8b2c710329..c041df1055 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3696,3 +3696,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index a02caeeaa6..f2ca0cd115 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -4715,3 +4715,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 1fb9e5dba5..01b032fcc1 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3472,3 +3472,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 2637884ab6..01e5e205ea 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3608,3 +3608,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index d6277e1154..17ff133ff0 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -7700,3 +7700,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index e2f0ebe25b..a2172786ad 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3347,3 +3347,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 0dc0ecaff4..dd588eee85 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7637,3 +7637,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 748d6aee42..e0295b0c35 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3506,3 +3506,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 3b428891f5..ba5f992d91 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3566,3 +3566,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Usa la colorazione preferita di sistema") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Utilizza la colorazione dei temi del sistema operativo (se presente) - impostazioni del tema di override.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 49e80b63d2..133b22d2c2 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -4015,3 +4015,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 0cae872621..22f613879a 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3467,3 +3467,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 86ab943faa..c82cf6d559 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3353,3 +3353,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Laagst") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lager") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normaal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Hoger") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Hoogst") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 7aeab8ae6e..9ca0b84ee1 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3769,3 +3769,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Użyj preferowanego motywu kolorystycznego systemu") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Użyj motywu kolorystycznego systemu operacyjnego (jeśli jest dostępny) - zastępuje ustawienia kompozycji.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 41fe5e2788..a58aa4e2cd 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7731,3 +7731,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 68626e9a45..6e1c6df6d9 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3433,3 +3433,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 36145db042..419bbd3c85 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3636,3 +3636,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 9189992a5b..f1bbb0d370 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7731,3 +7731,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 6f4a5c5cf3..b3376cbe61 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3506,3 +3506,13 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, + "Lowest") +MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, + "Lower") +MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, + "Normal") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, + "Higher") +MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, + "Highest") diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a18666d49f..f5b91328c8 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1656,23 +1656,23 @@ static void setting_get_string_representation_uint_audio_resampler_quality( len); break; case RESAMPLER_QUALITY_LOWEST: - strlcpy(s, "Lowest", + strlcpy(s, msg_hash_to_str(MSG_RESAMPLER_QUALITY_LOWEST), len); break; case RESAMPLER_QUALITY_LOWER: - strlcpy(s, "Lower", + strlcpy(s, msg_hash_to_str(MSG_RESAMPLER_QUALITY_LOWER), len); break; case RESAMPLER_QUALITY_HIGHER: - strlcpy(s, "Higher", + strlcpy(s, msg_hash_to_str(MSG_RESAMPLER_QUALITY_HIGHER), len); break; case RESAMPLER_QUALITY_HIGHEST: - strlcpy(s, "Highest", + strlcpy(s, msg_hash_to_str(MSG_RESAMPLER_QUALITY_HIGHEST), len); break; case RESAMPLER_QUALITY_NORMAL: - strlcpy(s, "Normal", + strlcpy(s, msg_hash_to_str(MSG_RESAMPLER_QUALITY_NORMAL), len); break; } diff --git a/msg_hash.h b/msg_hash.h index 0642ca9abe..9e7b7b0433 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -184,6 +184,11 @@ enum msg_hash_enums MSG_NETPLAY_CANNOT_PLAY, MSG_NETPLAY_PEER_PAUSED, MSG_NETPLAY_CHANGED_NICK, + MSG_RESAMPLER_QUALITY_LOWEST, + MSG_RESAMPLER_QUALITY_LOWER, + MSG_RESAMPLER_QUALITY_NORMAL, + MSG_RESAMPLER_QUALITY_HIGHER, + MSG_RESAMPLER_QUALITY_HIGHEST, MSG_ADDED_TO_FAVORITES, MSG_RESET_CORE_ASSOCIATION, MSG_CORE_ASSOCIATION_RESET, From 7be48c80348a1c0d2afe931d1f57304f1c9247b0 Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Fri, 2 Nov 2018 14:30:26 +0000 Subject: [PATCH 0460/1292] Add Normal2x CPU filter --- Makefile.common | 5 +- gfx/video_filter.c | 2 + gfx/video_filters/Makefile | 2 +- gfx/video_filters/Normal2x.filt | 1 + gfx/video_filters/normal2x.c | 218 ++++++++++++++++++++++++++++++++ griffin/griffin.c | 1 + 6 files changed, 226 insertions(+), 3 deletions(-) create mode 100644 gfx/video_filters/Normal2x.filt create mode 100644 gfx/video_filters/normal2x.c diff --git a/Makefile.common b/Makefile.common index f7017a98bc..f6995db9ed 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1806,7 +1806,8 @@ OBJ += gfx/video_filters/2xsai.o \ gfx/video_filters/scale2x.o \ gfx/video_filters/blargg_ntsc_snes.o \ gfx/video_filters/lq2x.o \ - gfx/video_filters/phosphor2x.o + gfx/video_filters/phosphor2x.o \ + gfx/video_filters/normal2x.o endif ifeq ($(WANT_IOSUHAX), 1) @@ -1881,4 +1882,4 @@ endif ifeq ($(HAVE_HAKCHI), 1) CFLAGS += -DHAVE_HAKCHI endif -################################## \ No newline at end of file +################################## diff --git a/gfx/video_filter.c b/gfx/video_filter.c index 935c435e7a..bb76dbcba5 100644 --- a/gfx/video_filter.c +++ b/gfx/video_filter.c @@ -333,6 +333,7 @@ extern const struct softfilter_implementation *supertwoxsai_get_implementation(s extern const struct softfilter_implementation *twoxbr_get_implementation(softfilter_simd_mask_t simd); extern const struct softfilter_implementation *darken_get_implementation(softfilter_simd_mask_t simd); extern const struct softfilter_implementation *scale2x_get_implementation(softfilter_simd_mask_t simd); +extern const struct softfilter_implementation *normal2x_get_implementation(softfilter_simd_mask_t simd); static const softfilter_get_implementation_t soft_plugs_builtin[] = { blargg_ntsc_snes_get_implementation, @@ -345,6 +346,7 @@ static const softfilter_get_implementation_t soft_plugs_builtin[] = { supereagle_get_implementation, epx_get_implementation, scale2x_get_implementation, + normal2x_get_implementation, }; static bool append_softfilter_plugs(rarch_softfilter_t *filt, diff --git a/gfx/video_filters/Makefile b/gfx/video_filters/Makefile index 81c04b8f82..3a1a3e6b8f 100644 --- a/gfx/video_filters/Makefile +++ b/gfx/video_filters/Makefile @@ -70,7 +70,7 @@ ASMFLAGS := -INEON/asm asflags += -mfpu=neon endif -objects += blargg_ntsc_snes.$(DYLIB) phosphor2x.$(DYLIB) epx.$(DYLIB) lq2x.$(DYLIB) 2xsai.$(DYLIB) super2xsai.$(DYLIB) supereagle.$(DYLIB) 2xbr.$(DYLIB) darken.$(DYLIB) scale2x.$(DYLIB) +objects += blargg_ntsc_snes.$(DYLIB) phosphor2x.$(DYLIB) epx.$(DYLIB) lq2x.$(DYLIB) 2xsai.$(DYLIB) super2xsai.$(DYLIB) supereagle.$(DYLIB) 2xbr.$(DYLIB) darken.$(DYLIB) scale2x.$(DYLIB) normal2x.$(DYLIB) all: build; diff --git a/gfx/video_filters/Normal2x.filt b/gfx/video_filters/Normal2x.filt new file mode 100644 index 0000000000..500574af11 --- /dev/null +++ b/gfx/video_filters/Normal2x.filt @@ -0,0 +1 @@ +filter = normal2x diff --git a/gfx/video_filters/normal2x.c b/gfx/video_filters/normal2x.c new file mode 100644 index 0000000000..d39159b436 --- /dev/null +++ b/gfx/video_filters/normal2x.c @@ -0,0 +1,218 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2018 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +/* Compile: gcc -o normal2x.so -shared normal2x.c -std=c99 -O3 -Wall -pedantic -fPIC */ + +#include "softfilter.h" +#include + +#ifdef RARCH_INTERNAL +#define softfilter_get_implementation normal2x_get_implementation +#define softfilter_thread_data normal2x_softfilter_thread_data +#define filter_data normal2x_filter_data +#endif + +struct softfilter_thread_data +{ + void *out_data; + const void *in_data; + size_t out_pitch; + size_t in_pitch; + unsigned colfmt; + unsigned width; + unsigned height; + int first; + int last; +}; + +struct filter_data +{ + unsigned threads; + struct softfilter_thread_data *workers; + unsigned in_fmt; +}; + +static unsigned normal2x_generic_input_fmts(void) +{ + return SOFTFILTER_FMT_XRGB8888 | SOFTFILTER_FMT_RGB565; +} + +static unsigned normal2x_generic_output_fmts(unsigned input_fmts) +{ + return input_fmts; +} + +static unsigned normal2x_generic_threads(void *data) +{ + struct filter_data *filt = (struct filter_data*)data; + return filt->threads; +} + +static void *normal2x_generic_create(const struct softfilter_config *config, + unsigned in_fmt, unsigned out_fmt, + unsigned max_width, unsigned max_height, + unsigned threads, softfilter_simd_mask_t simd, void *userdata) +{ + struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); + (void)simd; + (void)config; + (void)userdata; + + if (!filt) { + return NULL; + } + /* Apparently the code is not thread-safe, + * so force single threaded operation... */ + filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data)); + filt->threads = 1; + filt->in_fmt = in_fmt; + if (!filt->workers) { + free(filt); + return NULL; + } + return filt; +} + +static void normal2x_generic_output(void *data, + unsigned *out_width, unsigned *out_height, + unsigned width, unsigned height) +{ + *out_width = width << 1; + *out_height = height << 1; +} + +static void normal2x_generic_destroy(void *data) +{ + struct filter_data *filt = (struct filter_data*)data; + if (!filt) { + return; + } + free(filt->workers); + free(filt); +} + +static void normal2x_work_cb_xrgb8888(void *data, void *thread_data) +{ + struct softfilter_thread_data *thr = (struct softfilter_thread_data*)thread_data; + const uint32_t *input = (const uint32_t*)thr->in_data; + uint32_t *output = (uint32_t*)thr->out_data; + unsigned in_stride = (unsigned)(thr->in_pitch >> 2); + unsigned out_stride = (unsigned)(thr->out_pitch >> 2); + unsigned x, y; + + for (y = 0; y < thr->height; ++y) + { + uint32_t *out_ptr = output; + for (x = 0; x < thr->width; ++x) + { + uint64_t colour = (uint64_t)*(input + x); + colour |= colour << 32; + + *(uint64_t *)(out_ptr) = colour; + *(uint64_t *)(out_ptr + out_stride) = colour; + + out_ptr += 2; + } + + input += in_stride; + output += out_stride << 1; + } +} + +static void normal2x_work_cb_rgb565(void *data, void *thread_data) +{ + struct softfilter_thread_data *thr = (struct softfilter_thread_data*)thread_data; + const uint16_t *input = (const uint16_t*)thr->in_data; + uint16_t *output = (uint16_t*)thr->out_data; + unsigned in_stride = (unsigned)(thr->in_pitch >> 1); + unsigned out_stride = (unsigned)(thr->out_pitch >> 1); + unsigned x, y; + + for (y = 0; y < thr->height; ++y) + { + uint16_t * out_ptr = output; + for (x = 0; x < thr->width; ++x) + { + uint32_t colour = (uint32_t)*(input + x); + colour |= colour << 16; + + *(uint32_t *)(out_ptr) = colour; + *(uint32_t *)(out_ptr + out_stride) = colour; + + out_ptr += 2; + } + + input += in_stride; + output += out_stride << 1; + } +} + +static void normal2x_generic_packets(void *data, + struct softfilter_work_packet *packets, + void *output, size_t output_stride, + const void *input, unsigned width, unsigned height, size_t input_stride) +{ + /* We are guaranteed single threaded operation + * (filt->threads = 1) so we don't need to loop + * over threads and can cull some code. This only + * makes the tiniest performance difference, but + * every little helps when running on an o3DS... */ + struct filter_data *filt = (struct filter_data*)data; + struct softfilter_thread_data *thr = (struct softfilter_thread_data*)&filt->workers[0]; + + thr->out_data = (uint8_t*)output; + thr->in_data = (const uint8_t*)input; + thr->out_pitch = output_stride; + thr->in_pitch = input_stride; + thr->width = width; + thr->height = height; + + if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) { + packets[0].work = normal2x_work_cb_xrgb8888; + } else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) { + packets[0].work = normal2x_work_cb_rgb565; + } + packets[0].thread_data = thr; +} + +static const struct softfilter_implementation normal2x_generic = { + normal2x_generic_input_fmts, + normal2x_generic_output_fmts, + + normal2x_generic_create, + normal2x_generic_destroy, + + normal2x_generic_threads, + normal2x_generic_output, + normal2x_generic_packets, + + SOFTFILTER_API_VERSION, + "Normal2x", + "normal2x", +}; + +const struct softfilter_implementation *softfilter_get_implementation( + softfilter_simd_mask_t simd) +{ + (void)simd; + return &normal2x_generic; +} + +#ifdef RARCH_INTERNAL +#undef softfilter_get_implementation +#undef softfilter_thread_data +#undef filter_data +#endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 237ce3a9c5..e063951f5c 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -860,6 +860,7 @@ FILTERS #include "../gfx/video_filters/blargg_ntsc_snes.c" #include "../gfx/video_filters/lq2x.c" #include "../gfx/video_filters/phosphor2x.c" +#include "../gfx/video_filters/normal2x.c" #include "../libretro-common/audio/dsp_filters/echo.c" #include "../libretro-common/audio/dsp_filters/eq.c" From e374061f90a0c8d11aa0e989116ad202c8ae6d66 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 2 Nov 2018 16:30:52 +0100 Subject: [PATCH 0461/1292] Cleanups --- dynamic.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/dynamic.c b/dynamic.c index bf2136e9dc..b957db5943 100644 --- a/dynamic.c +++ b/dynamic.c @@ -54,7 +54,6 @@ #include "camera/camera_driver.h" #include "location/location_driver.h" #include "record/record_driver.h" -#include "core.h" #include "driver.h" #include "performance_counters.h" #include "gfx/video_driver.h" @@ -62,13 +61,11 @@ #include "midi/midi_driver.h" #include "cores/internal_cores.h" -#include "frontend/frontend_driver.h" #include "content.h" #include "dirs.h" #include "paths.h" #include "retroarch.h" #include "configuration.h" -#include "msg_hash.h" #include "verbosity.h" #include "tasks/tasks_internal.h" From 7ec627d41df14d782419999a010ab0e6aae21d1a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 2 Nov 2018 16:32:32 +0100 Subject: [PATCH 0462/1292] Cleanups --- driver.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/driver.c b/driver.c index 68f5b314d7..a282df040c 100644 --- a/driver.c +++ b/driver.c @@ -18,8 +18,6 @@ #include #include -#include