Jump to content

[EXTRA1 Linux Port done!] Ao no Kanata no Four Rythm + EXTRA1 Linux Port & +18 Patch for Nintendo Switch


loam

Recommended Posts

November 2021 message (I don't want to bump the thread):

Hey there, it's been a while. I came back and just read messages from october last year, lol.

There's been updates to the game but they've been somewhat trivial afaik, so I don't think it merits setting up again my whole setup for the project.

Also, I think I have spotted at least one instance of someone attributing the patch to someone called "trigger_segfault". I don't think this was done in bad faith or anything, probably the result of some innocent confusion, but I want to clarify that only me, "loam", made the patches here. In the scope of these projects, I don't go by any other names on social media.

That is all. Download numbers are low, but I hope someone out there enjoyed the patches. Thanks!

Linux port comment here: https://forums.fuwanovel.net/topic/23163-ao-no-kanata-no-four-rythm-linux-port-18-patch-for-nintendo-switch/?tab=comments#comment-522629

Aokana - EXTRA1 Linux Port: https://forums.fuwanovel.net/topic/23163-linux-port-now-released-ao-no-kanata-no-four-rythm-linux-port-18-patch-for-nintendo-switch/page/2/?tab=comments#comment-523833

Switch patch:

Hello, I made this patch some days ago out of pure boredom just to see if my hacked switch with Aokana installed on it would be able to handle R18 assets and I thought about releasing for other people who still haven't played the game and would like to on their hacked switch, but uncut, since otherwise it would be forever stuck for no reason on my hard drive as I already completed the game on PC.

Keep in mind this only works with a Hacked Switch with Atmosphere. If you want to see if you can hack your switch follow this guide: https://nh-server.github.io/. The zip is premade so that, provided that you're using Atmosphere CFW (which you will if you finish carefully the guide there), you only have to unzip the contents of the patch to your SD card's root folder.

For other CFW users (not necessary if you already have atmosphere/followed the guide I linked previously): It may work with other CFWs, provided they can patch romfs. Just make sure the path is the same (romfs/Data/StreamingAssets/patch.dat). Atmosphere is the most popular though, so I only tested there.

The H-Scene button in the gallery replay menu, although blank in this release, still works, so if you unlocked some of them just click it.

This works with the Base version + Update 1.01. I'm not sure if future updates will break this, so keep that in mind. To know if the mod works correctly, you'll see "1.01 SW (R18+PE)" on the bottom right corner when it's loaded (it's usually "SW 1.01" only).
Screenshot (WARNING: NSFW):

Spoiler

2020082314134800-21FF5D1CB7E1FA5F8428357

M5n5jdN.jpg

 

xjxFDjb.jpg

Download link: http://www.mediafire.com/file/yf86ywni65n6ki8/file

