Commit Graph

1567 Commits

Author SHA1 Message Date
Phillip Stephens 2e8eec91ea
Missed one 2019-09-21 06:10:54 -07:00
Phillip Stephens 68e2fad74f
Fix TCastTo.hpp inclusions, add comment to warn against modifying include path 2019-09-21 06:07:13 -07:00
Phillip Stephens a89852fc46
Merge pull request #79 from lioncash/trunc
CAuiEnergyBarT01: Prevent truncation within DownloadBarCoordFunc
2019-09-21 05:44:27 -07:00
Phillip Stephens 88e057bf11
Merge pull request #78 from lioncash/const2
CGuiWidgetDrawParms: Mark Default instance as const
2019-09-21 05:44:00 -07:00
Phillip Stephens 110f07256d
Merge pull request #77 from lioncash/state
CPlayerState: Make use of std::array where applicable
2019-09-21 05:43:49 -07:00
Lioncash 3f06dd0a64 CAuiEnergyBarT01: Prevent truncation within DownloadBarCoordFunc
Without float literals, the calculation is performed in double precision
and then truncated down to float implicitly.
2019-09-19 22:31:46 -04:00
Lioncash 04cc300019 CGuiWidgetDrawParms: Mark Default instance as const
This isn't ever modified, so it can be made const to prevent
unintentional modification (and allow it to be placed within the RO
segment).
2019-09-19 21:46:11 -04:00
Lioncash f49c8e9d6c CPlayerState: Use std::array where applicable
Prevents implicit array->pointer decay and makes for a more convenient
data type.
2019-09-19 15:42:50 -04:00
Lioncash f4fd182741 CPlayerState: Move arrays into an anonymous namespace where applicable
Keeps local arrays together and makes it impossible to accidentally
violate the ODR.
2019-09-19 15:36:39 -04:00
Lioncash bc285913c8 CPlayerState: Organize includes 2019-09-19 15:27:20 -04:00
Lioncash 019ee29a0c CPlayer: Make file-scope CMaterialFilter instances constexpr
Now that the interface is constexpr, we can mark these as constexpr.
2019-09-19 15:18:44 -04:00
Phillip Stephens 9c2fd54546
Merge pull request #75 from lioncash/matlist
CMaterialFilter/CMaterialList: Make interface constexpr
2019-09-19 01:21:56 -07:00
Lioncash 2d8111531f CMaterialFilter: Make interface constexpr
A few instances of CMaterialFilter are constructed at file-scope using
the Make* functions and the constructor. Given these aren't constexpr,
this means these are technically runtime function calls. We can make
these constexpr to allow the initialization to be done at compile-time,
slightly improving startup time.
2019-09-18 13:00:04 -04:00
Lioncash 0e39c64bfc CMaterialList: Make interface constexpr 2019-09-18 12:45:11 -04:00
Lioncash 1f13fc05a0 CMaterialFilter/CMaterialList: Amend inclusions 2019-09-18 12:38:14 -04:00
Lioncash 6ec903f9ac CPlayer: Use std::array where applicable
Makes the arrays strongly-typed and impervious to implicit
array->pointer decay. We can also eliminate a few hardcoded magic
values.
2019-09-18 12:28:44 -04:00
Lioncash 70fb763180 CPlayer: Enclose translation-unit-local data within an anonymous namespace
Keeps all local data within one spot and prevents any potential ODR
violations related to them from occurring.
2019-09-18 12:27:15 -04:00
Lioncash 33f10e2552 CPlayer: Organize includes 2019-09-18 11:50:26 -04:00
Lioncash 45cdc38ac0 CPlayer: Use size_t with SfxIdFromMaterial
Allows passing in sizes without potential truncation from size_t,
allowing nicer use of std::size() to dehardcode some magic values.
2019-09-17 14:52:42 -04:00
Lioncash 96f035f24b CMorphBall: Use std::array where applicable
Makes the arrays strongly-typed and impervious to implicit
array->pointer decay.

