Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pshittyload #169

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
09ceb2b
Added hello.psx. Needs fixing.
asmblur Sep 30, 2019
35094ae
Fixed crt0.S
asmblur Sep 30, 2019
7c1c897
Fixing the ldscript to generate a proper psx binary.
nicolasnoble Sep 30, 2019
91c9f52
Removing extra include path.
nicolasnoble Sep 30, 2019
1b8917f
Initial sdk stuff.
asmblur Sep 30, 2019
d01e864
Modified hello
asmblur Sep 30, 2019
5ae778d
Slightly better dependency graph.
nicolasnoble Sep 30, 2019
554e67d
Merge branch 'hello' of github.com:asmblur/pcsx-redux into ps1sdk-ini…
asmblur Sep 30, 2019
6ef8eee
Fixing build.
nicolasnoble Sep 30, 2019
cd5b5c2
Fixes to sioload and common.mk
asmblur Oct 1, 2019
13c5b5c
Addded src/.clang-format-asm
asmblur Oct 1, 2019
6b47f79
inital support for switching between clang-format files.
asmblur Oct 1, 2019
1d9752f
formatting applied to src
asmblur Oct 1, 2019
41447d5
Rewrite of sioload.
asmblur Oct 1, 2019
1cf7fae
Alternative serial I/O stuff.
asmblur Oct 1, 2019
417c6bc
Fixed typos and such.
asmblur Oct 1, 2019
9f3727e
added pshittyload
asmblur Oct 3, 2019
be183af
fixed some oopsies
asmblur Oct 3, 2019
c13a481
serial stuff
asmblur Oct 5, 2019
89c8e0c
added tinyload, improved some definitions in headers.
asmblur Oct 8, 2019
713ca8e
Fixed a typo in shell.ld
asmblur Oct 8, 2019
18be7ad
Tinyload!
asmblur Oct 11, 2019
771a780
Added tinyload files.
asmblur Oct 11, 2019
65f03d3
Merge branch 'master' of github.com:grumpycoders/pcsx-redux into pshi…
nicolasnoble Oct 11, 2019
80633a7
Shuffling projects around.
nicolasnoble Oct 11, 2019
f455b1e
Adding PC-side loader.
nicolasnoble Oct 11, 2019
2eb8304
Removing tinyload.
nicolasnoble Oct 11, 2019
e38d5b3
Fixes to Exec2 prototype and call
asmblur Oct 11, 2019
8992fd9
Adding quick shell support.
nicolasnoble Oct 11, 2019
54646c5
Fixing kernel vectors.
nicolasnoble Oct 11, 2019
0198260
Adding printf syscall.
nicolasnoble Oct 11, 2019
8ee5f34
Adding syscalls to the makefile.
nicolasnoble Oct 11, 2019
c91f4ca
Adding printf syscall.
nicolasnoble Oct 11, 2019
b7e307c
Fixing pshittyload.
nicolasnoble Oct 11, 2019
97689ad
Flagging the loader as executable.
nicolasnoble Oct 11, 2019
b64dbed
Fixing code.
nicolasnoble Oct 11, 2019
537eeec
Actually opening serial port.
nicolasnoble Oct 11, 2019
863e1eb
unshat pshittyloader.py
asmblur Oct 11, 2019
4814e9d
Go away DOS line endings!
asmblur Oct 11, 2019
1ce069f
Merge branch 'pshittyload' of github.com:asmblur/pcsx-redux into pshi…
asmblur Oct 11, 2019
982ab51
More unpshitting of pshittyloader.py
asmblur Oct 11, 2019
5066e30
Fixing script a bit.
nicolasnoble Oct 11, 2019
9ba8655
Few more fixes.
nicolasnoble Oct 11, 2019
d91251a
Making pyserial happy.
nicolasnoble Oct 11, 2019
ee3dccb
changes to pshittyload.py...
asmblur Oct 11, 2019
72c3a8a
Merge branch 'pshittyload' of github.com:asmblur/pcsx-redux into pshi…
asmblur Oct 11, 2019
5fe228e
pshitty-- Fixed bugs in pshittyload
asmblur Oct 12, 2019
9d6f224
Removing chunking.
nicolasnoble Oct 12, 2019
d7ea8ca
new pshittyloader.py
asmblur Oct 12, 2019
c8f90d7
Getting pshittyloader to work.
nicolasnoble Oct 12, 2019
ff7b03b
Also adjusting baud rate python-side.
nicolasnoble Oct 12, 2019
d35cacf
flashey stuff, serially stuff
asmblur Oct 12, 2019
fed2c91
Merge branch 'pshittyload' of github.com:asmblur/pcsx-redux into pshi…
asmblur Oct 12, 2019
d5cfcb1
tweak for pshittyload.py
asmblur Oct 12, 2019
cd8c202
tester for flash
asmblur Oct 13, 2019
f3df5f2
Some more mapper test.
nicolasnoble Dec 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
name: Build
command: |
make -j 2
make -C src/mips/serial -j 2
make -C src/mips/hello -j 2
make -C src/mips/pshittyload -j 2
make -C src/mips/tinyload -j 2
make -C src/mips/shell -j 2
make -C src/mips/openbios -j 2

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ vsprojects/packages
/memcard1.mcd
/memcard2.mcd

