2015-05-25 18:36:28 -03:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
2013-04-17 23:09:55 -04:00
|
|
|
// Refer to the license.txt file included.
|
2009-03-07 08:35:01 +00:00
|
|
|
|
2014-06-03 18:14:53 -03:00
|
|
|
#pragma once
|
2009-03-07 08:35:01 +00:00
|
|
|
|
2010-12-14 17:52:01 +00:00
|
|
|
namespace LogTypes
|
|
|
|
{
|
2014-09-03 17:38:59 -03:00
|
|
|
enum LOG_TYPE
|
|
|
|
{
|
|
|
|
ACTIONREPLAY,
|
|
|
|
AUDIO,
|
|
|
|
AUDIO_INTERFACE,
|
|
|
|
BOOT,
|
|
|
|
COMMANDPROCESSOR,
|
|
|
|
COMMON,
|
|
|
|
CONSOLE,
|
|
|
|
DISCIO,
|
|
|
|
DSPHLE,
|
|
|
|
DSPLLE,
|
|
|
|
DSP_MAIL,
|
|
|
|
DSPINTERFACE,
|
|
|
|
DVDINTERFACE,
|
|
|
|
DYNA_REC,
|
|
|
|
EXPANSIONINTERFACE,
|
2015-09-19 19:56:20 -03:00
|
|
|
FILEMON,
|
2014-09-03 17:38:59 -03:00
|
|
|
GDB_STUB,
|
|
|
|
GPFIFO,
|
2015-09-19 19:56:20 -03:00
|
|
|
HOST_GPU,
|
2014-09-03 17:38:59 -03:00
|
|
|
MASTER_LOG,
|
|
|
|
MEMMAP,
|
|
|
|
MEMCARD_MANAGER,
|
2015-09-19 19:56:20 -03:00
|
|
|
NETPLAY,
|
|
|
|
OSHLE,
|
2014-09-03 17:38:59 -03:00
|
|
|
OSREPORT,
|
|
|
|
PAD,
|
|
|
|
PIXELENGINE,
|
2015-09-19 19:56:20 -03:00
|
|
|
PROCESSORINTERFACE,
|
|
|
|
POWERPC,
|
2014-09-03 17:38:59 -03:00
|
|
|
SERIALINTERFACE,
|
2019-08-05 22:34:31 -07:00
|
|
|
SLIPPI,
|
2021-08-09 23:39:36 -04:00
|
|
|
SLIPPI_ONLINE,
|
feat: add menu + stage music support (#386)
* Add support for Rust in CMake via Corrosion
* Tweak .gitignore to handle Rust target dir
* It's 3AM and I have no desire to deal with this
* Initial scaffolding for loading Rust library in Dolphin
* Expose the Dolphin logging mechanisms to Rust via some callback trickery
* Attempt patching Core.vcxproj to support building Rust dylib
* Attempt patching Core.vcxproj to support building Rust dylib, take 2 OR
* Instruct the build to actually use the steps
* Attempt the older style vcxproj definition format
* Push build targets to end
* Just don't use va_args when calling through from Rust
* Enable Windows project linking, move to generic project structure, start moving out of HW
* Add note to README about Rust requirement
* Update slippi-rust-extensions to have proper EXI Device skeleton
* Attach shadow EXI device to cpp EXI device, add feature flag for playback-specific code, rewrite README for rust extensions slightly
* Remove unused log file
* Ongoing logging work
* Tweak Dolphin LogContainer to auto forward enabled/level status over to Rust, expose more methods on Rust side for control, rebuild logger layer subscriber
* Remove debug flag for release mode but add note about it
* Reorganize module definitions, pass in sampler handler fn for SoundStream
* Fix log target
* Rename to SlippiRustExtensions, separate out into cargo workspace, rename General Rust log
* Tweak logging layer so that we don't double-allocate strings on all log messages, properly surface log locations
* cargo fmt
* initial port of slippi-jukebox code
* minor cleanup and leverage channels rather than atomic bool for stopping
threads
* Add config option for enabling/disabling Jukebox
* Invert shutdown order for Memory and ExpansionInterface so we avoid a null ptr race in the Jukebox, as we need Memory to still be valid at Jukebox shutdown
* update dolphin additional include dirs to facilitate new slippi config pane changes
* Ensure Core is running before trying to find an EXI device, as ExpansionInterface isn't initialized unless Core is running - fixes a crash on bad access
* Expose streaming sampler to jukebox, disable DVDInterface streaming sampler pushes to avoid null data being pushed in
* Expose setters for streaming sample rate and streaming volume to Rust
* jukebox: renaming variables for clarity
* try to use new jukebox sample functions
* jukebox: add support for all star rest area
* jukebox: add support for adventure mode field stages
* jukebox: continuously send chunks of pcm data to dolphin's audio mixer
* Audio somewhat coming through now, albeit with pops and pitch issues...
* Force-log samples to wav
* jukebox: switch from dolphin mixer back to rodio for music playback
* Mark doc example as notest
* Attempt an initial CI pass
* Tinkering with CI
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* [CI] More permissive for compiling code
* jukebox: replace rand with fastrand
* jukebox: dont use static memory for menu & tournament tracks
* Attempt to resolve Windows playback lib loading oddity
* Add a method for grabbing the current volume level
* Have Dolphin pass over the iso path and a getter for the volume level
* Cargo fmt pass
* Include rustfmt.toml
* Remove the Jukebox config option from playback builds entirely, do not start the jukebox if we're in WASAPI Exclusive mode
* Ix-nay the bad check I copied by accident, lol
* SlippiRustExtensions: add build instructions for windows
* jukebox: make proper use of dolphin's volume + remove unused dependencies
* SlippiRustExtensions(readme): simplify suggested out-of-band build command
* jukebox: remove 'anyhow' dependency
* jukebox: simplify read_dolphin_state fn
* jukebox: reduce hps fingerprint size for track matching
* jukebox: remove 'bus' dependency and improve comments
* jukebox: add readme
* jukebox: add description field to Cargo.toml
* README cleanup, extra writeup for logcontainer creation
* Cleanup unused imports
* Rename DolphinState to DolphinGameState
* Pin to Rust 1.70.0
* Re-enable SFX, stop force-dumping WAV DTK audiograph logs
* Revert attempted change of disabling DTK reads
* Revise documentation surrounding logging infrastructure changes
* Ensure the Volume getter is outside of a C++ namespace, just to try and be careful with ABI oddities
* Add an extra LogContainer.
- A generic Rust dependencies log container that we can use if we need
to ever inspect dependency tracing logs.
- Moves the AudioCommon::GetVolume call out of the namespace for now
since I want someone (or me, when I get more time) to verify that
being inside a C++ namespace is safe.
- Remove once_cell as a dependency now that this is pinned to `1.70.0`.
* Fix the typo, because C++
* Additional README contexts
* ifndef PLAYBACK for GUI toggles
* Always publish an artifact for macOS even if we're not signing and notarizing
* Try changing into the directory - why is there so little documentation about what is supported in these files...?
* Pin toolchain in CI to 1.70.0, update Visual Studio to change into working directory for pre-build Rust step so that toolchain file is actually detected
* Opt for a root symlink to the toolchain config per Nikki's idea, comment out forced 1.70.0 in CI build flow
* Revert symlink toolchain to see if there's a CI bug for Linux
* jukebox: reduce music volume by 20%
* jukebox: link to hps_decode crate in the docs
* ci: sed out rust version from rust-toolchain.toml
* ci: add id field for rust_ver
* jukebox: stop blocking the main thread when scanning iso for tracks
* jukebox: respect melee's volume setting when restarting jukebox during emulation
* jukebox: improve code readability
* jukebox: leverage disc filesystem table to locate .hps files
* jukebox: minor fst parsing code improvements
* remove '.unwrap()' from Jukebox destructor
---------
Co-authored-by: Ryan McGrath <ryan@rymc.io>
Co-authored-by: Nikhil Narayana <nikhil.narayana@live.com>
2023-07-27 23:22:41 -04:00
|
|
|
SLIPPI_RUST_DEPENDENCIES,
|
|
|
|
SLIPPI_RUST_EXI,
|
|
|
|
SLIPPI_RUST_JUKEBOX,
|
2014-09-03 17:38:59 -03:00
|
|
|
SP1,
|
|
|
|
VIDEO,
|
|
|
|
VIDEOINTERFACE,
|
|
|
|
WII_IPC,
|
|
|
|
WII_IPC_DVD,
|
|
|
|
WII_IPC_ES,
|
|
|
|
WII_IPC_FILEIO,
|
|
|
|
WII_IPC_HID,
|
|
|
|
WII_IPC_HLE,
|
|
|
|
WII_IPC_NET,
|
|
|
|
WII_IPC_SD,
|
2015-09-19 19:56:20 -03:00
|
|
|
WII_IPC_SSL,
|
2014-09-03 17:38:59 -03:00
|
|
|
WII_IPC_STM,
|
2015-09-19 19:56:20 -03:00
|
|
|
WII_IPC_WC24,
|
2014-09-03 17:38:59 -03:00
|
|
|
WII_IPC_WIIMOTE,
|
|
|
|
WIIMOTE,
|
|
|
|
|
2016-12-27 19:01:46 -03:00
|
|
|
NUMBER_OF_LOGS // Must be last
|
2014-09-03 17:38:59 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum LOG_LEVELS
|
|
|
|
{
|
2016-12-27 19:01:46 -03:00
|
|
|
LNOTICE = 1, // VERY important information that is NOT errors. Like startup and OSReports.
|
|
|
|
LERROR = 2, // Critical errors
|
|
|
|
LWARNING = 3, // Something is suspicious.
|
|
|
|
LINFO = 4, // General information.
|
|
|
|
LDEBUG = 5, // Detailed debugging - might make things slow.
|
2014-09-03 17:38:59 -03:00
|
|
|
};
|
2014-08-02 12:00:55 -03:00
|
|
|
|
2014-09-03 17:38:59 -03:00
|
|
|
static const char LOG_LEVEL_TO_CHAR[7] = "-NEWID";
|
2010-12-14 17:52:01 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
feat: add menu + stage music support (#386)
* Add support for Rust in CMake via Corrosion
* Tweak .gitignore to handle Rust target dir
* It's 3AM and I have no desire to deal with this
* Initial scaffolding for loading Rust library in Dolphin
* Expose the Dolphin logging mechanisms to Rust via some callback trickery
* Attempt patching Core.vcxproj to support building Rust dylib
* Attempt patching Core.vcxproj to support building Rust dylib, take 2 OR
* Instruct the build to actually use the steps
* Attempt the older style vcxproj definition format
* Push build targets to end
* Just don't use va_args when calling through from Rust
* Enable Windows project linking, move to generic project structure, start moving out of HW
* Add note to README about Rust requirement
* Update slippi-rust-extensions to have proper EXI Device skeleton
* Attach shadow EXI device to cpp EXI device, add feature flag for playback-specific code, rewrite README for rust extensions slightly
* Remove unused log file
* Ongoing logging work
* Tweak Dolphin LogContainer to auto forward enabled/level status over to Rust, expose more methods on Rust side for control, rebuild logger layer subscriber
* Remove debug flag for release mode but add note about it
* Reorganize module definitions, pass in sampler handler fn for SoundStream
* Fix log target
* Rename to SlippiRustExtensions, separate out into cargo workspace, rename General Rust log
* Tweak logging layer so that we don't double-allocate strings on all log messages, properly surface log locations
* cargo fmt
* initial port of slippi-jukebox code
* minor cleanup and leverage channels rather than atomic bool for stopping
threads
* Add config option for enabling/disabling Jukebox
* Invert shutdown order for Memory and ExpansionInterface so we avoid a null ptr race in the Jukebox, as we need Memory to still be valid at Jukebox shutdown
* update dolphin additional include dirs to facilitate new slippi config pane changes
* Ensure Core is running before trying to find an EXI device, as ExpansionInterface isn't initialized unless Core is running - fixes a crash on bad access
* Expose streaming sampler to jukebox, disable DVDInterface streaming sampler pushes to avoid null data being pushed in
* Expose setters for streaming sample rate and streaming volume to Rust
* jukebox: renaming variables for clarity
* try to use new jukebox sample functions
* jukebox: add support for all star rest area
* jukebox: add support for adventure mode field stages
* jukebox: continuously send chunks of pcm data to dolphin's audio mixer
* Audio somewhat coming through now, albeit with pops and pitch issues...
* Force-log samples to wav
* jukebox: switch from dolphin mixer back to rodio for music playback
* Mark doc example as notest
* Attempt an initial CI pass
* Tinkering with CI
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* Specify CI working directory for cargo fmt
* [CI] More permissive for compiling code
* jukebox: replace rand with fastrand
* jukebox: dont use static memory for menu & tournament tracks
* Attempt to resolve Windows playback lib loading oddity
* Add a method for grabbing the current volume level
* Have Dolphin pass over the iso path and a getter for the volume level
* Cargo fmt pass
* Include rustfmt.toml
* Remove the Jukebox config option from playback builds entirely, do not start the jukebox if we're in WASAPI Exclusive mode
* Ix-nay the bad check I copied by accident, lol
* SlippiRustExtensions: add build instructions for windows
* jukebox: make proper use of dolphin's volume + remove unused dependencies
* SlippiRustExtensions(readme): simplify suggested out-of-band build command
* jukebox: remove 'anyhow' dependency
* jukebox: simplify read_dolphin_state fn
* jukebox: reduce hps fingerprint size for track matching
* jukebox: remove 'bus' dependency and improve comments
* jukebox: add readme
* jukebox: add description field to Cargo.toml
* README cleanup, extra writeup for logcontainer creation
* Cleanup unused imports
* Rename DolphinState to DolphinGameState
* Pin to Rust 1.70.0
* Re-enable SFX, stop force-dumping WAV DTK audiograph logs
* Revert attempted change of disabling DTK reads
* Revise documentation surrounding logging infrastructure changes
* Ensure the Volume getter is outside of a C++ namespace, just to try and be careful with ABI oddities
* Add an extra LogContainer.
- A generic Rust dependencies log container that we can use if we need
to ever inspect dependency tracing logs.
- Moves the AudioCommon::GetVolume call out of the namespace for now
since I want someone (or me, when I get more time) to verify that
being inside a C++ namespace is safe.
- Remove once_cell as a dependency now that this is pinned to `1.70.0`.
* Fix the typo, because C++
* Additional README contexts
* ifndef PLAYBACK for GUI toggles
* Always publish an artifact for macOS even if we're not signing and notarizing
* Try changing into the directory - why is there so little documentation about what is supported in these files...?
* Pin toolchain in CI to 1.70.0, update Visual Studio to change into working directory for pre-build Rust step so that toolchain file is actually detected
* Opt for a root symlink to the toolchain config per Nikki's idea, comment out forced 1.70.0 in CI build flow
* Revert symlink toolchain to see if there's a CI bug for Linux
* jukebox: reduce music volume by 20%
* jukebox: link to hps_decode crate in the docs
* ci: sed out rust version from rust-toolchain.toml
* ci: add id field for rust_ver
* jukebox: stop blocking the main thread when scanning iso for tracks
* jukebox: respect melee's volume setting when restarting jukebox during emulation
* jukebox: improve code readability
* jukebox: leverage disc filesystem table to locate .hps files
* jukebox: minor fst parsing code improvements
* remove '.unwrap()' from Jukebox destructor
---------
Co-authored-by: Ryan McGrath <ryan@rymc.io>
Co-authored-by: Nikhil Narayana <nikhil.narayana@live.com>
2023-07-27 23:22:41 -04:00
|
|
|
// A "simple" logger that doesn't actually do any formatting at all, simply
|
|
|
|
// taking in a `level`, `file` name, `line` number, and the `msg` to log.
|
|
|
|
//
|
|
|
|
// The reason for this is that we now have some modules written in other languages
|
|
|
|
// that need to hop the boundary for logging, and we explicitly *do not* want to
|
|
|
|
// attempt to deal with who owns what and/or how to format with variable-length args
|
|
|
|
// from another language. Offering this just makes logging easier on some
|
|
|
|
// platforms (e.g, Windows). We also avoid needing to expose the LOG_LEVELS enum into
|
|
|
|
// other languages by just accepting an integer, which is shuffled into the correct type
|
|
|
|
// in the implementation.
|
|
|
|
//
|
|
|
|
// If you are calling this from another language and you need to log any form of structured
|
|
|
|
// data, you should do the formatting *on your side* and pass it over here. You are also
|
|
|
|
// responsible for ensuring that the msg string lives for an appropriate lifetime.
|
|
|
|
void SlippiRustLogger(int level, int slp_log_type, const char* file, int line, const char *msg);
|
|
|
|
|
2016-12-27 19:01:46 -03:00
|
|
|
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line,
|
|
|
|
const char* fmt, ...)
|
2010-12-05 09:04:34 +00:00
|
|
|
#ifdef __GNUC__
|
2016-07-08 16:14:35 -03:00
|
|
|
__attribute__((format(printf, 5, 6)))
|
2010-12-05 09:04:34 +00:00
|
|
|
#endif
|
2016-07-08 16:14:35 -03:00
|
|
|
;
|
2009-03-07 08:35:01 +00:00
|
|
|
|
2009-03-18 17:17:58 +00:00
|
|
|
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
|
2014-10-04 12:11:42 -03:00
|
|
|
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LDEBUG
|
2009-03-07 08:35:01 +00:00
|
|
|
#else
|
2009-09-01 08:44:32 +00:00
|
|
|
#ifndef MAX_LOGLEVEL
|
2016-12-27 19:01:46 -03:00
|
|
|
#define MAX_LOGLEVEL LogTypes::LOG_LEVELS::LINFO
|
|
|
|
#endif // loglevel
|
|
|
|
#endif // logging
|
2009-03-07 08:35:01 +00:00
|
|
|
|
|
|
|
// Let the compiler optimize this out
|
2016-12-27 19:01:46 -03:00
|
|
|
#define GENERIC_LOG(t, v, ...) \
|
|
|
|
{ \
|
|
|
|
if (v <= MAX_LOGLEVEL) \
|
2021-02-08 18:59:47 +01:00
|
|
|
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
|
2016-12-27 19:01:46 -03:00
|
|
|
}
|
2009-03-07 08:35:01 +00:00
|
|
|
|
2016-12-27 19:01:46 -03:00
|
|
|
#define ERROR_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) \
|
|
|
|
} while (0)
|
|
|
|
#define WARN_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) \
|
|
|
|
} while (0)
|
|
|
|
#define NOTICE_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) \
|
|
|
|
} while (0)
|
|
|
|
#define INFO_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) \
|
|
|
|
} while (0)
|
|
|
|
#define DEBUG_LOG(t, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) \
|
|
|
|
} while (0)
|