<![CDATA[exjam]]>https://exjam.github.io/https://exjam.github.io/favicon.pngexjamhttps://exjam.github.io/Ghost 3.1Tue, 03 Dec 2019 17:48:03 GMT60<![CDATA[History of decaf-emu in screenshots - Part 7]]>

A whole year has passed since the last part of this series, unfortunately I did not spend much time working on decaf-emu over that time but I do have some screenshots I can share.

2018-12-23
I started work on trying to make a clean interface to decaf which can be

]]>
https://exjam.github.io/history-of-decaf-emu-in-screenshots-part-7/5de6872a9689e7007a8b416fTue, 03 Dec 2019 17:01:00 GMTHistory of decaf-emu in screenshots - Part 7

A whole year has passed since the last part of this series, unfortunately I did not spend much time working on decaf-emu over that time but I do have some screenshots I can share.

2018-12-23
I started work on trying to make a clean interface to decaf which can be used for debuggers as part of some refactoring work around the imgui based debugger.

History of decaf-emu in screenshots - Part 7

2019-02-04
Be safe out there everyone.

History of decaf-emu in screenshots - Part 7

2019-02-08
Disney Epic Mickey 2 going ingame, albeit at an incredibly low FPS.

History of decaf-emu in screenshots - Part 7

2019-08-18
Around this time I started working on the Qt based debugger, this would be using the same debug interface to decaf that I worked on earlier whilst refactoring the imgui debugger.

The motivation for writing a debugger in Qt was so that we could move rendering of the debugger out of the game window. This was because we were using two Vulkans graphics queues in order to render, one which was responsible for rendering the imgui overlay and the game screens, and one which was used for running the graphics backend. The graphics backend would draw frames as fast as the game provided it, and the display would be running independently at 60 fps just drawing the most recent frame produced by the backend.

Unfortunately it turns out that AMD graphics drivers only support having one Vulkan graphics queue, this would make it difficult to continue with this model of rendering. So I decided that we should move the display to the graphics backend and consequently we would need a replacement for the imgui debugger, as there is no point in a debugger which is tied to the games frame rate.

History of decaf-emu in screenshots - Part 7

2019-08-19
Wow you can select text, amazing!

History of decaf-emu in screenshots - Part 7

2019-09-10
More progress on the debugger.

History of decaf-emu in screenshots - Part 7

2019-09-13
Finally added a disassembly view - which is the most important part of a debugger!

History of decaf-emu in screenshots - Part 7

2019-09-15
Totally did not copy the style from IDA.

History of decaf-emu in screenshots - Part 7

2019-09-22
Added some function outlines, this is about as fancy as the disassembler will get I imagine. I am not looking to make the next Ghidra.

History of decaf-emu in screenshots - Part 7

2019-09-26
This is the first screenshot of a game displaying entirely from the graphics backend, with only a single graphics queue (so in theory, AMD should work now!).

History of decaf-emu in screenshots - Part 7
Should Shovel Knight be the HelloWorld of Wii U emulators?

2019-10-19
Mario Kart 8 is finally running in game again, albeit still ugly as ever. One of the causes of ugliness is the current lack of mipmap support.

History of decaf-emu in screenshots - Part 7

2019-10-26
I do actually use the debugger some times, so maybe it was worth the effort. Here I am stepping through some code in the Internet Browser.

History of decaf-emu in screenshots - Part 7

2019-11-07
There was an open pull request on decaf for a long time implementing a game list. I eventually got around to tackling it, but unfortunately ended up rewriting most of the code.

History of decaf-emu in screenshots - Part 7

This is what a icon list view looks like in Qt by default. I am not sure why anyone would prefer it to behave like this as opposed to neatly ordering. Rest assured the actual icon view looks nicer than this one.

History of decaf-emu in screenshots - Part 7

2019-11-09
So it turns out the decaf-emu svg logo we had that someone made for us a long time ago (sorry I forgot who), was not a real vectorised svg but instead a series of PNG files embedded inside a svg file - which is kind of pointless when you think about it really.

So I spent the day learning how to use inkscape (in terms of UX, you get what you pay for) and remade the logo using vectors.

History of decaf-emu in screenshots - Part 7

And then I learned that SVG has multiple versions and it turns out one of the features I was using for the white stroke outline was not supported in the Qt SVG renderer. So I had to redo the outline again.

History of decaf-emu in screenshots - Part 7

2019-11-09
As you can see, I do not waste my time playing any games and instead spend it all working very hard!

History of decaf-emu in screenshots - Part 7
9/11

2019-11-17
When working on a difficult problem sometimes it just helps to take the time to very carefully draw a visual representation to help understand your problem.

In this case I was working on a new implementation of RECT rendering. For background, the Wii U's GPU supports rendering of RECT primitive types - where they only give you 3 vertices and the GPU magically figures out the 4th vertex. This is not a supported primitive mode in Vulkan and must be emulated using geometry shaders.

History of decaf-emu in screenshots - Part 7

You can see the initial work I did on it in this commit:
https://github.com/decaf-emu/decaf-emu/commit/baf45d318e51a74f9d43f6e2e94f6bb89d36345a

And then Brett came along and improved it, fixing the problems with attributes:
https://github.com/decaf-emu/decaf-emu/commit/d1dcc0921a5423ca5cf60df7f69e398d824d734b

2019-11-17
After fixing a silly bug with GX2PatchDisplayList we were able to go ingame on Super Mario Maker, albeit with a minor problem in that the blocks do not render.

History of decaf-emu in screenshots - Part 7

2019-11-30
I changed the Registers View to match the other widgets, I think it looks nicer.

History of decaf-emu in screenshots - Part 7

2019-11-30
I discovered that you can make the blocks appear in Super Mario Maker when you are placing one of these lil spikey guys. They disappear again as soon as you release the mouse button. But without context from this screenhot we can pretend the game works :).

History of decaf-emu in screenshots - Part 7

