Views: 1,611,765 | Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search | 12-03-24 04:41 PM |
Guest: |
Main - Posts by StapleButter |
(post in restricted forum) |
StapleButter |
| ||
Member blarg Level: 30 Posts: 2/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
4dsdev is basically aiming at being the place to go for 3DS homebrew programming and related activities. 3DS homebrew is still in its early stages, and not very newbie-friendly. This board aims at explaining and simplifying the process, to hopefully encourage more potential homebrewers to jump in.
While GBAtemp is more general, this board will specialize more on the programming, hacking and reverse-engineering aspects. We aren't aiming at replacing GBAtemp, 3dbrew or #3dsdev, but rather complement them. I hope you will enjoy your stay here If you have anything to say about the board or whatever, feel free to post! ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 3/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
There are two possible types of homebrew on the 3DS: ARM11 userland and ARM9.
ARM11 userland homebrew is the type we're going to cover in this section of the board. Basically, ARM11 userland homebrew runs in the same environment as commercial games. This environment gives enough privilege to make interesting homebrew, and is also the most practical. Here are the possible ways to run ARM11 userland homebrew on your 3DS: NinjhaxIt is a game-based exploit released by smealum and working on all firmware versions from 4.0.07 to 9.0.20. This exploit requires you to own a copy of the game Cubic Ninja. To obtain this exploit and learn more about it, go to the Ninjhax homepage. GatewayIt is a flashcard that is made for piracy purposes but also supports running homebrew. If you want to go this way, be warned that their launcher contains code that has a 1/16 chance of bricking your 3DS if it detects that Launcher.dat has been modified. Make sure to acquire a genuine Gateway and to get the launcher from their site. Accidental corruption of the launcher has more chances of resulting in a simple crash, but always make sure that the file's MD5 hash matches the hash posted on their site's download page. We take no responsibility if your 3DS gets bricked. You were warned. Before acquiring a Gateway, make sure that your 3DS firmware version is comprised between 4.1 and 9.2. If your firmware version is too old, you can update by running a game that embeds the desired firmware version, such as Animal Crossing. Do not update via the System Menu. If your firmware version is too recent, Gateway won't work for you. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 4/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Now let's get to the fun part!
3DS homebrew is programmed in C or C++. We expect that you already have good knowledge of these languages. 1. Things you will need • devkitPro • makerom (for building a Gateway-compatible .3ds file). Windows users can grab a build here. • RSF file for Gateway 2. Setup Install devkitPro. If it's already installed, update it to the last version. The installer will install ctrulib and set everything up automatically. 3. Making homebrew You can build from the examples that come with ctrulib. The examples aren't provided in devkitPro, but you can obtain them from the ctrulib repository on Github. • app_launch: demonstrates how to launch another app (in this case, the EUR Camera app) • gpu: demonstrates how to render 3D geometry with the GPU • mic: demonstrates how to read sound from the microphone • mvd: demonstrates how to use hardware video decoding on the New 3DS • sdmc: demonstrates how to access files on the SD card (TODO: documentation of the API!) 4. Building homebrew for distribution To build your homebrew, it works the same way as for building ctrulib. Open a terminal, browse to your homebrew's folder and run make. This will build a .elf file and a .3dsx file. The .3dsx file is meant for oncoming homebrew launchers. To build a Gateway-compatible .3ds file, an extra step is needed. You need to strip the .elf file and use makerom on it (with the provided RSF file). Here are commands to do it: arm-none-eabi-strip [ELF file]
makerom -f cci -o [.3ds file] -rsf [RSF file] -target d -exefslogo -elf [ELF file] -icon [icon file] -banner [banner file] Have fun! ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 5/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
What the title says. If you have seen lolSnes, you know what to expect. This project even reuses a lot of lolSnes's code.
Like everything else regarding 3DS homebrew, this is in early stages. Builds from EmuCR are NOT SUPPORTED. You will not receive help if you have trouble with one of these builds. Screenshots Wikitemp BlargSnes Page on Wiki Compatibility list Downloads Version 1.3b: https://blargsnes.kuribo64.net/download/blargSnes_1.3b.zip Version 1.3: https://kuribo64.net/get.php?id=fYRTHLeS0pR3DXFw Older: (unsupported) Version 1.2: https://blargsnes.kuribo64.net/download/blargSnes_1.2.zip Unofficial 1.19: https://mega.co.nz/#!LJpC0ASK!Jke6Snsfs2sOkQyxfFUC1alGvH6zt9b6tjwdxVKwmm8 Version 1.1: https://kuribo64.net/get.php?id=ccoTzGtwgVkh42b4 Version 1.0: https://kuribo64.net/get.php?id=72nkdEkneiIQqlAW Source: https://github.com/StapleButter/blargSnes Website: https://blargsnes.kuribo64.net/ This isn't the cleanest code ever, but it can serve as a handy reference for 3DS homebrew development (or SNES emulation, although I wouldn't recommend it ). Custom borders blargSNES custom border repository Custom border submission thread at GBAtemp Changelog Version 1.3: * Usage of geometry shaders and other speedups to rendering * Hardware renderer: offset-per-tile, hi-res modes, and more fixes by DiscostewSM * Much better sound quality, support for noise, echo and pitch modulation (thanks DiscostewSM again) * Two added scaling modes: 4:3 and cropped 4:3 * Better open-bus emulation, and ability to execute code in open-bus regions (fixes Home Alone) * Overall more accurate timings, IRQ fixes, etc * ROM selector is no longer locked to the /snes folder * the usual forgotten novelties, surprise Version 1.2: * Brand new hardware-accelerated renderer * Scaling support * Exit button (mainly for use with the Homebrew Launcher) * Emulation fixes (namely, huge 'next EXP' in Earthbound is fixed) * Support for the 256x239 mode * Proper PAL support (actually uses PAL timings) * Tries to prevent GPU freezes * Synchronous SPC700 (fixes issues but also causes a little slowdown) * As usual, more crap I forgot about. Hah. Version 1.1: * No more garbled/blank screens or freezes when pressing Home or closing/reopening the 3DS or playing with the 3D slider * Ability to run a new game without restarting blargSnes * Screenshot function * Support for external borders * Support for backgrounds with 16x16 tiles. Super Bomberman games are finally playable. * Brightness, color math (blending) and windows added. Many games look nicer this way. * Several PPU speedups * Speedhacking disabled (it was error-prone, not that efficient, and broke HDMA) * Replaced forced 1/2 frameskip with automatic frameskipper (isn't perfect, though) * More stable display (although tearing still occurs when frameskipping), VSync * More things I forgot about. Surprise! What's in the zip * blargSnes.3ds -- 3DS ROM. Useful for Gateway. * blargSnes.cia -- Installable version * blargSnes folder -- files for use with the Homebrew Launcher * blargSnes.elf -- ELF file. May be useful for alternate homebrew loaders. Provided for the sake of completeness. How to use You need a way to run ARM11 userland homebrew on your 3DS. Gateway Copy blargSnes.3ds to the Gateway's MicroSD. Due to limitations, you will not get sound if you use this method. Homebrew Launcher / Ninjhax Copy the blargSnes folder into the 3ds folder on your SD card. Due to limitations, you will not get sound if you use this method on a New 3DS. 'Old' 3DS users will get sound. Also note that sleep mode (closing your 3DS) and the Home button don't work when using this method. CIA The method for using the CIA version will not be covered here because installation of CIA files involves warez. However, the CIA version gives you the best of all worlds-- sound AND working sleep mode on all systems, provided you're able to install and run it. You will need either a Gateway or a CFW to be able to run unsigned CIA files. The normal Home menu will show them but will refuse to launch them. You're on your own for getting SNES ROMs. On the 3DS's SD card (not the Gateway MicroSD), create a folder named 'snes' and put your SNES ROMs in there. In the same folder, you can also place savegames. They must have the same name as their corresponding ROM, and have a .srm extension. With that done, start blargSnes, and you see a ROM selection menu. Select your ROM and press A (or B). See what happens. You can pause gameplay by tapping the touchscreen. When paused, resume by pressing A or tapping the touchscreen again. You can also select another game by pressing Select, or open the configuration screen by pressing Start, or take a screenshot by pressing both L and R (screenshot is saved to your SD card in .bmp format, includes both screens). The configuration screen * Hardware renderer: this enables the hardware-accelerated renderer. It is faster than the software renderer but also less accurate in some cases. * Scaling: provides some scaling modes for the video output. How to make a custom border Your border image needs to be exactly 400x240. The SNES video output takes place from coordinates 72,8, in a 256x244 rectangle. Anything in this region of your border image will not be visible. When you're done, save the file at the root of your SD card, under the name blargSnesBorder.bmp. Make sure it is saved as a 24-bit bitmap. If you have a border you're particularly proud of, you're welcome to post it in this thread Supported features * Software and hardware renderers * DMA (with faster paths for VRAM/CGRAM/OAM), HDMA * SPC700 * Sound (when possible) * SRAM with auto-saving * Joypad for player 1 (circle pad also works) * Catgirls Future features * Sound using the 3DS DSP * Expansion chips. Star Fox in 3D, anyone? Credits * 3dbrew and all the people who made 3DS homebrew possible * DiscostewSM for all his coding help * anyone who helped make lolSnes work * Bond697 and Normmatt for how to use the 3DS syscore * smealum for ctrulib and for paving the way to the PICA200 * Martin Korth for the nice SNES documentation and no$sns's debugger * The authors of SNemulDS for their DSP emulation code * if you feel I forgot your name here, let me know Enjoy ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 6/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
4dsdev isn't pretty currently. We have a plaintext banner and the current theme is the default theme for Acmlmboard.
Unfortunately, while I'm somewhat good at programming, graphics design is one of the things I suck at. If you have graphics skills, or if you have ideas for a kickass theme+banner, feel free to post. Ideal dimensions for the banner are 600x100, but this isn't a requirement. Just don't take too much space vertically Regarding the theme, the board can be themed rather easily with CSS. There aren't a shitton of possible elements to take care of. We can also feature multiple themes and give users the choice. Hell, regarding the board theme, I can attempt something. It would most likely be a dark theme, though, knowing my tastes. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 7/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Shader limits. For whatever reason, trying to specify more than one constant or 9 opdesc's in a shader freezes the GPU.
Probably it's also the case for uniforms. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 8/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Which reminds me of, of course, fragment lighting. It'd be really cool if we figured out how to use that thing. It's one of the big things DMP shows off about the PICA200, too.
Oh, and stencil buffer replacement ops. What the hell is up with those. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 9/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
-> 3dbrew <-
This is where most of the information about the 3DS is available. Documentations for ctrulib will eventually be made. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 10/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
* ctrulib documentation, once it's less subject to abrupt changes
* documentation going over a simple 3DS homebrew example in detail * listing the possible known causes of a PICA200 freeze, guiding users through the PICA200 minefield * tutorial for PICA200 shader assembly, along with details over a simple example (unless a GLSL-like shader language compiler is developed) ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 11/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Shader instructions: Also we gotta find shit like SUB and DIV. SUB could be emulated with MUL*-1 and ADD, and DIV could be emulated with RCP and MUL, but that's hacky. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 12/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Test operation is the following:
[op] d1A, d01, d25 (0x6) d01 holds a texcoord. d25 is a constant set to: 0, 0, 0.5, 1 d1A is a temporary register that is later mov'd to the texcoord output registers. Opdesc 0x6 is declared as follows: .opdesc xyzw, xyzw, zzzz ; 0x6 So, if I got all that junk right, it should really be, in pseudo-GLSL: d1A.xyzw = d01.xyzw [op] d25.zzzz; In practice I must have done something wrong. None of the known opcodes behaved as expected. They either had no effect on the texcoords or turned them into all the same value. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 13/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Okay.
mul d1A, d25, d01 (0x6) <- okay mul d1A, d01, d25 (0x6) <- doesn't work Note the order of operands. (each with a properly adjusted opdesc) ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
(post in restricted forum) |
StapleButter |
| ||
Member blarg Level: 30 Posts: 15/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Posted by StapleButter Need to try odd numbers of them. Maybe it's even number syndrome all over again? ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 16/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Interesting project. What would you recommend me to test it with?
(also reminds me I should probably make the board convert stray URLs to links ) ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 17/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Oh okay, it's all good then!
I'll let you know whenever I get around testing it on real hardware. I'd also recommend that you look into acquiring an exploitable 3DS. Especially if you plan on using the GPU. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 18/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
I guess the way we're going with the low-level GPU API s not the best way.
Those functions can't just be used anywhere, there is an order to them, and that order isn't always obvious. By being modelled after the PICA200 commands, the API is full of oddities. To name a few: * GPU_FinishDrawing() -- still not quite clear when exactly it must be called (best thing to do is to try with and without it) * GPU_SetDepthTestAndWriteMask() -- because the same command does both depth test stuff and color/depth write masks, we get such a weirdass name * GPU_SetBlendingColor() must be called after GPU_SetStencilOp() -- because the GPU freezes if command 0x0106 isn't followed by 0x0103, even if they are unrelated * GPU_SetScissorTest() -- the commands that set scissor test boundaries are already called in the middle of GPU_SetViewport(), which is problematic when trying to use GPU_SetScissorTest() Long story short, the PICA200 is a weird GPU. If we don't accomodate to that in the best way possible, the code will be a nightmare to manage. What they do in official code is store all the GPU configuration somewhere, and only send all the configuration in the correct order whenever geometry has to be drawn. There are some exceptions, but this is how most things are handled. I believe we need to think for a while and make the low-level GPU API more sane before we try to build more stuff (like the planned OpenGL implementation) on top of it. Eventually anything will be a pain if we continue in this weird way. Doing things like they do in official code would help cut down on weirdness. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 19/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Interesting project.
When I'm less busy with blargSNES's hardware renderer, I'll port the shaders it uses, so you can test them. I'll gladly switch to this if it is practical enough. devkitPro integration would be gold, but atleast being readily available for Windows and Linux would do it for me. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
StapleButter |
| ||
Member blarg Level: 30 Posts: 20/184 EXP: 151608 Next: 14261 Since: 10-27-14 From: France Last post: 2660 days ago Last view: 2571 days ago |
Welcome aboard
If you find some of those favorite coders of yours, be sure to tell them about this board Either way we hope you'll enjoy yourself here. Oh and you remind me that a forum for introductions could be a good idea. ____________________ blargSNES -- SNES emu for 3DS More cool stuff |
Main - Posts by StapleButter |
Page rendered in 0.043 seconds. (2048KB of memory used) MySQL - queries: 22, rows: 99/99, time: 0.005 seconds. Acmlmboard 2.064 (2018-07-20) © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |