Coding new stuff for LCD addons

Discussion of XBMC4XBOX development.
Post Reply
psyko_chewbacca
Posts: 211
Joined: Fri Oct 05, 2012 5:19 pm
Location: Québec, Canada
Has thanked: 21 times
Been thanked: 122 times

Coding new stuff for LCD addons

Post by psyko_chewbacca » Wed Sep 30, 2015 6:52 pm

Hi there, I want to add some stuff to XBMC4Xbox but I'd like some input from the devs before finalizing and committing everything.

First, I added XBlast modchip detection capability in "CSysInfo::SmartXXModCHIP()" method.
XBlast modchips use the same IO address to report their ID as SmartXX modchips except they generate a 8-bit value (whereas SmartXX only generate a 4-bit).
Since I used the same logic as SmartXX to ID their modchip, I thought it would not be that relevant to code an entirely separate method for detecting an XBlast modchip.
The updated code of the method first retreive the whole byte from 0xF701, check against known values from XBlast modchips and either returns the proper string if found. If no XBlast modchip is found, the same byte is ANDed with 0xF and then checked against known values from SmartXX modchips; just like before.

Here's the new code:

Code: Select all

CStdString CSysInfo::SmartXXModCHIP()
{
  // SmartXX ModChip Detection
  unsigned char uSmartXX_ID = _inp(0xf701);
  
  if( uSmartXX_ID == 0x11 )
	return "Aladdin XBlast";
  else if( uSmartXX_ID == 0x15 )
	  return "XBlast Lite V1";

  uSmartXX_ID &= 0xf;

  if ( uSmartXX_ID == 1 )      // SmartXX V1+V2
    return "SmartXX V1/V2";
  else if ( uSmartXX_ID == 2 ) // SmartXX V1+V2
    return "SmartXX V1/V2";
  else if ( uSmartXX_ID == 5 ) // SmartXX OPX
    return "SmartXX OPX";
  else if ( uSmartXX_ID == 8 ) // SmartXX V3
    return "SmartXX V3";
  else 
    return "None";
}
Is this OK or would it be better to have XBlast modchip detection in it's dedicated method?


Secondly, I added proper LCD support in XBMC4Xbox. XBlast LCD uses almost the same logic as SmartXX LCD and so I created a CXBlastLCD class that inherits from CSmartXXLCD class instead of ILCD and overloaded the relevant methods.
The result is a very small class that depends on CSmartXXLCD class. Seeing that this code is in the library portion of the project, would it be preferable to have the CXBlastLCD class inherit directly from ILCD without any dependency on CSmartXXLCD instead?

Finally, I took the liberty to add a new feature called "Power Off On Exit" in the LCD settings. When set to "true" it will turn OFF the LCD when XBMC quits. If set to "false" it will simply display "Playing <name of xbe>". This feature is available to all types of modchips that support LCD (Xenium, SmartXX, Xecuter 3 and XBlast) and have their proper "shutdown" implementation in their Stop() method.
Where should I keep the boolean variable that holds the setting. Currently it's held as a private member of ILCD class and have the traditional "Set/Get" methods that are called when populating the setting (XBMC launch and setting change by user) and quitting the program. Should this setting value be held in the CAdvancedSettings class instead of ILCD?

Side question, should I hide this new setting entry in the GUI menu if there's an entry (let's say "<lcdpoweroffonexit>" set in an "advancedsettings.xml" file?

Thanks

fxmech
Posts: 673
Joined: Wed Aug 01, 2012 9:15 am
Has thanked: 37 times
Been thanked: 46 times

Re: Coding new stuff for LCD addons

Post by fxmech » Fri Oct 09, 2015 4:34 am

Happy to read about your work on this. I am kind of disappointed in the capability of LCD library as it stands.

The shutdown on exit feature will be nice.

psyko_chewbacca
Posts: 211
Joined: Fri Oct 05, 2012 5:19 pm
Location: Québec, Canada
Has thanked: 21 times
Been thanked: 122 times

Re: Coding new stuff for LCD addons

Post by psyko_chewbacca » Fri Oct 09, 2015 1:05 pm

fxmech wrote:I am kind of disappointed in the capability of LCD library as it stands.
What would you like to see it do?
Make feature requests on the project bugtracker and I'll see if I can get assigned to them!

User avatar
professor_jonny
Posts: 1229
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 54 times
Been thanked: 173 times

Re: Coding new stuff for LCD addons

Post by professor_jonny » Sat Oct 10, 2015 8:45 am

maybe a few suggestions:

I all way's wanted a slow fade then brighten feature on the lcd.