Some technical details in the making of this patch which may be or not interesting:

  • This VN is made on a custom C# VN engine on top of Unity, made by NekoNyan. It's visibly made for reusability in the future, and according to some announcements it will be reused in future projects of them. It's very nicely done so kudos to them.
  • While .NET binaries in the PC are unobfuscated, the Switch port used IL2CPP, probably due to platform limitations.
  • Despite being in Unity, this engine loads content from a custom format instead of using Unity itself for them (not that it's a necessarily bad thing to do). It has some custom simple encryption, with the keys of the files themselves being inside of the archive. Other than that, it's just an archive with files and folders inside of it.
  • They slightly changed the encryption algorithm for the Switch version. While the PC format was easily readable by looking at decompiled C# code about how the PC version itself loads it, it was trickier to see how the switch loaded it because of the game being compiled to C++. That said, this cool tool helped me to locate the encryption function for the Switch, which turned out to be a simple 2 lines change. This change doesn't affect size nor performance so I can only imagine why they did this....
  • With that figured out, I had to make an (re/un)packer for this game to pack the R18 assets since it needed to use the switch format for it to work. I can release the source code and binaries if anybody's interested, just hit me up here or by email.
  • The switch version prefers different formats of its assets: swp (some Switch image format?) instead of webp, ogg vorbis instead of ogg opus, and some others. Even so, it supports loading all formats of the PC version.
  • The switch version contains voices for H-Scenes on the base game (except for the Perfect Edition H-Scenes), even though they go completely unused. This effectively lowers the size of this patch. Some trivial metadata for the replay gallery is still there, but goes unused because you never unlock any H-Scenes.
  • The binary as well as bs5 scripts (aokana's script format) still contains lots of code that handle R18 assets and scenes, if they somehow (heh) were to be available to the game, which facilitated this patch by a lot.
  • This engine made by NekoNyan is very well done and I hope to see more VNs localized by them on it :)

If you find a problem just let me know here or by email ([email protected]).

I hope you enjoy it! I know Nintendo won't....

Edited by loam
november 2021 message
Link to comment
Share on other sites

To me it's not like anyone who own Switch and can play adult content (18 or above) didn't own the PC anyway. While I'm sounds like not interested with your (Redundant) effort, I should appreciate it in that some people may prefer console to watch the sex scenes even though they might more than able to buy laptop that can play Aokana, so good job on that.

Edited by littleshogun
Link to comment
Share on other sites

Now you can listen to the cultured eroge moanings even in group of people.

Jokes aside, all I fear is Nintendo somehow finding about this and tracking it down. You must be careful with these projects, because it probably violates their rules. Also, they must be angry if people will show obscene scenes on their platform.

Link to comment
Share on other sites

29 minutes ago, [Hun]Lepto said:

Jokes aside, all I fear is Nintendo somehow finding about this and tracking it down. You must be careful with these projects, because it probably violates their rules. Also, they must be angry if people will show obscene scenes on their platform.

There is already decent amount of 18+ patches and nude mods for games (even Nintendo one, like SSBU, AC or Pokemon). Nintendo doesn't care about it.

Edited by ShinRaikdou
Link to comment
Share on other sites

13 hours ago, ShinRaikdou said:

There is already decent amount of 18+ patches and nude mods for games (even Nintendo one, like SSBU, AC or Pokemon). Nintendo doesn't care about it.

Strange, because they're mostly known for tracking down mods and projects and putting an end to them. Though again, it could be just that they don't really know about it yet.

Edited by [Hun]Lepto
Link to comment
Share on other sites

2 hours ago, [Hun]Lepto said:

Strange, because they're mostly known for tracking down mods and projects and putting an end to them. Though again, it could be just that they don't really know about it yet.

Do you mean fan remakes/remaster projects? Of course they'll put an end to them since it's potential money loss. It's not like Nintendo plan to release and sell 18+ patches.

Edited by ShinRaikdou
Link to comment
Share on other sites

7 hours ago, ShinRaikdou said:

Do you mean fan remakes/remaster projects? Of course they'll put an end to them since it's potential money loss. It's not like Nintendo plan to release and sell 18+ patches.

Not always, since some projects require you to buy the original game first. Also, yeah, if we think about it, 18+ patches don't really hurt their sales. But again, it would probably put a bad look on them if someone was to play an eroge in public while a sex scene happens, especially if it would be in something like news or something.

Link to comment
Share on other sites

Hello, thanks for the feedback you all. I know playing an eroge with sex scenes on the switch isn't very popular (lmao) but I appreciate nonetheless the appreciation you've shown. I want to address a few comments I've seen:

I've seen people on Discord concerned about nintendo finding out about the unused voice clips. Nintendo mainly doesn't care about some horny voice lines that haven't been used, and they only review the game itself, it's not like they'll dive into the game files or anything (they probably don't even have the time to unpack the files format and etc.). Somebody referenced the gta sa hot coffee situation but still, it's only audio, no explicit pictures or anything. Not even their staff seemed to care (i know some of them are already aware through discord, greetings to all the people from there :) ). The content you have to restore is still a big amount and any single thing about modding is something nintendo doesn't care. Just way too many hoops to jump off through to get hentai on the switch (Which in theory is already achievable without modding by using a dns trick to trick the switch into opening a browser for "authenticating"). I might have made it sound like if it were a big amount of waste but the voice files are pretty well compressed so it's a trivial amount.

