summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.vcxproj1
-rw-r--r--src/core/core.vcxproj.filters1
-rw-r--r--src/core/src/core.cpp18
-rw-r--r--src/core/src/core.h28
-rw-r--r--src/core/src/system.h61
5 files changed, 87 insertions, 22 deletions
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index c771f2e2d..90d0628f2 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -163,6 +163,7 @@
163 <ClInclude Include="src\file_sys\meta_file_system.h" /> 163 <ClInclude Include="src\file_sys\meta_file_system.h" />
164 <ClInclude Include="src\loader.h" /> 164 <ClInclude Include="src\loader.h" />
165 <ClInclude Include="src\mem_map.h" /> 165 <ClInclude Include="src\mem_map.h" />
166 <ClInclude Include="src\system.h" />
166 </ItemGroup> 167 </ItemGroup>
167 <ItemGroup> 168 <ItemGroup>
168 <None Include="CMakeLists.txt" /> 169 <None Include="CMakeLists.txt" />
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index f75e6305c..039373047 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -87,6 +87,7 @@
87 <ClInclude Include="src\file_sys\meta_file_system.h"> 87 <ClInclude Include="src\file_sys\meta_file_system.h">
88 <Filter>file_sys</Filter> 88 <Filter>file_sys</Filter>
89 </ClInclude> 89 </ClInclude>
90 <ClInclude Include="src\system.h" />
90 </ItemGroup> 91 </ItemGroup>
91 <ItemGroup> 92 <ItemGroup>
92 <None Include="CMakeLists.txt" /> 93 <None Include="CMakeLists.txt" />
diff --git a/src/core/src/core.cpp b/src/core/src/core.cpp
index 7f6bb2b0e..a748ebbd7 100644
--- a/src/core/src/core.cpp
+++ b/src/core/src/core.cpp
@@ -29,14 +29,26 @@ namespace Core {
29 29
30/// Start the core 30/// Start the core
31void Start() { 31void Start() {
32 // TODO(ShizZy): ImplementMe
32} 33}
33 34
34/// Kill the core 35/// Run the core CPU loop
35void Kill() { 36void RunLoop() {
37 // TODO(ShizZy): ImplementMe
38}
39
40/// Step the CPU one instruction
41void SingleStep() {
36} 42}
37 43
38/// Stop the core 44/// Halt the core
45void Halt() {
46 // TODO(ShizZy): ImplementMe
47}
48
49/// Kill the core
39void Stop() { 50void Stop() {
51 // TODO(ShizZy): ImplementMe
40} 52}
41 53
42/// Initialize the core 54/// Initialize the core
diff --git a/src/core/src/core.h b/src/core/src/core.h
index 2270e46e2..f018ff6ed 100644
--- a/src/core/src/core.h
+++ b/src/core/src/core.h
@@ -35,34 +35,24 @@ class EmuWindow;
35 35
36namespace Core { 36namespace Core {
37 37
38// State of the full emulator
39typedef enum {
40 SYS_NULL = 0, ///< System is in null state, nothing initialized
41 SYS_IDLE, ///< System is in an initialized state, but not running
42 SYS_RUNNING, ///< System is running
43 SYS_LOADING, ///< System is loading a ROM
44 SYS_HALTED, ///< System is halted (error)
45 SYS_STALLED, ///< System is stalled (unused)
46 SYS_DEBUG, ///< System is in a special debug mode (unused)
47 SYS_DIE ///< System is shutting down
48} SystemState;
49
50
51/// Start the core 38/// Start the core
52void Start(); 39void Start();
53 40
54/// Kill the core 41/// Run the core CPU loop
55void Kill(); 42void RunLoop();
43
44/// Step the CPU one instruction
45void SingleStep();
56 46
57/// Stop the core 47/// Halt the core
48void Halt();
49
50/// Kill the core
58void Stop(); 51void Stop();
59 52
60/// Initialize the core 53/// Initialize the core
61int Init(EmuWindow* emu_window); 54int Init(EmuWindow* emu_window);
62 55
63extern SystemState g_state; ///< State of the emulator
64extern bool g_started; ///< Whether or not the emulator has been started
65
66} // namespace 56} // namespace
67 57
68//////////////////////////////////////////////////////////////////////////////////////////////////// 58////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/src/system.h b/src/core/src/system.h
new file mode 100644
index 000000000..d35515c66
--- /dev/null
+++ b/src/core/src/system.h
@@ -0,0 +1,61 @@
1/**
2 * Copyright (C) 2013 Citrus Emulator
3 *
4 * @file system.h
5 * @author ShizZy <shizzy247@gmail.com>
6 * @date 2013-09-26
7 * @brief Emulation of main system
8 *
9 * @section LICENSE
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details at
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * Official project repository can be found at:
22 * http://code.google.com/p/gekko-gc-emu/
23 */
24
25#ifndef CORE_SYSTEM_H_
26#define CORE_SYSTEM_H_
27
28#include "file_sys/meta_file_system.h"
29
30////////////////////////////////////////////////////////////////////////////////////////////////////
31
32namespace System {
33
34extern MetaFileSystem g_ctr_file_system;
35
36// State of the full emulator
37typedef enum {
38 STATE_NULL = 0, ///< System is in null state, nothing initialized
39 STATE_IDLE, ///< System is in an initialized state, but not running
40 STATE_RUNNING, ///< System is running
41 STATE_LOADING, ///< System is loading a ROM
42 STATE_HALTED, ///< System is halted (error)
43 STATE_STALLED, ///< System is stalled (unused)
44 STATE_DEBUG, ///< System is in a special debug mode (unused)
45 STATE_DIE ///< System is shutting down
46} State;
47
48extern volatile State g_state;
49
50void UpdateState(State state);
51void Init();
52void RunLoopFor(int cycles);
53void RunLoopUntil(u64 global_cycles);
54void Shutdown();
55
56};
57
58////////////////////////////////////////////////////////////////////////////////////////////////////
59
60#endif // CORE_SYSTEM_H_
61 \ No newline at end of file