This also uncovered an out of bounds memory read within UpdateEffects
cause by said array->pointer decay.
2019-09-16 21:11:30 -04:00
Lioncash e4b22ea9d8 CMorphBall: Place internally linked data within an anonymous namespace
Keeps all internal data within one place and also prevents any potential
ODR violations from occurring in relation to any of these.
2019-09-16 14:53:52 -04:00
Lioncash 8c59ace5fe CMorphBall: Clean up includes 2019-09-16 14:43:33 -04:00
Phillip Stephens 823df9643a
Merge pull request #71 from lioncash/enum
CSortedLists: Minor changes
2019-09-15 22:06:06 -07:00
Lioncash a5ab077dc3 CSortedLists: Use std::array where applicable
Prevents implicit array to pointer decay and allows us to simplify a bit
of the code.
2019-09-15 19:27:19 -04:00
Lioncash f5d486f0ca CSortedLists: Turn ESortedList into an enum class
Prevents namespace pollution and makes the type more strongly-enforced
with regards to implicit conversions
2019-09-15 18:52:02 -04:00
Lioncash 0281029015 CEntityInfo: std::move vector in constructor
Allows calling code to potentially avoid copies altogether by moving
into the constructor.
2019-09-15 16:22:35 -04:00
Phillip Stephens cc236dcaba
Merge pull request #69 from lioncash/frontend
CFrontEndUI: Use std::array where applicable
2019-09-14 19:24:12 -07:00
Phillip Stephens 0120a43e0e
Merge pull request #68 from lioncash/insensitive
CStringExtras: Prevent potential out of bounds reads with CompareCaseInsensitive
2019-09-14 19:23:59 -07:00
Lioncash 991d048694 CStringExtras: Prevent undefined behavior within IndexOfSubstring
Unlikely to occur, but does completely prevent the case of undefined
behavior if a non-ascii character ends up within the given string.
2019-09-14 16:43:06 -04:00
Lioncash 0d2b2f45a8 CStringExtras: Prevent potential out of bounds reads with CompareCaseInsensitive
The strcasecmp and _stricmp functions expect the passed in strings to
be null-terminated, however we we're also exposing a std::string_view
overload for that function. std::string_view instances aren't required
to be null-terminated, so this makes the interface a little unsafe.

We can use std::lexicographical_compare() to provide the same behavior
and also properly handle the case of non-null-terminated strings.
2019-09-14 16:43:04 -04:00
Lioncash 86218421f5 CFrontEndUI: Use std::array where applicable
Makes the array types strongly-typed and also allows us to eliminate a
few magic values within the code.
2019-09-14 16:26:29 -04:00
Lioncash b6ea391755 CFrontEndUI: Enclose file-local data within an anonymous namespace
Gets rid of the need to write static, and also makes it impossible to
violate the ODR for any declared types within the namespace (e.g.
FEMovie).
2019-09-14 15:45:17 -04:00
Lioncash 2a10e547d2 CFrontEndUI: Sort includes
Tidies up the includes for the translation unit and alphabetizes them
for easier reading.
2019-09-14 15:42:12 -04:00
Phillip Stephens 9b816d471b
Compile fixes 2019-09-14 10:08:09 -07:00
Phillip Stephens 613f690c42
Merge pull request #66 from lioncash/lockfire
CCompoundTargetReticle: Fix typo in lock fire string
2019-09-13 00:11:37 -07:00
Lioncash 0aa749ce0c CCompoundTargetReticle: Fix typo in lock fire string
In the actual game executable, the string is stored with a lower-case 'i', not an upper-case one.
2019-09-12 06:40:52 -04:00
Lioncash 20696fd500 CCompoundTargetReticle: Declare file-scope strings as arrays
Reduces the overall size of the resulting binary, as only the string
data will be stored rather than the string and a pointer pointing to
said string data.
2019-09-12 06:38:05 -04:00
Lioncash 267fd2962a CCompoundTargetReticle: Move private strings into the cpp file
This is an internal detail, so we don't need to expose this in the
header,
2019-09-12 05:45:53 -04:00
Lioncash f9079f0215 Runtime: Make use of std::make_unique where applicable
Makes use of the C++14 make_unique allocation function to allocate class
instances where applicable instead of a reset with a new operator within
it.

