Skip to content

Commit 8e47c35

Browse files
committed
various fixes
1 parent d27cf6a commit 8e47c35

23 files changed

Lines changed: 70 additions & 70 deletions

client/makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
# This project is licensed under the terms of the GNU General
44
# Public License version 2. See LICENSE for more information.
55

6-
.PHONY: default
7-
default: build/sm64net build/sm64net.exe build/sm64net_usb
6+
build/sm64net: src/main.c src/net.c src/mem.c
87

9-
SRC := src/main.c src/net.c src/mem.c
10-
build/sm64net: $(SRC)
11-
build/sm64net.exe: $(SRC)
8+
build/sm64net.exe: src/main.c src/net.c src/mem.c
129
build/sm64net.exe: CC := i686-w64-mingw32-gcc -mconsole -D_WIN32_WINNT=0x0600
1310
build/sm64net.exe: LIB := -lws2_32
1411

15-
SRC := src/main.c src/net.c src/mem_usb.c
16-
build/sm64net_usb: $(SRC)
12+
build/sm64net_usb: src/main.c src/net.c src/mem_usb.c
1713
build/sm64net_usb: LIB := -lftdi
1814

1915
include ../include/native.mk

client/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void main_exit(void)
2121
#endif
2222
}
2323

24-
int main(int argc, const char **argv)
24+
int main(int argc, char *argv[])
2525
{
2626
const char *proc;
2727
const char *addr;
@@ -44,7 +44,7 @@ int main(int argc, const char **argv)
4444
errno = 0;
4545
port = strtol(argv[3], NULL, 0);
4646
if (errno != 0 || port < 1 || port > 65535) eprint("invalid port\n");
47-
net_init(proc, addr, port, argv+4, argc-4);
47+
net_init(proc, addr, port, argc-4, argv+4);
4848
while (true) net_update();
4949
return EXIT_SUCCESS;
5050
}

client/src/net.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,14 @@ static void nff_write(const char *path)
112112
PTR end = W(0x0C);
113113
b += 0x0C;
114114
if (addr == 0) break;
115-
if (addr == (u32)-1) addr = np_table;
115+
if (addr == (PTR)-1) addr = np_table;
116116
mem_write(addr, data+start, end-start);
117117
}
118118
free(data);
119119
}
120120

121121
void net_init(
122-
const char *proc, const char *addr, int port,
123-
const char **argv, int argc
122+
const char *proc, const char *addr, int port, int argc, char *argv[]
124123
)
125124
{
126125
NET_META meta;
@@ -169,8 +168,8 @@ void net_init(
169168
eprint("server is version %s\n", meta.version);
170169
}
171170
mem_init(proc, np_u32(meta.mem_addr));
172-
mem_write(NP_TABLE, meta.np_table_b, sizeof(meta.np_table_b));
173-
np_table = np_u32(meta.np_table);
171+
mem_write(NP_TABLE, meta.np_data_b, sizeof(meta.np_data_b));
172+
np_table = np_u32(meta.np_data);
174173
while (argc-- > 0) nff_write(*argv++);
175174
puts("Connected.");
176175
}

client/src/net.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include <types.h>
1212

1313
extern void net_init(
14-
const char *proc, const char *addr, int port,
15-
const char **argv, int argc
14+
const char *proc, const char *addr, int port, int argc, char *argv[]
1615
);
1716
extern void net_update(void);
1817

include/native.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CCFLAG += -D__NATIVE__ -Wall -Wextra -Wpedantic -O2
1212

1313
.PHONY: clean
1414
clean:
15-
rm -rf build
15+
rm -f -r build
1616

1717
build/%: | build
1818
$(CC) $(CCFLAG) -s -o $@ $^ $(LIB)

include/sm64.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CPPFLAG := $(FLAG) -Umips
1818

1919
.PHONY: clean
2020
clean:
21-
rm -rf build
21+
rm -f -r build
2222

2323
build/%.z64: build/%.elf build/crc | build
2424
$(OBJCOPY) -O binary $< $@
@@ -39,11 +39,11 @@ build/%.ld.o: | build
3939
build/%.o: %.c | build
4040
$(CC) $(CCFLAG) -c -o $@ $<
4141

42-
build/%.o: %.S | build
42+
build/%.o: %.sx | build
4343
$(CC) $(CCFLAG) -c -o $@ $<
4444

4545
build/crc: crc.c | build
46-
cc -Wall -Wextra -Wpedantic -O2 -s -o $@ $<
46+
cc -O2 -Wall -Wextra -Wpedantic -s -o $@ $<
4747

4848
build:
4949
mkdir -p $@

include/sm64net.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
#include <types.h>
1212

13-
#define NET_PORT 4352
13+
#define NET_PORT 4352
1414

15+
#define NP_TABLE 0x80000380
1516
#define NP_LEN 32
1617
#define NP_NAME_LEN 32
1718
#define NP_UDP_LEN 0x80
@@ -110,11 +111,10 @@ NET_PL;
110111
typedef struct net_meta
111112
{
112113
/* 0x00 */ u8 mem_addr_b[4];
113-
/* 0x04 */ u8 np_table_b[4];
114+
/* 0x04 */ u8 np_data_b[4];
114115
/* 0x08 */ char version[0x40-0x08];
115116
} /* 0x40 */
116117
NET_META;
117-
#define NP_TABLE 0x80000380
118118
#else
119119
extern NET_PL *np_table;
120120
#endif

include/sm64net.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
#define __ASSEMBLER__
99
#include <sm64net.h>
1010

11-
np_table = 0x80000380;
11+
np_table = NP_TABLE;
File renamed without changes.

server/hrdee_gfx.o

-100 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)