1 2 3
16 17
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Okay, that seems horribly complicated. Oh the irony. Here's my code for UTF8 to UCS4 conversion:
#include <string>
#include <vector>

/* So much code for so little meaning. This is so called purity. */
class SeqResult
{
    bool     Bool;
    unsigned Length;
    unsigned Value;
    int ShiftType;
    
public:
    SeqResult(): Bool(false), Length(),Value(),ShiftType() { }
    SeqResult(bool v) : Bool(v), Length(),Value(),ShiftType() { }
    SeqResult(bool v, unsigned len) : Bool(v), Length(len), Value(),ShiftType() { }
    SeqResult(bool v, unsigned len, unsigned val) : Bool(v), Length(len), Value(val), ShiftType() { }
    SeqResult(int seq, unsigned len): Bool(true), Length(len), Value(), ShiftType(seq) { }
    
    operator bool() const { return Bool; }
    
    unsigned GetLength() const { return Length; }
    unsigned GetValue() const { return Value; }
    int GetShiftType() const { return ShiftType; }
    
    void SetBool(bool b) { Bool = b; }
    void SetLength(unsigned l) { Length = l; }
    void SetValue(unsigned n) { Value = n; }
    void SetShift(int s) { ShiftType = s; }
};

namespace UTF8
{
    void SeqValue(std::string& result, wchar_t ch, int&)
    {
        const unsigned n = ch;
        if(n < 0x80)                 // <=7 bits
            result += (char)n;
        else
        {
            if(n < 0x800)            // <11>>6));
            else
            {
                if(n < 0x10000)      // <16>>12));
                else                 // <21>>18));
                    result += (char)(0x80 + ((n>>12)&63));
                }
                result += (char)(0x80 + ((n>>6)&63));
            }
            result += (char)(0x80 + (n&63));
        }
    }

    const SeqResult IsData(const std::string& input, unsigned pos, int)
    {
        /* This must be the most obfuscated UTF-8 decoder I have seen.
         * I tried to avoid having many hardcoded magical numbers. -Bisqwit
         */
        unsigned char headbyte = input[pos];
        
        /* How many bytes does each sequence take? */
        static const char sizes[16] =
        { 1,1,1,1,1,1,1,1,   
          0,0,0,0,2,2,3,4 };
        
        /* What is the minimum value of the given sequence? */
        static const unsigned minimums[4] = { 0, 0x80, 0x800, 0x10000 };
        /* How to mask bits from the first byte */
        static const char     masks[4]    = { 0x7F, 0x1F, 0x0F, 0x07 };
        
        unsigned len = sizes[headbyte >> 4];
        
        //fprintf(stderr, "UTF-8 in: %c -> len=%u\n", (char)headbyte, len);
        
        /* Ensure it wasn't an invalid sequence */
        if(len == 0) return false;
        /* Ensure we have enough bytes */
        if(pos+len > input.size()) return false;
        
        unsigned result=0, shl=0;
        
        /* Process the tail bytes - last to first. */
        for(unsigned n = len; --n > 0; )
        {
            unsigned char byte = input[pos+n];
            
            //fprintf(stderr, "byte %u: %02X\n", n, byte);
            
            // The tail bytes must be 10xxxxxx
            if((byte & 0xC0) != 0x80) return false;
            
            unsigned bits = byte & 0x3F;
            result |= bits << shl;
            shl += 6;
        }
        
        /* Process the head byte. */
        // The top bits have already been verified in sizes[].
        // Take the low bits.
        unsigned bits = headbyte & masks[len-1];
        result |= bits << shl;
        
        if(result < minimums[len-1])
        {
            /* Non-optimal coding - not likely valid. */
            return false;
        }

        //fprintf(stderr, "UTF-8 in: %.*s -> %X\n", len, input.c_str()+pos, result);
        
        return SeqResult(true, len, result);
    }
}