This doesn't touch cases where buffers are allocated, given make_unique
would zero-initialize them.
2019-09-12 04:09:48 -04:00
Lioncash 9983366a53 RumbleFxTable: Use std::array for the lookup table
Strongly enforces the type of the array and also allows size querying,
etc, directly from the type.
2019-09-10 19:13:34 -04:00
Lioncash d7493d5920 CRumbleVoice: Make SAdsrDelta interface constexpr
Makes the API consistent between SAdsrData and SAdsrDelta.
2019-09-10 19:13:34 -04:00
Lioncash 6ca5143b15 CRumbleVoice: Make SAdsrData constructors constexpr
Technically all file-scope instances have runtime-static constructors
otherwise. This allows the compiler to completely elide them from a
language point of view.
2019-09-10 19:02:22 -04:00
Phillip Stephens 60409d2f6a
Merge pull request #63 from lioncash/char
CActorModelParticles: Make DGRP array constexpr
2019-09-10 04:03:06 -07:00
Lioncash 5baf3206f4 CActorModelParticles: Make DGRP array constexpr
Technically this array wasn't readonly and contained a sequence of
modifiable elements. We can make this constexpr so that the compiler can
definitively place it into the read-only segment.
2019-09-09 20:44:23 -04:00
Phillip Stephens e2ab93dfac
Update submodules 2019-09-09 04:21:01 -07:00
Phillip Stephens f07fc458d2
Merge pull request #62 from lioncash/crc
CCRC32: Move table declaration into the cpp file
2019-09-08 17:49:44 -07:00
Lioncash f430a00314 CCRC32: Move table declaration into the cpp file
This can be moved entirely into the cpp file, making it an
implementation detail.
2019-09-08 18:18:29 -04:00
Lioncash c9271809a7 CAiFuncMap: Remove unused static std::vector
This isn't used, so we can remove it and get rid of a static
constructor.
2019-09-08 18:08:10 -04:00
Lioncash 20a0585cc5 CAiFuncMap: Convert typedefs into type aliases
Same thing, but reads a little nicer.
2019-09-08 18:08:10 -04:00
Lioncash 2f06fcba0a CAiFuncMap: Avoid redundant map lookups in getters
We can just use the result of the find operation instead of rehashing
into the map to retrieve the entry.

This also allows us to make the getter const qualified.
2019-09-08 18:08:10 -04:00
Lioncash 1cfe83d8d1 CAiFuncMap: Replace map indexing with emplace in the constructor
Provides the same behavior, but without default initializing a map entry
that immediately gets overridden in the assignment.
2019-09-08 18:08:10 -04:00
Phillip Stephens 12c3942e65
Merge pull request #57 from lioncash/ref
World/CScript*: Pass by reference over by value
2019-09-06 23:21:23 -07:00
Phillip Stephens eae1f1ab82
Merge pull request #56 from lioncash/tentacle
MP1/CFlaahgraTentacle: Amend sphere collision list appending
2019-09-06 23:21:01 -07:00
Lioncash 5b1e783a90 ControlMapper: Prevent array overrun cases
These should be comparing with >=, not >.