2019-12-02
After fixing an even sillier bug in GX2CopyDisplayList we were able to get "in game" on the Internet Browser. However we do not have networking implemented yet so there is not much browsing you can do.

History of decaf-emu in screenshots - Part 7

2019-12-02
Bonus images from testing some games:

History of decaf-emu in screenshots - Part 7

History of decaf-emu in screenshots - Part 7

History of decaf-emu in screenshots - Part 7
LLE of swkbd.rpl works great!

History of decaf-emu in screenshots - Part 7
Wind Waker crashes almost immediately after going in game, this is about as far as you can get.

History of decaf-emu in screenshots - Part 7
Nintendo Land, TODO: Motion controls.

2019-12-03
That brings us to today, sitting here writing this after yet another year has passed. The first commit to the project was in May 2015, so we are already 4.5 years in and we still cannot play 144hz 4k Zelda!! But I feel like decaf-emu is slowly but surely moving in the right direction and the most important thing is that I still enjoy working on this project, even if at times there are some very tedious problems to tackle.

]]>
<![CDATA[History of decaf-emu in screenshots - Part 6]]>

A continuation from the previous post with spam of images from games rendering under Vulkan, followed by the beginnings of the Qt based UI.

2018-11-05
Making nice progress but still have some interesting glitches.
2018-11-05_02-11-35
2018-11-05_02-16-16
2018-11-05_23-41-44
2018-11-05_23-49-50
2018-11-05_23-49-54

2018-11-06
The blocks in New Super Mario Bros U were not rendering correctly.
2018-11-06_00-23-36

2018-11-07
Super Mario

]]>
https://exjam.github.io/history-of-decaf-emu-in-screenshots-part-6/5c2b5c03f7eb9d054663a0d3Tue, 01 Jan 2019 12:55:37 GMTHistory of decaf-emu in screenshots - Part 6

A continuation from the previous post with spam of images from games rendering under Vulkan, followed by the beginnings of the Qt based UI.

2018-11-05
Making nice progress but still have some interesting glitches.
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6

2018-11-06
The blocks in New Super Mario Bros U were not rendering correctly.
History of decaf-emu in screenshots - Part 6

2018-11-07
Super Mario World 3D is looking good and running in game.
History of decaf-emu in screenshots - Part 6

2018-11-07
There were still several bugs with Xenoblade though.
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6

2018-11-09
We moved to doing surface tiling / untiling on the GPU, there were a few performance issues to debug with it though.
History of decaf-emu in screenshots - Part 6

2018-11-12
Still struggling with our new GPU tiling.
History of decaf-emu in screenshots - Part 6

2018-11-27
Meanwhile with some help from SteveLeafo I was able to get h264 rendering working with ffmpeg.
History of decaf-emu in screenshots - Part 6

When you compile without ffmpeg I generate a image to take the videos place.
History of decaf-emu in screenshots - Part 6

2018-12-09
The h264 video in MK8 now plays.
History of decaf-emu in screenshots - Part 6

2018-12-10
Example of the Spir-V code we generate from decompiling shaders. Much time was spent staring at this figuring out what we did wrong.
History of decaf-emu in screenshots - Part 6

2018-12-10
The start of the Qt based UI - the green area is being rendered by Vulkan.
History of decaf-emu in screenshots - Part 6

2018-12-11
I worked on a simple input configuration UI.
History of decaf-emu in screenshots - Part 6

2018-12-11
Inbetween the tedious UI work I am still reverse engineering the internals of the Wii U to further learn things. This is the code that reads meta.xml into a structure in memory, I was looking at this piece of code so I could figure out the layout of the structure.
History of decaf-emu in screenshots - Part 6

2018-12-12
Meanwhile Brett was trying to make performance improvements in the Vulkan renderer.
History of decaf-emu in screenshots - Part 6
History of decaf-emu in screenshots - Part 6

2018-12-17
Trying to get travis and appveyor to build with Qt and Vulkan took a few tries.
History of decaf-emu in screenshots - Part 6

2018-12-21
First I got the debug ui rendering in Qt + Vulkan.
History of decaf-emu in screenshots - Part 6

Then like 30 minutes later I had the game rendering too!
History of decaf-emu in screenshots - Part 6

2018-12-22
Super Mario 3D World running in decaf-qt + Vulkan.
History of decaf-emu in screenshots - Part 6

I also recorded a video of Super Mario 3D World in decaf-qt, note that the audio is horrendous.
]]>
<![CDATA[History of decaf-emu in screenshots - Part 5]]>

In August 2018, Brett returned to the project and started work on a Vulkan renderer. Unfortunately I do not have much commentary to add here because the majority of the Vulkan work was not done by me.

2018-10-02
The first screenshot of a game rendering in Vulkan.

2018-10-02_23-03-50

2018-10-03
Figuring out

]]>
https://exjam.github.io/history-of-decaf-emu-in-screenshots-part-5/5c2b4b4ac63c7500b9ce8727Tue, 01 Jan 2019 12:55:13 GMTHistory of decaf-emu in screenshots - Part 5

In August 2018, Brett returned to the project and started work on a Vulkan renderer. Unfortunately I do not have much commentary to add here because the majority of the Vulkan work was not done by me.

2018-10-02
The first screenshot of a game rendering in Vulkan.

History of decaf-emu in screenshots - Part 5

2018-10-03
Figuring out why things don't work involves alot of time staring at things like these.

History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5

2018-10-17
The first game to be playable in Vulkan is Shovel Knight!

History of decaf-emu in screenshots - Part 5

2018-10-22
Mario Kart 8 was getting ingame, but still showing only a black screen just like with the OpenGL renderer.

History of decaf-emu in screenshots - Part 5

2018-10-29
This was the beginning of a long battle with getting the Mario Kart 8 characters to render correctly.
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5

2018-11-02
Barbie looking as great as ever.
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5

2018-11-03
Some small progress with the MK8 characters and other games.
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5

2018-11-04
Trying to fix issues with Super Mario 3D World.
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5

2018-11-04
Finally fixed Mario Kart 8 rendering!
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5