void UTF8toUCS4(const std::string& input,
                std::vector<unsigned>& result)
{
    for(std::string::size_type pos = 0; pos < input.size(); )
    {
        SeqResult r = UTF8::IsData(input, pos, 0);
        if(r)
        {
            result.push_back(r.GetValue());
            pos += r.GetLength();
        }
        else
        {
            result.push_back('?');
            ++pos;
        }
    }
}

void UCS4toUTF8(const std::vector<unsigned>& input,
                std::string& result)
{
    for(std::string::size_type pos = 0; pos < input.size(); ++pos)
    {
        int shift;
        UTF8::SeqValue(result, input[pos], shift);
    }
}
I've got simpler code too, but this is very robust code that handles all kinds of error situations neatly and is suitably well commented.
Banned User
Joined: 12/23/2004
Posts: 1850
Another strange bug. Possibly unicode related? :|
Perma-banned
Former player
Joined: 12/5/2007
Posts: 716
I've been talking to adelikat about this quite some time ago. My theory is that the path exceeds 255 bytes in length. One way to test this would be to put the ROM directly at your root directory (C:\game.nes) and trying to load to it from this path. Other than this, all I can say is that Unicode-named ROMs work perfectly fine with the SDL build.
gocha
Any
Emulator Coder, Former player
Joined: 6/21/2006
Posts: 401
Location: Japan, Nagoya
Man, I can provide a very simple script which crashes FCEUX!
emu = FCEU
The reason isn't complex at all, but I couldn't notice it for several minutes. *FCEUX crashes at the lua_getfield(L, -1, "OnClose") line. I personally like emu.registerexit() rather than emu.OnClose table. Edit: oh... I hadn't noticed the bugtrack page on SF.net.
I am usually available on Discord server or Twitter.
Former player
Joined: 12/5/2007
Posts: 716
FatRatKnight: Your bug has been solved on SDL as well. I assume adelikat will release 2.1.1 later today to address this issue.
Post subject: 2.1.0a release announcement
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Ok, this issue has been fixed and a new release has been made: http://fceux.com/web/htdocs/ Anyone who TASes NEEDS to download this new fceux. If you were having the large .fm2 issue here are the steps to remedy it: *open your .fm2 with wordpad (or some text editor) *delete all the extra characters in the author field *save your .fm2 Your Savestates that are tied to this movie will still be slow until you overwrite them with new ones. Thanks to FatRatKnight and FerretWarlord for helping me diagnose this bug.
It's hard to look this good. My TAS projects
Active player (437)
Joined: 4/21/2004
Posts: 3517
Location: Stockholm, Sweden
I've had it with this emulator. 4 times, I've tased Drill Man in Mega Man 4. It never saved my progress. There really aint much to describe, it simply doesnt save my progress.. I am using fceux 2.0.4-interim
Nitrogenesis wrote:
Guys I come from the DidyKnogRacist communite, and you are all wrong, tihs is the run of the mileniun and everyone who says otherwise dosnt know any bater! I found this run vary ease to masturbate too!!!! Don't fuck with me, I know this game so that mean I'm always right!StupedfackincommunityTASVideoz!!!!!!
Arc wrote:
I enjoyed this movie in which hands firmly gripping a shaft lead to balls deep in multiple holes.
natt wrote:
I don't want to get involved in this discussion, but as a point of fact C# is literally the first goddamn thing on that fucking page you linked did you even fucking read it
Cooljay wrote:
Mayor Haggar and Cody are such nice people for the community. Metro City's hospitals reached an all time new record of incoming patients due to their great efforts :P
Former player
Joined: 12/5/2007
Posts: 716
Obvious question: have you tried 2.1.0a?
Active player (437)
Joined: 4/21/2004
Posts: 3517
Location: Stockholm, Sweden
ShinyDoofy wrote:
Obvious question: have you tried 2.1.0a?
No because that version solely aims to address the issue with files being too big. But I did download it and the problem remains.
Nitrogenesis wrote:
Guys I come from the DidyKnogRacist communite, and you are all wrong, tihs is the run of the mileniun and everyone who says otherwise dosnt know any bater! I found this run vary ease to masturbate too!!!! Don't fuck with me, I know this game so that mean I'm always right!StupedfackincommunityTASVideoz!!!!!!
Arc wrote:
I enjoyed this movie in which hands firmly gripping a shaft lead to balls deep in multiple holes.
natt wrote:
I don't want to get involved in this discussion, but as a point of fact C# is literally the first goddamn thing on that fucking page you linked did you even fucking read it
Cooljay wrote:
Mayor Haggar and Cody are such nice people for the community. Metro City's hospitals reached an all time new record of incoming patients due to their great efforts :P
Joined: 5/29/2004
Posts: 757
Wow, right off the hop I have an issue with this. I hit the tab key to temporarily speed up a video and it went to 6400% playback speed and would NOT move from there. If I loaded a new rom or whatever, the problem persists until I literally shut her down and start over again or I hit the = key... which is damned annoying since just holding down tab for a few seconds and releasing has the same effect. :( Mr. Kelly R. Flewin
Mr. Kelly R. Flewin Just another random gamer ---- <OmnipotentEntity> How do you people get bored in the span of 10 seconds? Worst ADD ever.
Banned User
Joined: 12/23/2004
Posts: 1850
Mr. Kelly R. Flewin wrote:
Wow, right off the hop I have an issue with this. I hit the tab key to temporarily speed up a video and it went to 6400% playback speed and would NOT move from there. If I loaded a new rom or whatever, the problem persists until I literally shut her down and start over again or I hit the = key... which is damned annoying since just holding down tab for a few seconds and releasing has the same effect. :(
Fix your hotkeys. One of the devlopers added an "Exit" hotkey (as opposed to, you know, Alt-F4), which bumped all the old associatons. That would mean "tab" is now fastest speed, and = is "normal speed". Everything below "Exit" is probably off by one as well, so you should take some time to fix that.
Perma-banned
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
What Xkeeper said. Also, I mentioned this in my release announcement post :P And again, I apologize for that annoyance. I had to play politics with that decision.
It's hard to look this good. My TAS projects
Former player
Joined: 12/5/2007
Posts: 716
Some users of the SDL build (namely those compiling it without Lua support) were unable to use any input all. This is now finally fixed in the latest SVN revision.
Active player (328)
Joined: 2/23/2005
Posts: 786
I have not been experiencing any of the crashing issues with 2.1.0a. So far. I know this has been mentioned elsewhere, but I'll bring it up again. Can there be a way to control how often the auto-save saves?
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Glad those random crashes are gone for you! And no, there is no way to control how often auto-save works. That wouldn't be a hard thing to implement (I think) if you are asking as a feature request.
It's hard to look this good. My TAS projects
Active player (328)
Joined: 2/23/2005
Posts: 786
Yeah, it would be great as a new feature. I know you can rig up lua to do some auto-saves of your own, but since it's integrated into the emulator itself (and rightly so, it's a great general tool), I think it should at least be customizable. As-is, it's pretty useless for TASing, though I have found it useful sometimes when playing in real time. Also, I got a crash again today when I was spamming the frame advance key. Dang. I should try running FCEUX in the IDE and see if it breaks on the error.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
CtrlAltDestroy wrote:
Dang. I should try running FCEUX in the IDE and see if it breaks on the error.
Yes please! And I will add auto-save customizeability to the todo list.
It's hard to look this good. My TAS projects
Editor, Emulator Coder, Expert player (2156)
Joined: 5/22/2007
Posts: 1134
Location: Glitchvania
Uh, my question about performance: Why does FCEUX 2.10a become even more sluggish than Dega, Snes9x, Gen, VBA etc. every time some background programs hog my out-dated CPU? I know Snes9x is an extremely optimized monster that isn't supposed to compare with, but I don't think FCEUX should run slower than most of other emulators.
<klmz> it reminds me of that people used to keep quoting adelikat's IRC statements in the old good days <adelikat> no doubt <adelikat> klmz, they still do
Player (206)
Joined: 5/29/2004
Posts: 5712
Isn't there an option to give FCEU priority over other applications?
put yourself in my rocketpack if that poochie is one outrageous dude
Editor, Emulator Coder, Expert player (2156)
Joined: 5/22/2007
Posts: 1134
Location: Glitchvania
Bag of Magic Food wrote:
Isn't there an option to give FCEU priority over other applications?
That's the workaround (using task manager to set the priority). Still I hope the performance can be improved in future releases. EDIT: Guess I'll stick to FCEU 0.98.28. It runs much better.
<klmz> it reminds me of that people used to keep quoting adelikat's IRC statements in the old good days <adelikat> no doubt <adelikat> klmz, they still do
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Go to config > sound and select low quality sound. Go to config > video and uncheck "Disable hardware acceleration". Btw, there is a troubleshooting section in the FCEUX help menu that mentions this.
It's hard to look this good. My TAS projects
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
I seem to have encountered a problem involving subtitles. Namely, subtitles from an earlier movie are not getting properly cleared when playing a new movie. The only workaround I've noticed is to completely close down FCEUX then run it again from scratch. This problem became quite pronounced when subtitling my Magician movie. Often, I want to run the game while fixing up subtitles in WordPad to see how it would look. The changes didn't show correctly until after I restart FCEUX. For whatever reason, I have two versions of my Magician movie, where the only difference is the subtitles. I ran the old version first, with its first message at frame 550. Then I played the submitted version where it doesn't have the same messages. The same message from the old movie showed up while playing the new movie, at the same frame. I think that shouldn't happen, since there isn't a subtitle at frame 550 in the new movie. Closing FCEUX, re-opening it, then playing the new movie first thing does not have this oddity. Now, I make a test movie, test1. I put down a few subtitles, at frames 50, 150, 250, and 350. Restart FCEUX, then play it. They show properly. I edit the movie file, then play it again without restart. The edits: Messages are inserted at frames 10, 100, and 400, and the message at 250 is removed. I do not see the added messages at 10 or 400, but 100 shows fine. I still see the message at 250, despite the fact I removed it from the fc2 file. At this point, it's simply a matter of convenience -- The workaround is to close the FCEUX emulation completely then start it up again. All problems involving subtitles go away when I do this. Then again, it appears to be a bug, and should be brought to your attention. As for why I didn't bring this up earlier, like around the time I submitted my Magician run, when I ran into the problem... That would be a mistake on my part. Laziness, perhaps?
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
I appreciate you bringing it to our attention. Actually though, I was already aware of this problem when I did my Double Dragon 2 subtitles. Closing the emulator everytime is not that convenient but it works. I guess the whole idea of subtitles is becoming popular enough so I need to work on making it more convenient. What is happening (I think) is that the subtitle & comments vector are not getting cleared when a movie stops playing. Either that is easy to fix, or it will be a true pain. When the code was written it wasn't intended to be messed with in this way.
It's hard to look this good. My TAS projects
Former player
Joined: 12/5/2007
Posts: 716
This seems to be a win32-only bug as it doesn't happen on SDL. Every time a movie is loaded, the variable holding all the information (ASCII header, subtitles, input and so on) is freshly created in movie.cpp (currMovieData = MovieData();). Maybe the win32 build is using a static variable instead?
Skilled player (1827)
Joined: 4/20/2005
Posts: 2161
Location: Norrköping, Sweden
I'm wondering if there's a way to adjust the position of a comment I've added to a movie-file, for example, if I want a certain comment to appear in the top right corner instead of the usual top left corner. If not, this might be a nice feature.
1 2 3
16 17