The command table descriptions also weren't kept in sync with the
enumeration.
2019-09-06 11:18:13 -04:00
Lioncash 2c6aed7033 World/CScript*: Pass by reference over by value
Based off the use of the const, it's likely that these were intended to
be references, rather than be copied by value
2019-09-06 10:49:54 -04:00
Lioncash d25f4fa9a3 MP1/CFlaahgraTentacle: Amend sphere collision list appending
This was always using the first element in the array to append t the
output joint list, resulting in incorrect names and radius values.
2019-09-06 09:43:32 -04:00
Phillip Stephens a1819ca079
Merge pull request #50 from lioncash/jbus
General: Amend relevant code to compile with jbus changes
2019-09-03 23:12:06 -07:00
Phillip Stephens 2d1d11fb56
Update submodules, fix compiling against kabufuda 2019-09-03 23:11:04 -07:00
Lioncash 5aafd3935b CGBASupport: Amend code to compile with jbus changes 2019-09-04 01:56:08 -04:00
Lioncash d5fa8b72b0 CStringTable: Remove unnecessary initializer
std::unique_ptr always initializes to nullptr. We can remove this
implicit convertion from 0 to nullptr.
2019-09-01 03:16:54 -04:00
Lioncash e23dfbd8db CStringTable: Use std::array instead of std::vector
Gets rid of a static constructor, as well as a few heap allocations
2019-09-01 03:13:45 -04:00
Phillip Stephens 256994c199
Initial CEnergyBall, update submodules, various fixes 2019-08-31 02:02:21 -07:00
Lioncash 1d3062b33f General: Make use of FopenUnique where applicable
Migrates to the hecl Fopen variant that automatically closes its
contained file handle if it goes out of scope.
2019-08-26 15:03:58 -04:00
Phillip Stephens 2a60b9fbf4
Update submodules, minor fixes 2019-08-25 18:29:25 -07:00
Lioncash fa608acb06 CPatterned: Correct use of bool in bitfield
This is incremented within PathFind(), however, because the type within
this bitfield is a bool, this can trigger compilation warnings (rightly
so). So we can make it a uint32_t to make it obvious that the
incrementing behavior is intended.
2019-08-23 22:26:07 -04:00
Phillip Stephens 9866bac443 Update jbus, initial CEnergyBall stub 2019-08-23 01:32:48 -07:00
Phillip Stephens e855cbd902 Update hecl, fix CFlickerBat's targetable state being inverted 2019-08-20 06:58:13 -07:00
Phillip Stephens a41bd828e7 Update submodules 2019-08-18 18:49:54 -07:00
Phillip Stephens fa7785d024 Fix GetAreaFog 2019-08-14 12:56:46 -07:00
Lioncash afab3e0327 Runtime: Make const/non-const getters have the same name
Makes for a more consistent interface, as getters won't have different
names to remember based off whether or not they're const qualified.
2019-08-14 12:45:57 -04:00
Phillip Stephens 2ace76e3d2
Merge pull request #41 from lioncash/const
RuntimeCommon: Use const on member functions where applicable
2019-08-14 06:36:27 -07:00
Phillip Stephens bab78f96a5
Merge pull request #40 from lioncash/constexpr
RetroTypes: Make types constexpr where applicable
2019-08-14 06:36:16 -07:00
Phillip Stephens 64489c7461
Merge pull request #39 from lioncash/bind
MP1: Migrate from std::bind to lambdas
2019-08-14 06:36:06 -07:00
Lioncash d3d629d405 RuntimeCommon: Use const on member functions where applicable
Adds missing const qualifiers on class member functions that don't
modify instance state.
2019-08-14 09:25:39 -04:00
Lioncash 1f8ed5af25 RetroTypes: Make types constexpr where applicable
These are generally used as basic tags and ID types, so these can have a
constexpr interface. This is particularly beneficial, given some of
these types are used in file-static lookup tables.

Without being constexpr, these type's constructors in that case are
technically runtime static constructors. While most compilers will
initialize the type at compile-time, this would be dependent on the
optimizer. By marking them constexpr, we allow it outright. It also
allows those arrays to be made constexpr as well.
2019-08-14 05:20:43 -04:00
Lioncash 8b7945e76f MP1: Migrate from std::bind to lambdas
Provides a more straightforward means of supplying custom behavior in
place. Lambdas also typically optimize better compared to std::bind
objects.
2019-08-14 04:55:21 -04:00
Phillip Stephens bade450431
Merge pull request #37 from lioncash/conversion
Runtime/Input/CFinalInput: Correct return value of AKey, ASpecialKey and AMouseButton
2019-08-14 01:05:05 -07:00
Lioncash acb9ac92e7 Runtime/CGameOptions: Use std::array where applicable
Makes the data a little more strongly typed; preventing implicit
array->pointer decay. It also allows simplifying assignments within the
CGameState code.