Kind of...
History of decaf-emu in screenshots - Part 5
History of decaf-emu in screenshots - Part 5

I had to split this into another post, part 6, because there were too many megabytes of images and it would be rude to people's internet.

]]>
<![CDATA[History of decaf-emu in screenshots - Part 4]]>

There has been a total of 1211 commits since the last blog post, so we are probably overdue another update.

Unfortunately there has not been many screenshots until fairly recently as I continued to dive deeper down into the rabbit holes I mentioned in the previous post and ended up

]]>
https://exjam.github.io/history-of-decaf-emu-in-screenshots-part-4/5c2b3842c63c7500b9ce8722Tue, 01 Jan 2019 11:12:45 GMTHistory of decaf-emu in screenshots - Part 4

There has been a total of 1211 commits since the last blog post, so we are probably overdue another update.

Unfortunately there has not been many screenshots until fairly recently as I continued to dive deeper down into the rabbit holes I mentioned in the previous post and ended up completely rewriting the core of the emulator so that we have a boot process which matches similarly to the real system. This means that in decaf-emu we start by booting IOS, and then IOS MCP process boots the Cafe Kernel which in turn boots the Loader process to load the CafeOS userland. I then went on to rework the CafeOS userland such that one day we could support multiple processes, as the Wii U can have both a foreground and background process running (like when a game opens the Internet Browser), as well as a few other system ones such as the Loader or the Home Button Menu. During this process, which took over a year, I was not even able to compile my emulator let alone run a game in it.

2017-05-08
At the end of the previous post I mentioned one of my goals was to create a latte shader assembler, turns out I started work on it the next day.

History of decaf-emu in screenshots - Part 4

2017-05-10
And 2 days later, the initial commit of it!

github: 7c8466cc197b84be3a7598da8bed8bccc27c40d2

2017-05-12
I then went on to experiment with the idea of implementing something like dolphin's FifoCI for automated testing of graphics. Unfortunately our PM4 (the communication protocol with the AMD R600 series GPUs) replay mechanism is not yet mature enough to make this tool useful so it was shelved for now. But you can see from this screenshot I had the replay dumping each frame to images, which when the tool is ready would be used to compare against previous images and automatically detect changes to notify us of regressions.

History of decaf-emu in screenshots - Part 4

github: 5a954424f49b33ac74889d88981e52e25192099c

2017-05 to 2017-07
Nothing notable happened here, just many small bug fixes and improvements to code quality.

2017-08 onwards
This is when I seriously started work on the huge rewrite which goes on to take up a year of my life. The first step was to completely emulate the whole IOS operating system, in the previous blog I talked about doing IOS but that was only implementing IOS devices which coreinit could ioctl with. Unfortunately because of this there are not many screenshots to show between here and when I finally finished this effort.

2017-09-23
Shoutout to Nintendo for always leaving us behind some useful debug information.

History of decaf-emu in screenshots - Part 4

2017-09-24
You discover some fun things when reversing the internals, like the fact that the Wii U apparently supports using ~ in paths for your "home directory". Although I cannot remember where ~ actually points to.

History of decaf-emu in screenshots - Part 4

2017-10-03
I found where the IOS_MCP process initialises the filesystem, this was useful.

History of decaf-emu in screenshots - Part 4

2017-10-06
This is from the Loader, this is the list of binaries of which their text/code sections are loaded into a shared memory area which all processes will use.

History of decaf-emu in screenshots - Part 4

2017-10-10
Here you can see that the MCP process in IOS is responsible for powering on / off the PPC processor.

History of decaf-emu in screenshots - Part 4

2017-10-11
Taking notes whilst trying to figure out the full path to get into a userland process. Note I cannot vouch for the accuracy of this as I don't know if these were my final notes or not, this is just a screenshot taken at a moment in time.

History of decaf-emu in screenshots - Part 4

2017-10-11
Sometimes IDA generates fun graphs.

History of decaf-emu in screenshots - Part 4

2018-05-11
Shoutout to one of my personal heroes.

History of decaf-emu in screenshots - Part 4
History of decaf-emu in screenshots - Part 4

2018-05-22
I was also working on improving wut (my Wii U Toolchain for writing homebrew) alongside my work on decaf, especially as I had spent so much time reversing the real Loader I had much more knowledge of what was possible. I discovered that there was a custom relocation type which was perfect for translating R_PPC_REL32 relocations in the .elf files output by gcc into .rpx files compatible with the Wii U.

History of decaf-emu in screenshots - Part 4

github: wut/tools/elf2rpl

2018-06-13
This is a homebrew made with wut using the official swkbd.rpl

History of decaf-emu in screenshots - Part 4

github: wut/samples/swkbd

2018-08-02
Reversing and coding an implementation identical to the official loader was hard work and at time of writing this blog it stands at 8,469 lines of code over 45 files.

History of decaf-emu in screenshots - Part 4

github: decaf-emu/cafe/loader

2018-08-16
Finally able to load games again, over a year after the huge rewrite begun. I love this screenshot because it represents the result of a full year of reverse engineering and programming where I could not even compile my code, let alone succesfully load a game. It also shows something I think is pretty cool, you can see see in the Memory window all our internal HLE functions, I rewrote how our HLE implementation interacts with the userland processes so that we now actually generate a .rpl file at runtime for each HLE library with its function and data exports which are then loaded by the Loader process as it would with a real .rpl. I thought this was cool, but I imagine the concept would require much more explaining to fully appreciate.

History of decaf-emu in screenshots - Part 4

2018-08-27
Fixing a few bugs here and there in the huge rewrite and games start working again.

History of decaf-emu in screenshots - Part 4

2018-08-31

That "filesystem bug" mentioned in the previous blog was actually a bug in the jit with the rlwinm, many many many thanks to Kinnay for finding this. It was slowly driving me crazy as I could not figure out the issue myself. This went on to make many games work again, including all Unity engine games such as this very important historical piece:

History of decaf-emu in screenshots - Part 4

bitbucket: libbinrec Issue#8

2018-09-11
IDA is normally more useful than this. }}}}}}} promise }}}}}}}}}}}}}}}}}}}}}.

History of decaf-emu in screenshots - Part 4

2018-09-16
Emulating an emulator.

History of decaf-emu in screenshots - Part 4

2018-09-25
Mario Kart 8 is getting in game again.

History of decaf-emu in screenshots - Part 4

2018-09-30
I got slightly distracted and wrote a small console output library for the Wii U which supports all the things one would expect from a console. Except I never got around to adding it to wut, maybe one day. My original intention was to use it to write a fancy exception handler for wut which provided more useful information and could allow homebrew to exit gracefully upon encountering an error.

History of decaf-emu in screenshots - Part 4

ramblings
To others this may not have been the most interesting year, afterall this was the year of people proclaiming "decaf is dead" whilst I quietly slaved away slowly marching onwards to achieve my own personal goals. I think some people forget what these complex long-term programming projects mean to their authors, although I can only speak for myself. decaf-emu fulfills a role of artistic expression in my life and is a long term project to focus my ambitions and desires for continuous learning, exploration and self improvement. I learnt so much about the internals of the Wii U so this was probably my favourite year yet. There was some great refactoring and rewriting of the core internals of the emulator, along with many bug fixes and improvements, such that I can say I am feeling more proud of what we have achieved. Of course we still have a long way to go, but we made some amazing steps in the right direction.

Check out part 5 and part 6, for lots of images from the recent Vulkan backend.

]]>
<![CDATA[History of decaf-emu in screenshots - Part 3]]>

Apologies for the non-coders who view this post, these are pretty much all screenshots of code as I have not been focusing on testing and trying to fix many games this year. It's important to remember I view decaf-emu as an experiment in software engineering, it is my playground to

]]>
https://exjam.github.io/history-of-decaf-emu-part-3/5af8251f2b0ff0098d21c605Mon, 08 May 2017 00:00:00 GMTHistory of decaf-emu in screenshots - Part 3

Apologies for the non-coders who view this post, these are pretty much all screenshots of code as I have not been focusing on testing and trying to fix many games this year. It's important to remember I view decaf-emu as an experiment in software engineering, it is my playground to have fun, test new programming ideas and to be a good opportunity to write some quality code. Although saying that, after Part 2 I'm sure we're all a bit bored of screenshots of game menus.

This is the 3rd and final part - consider reading part 1, and part 2 first.

2017-02-17 18:17:16
I updated the Windows build to also use CMake - this is great because it creates less of a maintenance nightmare. At this time both Windows devs (Brett and I) were not working on the project so any change achurch or others pushed would break the Windows build. So instead of having to maintain two separate build systems I did the obvious thing and started working on a unified CMake.
History of decaf-emu in screenshots - Part 3

2017-02-23 22:02:04
With my new found knowledge of CMake I decided to port my Wii U toolchain wut to CMake also, this should make it much easier to write Wii U homebrew - the old Makefiles were a confusing mess! The benefit of this for decaf-emu would be so that we could integrate test homebrew into the decaf CMake build system.
History of decaf-emu in screenshots - Part 3

2017-03-13 20:44:19
One of my pet projects that I had been trying to do for a long time was to rewrite our implementation of the coreinit.rpl filesystem emulation from the ground up to be much more close to the original implementation in coreinit.rpl. This was a nightmare to reverse, especially the FS State Manager which I still don't fully understand!
History of decaf-emu in screenshots - Part 3

2017-03-21 21:06:59
I really jumped down the rabbit hole when rewriting the filesystem - I ended up reversing it all the way to the IOS layer where it communicates over IPC with the ARM chip in the Wii U. This is actually a very important change, having IOS emulation is great as it allows for some exciting stuff in the future. For example many system libraries use the IOS to communicate with hardware devices, this means we would be able to do cool stuff like USB or Bluetooth passthrough for supporting peripherals such as Wii motes. It also opens the door for low level emulation of system libraries which rely on IOS.
History of decaf-emu in screenshots - Part 3

2017-03-22 22:12:36
The actual control flow of a filesystem operation is quite complex - that's why writing good comments is useful. I'd never remember this if I came back to it later without a written explanation.
History of decaf-emu in screenshots - Part 3

2017-03-23 00:43:03
The new filesystem with IOS IPC works - that complicated control flow which spans multiple threads and interrupts as seen in the previous screenshot actually all works!
History of decaf-emu in screenshots - Part 3

2017-03-24 17:34:10
Obviously this meant I had to rewrite every single filesystem command, with reversing the serialisation to the IOS IPC buffers and then implementing the command over in the IOS FSA driver. There's a lot of commands!
History of decaf-emu in screenshots - Part 3

2017-03-28 17:16:43
At the same time I was also trying to help achurch with debugging the last remaining issues in his amazing new JIT that he wrote for decaf-emu, libbinrec. It's an incredible effort, it decompiles PPC to an internal representation then performs optimisation passes over to generate some beautifully optimised x64. I was very impressed by the comprehensive test suite he wrote for his new library, there was 3296 of them!
History of decaf-emu in screenshots - Part 3

2017-04-01 01:18:54
The new JIT was finally working, and we even had a small JIT stats debug UI.
History of decaf-emu in screenshots - Part 3

2017-04-03 21:40:08
One last thing I wanted to make sure worked before merging the JIT was debugging. I modified our breakpoints to write actual trap instructions and then invalidate the JIT code cache in the region the breakpoint was placed. So that when the JIT recompiles the function it will see the tw and emit a handler which processes the breakpoint and returns control to the debugger. The debugger will fall back to the interpreter for stepping through instructions, or when properly resumed will continue with the JIT.
History of decaf-emu in screenshots - Part 3

