Commit Graph

36759 Commits

Author SHA1 Message Date
Crash Cringle 00342feadc Add new preference: DefaultGroupOffsetSeconds to dictate the default sync bias on the machine when no group.ini is present (or if there is no SyncOffset field in said file).
- Generally Supports either ITG (9ms) or NULL (0ms).
- Alternatively, one could edit the preference manually to put a different value
- Name/Description probably worth ironing out
2025-03-03 23:25:32 -08:00
Crash Cringle 835ca35065 Ensure the Group Offset is applied when Reloading a Song from Disk 2025-03-03 23:25:32 -08:00
Crash Cringle fe1bfbdde2 Fix the AutoSync Relay showing Global Offset instead of the song Offset when Auto Syncing
- Unrelated to group.ini
2025-03-03 23:25:32 -08:00
Crash Cringle 01eea5cd42 Remove additional leftover debug message 2025-03-03 23:25:32 -08:00
Crash Cringle 1bf9dd004d Use the Translit field from Group.ini, Migrate Banner code to Group class 2025-03-03 23:25:32 -08:00
Crash Cringle 520173ef5d Safe delete Groups 2025-03-03 23:25:32 -08:00
Crash Cringle c06059b274 Further Group enhancements.
- Adjust the variable scope of group attributes
- Remove the now redundant GroupBannerPaths vector and replace its usage.
- Migrate ini loading logic to Group class
- Better clarity on comments for Group
- Remove GetTotalSongs in favor of GetSongs.
- Add Year as a value to Group.ini
- Ensure new group and song maps are cleared properly when freeing songs
2025-03-03 23:25:32 -08:00
Crash Cringle 096d3093e4 Add Group files to cmake 2025-03-03 23:25:32 -08:00
Crash Cringle 5abaf5318a Move group into its own class, add Credit and AuthorsNotes fields, Begin exposing methods to lua 2025-03-03 23:25:32 -08:00
Crash Cringle 1aa44cacb6 Rename Pack -> Group for consistency. Remove leftover logging and extra lines from debugging.
Misc patches via PR review.
2025-03-03 23:25:32 -08:00
Crash Cringle e55475a295 Add enums for ITG/NULL in pack.ini for SyncOffset 2025-03-03 23:25:32 -08:00
Crash Cringle 798201cce4 Add Pack Offset and Group Banners to pack.ini, Remove debug logging 2025-03-03 23:25:32 -08:00
Crash Cringle 5e6f3378a8 Thrown together Initial working implementation of pack.ini
# Conflicts:
#	src/MusicWheel.cpp
2025-03-03 23:25:32 -08:00
Michael Votaw 239d38d5aa pre-initialize size of vectors for writing nps/notes per measure to cache file. 2025-03-03 21:24:17 -08:00
Michael Votaw c0db6beb9c We don't need to set cached nps per player individually, just parse all of it and pass it to Steps 2025-03-03 21:24:17 -08:00
Michael Votaw 2625394ac0 Only store NotesPerMeasure and NpsPerMeasure values per-player if the steps type has different steps per player. 2025-03-03 21:24:17 -08:00
Michael Votaw fd790eb83e Replace #MEASUREINFO with two separate tags, #NPSPERMEASURE and #NOTESPERMEASURE. Stop storing MeasureInfo objects on Steps, and just directly store NpsPerMeasure, NotesPerMeasure, and peakNPS. 2025-03-03 21:24:17 -08:00
sukibaby 2414595063 do_mad_frame_decode might return 0, protect against possible crash
In the song wheel, if you scroll back and forth over an MP3 song very fast, you might get some audible corruption at the beginning of the song preview, and it might even crash the game.

This fixes both of those problems.
2025-03-02 22:21:30 -08:00
sukibaby 6f497f70e7 Use SetPosition_hard instead of SetPosition_toc for the mp3 position, remove dependency on accurate sync boolean
Resolves #610.

`RageSoundReader_MP3` has three different methods of setting the position. The default choice of `SetPosition_toc` is unable to provide an accurate result. The reason Edit Mode has such a severe desync when working with MP3's is due to the preference of using `SetPosition_toc`.

We can prevent this by using `SetPosition_hard` which works very well.  Judging by comments in the file, it seems like `SetPosition_hard` was too resource intensive to use as the default method, 20+ years ago.

The only downside is, if you start from an arbitrary position (which is **only** possible in Edit Mode), you have a few milliseconds of corrupted audio, but then the sync is perfect.  You can hear this in the demonstration video below.

When we start from the beginning of a file, such as playing a song, or using `Play whole song` in edit mode, `MADLIB_rewind` will be used.

`SetPosition_hard` provides an accurate result, and is consistent with the offset provided by `MADLIB_rewind`. The result is a consistent sync experience whether the MP3 is started from the beginning, or from an arbitrary position midway thru the file.

The `m_bAccurateSync` boolean dependency has been removed from SetPosition since it does not seem to provide any benefit on modern hardware. It seems fine to remove it so that we can call `MADLIB_rewind` or `SetPosition_hard` as fast as possible.

In my testing I never got `SetPosition_estimate` to be used, but I've left it in as a backup option.
2025-03-02 22:21:30 -08:00
sukibaby 5326808f38 Revert "(Win32 refresh) LoadingWindow_Win32"
This reverts commit afc3083b3e.

Revert "be 32 bit"

This reverts commit 4d8d22d223.
2025-03-02 15:05:31 -08:00
teejusb ef649135bd Add itgmania.com to the list of allowed hosts. 2025-03-02 12:16:12 -08:00
teejusb 33039d61b4 Version bump to 1.0.0 2025-03-02 12:05:52 -08:00
Thomas Calvert 1409bbcadf fixup: fix memory leak 2025-03-02 11:41:43 -08:00
Thomas Calvert 788db3d826 fixup: link directly to issue 2025-03-02 11:41:43 -08:00
Thomas Calvert fe3e73ae0d Linux: Detect joystick hotplug
Interface with libudev to get notified when a new joystick appears.

The code is in IH_Linux_Event rather than IH_Linux_Joystick because it
seemed like the former uses evdev (standard for most devices nowadays)
whereas the latter uses the old joydev API. The result should be the
same in any case...

Implementation is a bit messy due to LinuxInputManager only scanning for
devices from its constructor, this forces RageInput to have an exception
for LinuxInputManager. Possibly with more involved surgery a cleaner
solution could be devised...
2025-03-02 11:41:43 -08:00
teejusb 368c257e95 Rename to rate_scaling_enable_ + Expose functions to lua 2025-03-02 10:34:28 -08:00
Brandon W 9789ef9697 Give actors the ability to undo the rate change triggered by holding
tilde or tab.

This is gated by a new boolean, `tab_tilde_scaling_enabled_`, and
applied only to banners by default.
2025-03-02 10:34:28 -08:00
sukibaby 2feb9e784c RageSoundReader_Merge fixes
This is the fixed Merge from the 2025-1-26 test build. It will more strictly check the drift with each iteration of the m_aSounds loop, whereas the original implementation can allow small amounts of desync to accumulate over time if none of them exceed the threshold.
2025-03-02 09:13:31 -08:00
sukibaby 4f4167e3c7 Fix DirectSound and set it to default on Windows.
I've fixed the issues with the DirectSound driver which a number of commits from 2016 attempted to address. Additionally, build testers strongly prefer the fixed DirectSound to WaveOut (the current default driver for Windows) in terms of both game stability and sync stability, so I'm making it the default driver as well.

StepMania commit 75a9532 from 2006 had a subtle error, the declaration of len and locked_buf will hide the previous local declaration of these variables. The issues causing the DirectSound driver to be unreliable in terms of sync were due to this. This PR renames the variables from the 2006 commit to prevent this, and also ensures all variables are properly initialized.

Renamed `locked_buf` and `len` in `MixerThread` to `locked_buf_init` and `len_init` to avoid shadowing.

Prevent use of uninitialized member variables by initializing `m_pPCM`, `m_iSampleRate`, and `m_bShutdownMixerThread` in the constructor.
2025-03-02 09:11:25 -08:00
sukibaby 5673d84567 undo whitespace changes in Threads_Win32 2025-03-02 09:04:34 -08:00
sukibaby 1b258a4a00 use ExitThread instead of TerminateThread
Preferred in Windows, especially when we can't guarantee that we are able to perform a proper clean-up before terminating. Halt may be called with the Kill flag which indicates everything must shut down. This is the preferred approach in the Windows API.

Another preferred option is to use WaitForSingleObject with a timeout, but Halt with the Kill flag is being called when the game is about to crash, so that's not a realistic option and may cause the program to hang indefinitely.
2025-03-02 09:04:34 -08:00
sukibaby 1da7f6167f (Win32 refresh) Threads_Win32
This file handles OS side interaction as well as the creation of threads within the game -  std::unique_ptr and std::mutex are introduced here for their safety and memory management benefits.

A custom wrapper PortableSignalObjectAndWait was removed in favor of directly calling SignalObjectAndWait.

In SetThreadName, we change from EXCEPTION_CONTINUE_EXECUTION to EXCEPTION_EXECUTE_HANDLER as suggested by the compiler to avoid a potential infinite loop.

ThreadImpl_Win32::Halt has been refactored to unequivocably call SuspendThread instead of TerminateThread, as TerminateThread doesn't allow for proper thread cleanup.

