Skip to content

Commit c70d85e

Browse files
authored
Merge branch 'main' into aur-ci
2 parents 98c5385 + 87f8e86 commit c70d85e

File tree

19 files changed

+342
-111
lines changed

19 files changed

+342
-111
lines changed

.github/workflows/macos-toolchain.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ jobs:
1919
- uses: n1hility/cancel-previous-runs@v2
2020
with:
2121
token: ${{ secrets.GITHUB_TOKEN }}
22+
- name: install dependencies
23+
run: brew install --verbose nikitabobko/tap/brew-install-path
2224
- name: build mips binutils
23-
run: brew install ./tools/macos-mips/mipsel-none-elf-binutils.rb --debug
25+
run: brew install-path --verbose ./tools/macos-mips/mipsel-none-elf-binutils.rb
2426
- name: build mips gcc
25-
run: brew install ./tools/macos-mips/mipsel-none-elf-gcc.rb --debug
27+
run: brew install-path --verbose ./tools/macos-mips/mipsel-none-elf-gcc.rb
2628
- name: build openbios
2729
run: make -C ./src/mips/openbios

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ You need MacOS Catalina or later with the latest XCode to build, as well as a fe
130130

131131
Compiling OpenBIOS will require a mips compiler, that you can generate using the following commands:
132132
```bash
133-
brew install ./tools/macos-mips/mipsel-none-elf-binutils.rb
134-
brew install ./tools/macos-mips/mipsel-none-elf-gcc.rb
133+
brew install nikitabobko/tap/brew-install-path
134+
brew install-path ./tools/macos-mips/mipsel-none-elf-binutils.rb
135+
brew install-path ./tools/macos-mips/mipsel-none-elf-gcc.rb
135136
```
136137

137138
Then, you can compile OpenBIOS using `make -C ./src/mips/openbios`.