2017-04-05 00:37:07
I decided to start playing around with low level emulation of system libraries. Previously we had to reimplement every single library by hand in C++ function by function, which is a slow and tedious process. It is also would be a very bad approach in the long term, for example some system libraries are simply drivers around USB devices. Now that we have IOS support it would be much better to allow USB passthrough to these LLE libraries rather than have to implement our own USB drivers! The LLE approach is only suitable for non performance critical libraries, and for any library which does not directly use MMIO. This would exclude the important libraries, coreinit, gx2 and snd_core. For example however, erreula.rpl is a great candidate - it's a system library which sole purpose is to display error messages on the screen, and now by LLEing it Bit Trip Runner 2 the game now shows an error message instead of a black screen:
History of decaf-emu in screenshots - Part 3

2017-04-05 10:51:11
I tried playing around with LLE of swkbd.rpl, and now the Wii U system keyboard almost works in Xenoblade. There is lower level functionality it relies on which I did not implement yet so it's not useable but it's another great candidate for LLE. It's also cool to see the real Wii U keyboard in decaf-emu!
History of decaf-emu in screenshots - Part 3

2017-04-06 14:03:19
A big part of emulation is figuring out the system internals, I finally got around to writing a much nicer RPC server/client for the Wii U which lets me easily prod at Wii U functions from python. Thanks to all the recent strides in Wii U homebrew it's much easier now than it is before, no more messing around with browser exploits, I can simply compile a .rpx using my toolchain, upload it to my console via FTP, and run it from homebrew launcher!
History of decaf-emu in screenshots - Part 3

2017-04-06 23:02:45
My IOS IPC reversing days are far from over, after figuring out the IOS device /dev/fsa for the filesystem, I now moved onto reversing /dev/mcp for the MCP_ family of functions. These were much harder to reverse but I have made some progress. MCP is responsible for title management (installed games, patches and DLC).
History of decaf-emu in screenshots - Part 3

2017-04-07 14:40:35
After reworking the debugger for the new JIT and trying to debug some issues for some games, I found myself cross referencing our debugger and the same code in IDA, so i thought why not merge the two and expose decaf-emu's debugger as GDB stub which IDA can connect to. Hopefully this will be useful for some people, but I also found it rewarding because it allowed me to clean up all the debugger code which I have wanted to refactor for a long time!
History of decaf-emu in screenshots - Part 3

2017-04-16 02:07:46
I finally started looking into the issue with the new Zelda title, an allocation was failing due to us not providing the game with enough memory. A simple hack is to increase the memory available to games, but that is not the correct approach. I ended up rewriting the whole virtual memory management and physical memory mapping from scratch to now be much more accurate with how a real console works. In line with my low level IOS work I've been doing lately I decided to jump down that rabbit hole once again. I ended up implementing the virtual memory stuff as kernel syscalls as they are on the console, and used my new python RPC tool to prod at the actual virtual memory map on the console to reproduce the same mappings in decaf. Then I decided to re-evaluate our approach to accessing virtual memory from HLE code and ended up trying to write a much safer way of using it which is what is shown in this screenshot. Sorry for those people who don't know C++ ;D.
History of decaf-emu in screenshots - Part 3

2017-04-21 11:50:17
I decide to bring my previous works with CMake together and integrate building the HLE unit tests with my toolchain wut from inside the decaf-emu tree. It even works from inside the Visual Studio solution!
History of decaf-emu in screenshots - Part 3

2017-04-24 18:16:56
A new game boots.
History of decaf-emu in screenshots - Part 3

2017-04-26 13:29:46
After unifying the test building, I can now use CTest to actually execute the tests. A great step forward for automated testing of the emulator, now we just need to write thousands of tests... simple! And also write a framework to get these tests running automated on console so we can match up results to verify behaviour.
History of decaf-emu in screenshots - Part 3

2017-04-26 13:29:46
Playing around with a POC of a Qt based PM4 graphical debugger tool. This tool would allow you to inspect the state of the latte GPU and would function similar to how graphical debuggers work for OpenGL / DirectX etc. This is a significant amount of work however, and I'm not sure how valuable the gains are, I feel effort is better spent in gx2 unit tests and hardware testing.
History of decaf-emu in screenshots - Part 3

2017-05-03 01:03:51
An example of the as-of-yet unsolved mysterious filesystem bug. Unity games all behave like this right now:
History of decaf-emu in screenshots - Part 3

2017-05-05 18:26:42
Another prime example of games with full function symbols included being very useful in the development process. Here I was working on a library for wut to allow easy loading of GFD files (which are files that can store shaders and textures). This is the first step towards easier use of GX2 from homebrew (and more importantly, graphical tests for decaf!).
History of decaf-emu in screenshots - Part 3

2017-05-08 01:51:06
A triangle is the "hello world" of graphics programming.
History of decaf-emu in screenshots - Part 3

Future
So what's the future of decaf-emu going to look like? At this point our weakest area is the GPU emulation, so most of my ideas are around that. Some of the things I have been thinking about are:

  • Fix the mysterious file system bug - ever since I rewrote the file system several games are failing in file system related functions for no apparent reason. Including most (all?) Unity engine games (Meme Run!!!), also seen in sound loading functions for several games which presumably are sharing the same library code.
  • Improve PM4 replay recording - fix texture size bug (now fixed), reduce file size of replays by supporting memory diffs.
  • PM4 replay GUI.
  • Vulkan graphics backend - it's good to write a new backend from scratch using the knowledge we've gained, hopefully it will clean out some of the organically grown mess from the GL backend.
  • latte shader assembler, super important for homebrew and for GX2 tests.
  • GX2 graphics unit tests, with results dumped from console to compare to decaf.
  • Something like dolphin's FifoCI using our PM4 replay tool.
  • Improve the interface between gx2.rpl and our GPU emulation. This involves another one of those low level rabbit holes I seem to enjoy diving down lately. More accurate emulation of the GPU ringbuffer control via tcl.rpl, and hardware display control via dc.rpl and avm.rpl.
  • More code documentation!
  • More HLE unit tests.
  • Framework for running HLE unit tests on console and comparing results with decaf-emu.
  • Figure out ways to improve the development infrastructure to help new and existing developers.
]]>
<![CDATA[History of decaf-emu in screenshots - Part 2]]>