While we're at it, we can also eliminate several instances of magic
numbers related to the array sizes throughout the code.
2019-08-14 03:24:00 -04:00
Lioncash 27a8274e3b Runtime/Input/CFinalInput: Make comparison operators const
While we're at it, we can also provide an inequality operator for
logical symmetry.
2019-08-14 02:11:50 -04:00
Lioncash e9e9de26b2 Runtime/Input/CFinalInput: Correct return value of AKey, ASpecialKey and AMouseButton
The other A-prefixed functions all return a float value, however these
are truncating float values to bool. We can amend this to prevent
potential compilation warnings.
2019-08-14 02:07:02 -04:00
Lioncash 09f917a9aa Runtime/Weapon/CGameProjectile: Fix misnamed virtual function
This has a vaguely equivalent name to FluidFXThink (which has an
uppercase X). Given this function isn't explicitly called anywhere
directly, this is assumed to be a typo.
2019-08-14 02:00:09 -04:00
Phillip Stephens 7eb3bce499 Update submodules, more CMetroidBeta imps 2019-08-13 14:41:15 -07:00
Phillip Stephens ebdcfb6b51 Initial CMetroidBeta imps 2019-08-11 08:14:52 -07:00
Phillip Stephens a572100176 Add CRipper files 2019-08-10 20:02:54 -07:00
Phillip Stephens ad5e395a51 Fixes for `override` modernization 2019-08-10 17:49:41 -07:00
Phillip Stephens 1e625e0995 Fix missed `override` declarations 2019-08-09 15:07:52 -07:00
Phillip Stephens 1d3e5cdb70 Implement Oculus loader 2019-08-09 14:55:59 -07:00
Lioncash 9312eef905 RuntimeCommon: Use override where applicable
Continues the override modernization by applying it to the main
RuntimeCommon target. Resolves around 1100+ cases where override can be
used.
2019-08-09 17:39:42 -04:00
Phillip Stephens 5eaa7a23e8 Merge branch 'override' of https://github.com/lioncash/urde 2019-08-09 06:27:54 -07:00
Phillip Stephens 8089566788 Merge branch 'assign' of https://github.com/lioncash/urde 2019-08-09 06:27:05 -07:00
Lioncash 2059535b55 RuntimeCommonB: Use the override specifier where applicable
Applies the override keyword where applicable to indicate visually where
member function overriding is occurring. This only targets
the RuntimeCommonB target as a starting point, which resolves around
900+ cases where the keyword could be used.
2019-08-09 09:13:26 -04:00
Lioncash af8731f2d2 GuiSys/CInstruction: Correct erroneous assignment in TestLargestFont
Without this, x20_largestMonoW will never be any value other than zero,
which is indicative of a logic bug.
2019-08-09 07:08:04 -04:00
Phillip Stephens 2f65d6d3a2 Merge branch 'namespace' of https://github.com/lioncash/urde into lioncache-namespace 2019-08-08 20:33:05 -07:00
Lioncash fc906eec66 MP1/CMFGame: Remove erroneous forward declaration
This type is actually defined within the urde::MP1 namespace, not the
top-level urde namespace.

We remove the namespace itself however, given the header for that type
is already being included.
2019-08-08 23:10:00 -04:00
Phillip Stephens d648f156b8 Revert original dolphin hash idea completely 2019-08-03 17:05:40 -07:00
Phillip Stephens ff83dbc676 Minor fixes and cleanup 2019-08-03 17:02:53 -07:00
Jack Andersen 0ab08daae7 Windows build fixes 2019-07-27 15:21:31 -10:00
Jack Andersen 5acf9ecbcf Graphics debug groups and bug fixes 2019-07-20 22:42:52 -10:00
Jack Andersen b4fe474de3 Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/urde 2019-07-19 18:29:06 -10:00
Jack Andersen 7a3da1f7a6 Massive fmtlib refactor 2019-07-19 18:27:21 -10:00