automatic dimming at a specified time like a night time mode.

graphic equaliser/ milksop for your lcd ?

two line emulation mode, say if you have a two line display it will swap between the top and bottom two lines periodically.

startup/ shutdown logo picture.

game start logo/ picture or custom text

User avatar
BuZz
Site Admin
Posts: 1889
Joined: Wed Jul 04, 2012 12:50 am
Location: UK
Has thanked: 62 times
Been thanked: 421 times
Contact:

Re: Coding new stuff for LCD addons

Post by BuZz » Mon Oct 12, 2015 4:44 pm

The code looks ok to me at first glance. You can submit a patch on redmine and I will include it when I can. In regards to the settings I guess it is fine as it is currently, but we can go over details on redmine if I have any questions. thanks.

psyko_chewbacca
Posts: 211
Joined: Fri Oct 05, 2012 5:19 pm
Location: Québec, Canada
Has thanked: 21 times
Been thanked: 122 times

Re: Coding new stuff for LCD addons

Post by psyko_chewbacca » Tue Oct 13, 2015 12:25 pm

BuZz wrote:The code looks ok to me at first glance. You can submit a patch on redmine and I will include it when I can. In regards to the settings I guess it is fine as it is currently, but we can go over details on redmine if I have any questions. thanks.
I have created 3 issues on redmine with attached patch files. I tried to separate all the stuff I changed as much as possible (I initially skipped the part about having one patch per feature/issue...). Two of them were filed as "bug" instead of feature by mistake. I did not found how to change this so I left them like that.

Here are the 3 issues:
http://redmine.exotica.org.uk/issues/346
http://redmine.exotica.org.uk/issues/347
http://redmine.exotica.org.uk/issues/348

Is it the proper way to do it? I haven't found any dedicated place to submit patches.

professor_jonny wrote:maybe a few suggestions:

I all way's wanted a slow fade then brighten feature on the lcd.

automatic dimming at a specified time like a night time mode.

graphic equaliser/ milksop for your lcd ?

two line emulation mode, say if you have a two line display it will swap between the top and bottom two lines periodically.

startup/ shutdown logo picture.

game start logo/ picture or custom text
Those are definitely good ideas.

I guess I could code a monochrome bitmap decoder. Details could be discussed in a created issue on redmine.
The way I see it is there could be both an intro splash and (default)exit splash. Folders containing launchable XBEs could all have a bmp file with a fixed filename that gets displayed on the LCD when launching it. The only issue with displaying a raster/bitmap on these LCD is the fact that all pixels are grouped in 5x7 rectangles with notable space between them. Displaying a big logo that takes most of the screen space could look ugly.

2 lines emulation could be taken care of using some sort of bouncing vertical scrolling. The only issue with this would be big number displays (like when on screensaver). I'd have to disable vertical scrolling while in screen saver.

For Equalizer or Vu meter, the issue here is the refresh rate. All the LCD stuff is in it's own dedicated thread and to my knowledge, it is very very low priority (Hey, we all want smooth video playback so let's keep them precious CPU cycles where it really matters!). You can probably see this issue when using 3-4 lines high numbers in the clock when in screensaver mode. Sometimes the seconds digit gets refreshed in a weird way; much like they don't have time to get fully drawn before the next second comes in. At a quick glance, it doesn't seem to be a coding error; granted there could be some optimization made in the LCD handling code.

For all that's dimming and changing backlight intensity automatically, you'll have to describe in details what you envision as I am not sure what you mean.

User avatar
xman
Posts: 1286
Joined: Wed Jul 04, 2012 2:30 pm
Location: Sydney, Australia
Has thanked: 55 times
Been thanked: 167 times

Re: Coding new stuff for LCD addons

Post by xman » Tue Oct 13, 2015 3:40 pm

When I had a display machine I found it useless how it just kept scrolling the same info continuously. I think the info should all be shown but how about swapping from one form of info to another like "movie title" for so long and then full screen "time" for X amount of time and then on to movie title again and so on. Just a thought. Really my true wish would be to have the time displayed full time when the machine is off because after doing many of my clock mods to Xbox face plates, I found the machine so much more useful even if it was simply just having a humble clock fitted but you need full time power to do that and the LCD will not work without the whole machine powered up. Just in case you aren't aware of one of my clock mods, here's a picture.
Image

The backlight is on when the machine is off as well. I powered the clock module off 2 X AA batteries because I wanted the time to be correct even when the machine was unplugged but the back light is powered of the 3.3 or 5vDC standby power.