So we're coming off of a few months break - but I was determined to not let this project die like all of our other projects we have worked on over the years! If you havn't seen it, you should probably first read part 1.

2016-05-31 20:27:06
So

]]>
https://exjam.github.io/history-of-decaf-emu-in-screenshots-part-2/5af8251f2b0ff0098d21c604Mon, 01 May 2017 00:00:00 GMTHistory of decaf-emu in screenshots - Part 2

So we're coming off of a few months break - but I was determined to not let this project die like all of our other projects we have worked on over the years! If you havn't seen it, you should probably first read part 1.

2016-05-31 20:27:06
So Mario Kart 8 finally shows something.
History of decaf-emu in screenshots - Part 2

2016-06-07 12:01:54
Trying to debug why text rendering is broken in NES Remix.
History of decaf-emu in screenshots - Part 2

2016-06-07 14:45:27
History of decaf-emu in screenshots - Part 2

2016-06-08 11:04:51
Fixed a few graphical errors and now getting close to ingame with NES Remix.
History of decaf-emu in screenshots - Part 2

2016-06-11 02:57:45
Brett started work on an awesome new debugger using imgui.
History of decaf-emu in screenshots - Part 2

2016-06-16 02:27:22
A more complete debugger in action!
History of decaf-emu in screenshots - Part 2

2016-06-18 11:53:36
Some other emulator developer said that Shovel Knight was the first game they got in game, so let's try that out instead.. Something's happening...
History of decaf-emu in screenshots - Part 2

2016-06-18 11:55:22
I guess he was right! We're in a game playable for the first time ever on decaf-emu! Albeit upside down and several other graphical bugs.
History of decaf-emu in screenshots - Part 2

2016-06-26 21:55:59
Rendering upside down was a simple fix to change from OpenGL to DirectX clipping space using ARB_clip_control
History of decaf-emu in screenshots - Part 2

2016-06-28 20:10:35
A few days later and Shovel Knight was looking much better!
History of decaf-emu in screenshots - Part 2

2016-07-03 10:15:00
Angry Birds Star Wars is a thing that exists apparently.
History of decaf-emu in screenshots - Part 2

2016-07-04 16:23:54
Time to take a look at NES Remix again... looks bad.
History of decaf-emu in screenshots - Part 2

2016-07-04 16:53:50
Much better! Now NES Remix was playable (with a few graphical glitches still).
History of decaf-emu in screenshots - Part 2

2016-07-04 20:25:59
Upside down, back to front, inside out, we've seen it all over here!
History of decaf-emu in screenshots - Part 2

2016-07-10 02:03:59
Brett had a never ending battle with Mario Kart 8, the game kept winning though.
History of decaf-emu in screenshots - Part 2

2016-07-10 14:31:54
We began to see progress in other quality Wii U titles such as Family Tennis SP!
History of decaf-emu in screenshots - Part 2

2016-07-14 17:29:10
Angry Birds isn't just a mobile game, it's also a buggy game on decaf-emu.
History of decaf-emu in screenshots - Part 2

2016-07-25 22:14:32
Someone requested that I get homebrew working in decaf, so I did. Many homebrews were using the OSScreen functions to render to screen, which no game uses.
History of decaf-emu in screenshots - Part 2

2016-07-28 14:45:52
More games were showing progress, things were getting exciting.
History of decaf-emu in screenshots - Part 2

2016-08-03 11:54:59
After much persistence from Brett, Mario Kart 8 actually reached the menu.
History of decaf-emu in screenshots - Part 2

2016-08-12 13:10:49
Xenoblade Chronicls X is a special game in decaf history, because it was consistently worked on by the achurch, he did amazing work over the next few months to fix graphical errors in this game.
History of decaf-emu in screenshots - Part 2

2016-08-13 00:03:42
Xenoblade progress.
History of decaf-emu in screenshots - Part 2

2016-08-17 23:33:33
In the mean time I was working on much more important things such as trying to figure out why Meme Run wasn't working.
History of decaf-emu in screenshots - Part 2

2016-08-18 00:42:36
Xenoblade showing nice progress thanks to achurch!
History of decaf-emu in screenshots - Part 2

2016-08-18 00:44:54
Xenoblade character ceration!
History of decaf-emu in screenshots - Part 2

2016-08-19 01:43:11
8 Bit Hero boots.
History of decaf-emu in screenshots - Part 2

2016-08-19 15:00:00
Revolutionary update, Meme Run works in game.

2016-08-22 12:22:17
Mario Party 10 boots.
History of decaf-emu in screenshots - Part 2

2016-08-22 17:18:13
Xenoblade in game!!! Awesome!
History of decaf-emu in screenshots - Part 2

2016-08-22 22:24:59
A game brought to my attention by a friendly youtube emulator tester JohnGodGames / pcmaker. He was very helpful during this time of development regularly testing updates and providing us with logs from his huge collection of games so we could fix issues.
History of decaf-emu in screenshots - Part 2

2016-08-26 10:54:37
Mii Maker has a few issues...
History of decaf-emu in screenshots - Part 2

2016-08-26 10:56:33
Mario Kart 8 showing progress.
History of decaf-emu in screenshots - Part 2

2016-08-28 12:34:16
Started work on a tool to record and replay PM4 graphical traces. Will be immensely helpful in debugging graphical issues.
History of decaf-emu in screenshots - Part 2

2016-08-29 04:26:58
Sometimes games output useful debug information.
History of decaf-emu in screenshots - Part 2

2016-08-29 22:43:38
Sonic Lost World.
History of decaf-emu in screenshots - Part 2

2016-08-30 02:48:04
Chariot in game.
History of decaf-emu in screenshots - Part 2

2016-08-31 05:18:20
Mario Party 10 in game.
History of decaf-emu in screenshots - Part 2

2016-09-03 02:31:36
New Super Mario Bros U.
History of decaf-emu in screenshots - Part 2

