-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.txt
406 lines (358 loc) · 9.32 KB
/
content.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
=
-img,0,0: ruby_white_blue_640x480_png
=
-img,0,0: main_title_640x480_png
-wait:
-txt,320,216,black:PRESS A TO START!
= Resetting timer internally...
-resettimer
= Table of Contents
-sound:start
-bkg:ruby_kaigi_2024_dark_bg_png
-txt,40,40: - About me
- About mruby, Dreamcast, Wii
- mruby support for Dreamcast and Wii
- About this application
- Why?
- Cross platform development
- Differences and limitations
- Summary
- Thanks and info
= About me
-txt,60,30:Yuji Yokoo
Software developer
Work: CipherStash
Based in: Tokyo, Japan
Previously in: Adelaide, South Australia
Social: @yujiyokoo@ruby.social
-img,110,220: yuji_avatar_png
= About mruby
-txt,60,60:Lightweight implementation of Ruby
-wait:
-txt,60,90: - For embedded environments
-wait:
-txt,60,120: - Easy to compile and link into C
-txt,30,180:
"mruby is the lightweight implementation of the
Ruby language complying with part of the ISO
standard. mruby can be linked and embedded
within your application."
= About Dreamcast
-img,40,50: dreamcast_photo_png
= About Dreamcast
-txt,60,30: - The best video game console from Sega
-wait:
-txt,60,90: - Released in November 1998
- Hitachi SH4 at 200MHz
- 16MB of RAM
- NEC PowerVR2 at 100MHz
- 8MB Video RAM
- GD-ROM
- Serial Port
- Modem (33.6K~56K)
= About Dreamcast
-wait:
-txt,30,60: - Strong indie and homebrew communities
-wait:
-txt,30,90: - Good OSS for homebrew (KallistiOS)
-wait:
-txt,30,120: - KOS ports now includes mruby!
-wait:
-txt,30,150: - Runs custom code with no mods*
-txt,30,240: *assuming you have early-revision consoles
from 1998, 1999, or early 2000
= About Wii
-txt,10,30: - Great innovative console from Nintendo
-img,40,50: wii_photo_png
= About Wii
-txt,10,30: - Great innovative console from Nintendo
-wait:
-txt,10,90: - Released in 2006
- Not very powerful - an update to GameCube
- Wii Remote (aka Wiimote)
- IBM PowerPC 729MHz
- 24MB 1T-SRAM + 64MB GDDR3
- Wii Optical Disc, GameCube Game Disc & SD card
- Easy exploits for running your code
- No known easy way of booting custom discs
= What's good about Wii today
-wait:
-txt,60,60:Popularity.
Dreamcast sold over 9 million units
-wait:
-txt,60,120,red:Wii sold over 100 million units!
-wait:
-txt,60,150:Lots of people have a Wii at home
-wait:
-txt,60,210:I had one at home
= About this application
-txt,60,60:Dreampresent
-wait:
-txt,60,90: - Presentation app for DC from 2019
-wait:
-txt,60,120: - Runs on DC and Wii
-wait:
-txt,60,150: - It's not "Wiipresent"
-wait:
-txt,60,180: - Part of a larger project:
-txt,60,210: "Outstanding Performance Award" at
-txt,60,240: Fukuoka Ruby Awards 2023
-wait:
-txt,60,300: - Text, image, sound
-wait:
-sound:jump
-wait:
-txt,60,330: - It's a live demo
= mruby, Dreamcast, and Wii
-txt,30,30:mruby support:
-txt,60,60:Dreamcast - officially supported since 2020
-wait:
-img,40,90:dc_pr_png
= mruby, Dreamcast, and Wii
-txt,30,30:mruby support:
-txt,60,60:Dreamcast - officially supported since 2020
-txt,60,90:Wii - officially supported since 2023
-wait:
-img,40,120:wii_pr_png
= mruby, Dreamcast, and Wii
-txt,30,30:mruby support:
-txt,60,60:Dreamcast - officially supported since 2020
-txt,60,90:Wii - officially supported since 2023
-txt,60,150,yellow:$ make CONFIG=dreamcast_shelf
-wait:
-txt,60,210,yellow:$ make CONFIG=nintendo_wii
-wait:
-txt,60,270:(toolchains and libraries needed)
= Why?
= Dreamcast vs Wii
-wait:
-txt,30,60:Different architectures
-wait:
-txt,30,90:Different generation - port from DC to Wii
-wait:
-txt,30,120:Different devkit/SDK/library
-wait:
-txt,30,150:Both have free devkit/SDK with gcc
(KallistiOS, devkitPPC)
-wait:
-txt,30,210:Both allow running your own code fairly easily
-wait:
= Homebrew Development with mruby
-txt,30,40,white,yes:[ C code ]
-txt,430,40,white,yes:[ mruby code ]
-wait:
-txt,350,85,white:compile w/ mrbc (host)
-txt,402,64,white:^
-txt,402,64,white:|
-txt,376,40,yellow:<---
-wait:
-txt,180,40,white,yes:[ bytecode(.c) ]
-wait:
-txt,154,40,yellow:--
-txt,160,62,yellow:|
-txt,160,70,yellow:|
-txt,160,100,yellow:|
-wait:
-txt,172,85,white:<-
-txt,200,72,white:Cross
-txt,200,96,white:compile
-wait:
-txt,30,130,white,yes:[SH4/PPC object file]
-wait:
-txt,160,160,yellow:|
-txt,160,190,yellow:|
-txt,178,175,white:<- link -
-txt,320,160,white,yes:[DC/Wii library (SH4/PPC)]
-wait:
-txt,320,190,white,yes:[mruby library (SH4/PPC)]
-wait:
-txt,30,220,white,yes:[Executable (.elf)]
-wait:
-txt,270,220,white: *runnable on console
-wait:
-txt,160,250,yellow:|
-txt,160,280,yellow:|
-txt,178,265,white:<--- binary munging
-wait:
-txt,30,310,white,yes:[bootable image (cdi/dol)]
= Cross-platform for DC and Wii
-wait:
-txt,60,60:- mrbgems
-wait:
-txt,60,90: - many issues, and gave up (for now)
-txt,60,120: - eg. linker script related issues from
the platform library
-wait:
-txt,60,180:- Manual management
-txt,60,210: - separate source files for platform things
-wait:
-txt,60,240: - Develop on DC, Wii, then DC again...
= Original directories
-txt,60,30:project root/
- Makefile
- src/
- .rb files
- .c files (including main)
- romdisk/
- asset files
= Directories for Wii
-txt,60,30:project root/
- Makefile
- src/
- .rb files
- .c files (including main)
- data/
- asset files
= Current directories
-txt,60,30:project root/
- src/
- common/
- .rb files
- .rb file .c files (including main)
- .rb file, .c files (including main)
- romdisk/
- asset files
-txt,60,60,yellow: - Makefile.wii
- Makefile.dc
- wii/
- dc/
= Main entry point (DC)
-txtblock,30,30,600,470
-code,40,40,c:extern const uint8_t bytecode[];
int main(int argc, char **argv) {
vid_set_mode(DM_640x480_VGA, PM_RGB565);
snd_init();
load_sound_effects();
mrb_state *mrb = mrb_open();
struct RClass *dp_mod =
mrb_define_module(mrb, "DreamPresent");
define_module_functions(mrb, dp_mod);
mrb_load_irep(mrb, bytecode);
mrb_close(mrb);
return 0;
}
= Main entry point (Wii)
-txtblock,30,30,600,470
-code,40,40,c:extern const uint8_t bytecode[];
int main(int argc, char **argv) {
GRRLIB_Init();
AESND_Init();
WPAD_Init();
mrb_state *mrb = mrb_open();
struct RClass *dp_mod =
mrb_define_module(mrb, "DreamPresent");
define_module_functions(mrb, dp_mod);
mrb_load_irep(mrb, bytecode);
mrb_close(mrb);
return 0;
}
= Dreampresent start.rb
-txtblock,40,40,600,400
-code,50,50,ruby:begin
puts "Starting presentation."
Dreampresent.new(
DreamPresentRb.new(DreamPresent)
).start
rescue => ex
# NOTE: backtrace requires 'mrbc -g'
p ex.backtrace
p ex.inspect
raise ex
end
= Differences - asset access
-txt,30,30:KOS provides "romdisk" virtual file system
-wait:
-txtblock,40,55,400,120
-code,60,60,C:path = "/rd/content.txt";
f = fs_open(path, O_RDONLY);
-wait:
-txt,30,200:devkitPPC converts assets data to object + header
-wait:
-txtblock,40,225,540,290
-code,60,230,C:extern const uint8_t qrcode_png[];
extern const uint8_t qrcode_png_end[];
= Differences - asset access
-txt,30,30:String to const mapping for Wii
-txtblock,40,85,620,280
-code,60,90,C:const uint8_t *find_img(char* img) {
if(strcmp(img, "profile_pic.png") == 0) {
return profile_pic_png;
} else if(strcmp(img, "avatar.png") == 0) {
return avatar_png;
}
= Differences - graphics API
-txt,30,30:KOS provides direct VRAM access
-wait:
-txtblock,40,55,480,120
-code,60,60,C:vram_s[y * PX_PER_LINE + curr_x]
= PACK_PIXEL(r, g, b);
-wait:
-txt,30,200:GRRLIB on Wii provides graphics functions and
render function to be called every frame
-wait:
-txtblock,40,255,500,380
-code,60,260,C:GRRLIB_Printf(..);
GRRLIB_DrawImage(..);
VIDEO_WaitVSync();
GRRLIB_Render();
-wait:
-txt,30,390:* I tried to implement this style in DC with
software rendering, but it was too slow
= Differences - other
-txt,30,30:GRRLIB's png support requires height and width
to be multiples of 4
-wait:
-txt,30,100:Wii Remote vs controller
-wait:
-txt,30,140:Clock worked straight away on DC, but had issues
ond Wii and I implemented a new time function:
-txtblock,20,200,600,440
-code,30,205,C:static mrb_value int_time(
mrb_state *mrb, mrb_value self
) {
u64 curr_time = gettime();
u32 curr_sec =
ticks_to_millisecs(curr_time) / 1000;
return mrb_int_value(mrb, curr_sec);
}
= Testing and debugging
-txt,40,30:Real console units: where it needs to work
- Hard to debug
-wait:
-txt,40,90:Emulators
- Extremely useful for debugging
-wait:
-txt,40,120:
- Often comes with terminal output (stdout)
- lxdream always made this easy
- Dolphin recently made it easy to print
to stdout
-wait:
-img,40,70: emulator_console_png
= Testing and debugging
-txt,40,90:New problem:
Now debugging on 2 platforms...
= Summary
-txt,40,40: - Cross-platform mruby "works"
but the DX is not smooth
- The actual platform-specific part often
resemble each other
- Debugging is hard. Possibly doubled
= Thanks
-txt,40,40: - mruby developers
- KallistiOS developers
- DevkitPro
- Simulant discord channel
- RubyKaigi organisers and sponsors
-wait:
-txt,40,190: - Everyone who came to this session
= More information
-txt,10,40:Dreampresent cross-platform:
https://gitlab.com/yujiyokoo/dreampresent-wii
-txt,10,200:Dockerfile for Dreamcast:
https://gitlab.com/yujiyokoo/docker-mruby-kos-dc
-txt,80,360: https://yujiyokoo.dev/mruby/
= More information
-txt,50,30:mruby on Retro Consoles
-img,50,60:qrcode_png
-txt,80,400: https://yujiyokoo.dev/mruby/