Jump to content



Photo
- - - - -

What Code Can I Add Before Add-In Code To Have A Blank Screen Until A


  • Please log in to reply
14 replies to this topic

#1 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 14 March 2016 - 06:26 PM

I want to add some code before the source of an add-in I have installed so that once the add-in is ran there is a blank screen - until I press something. Can anyone suggest what I could do?

 

If this isn't possible can anyone suggest something similar that I could do?

 

Thanks.



#2 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 98 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 17 March 2016 - 08:26 AM

It depends on how they coded their add-in.

To do this, it would be helpful to have some knowledge of the C language.

You will need to find the main loop, which usually calls the functions for the input and display handling.

It usually looks something like this (not exactly, as this will definitely vary from program to program):

while(true){

    clear_screen();

    draw_stuff();

    update_stuff();

}

Then insert a while loop before the main loop code that will clear the screen(making it a blank screen) and check for input, and if the chosen button is pressed down than break out of the loop and continue with the program as normal.


Edited by Viliami, 20 March 2016 - 06:58 AM.


#3 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 19 March 2016 - 09:08 PM

This is the one:

https://sourceforge....s/edit-fx9860g/

 

I tried looking for what you said, but I found it in numerous places throughout the code so I am unsure what to do.



#4 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 98 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 20 March 2016 - 06:55 AM

The main loop is located in the "EDIT.c" file and it starts on line 418.

This is what line 416-421 looks like:

//Main loop
    iExit=0;
    do{
       
      //Inititializations
      iRefresh=0;

As you can see, there is a comment at the top stating that it is the main loop, it is a do-while loop instead of a while loop, they are basically the same except do-while loops will always run once first and then check whether the statement evaluates to true or not. e.g

int c = 0;
do{

     c = -1;

}while(c > 1);

The above code will only run once and then stop because -1 is not bigger than 1. If it was a while loop instead, it wouldn't even run once as it will check if (c > 1) before the code within the while loop is run.

 

You will need to add your code before line 418.


Edited by Viliami, 20 March 2016 - 06:57 AM.


#5 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 24 March 2016 - 11:12 PM

The main loop is located in the "EDIT.c" file and it starts on line 418.

This is what line 416-421 looks like:

//Main loop
    iExit=0;
    do{
       
      //Inititializations
      iRefresh=0;

As you can see, there is a comment at the top stating that it is the main loop, it is a do-while loop instead of a while loop, they are basically the same except do-while loops will always run once first and then check whether the statement evaluates to true or not. e.g

int c = 0;
do{

     c = -1;

}while(c > 1);

The above code will only run once and then stop because -1 is not bigger than 1. If it was a while loop instead, it wouldn't even run once as it will check if (c > 1) before the code within the while loop is run.

 

You will need to add your code before line 418.

 

Ah, I was confused because there were multiple comments saying Main Loop in the EDIT.c file. Now I just need to figure out what code to put before it. Can you help? Or point me to some resources that will help me learn? Thanks.



#6 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 98 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 27 March 2016 - 02:13 PM

Insert this:

int foo;
while (1) {
    GetKey( &foo );                                        //wait until a key is pressed
    if(foo == /*insert specific key code here*/){          //check if the key pressed is the same as the key you had in mind
        break;                                             //break out of the loop
    }
}

The key code of the button can be found out by reading the documentation on the Casio website or on the calculator by making a BASIC program that displays the key codes, and then run it on your calculator and press the buttons to find out their key codes.

A BASIC program like this:

Lbl 1
GetKey->A
Locate 1,1,A
Goto 1

I haven't tested out the programs yet, so there might be some syntax errors.


Edited by Viliami, 12 April 2016 - 12:18 AM.


#7 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 12 April 2016 - 12:09 AM

Insert this:

int foo;
while (1) {
    GetKey( &foo );                                        //wait until a key is pressed
    if(foo == /*insert specific key code here*/){          //check if the key pressed is the same as the key you had in mind
        break;                                             //break out of the loop
    }
}

The key code of the button can be found out by reading the documentation on the casio website or on the calculator by making a BASIC program that displays the key codes, and then run it on your calculator and press the buttons to find out their keycodes.

A BASIC program like this:

Lbl 1
GetKey->A
Locate 1,1,A
Goto 1

I haven't tested out the programs yet, so there mught be some syntax errors.

 

Hi, this isn't working for me. Build unsuccessful.

E:\EDIT\EDIT\EDIT.c(416) : C2500 (E) Illegal token "int"
E:\EDIT\EDIT\EDIT.c(416) : C2225 (E) Undeclared name "foo"
E:\EDIT\EDIT\EDIT.c(418) : C1016 (W) Argument mismatch

Can you help me?



#8 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 98 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 12 April 2016 - 12:16 AM

Does it have any errors or warnings before that?

Can you copy and paste the full error and warnings log?



#9 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 12 April 2016 - 12:42 AM

Does it have any errors or warnings before that?

Can you copy and paste the full error and warnings log?

 

Here is the full error log:


Executing Hitachi SH C/C++ Compiler/Assembler phase

set SHC_INC=E:\CASIO\fx-9860G SDK\OS\SH\include
set PATH=E:\CASIO\fx-9860G SDK\OS\SH\bin
set SHC_LIB=E:\CASIO\fx-9860G SDK\OS\SH\bin
set SHC_TMP=E:\EDIT\EDIT\Debug
"E:\CASIO\fx-9860G SDK\OS\SH\bin\shc.exe" -subcommand=C:\Users\J\AppData\Local\Temp\hmk336B.tmp
E:\EDIT\EDIT\EDIT.c(416) : C2500 (E) Illegal token "int"
E:\EDIT\EDIT\EDIT.c(416) : C2225 (E) Undeclared name "foo"
E:\EDIT\EDIT\EDIT.c(418) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1764) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1767) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1768) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1772) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1774) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1783) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1805) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1813) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1814) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1829) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1831) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1832) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1837) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1859) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1860) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1860) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1866) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1868) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1869) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1874) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1893) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1898) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1899) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1899) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1906) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1908) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1921) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(1923) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(2051) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(2054) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(2064) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(2820) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(2821) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(3900) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(3944) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(3947) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(3949) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4021) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4056) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4151) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4159) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4170) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4235) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4263) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4264) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4271) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4316) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4336) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4432) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4433) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4434) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4486) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4489) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4490) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4493) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4494) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4495) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4498) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4499) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4500) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4501) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4504) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4505) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4506) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4507) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4508) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4554) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4555) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4556) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4557) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4562) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4563) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4564) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4598) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4599) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4644) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4645) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4690) : C1016 (W) Argument mismatch
E:\EDIT\EDIT\EDIT.c(4691) : C1016 (W) Argument mismatch

