Commit Graph

31 Commits

Author SHA1 Message Date
Pokechu22 e391a28102 DSPTool: Generate an alignment specifier
alignas is a C++ keyword since C++11, and can be used in C with a header too (although I don't know the details).
2023-01-23 15:30:49 -08:00
Pokechu22 f9fe25291d Remove most uses of StringFromFormat in favor of fmt 2022-10-12 16:50:47 -07:00
Pokechu22 dc353ed84d DSPTool: Exit with status 1 if binary comparison fails 2022-06-14 12:22:06 -07:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Lioncash 7d1bd565a6 DSP: Eliminate most global state
An unfortunately large single commit that deglobalizes the DSP code.
(which I'm very sorry about).

This would have otherwise been extremely difficult to separate due to
extensive use of the globals in very coupling ways that would result in
more scaffolding to work around than is worth it.

Aside from the video code, I believe only the DSP code is the hairiest
to deal with in terms of globals, so I guess it's best to get this dealt
with right off the bat.

A summary of what this commit does:
  - Turns the DSPInterpreter into its own class
    This is the most involved portion of this change.
    The bulk of the changes are turning non-member functions into member
    functions that would be situated into the Interpreter class.

  - Eliminates all usages to globals within DSPCore.
    This generally involves turning a lot of non-member functions into
    member functions that are either situated within SDSP or DSPCore.

  - Discards DSPDebugInterface (it wasn't hooked up to anything,
    and for the sake of eliminating global state, I'd rather get rid of
    it than think up ways for this class to be integrated with
    everything else.

  - Readjusts the DSP JIT to handle calling out to member functions.
    In most cases, this just means wrapping respective member function
    calles into thunk functions.

Surprisingly, this doesn't even make use of the introduced System class.
It was possible all along to do this without it. We can house everything
within the DSPLLE class, which is quite nice =)
2020-12-27 06:38:02 -05:00
Pokechu22 1ca3710bd2 DSPLLE: Use Memory functions isntead of directly using Memory::physical_base
Fixes bug 11980
2020-07-24 15:06:39 -07:00
Pokechu22 59dc7cfe7d Use size_t in some DSP code code 2020-07-24 15:06:39 -07:00
Lioncash c212310fbe VideoCommon/OnScreenDisplay: Take Message's std::string parameter by value
Allows callers to std::move strings into the functions (or automatically
assume the move constructor/move assignment operator for rvalue
references, potentially avoiding copies altogether.
2019-07-28 23:00:58 -04:00
Silent 5f0b4d8da5
Fix a crash in DSPTool on malformed command line 2019-06-23 21:55:51 +02:00
Lioncash eb475025b8 Common/FileUtil: Make WriteStringToFile consistent with ReadFileToString
Makes the parameter ordering consistent and less error-prone.
2019-05-29 07:06:53 -04:00
Léo Lam eb9009e5c0 DSPTool: Use std::string == instead of strcmp
Less C-like and conveniently fixes a build issue caused by strcmp
not being declared for some reason.

Converting to std::string is safe because the argument count is
checked every time so the char* cannot be a nullptr.
2018-07-05 09:40:43 +02:00
Lioncash 43daebbc66 DSPTool: Get rid of unnecessary casts 2018-06-22 17:53:24 -04:00
Lioncash 83dab8dd36 DSPTool: Get rid of raw new and delete
We can just use a vector of a vector, which also has the benefit of
keeping the size accounted for as well, allowing us to get rid of a
count parameter for CodesToHeader().
2018-06-22 17:53:20 -04:00
Lioncash d81e3fddce DSPTool: Make CodeToHeader() and CodesToHeader() return a std::string directly
Instead of using an out-reference, we can modernize these to return the
std::string directly. While we're at it, also remove the unused name
parameter.
2018-06-22 16:50:13 -04:00
Lioncash 537d09e1d4 DSPTool: Remove unnecessary c_str() calls
These functions already accept std::string instances, so c_str here just
causes an unnecessary copy of the string to be made.
2018-06-22 16:38:15 -04:00
Lioncash f62dffa9f0 DSPTool: Factor out assembly file retrieval
Keeps the retrieval behavior isolated and lessens the amount of
variables within PerformAssembly's scope.
2018-06-22 16:36:35 -04:00
Lioncash 78eba28975 DSPTool: Factor out behavior from main()
Keeps all behavior localized in their own functions, making it a tiny
bit nicer to read.
2018-06-17 18:21:33 -04:00
Lioncash 0f25627614 DSPCodeUtil: Don't return data via an out parameter
We can just return directly in these cases.
2018-03-25 18:55:08 -04:00
Michael Maltese 97e6ba773b Move DSP::CodesToHeader to DSPTool
It's the only place it's used, and highly-specific to DSPTool's needs.
2017-06-05 19:28:40 -07:00
Michael Maltese 80710984dc DSPTool: extract tests into a DSPAssemblyTest
- Moves all test code from DSPTool into UnitTests/Core/DSPAssemblyTest.
- Converts test files (which could only be loaded if they were in the
  shell's working directory, so basically never) into C++ values.
- Enables most of the commented-out tests.
- Removes non-deterministic random code test.
2017-06-05 19:28:40 -07:00
Michael Maltese 1580b6e627 DSPTool: make existing tests pass
Disassemble code without the additional text for humans, like the
current PC and opcode hex values, so that it can be reassembled.

I'm not updating any commented-out tests here.
2017-06-05 19:28:40 -07:00
Lioncash 3eb25cea6f DSP: Namespace remaining un-namespaced DSP code 2016-12-31 17:20:14 -05:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Tillmann Karras f927af20f2 Fix more warnings from #579 2014-08-07 03:24:42 +02:00
Matthew Parlane 31cfc73a09 Fixes spacing for "for", "while", "switch" and "if"
Also moved && and || to ends of lines instead of start.
Fixed misc vertical alignments and some { needed newlining.
2014-03-11 00:35:07 +13:00
Lioncash 76b2dde3d7 Fix DSPTool string output for disassembly.
Would previously print that assembly had succeeded.
2014-03-09 15:01:56 -04:00
Lioncash 440efaa5f5 Fix DSPTool.
Forgot to adjust the stubs.
2014-03-09 13:00:51 -04:00
Lioncash ed9eea72a1 Forgot to move DSPTool over. Fixed now. 2014-02-20 01:01:11 +01:00
Jasper St. Pierre 34692ab826 Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00