About this patch itself, well, it was just something I did out of boredom, like a challenge to see how hard would it be (being myself a small-time developer with little experience in modding actual games alone by myself), I'm not expecting anyone to actually play it but it seemed to me the right thing was to release it for anybody that might find this useful. Besides, in theory, you can also download the adult patch for free without even actually owning the game, so there's that.

About the takedown part, this is a niche market, nintendo usually only care about first party IP. Some people probably already downloaded it so it won't be "effective", and if the download gets taken down, I'll get the memo and just disappear so ninty doesn't try to come after me lol. I rarely make such online releases so I like to see people appreciate it, it keeps me motivated to do similar stuff :)

Link to comment
Share on other sites

whoa , this is really brilliant , i am wondering if someone out there can make patch from pc to switch and you really made it , I really appreciate what you've done , thanks !

oh and i have question , can you make something like this to other vn too? maybe like if my heart had wings , grisaia or maitetsu . i know how to make the folder and the path , but is that all you just do? i know all about how this patch using LayeredFS to make it work and actually i just tried using nekonyan patch to my switch before but it didnt work lol , turns out that you can make something like this out of boredom is really cool . so yeah , can you apply pc patch to other switch game ? and all you just had to do is make the folder and correcting the path to make it works ?

Edited by Anixia
Link to comment
Share on other sites

On 8/30/2020 at 7:41 AM, Anixia said:

whoa , this is really brilliant , i am wondering if someone out there can make patch from pc to switch and you really made it , I really appreciate what you've done , thanks !

oh and i have question , can you make something like this to other vn too? maybe like if my heart had wings , grisaia or maitetsu . i know how to make the folder and the path , but is that all you just do? i know all about how this patch using LayeredFS to make it work and actually i just tried using nekonyan patch to my switch before but it didnt work lol , turns out that you can make something like this out of boredom is really cool . so yeah , can you apply pc patch to other switch game ? and all you just had to do is make the folder and correcting the path to make it works ?

To be honest, it really was helpful that the engine was written in C#/Unity, it made the stuff a lot easier since you can navigate through decompiled source easily (i hope this doesn't change lol). Usually I only reverse engineer stuff because of necessity (i run a server for an closed source mp mod for a game, also closed source). As for other vns, it might be harder since some (like maitetsu) use custom stuff like e-mote, and unlike Unity, I'm not very knowledgeable in KiriKiri stuff. That said, no promises, but I might take a peek into maitetsu since that one would be actually one that I haven't still played and looking forward to in some future.

In general, the difficulty depends on how the port was made, if the assets packaging is different (different formats or just different storage code with no apparent reason like here), and in that case, how difficult could it be to have to repack the assets.

Edited by loam
Link to comment
Share on other sites

Hi. I just happened to have a hacked switch with atmosphere and the game installed, so I gave your patch a go after finding about it on VNDB. Turns out it loads just well, thanks! This allows to benefit both from the convenience of a handheld console and the completeness of the PC version. Your act of pure boredom is much appreciated :)

I would not have thought that porting the patch would be so complex due to using different packing formats between the PC and Switch versions. The technical details part was an interesting read. Just a quick note about your zip file: there are two identical patch files inside, so you can reduce the archive size by removing one of them. Just extracting the "atmosphere" folder worked for me.

Also I think you should not worry that much about Nintendo because your patch is not for one of their first-party games nor a way to hack the console. And you're not providing the base game.

Link to comment
Share on other sites

10 hours ago, loam said:

To be honest, it really was helpful that the engine was written in C#/Unity, it made the stuff a lot easier since you can navigate through decompiled source easily (i hope this doesn't change lol). Usually I only reverse engineer stuff because of necessity (i run a server for an closed source mp mod for a game, also closed source). As for other vns, it might be harder since some (like maitetsu) use custom stuff like e-mote, and unlike Unity, I'm not very knowledgeable in KiriKiri stuff. That said, no promises, but I might take a peek into maitetsu since that one would be actually one that I haven't still played and looking forward to in some future.

In general, the difficulty depends on how the port was made, if the assets packaging is different (different formats or just different storage code with no apparent reason like here), and in that case, how difficult could it be to have to repack the assets.

