ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan_BSL.c
(Generate patch)

Comparing Daodan/src/Daodan_BSL.c (file contents):
Revision 837 by alloc, Mon Apr 29 15:26:54 2013 UTC vs.
Revision 839 by alloc, Mon Apr 29 19:08:16 2013 UTC

# Line 662 | Line 662 | uint16_t ONICALL bsl_sprintf(sl_callinfo
662                  formatnum++;
663                  
664          }
665        //strcpy( output, args[0].value_str32 );
665  
666          for(i = 1; i < numargs; i++)    {
667                  //sprintf(output, output, args[i].value_str32);
# Line 675 | Line 674 | uint16_t ONICALL bsl_sprintf(sl_callinfo
674                          sprintf(output, buffer, args[i].val.value_int32);
675                          break;
676                  case sl_float:
677 <                        //crashes oni, why?
679 <                //      sprintf(output, output, args[i].val.value_float);
677 >                        sprintf(output, buffer, args[i].val.value_float);
678                          break;
679                  case sl_str32:
680                          sprintf(output, buffer, args[i].val.value_str32);
# Line 686 | Line 684 | uint16_t ONICALL bsl_sprintf(sl_callinfo
684                          break;
685                  }      
686          }
689        //output[32] = 0;
687          ret->val.value_str32 = output;
688          ret->type = sl_str32;
689          return 0;
690   }
691  
695 //Sorry rossy, I broke this. FFI isnt in windows
696 /*
697 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
698 {
699        
700        
701                int ffi_ret;
702        char* str = NULL;
703        int size = 0;
704        
705        ffi_cif cif;
706        ffi_type* ffi_args[256];
707        void* values[256];
708        int i;
709                numargs = 0;
710        for(i = 0; args[i].type <= sl_void; i++)
711        {
712                //DDrConsole_PrintF("%i", args[i].type );
713                numargs++;
714
715        }
716
717        if (numargs < 1 || args[0].type != sl_str32)
718        {
719                DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": parameter list does not match: format:string arg1 arg2 ...", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name);
720                return 0;
721        }
722        
723        if (!args[0].value_str32)
724                args[0].value_str32 = "";
725        
726        
727        
728        ffi_args[0] = &ffi_type_pointer;
729        values[0] = &str;
730        ffi_args[1] = &ffi_type_uint32;
731        values[1] = &size;
732        
733
734        for(i = 2; i < numargs + 2; i ++)
735        {
736                if (args[i - 2].type == sl_float)
737                {
738                        float value_float = args[i - 2].value_float;
739                        double* value_double = (double*)&(args[i - 2]);
740                        *value_double = value_float;
741                        
742                        ffi_args[i] = &ffi_type_double;
743                        values[i] = value_double;
744                }
745                else
746                {
747                        ffi_args[i] = &ffi_type_pointer;
748                        values[i] = &(args[i - 2].value);
749                }
750        }
751        
752        if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, i, &ffi_type_sint32, ffi_args) != FFI_OK)
753                return 1;
754        ffi_call(&cif, (void*)_snprintf, (void*)&ffi_ret, values);
755        str = malloc(ffi_ret + 1);
756        size = ffi_ret + 1;
757        ffi_call(&cif, (void*)_snprintf, (void*)&ffi_ret, values);
758        ret->value_str32 = str;
759        ret->type = sl_str32;
760        return 0;
761 }
762 */
692   // Widescreen patch for talking heads.
693   uint16_t ONICALL cinematic_start_patch(sl_callinfo* callinfo, unsigned int numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
694   {
# Line 767 | Line 696 | uint16_t ONICALL cinematic_start_patch(s
696          return ((sl_func)(OniExe + 0x000f3830))(callinfo, numargs, args, dontuse1, dontuse2, ret);
697   }
698  
699 + /*
700   bool ini_inbsl = false;
701   bool SLrIniCallback(char* section, bool newsection, char* name, char* value)
702   {
703 <        if (newsection && !_stricmp(section, "bsl"))
704 <                ini_inbsl = true;
703 >        if (newsection)
704 >                ini_inbsl = !_stricmp(section, "bsl");
705          
706          if (ini_inbsl)
707          {
# Line 857 | Line 787 | void SLrConfig()
787          inifile_read("daodan.ini", SLrIniCallback);
788          DDrStartupMessage("Daodan: Finished parsing");
789   }
790 + */
791  
792   void ONICALL SLrDaodan_Register_ReturnType(char* name, char* desc, char* argfmt, sl_type type, sl_func callback) {
793          char argfmt2[512];
# Line 891 | Line 822 | uint16_t ONICALL new_text(sl_callinfo* c
822  
823   void SLrDaodan_Initialize()
824   {
825 <        SLrConfig();
825 > //      SLrConfig();
826  
827          SLrScript_Command_Register_Void("debug_daodan","Adds text to screen", "", new_text);
828  
# Line 927 | Line 858 | void SLrDaodan_Initialize()
858          SLrScript_Command_Register_ReturnType("d_dprint", "Prints to console in color", "", sl_void, bsl_dprintcolored);
859   }
860  
861 + // Patch for cinematic_start to work on widescreen resolutions
862   void SLrDaodan_Patch()
863   {
864          DDrPatch_Int32((int*)(OniExe + 0x000f3755), (int)cinematic_start_patch);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)