Don't bother with the try-catch in SetThreadName unless this is a debug build (since exceptions are disabled in ITGm, so it won't work as expected).
2025-03-02 09:04:34 -08:00
sukibaby 3f348117e2 (Win32 refresh) GetFileInformation, DebugInfoHunt
DebugInfoHunt was also updated since GetFileInformation directly uses it.

- GetMemoryDebugInfo is updated as GlobalMemoryStatus is deprecated.
- GetWindowsVersionDebugInfo is updated to use RtlGetVersion.
- GetFileInformation updated to use vector and string, as well as const correctness and modern  Windows methods. Mostly removing Win9x-XP compatibility code.
- Also gets rid of some workarounds aimed at XP era versions of Visual Studio.

Fix a mistake in Windows version detection logic
2025-03-02 08:51:21 -08:00
Rafał Florczak 8f8064c8fa Add ARM builds to the pipeline 2025-03-02 08:41:35 -08:00
sukibaby a7477a6c56 Better type choices, comment improvements, adding missing braces, removal of dead code. 2025-03-02 08:40:36 -08:00
sukibaby 94eb8d2a7f Vector based RageSoundMixBuffer
Bringing in algorithm for std::copy, and vector for automatic memory management.

Initializing the buffer with zeroes in the same operation as resizing the buffer. Going back to using an unsigned int for realsize, to prevent the buffer from becoming an unreasonably large size.

The constructor and destructor can be empty since the vector<float>'s own destructor will take care of freeing allocated memory.

The static_cast to an int in read(int16_t *pBuf) is changed to a static_cast to an int16_t, as audio data is expressed in 16 bit integers, and the fractional part is inherently rounded towards zero by truncation.
2025-03-02 08:40:36 -08:00
teejusb 97c2f36491 Remove g_bInputLinuxOrderByLocation preference 2025-03-01 23:25:47 -08:00
din f0394b721e sort by location 2025-03-01 23:25:47 -08:00
sukibaby 4d8d22d223 be 32 bit 2025-02-26 11:07:54 -08:00
sukibaby afc3083b3e (Win32 refresh) LoadingWindow_Win32
Speed up the loading window. SetPixelV is slow.  No perceptible difference in loading window behavior, but is faster.  The goal here is to alleviate the case where the loading window is the bottleneck when loading songs on a fast computer.
2025-02-26 11:07:54 -08:00
Crash Cringle b6a08130ab When using auto set style we need to ensure that we're showing all the songs that we're telling the user that they're able to see.
- If AutoSetStyle is true then we're showing all compatible styles at once (compatible styles determined by number of players joined)
- Sooooo if 1 player is joined then we'd see Singles, Doubles, & 3-panel charts. (Maybe solo as well?)
- If 2 players are joined we'll see Singles (versus), Routine, and couples charts.

This needs to be reflected in the music wheel so that we're seeing songs with compatible styles. Previously it was checking if the song had steps in the current style which doesnt really apply for AutoSetStyle being toggled.

(cherry picked from commit 1fc4a805b497aa93a965547c688844a30018527a)
2025-02-12 20:04:53 -08:00
Rafał Florczak 0d32709f76 Revert "Migrate to universal build for macOS"
This reverts commit b938ac449f.
2025-02-11 23:37:59 -08:00
sukibaby 4601da4ab9 Update RageUtil::power_of_two
Replacing the SM5 power-of-two code with the implementation from Bit Twiddling Hacks, since the current implementation isn't correctly handling the edge case where the input is 0, and is a little overcomplicated.
2025-02-11 22:55:29 -08:00
D.J. Rideout f2809028de Refactor SwitchToDifficulty/SwitchToPreferredDifficulty 2025-02-11 21:48:54 -08:00
D.J. Rideout ae2f4060f5 If sort order is SORT_METER, select the highest difficulty matching the meter of the current section when scrolling to a song. 2025-02-11 21:48:54 -08:00
Michael Votaw 9fd4c38efd Keep a temporary State object around instead of allocating and deleting one nearly every time initResultState is called 2025-02-11 19:39:03 -08:00
Michael Votaw 46c3442018 non-void functions should return values! 2025-02-11 19:39:03 -08:00
Michael Votaw b52ea2257b wrap global function in anonymous namespace 2025-02-11 19:39:03 -08:00
Michael Votaw 97cefc6d71 Reduce the precision of nps to 3 decimal places, and don't use ssprint to join all of it together (very very long charts would cause a stack overflow on Windows) 2025-02-11 19:39:03 -08:00
Michael Votaw 6a7dd95212 Removed ASSERTs. StepParityGenerator::analyzeNoteData() now returns a boolean to indicate whether it succeeded at analyzing the note data.
Fixed issue where getFootPlacementPermutations would return no permutations in some circumstances
2025-02-11 19:39:03 -08:00