HMAKE MAKE UTILITY Ver. 1.1
Copyright (C) Hitachi Micro Systems Europe Ltd. 1998
Copyright (C) Hitachi Ltd. 1998 


	ERROR: Process failed with return code: 1
Build was not successful.

Here is how I incorporated what you said into my code, in case I did it wrong:

 

1f6hnvG.png



#10 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 98 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 12 April 2016 - 01:06 AM

Move the "int foo" line up near the top of the program and make sure it is within global scope. The error may be caused because you cannot declare it there.


Edited by Viliami, 12 April 2016 - 01:07 AM.


#11 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 12 April 2016 - 01:20 AM

Move the "int foo" line up near the top of the program and make sure it is within global scope. The error may be caused because you cannot declare it there.

 

Moved the int foo and the build was successful - but the program opens as normal without requiring me to press a key. Could this be due to where I put the int foo or where I put the rest of the code? Thanks for the quick responses! Much appreciated. 



#12 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 98 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 12 April 2016 - 10:04 PM

Did you choose to use the key code for the "EXE" button?

Because the EXE button is used to open the program, and using the EXE button will skip through the loop straight away and the program will run normally.

 

You need to use a key code other than the "EXE" button if that's the case. Maybe F1 or a number key.



#13 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 17 April 2016 - 06:01 PM

Did you choose to use the key code for the "EXE" button?

Because the EXE button is used to open the program, and using the EXE button will skip through the loop straight away and the program will run normally.

 

You need to use a key code other than the "EXE" button if that's the case. Maybe F1 or a number key.

No I did KEY_CHAR_DP which I believe is the decimal point.



#14 Viliami

Viliami

    Casio Addict

  • Moderator
  • PipPipPip
  • 98 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:C++ - OpenGL,SDL
    Python - Pygame
    Java - SFML
    C - Casio SDK

  • Calculators:
    FX-9750 GII upgraded to FX-9860 GII

Posted 23 April 2016 - 03:53 AM

I have just tried to do it myself, and turns out I sent you to the wrong main loop! There are apparently two main loops the first one calls the second one, and we inserted the code before the second one, just move the code up before line 307 instead and it should work properly. I have got it to compile and run correctly on my laptop.

    while(1){
    	
    	GetKey(&foo);
    	if(foo == KEY_CHAR_DP){
    		break;
    	}
    }
    
    //Main loop
    do{
      
      //Select file
      Explorer(EXPLOREROPEN,sRoot,sFolder,sFile,&sConfig,&iNew);
      
      //Start editor
      Editor(sRoot,sFolder,sFile,iNew,&sConfig);
      
    }while(1);
    

  • JMEHRPR likes this

#15 JMEHRPR

JMEHRPR

    Newbie

  • Members
  • Pip
  • 12 posts

Posted 18 May 2016 - 02:17 PM

 

I have just tried to do it myself, and turns out I sent you to the wrong main loop! There are apparently two main loops the first one calls the second one, and we inserted the code before the second one, just move the code up before line 307 instead and it should work properly. I have got it to compile and run correctly on my laptop.

    while(1){
    	
    	GetKey(&foo);
    	if(foo == KEY_CHAR_DP){
    		break;
    	}
    }
    
    //Main loop
    do{
      
      //Select file
      Explorer(EXPLOREROPEN,sRoot,sFolder,sFile,&sConfig,&iNew);
      
      //Start editor
      Editor(sRoot,sFolder,sFile,iNew,&sConfig);
      
    }while(1);
    

Thank you Viliami! Your help does not go unappreciated. 


  • Viliami likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users