[Release] Kuriimu - A general purpose game translation toolkit for authors of fan translations.

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by IcySon55, Dec 8, 2016.

  1. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Seems like there might be a save and/or loading bug. Send me files that work files that don't and edited files that don't work. Label them as such using folders.
     


  2. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Hey there tempers,

    In this update we've got a few bug fixes, and some cool new features!
    • game_maple_story_3ds - A new plugin for the MapleStory 3DS game co-authored by @CakeLancelot @IcySon55 and @Neobeo.
    • BCFNT - A BCFNT file handler by @Neobeo that allows preview plugins to load actual game fonts directly for generating their previews.
    • JMSG has been patched to properly support the variations on the format.
    • The editor no longer causes the preview to update when keys are pressed in the textbox but the text hasn't changed. (Speedup)
    • The previewer code has been significantly sped up by some enhancements that @Neobeo made.
    • An early UI has been put together for an image converter and previewer called Kukki.
    The new BCFNT handler and MapleStory 3DS preview plugin working together to generate the image below. Since we have the actual game font supported, we can also render the Japanese characters!

    [​IMG]
     
    Last edited by IcySon55, Jan 27, 2017
  3. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Good evening fellow tempers,

    In this update, we introduce Kukkii!

    [​IMG]

    Kukkii is going to be an image format converter and previewer with batch functionality.

    Recent changes in the beta include:
    • Kukkii - See above. It currently does not perform any batch functions and cannot save any files yet. It can however already preview and export the two supported formats to PNG.
    • game_daigasso_band_brothers_p - A game handler plugin by @Neobeo.
    • game_time_travelers - A game handler plugin by @onepiecefreak.
    • image_bclim - A Kukkii image adapter for the common BCLIM format by @Neobeo.
    • image_xi - A Kukkii image adapter for the uncommon XI format used in Level 5 games by @onepiecefreak and @Neobeo.
    • In Kuriimu it is now possible to save the preview image as a PNG.
    • In Kuriimu you can now select your preferred font family and size for the edit and original text boxes.
    • Lots of code cleanup and bug fixes.
    Enjoy~
     
    Last edited by IcySon55, Feb 8, 2017
    ZeroHunta and Arubaro like this.
  4. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Quick update:

    The just recently released beta can now open, import and save BCLIM image files.
    • Kukkii now has Batch Export for both BCLIM and XI simultaneously.
    • The BCLIM adapter can now save!
    • It is possible to import a modified image by opening a BCLIM and then dragging and dropping a PNG to be imported. Standard file open dialog to follow in next update.
    Enjoy~
     
  5. Ryuzaki_MrL

    Ryuzaki_MrL Furry Addict

    Member
    728
    702
    Jun 23, 2015
    Brazil
    @IcySon55 How can I write a plugin for Kukkii? I've been working on a fantranslation of Zelda ALBW to portuguese since mid-2016, and a ALBW plugin would be very helpful.
     
  6. onepiecefreak

    onepiecefreak The Special One

    Member
    370
    122
    Aug 12, 2015
    Gambia, The
    You can use other plugins already written to have an overview of needed functions and variables.
    However a documentation will be created soon.
     
  7. _Shebang

    _Shebang Member

    Newcomer
    49
    34
    Dec 14, 2016
    Canada
    Couple of questions after briefly looking over the source:
    1. If you are looking to update the preview image every time the text is changed, why not subscribe to the TextBox's TextChanged event? That way you don't have to manage any string comparison yourself.
    2. I noticed that you aren't loading your preview image asynchronously, which could cause some hanging if all the processing is being done in the UI thread. You can solve this with a couple of options:
    • You could rewrite the preview generation and updating functions to run asynchronously using the new async / await pattern from .NET 4.5. This is objectively more work than the next option, but it will be worthwhile to write functions and methods that can take a while as asynchronous, because then you can keep the code a bit cleaner, make custom events for better interaction between plugins and the main application, etc.
    • You could simply import System.Threading.Tasks, and then change UpdatePreview(); to be Task.Run(() => UpdatePreview());, and it will automatically run without hanging the UI. However, as I haven't tested with your code it's possible this could cause issues you need to check for, such as if a second update is triggered in the middle of a previous update.
    I would make a PR myself, however I don't really have any material to test with where I am and I'm not completely familiar with the codebase.
     
    Last edited by _Shebang, Feb 10, 2017
  8. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    All good suggestions.

    I haven't toyed with threading all that much other than the Fenceposts extension but it's always a pain in rear to handle it properly. Granted the preview generation happens quite quickly and we haven't seen much in the way of slowdown. (Excepting huge piles of text.)

    I'll likely run this by @Neobeo as I'm not too well versed with threading, especially with async/await. I don't understand how that pattern works at all. Don't have a mental picture of it... (even though I passed the C# certification which includes async/await, I have no idea how to apply it)
     
  9. _Shebang

    _Shebang Member

    Newcomer
    49
    34
    Dec 14, 2016
    Canada
    Ah, it's pretty easy! I seem to remember asynchronous programming was a headache and a half before this came out. Here's an example:

    Say you had a form that needed to download a file from somewhere, and then display the hex bytes for the user to be able to view them, along with some other things in the middle and afterwards. If you had this action happen on a button press, you might do something along the lines of (in pseudo-code):

    Code:
    byte[] GetNecessaryFile() {
        var file = DownloadFile("http://myfilehosted.here/");
        return file;
    }
    
    void Button_Click(object sender, EventArgs e) {
        var bytes = GetNecessaryFile();
        // maybe some other actions here
        hexViewer.SetBytes(bytes);
        // more actions once loaded
    }
    Depending on the size of the file and the internet speed, the form could hang for quite some time. So, you can implement async / await. You would make each of your functions async by using the async keyword, and make your GetNecessaryFile function return a Task. This will have added benefits, because if you have to do tasks in the meantime that won't hang the main form, you can do it while the file is downloading, and wait to proceed further, like so:

    Code:
    async Task<byte[]> GetNecessaryFileAsync() {
        var file = await DownloadFileAsync("http://myfilehosted.here/"); // will assume this exists because it probably does
        return file;
    }
    
    async void Button_Click(object sender, EventArgs e) {
        var bytes = GetNecessaryFileAsync(); // this is a task, so it will start running but won't return anything yet
        // maybe some other actions here that don't depend on those bytes
        hexViewer.SetBytes(await bytes); // this causes execution to pause while it waits for the file to download if it isn't done yet
        // more actions once loaded that continue after the file is done downloading
    }
    
    Does that make sense? I guess the main idea is to use this when you are doing something that will take a long time. I would define long time as causing a noticeable hang on the form (third of a second or so). It's generally used for I/O operations and network communication.
     
  10. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Let's see if I can implement it for the preview.

    Oh boy, mixing async/await with interfaces... this is not going well.

    Nope, I can't implement this pattern at all. It has way too many requirements just to get it to compile.

    Code:
    async Task<Bitmap> GeneratePreviewAsync() {
        var preview = new Bitmap();
    
        return preview; // It breaks here because Bitmap doesn't implement 'GetAwaiter'.
    }
     
    Last edited by IcySon55, Feb 10, 2017
  11. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    What types of files are you looking to edit? Kuriimu deals with the text files in games as well as preview generation. Kukkii deals with image formats in games.
     
  12. Ryuzaki_MrL

    Ryuzaki_MrL Furry Addict

    Member
    728
    702
    Jun 23, 2015
    Brazil
    Text files (.msbt)
    I'm currently using your MSBT Editor, but it's a pain to mount the romFS, copy to SD card, run NTRCFW, then run the game, sometimes having to use cheats to reach the point where the text is displayed, just to check if there's no text overflow. A preview plugin for ALBW would solve this.
     
  13. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Right, so what you will want to do is look at the MapleStory game plugin for a good example of how to write a game plugin.

    Pre-setup:
    1. Extract the various images from the game for displaying the textbox. Depending on their format, Kukkii might be able to help here. (only BCLIM and XI support for the moment)
    2. Extract the game font file(s) to be included as well. These can be BCFNT or BFFNT (we have a BF to BC font converter)
    3. Take a decent number of screenshots using NTR so that you have good templates to use for linnig up your previewer.
    Plugin writing:
    1. Pull down a copy of the Kuriimu Git repo to your computer.
    2. Create a new Class Library project in Visual Studio 2015 called "game_zelda_a_link_between_worlds".
    3. Adjust the various project settings to match up with all of the other game plugins.
      1. Build output directory for both Debug and Release.
      2. Assembly Information
      3. Add a Settings object and the usual settings entries.
    4. Take a look at the Handler.cs from Maple Story 3DS' plugin for a good example of implementing your plugin.
    5. Adjust the handler code so that it produces the desired results.
    6. Note that the main namespace you have to reference is KuriimuContract for a plugin to be successfully loaded by the programs. (Again look at existing plugins for examples)
    If you don't know C# or can't program then you'll have to look for someone with a bit of time to help you out. Sadly I'm swamped with getting all of the other features into these programs. Precisely why I wrote them with plugins, to offload some of the work. Good luck!
     
    lgnmcrules likes this.
  14. _Shebang

    _Shebang Member

    Newcomer
    49
    34
    Dec 14, 2016
    Canada
    You could always try making a synchronous thread and then calling with a Task:

    Code:
    Task.Run(() => GeneratePreview()).Result;
    However, from a bit of Google research it seems that the Bitmap class is extremely annoying about requiring a lock so that only one thread can use it at a time, so your mileage may vary.
     
  15. Beat_

    Beat_ GBAtemp Regular

    Member
    131
    7
    Mar 24, 2015
    I can't seem to be able to open the program?
     
  16. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Before you extract the .rar, right click properties and unblock it. Then extract it.
     
    Last edited by IcySon55, Feb 14, 2017
  17. Beat_

    Beat_ GBAtemp Regular

    Member
    131
    7
    Mar 24, 2015
    Thank you.
     
  18. IcySon55
    OP

    IcySon55 GBAtemp Fan

    Member
    310
    264
    Mar 18, 2008
    Canada
    Hello again tempers,

    In this update, Kukkii gets Batch Import and a new supported format, JTEX!

    [​IMG]

    Recent changes in the beta include:
    • In Kuriimu it is now possible to Batch Import PNGs into their paired image formats. If you used Batch Export then the files will already be named correctly.
    • Thanks a ton to @Neobeo who corrected the BCLIM and BFLIM class for saving imported images correctly.
    • image_jtex - A JTEX plugin for Kukkii written by @IcySon55 and @Neobeo.
    Enjoy~
     
    Last edited by IcySon55, Feb 14, 2017
  19. pikatsu

    pikatsu GBAtemp Advanced Fan

    Member
    715
    123
    Apr 16, 2014
    Argentina
    Great work !!!
     
  20. Sliter

    Sliter GBAtemp Addict

    Member
    2,915
    748
    Dec 7, 2013
    Brazil
    ㊙️
    this is very awesome! Great work!
    This would be nice for pokemon games too, mainly for graphic and font editing (as if a language need to have some different characters), maybe for text editing can m merged with XY text? Is a great tool we have for the text editing, the only thing I think it could be improve was a text box simulation
    if I could help here in some way, I would like to (I don't know programming x3x I'm just the graphic artist and translator lol)
     
    Last edited by Sliter, Feb 15, 2017