src/mips/openbios/card/device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,9 @@ static const struct Device s_cardDevice = {
632632
.desc = "MEMORY CARD",
633633
.init = (void (*)())psxdummy,
634634
.open = dev_bu_open,
635-
.action = psxdummy,
635+
.action = (int (*)(struct File *, enum FileAction))psxdummy,
636636
.close = dev_bu_close,
637-
.ioctl = psxdummy,
637+
.ioctl = (int (*)(struct File *, int, int))psxdummy,
638638
.read = dev_bu_read,
639639
.write = dev_bu_write,
640640
.erase = dev_bu_erase,

src/mips/openbios/cdrom/cdrom.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,18 @@ static const struct Device s_cdromDevice = {
101101
.desc = "CD-ROM",
102102
.init = (void (*)())psxdummy,
103103
.open = dev_cd_open,
104-
.action = psxdummy,
105-
.close = psxdummy,
106-
.ioctl = psxdummy,
104+
.action = (int (*)(struct File *, enum FileAction))psxdummy,
105+
.close = (int (*)(struct File *))psxdummy,
106+
.ioctl = (int (*)(struct File *, int, int))psxdummy,
107107
.read = dev_cd_read,
108-
.write = psxdummy,
109-
.erase = psxdummy,
108+
.write = (int (*)(struct File *, void *, int))psxdummy,
109+
.erase = (int (*)(struct File *, const char *))psxdummy,
110110
.undelete = psxdummy,
111111
.firstFile = dev_cd_firstFile,
112112
.nextFile = dev_cd_nextFile,
113-
.format = psxdummy,
113+
.format = (int (*)(struct File *))psxdummy,
114114
.chdir = dev_cd_chdir,
115-
.rename = psxdummy,
115+
.rename = (int (*)(struct File *, const char *, struct File *, const char *))psxdummy,
116116
.deinit = deinitCDRom,
117117
.check = psxdummy,
118118
};

src/mips/openbios/tty/tty.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ static const struct Device s_ttyDevice = {
5454
.init = dev_tty_init,
5555
.open = dev_tty_open,
5656
.action = dev_tty_action,
57-
.close = psxdummy,
57+
.close = (int (*)(struct File *))psxdummy,
5858
.ioctl = dev_tty_ioctl,
59-
.read = psxdummy,
60-
.write = psxdummy,
61-
.erase = psxdummy,
59+
.read = (int (*)(struct File *, void *, int))psxdummy,
60+
.write = (int (*)(struct File *, void *, int))psxdummy,
61+
.erase = (int (*)(struct File *, const char *))psxdummy,
6262
.undelete = psxdummy,
6363
.firstFile = (struct DirEntry * (*)(struct File *, const char *, struct DirEntry *)) psxdummy,
6464
.nextFile = (struct DirEntry * (*)(struct File *, struct DirEntry *)) psxdummy,
65-
.format = psxdummy,
65+
.format = (int (*)(struct File *))psxdummy,
6666
.chdir = psxdummy,
67-
.rename = psxdummy,
67+
.rename = (int (*)(struct File *, const char *, struct File *, const char *))psxdummy,
6868
.deinit = (void (*)())psxdummy,
6969
.check = psxdummy,
7070
};
@@ -77,19 +77,19 @@ static const struct Device s_dummyDevice = {
7777
.blockSize = 1,
7878
.desc = "CONSOLE",
7979
.init = (void (*)())psxdummy,
80-
.open = psxdummy,
81-
.action = psxdummy,
82-
.close = psxdummy,
83-
.ioctl = psxdummy,
84-
.read = psxdummy,
85-
.write = psxdummy,
86-
.erase = psxdummy,
80+
.open = (int (*)(struct File *, const char *, int))psxdummy,
81+
.action = (int (*)(struct File *, enum FileAction))psxdummy,
82+
.close = (int (*)(struct File *))psxdummy,
83+
.ioctl = (int (*)(struct File *, int, int))psxdummy,
84+
.read = (int (*)(struct File *, void *, int))psxdummy,
85+
.write = (int (*)(struct File *, void *, int))psxdummy,
86+
.erase = (int (*)(struct File *, const char *))psxdummy,
8787
.undelete = psxdummy,
8888
.firstFile = (struct DirEntry * (*)(struct File *, const char *, struct DirEntry *)) psxdummy,
8989
.nextFile = (struct DirEntry * (*)(struct File *, struct DirEntry *)) psxdummy,
90-
.format = psxdummy,
90+
.format = (int (*)(struct File *))psxdummy,
9191
.chdir = psxdummy,
92-
.rename = psxdummy,
92+
.rename = (int (*)(struct File *, const char *, struct File *, const char *))psxdummy,
9393
.deinit = (void (*)())psxdummy,
9494
.check = psxdummy,
9595
};

src/mips/psyqo/GETTING_STARTED.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ trizen -S cross-mipsel-linux-gnu-binutils cross-mipsel-linux-gnu-gcc
2626
Using [Homebrew](https://brew.sh/), you can install the mips toolchain after downloading [these two scripts](https://github.com/grumpycoders/pcsx-redux/tree/main/tools/macos-mips) (or cloning the whole PCSX-Redux repository).
2727

2828
```bash
29-
brew install ./tools/macos-mips/mipsel-none-elf-binutils.rb
30-
brew install ./tools/macos-mips/mipsel-none-elf-gcc.rb
29+
brew install nikitabobko/tap/brew-install-path
30+
brew install-path ./tools/macos-mips/mipsel-none-elf-binutils.rb
31+
brew install-path ./tools/macos-mips/mipsel-none-elf-gcc.rb
3132
```
3233

3334
## Windows

src/mips/psyqo/primitives/common.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ struct TPageLoc {
165165
}
166166

167167
private:
168+
TPageLoc(uint8_t i) : info(i) {}
168169
uint8_t info = 0;
169170
friend struct TPageAttr;
170171
};
@@ -246,7 +247,7 @@ struct TPageAttr {
246247
}
247248
uint8_t getPageX() const { return info & 0x000f; }
248249
uint8_t getPageY() const { return (info >> 4) & 0x0001; }
249-
uint8_t getPageLoc() const { return info & 0x001f; }
250+
TPageLoc getPageLoc() const { return TPageLoc(info & 0x001f); }
250251
Prim::TPageAttr::SemiTrans getSemiTrans() const {
251252
return static_cast<Prim::TPageAttr::SemiTrans>((info >> 5) & 0x0003);
252253
}

src/mips/psyqo/src/xprintf.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,7 @@ static const info fmtinfo[] = {
315315
** seems to make a big difference in determining how fast this beast
316316
** will run.
317317
*/
318-
int vxprintf(func, arg, format, ap) void (*func)(const char *, int, void *);
319-
void *arg;
320-
const char *format;
321-
va_list ap;
322-
{
318+
int vxprintf(void (*func)(const char *, int, void *), void *arg, const char *format, va_list ap) {
323319
register const char *fmt; /* The format string. */
324320
register int c; /* Next character in the format string */
325321
register char *bufpt; /* Pointer to the conversion buffer */
@@ -704,10 +700,7 @@ struct s_strargument { /* Describes the string being written to */
704700
char *last; /* Last available slot in the string */
705701
};
706702

707-
static void sout(txt, amt, arg) char *txt;
708-
int amt;
709-
void *arg;
710-
{
703+
static void sout(const char *txt, int amt, void *arg) {
711704
register char *head;
712705
register const char *t;
713706
register int a;
@@ -756,10 +749,7 @@ struct sgMprintf {
756749
};
757750

758751
/* The xprintf callback function. */
759-
static void mout(zNewText, nNewChar, arg) char *zNewText;
760-
int nNewChar;
761-
void *arg;
762-
{
752+
static void mout(const char *zNewText, int nNewChar, void *arg) {
763753
struct sgMprintf *pM = (struct sgMprintf *)arg;
764754
if (pM->nChar + nNewChar + 1 > pM->nAlloc) {
765755
pM->nAlloc = pM->nChar + nNewChar * 2 + 1;

tools/linux-mips/spawn-compiler.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ set -ex
1313

1414
PREFIX=${PREFIX:-"/usr/local"}
1515

16-
for url in https://ftpmirror.gnu.org/gnu/binutils/binutils-2.43.tar.gz https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz ; do
16+
for url in https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.tar.gz https://mirrors.kernel.org/gnu/binutils/binutils-2.45.tar.gz ; do
1717
wget --max-redirect=2 --timeout=60 --continue --trust-server-names $url && break
1818
done
19-
tar xvfz binutils-2.43.tar.gz
20-
cd binutils-2.43
19+
tar xvfz binutils-2.45.tar.gz
20+
cd binutils-2.45
2121
./configure --target=mipsel-none-elf --disable-multilib --disable-nls --disable-werror --prefix=$PREFIX
2222
make
2323
make install-strip
2424
cd ..
2525

26-
for url in https://ftpmirror.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz https://mirrors.kernel.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz ; do
26+
for url in https://ftpmirror.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.gz https://mirrors.kernel.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.gz ; do
2727
wget --max-redirect=2 --timeout=60 --continue --trust-server-names $url && break
2828
done
29-
tar xvfz gcc-14.2.0.tar.gz
30-
cd gcc-14.2.0
29+
tar xvfz gcc-15.2.0.tar.gz
30+
cd gcc-15.2.0
3131
./contrib/download_prerequisites
3232
mkdir build
3333
cd build

tools/macos-mips/mipsel-none-elf-binutils.rb

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
class MipselNoneElfBinutils < Formula
22
desc "FSF Binutils for mipsel cross development"
33
homepage "https://www.gnu.org/software/binutils/"
4-
url "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.43.tar.gz"
5-
mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz"
6-
sha256 "025c436d15049076ebe511d29651cc4785ee502965a8839936a65518582bdd64"
4+
url "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.tar.gz"
5+
mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.45.tar.gz"
6+
sha256 "8a3eb4b10e7053312790f21ee1a38f7e2bbd6f4096abb590d3429e5119592d96"
77

88
depends_on "texinfo" => :build
99

10+
patch :DATA
11+
1012
def install
1113
system "./configure", "--target=mipsel-none-elf",
1214
"--disable-multilib",
@@ -20,3 +22,47 @@ def install
2022
assert_match "f()", shell_output("#{bin}/mipsel-none-elf-c++filt _Z1fv")
2123
end
2224
end
25+
26+
__END__
27+
diff --git a/zlib/zutil.h b/zlib/zutil.h
28+
index 0bd2dbcba..bb513cb4b 100644
29+
--- a/zlib/zutil.h
30+
+++ b/zlib/zutil.h
31+
@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
32+
# endif
33+
#endif
34+
35+
-#if defined(MACOS) || defined(TARGET_OS_MAC)
36+
+#if defined(MACOS)
37+
# define OS_CODE 7
38+
-# ifndef Z_SOLO
39+
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
40+
-# include <unix.h> /* for fdopen */
41+
-# else
42+
-# ifndef fdopen
43+
-# define fdopen(fd,mode) NULL /* No fdopen() */
44+
-# endif
45+
-# endif
46+
-# endif
47+
#endif
48+
49+
#ifdef __acorn
50+
@@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
51+
# define OS_CODE 19
52+
#endif
53+
54+
-#if defined(_BEOS_) || defined(RISCOS)
55+
-# define fdopen(fd,mode) NULL /* No fdopen() */
56+
-#endif
57+
-
58+
-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
59+
-# if defined(_WIN32_WCE)
60+
-# define fdopen(fd,mode) NULL /* No fdopen() */
61+
-# else
62+
-# define fdopen(fd,type) _fdopen(fd,type)
63+
-# endif
64+
-#endif
65+
-
66+
#if defined(__BORLANDC__) && !defined(MSDOS)
67+
#pragma warn -8004
68+
#pragma warn -8008

0 commit comments

Comments
 (0)