2016-09-04 03:14:30
Barbie Puppy Rescue.
History of decaf-emu in screenshots - Part 2

2016-09-04 15:03:44
Fast Racing NEO.
History of decaf-emu in screenshots - Part 2

2016-09-04 20:50:53
Mario Kart 8 "in game".
History of decaf-emu in screenshots - Part 2

Then we got burnt out and took another break...

Part 3

]]>
<![CDATA[History of decaf-emu in screenshots - Part 1]]>

Both Brett and I use this screenshot upload service called puu.sh, turns out it's a great way to track the history of your life. Here's what we have of decaf over the years.

2015-05-18 19:58:18
decaf-emu (or wiiu-emu as it was known back then) started as a

]]>
https://exjam.github.io/history-of-decaf-emu-in-screenshots-part-1/5af8251f2b0ff0098d21c603Wed, 26 Apr 2017 22:40:00 GMTHistory of decaf-emu in screenshots - Part 1

Both Brett and I use this screenshot upload service called puu.sh, turns out it's a great way to track the history of your life. Here's what we have of decaf over the years.

2015-05-18 19:58:18
decaf-emu (or wiiu-emu as it was known back then) started as a simple file loader for the Wii U .rpx files
History of decaf-emu in screenshots - Part 1

2015-05-19 00:53:56
The day after that first screenshot we have the first ever commit:

Initial commit.
Can load WiiU compressed .ELF files into memory with symbols & relocations.

https://git.io/v9OiY

2015-05-20 18:03:19
Looks like we have the beginnings of a PPC interpreter going on here.
History of decaf-emu in screenshots - Part 1

2015-05-24 22:05:59
My first HLE functions!
History of decaf-emu in screenshots - Part 1

2015-06-29 05:19:16
First run of the JIT against a real game.
History of decaf-emu in screenshots - Part 1

2015-07-03 12:47:49
Looks like we have a reasonable amount of functions implemented at this point - in this screenshot we can see memory allocation and file system usage. Followed by a crash!
History of decaf-emu in screenshots - Part 1

2015-07-08 17:14:01
We are now 2 months in and from this screenshot you can see we already have our first fiber based thread scheduler and quite a few coreinit functions implemented (and I presume a pretty solid PPC interpreter if we are getting this far).
History of decaf-emu in screenshots - Part 1

2015-07-27 14:33:30
The humble beginnings of a latte shader decompiler.
History of decaf-emu in screenshots - Part 1

2015-10-12 14:39:15
Seems like we figured out how texture storage "works" (we are yet to have many problems with the peculiarities of GPU texture swizzling!).
History of decaf-emu in screenshots - Part 1

2015-10-13 22:01:33
And shader storage...
History of decaf-emu in screenshots - Part 1

2015-10-13 23:05:11
Which means... our first rendering! This is from the system application Amiibo Settings.
History of decaf-emu in screenshots - Part 1

2015-10-20 04:59:13
Testing the accuracy of your CPU emulation for all edge cases is quite important!
History of decaf-emu in screenshots - Part 1

2015-10-28 20:15:53
This was the first game running in the emulator, if you look hard enough you might be able to tell this is actually NES Remix. Looks like we've switched to the name decaf here.
History of decaf-emu in screenshots - Part 1

2015-10-28 21:55:21
Now that looks more like it...!
History of decaf-emu in screenshots - Part 1

2015-10-29 00:47:18
Figuring out registers was fun...
History of decaf-emu in screenshots - Part 1

2015-10-29 02:36:29
Progress in emulation is not always forwards.
History of decaf-emu in screenshots - Part 1

2015-10-30 02:49:55
So we're now 5 months in and we have something which looks like a game! Awesome! Except it's totally wrong and we're going to redo all the graphics from scratch again, great!
History of decaf-emu in screenshots - Part 1

2015-11-11 22:25:39
In November we decided to move to using PM4 for encoding our GPU instructions just as the real Wii U does. PM4 is the data format that the AMD gpu uses to communicate with the graphics drivers running on the CPU.

Start fleshing out this whole pm4 / gx2 / driver stuff.
https://github.com/decaf-emu/decaf-emu/commit/a868521c2ffcc9248bde44f056dfa740fb93c58f

2015-11-23 15:35:27
Untiling / unswizzling was non-trivial to figure out! Please excuse my mouse cursor.
History of decaf-emu in screenshots - Part 1 History of decaf-emu in screenshots - Part 1 History of decaf-emu in screenshots - Part 1

2015-11-23 17-51-38
Once we started gaining some interest from the outside world we decided to switch to OpenGL in an attempt to attract Linux developers to the project. So we're back to being unable to render Amiibo Settings correctly.
History of decaf-emu in screenshots - Part 1

2015-11-24 18:47:35
Trying to figure out why nothing is working by using the NVIDIA debug tools.
History of decaf-emu in screenshots - Part 1

2015-11-26 17:38:37
It didn't take that long to get back to where we were before with the old DX12 renderer. But now we were using OpenGL with our much more accurate PM4 pipeline for feeding commands to the GPU instead of a custom format!
History of decaf-emu in screenshots - Part 1

2015-11-26 23:30:50
It wasn't perfect though.
History of decaf-emu in screenshots - Part 1

2015-12-02 15:34:24
With the Wii U we were fortunate enough to have games compiled with full function symbols which made some things easier to reverse!
History of decaf-emu in screenshots - Part 1

2015-12-12 16:07:43
One step backwards..
History of decaf-emu in screenshots - Part 1

2015-12-19 14:13:30
But two steps forward! A second game running in the emulator, I believe this is one of the Mario games.
History of decaf-emu in screenshots - Part 1

2015-12-20 15:18:28
Oh yeah it's Super Mario 3D World.
History of decaf-emu in screenshots - Part 1

So it's about 7 months after we started, we've made some progress, but it's a long time to work on stuff without any playable results and we're a bit burnt out so we both took a break.

Part 2

]]>
<![CDATA[ROSE Online in the browser]]>