and here i though the pc patch for another game is just moving the patch file into atmosphere folder like this one , turns out its really hard . thx for answering anyway and good luck if you try to patch maitetsu too , i'll be cheering you . having console when you can play uncensored game is really blessing 

Link to comment
Share on other sites

On 9/2/2020 at 10:24 PM, Windy3252 said:

Does this work with SX OS please?

I think it should, but you'll have to change the folder structure of the zip apparently. Try this:

  • Go to the "sxos" folder on the root of your sdcard, if it doesn't exist create it
  • Go to the "titles" folder inside the "sxos" folder. If it doesn't exist, create it
  • Open the Zip file and find the "0100990011866000" folder inside "atmosphere/contents" and drag it into the titles folder

The "0100990011866000" folder should be now inside the "titles" folder which is inside the "sxos" folder on the root of your sdcard (so the folder structure should be "sxos/titles/0100990011866000/[patch contents]"

Let me know if it works for you!

SX-OS is just an overrated and priced fork/clone of atmosphere which is free, I wouldn't use it but some must because of the mod chip I guess, I pity you if that's the case.

Link to comment
Share on other sites

I've been working on a patch to make it run on Linux natively (i.e. without Wine, an actual Linux executable) with the Linux build of UnityPlayer + patches to the code.

Images below (no actual spoilers, just to prevent from cluttering the post)

Spoiler

https://cdn.discordapp.com/attachments/685919437995769866/753035159820828792/Screenshot_from_2020-09-09_01-24-21.png

 

https://cdn.discordapp.com/attachments/685919437995769866/753035156729626644/Screenshot_from_2020-09-09_01-24-30.png

It works great so far, fixes some issues Wine apparently had (missing text on some parts), but it still has a couple of issues (no mp4 player on linux -> op/ed and chapter videos refuse to play so they have to be transcoded + some platform specific stuff stubbed for sake of testing) that need to be fixed before releasing this. Since it's Unity based and most of the code was platform independent, it was fairly easy (except for aokanaproc.dll for which I had to build a Linux replacement libaokanaproc.so for webp decoding, + savefile thumbnails refused to load because a raw texture was being converted to jpg using System.Drawing which only works on Windows officially, had to replace that with a Unity built-in one-liner texture2D.EncodeToJPG(), dunno why that other thing was being used). Expect a release in the following days!

Link to comment
Share on other sites

On 9/6/2020 at 4:53 PM, loam said:

I think it should, but you'll have to change the folder structure of the zip apparently. Try this:

  • Go to the "sxos" folder on the root of your sdcard, if it doesn't exist create it
  • Go to the "titles" folder inside the "sxos" folder. If it doesn't exist, create it
  • Open the Zip file and find the "0100990011866000" folder inside "atmosphere/contents" and drag it into the titles folder

The "0100990011866000" folder should be now inside the "titles" folder which is inside the "sxos" folder on the root of your sdcard (so the folder structure should be "sxos/titles/0100990011866000/[patch contents]"

Let me know if it works for you!

SX-OS is just an overrated and priced fork/clone of atmosphere which is free, I wouldn't use it but some must because of the mod chip I guess, I pity you if that's the case.

I discovered this graphical issue. Do you think there is any way it can be fixed? I am concerned that I will continue to see stuff like this as I progress. Please see the attached image. Also I have a patched switch so a mod chip is the only way I can get CFW. No need for pity sir I enjoy SX OS. Thank you.

Image: https://imgur.com/a/TNACj1r

Link to comment
Share on other sites

  • 2 weeks later...
On 9/10/2020 at 1:59 PM, Windy3252 said:

I discovered this graphical issue. Do you think there is any way it can be fixed? I am concerned that I will continue to see stuff like this as I progress. Please see the attached image. Also I have a patched switch so a mod chip is the only way I can get CFW. No need for pity sir I enjoy SX OS. Thank you.

Image: https://imgur.com/a/TNACj1r

Hello, sorry for the late response, as well as for the graphical issue. I could swear I tested this scene though, but I didn't test docked mode, are you using it? I'll look into this in these days.

Link to comment
Share on other sites

Hello, I've finished the Aokana for Linux patch:

This patch allows Aokana to run on Linux natively, without any compatibility software like Wine/Proton/etc. This eliminates most of the bugs related to these compatibility solutions and I guess it removes the overhead of such a compatibility layer if this was of any concern to you.

Videos had to be transcoded to webm (vp8/vorbis), because Linux can't play the already-present mp4 videos. The file sizes are very similar for English videos (~16mb bigger) and I didn't notice any visual deterioration. The Chinese videos on the other hand are around ~100MB smaller. You'll have to download them again for videos to work on Linux; the patch will take care of loading these instead. I uploaded these as separate downloads so people don't have to download videos for a language they might not speak. When using Japanese, the English videos are loaded instead (don't worry, the subtitles for the videos between chapters are saved somewhere else except for the opening - it's the same on the normal release)

About Steam Integration: I couldn't test it myself, but I provided the Linux equivalent of the library that the game tries to use for Steam, so it should work. Feedback about this would be appreciated.

The patch works on Windows too, in case you switch frequently between Windows and Linux. The patch will run the original windows code and will not suffer from the differences Linux has.

I also took the liberty to add a small extra feature: If you run the game with the Continue.bat/Continue.sh files on Windows or Linux respectively (or pass --continue as a command line arg, which is what these files do internally), it loads a special save file (a save not present on the load/save menu that gets saved everytime you exit the game; this save on exit functionality was already done by NekoNyan, but not used anywhere) immediately after starting the game, skipping the intro logos/movie and placing you right back where you were last time you played. No Title, no Main Menu. You should be able to try this out even if you've never used the patch before because of what was mentioned before.

Unfortunately it has a few but subtle/minor differences from the Windows version (explained why on the rundown further below):

  • Save thumbnail uses Unity-provided bilinear filtering (like the Switch version), which provides inferior quality compared to Windows' bicubic filtering.
  • Importing a background or saving an image using the Sprite Viewer won't work because Windows specific dialogs were used and no alternative was coded into this patch (at least for now).
  • Letterboxing (black bars on sides/bottom) will be present if you resize the window manually and it doesn't match the game's aspect ratio, unlike the Windows version which corrects itself.
  • The game's sound won't be paused when minimized, unlike the Windows version.
  • Apparently the game tries to set the cursor on Windows for things like prompts and the gallery. Even with the original windows game, I never saw this behaviour even though it should've worked (no idea why). In any case, this wasn't ported to Linux.

Downloads:
Main patch: http://www.mediafire.com/file/k02f4pb0ovxckn7/file

REMEMBER: Download the Linux-compatible videos for your language!
English videos (also used when the game is set to Japanese): http://www.mediafire.com/file/bhm65i1h9tx68yv/file
Simplified Chinese videos: http://www.mediafire.com/file/s3rai72u2je60t1/file
Traditional Chinese videos: http://www.mediafire.com/file/fsisjaibh73wc8v/file

 

Screenshots: (SFW)

Spoiler

QZBcCee.png

eYcAXyx.png

HbTP8pl.png

SPmUvup.png


Boring technical rundown:

Spoiler

 

This was relatively "easy" to do because of the fact that this VN in particular is using a custom in-house engine based on Unity, made by NekoNyan. It's written in C# (Unity's scripting API is mainly in C# for those that may not know) and it's highly portable since all the Platform specific stuff is either handled by Unity already or isolated and easy to change. UI and other stuff are loaded from files inside a custom format (which also includes the scripts), which means effort has been put into making this a repurpose-able engine for future projects (they have a few projects announced to be on their new engine as well). Porting it to Linux wasn't a walk in the park as all this would suggest though:

Fortunately, Aokana was built with Vulkan support (I've heard it solves some issues and runs faster for some). This is nice as no effort has to be done into porting DirectX shaders to Vulkan/OpenGL manually; some custom shaders are being used for some effects and since it gets built into a DirectX specific format by Unity when building, it would've required redoing those for Vulkan. Linux defaults to Vulkan for running the game as a result. OpenGL wasn't included on their build.

The script itself had to receive some changes to actually run on Linux. On the original Windows version, because Unity doesn't provide some stuff to manipulate the window freely, some stuff had to be done using the Windows API. On Linux, X11 (the most common window system) has a rather old and cumbersome API. Most use desktop environments which implement X11, but others might use Wayland, or who knows what. In theory they should also have a working X11 compatibility layer, but in practice this doesn't always work and tends to break. Anyways, I could've make the extra effort to port functionality but since it's just a couple of small features for an unofficial port I just didn't think it was worth the effort for now. This is the reason why minimizing detection, cursor moving made by the game and window size correction are missing in Linux. As for the file browser for saving images and importing backgrounds for the sprite viewer, it also used a Windows specific dialog. Like before, and being a kinda niche feature, I didn't implement a new cross-platform dialog for it, so it will not work at all, sorry if you were planning to use this.

One rather unexpected hurdle to go through was the usage of a custom native windows library called aokanaproc.dll, which took care of the resizing code and webp support: webp (an image format, a very good one) is used for almost every texture of the game. Because Unity doesn't support it, it had to be implemented in their custom native code. As a result I had to download and build a compatible library, libaokanaproc.so, which will do what aokanaproc.dll did on Windows, but on Linux (sans window resizing code).

As for the videos, it was very simple: mp4 not supported in Linux, so it needs another format, and between ogv and webm, webm seemed more favorable, so I went with webm (vp8 for video, vorbis for sound).

The save thumbnail quality issue: Windows specific code was being used (System.Drawing, which isn't officially supported by Unity but can be used nonetheless), which provided Bicubic filtering when downscaling the texture for the thumbnails. Unity doesn't provide a straightforward method for resizing textures, so some tinkering with textures in the code had to be done, and the best I could get was bilinear filtering which is provided by Unity. I believe the Switch version uses this since the quality is very similar, so I decided to leave it like that.

 

Overall this was fun to do, Unity is a very good engine when used the right way.

Any feedback is appreciated, and if the game gets updated I'll try to port any script changes to Linux again too.

I hope anyone that ends up using it enjoys it!

Edited by loam
fix typo
Link to comment
Share on other sites

8 hours ago, Windy3252 said:

I was using docked mode. Thank you.

I figured. The issue was that the PC targets 1440p, while the switch version targets 1080p, and scale textures accordingly on the screen. The packed hi-res assets as such were made with 1440p in mind for PC and 1080p for the switch. Using the 1440p assets on the switch caused stuff to scale incorrectly on the switch. I've resized all hi-res assets to 75% of their original sizes (1440 * 0.75 = 1080) so now they'll scale properly. The patch is also now smaller because of that (~52mb smaller).

I've updated the main post with more screenshots and the new download link.

New download link: http://www.mediafire.com/file/yf86ywni65n6ki8/file

Thanks for reporting!

Edited by loam
Link to comment
Share on other sites

5 hours ago, loam said:

I figured. The issue was that the PC targets 1440p, while the switch version targets 1080p, and scale textures accordingly on the screen. The packed hi-res assets as such were made with 1440p in mind for PC and 1080p for the switch. Using the 1440p assets on the switch caused stuff to scale incorrectly on the switch. I've resized all hi-res assets to 75% of their original sizes (1440 * 0.75 = 1080) so now they'll scale properly. The patch is also now smaller because of that (~52mb smaller).

I've updated the main post with more screenshots and the new download link.

New download link: http://www.mediafire.com/file/yf86ywni65n6ki8/file

Thanks for reporting!

Thank you so much! You rock.

Link to comment
Share on other sites

Thanks dude its a great work ! Switch it's pretty cool because instand of PC you can play anywhere easly.

Are the H-Scene only available on replay gallery or you can actually see thoses during story ?

Someone know if there is any other R18 patch for switch games ?

 

Link to comment
Share on other sites

7 hours ago, Kalkal said:

Thanks dude its a great work ! Switch it's pretty cool because instand of PC you can play anywhere easly.

Are the H-Scene only available on replay gallery or you can actually see thoses during story ?

Someone know if there is any other R18 patch for switch games ?

 

H-Scenes are part of the story, just like the PC version. The only exception is one additional Misaki H-Scene that gets unlocked after finishing her route.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...