src/.clang-format
1 change: 1 addition & 0 deletions env.list
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ LD=clang++-9
XDG_DATA_HOME=/home/coder
XDG_CACHE_HOME=/home/coder
HOME=/home/coder
PS1SDK=/project/src/mips/ps1sdk
4 changes: 4 additions & 0 deletions src/.clang-format-asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BasedOnStyle: WebKit
IndentWidth: 4
ColumnLimit: 120
AccessModifierOffset: -2
File renamed without changes.
204 changes: 103 additions & 101 deletions src/core/cdriso.cc

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions src/core/cdrom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CDRomImpl : public PCSX::CDRom {
CdlReadToc = 30,
};

static const inline char *CmdName[] = {
static const inline char* CmdName[] = {
"CdlSync", "CdlNop", "CdlSetloc", "CdlPlay", "CdlForward", "CdlBackward", "CdlReadN", "CdlStandby",
"CdlStop", "CdlPause", "CdlInit", "CdlMute", "CdlDemute", "CdlSetfilter", "CdlSetmode", "CdlGetmode",
"CdlGetlocL", "CdlGetlocP", "CdlReadT", "CdlGetTN", "CdlGetTD", "CdlSeekL", "CdlSeekP", "CdlSetclock",
Expand Down Expand Up @@ -141,16 +141,16 @@ class CDRomImpl : public PCSX::CDRom {

struct CdrStat cdr_stat;

static constexpr unsigned int msf2sec(const uint8_t *msf) { return ((msf[0] * 60 + msf[1]) * 75) + msf[2]; }
static constexpr void sec2msf(unsigned int s, uint8_t *msf) {
static constexpr unsigned int msf2sec(const uint8_t* msf) { return ((msf[0] * 60 + msf[1]) * 75) + msf[2]; }
static constexpr void sec2msf(unsigned int s, uint8_t* msf) {
msf[0] = s / 75 / 60;
s = s - msf[0] * 75 * 60;
msf[1] = s / 75;
s = s - msf[1] * 75;
msf[2] = s;
}
// for that weird psemu API..
static constexpr unsigned int fsm2sec(const uint8_t *msf) { return ((msf[2] * 60 + msf[1]) * 75) + msf[0]; }
static constexpr unsigned int fsm2sec(const uint8_t* msf) { return ((msf[2] * 60 + msf[1]) * 75) + msf[0]; }

static const uint32_t H_SPUirqAddr = 0x1f801da4;
static const uint32_t H_SPUaddr = 0x1f801da6;
Expand Down Expand Up @@ -334,7 +334,7 @@ class CDRomImpl : public PCSX::CDRom {
}
}

void Find_CurTrack(const uint8_t *time) {
void Find_CurTrack(const uint8_t* time) {
int current, sect;

current = msf2sec(time);
Expand All @@ -347,7 +347,7 @@ class CDRomImpl : public PCSX::CDRom {
CDR_LOG("Find_CurTrack *** %02d %02d\n", m_curTrack, current);
}

void generate_subq(const uint8_t *time) {
void generate_subq(const uint8_t* time) {
unsigned char start[3], next[3];
unsigned int this_s, start_s, next_s, pregap;
int relative_s;
Expand Down Expand Up @@ -394,9 +394,9 @@ class CDRomImpl : public PCSX::CDRom {
m_subq.absolute[2] = itob(time[2]);
}

void ReadTrack(const uint8_t *time) {
void ReadTrack(const uint8_t* time) {
unsigned char tmp[3];
struct SubQ *subq;
struct SubQ* subq;
uint16_t crc;

tmp[0] = itob(time[0]);
Expand All @@ -410,9 +410,9 @@ class CDRomImpl : public PCSX::CDRom {
m_suceeded = m_iso.readTrack(tmp);
memcpy(m_prev, tmp, 3);

subq = (struct SubQ *)m_iso.getBufferSub();
subq = (struct SubQ*)m_iso.getBufferSub();
if (subq != NULL && m_curTrack == 1) {
crc = calcCrc((uint8_t *)subq + 12, 10);
crc = calcCrc((uint8_t*)subq + 12, 10);
if (crc == (((uint16_t)subq->CRC[0] << 8) | subq->CRC[1])) {
m_subq.track = subq->TrackNumber;
m_subq.index = subq->IndexNumber;
Expand Down Expand Up @@ -526,8 +526,8 @@ class CDRomImpl : public PCSX::CDRom {
if (!m_muted) {
m_iso.readCDDA(m_setSectorPlay[0], m_setSectorPlay[1], m_setSectorPlay[2], m_transfer);

attenuate((int16_t *)m_transfer, CD_FRAMESIZE_RAW / 4, 1);
PCSX::g_emulator.m_spu->playCDDAchannel((short *)m_transfer, CD_FRAMESIZE_RAW);
attenuate((int16_t*)m_transfer, CD_FRAMESIZE_RAW / 4, 1);
PCSX::g_emulator.m_spu->playCDDAchannel((short*)m_transfer, CD_FRAMESIZE_RAW);
}

m_setSectorPlay[2]++;
Expand Down Expand Up @@ -891,7 +891,7 @@ class CDRomImpl : public PCSX::CDRom {
}
m_result[0] |= (m_result[1] >> 4) & 0x08;

strncpy((char *)&m_result[4], "PCSX", 4);
strncpy((char*)&m_result[4], "PCSX", 4);
m_stat = Complete;
break;

Expand Down Expand Up @@ -943,7 +943,7 @@ class CDRomImpl : public PCSX::CDRom {
// Crusaders of Might and Magic - update getlocl now
// - fixes cutscene speech
{
uint8_t *buf = m_iso.getBuffer();
uint8_t* buf = m_iso.getBuffer();
if (buf != NULL) memcpy(m_transfer, buf, 8);
}

Expand Down Expand Up @@ -1024,7 +1024,7 @@ class CDRomImpl : public PCSX::CDRom {
return v;
}

void attenuate(int16_t *buf, int samples, int stereo) final {
void attenuate(int16_t* buf, int samples, int stereo) final {
int i, l, r;
int ll = m_attenuatorLeftToLeft;
int lr = m_attenuatorLeftToRight;
Expand Down Expand Up @@ -1054,7 +1054,7 @@ class CDRomImpl : public PCSX::CDRom {
}

void readInterrupt() final {
uint8_t *buf;
uint8_t* buf;

if (!m_reading) return;

Expand Down Expand Up @@ -1353,7 +1353,7 @@ class CDRomImpl : public PCSX::CDRom {
void dma(uint32_t madr, uint32_t bcr, uint32_t chcr) final {
uint32_t cdsize;
unsigned i;
uint8_t *ptr;
uint8_t* ptr;

CDR_LOG("dma() Log: *** DMA 3 *** %x addr = %x size = %x\n", chcr, madr, bcr);

Expand Down Expand Up @@ -1384,7 +1384,7 @@ class CDRomImpl : public PCSX::CDRom {
}
}

ptr = (uint8_t *)PSXM(madr);
ptr = (uint8_t*)PSXM(madr);
if (ptr == NULL) {
CDR_LOG("dma() Log: *** DMA 3 *** NULL Pointer!\n");
break;
Expand Down Expand Up @@ -1568,4 +1568,4 @@ class CDRomImpl : public PCSX::CDRom {

} // namespace

PCSX::CDRom *PCSX::CDRom::factory() { return new CDRomImpl; }
PCSX::CDRom* PCSX::CDRom::factory() { return new CDRomImpl; }
38 changes: 19 additions & 19 deletions src/core/cheat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void PCSX::Cheats::ClearAllCheats() {
}

// load cheats from the specific filename
void PCSX::Cheats::LoadCheats(const char *filename) {
FILE *fp;
void PCSX::Cheats::LoadCheats(const char* filename) {
FILE* fp;
char buf[256];
int count = 0;
unsigned int t1, t2;
Expand Down Expand Up @@ -73,9 +73,9 @@ void PCSX::Cheats::LoadCheats(const char *filename) {
if (g_cheats == NULL) {
assert(g_numCheats == 0);
assert(s_numCheatsAllocated == ALLOC_INCREMENT);
g_cheats = (Cheat *)malloc(sizeof(Cheat) * s_numCheatsAllocated);
g_cheats = (Cheat*)malloc(sizeof(Cheat) * s_numCheatsAllocated);
} else {
g_cheats = (Cheat *)realloc(g_cheats, sizeof(Cheat) * s_numCheatsAllocated);
g_cheats = (Cheat*)realloc(g_cheats, sizeof(Cheat) * s_numCheatsAllocated);
}
}

Expand Down Expand Up @@ -104,9 +104,9 @@ void PCSX::Cheats::LoadCheats(const char *filename) {
if (g_cheatCodes == NULL) {
assert(g_numCodes == 0);
assert(s_numCodesAllocated == ALLOC_INCREMENT);
g_cheatCodes = (CheatCode *)malloc(sizeof(CheatCode) * s_numCodesAllocated);
g_cheatCodes = (CheatCode*)malloc(sizeof(CheatCode) * s_numCodesAllocated);
} else {
g_cheatCodes = (CheatCode *)realloc(g_cheatCodes, sizeof(CheatCode) * s_numCodesAllocated);
g_cheatCodes = (CheatCode*)realloc(g_cheatCodes, sizeof(CheatCode) * s_numCodesAllocated);
}
}

Expand All @@ -127,8 +127,8 @@ void PCSX::Cheats::LoadCheats(const char *filename) {
}

// save all cheats to the specified filename
void PCSX::Cheats::SaveCheats(const char *filename) {
FILE *fp;
void PCSX::Cheats::SaveCheats(const char* filename) {
FILE* fp;
int i, j;

fp = fopen(filename, "w");
Expand Down Expand Up @@ -269,7 +269,7 @@ void PCSX::Cheats::ApplyCheats() {
}
}

int PCSX::Cheats::AddCheat(const char *descr, char *code) {
int PCSX::Cheats::AddCheat(const char* descr, char* code) {
int c = 1;
char *p1, *p2;

Expand All @@ -279,9 +279,9 @@ int PCSX::Cheats::AddCheat(const char *descr, char *code) {
if (g_cheats == NULL) {
assert(g_numCheats == 0);
assert(s_numCheatsAllocated == ALLOC_INCREMENT);
g_cheats = (Cheat *)malloc(sizeof(Cheat) * s_numCheatsAllocated);
g_cheats = (Cheat*)malloc(sizeof(Cheat) * s_numCheatsAllocated);
} else {
g_cheats = (Cheat *)realloc(g_cheats, sizeof(Cheat) * s_numCheatsAllocated);
g_cheats = (Cheat*)realloc(g_cheats, sizeof(Cheat) * s_numCheatsAllocated);
}
}

Expand Down Expand Up @@ -314,9 +314,9 @@ int PCSX::Cheats::AddCheat(const char *descr, char *code) {
if (g_cheatCodes == NULL) {
assert(g_numCodes == 0);
assert(s_numCodesAllocated == ALLOC_INCREMENT);
g_cheatCodes = (CheatCode *)malloc(sizeof(CheatCode) * s_numCodesAllocated);
g_cheatCodes = (CheatCode*)malloc(sizeof(CheatCode) * s_numCodesAllocated);
} else {
g_cheatCodes = (CheatCode *)realloc(g_cheatCodes, sizeof(CheatCode) * s_numCodesAllocated);
g_cheatCodes = (CheatCode*)realloc(g_cheatCodes, sizeof(CheatCode) * s_numCodesAllocated);
}
}

Expand Down Expand Up @@ -350,7 +350,7 @@ void PCSX::Cheats::RemoveCheat(int index) {
g_numCheats--;
}

int PCSX::Cheats::EditCheat(int index, const char *descr, char *code) {
int PCSX::Cheats::EditCheat(int index, const char* descr, char* code) {
int c = 1;
int prev = g_numCodes;
char *p1, *p2;
Expand Down Expand Up @@ -381,9 +381,9 @@ int PCSX::Cheats::EditCheat(int index, const char *descr, char *code) {
if (g_cheatCodes == NULL) {
assert(g_numCodes == 0);
assert(s_numCodesAllocated == ALLOC_INCREMENT);
g_cheatCodes = (CheatCode *)malloc(sizeof(CheatCode) * s_numCodesAllocated);
g_cheatCodes = (CheatCode*)malloc(sizeof(CheatCode) * s_numCodesAllocated);
} else {
g_cheatCodes = (CheatCode *)realloc(g_cheatCodes, sizeof(CheatCode) * s_numCodesAllocated);
g_cheatCodes = (CheatCode*)realloc(g_cheatCodes, sizeof(CheatCode) * s_numCodesAllocated);
}
}

Expand Down Expand Up @@ -432,7 +432,7 @@ void PCSX::Cheats::CheatSearchBackupMemory() {

void PCSX::Cheats::CheatSearchInitBackupMemory() {
if (g_prevM == NULL) {
g_prevM = (int8_t *)malloc(0x200000);
g_prevM = (int8_t*)malloc(0x200000);
CheatSearchBackupMemory();
}
}
Expand All @@ -442,9 +442,9 @@ void PCSX::Cheats::CheatSearchAddResult(uint32_t addr) {
s_numSearchResultsAllocated += ALLOC_INCREMENT;

if (g_searchResults == NULL) {
g_searchResults = (uint32_t *)malloc(sizeof(uint32_t) * s_numSearchResultsAllocated);
g_searchResults = (uint32_t*)malloc(sizeof(uint32_t) * s_numSearchResultsAllocated);
} else {
g_searchResults = (uint32_t *)realloc(g_searchResults, sizeof(uint32_t) * s_numSearchResultsAllocated);
g_searchResults = (uint32_t*)realloc(g_searchResults, sizeof(uint32_t) * s_numSearchResultsAllocated);
}
}

Expand Down
24 changes: 12 additions & 12 deletions src/core/cheat.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ class Cheats {
} CheatCode;

typedef struct {
char *Descr;
char* Descr;
int First; // index of the first cheat code
int n; // number of cheat codes for this cheat
int Enabled;
} Cheat;

void ClearAllCheats();

void LoadCheats(const char *filename);
void SaveCheats(const char *filename);
void LoadCheats(const char* filename);
void SaveCheats(const char* filename);

void ApplyCheats();

int AddCheat(const char *descr, char *code);
int AddCheat(const char* descr, char* code);
void RemoveCheat(int index);
int EditCheat(int index, const char *descr, char *code);
int EditCheat(int index, const char* descr, char* code);

void FreeCheatSearchResults();
void FreeCheatSearchMem();
Expand Down Expand Up @@ -80,9 +80,9 @@ class Cheats {
void CheatSearchNoChange32();

#define PREVM(mem) (&g_prevM[mem])
#define PrevMu8(mem) (*(uint8_t *)PREVM(mem))
#define PrevMu16(mem) (SWAP_LE16(*(uint16_t *)PREVM(mem)))
#define PrevMu32(mem) (SWAP_LE32(*(uint32_t *)PREVM(mem)))
#define PrevMu8(mem) (*(uint8_t*)PREVM(mem))
#define PrevMu16(mem) (SWAP_LE16(*(uint16_t*)PREVM(mem)))
#define PrevMu32(mem) (SWAP_LE32(*(uint32_t*)PREVM(mem)))

// cheat types
enum {
Expand All @@ -106,12 +106,12 @@ class Cheats {
};

private:
Cheat *g_cheats = NULL;
CheatCode *g_cheatCodes = NULL;
Cheat* g_cheats = NULL;
CheatCode* g_cheatCodes = NULL;
int g_numCodes = 0;

int8_t *g_prevM = NULL;
uint32_t *g_searchResults = NULL;
int8_t* g_prevM = NULL;
uint32_t* g_searchResults = NULL;
int g_numSearchResults = 0;

int g_numCheats = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/core/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void PCSX::Debug::processAfter() {

if (m_stepping) {
const bool gotException = pc == 0x80000080 || pc == 0xbfc00180;
if (gotException) m_steppingJumps += 2; // there ought to be two jr $k0
if (gotException) m_steppingJumps += 2; // there ought to be two jr $k0

auto none = m_breakpoints.end();
switch (m_stepType) {
Expand Down
Loading