mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-25 00:55:24 +02:00
Add FileInt.pos method
This commit is contained in:
parent
8f4489ef70
commit
fbcca152f1
1 changed files with 13 additions and 1 deletions
|
@ -130,6 +130,14 @@ RB_METHOD(fileIntBinmode)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(fileIntPos)
|
||||
{
|
||||
SDL_RWops *ops = getPrivateData<SDL_RWops>(self);
|
||||
|
||||
long long pos = SDL_RWtell(ops); // Will return -1 if it doesn't work
|
||||
return LL2NUM(pos);
|
||||
}
|
||||
|
||||
VALUE
|
||||
kernelLoadDataInt(const char *filename, bool rubyExc)
|
||||
{
|
||||
|
@ -227,8 +235,12 @@ fileIntBindingInit()
|
|||
|
||||
_rb_define_method(klass, "read", fileIntRead);
|
||||
_rb_define_method(klass, "getbyte", fileIntGetByte);
|
||||
#ifdef OLD_RUBY // Marshal looks for 'getc', not 'getbyte'
|
||||
#ifdef OLD_RUBY
|
||||
// Ruby doesn't see this as an initialized stream,
|
||||
// so either that has to be fixed or necessary
|
||||
// IO functions have to be overridden
|
||||
rb_define_alias(klass, "getc", "getbyte");
|
||||
_rb_define_method(klass, "pos", fileIntPos);
|
||||
#endif
|
||||
_rb_define_method(klass, "binmode", fileIntBinmode);
|
||||
_rb_define_method(klass, "close", fileIntClose);
|
||||
|
|
Loading…
Add table
Reference in a new issue