A story in pictures - aka how three.js and javascript enables you to make shit real quick.

ROSE Online is an MMORPG that Brett and I had huge amounts of development experience in, our coding careers (and friendship!) began in the private server emulation scene back in around 2008

]]>
https://exjam.github.io/rose-online-in-the-browser/5af8251f2b0ff0098d21c602Wed, 26 Apr 2017 22:34:00 GMTROSE Online in the browser

A story in pictures - aka how three.js and javascript enables you to make shit real quick.

ROSE Online is an MMORPG that Brett and I had huge amounts of development experience in, our coding careers (and friendship!) began in the private server emulation scene back in around 2008 when we were like 14 years old or something. Fast forward several years and suddenly one day I receive a message from Brett Lawson saying he wants to try make a ROSE client in the browser with WebGL and three.js, after some discussion we got a bit carried away and suddenly it's 30 days later and we've barely slept, but we actually came up with something pretty impressive.

The source code for this project is available on github: https://github.com/brett19/rosebrowser

All the screenshots and their timestamps come from both of our puu.sh accounts.

2014-09-15 02:54:55
It all started on the 15th September 2014 at 02:54:55am, where we rendered a simple heightmap and tileset.
ROSE Online in the browser

2014-09-15 02:55:39
10 minutes later we could render a full map with the correct tilemap.
ROSE Online in the browser

2014-09-15 03:43:35
About 50 minutes later we could render the static objects on a map too... In roughly 1h30m we managed to go from nothing to this:
ROSE Online in the browser

2014-09-16 03:37:11
Starting on rendering NPCs.
ROSE Online in the browser

2014-09-17 02:08:07
We have some basic character rendering started. It's possible we have a network connection to the server here too as this is a character standing on the character select map.
ROSE Online in the browser

2014-09-17 04:12:19
Trying to get lightmaps working here.
ROSE Online in the browser

2014-09-19 02:44L04
Looking pretty amazing with lightmaps!
ROSE Online in the browser

2014-09-19 10:21:49
4 days in to the project now and we have the map rendering with full lightmaps and water rendering
ROSE Online in the browser

2014-09-21 06:04:42
After only 6 days we were able to get in game, move around, and see other players.
ROSE Online in the browser

2014-09-21 06:23:40
However we clearly still had some rendering issues.
ROSE Online in the browser

2014-09-23 01:27:00
Then our attention turned to particle effects, after 1-2 days of work we had particle effects working, parsing from the .PTL and .EFT files.
ROSE Online in the browser

2014-09-23 08:04:37
Looks like we fixed an error with tilemaps here.
ROSE Online in the browser

2014-09-28 04:19:42
Getting monsters rendering!
ROSE Online in the browser

2014-09-29 02:25:22
Time to get started on a user interface.
ROSE Online in the browser

2014-09-29 02:31:25
And time to focus on playability, this was our first properly functioning character select screen.
ROSE Online in the browser

2014-09-29 02:32:26
Conversations with NPCs were based off local .CON files, which referenced strings in .STL files.
ROSE Online in the browser

2014-09-29 02:36:25
They also relied on .QSD files to allow for conditions / actions to happen to decide what text to show you or what action to take on clicking text.
ROSE Online in the browser

2014-10-03 03:48:04
So less than 3 weeks have passed and we have something resembling a functional client...
ROSE Online in the browser

2014-10-03 03:48:37
It still has it's entertaining bugs though, we used a downwards raycast to calculate where to place an NPC, except this one is meant to stand under a tent...
ROSE Online in the browser

2014-10-03 06:44:02
Entertaining bug #2.
ROSE Online in the browser

2014-10-03 06:38:50
Basic attempt at in game combat.
ROSE Online in the browser

2014-10-04 01:27:58
Now we had combat in the game, I really wanted to get the client into a position where we could complete the first quest line to get access to your profession, here's the Quest UI which shows your progression along your active quests.
ROSE Online in the browser

2014-10-04 01-57-40
Getting pretty excited here, I am able to progress along the job quest, kill the flowers and take their precious seeds!
ROSE Online in the browser

82014-10-04 02:08:54*
Ahhh after some hardcore grinding I'm about to complete the job quest and get my job!
ROSE Online in the browser

2014-10-04 02:10:31
Fuck... maybe next time.
ROSE Online in the browser

2014-10-07 03:15:22
What other features does an MMO client need? Parties! Now i can finally send Brett abusive messages in private (and we completed a job quest together!)
ROSE Online in the browser

2014-10-08 02:21:46
Wow! It runs on an Android tablet.
ROSE Online in the browser

2014-10-08 04:09:40
Awful frame times in game though (~250ms).
ROSE Online in the browser

2014-10-08 05:35:31
Added displaying for character and status related particles.
ROSE Online in the browser

2014-10-08 07:51:55
Looking pretty good with the interface!
ROSE Online in the browser

2014-10-10 02:32:10
Frame profile.
ROSE Online in the browser

2014-10-13 07:48:37
It's been a month and we made some amazing progress, but after working on it all day every day we just got burnt out. Here was one of the last screenshots I made before we stopped, it's the first screen you see when you open your browser.
ROSE Online in the browser

2014-10-20 03:46:09
Bonus picture of when I was trying to fiddle with character hitboxes a week later when I was bored.
ROSE Online in the browser

2014-10-26 09:56:05
Bonus picture #2 showing top down view of terrain chunking in action.
ROSE Online in the browser

]]>
<![CDATA[My first emulator: psp2c]]>

I went with a bit of an unusual approach with my first emulator. It translated PSP games to C files which you compile to an .exe! This was back in 2010.




]]>
https://exjam.github.io/psp2c/5af8251f2b0ff0098d21c601Wed, 26 Apr 2017 22:00:00 GMTMy first emulator: psp2c

I went with a bit of an unusual approach with my first emulator. It translated PSP games to C files which you compile to an .exe! This was back in 2010.

My first emulator: psp2c
My first emulator: psp2c
My first emulator: psp2c
My first emulator: psp2c

]]>