the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1
2
3#include "stdafx.h"
4
5#include "C4JThread_SPU.h"
6#include "PS3\SPU_Tasks\ChunkUpdate\ChunkRebuildData.h"
7#include "PS3\SPU_Tasks\CompressedTile\CompressedTileStorage_SPU.h"
8#include "PS3\SPU_Tasks\LevelRenderChunks\LevelRenderChunks.h"
9
10#define SPURS_MAX_SPU 6
11#define SPURS_PPU_THREAD_PRIORITY 2
12#define SPURS_SPU_THREAD_PRIORITY 100
13#define SPURS_PREFIX "Minecraft"
14#define PRIMARY_PPU_THREAD_PRIORITY 1001
15#define PRIMARY_PPU_THREAD_STACK_SIZE 65536
16#define SPU_PRINTF_HANDLER_PRIORITY 999
17
18static const bool sc_verbose = true;
19
20cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = NULL;
21
22void C4JThread_SPU::initSPURS()
23{
24 int ret;
25#ifndef _CONTENT_PACKAGE
26 // initialize spu_printf server
27 ret = spu_printf_initialize(SPU_PRINTF_HANDLER_PRIORITY, 0);
28 if (ret)
29 {
30 std::printf("Error: spu_printf_initialize(): %#x\n", ret);
31 std::printf("## libspurs : FAILED ##\n");
32 std::abort();
33 }
34#endif
35
36 // initialize SPURS attribute
37 cell::Spurs::SpursAttribute attribute;
38 ret = cell::Spurs::SpursAttribute::initialize(&attribute, SPURS_MAX_SPU - 1, SPURS_SPU_THREAD_PRIORITY, SPURS_PPU_THREAD_PRIORITY, false);
39 if (ret)
40 {
41#ifndef _CONTENT_PACKAGE
42 std::printf("Error: cell::Spurs::SpursAttribute::initialize(): %#x\n", ret);
43 std::printf("## libspurs : FAILED ##\n");
44#endif
45 std::abort();
46 }
47
48 ret = attribute.setNamePrefix(SPURS_PREFIX, std::strlen(SPURS_PREFIX));
49 if (ret)
50 {
51#ifndef _CONTENT_PACKAGE
52 std::printf("Error: attribute.setNamePrefix(): %#x\n", ret);
53 std::printf("## libspurs : FAILED ##\n");
54#endif
55 std::abort();
56 }
57
58 ret = attribute.setSpuThreadGroupType(SYS_SPU_THREAD_GROUP_TYPE_EXCLUSIVE_NON_CONTEXT);
59 if (ret)
60 {
61#ifndef _CONTENT_PACKAGE
62 std::printf("Error: attribute.setSpuThreadGroupType(): %#x\n", ret);
63 std::printf("## libspurs : FAILED ##\n");
64#endif
65 std::abort();
66 }
67
68#ifndef _CONTENT_PACKAGE
69 ret = attribute.enableSpuPrintfIfAvailable();
70 if (ret)
71 {
72 std::printf("Error: attribute.enableSpuPrintfIfAvailable(): %#x\n", ret);
73 std::printf("## libspurs : FAILED ##\n");
74 std::abort();
75 }
76#endif
77
78 // allocate memory
79 ms_spurs2Object = new cell::Spurs::Spurs2;
80 if (ms_spurs2Object == 0)
81 {
82#ifndef _CONTENT_PACKAGE
83 std::printf("Error: new cell::Spurs::Spurs2\n");
84 std::printf("## libspurs : FAILED ##\n");
85#endif
86 std::abort();
87 }
88
89 // create SPURS instance
90 ret = cell::Spurs::Spurs2::initialize(ms_spurs2Object, &attribute);
91 if (ret)
92 {
93#ifndef _CONTENT_PACKAGE
94 std::printf("Error: cell::Spurs::Spurs2::initialize(): %#x\n", ret);
95 std::printf("## libspurs : FAILED ##\n");
96#endif
97 std::abort();
98 }
99
100}
101
102
103void C4JThread_SPU::shutdownSPURS()
104{
105 int ret;
106 // destroy SPURS instance
107 ret = ms_spurs2Object->finalize();
108 if (ret)
109 {
110#ifndef _CONTENT_PACKAGE
111 std::printf("Error: spurs->finalize(): %#x\n", ret);
112 std::printf("## libspurs : FAILED ##\n");
113#endif
114 std::abort();
115
116 }
117
118 // free memory
119 delete ms_spurs2Object;
120
121#ifndef _CONTENT_PACKAGE
122 // finalize spu_printf server
123 ret = spu_printf_finalize();
124 if (ret)
125 {
126 std::printf("Error: spu_printf_finalize(): %#x\n", ret);
127 std::printf("## libspurs : FAILED ##\n");
128 std::abort();
129 }
130#endif
131}
132
133
134
135
136