Results 1 to 3 of 3
  1. #1
    Moderator Cyberman's Avatar
    Join Date
    Nov 2001
    Posts
    1,916
    Mentioned
    1 Post(s)

    modifying istream using streambuf overloading?

    This might be a bit on the odd side of things (scary enough it even has to do with emulation).
    I would like to be able to open 'files' in an ISO image for reading, my problem is I prefer to do this using NORMAL C++ stream operators.

    I've been reading this bit of information but it's a bit weak on the example side of things.
    I prefer to examine more complete code or have a more detailed explanation of something that provided.
    Mostly I want to use a stream buffer passed to an istream. that is streambuf created by a function copying the behaviour of fstream's open method.

    Anyhow anyone here over load ye olde stream buff (ever?)

    Cyb
    Progress (n.):
    The process through which the Internet has evolved from smart people in front of dumb terminals to dumb people in front of smart terminals.
    -------------------------------------------------------------------
    Recursive (adj):
    see Recursive

  2. #2
    Moderator smcd's Avatar
    Join Date
    Jun 2004
    Posts
    2,533
    Mentioned
    0 Post(s)
    I've done some very simple overloading the << in a class to be able to say std :: cout << myObject; but nothing as complex as trying to make the streams work on a file format. Where are you getting stuck?



    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  3. #3
    Moderator Cyberman's Avatar
    Join Date
    Nov 2001
    Posts
    1,916
    Mentioned
    1 Post(s)
    Quote Originally Posted by smcd View Post
    I've done some very simple overloading the << in a class to be able to say std :: cout << myObject; but nothing as complex as trying to make the streams work on a file format. Where are you getting stuck?
    Well let me put things in perspective

    Overloading various >> operators individually takes quite a bit of work. In fact repeating 30 or so operators is insane. Those operators work using a stream buffer for input why not over load the stream buffer object, using the same interface as all other C++ istream to it. You only then need to overload a couple virtual methods at least that's what it looks like. I think that is simpler and more portable.
    That is why I just want to overload a stream buffer instead.
    The operators then have no need to be overloaded (rewritten) and made buggy again (seriously), one can read formatted and raw data as much as one wants (it's going to be an istream only).
    I got the idea from this article on overloading a stream buffer for ostream.

    Now the reason for that is the overloaded ostream will be an object referencing a ISO image supporting both mode 1 and mode 2 (type 1 and 2). I'm working on the opendir, closedir etc methods on the iso object right now. By creating an iso_object that contains the image file and opening the file through the iso_object one can directly read data on the disk image as if one had mounted it.

    The 'fun' part is that I may have to repeat the same process AGAIN. For example FF8 has a container file system in the playstation version. The game data is contained in a single image. Picking off individual file data is a pain because the sector sizes vary between mode 1 and mode 2. So you have your 2048 'data' sectors and your 2304 video sectors and your 2304 audio (which really only uses 2048 ... sigh). All mashed together in one big mess. Being able to read the ACTUAL data that's there is important so I need something that gracefully handles 'what kind of data are we' looking at sector by sector while deciphering the 'single file mass' design Square used for FF8's data.

    That's kind of a simplification.

    Cyb
    Progress (n.):
    The process through which the Internet has evolved from smart people in front of dumb terminals to dumb people in front of smart terminals.
    -------------------------------------------------------------------
    Recursive (adj):
    see Recursive

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •