# SIFAC
Love Live! School idol festival ~after school ACTIVITY~ (ラブライブ！スクールアイドルフェスティバル ~after school ACTIVITY~) is an arcade version of Love Live! School idol festival. It was first announced to be in production on November 27, 2015 and was made available for play on December 6, 2016.

Aqours was first announced to be added to the game on October 20, 2017. Aqours was added to the game with the Love Live! School Idol Festival: After School Activity Next Stage update on December 6, 2018. It was announced on October 26, 2020 that the game will receive a final update on November 10, 2020. No new songs or cards will be added passed that point, essentially ending support for the arcade version.

On October 10th 2020, it was announced that a port to the Playstation 4, titled Love Live! School idol festival ~after school ACTIVITY~ WaiWai! Home Meeting!!  was in development. This version of the game was also announced with English language support, notably being the first iteration of the game to be released outside of Japan and in another language. It was released worldwide on March 24th 2021.

# How to Play
Obtaining the game files for this is gray area due to the copyright restriction playing an old arcade game entails. If you agree with me, you'd think this is total BS and want to play things that are considered dead or EoS even after the matter. Archival and preservation are the main motivators here, not money or business!

1. I do not suggest looking on a certain site called nyaa.si or of similar origin as it will contain the borderline illegal method of getting the game
2. Once the game files are obtained. (From a dump of the arcade machine or of other methods) extract them or decrypt the virtual hard disk (ask around for help if you need this method).
3. The binary you want to run will be `ll3.exe`, but don't run it yet! There are some command line arguments that you can run it with to change how it acts:

### CLI Arguments
`-highquality`: Runs the game with higher quality graphics. Not really sure if this makes a huge difference or not. 

`-centralmode`: Enables a specific game mode designed for the gacha version, where players obtain randomized virtual items.

`-windowmode` or `-singlemode`: Runs the game in a resizable window instead of full-screen mode, useful for debugging or testing.

`-sh` (screen height): Sets the desired vertical size or resolution of the game window.

`-sw` (screen width): Sets the desired horizontal size or resolution of the game window.

`-wx`: Controls the horizontal position of the game window, specifying where the left edge of the window will be positioned.

`-wy`: Controls the vertical position of the game window, specifying where the top edge of the window will be positioned.

## Running The game
### Offline Mode
1. Once you've setup a `.bat` script in that directory to run the game, open it. Example below:
>```bat
ll3.exe -singlemode -sw 1920 -sh 1080 -highquality
>```
2. Launch the batch file and the game should open. Ensure you have the correct patched file(s) for the functionality you want to unlock. By default, the game will be capable of running in 'Free Play' mode (activate through the test configuration page). This allows for some gameplay (play up to a certain amount of songs per session, not all songs are unlocked). The machine *can* scan cards if a user has them. From my understanding, it doesn't need a network to do this. 

### Online Mode (currently being worked on)

For online mode, you will need some more files (which I don't believe are easy to get via the site you should not go to). Here is a download link for this file structure:

[../files/system.zip](../files/system.zip)

Next, make a `D:\` drive (you can partition your `C:\` drive) and directory to have the following file tree:

```
(Assume this is under the `D:\` root)
├── system
│   ├── CmdFile
│   │   └── log
│   │       └── Log.txt
│   ├── DUA
│   │   ├── data
│   │   ├── decrypt
│   │   ├── download
│   │   ├── event
│   │   ├── news
│   │   │   ├── 1524476664.png
│   │   │   └── 1554282603.png
│   │   ├── unpack
│   │   └── work
│   ├── option.txt
│   ├── Service
│   │   └── NesysService.exe
│   └── update.log
```
(The most important file is the `NesysService.exe` as this is what the game uses to call between the game server and the game)

After that step, edit your arcade machine's hosts file:

>Usually under:
`C:\Windows\System32\drivers\etc\hosts`
```
127.0.0.1 cert.nesys.jp
127.0.0.1 cert3.nesys.jp
127.0.0.1 data.nesys.jp
127.0.0.1 proxy.nesys.jp
127.0.0.1 nesys.taito.co.jp
127.0.0.1 fjm170920zero.nesica.net
```
MAKE SURE NOT TO ADD HASHTAGS TO THESE LINES!
(If its the same PC, just leave it as `127.0.0.1` if its a different PC on your network, replace it with the IP address)

Once your computer resolves the domains to where ever you host the game server, we need to add some registry entries to enable the NesysService to run.

Run the following file:

[../files/runme.reg](../files/runme.reg)

Finally, you'll need to make nesys an *actual* Windows service (one that you would find in `services.msc`). Download and run this command to add it (assuming your `service` directory is found in `D:\`). This is all tested for `D:\`.

[../files/nesys.bat](../files/nesys.bat)

If you don't want to create a service, you're also able to run `NesysService.exe` in powershell or cmd. Just follow these steps:

- Make sure you open powershell or cmd as administrator
- Run this first (so you can debug it if it gives you an error):
  - `chcp 932`
- Then run the exe as so:
  - `D:\system\Service\NesysService.exe -app`

If it outputs the following then you're good to go!

![image-20230716133155441](../images/nesys-good.png)

If it outputs something else, then you didn't install the registry values correctly!

(todo, add a picture here as an example)

### Certificates
The last step to this would be adding certificates. It is not an easy process, but asesidaa made a script that should do it for you.

You can find the script to install the scripts in here:
[https://github.com/asesidaa/LLServer/tree/master/LLServer/Certificates](https://github.com/asesidaa/LLServer/tree/master/LLServer/Certificates)

Make sure to run the script as administrator. ([you might need to enable powershell script running exception](https://superuser.com/questions/106360/how-to-enable-execution-of-powershell-scripts#106363))

Enter this command in an administrator powershell window:

`set-executionpolicy remotesigned`

If the script doesn't work, you just need to have the certs in the 'Personal' store and the 'Root Trust ...' store (I forget the full name). After that you shouldn't get any nesys HTTP errors (it should just connect).

(On Japanese Locale, I think the 'Personal' store is also called the 'My' store)

If the server isn't compiled already, you'll need Visual Studio Community edition, link for easy access [here](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false).
Make sure you set it up with basic .NET functionality. (It should install the things it needs if you don't select the right one so don't worry too much).

Then if you haven't already, download the LLServer repo:
[https://github.com/asesidaa/LLServer/archive/refs/heads/master.zip](https://github.com/asesidaa/LLServer)

To run that, all you need to do is open the `.sln` file in Visual Studio. Then click the green `HTTPS` button!

### Network Interfaces

NesysService will require you to have a single interface enabled (and the other ones disabled) in order for it to connect correctly. Make sure you only have one network interface enabled like the picture below:


![image-20230716133155441](../images/interfaces.png)


### Patched Binary

Lastly you will need the patched binary with the correct public key. This key is used to confirm that it's talking to the right server. 

Download it here:

[../files/ll3.exe](../files/ll3.exe)

FYI, you will need to replace the original binary with this one. 



Please message `@caretchara` on the Discord if anything here needs changes!