OW PJ,
I Love VU meters. I have something you may be interested in very shortly. It is due by the 16th of this month and the time to fit it to the machine of coarse but all good things take time I guess. I just hope it looks and works as good in practice as it does in my head if you know what I mean. ;)

User avatar
professor_jonny
Posts: 1229
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 54 times
Been thanked: 173 times

Re: Coding new stuff for LCD addons

Post by professor_jonny » Tue Oct 13, 2015 7:28 pm

@xman The xblast currently is not capable of driving the lcd on its own so there will be no ability to have a clock when the system is powered off, but yes vu meters are cool that was along the lines of what I was thinking but I'd rather play movies than have a fancy vu meter if it is going to take needed resources from out cpu!!!

@Ben for the auto dimming when the xbox is busy copying files etc you have no way on knowing from looking externally unless you have a hdd led as the display goes into stand by with the four line clock if the display brightened and dimmed in a slow fade in fade out it would be cool and give you indication it is still doing its thing, as a sleep/ screensaver display it would be quite cool also.

if in stand by on a two line emulated display if it switched to a single line clock display I guess that would fix the 4 line problem.

the grouping of the pixels in 5*7 is a problem but in your delux chip with a micro and a oled display you could use the icons embedded in the xbe's for display on the lcd, I know it is staring in the future a bit but it would be a cool idea.

User avatar
professor_jonny
Posts: 1229
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 54 times
Been thanked: 173 times

Re: Coding new stuff for LCD addons

Post by professor_jonny » Tue Oct 13, 2015 7:32 pm

@xman displaying an rss news feed on the display would fix the same info being displayed on the lcd you could pick a few news feeds and swap them from time to time I guess that could be a possibility?

User avatar
xman
Posts: 1286
Joined: Wed Jul 04, 2012 2:30 pm
Location: Sydney, Australia
Has thanked: 55 times
Been thanked: 167 times

Re: Coding new stuff for LCD addons

Post by xman » Wed Oct 14, 2015 2:43 am

professor_jonny wrote: but yes vu meters are cool that was along the lines of what I was thinking but I'd rather play movies than have a fancy vu meter if it is going to take needed resources from out cpu!!!
The movies is an issue I was looking at some kind of work around for. I want the VU to run only when playing music and music videos. The best I have thought is to control the VU meter operation using the front LED colour meaning if the LED colour is set to green, the VU meter is on, change it to red and the VU meter is off. I asked on the forum for a possible software solution to automatically change the LED colour but had no bites. I imagine it would require more a skin mod rather than XBMC itself but basically it would need to change the front LED colour when the machine is asked to do the two different states and then I could use the LED drives to turn the VU meter on and off. The big problem there is music is in the music folder and music videos are in the video or movie folder. However I could create a separate folder that has only music videos I guess. The VU meter is a complete stand alone by the way using the right and left channel of the stereo sound as the signal and powered off the machine's 5vDC although the whole setup is inside the machine itself so no drain on the machine's processing power.

psyko_chewbacca
Posts: 211
Joined: Fri Oct 05, 2012 5:19 pm
Location: Québec, Canada
Has thanked: 21 times
Been thanked: 122 times

Re: Coding new stuff for LCD addons

Post by psyko_chewbacca » Tue Dec 01, 2015 6:18 pm

I see the patches I submitted in issues 346, 347 and 348 are still not integrated. Is there something wrong with these?

Is there another place to submit diff patches?

User avatar
BuZz
Site Admin
Posts: 1889
Joined: Wed Jul 04, 2012 12:50 am
Location: UK
Has thanked: 62 times
Been thanked: 421 times
Contact:

Re: Coding new stuff for LCD addons

Post by BuZz » Wed Dec 02, 2015 11:49 am

I've just not had time to do any development recently, but I will get round to them before the next release. Apologies for the delay but I have a lot of things on at the moment.

psyko_chewbacca
Posts: 211
Joined: Fri Oct 05, 2012 5:19 pm
Location: Québec, Canada
Has thanked: 21 times
Been thanked: 122 times

Re: Coding new stuff for LCD addons

Post by psyko_chewbacca » Mon Dec 07, 2015 5:27 pm

No problem at all!

I was just worried I might have submitted them in the wrong place.

BarryZon
Posts: 10
Joined: Wed Jun 26, 2019 9:49 pm
Location: United Kingdom
Been thanked: 2 times
Contact:

Coding new stuff for LCD addons

Post by BarryZon » Sat Jul 06, 2019 9:52 am

Totally sweet
Well done on the coding, love to hear about new stuff, especially from scratch.
Im sure you will get a response regarding testers here.
Top marks.

Post Reply